blob: bcb40f7043baa1267756ab5f51e051c8d6568364 [file] [log] [blame]
carlosmscabralf40ecd12013-02-01 18:15:58 -02001#!/usr/bin/python
2
3"""
4This example shows how to create a network and run multiple tests.
5For a more complicated test example, see udpbwtest.py.
6"""
7
8from mininet.cli import CLI
9from mininet.log import lg, info
10from mininet.net import Mininet
11from mininet.node import OVSKernelSwitch
12from mininet.topolib import TreeTopo
13
14def ifconfigTest( net ):
15 "Run ifconfig on all hosts in net."
16 hosts = net.hosts
17 for host in hosts:
18 info( host.cmd( 'ifconfig' ) )
19
20if __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" )
27 network.start()
28 info( "*** Running ping test\n" )
29 network.pingAll()
30 info( "*** Running ifconfig test\n" )
31 ifconfigTest( network )
32 info( "*** Starting CLI (type 'exit' to exit)\n" )
33 CLI( network )
34 info( "*** Stopping network\n" )
35 network.stop()