Compatibility fixes with Ubuntu 18.04 09/13309/4
authorPeter Mikus <pmikus@cisco.com>
Sun, 1 Jul 2018 06:13:54 +0000 (06:13 +0000)
committerPeter Mikus <pmikus@cisco.com>
Mon, 2 Jul 2018 09:10:09 +0000 (09:10 +0000)
Currently we are using ip:port socket to for VPP to listen for incoming
connections. There is only one place in code this socket is used for
detection if VPP is responding after restart. This patch is supposed to
change ip:port to sock:file which is default preffered way in VPP. This
way we can start using vppctl. netcat on the other side with ip:port
remains hanged in console for infinite time not returning back.

There is also need to check whether uio_module is loaded and eventually
load it. As uio_pci_generic is not working there, we will fallback to
main igb_uio (uio_pci_generic being only lightweight subset of igb_uio).

This patch also add additional verbose output to console during setup to
better understand if failure happens during copy/extract/setup.

Change-Id: I0b8a3b76dce3316496a3ad928f58718b6e73057d
Signed-off-by: Peter Mikus <pmikus@cisco.com>
resources/libraries/python/DUTSetup.py
resources/libraries/python/SetupFramework.py
resources/libraries/python/VppConfigGenerator.py
tests/vpp/perf/__init__.robot

index 5e07ee0..4ead762 100644 (file)
@@ -442,19 +442,17 @@ class DUTSetup(object):
 
     @staticmethod
     def kernel_module_verify(node, module, force_load=False):
 
     @staticmethod
     def kernel_module_verify(node, module, force_load=False):
-        """Verify if kernel module is loaded on all DUTs. If parameter force
+        """Verify if kernel module is loaded on node. If parameter force
         load is set to True, then try to load the modules.
 
         load is set to True, then try to load the modules.
 
-        :param node: DUT node.
+        :param node: Node.
         :param module: Module to verify.
         :param force_load: If True then try to load module.
         :type node: dict
         :type module: str
         :type force_load: bool
         :param module: Module to verify.
         :param force_load: If True then try to load module.
         :type node: dict
         :type module: str
         :type force_load: bool
-        :returns: nothing
         :raises RuntimeError: If module is not loaded or failed to load.
         """
         :raises RuntimeError: If module is not loaded or failed to load.
         """
-
         ssh = SSH()
         ssh.connect(node)
 
         ssh = SSH()
         ssh.connect(node)
 
@@ -469,6 +467,22 @@ class DUTSetup(object):
                 raise RuntimeError('Kernel module {0} is not loaded on host '
                                    '{1}'.format(module, node['host']))
 
                 raise RuntimeError('Kernel module {0} is not loaded on host '
                                    '{1}'.format(module, node['host']))
 
+    @staticmethod
+    def kernel_module_verify_on_all_duts(nodes, module, force_load=False):
+        """Verify if kernel module is loaded on all DUTs. If parameter force
+        load is set to True, then try to load the modules.
+
+        :param node: DUT nodes.
+        :param module: Module to verify.
+        :param force_load: If True then try to load module.
+        :type node: dict
+        :type module: str
+        :type force_load: bool
+        """
+        for node in nodes.values():
+            if node['type'] == NodeType.DUT:
+                DUTSetup.kernel_module_verify(node, module, force_load)
+
     @staticmethod
     def kernel_module_load(node, module):
         """Load kernel module on node.
     @staticmethod
     def kernel_module_load(node, module):
         """Load kernel module on node.
index ccf4e4f..558d5d4 100644 (file)
@@ -84,6 +84,7 @@ def copy_tarball_to_node(tarball, node):
     ssh.connect(node)
 
     ssh.scp(tarball, "/tmp/")
     ssh.connect(node)
 
     ssh.scp(tarball, "/tmp/")
+    logger.console('Copying tarball to {0} done'.format(node['host']))
 
 
 def extract_tarball_at_node(tarball, node):
 
 
 def extract_tarball_at_node(tarball, node):
@@ -108,6 +109,8 @@ def extract_tarball_at_node(tarball, node):
     if ret_code != 0:
         raise RuntimeError('Failed to extract {0} at node {1}'
                            .format(tarball, node['host']))
     if ret_code != 0:
         raise RuntimeError('Failed to extract {0} at node {1}'
                            .format(tarball, node['host']))
