Remove intrusive useless logging
[csit.git] / resources / libraries / bash / function / device.sh
index 7a61bf7..0b1a090 100644 (file)
@@ -124,9 +124,10 @@ 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!"
+    # Check if there are some leftover containers and remove all. Command will
+    # not fail in case there are no containers to remove.
+    docker rm --force $(docker ps -q --filter name=${DCR_UUIDS[dut1]}) || {
+        warn "Failed to remove hanged containers or nothing to remove!"
     }
 
     # Rebind interfaces back to kernel drivers.
@@ -256,8 +257,8 @@ function get_available_interfaces () {
             # Add Intel Corporation 82545EM Gigabit Ethernet Controller to the
             # whitelist.
             pci_id="0x100f"
-            tg_netdev=(eth1 eth2)
-            dut1_netdev=(eth3 eth4)
+            tg_netdev=(enpTGa enpTGb)
+            dut1_netdev=(enpSUTa enpSUTb)
             ;;
         *)
             die "Unknown specification: ${case_text}!"
@@ -297,12 +298,26 @@ function get_available_interfaces () {
         fi
     done
 
-    for netdev in "${tg_side[@]::2}"; do
-        TG_NETDEVS+=(${netdev})
-    done
-    for netdev in "${dut1_side[@]::2}"; do
-        DUT1_NETDEVS+=(${netdev})
-    done
+    case "${case_text}" in
+        "1n_skx")
+            # Pick up first two DUT1 interfaces binded to i40evf.
+            for netdev in "${dut1_side[@]::2}"; do
+                DUT1_NETDEVS+=(${netdev})
+            done
+            # Corresponding TG interfaces will be same ID.SUB_ID, but on
+            # opposite linked device.
+            for netdev in "${DUT1_NETDEVS[@]}"; do
+                TG_NETDEVS+=(${netdev/$dut1_netdev/$tg_netdev})
+            done
+            ;;
+        *)
+            for netdev in "${tg_side[@]::2}"; do
+                TG_NETDEVS+=(${netdev})
+            done
+            for netdev in "${dut1_side[@]::2}"; do
+                DUT1_NETDEVS+=(${netdev})
+            done
+    esac
 
     for NETDEV in "${TG_NETDEVS[@]}"; do
         get_pci_addr
@@ -425,10 +440,8 @@ 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}")
@@ -472,7 +485,6 @@ 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]}"
@@ -536,25 +548,13 @@ 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} ${dcr_stc_params_dut1}
-            --name csit-dut1-$(uuidgen) ${dcr_image})
+    params=(${dcr_stc_params} --name csit-dut1-$(uuidgen) ${dcr_image})
     DCR_UUIDS+=([dut1]="$(docker run "${params[@]}")") || {
         die "Failed to start DUT1 docker container!"
     }