From f3e3ccc98fdf56900be97c3784f49615575c1aed Mon Sep 17 00:00:00 2001 From: Yuichi Ito Date: Wed, 11 Dec 2013 17:16:58 +0900 Subject: [PATCH] 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 Signed-off-by: FUJITA Tomonori --- ryu/tests/switch/run_mininet.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 ryu/tests/switch/run_mininet.py diff --git a/ryu/tests/switch/run_mininet.py b/ryu/tests/switch/run_mininet.py new file mode 100755 index 00000000..40ef3998 --- /dev/null +++ b/ryu/tests/switch/run_mininet.py @@ -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()