def getDeviceGroupSrcIpGatewayIp(self, srcIpAddress): """ Description Search each Topology's Device Group for the provided srcIpAddress. If found, get the gateway IP address. Parameter srcIpAddress: : The source IP address. Returns 0: Failed. No srcIpAddress found in any Device Group. Gateway IP address """ queryData = {'from': '/', 'nodes': [{'node': 'topology', 'properties': [], 'where': []}, {'node': 'deviceGroup', 'properties': [], 'where': []}, {'node': 'ethernet', 'properties': [], 'where': []}, {'node': 'ipv4', 'properties': ['address', 'gatewayIp'], 'where': []}, ]} queryResponse = self.ixnObj.query(data=queryData, silentMode=False) for topology in queryResponse.json()['result'][0]['topology']: for deviceGroup in topology['deviceGroup']: try: srcIpMultivalue = deviceGroup['ethernet'][0]['ipv4'][0]['address'] gatewayIpMultivalue = deviceGroup['ethernet'][0]['ipv4'][0]['gatewayIp'] response = self.ixnObj.getMultivalueValues(srcIpMultivalue) srcIp = response[0] if srcIpAddress == srcIp: self.ixnObj.logInfo('Found srcIpAddress: %s. Getting Gatway IP address ...' % srcIpAddress) response = self.ixnObj.getMultivalueValues(gatewayIpMultivalue) gatewayIp = response[0] self.ixnObj.logInfo('Gateway IP address: %s' % gatewayIp) return gatewayIp except: pass return 0