opendaylight: Genius install flow in switch

108 Views Asked by At

I am using opendaylight / Carbon and am trying to work with the Genius wrapper. I want to install a flow in a switch based on a MAC address match for an incoming packet. The instruction I want to install is a "GOTO" instruction. I proceed as follows:

     FlowEntityBuilder flowEntityBuilder = new FlowEntityBuilder();
    flowEntityBuilder.setTableId(tableId)
        .setDpnId(dpnId)
        .setFlowId(FlowUtils.createFlowId().toString())
        .setFlowName("gotoTable1");

    MatchInfo matchInfo = new MatchEthernetSource(macAddress);


    InstructionInfo instructionInfo = new InstructionGotoTable(tableId);
    FlowEntity flowEntity = flowEntityBuilder.addInstructionInfoList(instructionInfo).addMatchInfoList(matchInfo).build();
    mdsalApiManager.installFlow(dpnId,flowEntity);

Mu intention was to create a flow entity and install it using the IMDSalApiManager.installFlow method.

Here is the exception that I see:

java.lang.IllegalArgumentException: Node (urn:opendaylight:flow:inventory?revision=2013-08-19)ethernet-source is missing mandatory descendant /(urn:opendaylight:flow:inventory?revision=2013-08-19)address

Any help debugging this would be appreciated.

2

There are 2 best solutions below

0
On BEST ANSWER

This is how you build a GOTO instruction with OpenDaylight :

GoToTableBuilder gttb = new GoToTableBuilder();
gttb.setTableId(tableGoto);

Instruction gotoInstruction = new InstructionBuilder()
    .setOrder(1).setInstruction(new GoToTableCaseBuilder()
        .setGoToTable(gttb.build())
        .build())
    .build();

You can use this to adjust your code.

2
On

It turned out to be an issue on my end where the MacAddress supplied was null. I fixed this problem. However I still do not see the flow in the switch.