-->

opendaylight: multiple goto instructions in a sing

2019-08-25 12:51发布

问题:

I am using opendaylight (Carbon) and open VSwitch. I am building an application in java for which I would like to send the packet to multiple GoTo target tables. The following code fragment shows how I am building the instructions:

   private static InstructionsBuilder createGoToNextTableInstruction(short idstable, short l2switchTable) {
    // Create an instruction allowing the interaction.

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

    Instruction gotoIdsTableInstruction = new InstructionBuilder()
            .setInstruction(new GoToTableCaseBuilder()
                    .setGoToTable(new GoToTableBuilder().setTableId(idstable).build()).build())
            .setKey(new InstructionKey(getInstructionKey())).setOrder(0).build();

    instructions.add(gotoIdsTableInstruction);

    Instruction gotoL2SwitchInstruction = new InstructionBuilder()
            .setInstruction(new GoToTableCaseBuilder()
                    .setGoToTable(new GoToTableBuilder().setTableId(l2switchTable).build()).build())
            .setKey(new InstructionKey(getInstructionKey())).setOrder(1).build();

    instructions.add(gotoL2SwitchInstruction);
    InstructionsBuilder isb = new InstructionsBuilder();
    isb.setInstruction(instructions);
    return isb;
    }

The instructions are used to construct a flow rule as follows:

   flowBuilder.setMatch(match).setInstructions(isb.build()).setPriority(30)
            .setBufferId(OFConstants.ANY).setHardTimeout(0).setIdleTimeout(0)
            .setFlags(new FlowModFlags(false, false, false, false, false));

I run the application and no exceptions are thrown. However, when I go to list the flow rules at the switch, the flow never got installed. I can successfully install flows on the switch when I have a single GoTo instruction but not when I have multiple GoTo instructions.

My questions are :

  1. Is having multiple GoTo targets permitted in openflow and supported on all openflow compliant switches? Specifically, does openvswitch support multiple targets?

I tried the following :

 sudo ovs-ofctl -O OpenFlow13 add-flow s1 table=0,in_port=2,actions=goto_table:1,goto_table:2
  ovs-ofctl: instruction goto_table may be specified only once

Here is my version:

  ovs-ofctl --version
  ovs-ofctl (Open vSwitch) 2.4.1
  Compiled Sep 25 2016 21:59:05
  OpenFlow versions 0x1:0x4

Is this an ovs version problem?

  1. Is this a place where a group table should be used?

Thanks.

回答1:

I verified that it is indeed not possible to have multiple GoTo targets in a single flow rule in openflow. Just following up here for the benefit of others.