You are here: Home / Users / Oleg Sadov / Ryu / Testing

Testing

by Oleg Sadov last modified Dec 07, 2015 09:02 AM

1) Install Ryu, mininet and openvswitch:

rpm -ivh http://ftp.scientificlinux.org/linux/scientific/6/external_products/softwarecollections/yum-conf-softwarecollections-1.0-1.el6.noarch.rpm

yum --enablerepo=naulinux-extras --enablerepo=epel --enablerepo=softwarecollections install python27-ryu mininet

rpm -ivh http://rdo.fedorapeople.org/rdo-release.rpm (for SL6 use Icehouse repository package, for ex.:

rpm -ivh https://repos.fedorapeople.org/repos/openstack/EOL/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm )

yum --enablerepo=epel install openvswitch

2) Start openvswitch:

service openvswitch start

3) Start Ryu:

# . /opt/rh/python27/enable
# ryu-manager --verbose /opt/rh/python27/root/usr/lib/python2.7/site-packages/ryu/app/simple_switch.py
loading app /opt/rh/python27/root/usr/lib/python2.7/site-packages/ryu/app/simple_switch.py
loading app ryu.controller.ofp_handler
instantiating app ryu.controller.ofp_handler of OFPHandler
instantiating app /opt/rh/python27/root/usr/lib/python2.7/site-packages/ryu/app/simple_switch.py of SimpleSwitch
BRICK SimpleSwitch
  CONSUMES EventOFPPortStatus
  CONSUMES EventOFPPacketIn
BRICK ofp_event
  PROVIDES EventOFPPortStatus TO {'SimpleSwitch': set(['main'])}
  PROVIDES EventOFPPacketIn TO {'SimpleSwitch': set(['main'])}
  CONSUMES EventOFPErrorMsg
  CONSUMES EventOFPHello
  CONSUMES EventOFPEchoRequest
  CONSUMES EventOFPSwitchFeatures
  CONSUMES EventOFPPortDescStatsReply
connected socket:<eventlet.greenio.GreenSocket object at 0x1845190> address:('127.0.0.1', 54220)
connected socket:<eventlet.greenio.GreenSocket object at 0x1845250> address:('127.0.0.1', 54221)
hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x1845710>
move onto config mode
switch features ev version: 0x1 msg_type 0x6 xid 0x51413983 OFPSwitchFeatures(actions=4095,capabilities=199,datapath_id=1,n_buffers=256,n_tables=254,ports={1: OFPPhyPort(port_no=1,hw_addr='2e:8a:88:47:bb:4f',name='s1-eth1',config=0,state=1,curr=192,advertised=0,supported=0,peer=0), 2: OFPPhyPort(port_no=2,hw_addr='66:80:7d:1a:9c:ec',name='s1-eth2',config=0,state=0,curr=192,advertised=0,supported=0,peer=0), 65534: OFPPhyPort(port_no=65534,hw_addr='fe:48:8b:af:8c:47',name='s1',config=0,state=0,curr=0,advertised=0,supported=0,peer=0)})
move onto main mode
EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 be:40:b7:1f:71:d8 33:33:ff:1f:71:d8 2
EVENT ofp_event->SimpleSwitch EventOFPPortStatus
port modified 1
EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 fe:48:8b:af:8c:47 33:33:ff:89:b0:cd 65534
EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 66:82:b9:b8:be:c9 33:33:00:00:00:02 1
....


4) Start mininet:

# mn --controller=remote
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
*** Starting 1 switches
s1
*** Starting CLI:
mininet> xterm h1 h2

5) Check OVS-switch status:

# ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):

6) Run ping on mininets h1 xterm:

# ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=12.1 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.297 ms
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.087 ms
^C
--- 10.0.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2305ms
rtt min/avg/max/mdev = 0.087/4.181/12.159/5.641 ms

7) Ryu diagnostic messages:

EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 66:82:b9:b8:be:c9 ff:ff:ff:ff:ff:ff 1
EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 be:40:b7:1f:71:d8 66:82:b9:b8:be:c9 2
EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 66:82:b9:b8:be:c9 be:40:b7:1f:71:d8 1

8) To OVS flow-table must be added entries corresponded with h1 and h2 mininet pseudo-hosts:

# ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=166.866s, table=0, n_packets=4, n_bytes=336, idle_age=161, in_port=2,dl_dst=66:82:b9:b8:be:c9 actions=output:1
 cookie=0x0, duration=166.863s, table=0, n_packets=3, n_bytes=238, idle_age=161, in_port=1,dl_dst=be:40:b7:1f:71:d8 actions=output:2

9) Clean OVS flow-table:

# ovs-ofctl del-flows s1
# ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):

10) After pinging at mininet h1:

# ping -c1 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=6.76 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 6ms
rtt min/avg/max/mdev = 6.764/6.764/6.764/0.000 ms

We must get Ryu debug-messages:

EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 66:82:b9:b8:be:c9 be:40:b7:1f:71:d8 1
EVENT ofp_event->SimpleSwitch EventOFPPacketIn
packet in 1 be:40:b7:1f:71:d8 66:82:b9:b8:be:c9 2

And to OVS flow-table must be added entries corresponded with h1 and h2:

# ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=69.925s, table=0, n_packets=1, n_bytes=42, idle_age=64, in_port=1,dl_dst=be:40:b7:1f:71:d8 actions=output:2
 cookie=0x0, duration=69.921s, table=0, n_packets=1, n_bytes=42, idle_age=64, in_port=2,dl_dst=66:82:b9:b8:be:c9 actions=output:1

11) Stop Ryu:

^CTraceback (most recent call last):
  File "/opt/rh/python27/root/usr/bin/ryu-manager", line 9, in <module>
    load_entry_point('ryu==3.10', 'console_scripts', 'ryu-manager')()
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/ryu/cmd/manager.py", line 83, in main
    hub.joinall(services)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/ryu/lib/hub.py", line 89, in joinall
    t.wait()
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/eventlet/greenthread.py", line 168, in wait
    return self._exit_event.wait()
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/eventlet/event.py", line 116, in wait
    return hubs.get_hub().switch()
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 187, in switch
    return self.greenlet.switch()
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 236, in run
    self.wait(sleep_time)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/eventlet/hubs/poll.py", line 84, in wait
    presult = self.do_poll(seconds)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/eventlet/hubs/epolls.py", line 61, in do_poll
    return self.poll.poll(seconds)
KeyboardInterrupt

12) Clean OVS flow-table:

# ovs-ofctl del-flows s1
# ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):

13) Pings on mininet h1 should not pass:

# ping -c1 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.

After starting Ryu, OVS flow-table must be filled and ping should pass again.

14) Run topology viewer module:

# ryu run --observe-links ryu.app.gui_topology.gui_topology

15) Load topology viewer in web-browser by URL http://0.0.0.0:8080/

16) Run mininet with tree topolgy:

# mn --controller remote --topo tree,depth=3

17) After reloading of http://0.0.0.0:8080/ topology of mininet network must be visible at  web-browser.