diff options
Diffstat (limited to 'resources/tools')
-rwxr-xr-x | resources/tools/scripts/download_hc_pkgs.sh | 6 | ||||
-rwxr-xr-x | resources/tools/scripts/topo_installation.py | 78 | ||||
-rw-r--r-- | resources/tools/testbed-setup/playbooks/01-host-setup.yaml | 2 |
3 files changed, 55 insertions, 31 deletions
diff --git a/resources/tools/scripts/download_hc_pkgs.sh b/resources/tools/scripts/download_hc_pkgs.sh index 23e0be4b16..1bda02505c 100755 --- a/resources/tools/scripts/download_hc_pkgs.sh +++ b/resources/tools/scripts/download_hc_pkgs.sh @@ -30,19 +30,19 @@ if [ "${OS}" == "ubuntu1404" ]; then OS="ubuntu.trusty.main" PACKAGE="deb deb.md5" CLASS="deb" - VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-lib vpp-plugins vpp-api-java" + VPP_ARTIFACTS="vpp vpp-dbg vpp-lib vpp-plugins" DPDK_ARTIFACTS="vpp-dpdk-dkms" elif [ "${OS}" == "ubuntu1604" ]; then OS="ubuntu.xenial.main" PACKAGE="deb deb.md5" CLASS="deb" - VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-lib vpp-plugins vpp-api-java" + VPP_ARTIFACTS="vpp vpp-dbg vpp-lib vpp-plugins" DPDK_ARTIFACTS="vpp-dpdk-dkms" elif [ "${OS}" == "centos7" ]; then OS="centos7" PACKAGE="rpm rpm.md5" CLASS="" - VPP_ARTIFACTS="vpp vpp-debuginfo vpp-devel vpp-lib vpp-plugins vpp-api-java" + VPP_ARTIFACTS="vpp vpp-debuginfo vpp-lib vpp-plugins" DPDK_ARTIFACTS="" fi diff --git a/resources/tools/scripts/topo_installation.py b/resources/tools/scripts/topo_installation.py index 0488bdae69..5c91abbd0f 100755 --- a/resources/tools/scripts/topo_installation.py +++ b/resources/tools/scripts/topo_installation.py @@ -85,15 +85,34 @@ def main(): help="Packages paths to copy") parser.add_argument("-c", "--cancel", help="Cancel installation", action="store_true") + parser.add_argument("-hc", "--honeycomb", help="Include Honeycomb package.", + required=False, default=False) + args = parser.parse_args() topology_file = args.topo packages = args.packages install_dir = args.directory cancel_installation = args.cancel + honeycomb = args.honeycomb work_file = open(topology_file) topology = load(work_file.read())['nodes'] + def fix_interrupted(package): + """If there are interrupted installations, clean them up.""" + + cmd = "dpkg -l | grep {0}".format(package) + ret, _, _ = ssh.exec_command(cmd) + if ret == 0: + # Try to fix interrupted installations + cmd = 'dpkg --configure -a' + stdout = ssh_no_error(ssh, cmd, sudo=True) + print "###TI {}".format(stdout) + # Try to remove installed packages + cmd = 'apt-get purge -y "{0}.*"'.format(package) + stdout = ssh_no_error(ssh, cmd, sudo=True) + print "###TI {}".format(stdout) + ssh = SSH() for node in topology: if topology[node]['type'] == "DUT": @@ -106,41 +125,44 @@ def main(): stdout = ssh_ignore_error(ssh, cmd) print "###TI {}".format(stdout) - cmd = "dpkg -l | grep vpp" - ret, _, _ = ssh.exec_command(cmd) - if ret == 0: - # Try to fix interrupted installations - cmd = 'dpkg --configure -a' - stdout = ssh_no_error(ssh, cmd, sudo=True) - print "###TI {}".format(stdout) - # Try to remove installed vpp.* packages - cmd = 'apt-get purge -y "vpp.*"' - stdout = ssh_no_error(ssh, cmd, sudo=True) + if honeycomb: + fix_interrupted("honeycomb") + # remove HC logs + cmd = "rm -rf /var/log/honeycomb" + stdout = ssh_ignore_error(ssh, cmd, sudo=True) print "###TI {}".format(stdout) + fix_interrupted("vpp") + else: # Create installation directory on DUT cmd = "rm -r {0}; mkdir {0}".format(install_dir) stdout = ssh_no_error(ssh, cmd) print "###TI {}".format(stdout) - # Copy packages from local path to installation dir - for deb in packages: - print "###TI scp: {}".format(deb) - ssh.scp(local_path=deb, remote_path=install_dir) - - cmd = "dpkg -l | grep vpp" - ret, _, _ = ssh.exec_command(cmd) - if ret == 0: - # Try to fix interrupted installations - cmd = 'dpkg --configure -a' - stdout = ssh_no_error(ssh, cmd, sudo=True) - print "###TI {}".format(stdout) - # Try to remove installed vpp.* packages - cmd = 'apt-get purge -y "vpp.*"' - stdout = ssh_no_error(ssh, cmd, sudo=True) - print "###TI {}".format(stdout) - - # Installation of VPP deb packages + if honeycomb: + smd = "ls ~/honeycomb | grep .deb" + stdout = ssh_ignore_error(ssh, smd) + if "honeycomb" in stdout: + # If custom honeycomb packages exist, use them + cmd = "cp ~/honeycomb/*.deb {0}".format(install_dir) + stdout = ssh_no_error(ssh, cmd) + print "###TI {}".format(stdout) + else: + # Copy packages from local path to installation dir + for deb in packages: + print "###TI scp: {}".format(deb) + ssh.scp(local_path=deb, remote_path=install_dir) + else: + # Copy packages from local path to installation dir + for deb in packages: + print "###TI scp: {}".format(deb) + ssh.scp(local_path=deb, remote_path=install_dir) + + if honeycomb: + fix_interrupted("honeycomb") + fix_interrupted("vpp") + + # Installation of deb packages cmd = "dpkg -i --force-all {}/*.deb".format(install_dir) stdout = ssh_no_error(ssh, cmd, sudo=True) print "###TI {}".format(stdout) diff --git a/resources/tools/testbed-setup/playbooks/01-host-setup.yaml b/resources/tools/testbed-setup/playbooks/01-host-setup.yaml index 6d644e5054..8fa9d66799 100644 --- a/resources/tools/testbed-setup/playbooks/01-host-setup.yaml +++ b/resources/tools/testbed-setup/playbooks/01-host-setup.yaml @@ -127,3 +127,5 @@ apt: name=lxc state=present - name: Disable 80-vpp.conf command: ln -s /dev/null /etc/sysctl.d/80-vpp.conf + - name: Install java + apt: name=openjdk-8-jdk state=present |