summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/app/simple_switch.py7
-rw-r--r--ryu/app/simple_switch_12.py7
-rw-r--r--ryu/app/simple_switch_13.py2
-rw-r--r--ryu/app/simple_switch_14.py2
4 files changed, 10 insertions, 8 deletions
diff --git a/ryu/app/simple_switch.py b/ryu/app/simple_switch.py
index 862b8303..33c4f7d0 100644
--- a/ryu/app/simple_switch.py
+++ b/ryu/app/simple_switch.py
@@ -36,11 +36,12 @@ class SimpleSwitch(app_manager.RyuApp):
super(SimpleSwitch, self).__init__(*args, **kwargs)
self.mac_to_port = {}
- def add_flow(self, datapath, in_port, dst, actions):
+ def add_flow(self, datapath, in_port, dst, src, actions):
ofproto = datapath.ofproto
match = datapath.ofproto_parser.OFPMatch(
- in_port=in_port, dl_dst=haddr_to_bin(dst))
+ in_port=in_port,
+ dl_dst=haddr_to_bin(dst), dl_src=haddr_to_bin(src))
mod = datapath.ofproto_parser.OFPFlowMod(
datapath=datapath, match=match, cookie=0,
@@ -81,7 +82,7 @@ class SimpleSwitch(app_manager.RyuApp):
# install a flow to avoid packet_in next time
if out_port != ofproto.OFPP_FLOOD:
- self.add_flow(datapath, msg.in_port, dst, actions)
+ self.add_flow(datapath, msg.in_port, dst, src, actions)
data = None
if msg.buffer_id == ofproto.OFP_NO_BUFFER:
diff --git a/ryu/app/simple_switch_12.py b/ryu/app/simple_switch_12.py
index 6895b074..5e078515 100644
--- a/ryu/app/simple_switch_12.py
+++ b/ryu/app/simple_switch_12.py
@@ -30,11 +30,12 @@ class SimpleSwitch12(app_manager.RyuApp):
super(SimpleSwitch12, self).__init__(*args, **kwargs)
self.mac_to_port = {}
- def add_flow(self, datapath, port, dst, actions):
+ def add_flow(self, datapath, port, dst, src, actions):
ofproto = datapath.ofproto
match = datapath.ofproto_parser.OFPMatch(in_port=port,
- eth_dst=dst)
+ eth_dst=dst,
+ eth_src=src)
inst = [datapath.ofproto_parser.OFPInstructionActions(
ofproto.OFPIT_APPLY_ACTIONS, actions)]
@@ -80,7 +81,7 @@ class SimpleSwitch12(app_manager.RyuApp):
# install a flow to avoid packet_in next time
if out_port != ofproto.OFPP_FLOOD:
- self.add_flow(datapath, in_port, dst, actions)
+ self.add_flow(datapath, in_port, dst, src, actions)
data = None
if msg.buffer_id == ofproto.OFP_NO_BUFFER:
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598c..06a5d0ed 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -102,7 +102,7 @@ class SimpleSwitch13(app_manager.RyuApp):
# install a flow to avoid packet_in next time
if out_port != ofproto.OFPP_FLOOD:
- match = parser.OFPMatch(in_port=in_port, eth_dst=dst)
+ match = parser.OFPMatch(in_port=in_port, eth_dst=dst, eth_src=src)
# verify if we have a valid buffer_id, if yes avoid to send both
# flow_mod & packet_out
if msg.buffer_id != ofproto.OFP_NO_BUFFER:
diff --git a/ryu/app/simple_switch_14.py b/ryu/app/simple_switch_14.py
index d3151bc0..c932eda1 100644
--- a/ryu/app/simple_switch_14.py
+++ b/ryu/app/simple_switch_14.py
@@ -93,7 +93,7 @@ class SimpleSwitch14(app_manager.RyuApp):
# install a flow to avoid packet_in next time
if out_port != ofproto.OFPP_FLOOD:
- match = parser.OFPMatch(in_port=in_port, eth_dst=dst)
+ match = parser.OFPMatch(in_port=in_port, eth_dst=dst, eth_src=src)
self.add_flow(datapath, 1, match, actions)
data = None