diff options
author | Jan Gelety <jgelety@cisco.com> | 2019-01-10 11:53:58 +0100 |
---|---|---|
committer | Jan Gelety <jgelety@cisco.com> | 2019-01-23 08:19:54 +0000 |
commit | 5a53823d8a6e99072152654ac632bb06a6b467ac (patch) | |
tree | a7709a8192f86503c851abeba02849468ec3aa75 /resources/libraries/bash/function | |
parent | fcbcfb9aa1bd57fbf187b92a6b1de80899209640 (diff) |
VPP_Device - add baseline tests - part IIb)
CSIT-1372
Add following baseline tests to VPP_Device:
- ip4
eth2p-ethip4-ip4base-eth-2memif-1dcr-dev
- ip6
eth2p-ethip6-ip6base-eth-2memif-1dcr-dev
- l2bd
eth2p-eth-l2bdbasemaclrn-eth-2memif-1dcr-dev
- l2xc
eth2p-eth-l2xcbase-eth-2memif-1dcr-dev
Change-Id: Ic4a3a01b62d800c528a9c9371891dcc26b875220
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/bash/function')
-rw-r--r-- | resources/libraries/bash/function/device.sh | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/resources/libraries/bash/function/device.sh b/resources/libraries/bash/function/device.sh index 7363dc0df6..7a61bf7f71 100644 --- a/resources/libraries/bash/function/device.sh +++ b/resources/libraries/bash/function/device.sh @@ -108,8 +108,8 @@ function bind_interfaces_to_driver () { function clean_environment () { - # Cleanup environment by removing topology containers and binding - # interfaces back to original driver. + # Cleanup environment by removing topology containers and shared volumes + # and binding interfaces back to original driver. # # Variables read: # - DCR_UUIDS - Docker Container UUIDs. @@ -124,6 +124,11 @@ function clean_environment () { # Kill docker containers. docker rm --force "${DCR_UUIDS[@]}" || die "Cleanup containers failed!" + # Remove DUT1 /tmp volume + docker volume rm "${DCR_VOLUMES[dut1]}" || { + die "Failed to remove DUT1 /tmp volume!" + } + # Rebind interfaces back to kernel drivers. for ADDR in ${TG_PCIDEVS[@]}; do DRIVER="${TG_DRIVERS[0]}" @@ -420,8 +425,10 @@ function read_env_variables () { export "${param}" done declare -gA DCR_UUIDS + declare -gA DCR_VOLUMES DCR_UUIDS+=([tg]="${CSIT_TG_UUID}") DCR_UUIDS+=([dut1]="${CSIT_DUT1_UUID}") + DCR_VOLUMES+=([dut1]="${CSIT_DUT1_VOL}") TG_PCIDEVS=("${CSIT_TG_INTERFACES_PORT1_PCI}") TG_DRIVERS=("${CSIT_TG_INTERFACES_PORT1_DRV}") TG_PCIDEVS+=("${CSIT_TG_INTERFACES_PORT2_PCI}") @@ -465,6 +472,7 @@ function set_env_variables () { CSIT_DUT1_ARCH="$(uname -i)" || { die "Reading machine architecture failed!" } + CSIT_DUT1_VOL="${DCR_VOLUMES[dut1]}" CSIT_TG_INTERFACES_PORT1_MAC="${TG_NETMACS[0]}" CSIT_TG_INTERFACES_PORT1_PCI="${TG_PCIDEVS[0]}" CSIT_TG_INTERFACES_PORT1_DRV="${TG_DRIVERS[0]}" @@ -519,6 +527,8 @@ function start_topology_containers () { dcr_stc_params+="--volume /dev/vfio:/dev/vfio " # Mount nested_vm image to be able to run VM tests. dcr_stc_params+="--volume /var/lib/vm/vhost-nested.img:/var/lib/vm/vhost-nested.img " + # Mount docker.sock to be able to use docker deamon of the host. + dcr_stc_params+="--volume /var/run/docker.sock:/var/run/docker.sock " # Docker Container UUIDs. declare -gA DCR_UUIDS @@ -526,13 +536,25 @@ function start_topology_containers () { declare -gA DCR_PORTS # Docker Container PIDs (namespaces). declare -gA DCR_CPIDS + # Docker Container volumes with no relationship to the host. + declare -gA DCR_VOLUMES + + # Create DUT1 /tmp volume to be able to install VPP in "nested" container. + params=(--name DUT1_VOL_$(uuidgen)) + DCR_VOLUMES+=([dut1]="$(docker volume create "${params[@]}")") || { + die "Failed to create DUT1 /tmp volume!" + } + + # Mount DUT1_VOL as /tmp directory on DUT1 container + dcr_stc_params_dut1="--volume ${DCR_VOLUMES[dut1]}:/tmp " # Run TG and DUT1. As initial version we do support only 2-node. params=(${dcr_stc_params} --name csit-tg-$(uuidgen) ${dcr_image}) DCR_UUIDS+=([tg]="$(docker run "${params[@]}")") || { die "Failed to start TG docker container!" } - params=(${dcr_stc_params} --name csit-dut1-$(uuidgen) ${dcr_image}) + params=(${dcr_stc_params} ${dcr_stc_params_dut1} + --name csit-dut1-$(uuidgen) ${dcr_image}) DCR_UUIDS+=([dut1]="$(docker run "${params[@]}")") || { die "Failed to start DUT1 docker container!" } |