Brian O'Connor | eb27c45 | 2014-12-07 02:43:58 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | from opticalUtils import MininetOE, OpticalSwitch, OpticalLink |
| 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 } |
| 13 | O1 = self.addSwitch( 'SFO-W10', dpid='0000ffffffffff01', annotations=o1ann, cls=OpticalSwitch ) |
| 14 | o2ann = { "latitude": 37.3, "longitude": -121.9, "optical.regens": 0 } |
| 15 | O2 = self.addSwitch( 'SJC-W10', dpid='0000ffffffffff02', annotations=o2ann, cls=OpticalSwitch ) |
| 16 | o3ann = { "latitude": 33.9, "longitude": -118.4, "optical.regens": 0 } |
| 17 | O3 = self.addSwitch( 'LAX-W10', dpid='0000ffffffffff03', annotations=o3ann, cls=OpticalSwitch ) |
| 18 | o4ann = { "latitude": 32.8, "longitude": -117.1, "optical.regens": 3 } |
| 19 | O4 = self.addSwitch( 'SDG-W10', dpid='0000ffffffffff04', annotations=o4ann, cls=OpticalSwitch ) |
| 20 | o5ann = { "latitude": 44.8, "longitude": -93.1, "optical.regens": 3 } |
| 21 | O5 = self.addSwitch( 'MSP-M10', dpid='0000ffffffffff05', annotations=o5ann, cls=OpticalSwitch ) |
| 22 | o6ann = { "latitude": 32.8, "longitude": -97.1, "optical.regens": 3 } |
| 23 | O6 = self.addSwitch( 'DFW-M10', dpid='0000ffffffffff06', annotations=o6ann, cls=OpticalSwitch ) |
| 24 | o7ann = { "latitude": 41.8, "longitude": -87.6, "optical.regens": 3 } |
| 25 | O7 = self.addSwitch( 'CHG-N10', dpid='0000ffffffffff07', annotations=o7ann, cls=OpticalSwitch ) |
| 26 | o8ann = { "latitude": 38.8, "longitude": -77.1, "optical.regens": 3 } |
| 27 | O8 = self.addSwitch( 'IAD-M10', dpid='0000ffffffffff08', annotations=o8ann, cls=OpticalSwitch ) |
| 28 | o9ann = { "latitude": 40.8, "longitude": -73.1, "optical.regens": 0 } |
| 29 | O9 = self.addSwitch( 'JFK-M10', dpid='0000ffffffffff09', annotations=o9ann, cls=OpticalSwitch ) |
| 30 | o10ann = { "latitude": 33.8, "longitude": -84.1, "optical.regens": 0 } |
Brian O'Connor | 025fb44 | 2014-12-08 20:02:15 -0800 | [diff] [blame] | 31 | O10 = self.addSwitch( 'ATL-S10', dpid='0000ffffffffff0a', annotations=o10ann, cls=OpticalSwitch ) |
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 | |
| 41 | self.addLink( O1, O2, port1=50, port2=30, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 42 | self.addLink( O2, O3, port1=50, port2=30, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 43 | self.addLink( O3, O4, port1=50, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 44 | self.addLink( O1, O5, port1=20, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 45 | self.addLink( O2, O5, port1=20, port2=20, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 46 | self.addLink( O3, O6, port1=20, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 47 | self.addLink( O4, O6, port1=20, port2=20, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 48 | self.addLink( O5, O6, port1=30, port2=40, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 49 | self.addLink( O5, O7, port1=40, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 50 | self.addLink( O6, O8, port1=30, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 51 | self.addLink( O7, O8, port1=20, port2=30, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 52 | self.addLink( O7, O9, port1=30, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 53 | self.addLink( O8, O10, port1=20, port2=50, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 54 | self.addLink( O9, O10, port1=20, port2=20, annotations={ "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1000, "durable": "true" }, cls=OpticalLink ) |
| 55 | |
| 56 | self.addLink( SFOR10, O1, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=OpticalLink ) |
| 57 | self.addLink( LAXR10, O3, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=OpticalLink ) |
| 58 | # added second tap |
| 59 | self.addLink( LAXR10, O3, port1=3, port2=11, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=OpticalLink ) |
| 60 | self.addLink( SDGR10, O4, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=OpticalLink ) |
| 61 | self.addLink( CHGR10, O7, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=OpticalLink ) |
| 62 | self.addLink( JFKR10, O9, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=OpticalLink ) |
| 63 | self.addLink( ATLR10, O10, port1=2, port2=10, speed1=10000, annotations={ "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" }, cls=OpticalLink ) |
| 64 | |
| 65 | h1 = self.addHost( 'h1' ) |
| 66 | h2 = self.addHost( 'h2' ) |
| 67 | h3 = self.addHost( 'h3' ) |
| 68 | h4 = self.addHost( 'h4' ) |
| 69 | h5 = self.addHost( 'h5' ) |
| 70 | h6 = self.addHost( 'h6' ) |
| 71 | |
| 72 | self.addLink( SFOR10, h1, port1=1 ) |
| 73 | self.addLink( LAXR10, h2, port1=1 ) |
| 74 | self.addLink( SDGR10, h3, port1=1 ) |
| 75 | self.addLink( CHGR10, h4, port1=1 ) |
| 76 | self.addLink( JFKR10, h5, port1=1 ) |
| 77 | self.addLink( ATLR10, h6, port1=1 ) |
| 78 | |
| 79 | if __name__ == '__main__': |
| 80 | import sys |
| 81 | if len( sys.argv ) >= 2: |
| 82 | controllers = sys.argv[1:] |
| 83 | else: |
| 84 | print 'Usage: ./opticalUtils.py (<Controller IP>)+' |
| 85 | print 'Using localhost...\n' |
| 86 | controllers = [ '127.0.0.1' ] |
| 87 | |
| 88 | setLogLevel( 'info' ) |
| 89 | net = MininetOE( topo=SmallOpticalTopo(), controller=None, autoSetMacs=True ) |
| 90 | net.addControllers( controllers ) |
| 91 | net.start() |
| 92 | CLI( net ) |
| 93 | net.stop() |