test tool: add a script to make the test environment on mininet

What this patch implements:

    This patch implements a script that provides the simple test environment that includes 2 switches and 2 links for the test tool as follows:

                      +-----------+
           +----------| target sw | The OpenFlow switch to be tested (Open vSwitch)
           |          +-----------+
    +------------+      (1)   (2)
    | controller |       |     |
    +------------+      (1)   (2)
           |          +-----------+
           +----------| tester sw | OpenFlow Switch (Open vSwitch)
                      +-----------+

      (X) : port number

How to run:

    Do the following command:
    sudo ryu/tests/switch/run_mininet.py

    And then, run the test tool at another terminal:
    ryu-manager ryu/tests/switch/tester.py

Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Yuichi Ito 2013-12-11 17:16:58 +09:00 committed by FUJITA Tomonori
parent bef570dfe7
commit f3e3ccc98f

30
ryu/tests/switch/run_mininet.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
from mininet.cli import CLI
from mininet.link import Link
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.term import makeTerm
if '__main__' == __name__:
net = Mininet(controller=RemoteController)
c0 = net.addController('c0')
s1 = net.addSwitch('s1')
s2 = net.addSwitch('s2')
Link(s1, s2)
Link(s1, s2)
net.build()
c0.start()
s1.start([c0])
s2.start([c0])
s1.cmd('ovs-vsctl set Bridge s1 protocols=OpenFlow13')
s2.cmd('ovs-vsctl set Bridge s2 protocols=OpenFlow13')
CLI(net)
net.stop()