Software Defined Networking
1748003 Members
4522 Online
108757 Solutions
New Discussion

Problem with Flow-Mods instructions on HP VAN SDN

 
SOLVED
Go to solution
sbotkine
Frequent Advisor

Problem with Flow-Mods instructions on HP VAN SDN

Hello,

 

Following the HP SDN workshop tutorial, I have a problem when my controller (HP VAN SDN) try to installing Flow-Mods in my physical switch (HP 3800-24 G).

 

The openFlow version used by the switch is 1.3

 

The Methode that instert Flow-Mods  (given by the tuto) is:

 

    private void installDhcpFlowMod(DataPathId dp, ProtocolVersion version) {

   

   OfmMutableFlowMod flowMod67, flowMod68;

    Action action;

    MutableMatch match67, match68;      

                 

    match67 = MatchFactory.createMatch(version);

    match67.addField(FieldFactory.createBasicField(version, OxmBasicFieldType.UDP_DST, PortNumber.valueOf(67)));

    match67.addField(FieldFactory.createBasicField(version, OxmBasicFieldType.IP_PROTO, IpProtocol.UDP));

    match67.addField(FieldFactory.createBasicField(version, OxmBasicFieldType.ETH_TYPE, EthernetType.IPv4));

    match68 = MatchFactory.createMatch(version);

    match68.addField(FieldFactory.createBasicField(version, OxmBasicFieldType.UDP_DST, PortNumber.valueOf(68)));

    match68.addField(FieldFactory.createBasicField(version, OxmBasicFieldType.IP_PROTO, IpProtocol.UDP));

    match68.addField(FieldFactory.createBasicField(version, OxmBasicFieldType.ETH_TYPE, EthernetType.IPv4));

                 

action = ActionFactory.createAction(version, ActionType.OUTPUT, Port.CONTROLLER, ActOutput.CONTROLLER_NO_BUFFER);

 

    // create flow-mod and add all required fields

    flowMod67 = (OfmMutableFlowMod) MessageFactory.create(version, MessageType.FLOW_MOD);

    flowMod67.match((Match) match67.toImmutable());

    flowMod67.hardTimeout(0);

    flowMod67.idleTimeout(0);

    flowMod67.addAction(action);

    flowMod67.priority(33333);

    flowMod67.command(FlowModCommand.ADD);

    flowMod67.bufferId(BufferId.NO_BUFFER);

    flowMod67.outPort(Port.NONE);

    flowMod67.cookie(0x1234);

 

    flowMod68 = (OfmMutableFlowMod) MessageFactory.create(version, MessageType.FLOW_MOD);

    flowMod68.match((Match) match68.toImmutable());

    flowMod68.hardTimeout(0);

    flowMod68.idleTimeout(0);

    flowMod68.addAction(action);

...

    flowMod68.cookie(0x1235);

 

    try {

                  // Send our flow-mods

                  controllerService.sendFlowMod((OfmFlowMod) flowMod67.toImmutable(), dp);

                  controllerService.sendFlowMod((OfmFlowMod) flowMod68.toImmutable(), dp);

   } catch (OpenflowException e) {

                  ogger.warn("MYFIRST: Failed to install DHCP FlowMod: " + e.getMessage().toString());

   }

   }

 

 

The controller bundle failed with the follwing instruction:

 

flowMod67.addAction(action);

 

or

 

flowMod68.addAction(action);

 

Do you know why ?

 

Moreover, do you know why this code is using two different “flowMod” (67 and 68) Is it depending on the kind of switch.

In fact this tuto is suppose to be executed on Mininet. I use it with physical HP switch.  Do you think it could be the problem ?

 

Best regards,

 

Serge

4 REPLIES 4
Tomas_Kubica
Advisor
Solution

Re: Problem with Flow-Mods instructions on HP VAN SDN

Code you are using is OF 1.0 specific. Controller does provide some level of abstractions (for example match is universal even there are differences between versions), but this one needs to be version specific. With OF 1.0 you are assigning actions with Flow Mod, but OF 1.3 is using instructions. Those with Write-Actions for example contain actions. So I suggest to check here agains negotiated version (or version from Packet IN event) and either assign action directly or construct OF 1.3 instruction with action.

 

Tomas

sbotkine
Frequent Advisor

Re: Problem with Flow-Mods instructions on HP VAN SDN

Hello Tomas, 

 

Code you are using is OF 1.0 specific. Controller does provide some level of abstractions (for example match is universal even there are differences between versions), but this one needs to be version specific. With OF 1.0 you are assigning actions with Flow Mod, but OF 1.3 is using instructions. Those with Write-Actions for example contain actions. So I suggest to check here agains negotiated version (or version from Packet IN event) and either assign action directly or construct OF 1.3 instruction with action.

 

Ok, I tried to replace the previous code with the next one by using "Instructions" to add actions. Being not an expert with "Instructions", I took as a starting point the example in page 27 int the HPSDNControllerProgrammingGuide.

 

 

Here is the code:

 

  

   final ProtocolVersion PV = ProtocolVersion.V_1_3;

    OfmMutableFlowMod flowMod;

    

    MutableMatch match = MatchFactory.createMatch(PV);

    match = MatchFactory.createMatch(version);

    match.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.UDP_DST, PortNumber.valueOf(67)));

    match.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.IP_PROTO, IpProtocol.UDP));

    match.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.ETH_TYPE, EthernetType.IPv4));

 

    final long INS_META_MASK = 0xffff0000;

    final long INS_META_DATA = 0x33ab0000; 

 

    List<Instruction> ins = new ArrayList<Instruction>();

    ins.add((Instruction) createInstruction(PV, InstructionType.WRITE_METADATA,INS_META_DATA, INS_META_MASK));

    InstrMutableAction apply = createMutableInstruction(PV,InstructionType.APPLY_ACTIONS);

    apply.addAction(createAction(PV, ActionType.OUTPUT));

    ins.add((Instruction) apply.toImmutable());

    

    flowMod = (OfmMutableFlowMod) MessageFactory.create(PV, MessageType.FLOW_MOD);

    flowMod.match((Match) match.toImmutable());

    flowMod.hardTimeout(0);

    flowMod.idleTimeout(0);

    for (Instruction ins: result)

          flowMod.addInstruction((com.hp.of.lib.instr.Instruction) ins);

    flowMod.priority(33333);

 

However my application stoped after the instruction:

   ins.add((Instruction) createInstruction(PV, InstructionType.WRITE_METADATA,INS_META_DATA, INS_META_MASK));

 

Do you have an idea ?

 

Regards, 

 

Serge

sbotkine
Frequent Advisor

Re: Problem with Flow-Mods instructions on HP VAN SDN

Forget my previous message, I found the problem.

 

In fact I made the wrong import for "Instruction"

 

I did: 

 

import com.hp.util.Instruction

 

instead of:

 

import com.hp.of.lib.Intstruction.

 

Regards, 

 

Serge

 

sdnindia
Trusted Contributor

Re: Problem with Flow-Mods instructions on HP VAN SDN

Hello Serge,

From the post we understand that your problem is resolved.
Please do let us know if you need further assistance.

Please feel free to reply incase you have more questions around the same topic or open a new thread if new topic.

Thanks
HP SDN Team