def getIpAddrIndexNumber(self, ipAddress): """ Description Get the index ID of the IP address. Parameter ipAddress: : The IPv4|IPv6 address to search for its index. Return None or the IP address index number (based one) """ topologyList = self.ixnObj.get(self.ixnObj.sessionUrl + '/topology') for topology in topologyList.json(): topologyObj = topology['links'][0]['href'] deviceGroupList = self.ixnObj.get(self.ixnObj.httpHeader + topologyObj + '/deviceGroup') for deviceGroup in deviceGroupList.json(): deviceGroupObj = deviceGroup['links'][0]['href'] ethernetList = self.ixnObj.get(self.ixnObj.httpHeader + deviceGroupObj + '/ethernet') for ethernet in ethernetList.json(): ethernetObj = ethernet['links'][0]['href'] if '.' in ipAddress: ipList = self.ixnObj.get(self.ixnObj.httpHeader + ethernetObj + '/ipv4') if ':' in ipAddress: ipList = self.ixnObj.get(self.ixnObj.httpHeader + ethernetObj + '/ipv6') for ip in ipList.json(): ipObj = ip['links'][0]['href'] response = self.ixnObj.get(self.ixnObj.httpHeader + ipObj) ipMultivalue = response.json()['address'] response = self.ixnObj.get(self.ixnObj.httpHeader + ipMultivalue + '?includes=values') ipValueList = response.json()['values'] for index, ip in enumerate(ipValueList): if ipAddress in ipValueList: index = ipValueList.index(ipAddress) print(index, ipAddress) # Return index number using based one. Not based zero. return index + 1