Statistics
| Branch: | Tag: | Revision:

mininet / examples / multilink.py @ e0bf8ece

History | View | Annotate | Download (766 Bytes)

1 37bdf14b Bob Lantz
#!/usr/bin/python
2
3
"""
4
This is a simple example that demonstrates multiple links
5
between nodes.
6
"""
7
8
from mininet.cli import CLI
9 e0bf8ece Bob Lantz
from mininet.log import setLogLevel
10 37bdf14b Bob Lantz
from mininet.net import Mininet
11
from mininet.topo import Topo
12
    
13
def runMultiLink():
14
    
15
    topo = simpleMultiLinkTopo( n=2 )
16
    net = Mininet( topo=topo )
17
    net.start()
18
    CLI( net )
19
    net.stop()
20
21
class simpleMultiLinkTopo( Topo ):
22
23
    def __init__( self, n, **kwargs ):
24
        Topo.__init__( self, **kwargs )
25
26
        h1, h2 = self.addHost( 'h1' ), self.addHost( 'h2' )
27
        s1 = self.addSwitch( 's1' )
28
        
29
        for _ in range( n ):
30
            self.addLink( s1, h1 )
31
            self.addLink( s1, h2 )
32
33
if __name__ == '__main__':
34 e0bf8ece Bob Lantz
    setLogLevel( 'info' )
35 37bdf14b Bob Lantz
    runMultiLink()