diff options
Diffstat (limited to 'framework/src/onos/tools/test')
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-check-apps | 2 | ||||
-rw-r--r-- | framework/src/onos/tools/test/scenarios/setup.xml | 2 | ||||
-rw-r--r-- | framework/src/onos/tools/test/topos/opticalUtils.py | 35 |
3 files changed, 28 insertions, 11 deletions
diff --git a/framework/src/onos/tools/test/bin/onos-check-apps b/framework/src/onos/tools/test/bin/onos-check-apps index dfd6b4ef..5d83e416 100755 --- a/framework/src/onos/tools/test/bin/onos-check-apps +++ b/framework/src/onos/tools/test/bin/onos-check-apps @@ -24,7 +24,7 @@ for attempt in {1..3}; do # Check for differences case ${3:-equals} in equals) diff $aux.1 $aux.2;; - includes) [ $(egrep -c -f $aux.2 $aux.1) -eq $(wc -l $aux.2 | sed "s|$aux.2||g") ];; + includes) [ $(egrep -c -f $aux.2 $aux.1) -ge $(wc -l $aux.2 | sed "s|$aux.2||g") ];; excludes) ! egrep -f $aux.2 $aux.1;; esac diff --git a/framework/src/onos/tools/test/scenarios/setup.xml b/framework/src/onos/tools/test/scenarios/setup.xml index c26c0dea..071db8b9 100644 --- a/framework/src/onos/tools/test/scenarios/setup.xml +++ b/framework/src/onos/tools/test/scenarios/setup.xml @@ -40,7 +40,7 @@ <step name="Check-Components-${#}" exec="onos-check-components ${OC#}" requires="~Wait-for-Start-${#},"/> - <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#}" + <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#} ${ONOS_APPS} includes" requires="~Wait-for-Start-${#}"/> </parallel> </group> 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: |