2016-03-20 6 views
0

ロードバランサを使用してMininetで簡単なトポロジを構築しようとしています。 Load Balancerの代わりにスイッチを使用しています。ロードバランサの仕事を実行するために、宛先IPをサーバのIPの1つに変更する必要があります。OpenFlowコントローラでアクションを変更する

私は同じことをするために入力を変更することはできません。誰も私の助けてもらえますか?それとももっと良い方法がありますか?

ありがとうございます!

答えて

0

一致と目的のアクションを含むOpenflowメッセージを作成する必要があります。 宛先IPを変更する必要があるパケットを「検出」するのに役立ちます。アクションはSET_FIELDアクションでなければなりません。ちょっと

public static Action createSetFieldDestinationMacAddress(int order, String macAddress) { 

     Action action; 
     ActionBuilder ab = new ActionBuilder(); 

     MacAddress address = MacAddress.getDefaultInstance(macAddress); 
     EthernetDestination destination = new EthernetDestinationBuilder().setAddress(address).build(); 

     EthernetMatchBuilder builder = new EthernetMatchBuilder(); 
     builder.setEthernetDestination(destination); 

     EthernetMatch ethernetMatch = builder.build(); 
     SetFieldBuilder setFieldBuilder = new SetFieldBuilder(); 
     setFieldBuilder.setEthernetMatch(ethernetMatch); 
     SetField setField = setFieldBuilder.build(); 
     org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action acction = new SetFieldCaseBuilder(). 
       setSetField(setField).build(); 
     ab.setOrder(order).setKey(new ActionKey(order)).setAction(acction); 
     action = ab.build(); 
     return action; 
    } 
+0

:ここ はOpenDaylightコントローラを使用してそれを行う方法について簡単な例(この場合は、宛先MACアドレスを変更)です!答えをありがとう。私は非常に便利なリュウスターターキットも見つけました。 https://bitbucket.org/sdnhub/ryu-starter-kit/src –

関連する問題