Thomas Vachuska | 3f06e08 | 2014-11-21 11:58:23 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import sys |
| 4 | |
| 5 | from mininet.net import Mininet |
| 6 | from mininet.cli import CLI |
| 7 | from mininet.log import setLogLevel |
| 8 | from mininet.node import RemoteController |
| 9 | from mininet.link import TCLink |
| 10 | |
| 11 | from attmpls import AttMplsTopo |
| 12 | |
| 13 | setLogLevel( 'info' ) |
| 14 | |
| 15 | def run(controllers=[ '127.0.0.1' ]): |
| 16 | net = Mininet( topo=AttMplsTopo(), link=TCLink, build=False, autoSetMacs=True ) |
| 17 | ctrl_count = 0 |
| 18 | for controllerIP in controllers: |
| 19 | net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP ) |
| 20 | net.build() |
| 21 | net.start() |
| 22 | CLI( net ) |
| 23 | net.stop() |
| 24 | |
| 25 | if __name__ == '__main__': |
| 26 | if len( sys.argv ) > 1: |
| 27 | controllers = sys.argv[ 1: ] |
| 28 | else: |
| 29 | print 'Usage: att-onos.py <c0 IP> <c1 IP> ...' |
| 30 | exit( 1 ) |
| 31 | run( controllers ) |