tests: remote: Handle different ifconfig output formats
We could have different ifconfig output formats on the remote devices, so make the parser more flexible to handle such cases. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
This commit is contained in:
parent
f8b26af741
commit
7a934fe72a
1 changed files with 5 additions and 1 deletions
|
@ -239,6 +239,8 @@ def get_ipv6(client, ifname=None):
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
res = line.find("Scope:Link")
|
res = line.find("Scope:Link")
|
||||||
|
if res == -1:
|
||||||
|
res = line.find("<link>")
|
||||||
if res != -1:
|
if res != -1:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -248,6 +250,8 @@ def get_ipv6(client, ifname=None):
|
||||||
addr_mask = words[2]
|
addr_mask = words[2]
|
||||||
addr = addr_mask.split("/")
|
addr = addr_mask.split("/")
|
||||||
return addr[0]
|
return addr[0]
|
||||||
|
if words[0] == "inet6":
|
||||||
|
return words[1]
|
||||||
|
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
|
||||||
|
@ -281,7 +285,7 @@ def get_mac_addr(host, iface=None):
|
||||||
for word in words:
|
for word in words:
|
||||||
if found == 1:
|
if found == 1:
|
||||||
return word
|
return word
|
||||||
if word == "HWaddr":
|
if word == "HWaddr" or word == "ether":
|
||||||
found = 1
|
found = 1
|
||||||
raise Exception("Could not find HWaddr")
|
raise Exception("Could not find HWaddr")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue