Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Ievgeniia Zadorozhna | 7bc5405 | 2024-02-20 00:15:35 +0100 | [diff] [blame^] | 2 | echo "Sourcing $MY_PROJFOLDER/env.sh" |
| 3 | . $MY_PROJFOLDER/env.sh |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 4 | if [ -z ${TEMPEST_CUSTOM_PUBLIC_NET+x} ]; then |
Ievgeniia Zadorozhna | 7bc5405 | 2024-02-20 00:15:35 +0100 | [diff] [blame^] | 5 | echo "# WARNING: Public network is empty, please export its name to TEMPEST_CUSTOM_PUBLIC_NET environment variable to use some specific external net in case of several networks. Otherwise random external network will be used." |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 6 | fi |
| 7 | # mosrc |
| 8 | . $MY_PROJFOLDER/envs/mosrc |
| 9 | |
| 10 | ## |
| 11 | echo "### Checking openstack resources" |
| 12 | status=$(kubectl -n qa-space get pod | grep toolset | tr -s " " | cut -d' ' -f3) |
| 13 | if [ ${status} != "Running" ]; then |
| 14 | echo "# 'toolset' container is not Running" |
| 15 | exit 1 |
| 16 | fi |
| 17 | if [ ! -z $(kubectl exec toolset --stdin -n qa-space -- bash -c "openstack user show cvp.admin -c id -f value") ]; then |
| 18 | echo "# Resources already created" |
| 19 | echo " " |
| 20 | kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest" |
| 21 | else |
Ievgeniia Zadorozhna | 7bc5405 | 2024-02-20 00:15:35 +0100 | [diff] [blame^] | 22 | echo "# Creating openstack resources" |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 23 | echo " " |
| 24 | kubectl exec toolset --stdin -n qa-space -- bash -c "mkdir /artifacts/cmp-check" |
Ievgeniia Zadorozhna | 7bc5405 | 2024-02-20 00:15:35 +0100 | [diff] [blame^] | 25 | kubectl exec toolset --tty --stdin -n qa-space -- bash -c "cd /artifacts/cmp-check; export CUSTOM_PUBLIC_NET_NAME="${TEMPEST_CUSTOM_PUBLIC_NET:-}"; bash /opt/cmp-check/prepare.sh -w \$(pwd)" |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 26 | fi |
| 27 | |
| 28 | # |
| 29 | echo " " |
| 30 | echo "# Filling tempest_custom.yaml" |
Ievgeniia Zadorozhna | dd2a125 | 2024-01-24 23:42:42 +0100 | [diff] [blame] | 31 | # TODO: set the correct availability_zone in case nova is not used (now nova is default option) |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 32 | cp -v /opt/res-files/k8s/yamls/tempest_custom.yaml.clean $MY_PROJFOLDER/yamls/tempest_custom.yaml |
| 33 | declare $(kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest") |
| 34 | echo "# Getting network details" |
| 35 | netid=$(kubectl exec toolset --stdin -n qa-space -- openstack network show ${TEMPEST_CUSTOM_PUBLIC_NET} -c id -f value) |
Alex | c85212b | 2022-11-08 12:27:01 -0600 | [diff] [blame] | 36 | subnetid=$(kubectl exec toolset --stdin -n qa-space -- openstack subnet list -f value | grep ${netid} | cut -d' ' -f1) |
Ievgeniia Zadorozhna | 7bc5405 | 2024-02-20 00:15:35 +0100 | [diff] [blame^] | 37 | #echo "# image_ref_name -> ${cirros61_name}" |
| 38 | #sed -i "s/image_ref_name/${cirros61_name}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml |
| 39 | #echo "# image_ref_uuid -> ${cirros61_id}" |
| 40 | #sed -i "s/image_ref_uuid/${cirros61_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml |
| 41 | #echo "# image_ref_alt_uuid -> ${cirros62_id}" |
| 42 | #sed -i "s/image_ref_alt_uuid/${cirros62_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 43 | echo "# s/public_subnet_uuid/ -> ${subnetid}" |
| 44 | sed -i "s/public_subnet_uuid/${subnetid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml |
| 45 | echo "# s/public_net_uuid/ -> ${netid}" |
| 46 | sed -i "s/public_net_uuid/${netid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml |
| 47 | echo "# s/public_net_name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}" |
| 48 | sed -i "s/public_net_name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml |
Alex | 3594573 | 2023-04-07 10:03:59 -0500 | [diff] [blame] | 49 | echo "# s/volume_type_name/ -> ${TEMPEST_CUSTOM_VOLUME_TYPE}" |
| 50 | sed -i "s/volume_type_name/${TEMPEST_CUSTOM_VOLUME_TYPE}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 51 | echo " " |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 52 | |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 53 | echo "# Updating SPT global_config.yaml" |
| 54 | cp -v /opt/res-files/k8s/yamls/spt_global_config.yaml.clean $MY_PROJFOLDER/yamls/global_config.yaml |
Alex | c85212b | 2022-11-08 12:27:01 -0600 | [diff] [blame] | 55 | echo "# image_ref_name -> ${ubuntu20_name}" |
| 56 | sed -i "s/image_ref_name/${ubuntu20_name}/g" $MY_PROJFOLDER/yamls/global_config.yaml |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 57 | echo "# s/public-network-name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}" |
| 58 | sed -i "s/public-network-name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/global_config.yaml |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 59 | # |
| 60 | echo "# Done!" |