X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fbash%2Ffunction%2Fcommon.sh;h=d768e9b66c86d97a52d6215b75826e17fd15eea1;hb=74aa13757057a4c93d62704ad0de7a71c5cf1357;hp=b1979174e503def3fc246ffc0402e6e6292f69ff;hpb=ee9f4b4433d3a4b72b9d3e43c480a56892e8c8b6;p=csit.git diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh index b1979174e5..d768e9b66c 100644 --- a/resources/libraries/bash/function/common.sh +++ b/resources/libraries/bash/function/common.sh @@ -236,9 +236,6 @@ function common_dirs () { TOOLS_DIR=$(readlink -e "${RESOURCES_DIR}/tools") || { die "Readlink failed." } - DOC_GEN_DIR=$(readlink -e "${TOOLS_DIR}/doc_gen") || { - die "Readlink failed." - } PYTHON_SCRIPTS_DIR=$(readlink -e "${TOOLS_DIR}/scripts") || { die "Readlink failed." } @@ -475,8 +472,12 @@ function get_test_code () { NODENESS="3n" FLAVOR="icx" ;; - *"3n-spr"*) - NODENESS="3n" + *"3na-spr"*) + NODENESS="3na" + FLAVOR="spr" + ;; + *"3nb-spr"*) + NODENESS="3nb" FLAVOR="spr" ;; *"3n-snr"*) @@ -640,6 +641,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 +654,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 @@ -862,7 +869,13 @@ function select_tags () { *"3n-icx"* | *"2n-icx"*) default_nic="nic_intel-xxv710" ;; - *"3n-spr"* | *"2n-spr"*) + *"3na-spr"*) + default_nic="nic_mellanox-cx7veat" + ;; + *"3nb-spr"*) + default_nic="nic_intel-e810cq" + ;; + *"2n-spr"*) default_nic="nic_intel-e810cq" ;; *"2n-clx"* | *"2n-zn2"*) @@ -886,6 +899,7 @@ function select_tags () { awk_nics_sub_cmd+='gsub("xl710","40ge2p1xl710");' awk_nics_sub_cmd+='gsub("x520-da2","10ge2p1x520");' awk_nics_sub_cmd+='gsub("cx556a","100ge2p1cx556a");' + awk_nics_sub_cmd+='gsub("cx7veat","200ge2p1cx7veat");' awk_nics_sub_cmd+='gsub("e810cq","100ge2p1e810cq");' awk_nics_sub_cmd+='gsub("vic1227","10ge2p1vic1227");' awk_nics_sub_cmd+='gsub("vic1385","40ge2p1vic1385");' @@ -1005,7 +1019,10 @@ function select_tags () { ;; *"3n-snr"*) ;; - *"3n-spr"*) + *"3na-spr"*) + test_tag_array+=("!ipsechw") + ;; + *"3nb-spr"*) test_tag_array+=("!ipsechw") ;; *"3n-tsh"*) @@ -1103,6 +1120,14 @@ function select_topology () { TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_icx*.yaml ) TOPOLOGIES_TAGS="3_node_*_link_topo" ;; + "3na_spr") + TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3na_spr*.yaml ) + TOPOLOGIES_TAGS="3_node_*_link_topo" + ;; + "3nb_spr") + TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3nb_spr*.yaml ) + TOPOLOGIES_TAGS="3_node_*_link_topo" + ;; "2n_clx") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_clx*.yaml ) TOPOLOGIES_TAGS="2_node_*_link_topo" @@ -1197,7 +1222,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. @@ -1219,6 +1245,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." ;; *)