blob: 7aba54f906fb2e9f5c1f39b81e3e3bc554c33ddf [file] [log] [blame]
Thomas Vachuskae76f6532015-07-08 09:40:53 -07001#!/usr/bin/python
2
3import sys
4
5from mininet.net import Mininet
6from mininet.cli import CLI
7from mininet.log import setLogLevel
8from mininet.node import RemoteController
9
10from rftesttopo import ReactiveForwardingTestTopo
11
12setLogLevel( 'info' )
13
14def pingloop( net ):
15 setLogLevel( 'error' )
16 try:
17 while True:
18 net.ping()
19 finally:
20 setLogLevel( 'info' )
21
22def run(controllers=[ '127.0.0.1' ]):
23 Mininet.pingloop = pingloop
24 net = Mininet( topo=ReactiveForwardingTestTopo(), build=False, autoSetMacs=True )
25 ctrl_count = 0
26 for controllerIP in controllers:
27 net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP )
28 ctrl_count = ctrl_count + 1
29 net.build()
30 net.start()
31 CLI( net )
32 net.stop()
33
34if __name__ == '__main__':
35 if len( sys.argv ) > 1:
36 controllers = sys.argv[ 1: ]
37 else:
38 print 'Usage: rf-test.py <c0 IP> <c1 IP> ...'
39 exit( 1 )
40 run( controllers )