Hi,

You can use SET_FIELD action for such purpose.

$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 06a5d0e..4045b8c 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -48,6 +48,18 @@ class SimpleSwitch13(app_manager.RyuApp):
                                           ofproto.OFPCML_NO_BUFFER)]
         self.add_flow(datapath, 0, match, actions)

+        match = parser.OFPMatch(
+            in_port=1,
+            eth_dst='aa:bb:cc:dd:ee:ff',
+            eth_src='11:22:33:44:55:66',
+        )
+        actions = [
+            parser.OFPActionSetField(eth_dst='aa:bb:cc:11:22:33'),
+            parser.OFPActionSetField(eth_src='11:22:33:dd:ee:ff'),
+            parser.OFPActionOutput(ofproto.OFPP_NORMAL),
+        ]
+        self.add_flow(datapath, 0, match, actions)
+
     def add_flow(self, datapath, priority, match, actions, buffer_id=None):
         ofproto = datapath.ofproto
         parser = datapath.ofproto_parser


mininet> sh ovs-ofctl dump-flows s1
cookie=0x0, duration=13.025s, table=0, n_packets=0, n_bytes=0, priority=0 actions=CONTROLLER:65535 cookie=0x0, duration=13.025s, table=0, n_packets=0, n_bytes=0, priority=0,in_port="s1-eth1",dl_src=11:22:33:44:55:66,dl_dst=aa:bb:cc:dd:ee:ff actions=mod_dl_dst:aa:bb:cc:11:22:33,mod_dl_src:11:22:33:dd:ee:ff,NORMAL


Thanks,
Iwase


On 2018年03月02日 07:59, S hj wrote:

Hello,

Is it possible to add a flow with the following content in an OpenvSwitch using Ryu? How?

if  src=x and dest=y (match part)
then:
   src=x (mac_address)
   dest=p, (mac_address)
   actions=normal


Thank you


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot



_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to