Untitled

 avatar
unknown
plain_text
2 years ago
648 B
4
Indexable
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() ) }
Editor is loading...