Revision 45e82d09

View differences:

examples/README
29 29
already lives in the root namespace, so it does not need to be explicitly
30 30
connected.)
31 31

  
32
treeping64:
33

  
34
This example creates a 64-host tree network, and attempts to check full
35
connectivity using ping, for three different switch/datapath types.
36

  
37
tree1024.py:
38

  
39
This example attempts to create a 1024-host network, and then runs the
40
CLI on it. It may run into scalability limits, depending on available
41
memory and sysctl configuration (see INSTALL.)
42

  
32 43
udpbwtest.py:
33 44

  
34 45
This example shows how to run a test across an entire network, and monitor
35 46
the output of a set of hosts in real time.
36

  
examples/tree1024.py
1
#!/usr/bin/python
2

  
3
"""
4
Create a 1024-host network, and run the CLI on it.
5
If this fails because of kernel limits, you may have
6
to adjust them, e.g. by adding entries to /etc/sysctl.conf
7
and running sysctl -p. Check util/sysctl_addon.
8
"""
9

  
10
from mininet.cli import CLI
11
from mininet.log import setLogLevel
12
from mininet.net import init, Mininet
13
from mininet.node import KernelSwitch
14
from mininet.topolib import TreeTopo
15

  
16
def TreeNet( depth=1, fanout=2, **kwargs ):
17
    "Convenience function for creating tree networks."
18
    topo = TreeTopo( depth, fanout )
19
    return Mininet( topo, **kwargs )
20
    
21
if __name__ == '__main__':
22
    setLogLevel( 'info' )
23
    init()
24
    KernelSwitch.setup()
25
    network = TreeNet( depth=2, fanout=32, switch=KernelSwitch )
26
    network.run( CLI, network )
examples/treeping64.py
1
#!/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()

Also available in: Unified diff