Integration tests for the new l2switch project, released in Helium.
[integration/test.git] / test / csit / suites / l2switch / topologies / loop.py
diff --git a/test/csit/suites/l2switch/topologies/loop.py b/test/csit/suites/l2switch/topologies/loop.py
new file mode 100644 (file)
index 0000000..884b142
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+# usage: sudo mn --controller=remote,ip=<controller_ip> --switch=ovsk,protocols=OpenFlow13 --custom <path to createtopo.py> --topo loop ...
+
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import RemoteController
+from mininet.cli import CLI
+
+class LoopTopo(Topo):
+        def __init__(self, switches = 3, hosts_per = 1, **opts):
+            Topo.__init__(self, **opts)
+            sws = []
+            hnum = 0
+            for i in range(switches):
+                sw = self.addSwitch('s%s' % (i+ 1))
+
+                for _ in range(hosts_per):
+                    hnum += 1
+                    host = self.addHost('h%s' % hnum)
+                    self.addLink(sw, host)
+
+                for rhs in sws:
+                    self.addLink(sw, rhs)
+
+                sws.append(sw)
+
+topos = { 'loop': LoopTopo }
\ No newline at end of file