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
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
"""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}/install_dir/*.deb'.
- format(guest_dir=self.container.mnt[0].split(':')[1]))
- else:
- self.execute(
- 'for i in $(ls -I \"*dkms*\" {guest_dir}/install_dir/); do '
- 'dpkg -i --force-all {guest_dir}/install_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}'.
class LXC(ContainerEngine):
"""LXC implementation."""
- def __init__(self):
- """Initialize LXC object."""
- super(LXC, self).__init__()
+ # Implicit constructor is inherited.
def acquire(self, force=True):
"""Acquire a privileged system object where configuration is stored.
class Docker(ContainerEngine):
"""Docker implementation."""
- def __init__(self):
- """Initialize Docker object."""
- super(Docker, self).__init__()
+ # Implicit constructor is inherited.
def acquire(self, force=True):
"""Pull an image or a repository from a registry.
else:
return
- cmd = 'docker pull {c.image}'.format(c=self.container)
+ if not self.container.image:
+ setattr(self.container, 'image', 'snergster/csit-sut:latest')
+
+ cmd = 'docker pull {image}'.format(image=self.container.image)
ret, _, _ = self.container.ssh.exec_command_sudo(cmd, timeout=1800)
if int(ret) != 0: