To support user-specified OpenFlow version, this patch adds protocols
option support into run_mininet script.

Usage example)
  $ sudo python run_mininet.py --protocols OpenFlow13

Signed-off-by: IWASE Yusuke <[email protected]>
---
 ryu/tests/switch/run_mininet.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/ryu/tests/switch/run_mininet.py b/ryu/tests/switch/run_mininet.py
index a5acfde..3a8c6ae 100755
--- a/ryu/tests/switch/run_mininet.py
+++ b/ryu/tests/switch/run_mininet.py
@@ -17,15 +17,16 @@ if '__main__' == __name__:
 
     opts = [
         cfg.StrOpt('switch', default='ovs',
-                   help='test switch (ovs|ovs13|ovs14|cpqd)')
+                   help='test switch [ovs|cpqd]'),
+        cfg.StrOpt('protocols', default='OpenFlow13',
+                   help='"protocols" option for ovs-vsctl (e.g. OpenFlow13)')
     ]
     conf = cfg.ConfigOpts()
     conf.register_cli_opts(opts)
     conf(project='ryu', version='run_mininet.py %s' % version)
     conf(sys.argv[1:])
-    switch_type = {'ovs': OVSSwitch, 'ovs13': OVSSwitch,
-                   'ovs14': OVSSwitch, 'cpqd': UserSwitch}
-    switch = switch_type.get(conf.switch)
+    switch_type = {'ovs': OVSSwitch, 'cpqd': UserSwitch}
+    switch = switch_type.get(conf.switch, None)
     if switch is None:
         raise ValueError('Invalid switch type. [%s]', conf.switch)
 
@@ -45,12 +46,9 @@ if '__main__' == __name__:
     s1.start([c0])
     s2.start([c0])
 
-    if conf.switch in ['ovs', 'ovs13']:
-        s1.cmd('ovs-vsctl set Bridge s1 protocols=OpenFlow13')
-        s2.cmd('ovs-vsctl set Bridge s2 protocols=OpenFlow13')
-    elif conf.switch == 'ovs14':
-        s1.cmd('ovs-vsctl set Bridge s1 protocols=OpenFlow14')
-        s2.cmd('ovs-vsctl set Bridge s2 protocols=OpenFlow14')
+    if conf.switch == 'ovs':
+        s1.cmd('ovs-vsctl set Bridge s1 protocols=%s' % conf.protocols)
+        s2.cmd('ovs-vsctl set Bridge s2 protocols=%s' % conf.protocols)
 
     CLI(net)
 
-- 
1.9.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to