- Community Home
- >
- Networking
- >
- Software Defined Networking
- >
- Creating a Java FlowMod for 1.3 DataPath
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2014 02:32 PM
03-20-2014 02:32 PM
Creating a Java FlowMod for 1.3 DataPath
If I have an OF 1.0 action that looks something like this:
Action action = ActionFactory.createAction( ProtocolVersion.V_1_0, ActionType.OUTPUT, Port.NORMAL );
I have tried to create an Instruction for 1.3 but only get this far:
Instruction instruction = Instruction.createInstruction(ProtocolVersion.V_1_3, ...
I've lost my way in JavaDocs.
Could someone provide and example of an OF 1.3 FlowMod or point me in the correct direction?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2014 03:00 AM
03-24-2014 03:00 AM
Re: Creating a Java FlowMod for 1.3 DataPath
Hello RGBD,
The following listing shows an example of how to create a flowmod message:
Flowmod Message Example:
public class SampleFlowModMessageCreation {
private static final ProtocolVersion PV = ProtocolVersion.V_1_3;
private static final long COOKIE = 0x00002468;
private static final TableId TABLE_ID = TableId.valueOf(200);
private static final int FLOW_IDLE_TIMEOUT = 300;
private static final int FLOW_HARD_TIMEOUT = 600;
private static final int FLOW_PRIORITY = 50;
private static final BufferId BUFFER_ID = BufferId.NO_BUFFER;
private static final Set<FlowModFlag> FLAGS = EnumSet.of(FlowModFlag.SEND_FLOW_REM, FlowModFlag.CHECK_OVERLAP, FlowModFlag.NO_BYTE_COUNTS);
private static final MacAddress MAC =MacAddress.valueOf("00001e:000000");
private static final MacAddress MAC_MASK =MacAddress.valueOf("ffffff:000000");
private static final PortNumber SMTP_PORT = PortNumber.valueOf(25);
private static final MacAddress MAC_DEST = MacAddress.BROADCAST;
private static final IpAddress IP_DEST = IpAddress.LOOPBACK_IPv4;
private OfmFlowMod sampleFlowModCreation() {
// Create a 1.3 FlowMod ADD message...
OfmMutableFlowMod fm = (OfmMutableFlowMod) MessageFactory.create(PV, MessageType.FLOW_MOD, FlowModCommand.ADD);
// NOTE: outPort = ANY and outGroup = ANY by default so we don’t have
// to explicitly set them.
fm.cookie(COOKIE).tableId(TABLE_ID).priority(FLOW_PRIORITY).idleTimeout(FLOW_IDLE_TIMEOUT).hardTimeout(FLOW_HARD_TIMEOUT).bufferId(BUFFER_ID).flowModFlags(FLAGS).match(createMatch());
for (Instruction ins: createInstructions())
fm.addInstruction(ins);
return (OfmFlowMod) fm.toImmutable();
}
private Match
createMatch() {
// NOTE static imports of:
//
com.hp.of.lib.match.FieldFactory.createBasicField;
//
com.hp.of.lib.match.OxmBasicFieldType.*;
MutableMatch mm = MatchFactory.createMatch(PV).addField(createBasicField(PV, ETH_SRC, MAC, MAC_MASK)).addField(createBasicField(PV, ETH_TYPE, EthernetType.IPv4)).addField(createBasicField(PV, IP_PROTO, IpProtocol.TCP)).addField(createBasicField(PV, TCP_DST, SMTP_PORT));
return (Match) mm.toImmutable();
}
private static final long INS_META_MASK = 0xffff0000;
private static final long INS_META_DATA = 0x33ab0000;
private List<Instruction> createInstructions() {
// NOTE static imports of:
// com.hp.of.lib.instr.ActionFactory.createAction;
// com.hp.of.lib.instr.ActionFactory.createActionSetField;
// com.hp.of.lib.instr.InstructionFactory.createInstruction;
//
com.hp.of.lib.instr.InstructionFactory.createMutableInstruction;
List<Instruction> result = new ArrayList<Instruction>();
result.add(createInstruction(PV, InstructionType.WRITE_METADATA,INS_META_DATA, INS_META_MASK));
InstrMutableAction apply = createMutableInstruction(PV,InstructionType.APPLY_ACTIONS);
apply.addAction(createAction(PV, ActionType.DEC_NW_TTL)).addAction(createActionSetField(PV, ETH_DST, MAC_DEST)).addAction(createActionSetField(PV, IPV4_DST, IP_DEST));
result.add((Instruction) apply.toImmutable());
return result;
}
}
This is an example for FlowMOD message in the SDN Programming guide. [page 27-29]
Please follow the example and let us know if you still face the issue.
Thanks,
HP SDN Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2014 04:00 AM
04-04-2014 04:00 AM
Re: Creating a Java FlowMod for 1.3 DataPath
Hi RGBD,
Doing a follow up to see if previous post helps you.
Please let us know if your problem is solved or you still have some problem.
Thanks,
HP SDN Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2014 08:20 AM
06-04-2014 08:20 AM
Re: Creating a Java FlowMod for 1.3 DataPath
Hi everyone!
How do I send the FlowMod message?
I tried it with the ControllerService.sendFlowMod method
MessageFuture sendFlowMod(OfmFlowMod flowMod, DataPathId dpid) throws OpenflowException
but I always get the follogwing error:
ERROR of-io-29-thread-6 hp.of.ctl Unable to perform I/O java.lang.NoSuchMethodError: com.hp.of.ctl.ControllerService.sendFlowMod(Lcom/hp/of/lib/msg/OfmFlowMod;Lcom/hp/of/lib/dt/DataPathId;)Lcom/hp/of/lib/msg/MessageFuture;
The necessary jars are referenced in the projects pom.xml and the ControllerService seems to be bound as I can add a PacketListener.
Does anybody have an idea where the problem is?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 11:19 AM
06-11-2014 11:19 AM
Re: Creating a Java FlowMod for 1.3 DataPath
Hello Dast,
Below are the steps to send the FlowMod message-
// Construct OfmMutableFlowMod
OfmMutableFlowMod mod = (OfmMutableFlowMod) MessageFactory .create(pv, MessageType.FLOW_MOD);
// Assemble the match fields
// Add the values to flow mod
//Convert to Immutable
OfmFlowMod flow = (OfmFlowMod)mod.toImmutable();
…
//Call the method
cs.sendFlowMod(flow, dpInfo.dpid()); // Here dpInfo is of type DataPathInfo and cs is of type ControllerService
Please let us know if this helps .
Thanks,
HP SDN Team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2014 08:33 PM
09-09-2014 08:33 PM