+ source "${BASH_FUNCTION_DIR}/device.sh" || {
+ die "Source failed!"
+ }
+ device_image="$(< ${CSIT_DIR}/${IMAGE_VER_FILE})"
+ case_text="${NODENESS}_${FLAVOR}"
+ case "${case_text}" in
+ "1n_skx" | "1n_tx2")
+ # We execute reservation over csit-shim-dcr (ssh) which runs sourced
+ # script's functions. Env variables are read from ssh output
+ # back to localhost for further processing.
+ # Shim and Jenkins executor are in the same network on the same host
+ # Connect to docker's default gateway IP and shim's exposed port
+ ssh="ssh root@172.17.0.1 -p 6022"
+ run="activate_wrapper ${NODENESS} ${FLAVOR} ${device_image}"
+ # The "declare -f" output is long and boring.
+ set +x
+ # backtics to avoid https://midnight-commander.org/ticket/2142
+ env_vars=`${ssh} "$(declare -f); ${run}"` || {
+ die "Topology reservation via shim-dcr failed!"
+ }
+ set -x
+ set -a
+ source <(echo "$env_vars" | grep -v /usr/bin/docker) || {
+ die "Source failed!"
+ }
+ set +a
+ ;;
+ "1n_vbox")
+ # We execute reservation on localhost. Sourced script automatially
+ # sets environment variables for further processing.
+ activate_wrapper "${NODENESS}" "${FLAVOR}" "${device_image}" || die
+ ;;
+ *)
+ die "Unknown specification: ${case_text}!"
+ esac
+
+ trap 'deactivate_docker_topology' EXIT || {
+ die "Trap attempt failed, please cleanup manually. Aborting!"
+ }
+
+ # Replace all variables in template with those in environment.
+ source <(echo 'cat <<EOF >topo.yml'; cat ${TOPOLOGIES[0]}; echo EOF;) || {
+ die "Topology file create failed!"
+ }
+
+ WORKING_TOPOLOGY="/tmp/topology.yaml"
+ mv topo.yml "${WORKING_TOPOLOGY}" || {
+ die "Topology move failed!"
+ }
+ cat ${WORKING_TOPOLOGY} | grep -v password || {
+ die "Topology read failed!"
+ }
+}
+
+
+function activate_virtualenv () {
+
+ # Update virtualenv pip package, delete and create virtualenv directory,
+ # activate the virtualenv, install requirements, set PYTHONPATH.
+