简体   繁体   中英

opendaylight: Genius install flow in switch

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM