forked from faucetsdn/ryu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0001-Fix-simple_switch-for-multi-switch-env.patch
96 lines (80 loc) · 3.92 KB
/
0001-Fix-simple_switch-for-multi-switch-env.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From 615b7ccbc240405838e4104d415de0d552ee570b Mon Sep 17 00:00:00 2001
From: Jerico Moeyersons <[email protected]>
Date: Fri, 24 Nov 2017 09:32:52 +0100
Subject: [PATCH] Fix simple_switch for multi switch env
---
ryu/app/simple_switch.py | 6 +++---
ryu/app/simple_switch_12.py | 7 ++++---
ryu/app/simple_switch_13.py | 2 +-
ryu/app/simple_switch_14.py | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/ryu/app/simple_switch.py b/ryu/app/simple_switch.py
index 862b8303..677db5ba 100644
--- a/ryu/app/simple_switch.py
+++ b/ryu/app/simple_switch.py
@@ -36,11 +36,11 @@ 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 +81,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
--
2.13.3.windows.1