aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-01-08 08:25:55 +0000
committerPeter Mikus <pmikus@cisco.com>2019-01-09 07:51:56 +0000
commit5075d208e29ece6bfd8cf4aa5289dd0b2ade583c (patch)
tree2f1624a7df37a74f8b29e5b0d7343448ae836dc8 /resources/libraries/python
parent6abab7084716f4dc322574837b23f26a2ca9e2cb (diff)
CSIT-1389 Refactor current keywords for multichaining - CNF
- Add ability to create matrix of containers (chains x nodeness) - Change default Docker image to csit-dut - Use new resource mapping function Change-Id: Iaac0f2efc99146fbaef0b33dc71b38770610023d Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/ContainerUtils.py54
1 files changed, 19 insertions, 35 deletions
diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py
index 478a9781a0..786a4013de 100644
--- a/resources/libraries/python/ContainerUtils.py
+++ b/resources/libraries/python/ContainerUtils.py
@@ -20,7 +20,6 @@ from collections import OrderedDict, Counter
from resources.libraries.python.ssh import SSH
from resources.libraries.python.constants import Constants
-from resources.libraries.python.CpuUtils import CpuUtils
from resources.libraries.python.topology import Topology
from resources.libraries.python.VppConfigGenerator import VppConfigGenerator
@@ -78,24 +77,6 @@ class ContainerManager(object):
setattr(self.engine.container, 'env',
'MICROSERVICE_LABEL={label}'.format(label=kwargs['name']))
- # Set cpuset.cpus cgroup
- skip_cnt = kwargs['cpu_skip']
- smt_used = CpuUtils.is_smt_enabled(kwargs['node']['cpuinfo'])
- if not kwargs['cpu_shared']:
- skip_cnt += kwargs['i'] * kwargs['cpu_count']
- self.engine.container.cpuset_cpus = \
- CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'],
- cpu_node=kwargs['cpuset_mems'],
- skip_cnt=skip_cnt,
- cpu_cnt=1,
- smt_used=False) \
- + \
- CpuUtils.cpu_slice_of_list_per_node(node=kwargs['node'],
- cpu_node=kwargs['cpuset_mems'],
- skip_cnt=skip_cnt+1,
- cpu_cnt=kwargs['cpu_count']-1,
- smt_used=smt_used)
-
# Store container instance
self.containers[kwargs['name']] = self.engine.container
@@ -326,19 +307,22 @@ class ContainerEngine(object):
"""Install VPP inside a container."""
self.execute('ln -s /dev/null /etc/sysctl.d/80-vpp.conf')
self.execute('apt-get update')
- if self.container.install_dkms:
- self.execute(
- 'apt-get install -y dkms && '
- 'dpkg -i --force-all '
- '{guest_dir}/openvpp-testing/download_dir/*.deb'.
- format(guest_dir=self.container.mnt[0].split(':')[1]))
- else:
- self.execute(
- 'for i in $(ls -I \"*dkms*\" '
- '{guest_dir}/openvpp-testing/download_dir/); do '
- 'dpkg -i --force-all '
- '{guest_dir}/openvpp-testing/download_dir/$i; done'.
- format(guest_dir=self.container.mnt[0].split(':')[1]))
+ # Workaround for install xenial vpp build on bionic ubuntu.
+ self.execute('apt-get install -y wget')
+ self.execute('deb=$(mktemp) && wget -O "${deb}" '
+ 'http://launchpadlibrarian.net/336117627/'
+ 'libmbedcrypto0_2.5.1-1ubuntu1_amd64.deb && '
+ 'dpkg -i "${deb}" && '
+ 'rm -f "${deb}"')
+ self.execute('deb=$(mktemp) && wget -O "${deb}" '
+ 'http://launchpadlibrarian.net/252876048/'
+ 'libboost-system1.58.0_1.58.0+dfsg-5ubuntu3_amd64.deb && '
+ 'dpkg -i "${deb}" && '
+ 'rm -f "${deb}"')
+ self.execute(
+ 'dpkg -i --force-all '
+ '{guest_dir}/openvpp-testing/download_dir/*.deb'.
+ format(guest_dir=self.container.mnt[0].split(':')[1]))
self.execute('apt-get -f install -y')
self.execute('apt-get install -y ca-certificates')
self.execute('echo "{config}" >> {config_file}'.
@@ -685,10 +669,10 @@ class Docker(ContainerEngine):
else:
return
- image = self.container.image if self.container.image else\
- "ubuntu:xenial-20180412"
+ if not self.container.image:
+ setattr(self.container, 'image', 'snergster/csit-sut:latest')
- cmd = 'docker pull {image}'.format(image=image)
+ cmd = 'docker pull {image}'.format(image=self.container.image)
ret, _, _ = self.container.ssh.exec_command_sudo(cmd, timeout=1800)
if int(ret) != 0: