2 """Creates a Mininet topology based on examples in the main Mininet documentation."""
6 from mininet.topo import Topo
7 from mininet.net import Mininet
8 from mininet.log import setLogLevel
9 from mininet.node import RemoteController
12 class SingleSwitchTopo(Topo):
13 """Single switch connected to n hosts."""
15 switch = self.addSwitch("s1")
16 # Python's range(N) generates 0..N-1
18 host = self.addHost("h%s" % (h + 1))
19 self.addLink(host, switch)
23 """Create and test a simple network."""
24 topo = SingleSwitchTopo(n=4)
25 net = Mininet(topo=topo, controller=None)
26 net.addController("c0", controller=RemoteController, ip="127.0.0.1", port=6633)
29 print "Testing network connectivity"
33 if __name__ == "__main__":
34 # Tell mininet to print useful information