From a9366270c26b643a3c88795629090708c509cbf8 Mon Sep 17 00:00:00 2001 From: James Page Date: Fri, 9 Jun 2017 12:05:09 +0100 Subject: [PATCH] Update server nic handling for LXD style nic names Nova-LXD/LXD supports hotplugging of network interfaces, but nic names are a little different to those in qemu/kvm: 1249: eth0@if1250: mtu 1450 ... 1000 These are actually part of a veth pair (hence the @ annotation). Update server nic handling to deal with trailing '@if' so that nics get correctly detected when testing LXD based OpenStack Clouds. Change-Id: Ic7eb222d627513b9251772e2a3bf4909c4794a9f --- tempest/common/utils/linux/remote_client.py | 4 ++-- tempest/scenario/test_network_basic_ops.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py index 5ab980bf48..99a628eed5 100644 --- a/tempest/common/utils/linux/remote_client.py +++ b/tempest/common/utils/linux/remote_client.py @@ -93,12 +93,12 @@ class RemoteClient(remote_client.RemoteClient): def get_nic_name_by_mac(self, address): cmd = "ip -o link | awk '/%s/ {print $2}'" % address nic = self.exec_command(cmd) - return nic.strip().strip(":").lower() + return nic.strip().strip(":").split('@')[0].lower() def get_nic_name_by_ip(self, address): cmd = "ip -o addr | awk '/%s/ {print $2}'" % address nic = self.exec_command(cmd) - return nic.strip().strip(":").lower() + return nic.strip().strip(":").split('@')[0].lower() def get_dns_servers(self): cmd = 'cat /etc/resolv.conf' diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py index 9aeedaded5..4efeffdabd 100644 --- a/tempest/scenario/test_network_basic_ops.py +++ b/tempest/scenario/test_network_basic_ops.py @@ -295,7 +295,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): ssh_client.exec_command("sudo ip link set %s up" % new_nic) def _get_server_nics(self, ssh_client): - reg = re.compile(r'(?P\d+): (?P\w+):') + reg = re.compile(r'(?P\d+): (?P\w+)[@]?.*:') ipatxt = ssh_client.exec_command("ip address") return reg.findall(ipatxt)