blob: 109d335d5ad7e5cc762a2121927de6e9a3f47d4b [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 )
Thomas Vachuska0a4c2702015-07-06 08:43:41 -070029 ctrl_count = ctrl_count + 1
Thomas Vachuska3f06e082014-11-21 11:58:23 -080030 net.build()
31 net.start()
32 CLI( net )
33 net.stop()
34
35if __name__ == '__main__':
36 if len( sys.argv ) > 1:
37 controllers = sys.argv[ 1: ]
38 else:
39 print 'Usage: att-onos.py <c0 IP> <c1 IP> ...'
40 exit( 1 )
41 run( controllers )