X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fbash%2Ffunction%2Fcommon.sh;h=d98db18149746d1ea1aa75724a1291920127af12;hb=d66bbe4d85079621e13d6e2940c933da1297ba2b;hp=4a5f43b3e106086cc94c3a48852e7f5b4f7272ec;hpb=830b1021b8173461e231b276b4323a0a631036fb;p=csit.git diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh index 4a5f43b3e1..d98db18149 100644 --- a/resources/libraries/bash/function/common.sh +++ b/resources/libraries/bash/function/common.sh @@ -227,7 +227,7 @@ function common_dirs () { TOPOLOGIES_DIR=$(readlink -e "${CSIT_DIR}/topologies/available") || { die "Readlink failed." } - JOB_SPECS_DIR=$(readlink -e "${CSIT_DIR}/docs/job_specs") || { + JOB_SPECS_DIR=$(readlink -e "${CSIT_DIR}/resources/job_specs") || { die "Readlink failed." } RESOURCES_DIR=$(readlink -e "${CSIT_DIR}/resources") || { @@ -640,6 +640,8 @@ function prepare_topology () { # - TEST_CODE - String affecting test selection, usually jenkins job name. # - NODENESS - Node multiplicity of testbed, either "2n" or "3n". # - FLAVOR - Node flavor string, e.g. "clx" or "skx". + # Variables set: + # - TERRAFORM_MODULE_DIR - Terraform module directory. # Functions called: # - die - Print to stderr and exit. # - terraform_init - Terraform init topology. @@ -651,7 +653,11 @@ function prepare_topology () { case "${case_text}" in "1n_aws" | "2n_aws" | "3n_aws") export TF_VAR_testbed_name="${TEST_CODE}" + TERRAFORM_MODULE_DIR="terraform-aws-${NODENESS}-${FLAVOR}-c5n" terraform_init || die "Failed to call terraform init." + trap 'terraform_destroy' ERR || { + die "Trap attempt failed, please cleanup manually. Aborting!" + } terraform_apply || die "Failed to call terraform apply." ;; esac @@ -1111,6 +1117,10 @@ function select_topology () { TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_icx*.yaml ) TOPOLOGIES_TAGS="2_node_*_link_topo" ;; + "2n_spr") + TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_spr*.yaml ) + TOPOLOGIES_TAGS="2_node_*_link_topo" + ;; "3n_snr") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_snr*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" @@ -1193,7 +1203,8 @@ function untrap_and_unreserve_testbed () { # Variables read (by inner function): # - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed. # - PYTHON_SCRIPTS_DIR - Path to directory holding Python scripts. - # Variables written: + # Variables set: + # - TERRAFORM_MODULE_DIR - Terraform module directory. # - WORKING_TOPOLOGY - Set to empty string on successful unreservation. # Trap unregistered: # - EXIT - Failure to untrap is reported, but ignored otherwise. @@ -1215,6 +1226,7 @@ function untrap_and_unreserve_testbed () { } case "${TEST_CODE}" in *"1n-aws"* | *"2n-aws"* | *"3n-aws"*) + TERRAFORM_MODULE_DIR="terraform-aws-${NODENESS}-${FLAVOR}-c5n" terraform_destroy || die "Failed to call terraform destroy." ;; *)