[gnome-boxes] tests: Replace "arp" cmd w/ "ip neigh"
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] tests: Replace "arp" cmd w/ "ip neigh"
- Date: Wed, 29 Jul 2015 14:44:59 +0000 (UTC)
commit 22a6992c8ff8cdc6cff15b095e20fea87ff413ad
Author: Vladimir Benes <benesv email cz>
Date: Wed Jul 29 05:54:16 2015 +0200
tests: Replace "arp" cmd w/ "ip neigh"
"Arp" command has been obsoleted in favour of "ip neigh".
https://bugzilla.gnome.org/show_bug.cgi?id=750700
tests/steps/general.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/tests/steps/general.py b/tests/steps/general.py
index a7359c8..af19051 100644
--- a/tests/steps/general.py
+++ b/tests/steps/general.py
@@ -184,11 +184,16 @@ def libvirt_domain_get_mac(vm_title):
return libvirt_domain_get_val(ctx, "/domain/devices/interface/mac/@address")
return mac
-def get_ip_through_arp_cmd(mac):
+def get_ip_from_ip_neigh_cmd(mac):
out = ""
wait = 0
while wait < 120:
- cmd = Popen("arp -an |grep '%s' |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'"
%mac, shell=True, stdout=PIPE)
+ cmd = Popen("ip neigh show nud reachable\
+ |grep %s\
+ |tail -n 1\
+ |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'"
+ %mac, shell=True, stdout=PIPE)
+
out = cmd.communicate()[0]
ret = cmd.wait()
if out != "":
@@ -202,7 +207,7 @@ def save_ip_for_vm(context, vm):
if not hasattr(context, 'ips'):
context.ips = {}
- ip = get_ip_through_arp_cmd(libvirt_domain_get_mac(vm))
+ ip = get_ip_from_ip_neigh_cmd(libvirt_domain_get_mac(vm))
if not ip:
raise Exception("No address was assigned for this machine %s" %vm)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]