blob: c19b0f146d0dd347733b59f59f90df8160061f50 [file] [log] [blame]
Thomas Vachuska3f06e082014-11-21 11:58:23 -08001#!/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
9from mininet.link import TCLink
10
11from attmpls import AttMplsTopo
12
13setLogLevel( 'info' )
14
Thomas Vachuska82041f52014-11-30 22:14:02 -080015def pingloop( net ):
16 setLogLevel( 'error' )
17 try:
18 while True:
19 net.ping()
20 finally:
21 setLogLevel( 'info' )
22
Thomas Vachuska3f06e082014-11-21 11:58:23 -080023def run(controllers=[ '127.0.0.1' ]):
Thomas Vachuska82041f52014-11-30 22:14:02 -080024 Mininet.pingloop = pingloop
Thomas Vachuska3f06e082014-11-21 11:58:23 -080025 net = Mininet( topo=AttMplsTopo(), link=TCLink, build=False, autoSetMacs=True )
26 ctrl_count = 0
27 for controllerIP in controllers:
28 net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP )
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: att-onos.py <c0 IP> <c1 IP> ...'
39 exit( 1 )
40 run( controllers )