Merge "Update server nic handling for LXD style nic names"

This commit is contained in:
Jenkins 2017-06-12 23:40:48 +00:00 committed by Gerrit Code Review
commit c45d4dd071
2 changed files with 3 additions and 3 deletions

View File

@ -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'

View File

@ -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<num>\d+): (?P<nic_name>\w+):')
reg = re.compile(r'(?P<num>\d+): (?P<nic_name>\w+)[@]?.*:')
ipatxt = ssh_client.exec_command("ip address")
return reg.findall(ipatxt)