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