Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 3 | from opticalUtils import MininetOE, LINCSwitch, LINCLink |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 4 | from mininet.topo import Topo |
| 5 | from mininet.log import setLogLevel |
| 6 | from mininet.node import RemoteController |
| 7 | from mininet.cli import CLI |
| 8 | |
| 9 | class SmallOpticalTopo( Topo ): |
| 10 | |
| 11 | def build( self ): |
| 12 | o1ann = { "latitude": 37.6, "longitude": -122.3, "optical.regens": 0 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 13 | O1 = self.addSwitch( 'SFO-W10', dpid='0000ffffffffff01', annotations=o1ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 14 | o2ann = { "latitude": 37.3, "longitude": -121.9, "optical.regens": 0 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 15 | O2 = self.addSwitch( 'SJC-W10', dpid='0000ffffffffff02', annotations=o2ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 16 | o3ann = { "latitude": 33.9, "longitude": -118.4, "optical.regens": 0 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 17 | O3 = self.addSwitch( 'LAX-W10', dpid='0000ffffffffff03', annotations=o3ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 18 | o4ann = { "latitude": 32.8, "longitude": -117.1, "optical.regens": 3 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 19 | O4 = self.addSwitch( 'SDG-W10', dpid='0000ffffffffff04', annotations=o4ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 20 | o5ann = { "latitude": 44.8, "longitude": -93.1, "optical.regens": 3 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 21 | O5 = self.addSwitch( 'MSP-M10', dpid='0000ffffffffff05', annotations=o5ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 22 | o6ann = { "latitude": 32.8, "longitude": -97.1, "optical.regens": 3 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 23 | O6 = self.addSwitch( 'DFW-M10', dpid='0000ffffffffff06', annotations=o6ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 24 | o7ann = { "latitude": 41.8, "longitude": -87.6, "optical.regens": 3 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 25 | O7 = self.addSwitch( 'CHG-N10', dpid='0000ffffffffff07', annotations=o7ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 26 | o8ann = { "latitude": 38.8, "longitude": -77.1, "optical.regens": 3 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 27 | O8 = self.addSwitch( 'IAD-M10', dpid='0000ffffffffff08', annotations=o8ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 28 | o9ann = { "latitude": 40.8, "longitude": -73.1, "optical.regens": 0 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 29 | O9 = self.addSwitch( 'JFK-M10', dpid='0000ffffffffff09', annotations=o9ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 30 | o10ann = { "latitude": 33.8, "longitude": -84.1, "optical.regens": 0 } |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 31 | O10 = self.addSwitch( 'ATL-S10', dpid='0000ffffffffff0a', annotations=o10ann, cls=LINCSwitch ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 32 | |
| 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 | |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 41 | self.addLink( O1, O2, port1=50, port2=30, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 42 | self.addLink( O2, O3, port1=50, port2=30, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 43 | self.addLink( O3, O4, port1=50, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 44 | self.addLink( O1, O5, port1=20, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 45 | self.addLink( O2, O5, port1=20, port2=20, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 46 | self.addLink( O3, O6, port1=20, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 47 | self.addLink( O4, O6, port1=20, port2=20, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 48 | self.addLink( O5, O6, port1=30, port2=40, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 49 | self.addLink( O5, O7, port1=40, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 50 | self.addLink( O6, O8, port1=30, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 51 | self.addLink( O7, O8, port1=20, port2=30, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 52 | self.addLink( O7, O9, port1=30, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 53 | self.addLink( O8, O10, port1=20, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
| 54 | self.addLink( O9, O10, port1=20, port2=20, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=LINCLink ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 55 | |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 56 | self.addLink( SFOR10, O1, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
Marc De Leenheer | 1afa2a0 | 2015-05-13 09:18:07 -0700 | [diff] [blame] | 57 | self.addLink( SFOR10, O1, port1=3, port2=11, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
| 58 | |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 59 | self.addLink( LAXR10, O3, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 60 | # added second tap |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 61 | self.addLink( LAXR10, O3, port1=3, port2=11, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
| 62 | self.addLink( SDGR10, O4, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
| 63 | self.addLink( CHGR10, O7, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
Marc De Leenheer | 1afa2a0 | 2015-05-13 09:18:07 -0700 | [diff] [blame] | 64 | |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 65 | self.addLink( JFKR10, O9, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
Marc De Leenheer | 1afa2a0 | 2015-05-13 09:18:07 -0700 | [diff] [blame] | 66 | self.addLink( JFKR10, O9, port1=3, port2=11, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
| 67 | |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 68 | self.addLink( ATLR10, O10, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=LINCLink ) |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 69 | |
| 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 | |
| 84 | if __name__ == '__main__': |
| 85 | import sys |
| 86 | if len( sys.argv ) >= 2: |
| 87 | controllers = sys.argv[1:] |
| 88 | else: |
fahad | 44e62c7 | 2015-03-04 14:55:35 -0800 | [diff] [blame] | 89 | print 'Usage:sudo -E python opticalTest.py (<Controller IP>)+' |
Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 90 | 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() |