Statistics
| Branch: | Tag: | Revision:

mininet / examples / treeping64.py @ 45e82d09

History | View | Annotate | Download (1.12 KB)

1 45e82d09 Bob Lantz
#!/usr/bin/python
2
3
"Create a 64-node tree network, and test connectivity using ping."
4
   
5
from mininet.cli import CLI
6
from mininet.log import setLogLevel
7
from mininet.net import init, Mininet
8
from mininet.node import KernelSwitch, UserSwitch, OVSKernelSwitch
9
from mininet.topolib import TreeTopo
10
11
def TreeNet( depth=1, fanout=2, **kwargs ):
12
    "Convenience function for creating tree networks."
13
    topo = TreeTopo( depth, fanout )
14
    return Mininet( topo, **kwargs )
15
    
16
def treePing64():
17
    results = {}
18
    switches = { 'reference kernel': KernelSwitch,
19
        'reference user': UserSwitch,
20
        'Open vSwitch kernel': OVSKernelSwitch }
21
22
    for name in switches.keys():
23
        print "*** Testing", name, "datapath"
24
        switch = switches[ name ]
25
        network = TreeNet( depth=2, fanout=8, switch=switch )
26
        result = network.run( network.pingAll )
27
        results[ name ] = result
28
29
    print  
30
    print "*** Tree network ping results:"
31
    for name in switches.keys():
32
        print "%s: %d%% packet loss" % ( name, results[ name ] )
33
    print
34
   
35
if __name__ == '__main__':
36
   setLogLevel( 'info' )
37
   init()
38
   treePing64()