def verifyProtocolSessionsNgpf(self, protocolObjList=None, timeout=90): """ Description Either verify the user specified protocol list to verify for session UP or verify the default object's self.configuredProtocols list that accumulates the emulation protocol object when it was configured. When verifying IPv4, this API will verify ARP failures and return you a list of IP interfaces that failed ARP. Parameters protocolObjList: : A list of protocol objects. Default = None. The class will automatically verify all of the configured protocols. Ex: ['/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1', '/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1', '/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1/bgpIpv4Peer/1', '/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1/ospfv2/1',] timeout: : Total wait time for all the protocols in the provided list to come up. Syntaxes GET: http://10.219.117.103:11009/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1 RESPONSE: [u'notStarted', u'notStarted', u'notStarted', u'notStarted', u'notStarted', u'notStarted'] GET: http://10.219.117.103:11009/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1 RESPONSE: [u'up', u'up', u'up', u'up', u'up', u'up', u'up', u'up'] GET: http://10.219.117.103:11009/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv4/1/bgpIpv4Peer/1 """ timerStop = timeout if protocolObjList is None: protocolObjList = self.configuredProtocols for eachProtocol in protocolObjList: # notStarted, up or down protocolName = eachProtocol.split('/')[-2] for timer in range(1,timerStop+1): sessionStatus = self.getSessionStatus(eachProtocol) # ['up'] response = self.ixnObj.get(self.ixnObj.httpHeader+eachProtocol, silentMode=True) # Started protocolSessionStatus = response.json()['status'] self.ixnObj.logInfo('\nVerifyProtocolSessions: %s\n' % eachProtocol, timestamp=False) self.ixnObj.logInfo('\tprotocolSessionStatus: %s' % protocolSessionStatus, timestamp=False) self.ixnObj.logInfo('\tsessionStatusResponse: %s' % sessionStatus, timestamp=False) if timer < timerStop: if protocolSessionStatus != 'started': self.ixnObj.logInfo('\tWait %s/%s seconds' % (timer, timerStop), timestamp=False) time.sleep(1) continue # Started if 'up' not in sessionStatus: self.ixnObj.logInfo('\tProtocol session is down: Wait %s/%s seconds' % (timer, timerStop), timestamp=False) time.sleep(1) continue if 'up' in sessionStatus: self.ixnObj.logInfo('Protocol sessions are all up: {0}'.format(protocolName)) break if timer == timerStop: if 'notStarted' in protocolSessionStatus: raise IxNetRestApiException('\tverifyProtocolSessions: {0} session failed to start'.format(protocolName)) if protocolSessionStatus == 'started' and 'down' in sessionStatus: # Show ARP failures if protocolName == 'ipv4': ipInterfaceIndexList = [] index = 0 for eachSessionStatus in sessionStatus: self.ixnObj.logInfo('eachSessionStatus index: {0} {1}'.format(eachSessionStatus, index), timestamp=False) if eachSessionStatus == 'down': ipInterfaceIndexList.append(index) index += 1 ipMultivalue = response.json()['address'] ipAddressList = self.ixnObj.getMultivalueValues(ipMultivalue, silentMode=True) self.ixnObj.logWarning('ARP failed on IP interface:') for eachIpIndex in ipInterfaceIndexList: self.ixnObj.logInfo('\t{0}'.format(ipAddressList[eachIpIndex]), timestamp=False) else: self.ixnObj.logWarning('\tverifyProtocolSessions: {0} session failed'.format(protocolName)) raise IxNetRestApiException('Verify protocol sessions failed: {0}'.format(protocolName))