blob: 8e316fae7c75a2e763c9ea4690510e3f3e06474b [file] [log] [blame]
Brian O'Connoreb27c452014-12-07 02:43:58 -08001#!/usr/bin/python
2
fahad44e62c72015-03-04 14:55:35 -08003from opticalUtils import MininetOE, LINCSwitch, LINCLink
Brian O'Connoreb27c452014-12-07 02:43:58 -08004from mininet.topo import Topo
5from mininet.log import setLogLevel
6from mininet.node import RemoteController
7from mininet.cli import CLI
8
9class SmallOpticalTopo( Topo ):
10
11 def build( self ):
12 o1ann = { "latitude": 37.6, "longitude": -122.3, "optical.regens": 0 }
fahad44e62c72015-03-04 14:55:35 -080013 O1 = self.addSwitch( 'SFO-W10', dpid='0000ffffffffff01', annotations=o1ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080014 o2ann = { "latitude": 37.3, "longitude": -121.9, "optical.regens": 0 }
fahad44e62c72015-03-04 14:55:35 -080015 O2 = self.addSwitch( 'SJC-W10', dpid='0000ffffffffff02', annotations=o2ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080016 o3ann = { "latitude": 33.9, "longitude": -118.4, "optical.regens": 0 }
fahad44e62c72015-03-04 14:55:35 -080017 O3 = self.addSwitch( 'LAX-W10', dpid='0000ffffffffff03', annotations=o3ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080018 o4ann = { "latitude": 32.8, "longitude": -117.1, "optical.regens": 3 }
fahad44e62c72015-03-04 14:55:35 -080019 O4 = self.addSwitch( 'SDG-W10', dpid='0000ffffffffff04', annotations=o4ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080020 o5ann = { "latitude": 44.8, "longitude": -93.1, "optical.regens": 3 }
fahad44e62c72015-03-04 14:55:35 -080021 O5 = self.addSwitch( 'MSP-M10', dpid='0000ffffffffff05', annotations=o5ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080022 o6ann = { "latitude": 32.8, "longitude": -97.1, "optical.regens": 3 }
fahad44e62c72015-03-04 14:55:35 -080023 O6 = self.addSwitch( 'DFW-M10', dpid='0000ffffffffff06', annotations=o6ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080024 o7ann = { "latitude": 41.8, "longitude": -87.6, "optical.regens": 3 }
fahad44e62c72015-03-04 14:55:35 -080025 O7 = self.addSwitch( 'CHG-N10', dpid='0000ffffffffff07', annotations=o7ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080026 o8ann = { "latitude": 38.8, "longitude": -77.1, "optical.regens": 3 }
fahad44e62c72015-03-04 14:55:35 -080027 O8 = self.addSwitch( 'IAD-M10', dpid='0000ffffffffff08', annotations=o8ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080028 o9ann = { "latitude": 40.8, "longitude": -73.1, "optical.regens": 0 }
fahad44e62c72015-03-04 14:55:35 -080029 O9 = self.addSwitch( 'JFK-M10', dpid='0000ffffffffff09', annotations=o9ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080030 o10ann = { "latitude": 33.8, "longitude": -84.1, "optical.regens": 0 }
fahad44e62c72015-03-04 14:55:35 -080031 O10 = self.addSwitch( 'ATL-S10', dpid='0000ffffffffff0a', annotations=o10ann, cls=LINCSwitch )
Brian O'Connoreb27c452014-12-07 02:43:58 -080032
33
34 SFOR10 = self.addSwitch( 'SFO-R10', dpid='0000ffffffff0001', annotations={"latitude": 37.6, "longitude": -122.3} )
35 LAXR10 = self.addSwitch( 'LAX-R10', dpid='0000ffffffff0002', annotations={ "latitude": 33.9, "longitude": -118.4 } )
36 SDGR10 = self.addSwitch( 'SDG-R10', dpid='0000ffffffff0003', annotations={ "latitude": 32.8, "longitude": -117.1 } )
37 CHGR10 = self.addSwitch( 'CHG-R10', dpid='0000ffffffff0004', annotations={ "latitude": 41.8, "longitude": -87.6 } )
38 JFKR10 = self.addSwitch( 'JFK-R10', dpid='0000ffffffff0005', annotations={ "latitude": 40.8, "longitude": -73.1 } )
39 ATLR10 = self.addSwitch( 'ATL-R10', dpid='0000ffffffff0006', annotations={ "latitude": 33.8, "longitude": -84.1 } )
40
Marc De Leenheer32fc3d22015-12-15 21:36:39 -080041 self.addLink( O1, O2, port1=50, port2=30, annotations={ "durable": "true" }, cls=LINCLink )
42 self.addLink( O2, O3, port1=50, port2=30, annotations={ "durable": "true" }, cls=LINCLink )
43 self.addLink( O3, O4, port1=50, port2=50, annotations={ "durable": "true" }, cls=LINCLink )
44 self.addLink( O1, O5, port1=20, port2=50, annotations={ "durable": "true" }, cls=LINCLink )
45 self.addLink( O2, O5, port1=20, port2=20, annotations={ "durable": "true" }, cls=LINCLink )
46 self.addLink( O3, O6, port1=20, port2=50, annotations={ "durable": "true" }, cls=LINCLink )
47 self.addLink( O4, O6, port1=20, port2=20, annotations={ "durable": "true" }, cls=LINCLink )
48 self.addLink( O5, O6, port1=30, port2=40, annotations={ "durable": "true" }, cls=LINCLink )
49 self.addLink( O5, O7, port1=40, port2=50, annotations={ "durable": "true" }, cls=LINCLink )
50 self.addLink( O6, O8, port1=30, port2=50, annotations={ "durable": "true" }, cls=LINCLink )
51 self.addLink( O7, O8, port1=20, port2=30, annotations={ "durable": "true" }, cls=LINCLink )
52 self.addLink( O7, O9, port1=30, port2=50, annotations={ "durable": "true" }, cls=LINCLink )
53 self.addLink( O8, O10, port1=20, port2=50, annotations={ "durable": "true" }, cls=LINCLink )
54 self.addLink( O9, O10, port1=20, port2=20, annotations={ "durable": "true" }, cls=LINCLink )
Brian O'Connoreb27c452014-12-07 02:43:58 -080055
Marc De Leenheer32fc3d22015-12-15 21:36:39 -080056 self.addLink( SFOR10, O1, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
57 self.addLink( SFOR10, O1, port1=3, port2=11, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070058
Marc De Leenheer32fc3d22015-12-15 21:36:39 -080059 self.addLink( LAXR10, O3, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
Brian O'Connoreb27c452014-12-07 02:43:58 -080060 # added second tap
Marc De Leenheer32fc3d22015-12-15 21:36:39 -080061 self.addLink( LAXR10, O3, port1=3, port2=11, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
62 self.addLink( SDGR10, O4, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
63 self.addLink( CHGR10, O7, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070064
Marc De Leenheer32fc3d22015-12-15 21:36:39 -080065 self.addLink( JFKR10, O9, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
66 self.addLink( JFKR10, O9, port1=3, port2=11, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070067
Marc De Leenheer32fc3d22015-12-15 21:36:39 -080068 self.addLink( ATLR10, O10, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "durable": "true" }, cls=LINCLink )
Brian O'Connoreb27c452014-12-07 02:43:58 -080069
70 h1 = self.addHost( 'h1' )
71 h2 = self.addHost( 'h2' )
72 h3 = self.addHost( 'h3' )
73 h4 = self.addHost( 'h4' )
74 h5 = self.addHost( 'h5' )
75 h6 = self.addHost( 'h6' )
76
77 self.addLink( SFOR10, h1, port1=1 )
78 self.addLink( LAXR10, h2, port1=1 )
79 self.addLink( SDGR10, h3, port1=1 )
80 self.addLink( CHGR10, h4, port1=1 )
81 self.addLink( JFKR10, h5, port1=1 )
82 self.addLink( ATLR10, h6, port1=1 )
83
84if __name__ == '__main__':
85 import sys
86 if len( sys.argv ) >= 2:
87 controllers = sys.argv[1:]
88 else:
fahad44e62c72015-03-04 14:55:35 -080089 print 'Usage:sudo -E python opticalTest.py (<Controller IP>)+'
Brian O'Connoreb27c452014-12-07 02:43:58 -080090 print 'Using localhost...\n'
91 controllers = [ '127.0.0.1' ]
92
93 setLogLevel( 'info' )
94 net = MininetOE( topo=SmallOpticalTopo(), controller=None, autoSetMacs=True )
95 net.addControllers( controllers )
96 net.start()
97 CLI( net )
98 net.stop()