acsmars
Committed by Gerrit Code Review

Fixed timeout logic for waiting for onos device discovery in opticalUtils.py

Change-Id: I6e019cf8eafed296f4b4a345ac18c7ddc62acee0
...@@ -469,16 +469,15 @@ class LINCSwitch(OpticalSwitch): ...@@ -469,16 +469,15 @@ class LINCSwitch(OpticalSwitch):
469 devs = response.get('devices') 469 devs = response.get('devices')
470 470
471 # Wait for all devices to be registered. There is a chance that this is only a subgraph. 471 # Wait for all devices to be registered. There is a chance that this is only a subgraph.
472 - if (len(devices) > len(devs)): 472 + if (len(devices) == len(devs)):
473 - continue 473 +
474 - 474 + # Wait for all devices to available
475 - # Wait for all devices to available 475 + available = True
476 - available = True 476 + for d in devs:
477 - for d in devs: 477 + if d['id'] in devlist:
478 - if d['id'] in devlist: 478 + available &= d['available']
479 - available &= d['available'] 479 + if available:
480 - if available: 480 + break
481 - break
482 481
483 if (time >= TIMEOUT): 482 if (time >= TIMEOUT):
484 error('***ERROR: ONOS did not register devices within %s seconds\n' % TIMEOUT) 483 error('***ERROR: ONOS did not register devices within %s seconds\n' % TIMEOUT)
......