+    logger.console('Extracting tarball to {0} on {1} done'
+                   .format(con.REMOTE_FW_DIR, node['host']))
 
 
 def create_env_directory_at_node(node):
 
 
 def create_env_directory_at_node(node):
@@ -131,8 +134,8 @@ def create_env_directory_at_node(node):
     if ret_code != 0:
         raise RuntimeError('Virtualenv setup including requirements.txt on {0}'
                            .format(node['host']))
     if ret_code != 0:
         raise RuntimeError('Virtualenv setup including requirements.txt on {0}'
                            .format(node['host']))
-    else:
-        logger.console('Virtualenv on {0} created'.format(node['host']))
+
+    logger.console('Virtualenv on {0} created'.format(node['host']))
 
 
 def setup_node(args):
 
 
 def setup_node(args):
index e9933f2..4e1ec74 100644 (file)
@@ -160,7 +160,7 @@ class VppConfigGenerator(object):
             value = self._vpp_logfile
         self.add_config_item(self._nodeconfig, value, path)
 
             value = self._vpp_logfile
         self.add_config_item(self._nodeconfig, value, path)
 
-    def add_unix_cli_listen(self, value='localhost:5002'):
+    def add_unix_cli_listen(self, value='/run/vpp/cli.sock'):
         """Add UNIX cli-listen configuration.
 
         :param value: CLI listen address and port or path to CLI socket.
         """Add UNIX cli-listen configuration.
 
         :param value: CLI listen address and port or path to CLI socket.
@@ -590,9 +590,8 @@ class VppConfigGenerator(object):
             for _ in range(retries):
                 time.sleep(1)
                 ret, stdout, _ = \
             for _ in range(retries):
                 time.sleep(1)
                 ret, stdout, _ = \
-                    ssh.exec_command('echo show pci | nc 0 5002 || '
-                                     'echo "VPP not yet running"')
-                if ret == 0 and 'VPP not yet running' not in stdout:
+                    ssh.exec_command_sudo('vppctl show pci')
+                if ret == 0 and 'Connection refused' not in stdout:
                     break
             else:
                 raise RuntimeError('VPP failed to restart on node {name}'.
                     break
             else:
                 raise RuntimeError('VPP failed to restart on node {name}'.
index 642906d..6041016 100644 (file)
@@ -19,6 +19,8 @@
 | Library | resources.libraries.python.CpuUtils
 | Suite Setup | Run Keywords | Setup performance global Variables
 | ...         | AND          | Setup Framework | ${nodes}
 | Library | resources.libraries.python.CpuUtils
 | Suite Setup | Run Keywords | Setup performance global Variables
 | ...         | AND          | Setup Framework | ${nodes}
+| ...         | AND          | Kernel module verify on all DUTs | ${nodes}
+| ...                        | ${uio_driver} | force_load=${True}
 | ...         | AND          | Setup All DUTs | ${nodes}
 | ...         | AND          | Show Vpp Version On All Duts | ${nodes}
 | ...         | AND          | Get CPU Layout from all nodes | ${nodes}
 | ...         | AND          | Setup All DUTs | ${nodes}
 | ...         | AND          | Show Vpp Version On All Duts | ${nodes}
 | ...         | AND          | Get CPU Layout from all nodes | ${nodes}
@@ -53,6 +55,6 @@
 | | Set Global Variable | ${qemu_build} | ${True}
 | | Set Global Variable | ${pkt_trace} | ${False}
 | | Set Global Variable | ${dut_stats} | ${True}
 | | Set Global Variable | ${qemu_build} | ${True}
 | | Set Global Variable | ${pkt_trace} | ${False}
 | | Set Global Variable | ${dut_stats} | ${True}
-| | Set Global Variable | ${uio_driver} | uio_pci_generic
+| | Set Global Variable | ${uio_driver} | igb_uio
 | | @{plugins_to_enable}= | Create List | dpdk_plugin.so
 | | Set Global Variable | @{plugins_to_enable}
 | | @{plugins_to_enable}= | Create List | dpdk_plugin.so
 | | Set Global Variable | @{plugins_to_enable}