4 This example shows how to create a network and run multiple tests.
5 For a more complicated test example, see udpbwtest.py.
8 from mininet.cli import CLI
9 from mininet.log import lg, info
10 from mininet.net import Mininet
11 from mininet.node import OVSKernelSwitch
12 from mininet.topolib import TreeTopo
14 def ifconfigTest( net ):
15 "Run ifconfig on all hosts in net."
18 info( host.cmd( 'ifconfig' ) )
20 if __name__ == '__main__':
21 lg.setLogLevel( 'info' )
22 info( "*** Initializing Mininet and kernel modules\n" )
23 OVSKernelSwitch.setup()
24 info( "*** Creating network\n" )
25 network = Mininet( TreeTopo( depth=2, fanout=2 ), switch=OVSKernelSwitch )
26 info( "*** Starting network\n" )
28 info( "*** Running ping test\n" )
30 info( "*** Running ifconfig test\n" )
31 ifconfigTest( network )
32 info( "*** Starting CLI (type 'exit' to exit)\n" )
34 info( "*** Stopping network\n" )