+function post_process_robot_outputs () {
+
+ # Generate INFO level output_info.xml by rebot.
+ #
+ # Variables read:
+ # - ARCHIVE_DIR - Path to post-processed files.
+
+ set -exuo pipefail
+
+ # Generate INFO level output_info.xml for post-processing.
+ all_options=("--loglevel" "INFO")
+ all_options+=("--log" "none")
+ all_options+=("--report" "none")
+ all_options+=("--output" "${ARCHIVE_DIR}/output_info.xml")
+ all_options+=("${ARCHIVE_DIR}/output.xml")
+ rebot "${all_options[@]}" || true
+}
+
+
+function prepare_topology () {
+
+ # Prepare virtual testbed topology if needed based on flavor.
+
+ # Variables read:
+ # - 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.
+ # - terraform_apply - Terraform apply topology.
+
+ set -exuo pipefail
+
+ case_text="${NODENESS}_${FLAVOR}"
+ 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
+}
+
+