blob: 75d12161adc070650be9a8610e4bd248c9692767 [file] [log] [blame]
Alexa0053b92022-10-14 16:38:28 -05001#!/bin/bash
Ievgeniia Zadorozhna7bc54052024-02-20 00:15:35 +01002echo "Sourcing $MY_PROJFOLDER/env.sh"
3. $MY_PROJFOLDER/env.sh
Alexa0053b92022-10-14 16:38:28 -05004if [ -z ${TEMPEST_CUSTOM_PUBLIC_NET+x} ]; then
Ievgeniia Zadorozhna7bc54052024-02-20 00:15:35 +01005 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."
Alexa0053b92022-10-14 16:38:28 -05006fi
7# mosrc
8. $MY_PROJFOLDER/envs/mosrc
9
10##
11echo "### Checking openstack resources"
12status=$(kubectl -n qa-space get pod | grep toolset | tr -s " " | cut -d' ' -f3)
13if [ ${status} != "Running" ]; then
14 echo "# 'toolset' container is not Running"
15 exit 1
16fi
17if [ ! -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"
21else
Ievgeniia Zadorozhna7bc54052024-02-20 00:15:35 +010022 echo "# Creating openstack resources"
Alexa0053b92022-10-14 16:38:28 -050023 echo " "
24 kubectl exec toolset --stdin -n qa-space -- bash -c "mkdir /artifacts/cmp-check"
Ievgeniia Zadorozhna7bc54052024-02-20 00:15:35 +010025 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)"
Alexa0053b92022-10-14 16:38:28 -050026fi
27
28#
29echo " "
30echo "# Filling tempest_custom.yaml"
Ievgeniia Zadorozhnadd2a1252024-01-24 23:42:42 +010031# TODO: set the correct availability_zone in case nova is not used (now nova is default option)
Alexa0053b92022-10-14 16:38:28 -050032cp -v /opt/res-files/k8s/yamls/tempest_custom.yaml.clean $MY_PROJFOLDER/yamls/tempest_custom.yaml
33declare $(kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest")
34echo "# Getting network details"
35netid=$(kubectl exec toolset --stdin -n qa-space -- openstack network show ${TEMPEST_CUSTOM_PUBLIC_NET} -c id -f value)
Alexc85212b2022-11-08 12:27:01 -060036subnetid=$(kubectl exec toolset --stdin -n qa-space -- openstack subnet list -f value | grep ${netid} | cut -d' ' -f1)
Ievgeniia Zadorozhna7bc54052024-02-20 00:15:35 +010037#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
Alexa0053b92022-10-14 16:38:28 -050043echo "# s/public_subnet_uuid/ -> ${subnetid}"
44sed -i "s/public_subnet_uuid/${subnetid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
45echo "# s/public_net_uuid/ -> ${netid}"
46sed -i "s/public_net_uuid/${netid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
47echo "# s/public_net_name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}"
48sed -i "s/public_net_name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
Alex35945732023-04-07 10:03:59 -050049echo "# s/volume_type_name/ -> ${TEMPEST_CUSTOM_VOLUME_TYPE}"
50sed -i "s/volume_type_name/${TEMPEST_CUSTOM_VOLUME_TYPE}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
Alex2c8b8802022-10-20 14:07:15 -050051echo " "
Alexa0053b92022-10-14 16:38:28 -050052
Alex2c8b8802022-10-20 14:07:15 -050053echo "# Updating SPT global_config.yaml"
54cp -v /opt/res-files/k8s/yamls/spt_global_config.yaml.clean $MY_PROJFOLDER/yamls/global_config.yaml
Alexc85212b2022-11-08 12:27:01 -060055echo "# image_ref_name -> ${ubuntu20_name}"
56sed -i "s/image_ref_name/${ubuntu20_name}/g" $MY_PROJFOLDER/yamls/global_config.yaml
Alex2c8b8802022-10-20 14:07:15 -050057echo "# s/public-network-name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}"
58sed -i "s/public-network-name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/global_config.yaml
Alexa0053b92022-10-14 16:38:28 -050059#
60echo "# Done!"