def verifyDeviceGroupStatus(self): queryData = {'from': '/', 'nodes': [{'node': 'topology', 'properties': [], 'where': []}, {'node': 'deviceGroup', 'properties': ['href', 'enabled'], 'where': []}, {'node': 'deviceGroup', 'properties': ['href', 'enabled'], 'where': []}] } queryResponse = self.ixnObj.query(data=queryData) deviceGroupTimeout = 90 for topology in queryResponse.json()['result'][0]['topology']: for deviceGroup in topology['deviceGroup']: deviceGroupObj = deviceGroup['href'] response = self.ixnObj.get(self.ixnObj.httpHeader+deviceGroupObj, silentMode=False) # Verify if the Device Group is enabled. If not, don't go further. enabledMultivalue = response.json()['enabled'] enabled = self.ixnObj.getMultivalueValues(enabledMultivalue, silentMode=False) if enabled[0] == 'true': for counter in range(1,deviceGroupTimeout+1): response = self.ixnObj.get(self.ixnObj.httpHeader+deviceGroupObj, silentMode=False) deviceGroupStatus = response.json()['status'] self.ixnObj.logInfo('\t%s' % deviceGroupObj, timestamp=False) self.ixnObj.logInfo('\t\tStatus: %s' % deviceGroupStatus, timestamp=False) if counter < deviceGroupTimeout and deviceGroupStatus != 'started': self.ixnObj.logInfo('\t\tWaiting %d/%d seconds ...' % (counter, deviceGroupTimeout), timestamp=False) time.sleep(1) if counter < deviceGroupTimeout and deviceGroupStatus == 'started': break if counter == deviceGroupTimeout and deviceGroupStatus != 'started': raise IxNetRestApiException('\nDevice Group failed to start up') # Inner Device Group if deviceGroup['deviceGroup'] != []: innerDeviceGroupObj = deviceGroup['deviceGroup'][0]['href'] for counter in range(1,deviceGroupTimeout): response = self.ixnObj.get(self.ixnObj.httpHeader+innerDeviceGroupObj, silentMode=True) innerDeviceGroupStatus = response.json()['status'] self.ixnObj.logInfo('\tInnerDeviceGroup: %s' % innerDeviceGroupObj, timestamp=False) self.ixnObj.logInfo('\t Status: %s' % innerDeviceGroupStatus, timestamp=False) if counter < deviceGroupTimeout and innerDeviceGroupStatus != 'started': self.ixnObj.logInfo('\tWait %d/%d' % (counter, deviceGroupTimeout), timestamp=False) time.sleep(1) if counter < deviceGroupTimeout and innerDeviceGroupStatus == 'started': break if counter == deviceGroupTimeout and innerDeviceGroupStatus != 'started': raise IxNetRestApiException('\nInner Device Group failed to start up') print()