From 26637ca4fdb026cea585df4c9e6c0fc2c07492ba Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Fri, 1 Feb 2019 14:51:06 +0000 Subject: CSIT-1416 Remove installation of vpp from containers Use parent system (Host, Container) installation of VPP. This will save the internet bandwith by skip installing of prerequisites packages. It will also skip dpkg install and simplify the process of initializing VPP inside container. Previosly initialization of VPP in container takes about 55s. With this patch it is reduced to 2-3s. This patch removes the bloated VOLUME creation between container sidecars (a.k.a nested container) and fixes the hugepage allocation. Change-Id: Ifa2be532edb77354657e1b84568bdc34993b00d0 Signed-off-by: Peter Mikus --- resources/libraries/robot/shared/container.robot | 53 ++++++++++++------------ resources/libraries/robot/shared/default.robot | 18 ++++---- 2 files changed, 35 insertions(+), 36 deletions(-) (limited to 'resources/libraries/robot/shared') diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot index c08dc71fa6..d1ec6d2a03 100644 --- a/resources/libraries/robot/shared/container.robot +++ b/resources/libraries/robot/shared/container.robot @@ -14,9 +14,6 @@ *** Settings *** | Documentation | Keywords related to linux containers | ... -| Library | Collections -| Library | String -| ... | Library | resources.libraries.python.CpuUtils | Library | resources.libraries.python.topology.Topology @@ -34,34 +31,38 @@ | | ... | - auto_scale - If True, use same amount of Dataplane threads for | | ... | network function as DUT, otherwise use single physical core for | | ... | every network function. Type: boolean -| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per -| | ... | SUT/DUT not required. Type: boolean, default value: ${True} +| | ... | - nested: Set True if starting nested containers. +| | ... | Type: boolean, default value: ${False} | | ... | | ... | *Example:* | | ... | | ... | \| Construct container on all DUTs \| 1 \| 1 \| 1 \| 1 \| ${True} \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${nf_chain}=${1} -| | ... | ${nf_node}=${1} | ${auto_scale}=${True} | ${set_nf_cpus}=${True} +| | ... | ${nf_node}=${1} | ${auto_scale}=${True} | ${nested}=${False} | | ... | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | ${nf_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} | | | ${env}= | Create List | DEBIAN_FRONTEND=noninteractive -| | | ${tmp}= | Get Variable Value | ${tmp_volume} | /tmp -| | | ${mnt}= | Create List | ${tmp}:/mnt/host | /dev/vfio:/dev/vfio -| | | ${nf_cpus}= | Run Keyword If | ${set_nf_cpus} +| | | ${uuid}= | Get Variable Value | ${dcr_uuid} | ${Empty} +| | | ${root}= | Get Variable Value | ${dcr_root} | ${Empty} +| | | ${mnt}= | Create List +| | | ... | ${root}/tmp/:/mnt/host/ +| | | ... | ${root}/dev/vfio/:/dev/vfio/ +| | | ... | ${root}/usr/bin/vpp:/usr/bin/vpp +| | | ... | ${root}/usr/bin/vppctl:/usr/bin/vppctl +| | | ... | ${root}/usr/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/ +| | | ... | ${root}/usr/share/vpp/:/usr/share/vpp/ +| | | ${nf_cpus}= | Set Variable | ${None} +| | | ${nf_cpus}= | Run Keyword Unless | ${nested} | | | ... | Create network function CPU list | ${dut} | | | ... | chains=${nf_chains} | nodeness=${nf_nodes} | chain_id=${nf_chain} | | | ... | node_id=${nf_node} | auto_scale=${auto_scale} -| | | ... | ELSE | Set Variable | ${None} -| | | ${uuid_str}= | Run Keyword If | '${tmp}' == '/tmp' -| | | ... | Set Variable | ${EMPTY} -| | | ... | ELSE | Remove String | ${tmp} | ${dut}_VOL | | | &{cont_args}= | Create Dictionary -| | | ... | name=${dut}_${container_group}${nf_id}${uuid_str} +| | | ... | name=${dut}_${container_group}${nf_id}${uuid} | | | ... | node=${nodes['${dut}']} | mnt=${mnt} | env=${env} -| | | Run Keyword If | ${set_nf_cpus} +| | | Run Keyword Unless | ${nested} | | | ... | Set To Dictionary | ${cont_args} | cpuset_cpus=${nf_cpus} | | | Run Keyword | ${container_group}.Construct container | &{cont_args} @@ -75,8 +76,8 @@ | | ... | - auto_scale - If True, use same amount of Dataplane threads for | | ... | network function as DUT, otherwise use single physical core for | | ... | every network function. Type: boolean -| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per -| | ... | SUT/DUT not required. Type: boolean, default value: ${True} +| | ... | - nested: Set True if starting nested containers. +| | ... | Type: boolean, default value: ${False} | | ... | | ... | *Example:* | | ... @@ -84,12 +85,12 @@ | | ... | \| ${True} \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${nf_chain}=${1} -| | ... | ${auto_scale}=${True} | ${set_nf_cpus}=${True} +| | ... | ${auto_scale}=${True} | ${nested}=${False} | | ... | | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes}+1 | | | Construct container on all DUTs | nf_chains=${nf_chains} | | | ... | nf_nodes=${nf_nodes} | nf_chain=${nf_chain} | nf_node=${nf_node} -| | | ... | auto_scale=${auto_scale} | set_nf_cpus=${set_nf_cpus} +| | | ... | auto_scale=${auto_scale} | nested=${nested} | Construct chains of containers on all DUTs | | [Documentation] | Construct 1..N chains of 1..N CNFs on all DUT nodes. @@ -102,20 +103,20 @@ | | ... | - auto_scale - If True, use same amount of Dataplane threads for | | ... | network function as DUT, otherwise use single physical core for | | ... | every network function. Type: boolean -| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per -| | ... | SUT/DUT not required. Type: boolean, default value: ${True} +| | ... | - nested: Set True if starting nested containers. +| | ... | Type: boolean, default value: ${False} | | ... | | ... | *Example:* | | ... | | ... | \| Construct chains of containers on all DUTs \| 1 \| 1 \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${auto_scale}=${True} -| | ... | ${set_nf_cpus}=${True} +| | ... | ${nested}=${False} | | ... | | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1 | | | Construct chain of containers on all DUTs | nf_chains=${nf_chains} | | | ... | nf_nodes=${nf_nodes} | nf_chain=${nf_chain} -| | | ... | auto_scale=${auto_scale} | set_nf_cpus=${set_nf_cpus} +| | | ... | auto_scale=${auto_scale} | nested=${nested} | Acquire all '${group}' containers | | [Documentation] | Acquire all container(s) in specific container group on @@ -129,11 +130,11 @@ | | ... | | Run Keyword | ${group}.Create all containers -| Install VPP in all '${group}' containers -| | [Documentation] | Install VPP on all container(s) in specific container +| Start VPP in all '${group}' containers +| | [Documentation] | Start VPP on all container(s) in specific container | | ... | group on all DUT nodes. | | ... -| | Run Keyword | ${group}.Install VPP In All Containers +| | Run Keyword | ${group}.Start VPP In All Containers | Restart VPP in all '${group}' containers | | [Documentation] | Restart VPP on all container(s) in specific container diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot index 981bfa1d0d..981c329f63 100644 --- a/resources/libraries/robot/shared/default.robot +++ b/resources/libraries/robot/shared/default.robot @@ -552,9 +552,8 @@ | | ... | default value: ${1} | | ... | | ... | _NOTE:_ This KW sets following test case variables: -| | ... | - tmp_volume - Docker volume mounted as /tmp directory on DUT1. -| | ... | - dcr_uuid - UUID string (including prefix - underscore character) of -| | ... | DUT1 /tmp volume. +| | ... | - dcr_uuid - Parent container UUID. +| | ... | - dcr_root - Parent container overlay. | | ... | | ... | *Example:* | | ... @@ -567,19 +566,18 @@ | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager | | ... | engine=${container_engine} | WITH NAME | ${container_group} | | ... -| | ${tmp_volume}= | Get Environment Variable | CSIT_DUT1_VOL -| | ${dcr_uuid}= | Remove String | ${tmp_volume} | DUT1_VOL -| | Set Test Variable | ${tmp_volume} +| | ${dcr_uuid}= | Get Environment Variable | CSIT_DUT1_UUID +| | ${dcr_root}= | Run Keyword | Get Docker Mergeddir | ${nodes['DUT1']} +| | ... | ${dcr_uuid} | | Set Test Variable | ${dcr_uuid} +| | Set Test Variable | ${dcr_root} | | ... | | Construct chains of containers on all DUTs | ${chains} | ${nodeness} -| | ... | set_nf_cpus=${False} +| | ... | nested=${True} | | Acquire all '${container_group}' containers | | Create all '${container_group}' containers | | Configure VPP in all '${container_group}' containers -| | Stop VPP service on all DUTs | ${nodes} -| | Install VPP in all '${container_group}' containers -| | Start VPP service on all DUTs | ${nodes} +| | Start VPP in all '${container_group}' containers | | Append To List | ${container_groups} | ${container_group} | Tear down TAP functional test -- cgit 1.2.3-korg