Statistics
| Branch: | Tag: | Revision:

mininet / examples / multilink.py @ 0fac568a

History | View | Annotate | Download (834 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 setLogLevel
10
from mininet.net import Mininet
11
from mininet.topo import Topo
12

    
13
def runMultiLink():
14
    "Create and run multiple link network"
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
    "Simple topology with multiple links"
23

    
24
    def __init__( self, n, **kwargs ):
25
        Topo.__init__( self, **kwargs )
26

    
27
        h1, h2 = self.addHost( 'h1' ), self.addHost( 'h2' )
28
        s1 = self.addSwitch( 's1' )
29

    
30
        for _ in range( n ):
31
            self.addLink( s1, h1 )
32
            self.addLink( s1, h2 )
33

    
34
if __name__ == '__main__':
35
    setLogLevel( 'info' )
36
    runMultiLink()