from mininet.topo import Topo # Usage example: # sudo mn --custom h1topology.py --topo h1 --link tc -x class ObligTopo( Topo ): "Simple topology for mandatory assignment." def __init__( self ): "Set up our custom topo." # Initialize topology Topo.__init__( self ) # Add hosts A = self.addHost('A') B = self.addHost('B') C = self.addHost('C') # Add links self.addLink(A, B, bw=10, delay='10ms', loss=0.0, use_tbf=False) self.addLink(B, C, bw=10, delay='10ms', loss=0.0, use_tbf=False) class H1Topo( Topo ): "Larger topology for home exams." def __init__( self ): "Set up our custom topo." # Initialize topology Topo.__init__( self ) # Add hosts A = self.addHost('A') B = self.addHost('B') C = self.addHost('C') D = self.addHost('D') E = self.addHost('E') # Add links self.addLink(A, B, bw=10, delay='10ms', loss=0.0, use_tbf=False) self.addLink(B, C, bw=10, delay='10ms', loss=0.0, use_tbf=False) self.addLink(B, D, bw=10, delay='10ms', loss=0.0, use_tbf=False) self.addLink(C, D, bw=10, delay='10ms', loss=0.0, use_tbf=False) self.addLink(D, E, bw=10, delay='10ms', loss=0.0, use_tbf=False) topos = { 'oblig': ( lambda: ObligTopo() ), 'h1': ( lambda: H1Topo() ), }