From 35ae14a1a109d357bb548e0fb8aaf941ed4a85f2 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Tue, 22 Jan 2019 15:31:56 +0000 Subject: [PATCH] CSIT-1407 FIX vpp install after VPP changes Change-Id: I9148f6de75c3100f827eedec48c4c0ccb343bc54 Signed-off-by: Peter Mikus --- VPP_STABLE_VER_CENTOS | 2 +- VPP_STABLE_VER_UBUNTU | 2 +- VPP_STABLE_VER_UBUNTU_BIONIC | 2 +- bootstrap.sh | 2 +- resources/libraries/bash/dut_setup.sh | 4 +- resources/libraries/bash/function/artifacts.sh | 3 +- resources/libraries/python/DUTSetup.py | 77 +++++++------------------- resources/tools/papi/vpp_papi_provider.py | 17 +----- tests/vpp/device/__init__.robot | 7 --- tests/vpp/func/__init__.robot | 9 +-- tests/vpp/perf/__init__.robot | 7 +-- 11 files changed, 33 insertions(+), 99 deletions(-) diff --git a/VPP_STABLE_VER_CENTOS b/VPP_STABLE_VER_CENTOS index 494ee6eb87..e2c6beb584 100644 --- a/VPP_STABLE_VER_CENTOS +++ b/VPP_STABLE_VER_CENTOS @@ -1 +1 @@ -19.04-rc0~21_g36eb7c2~b5964 \ No newline at end of file +19.04-rc0~67_g72de626~b6010 \ No newline at end of file diff --git a/VPP_STABLE_VER_UBUNTU b/VPP_STABLE_VER_UBUNTU index 49e02272cc..e8d6983294 100644 --- a/VPP_STABLE_VER_UBUNTU +++ b/VPP_STABLE_VER_UBUNTU @@ -1 +1 @@ -19.04-rc0~21-g36eb7c2~b6151 \ No newline at end of file +19.04-rc0~67-g72de626~b6198 \ No newline at end of file diff --git a/VPP_STABLE_VER_UBUNTU_BIONIC b/VPP_STABLE_VER_UBUNTU_BIONIC index f78175bd95..f38b93caa4 100644 --- a/VPP_STABLE_VER_UBUNTU_BIONIC +++ b/VPP_STABLE_VER_UBUNTU_BIONIC @@ -1 +1 @@ -19.04-rc0~21-g36eb7c21~b1904 \ No newline at end of file +19.04-rc0~67-g72de626d~b1950 \ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh index 2d26bccfad..62ca6d8191 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -53,7 +53,7 @@ else fi VIRL_DIR_LOC="/tmp/" -VPP_PKGS=(vpp*.$PACKAGE) +VPP_PKGS=(*vpp*.$PACKAGE) VPP_PKGS_FULL=("${VPP_PKGS[@]/#/${VIRL_DIR_LOC}}") echo ${VPP_PKGS[@]} diff --git a/resources/libraries/bash/dut_setup.sh b/resources/libraries/bash/dut_setup.sh index aee6386bd7..d0b2fabd8e 100755 --- a/resources/libraries/bash/dut_setup.sh +++ b/resources/libraries/bash/dut_setup.sh @@ -24,9 +24,9 @@ echo echo "[Command_desc] Starting ${0}" if [ -f "/etc/redhat-release" ]; then - cmd 'rpm -qai vpp*' + cmd 'rpm -qai *vpp*' else - cmd 'dpkg -l vpp\*' + cmd 'dpkg -l | grep vpp' fi cmd 'ps aux | grep vpp' diff --git a/resources/libraries/bash/function/artifacts.sh b/resources/libraries/bash/function/artifacts.sh index 6695b4d977..b6b5bc5536 100644 --- a/resources/libraries/bash/function/artifacts.sh +++ b/resources/libraries/bash/function/artifacts.sh @@ -64,7 +64,8 @@ function download_ubuntu_artifacts () { } # If version is set we will add suffix. artifacts=() - vpp=(vpp vpp-dbg vpp-dev vpp-lib vpp-plugins vpp-api-python) + vpp=(vpp vpp-dbg vpp-dev vpp-api-python libvppinfra libvppinfra-dev + vpp-plugin-core vpp-plugin-dpdk) if [ -z "${VPP_VERSION-}" ]; then artifacts+=(${vpp[@]}) else diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py index 4fc0e6fc9c..7a28e09527 100644 --- a/resources/libraries/python/DUTSetup.py +++ b/resources/libraries/python/DUTSetup.py @@ -33,7 +33,8 @@ class DUTSetup(object): :type service: str """ if DUTSetup.running_in_container(node): - command = 'echo $(< /var/log/supervisord.log)' + command = ('echo $(< /var/log/supervisord.log);' + 'echo $(< /tmp/*supervisor*.log)') else: command = ('journalctl --no-pager --unit={name} ' '--since="$(echo `systemctl show -p ' @@ -595,73 +596,35 @@ class DUTSetup(object): exec_cmd_no_error(node, command, timeout=30, sudo=True, message=message) @staticmethod - def install_vpp_on_all_duts(nodes, vpp_pkg_dir, vpp_rpm_pkgs, vpp_deb_pkgs): + def install_vpp_on_all_duts(nodes, vpp_pkg_dir): """Install VPP on all DUT nodes. :param nodes: Nodes in the topology. :param vpp_pkg_dir: Path to directory where VPP packages are stored. - :param vpp_rpm_pkgs: List of VPP rpm packages to be installed. - :param vpp_deb_pkgs: List of VPP deb packages to be installed. :type nodes: dict :type vpp_pkg_dir: str - :type vpp_rpm_pkgs: list - :type vpp_deb_pkgs: list :raises RuntimeError: If failed to remove or install VPP. """ for node in nodes.values(): + message='Failed to install VPP on {host}!'.format(host=node['host']) if node['type'] == NodeType.DUT: - logger.debug("Installing VPP on node {0}".format(node['host'])) - - ssh = SSH() - ssh.connect(node) - - cmd = "[[ -f /etc/redhat-release ]]" - return_code, _, _ = ssh.exec_command(cmd) - if not int(return_code): - # workaroud - uninstall existing vpp installation until - # start-testcase script is updated on all virl servers - rpm_pkgs_remove = "vpp*" - cmd_u = 'yum -y remove "{0}"'.format(rpm_pkgs_remove) - r_rcode, _, r_err = ssh.exec_command_sudo(cmd_u, timeout=90) - if int(r_rcode): - raise RuntimeError('Failed to remove previous VPP' - 'installation on host {0}:\n{1}' - .format(node['host'], r_err)) - - rpm_pkgs = "*.rpm ".join(str(vpp_pkg_dir + pkg) - for pkg in vpp_rpm_pkgs) + "*.rpm" - cmd_i = "rpm -ivh {0}".format(rpm_pkgs) - ret_code, _, err = ssh.exec_command_sudo(cmd_i, timeout=90) - if int(ret_code): - raise RuntimeError('Failed to install VPP on host {0}:' - '\n{1}'.format(node['host'], err)) - else: - ssh.exec_command_sudo("rpm -qai vpp*") - logger.info("VPP installed on node {0}". - format(node['host'])) + command = '. /etc/lsb-release; echo "${DISTRIB_ID}"' + stdout, _ = exec_cmd_no_error(node, command) + + if stdout.strip() == 'Ubuntu': + exec_cmd_no_error(node, 'apt-get purge -y "*vpp*" || true', + timeout=120, sudo=True) + exec_cmd_no_error(node, 'dpkg -i --force-all {dir}*.deb'. + format(dir=vpp_pkg_dir), timeout=120, sudo=True, + message=message) + exec_cmd_no_error(node, 'dpkg -l | grep vpp', sudo=True) else: - # workaroud - uninstall existing vpp installation until - # start-testcase script is updated on all virl servers - deb_pkgs_remove = "vpp*" - cmd_u = 'apt-get purge -y "{0}"'.format(deb_pkgs_remove) - r_rcode, _, r_err = ssh.exec_command_sudo(cmd_u, timeout=90) - if int(r_rcode): - raise RuntimeError('Failed to remove previous VPP' - 'installation on host {0}:\n{1}' - .format(node['host'], r_err)) - deb_pkgs = "*.deb ".join(str(vpp_pkg_dir + pkg) - for pkg in vpp_deb_pkgs) + "*.deb" - cmd_i = "dpkg -i --force-all {0}".format(deb_pkgs) - ret_code, _, err = ssh.exec_command_sudo(cmd_i, timeout=90) - if int(ret_code): - raise RuntimeError('Failed to install VPP on host {0}:' - '\n{1}'.format(node['host'], err)) - else: - ssh.exec_command_sudo("dpkg -l | grep vpp") - logger.info("VPP installed on node {0}". - format(node['host'])) - - ssh.disconnect(node) + exec_cmd_no_error(node, 'yum -y remove "*vpp*" || true', + timeout=120, sudo=True) + exec_cmd_no_error(node, 'rpm -ivh {dir}*.rpm'.\ + format(dir=vpp_pkg_dir), timeout=120, sudo=True, + message=message) + exec_cmd_no_error(node, 'rpm -qai *vpp*', sudo=True) @staticmethod def running_in_container(node): diff --git a/resources/tools/papi/vpp_papi_provider.py b/resources/tools/papi/vpp_papi_provider.py index 69b196843a..845cc932ca 100644 --- a/resources/tools/papi/vpp_papi_provider.py +++ b/resources/tools/papi/vpp_papi_provider.py @@ -60,7 +60,7 @@ if do_import: CLIENT_NAME = 'csit_papi' -def papi_init(vpp_json_dir='/usr/share/vpp/api/'): +def papi_init(): """Construct a VPP instance from VPP JSON API files. :param vpp_json_dir: Directory containing all the JSON API files. If VPP is @@ -71,18 +71,8 @@ def papi_init(vpp_json_dir='/usr/share/vpp/api/'): :raises PapiJsonFileError: If no api.json file found. :raises PapiInitError: If PAPI initialization failed. """ - # construct a list of all the json api files - jsonfiles = [] - for root, dirnames, filenames in os.walk(vpp_json_dir): - for filename in fnmatch.filter(filenames, '*.api.json'): - jsonfiles.append(os.path.join(vpp_json_dir, filename)) - if not jsonfiles: - raise PapiJsonFileError( - 'No json api files found in location {dir}'.format( - dir=vpp_json_dir)) - try: - vpp = VPP(jsonfiles) + vpp = VPP() return vpp except Exception as err: raise PapiInitError('PAPI init failed:\n{exc}'.format(exc=repr(err))) @@ -191,9 +181,8 @@ def main(): help="Directory containing all vpp json api files.") args = parser.parse_args() json_string = args.json_data - vpp_json_dir = args.json_dir - vpp = papi_init(vpp_json_dir=vpp_json_dir) + vpp = papi_init() reply = list() json_data = json.loads(json_string) diff --git a/tests/vpp/device/__init__.robot b/tests/vpp/device/__init__.robot index 8b0788c362..bc13441d99 100644 --- a/tests/vpp/device/__init__.robot +++ b/tests/vpp/device/__init__.robot @@ -21,7 +21,6 @@ | Suite Setup | Run Keywords | Setup Global Variables | ... | AND | Setup Framework | ${nodes} | ... | AND | Install Vpp On All Duts | ${nodes} | ${packages_dir} -| ... | ${vpp_rpm_pkgs} | ${vpp_deb_pkgs} | ... | AND | Verify Vpp On All Duts | ${nodes} | ... | AND | Get CPU Layout from all nodes | ${nodes} | ... | AND | Update All Interface Data On All Nodes | ${nodes} @@ -46,9 +45,3 @@ | | Set Global Variable | ${dut_stats} | ${True} | | Set Global Variable | ${vm_image} | /var/lib/vm/csit-nested-1.7.img | | Set Global Variable | ${packages_dir} | /tmp/openvpp-testing/download_dir/ -| | @{vpp_rpm_pkgs}= | Create List | vpp | vpp-devel | vpp-lib | vpp-plugins -| | ... | vpp-api-python -| | Set Global Variable | ${vpp_rpm_pkgs} -| | @{vpp_deb_pkgs}= | Create List | vpp | vpp-dbg | vpp-dev | vpp-lib -| | ... | vpp-plugins | vpp-api-python -| | Set Global Variable | ${vpp_deb_pkgs} \ No newline at end of file diff --git a/tests/vpp/func/__init__.robot b/tests/vpp/func/__init__.robot index b074d0d5b0..563d1ea363 100644 --- a/tests/vpp/func/__init__.robot +++ b/tests/vpp/func/__init__.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Cisco and/or its affiliates. +# Copyright (c) 2019 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -19,7 +19,6 @@ | Suite Setup | Run Keywords | Setup Functional Global Variables | ... | AND | Setup Framework | ${nodes} | ... | AND | Install Vpp On All Duts | ${nodes} | ${VPP_PKG_DIR} -| ... | ${VPP_RPM_PKGS} | ${VPP_DEB_PKGS} | ... | AND | Verify Vpp On All Duts | ${nodes} | ... | AND | Setup All DUTs | ${nodes} | ... | AND | Update All Interface Data On All Nodes | ${nodes} @@ -34,9 +33,3 @@ | | ... | - vpp_pkg_dir - Path to directory where VPP packages are stored. | | ... | | Set Global Variable | ${VPP_PKG_DIR} | /scratch/vpp/ -| | @{VPP_RPM_PKGS}= | Create List | vpp | vpp-devel | vpp-lib | vpp-plugins -| | ... | vpp-api-python -| | Set Global Variable | ${VPP_RPM_PKGS} -| | @{VPP_DEB_PKGS}= | Create List | vpp | vpp-dbg | vpp-dev | vpp-lib -| | ... | vpp-plugins | vpp-api-python -| | Set Global Variable | ${VPP_DEB_PKGS} diff --git a/tests/vpp/perf/__init__.robot b/tests/vpp/perf/__init__.robot index 0e24ecda6b..0fb4401871 100644 --- a/tests/vpp/perf/__init__.robot +++ b/tests/vpp/perf/__init__.robot @@ -20,7 +20,7 @@ | Suite Setup | Run Keywords | Setup performance global Variables | ... | AND | Setup Framework | ${nodes} | ... | AND | Install Vpp On All Duts | ${nodes} -| ... | ${packages_dir} | ${vpp_rpm_pkgs} | ${vpp_deb_pkgs} +| ... | ${packages_dir} | ... | AND | Verify Vpp On All Duts | ${nodes} | ... | AND | Verify UIO Driver on all DUTs | ${nodes} | ... | AND | Setup All DUTs | ${nodes} @@ -57,8 +57,3 @@ | | @{plugins_to_enable}= | Create List | dpdk_plugin.so | | Set Global Variable | @{plugins_to_enable} | | Set Global Variable | ${packages_dir} | /tmp/openvpp-testing/download_dir/ -| | @{vpp_rpm_pkgs}= | Create List | vpp | vpp-devel | vpp-lib | vpp-plugins -| | Set Global Variable | ${vpp_rpm_pkgs} -| | @{vpp_deb_pkgs}= | Create List | vpp | vpp-dbg | vpp-dev | vpp-lib -| | ... | vpp-plugins | vpp-api-python -| | Set Global Variable | ${vpp_deb_pkgs} -- 2.16.6