def getCapabilities(self): api = API.Global() ret = api.getCapabilities() ret['info']['lastClient'] = self.cif.threadLocal.client ret['info']['lastClientIface'] = getDeviceByIP( self.cif.threadLocal.server) return ret
def Host_getCapabilities_Ret(server_address, ret): """ We need to add additional information to getCaps as it is done for xmlrpc. """ ret['info']['lastClientIface'] = getDeviceByIP(server_address) return ret['info']
def getCapabilities(self): api = API.Global() ret = api.getCapabilities() ret["info"]["management_ip"] = self.serverIP ret["info"]["lastClient"] = self.cif.threadLocal.client ret["info"]["lastClientIface"] = getDeviceByIP(self.cif.threadLocal.server) return ret
def testGetDeviceByIP(self): for addr in nl_addr.iter_addrs(): # Link-local IPv6 addresses are generated from the MAC address, # which is shared between a nic and its bridge. Since We don't # support having the same IP address on two different NICs, and # link-local IPv6 addresses aren't interesting for 'getDeviceByIP' # then ignore them in the test if addr['scope'] != 'link': self.assertEqual( addr['label'], netinfo.getDeviceByIP(addr['address'].split('/')[0]))
def testGetDeviceByIP(self): for dev in ethtool.get_interfaces_info(ethtool.get_active_devices()): # Link-local IPv6 addresses are generated from the MAC address, # which is shared between a nic and its bridge. Since We don't # support having the same IP address on two different NICs, and # link-local IPv6 addresses aren't interesting for 'getDeviceByIP' # then ignore them in the test ipaddrs = [ipv6.address for ipv6 in dev.get_ipv6_addresses() if ipv6.scope != 'link'] if dev.ipv4_address is not None: ipaddrs.append(dev.ipv4_address) for ip in ipaddrs: self.assertEqual(dev.device, netinfo.getDeviceByIP(ip))
def testGetDeviceByIP(self): for dev in ethtool.get_interfaces_info(ethtool.get_active_devices()): # Link-local IPv6 addresses are generated from the MAC address, # which is shared between a nic and its bridge. Since We don't # support having the same IP address on two different NICs, and # link-local IPv6 addresses aren't interesting for 'getDeviceByIP' # then ignore them in the test ipaddrs = [ ipv6.address for ipv6 in dev.get_ipv6_addresses() if ipv6.scope != 'link' ] if dev.ipv4_address is not None: ipaddrs.append(dev.ipv4_address) for ip in ipaddrs: self.assertEqual(dev.device, netinfo.getDeviceByIP(ip))