Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
648 B
1
Indexable
Never
from mininet.topo import Topo

class MyTopo( Topo ):
    "Simple topology example."

    def build( self ):
        
        top_switch = self.addSwitch('s1')

        
        lower_switches = []
        for i in range(1, 6):
            lower_switch = self.addSwitch('s{}'.format(i + 1))
            self.addLink(top_switch, lower_switch)
            lower_switches.append(lower_switch)

       
        for switch in lower_switches:
            for j in range(1, 9):
                host = self.addHost('h{}_{}'.format(switch[1:], j))
                self.addLink(switch, host)


topos = { 'mytopo': ( lambda: MyTopo() ) }