def verifyAllProtocolSessionsInternal(self, protocol, timeout=120, silentMode=True): """ Description Verify protocol sessions for UP state. Initially created for verifyAllProtocolSessionsNgpf(), but this API will also work by passing in a protocol object. Parameters protocol: : The protocol object to verify the session state. timeout: : The timeout value for declaring as failed. Default = 120 seconds. silentMode: : True to not display less on the terminal. False for debugging purpose. """ sessionDownList = ['down', 'notStarted'] startCounter = 1 response = self.ixnObj.get(self.ixnObj.httpHeader+protocol, silentMode=silentMode) protocolActiveMultivalue = response.json()['active'] response = self.ixnObj.getMultivalueValues(protocolActiveMultivalue, silentMode=silentMode) self.ixnObj.logInfo('\t%s' % protocol, timestamp=False) self.ixnObj.logInfo('\tProtocol is enabled: %s\n' % response[0], timestamp=False) if response[0] == 'false': return for timer in range(startCounter, timeout+1): currentStatus = self.getSessionStatus(protocol) self.ixnObj.logInfo('\n%s' % protocol, timestamp=False) self.ixnObj.logInfo('\tTotal sessions: %d' % len(currentStatus), timestamp=False) totalDownSessions = 0 for eachStatus in currentStatus: if eachStatus != 'up': totalDownSessions += 1 self.ixnObj.logInfo('\tTotal sessions Down: %d' % totalDownSessions, timestamp=False) #self.ixnObj.logInfo('\tCurrentStatus: %s' % currentStatus, timestamp=False) if timer < timeout and [element for element in sessionDownList if element in currentStatus] == []: self.ixnObj.logInfo('Protocol sessions are all up') startCounter = timer break if timer < timeout and [element for element in sessionDownList if element in currentStatus] != []: self.ixnObj.logInfo('\tWait %d/%d seconds' % (timer, timeout), timestamp=False) time.sleep(1) continue if timer == timeout and [element for element in sessionDownList if element in currentStatus] != []: raise IxNetRestApiException('\nError: Protocols failed')