2017-09-13 166 views
0

我正在使用opendaylight /碳,我正試圖與Genius包裝。我想根據傳入數據包的MAC地址匹配在交換機中安裝流。我想要安裝的指令是一個「GOTO」指令。我的步驟如下:opendaylight:Genius安裝流量在開關

 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); 

穆目的是創造一個流動的實體,並使用IMDSalApiManager.installFlow方法安裝。

這裏是我看到了異常:

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 

任何幫助調試這將不勝感激。

回答

0

這是你如何建立一個GOTO指令與OpenDaylight:

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

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

您可以使用此來調整你的代碼。

0

事實證明,在我提供的MacAddress爲空的結尾處存在一個問題。我解決了這個問題。但是我仍然看不到交換機中的流量。

+0

ovs日誌中的錯誤是什麼,或者您可以通過捕獲控制器和ovs之間的數據包傳輸來檢查錯誤是什麼。 –

+0

我有一個空的節點,因此錯誤。我不得不使用InstanceId 來安裝流程。 – LostInTheFrequencyDomain