def verifyNgpfProtocolStarted(self, protocolObj, ignoreFailure=False, timeout=30): """ Description Verify if NGPF protocol started. Parameter protocolObj: : /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1 timeout: : The timeout value. Default=30 seconds. """ for counter in range(1,timeout+1): # sessionStatus is a list of status for each 'session' (host) sessionStatus = self.getSessionStatus(protocolObj) self.ixnObj.logInfo('\nVerifyNgpfProtocolStarted: %s' % protocolObj, timestamp=False) if counter < timeout: count = 0 for session in sessionStatus: if session in ['notStarted', 'down']: count += 1 self.ixnObj.logInfo('\t{0} out of {1} sessions are still down'.format(count, len(sessionStatus)), timestamp=False) self.ixnObj.logInfo('\tWait %d/%d seconds' % (counter, timeout), timestamp=False) time.sleep(1) if counter == timeout: count = 0 for session in sessionStatus: if session in ['notStarted', 'down']: count += 1 if count != 0: errMsg = '{0} out of {1} sessions failed to start'.format(count, len(sessionStatus)) self.ixnObj.logError(errMsg) if ignoreFailure == False: raise IxNetRestApiException(errMsg) else: return 1 if counter < timeout: flag = 0 for session in sessionStatus: if session in ['notStarted', 'down']: flag = 1 if flag == 0: self.ixnObj.logInfo('\tTotal of {0} sessions started'.format(len(sessionStatus)), timestamp=False) return 0