qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 2/3] Acceptance test: provides new functions


From: Oksana Vohchana
Subject: [PATCH v4 2/3] Acceptance test: provides new functions
Date: Mon, 23 Mar 2020 12:30:15 +0200

Provides new functions related to the rdma migration test
Adds functions to check if service RDMA is enabled and gets
the ip address on the interface where it was configured

Signed-off-by: Oksana Vohchana <address@hidden>
---
 tests/acceptance/migration.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index e4c39b85a1..59144f18fd 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -11,12 +11,44 @@
 
 
 import tempfile
+import json
 from avocado_qemu import Test
 from avocado import skipUnless
 
 from avocado.utils import network
 from avocado.utils import wait
 from avocado.utils.path import find_command
+from avocado.utils.network.interfaces import NetworkInterface
+from avocado.utils.network.hosts import LocalHost
+from avocado.utils import service
+from avocado.utils import process
+
+
+def _if_rdma_enable():
+    rdma_stat = service.ServiceManager()
+    return bool(rdma_stat.status('rdma'))
+
+def _get_interface_rdma():
+    cmd = 'rdma link show -j'
+    out = json.loads(process.getoutput(cmd))
+    try:
+        for i in out:
+            if i['state'] == 'ACTIVE':
+                return i['netdev']
+    except KeyError:
+        return False
+    return False
+
+def _get_ip_rdma(interface):
+    local = LocalHost()
+    network_in = NetworkInterface(interface, local)
+    try:
+        ip = network_in._get_interface_details()
+        if ip:
+            return ip[0]['addr_info'][0]['local']
+    except (KeyError, process.CmdError):
+        return False
+    return False
 
 
 class Migration(Test):
-- 
2.21.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]