diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-22 10:02:05 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-22 10:02:05 -0800 |
commit | 77ce3be7567bd01c66d8ee88a93b485666723501 (patch) | |
tree | 283e7f39a501750bbd705fbb91645b20198900f1 /framework/src/onos/tools/test/topos | |
parent | 00e6500d0813dcbccaaa741ef38cc1eae6d11e07 (diff) |
Removed patch path since changes have been merged upstream to a different path. Updated README with directions.
Change-Id: Ie419abd2d3d3ef7315de9f607dcd757a78190995
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/tools/test/topos')
-rw-r--r-- | framework/src/onos/tools/test/topos/opticalUtils.py | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/framework/src/onos/tools/test/topos/opticalUtils.py b/framework/src/onos/tools/test/topos/opticalUtils.py index 5d955e51..87903cc5 100644 --- a/framework/src/onos/tools/test/topos/opticalUtils.py +++ b/framework/src/onos/tools/test/topos/opticalUtils.py @@ -58,7 +58,7 @@ import os from time import sleep import urllib2 -from mininet.node import Switch, RemoteController +from mininet.node import Switch, OVSSwitch, RemoteController from mininet.topo import Topo from mininet.util import quietRun from mininet.net import Mininet @@ -356,8 +356,18 @@ class LINCSwitch(OpticalSwitch): return configDict @staticmethod - def bootOE(net): - "Start the LINC optical emulator within a mininet instance" + def bootOE(net, domain=None): + """ + Start the LINC optical emulator within a mininet instance + + This involves 1. converting the information stored in Linc* to configs + for both LINC and the network config system, 2. starting Linc, 3. connecting + cross-connects, and finally pushing the network configs to ONOS. + + Inevitably, there are times when we have OVS switches that should not be + under the control of the controller in charge of the Linc switches. We + hint at these by passing domain information. + """ LINCSwitch.opticalJSON = {} linkConfig = [] devices = [] @@ -365,9 +375,11 @@ class LINCSwitch(OpticalSwitch): LINCSwitch.controllers = net.controllers for switch in net.switches: + if domain and switch not in domain: + continue if isinstance(switch, OpticalSwitch): devices.append(switch.json()) - else: + elif isinstance(switch, OVSSwitch): devices.append(LINCSwitch.switchJSON(switch)) LINCSwitch.opticalJSON[ 'devices' ] = devices @@ -450,18 +462,21 @@ class LINCSwitch(OpticalSwitch): opener = urllib2.build_opener(handler) opener.open(url) urllib2.install_opener(opener) + # focus on just checking the state of devices we're interested in + devlist = map( lambda x: x['uri'], devices ) while True: response = json.load(urllib2.urlopen(url)) devs = response.get('devices') - # Wait for all devices to be registered - if (len(devices) != len(devs)): + # Wait for all devices to be registered. There is a chance that this is only a subgraph. + if (len(devices) > len(devs)): continue # Wait for all devices to available available = True for d in devs: - available &= d['available'] + if d['id'] in devlist: + available &= d['available'] if available: break @@ -615,9 +630,11 @@ class LINCSwitch(OpticalSwitch): if isinstance(link, LINCLink): if link.annotations[ 'optical.type' ] == 'cross-connect': tapCount += 1 - while True: - if str(tapCount) == quietRun('ip addr | grep tap | wc -l', shell=True).strip('\n'): + # tapCount can be less than the actual number of taps if the optical network + # is a subgraph of a larger multidomain network. + tapNum = int(quietRun('ip addr | grep tap | wc -l', shell=True).strip('\n')) + if tapCount <= tapNum: return True if timeout: if time >= TIMEOUT: |