qemu-devel
[Top][All Lists]
Advanced

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

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


From: Oksana Vohchana
Subject: [PATCH v3 2/3] Acceptance test: provides new functions
Date: Fri, 20 Mar 2020 17:12:53 +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 | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index e4c39b85a1..a783f3915b 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -11,12 +11,17 @@
 
 
 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
 
 
 class Migration(Test):
@@ -58,6 +63,31 @@ class Migration(Test):
             self.cancel('Failed to find a free port')
         return port
 
+    def _if_rdma_enable(self):
+        rdma_stat = service.ServiceManager()
+        rdma = rdma_stat.status('rdma')
+        return rdma
+
+    def _get_interface_rdma(self):
+        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 None
+
+    def _get_ip_rdma(self, 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:
+            self.cancel("Incorrect interface configuration or device name")
+
 
     def test_migration_with_tcp_localhost(self):
         dest_uri = 'tcp:localhost:%u' % self._get_free_port()
-- 
2.21.1




reply via email to

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