Statistics
| Branch: | Tag: | Revision:

mininet / examples / multilink.py @ 37bdf14b

History | View | Annotate | Download (766 Bytes)

1
#!/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
from mininet.log import lg, info
10
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
    lg.setLogLevel( 'info' )
35
    runMultiLink()