1 """Custom topology example
3 Three directly connected switches plus a host for each switch:
5 host --- switch --- switch --- switch --- host
7 Adding the 'topos' dict with a key/value pair to generate our newly defined
8 topology enables one to pass in '--topo=mytopo' from the command line.
11 from mininet.topo import Topo
14 class PathpolicyTopo(Topo):
15 """Simple topology example."""
22 # Add hosts and switches
23 leftHost = self.addHost('h1')
24 rightHost = self.addHost('h2')
25 leftSwitch = self.addSwitch('s1')
26 middleSwitch = self.addSwitch('s2')
27 middleSwitch2 = self.addSwitch('s4')
28 rightSwitch = self.addSwitch('s3')
31 self.addLink(leftHost, leftSwitch)
32 self.addLink(leftSwitch, middleSwitch)
33 self.addLink(leftSwitch, middleSwitch2)
34 self.addLink(middleSwitch, rightSwitch)
35 self.addLink(middleSwitch2, rightSwitch)
36 self.addLink(rightSwitch, rightHost)
39 topos = {'pathpolicytopo': (lambda: PathpolicyTopo())}