aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-01-22 15:31:56 +0000
committerJan Gelety <jgelety@cisco.com>2019-01-24 16:50:56 +0100
commit35ae14a1a109d357bb548e0fb8aaf941ed4a85f2 (patch)
tree160143747e202d84fe592cd2b33dac5188293a3c /resources
parent552491e8bcff9745b04fbdd92609351ec9597cdc (diff)
CSIT-1407 FIX vpp install after VPP changes
Change-Id: I9148f6de75c3100f827eedec48c4c0ccb343bc54 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources')
-rwxr-xr-xresources/libraries/bash/dut_setup.sh4
-rw-r--r--resources/libraries/bash/function/artifacts.sh3
-rw-r--r--resources/libraries/python/DUTSetup.py77
-rw-r--r--resources/tools/papi/vpp_papi_provider.py17
4 files changed, 27 insertions, 74 deletions
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)