def getDeviceGroupObjAndIpObjBySrcIp(self, srcIpAddress): """ Description Search each Topology/Device Group for the srcIpAddress. If found, return the Device Group object and the IPv4|Ipv6 objects. if srcIpAddress is IPv6, the format must match what is shown in the GUI or API server. Please verify how the configured IPv6 format looks like on either the IxNetwork API server when you are testing your script during development. Parameter srcIpAddress: : The source IP address. Returns None: If no srcIpAddress is found. deviceGroup Object and IPv4|IPv6 object """ queryData = {'from': '/', 'nodes': [{'node': 'topology', 'properties': [], 'where': []}, {'node': 'deviceGroup', 'properties': [], 'where': []}, {'node': 'ethernet', 'properties': [], 'where': []}, {'node': 'ipv4', 'properties': ['address'], 'where': []}, {'node': 'ipv6', 'properties': ['address'], 'where': []} ]} queryResponse = self.ixnObj.query(data=queryData, silentMode=False) for topology in queryResponse.json()['result'][0]['topology']: for deviceGroup in topology['deviceGroup']: for ethernet in deviceGroup['ethernet']: try: if bool(re.match(r'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', srcIpAddress)): srcIpMultivalue = ethernet['ipv4'][0]['address'] ipObj = ethernet['ipv4'][0]['href'] else: # IPv6 format: ['2000:0:0:1:0:0:0:2', '2000:0:0:2:0:0:0:2', '2000:0:0:3:0:0:0:2', '2000:0:0:4:0:0:0:2'] srcIpMultivalue = ethernet['ipv6'][0]['address'] ipObj = ethernet['ipv6'][0]['href'] response = self.ixnObj.getMultivalueValues(srcIpMultivalue) if srcIpAddress in response: self.ixnObj.logInfo('Found srcIpAddress: %s' % srcIpAddress) return deviceGroup['href'],ipObj except: pass