La documentation technique et administrative

Outils pour utilisateurs

Outils du site


Hierarchy topology

Presentation of the topology

Here is a network topology which allow us to test our code for hierarchy

Code of the Hierarchy Topology

from import Mininet
from mininet.node import Controller, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info

def HierarchyTopology():

    net = Mininet( topo=None, build=False)

    info("***Create nodes***\n")
    h1 = net.addHost( 'h1', mac='01:00:00:00:01:00', ip='' )
    h2 = net.addHost( 'h2', mac='01:00:00:00:02:00', ip='' )

    info("***Create switches***\n")
    s0 = net.addSwitch( 's0', listenPort=6634, mac='00:00:00:00:00:01' )
    s1 = net.addSwitch( 's1', listenPort=6634, mac='00:00:00:00:00:02' )
    s2 = net.addSwitch( 's2', listenPort=6634, mac='00:00:00:00:00:03' )
    s3 = net.addSwitch( 's3', listenPort=6634, mac='00:00:00:00:00:04' )
    s4 = net.addSwitch( 's4', listenPort=6634, mac='00:00:00:00:00:05' )
    s5 = net.addSwitch( 's5', listenPort=6634, mac='00:00:00:00:00:06' )

    info("***Creating links***\n")
    net.addLink( h1,s0 )
    net.addLink( s0,s1 )
    net.addLink( s0,s2 )
    net.addLink( s1,s3 )
    net.addLink( s1,s4 )
    net.addLink( s2,s3 )
    net.addLink( s2,s4 )
    net.addLink( s3,s5 )
    net.addLink( s4,s5 )
    net.addLink( s5,h2 )

    info("***Add Controllers***")
    odl1 = net.addController( 'c1', controller=RemoteController, ip='', port=6633)
    odl2 = net.addController( 'c2', controller=RemoteController, ip='', port=6633)

    info("***Connect each switch to a different controller***")
    s0.start( [odl1] )
    s1.start( [odl1] )
    s2.start( [odl1] )
    s3.start( [odl2] )
    s4.start( [odl2] )
    s5.start( [odl2] )

    s1.cmdPrint('ovs-vsctl show')

    CLI( net )

if __name__ == '__main__':
    setLogLevel( 'info' )

How to run the topology

  • Check that machines ping each other
h1 ping h2
h2 ping h1

ONOS result

If you run mininet hierarchy topology with two separated controller instances, then h1 does no ping h2.

wiki/sdn/hierarchy.txt · Dernière modification: 2018/06/22 15:33 par sowarks