简体   繁体   English

opendaylight:Genius安装流程在交换机中

[英]opendaylight: Genius install flow in switch

I am using opendaylight / Carbon and am trying to work with the Genius wrapper. 我正在使用opendaylight / Carbon,并尝试与Genius包装器一起使用。 I want to install a flow in a switch based on a MAC address match for an incoming packet. 我想根据传入数据包的MAC地址匹配在交换机中安装流。 The instruction I want to install is a "GOTO" instruction. 我要安装的指令是“ GOTO”指令。 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. Mu的意图是创建一个流程实体,并使用IMDSalApiManager.installFlow方法安装它。

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. 事实证明,这是我提供的MacAddress为空的问题。 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 : 这是使用OpenDaylight构建GOTO指令的方式:

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. 您可以使用它来调整代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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