blob: f56667641f905a8e27d0a3f9d9eebb18e0e3a550 [file] [log] [blame]
Alexa0053b92022-10-14 16:38:28 -05001#!/bin/bash
2if [ -z ${TEMPEST_CUSTOM_PUBLIC_NET+x} ]; then
3 echo "# WARNING: Public network is empty"
4fi
5# mosrc
6. $MY_PROJFOLDER/envs/mosrc
7
8##
9echo "### Checking openstack resources"
10status=$(kubectl -n qa-space get pod | grep toolset | tr -s " " | cut -d' ' -f3)
11if [ ${status} != "Running" ]; then
12 echo "# 'toolset' container is not Running"
13 exit 1
14fi
15if [ ! -z $(kubectl exec toolset --stdin -n qa-space -- bash -c "openstack user show cvp.admin -c id -f value") ]; then
16 echo "# Resources already created"
17 echo " "
18 kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest"
19else
20 echo "# Creating openstack resources"
21 echo " "
22 kubectl exec toolset --stdin -n qa-space -- bash -c "mkdir /artifacts/cmp-check"
Alex2c8b8802022-10-20 14:07:15 -050023 kubectl exec toolset --tty --stdin -n qa-space -- bash -c "cd /artifacts/cmp-check; bash /opt/cmp-check/prepare.sh -w \$(pwd)"
Alexa0053b92022-10-14 16:38:28 -050024fi
25
26#
27echo " "
28echo "# Filling tempest_custom.yaml"
29cp -v /opt/res-files/k8s/yamls/tempest_custom.yaml.clean $MY_PROJFOLDER/yamls/tempest_custom.yaml
30declare $(kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest")
31echo "# Getting network details"
32netid=$(kubectl exec toolset --stdin -n qa-space -- openstack network show ${TEMPEST_CUSTOM_PUBLIC_NET} -c id -f value)
33subnetid=$(kubectl exec toolset --stdin -n qa-space -- openstack subnet list -f value | grep ${TEMPEST_CUSTOM_PUBLIC_NET} | cut -d' ' -f1)
34echo "# image_ref_uuid -> ${cirros51_id}"
35sed -i "s/image_ref_uuid/${cirros51_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
36echo "# image_ref_alt_uuid -> ${cirros52_id}"
37sed -i "s/image_ref_alt_uuid/${cirros52_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
38echo "# s/public_subnet_uuid/ -> ${subnetid}"
39sed -i "s/public_subnet_uuid/${subnetid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
40echo "# s/public_net_uuid/ -> ${netid}"
41sed -i "s/public_net_uuid/${netid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
42echo "# s/public_net_name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}"
43sed -i "s/public_net_name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
Alex2c8b8802022-10-20 14:07:15 -050044echo " "
Alexa0053b92022-10-14 16:38:28 -050045
Alex2c8b8802022-10-20 14:07:15 -050046echo "# Updating SPT global_config.yaml"
47cp -v /opt/res-files/k8s/yamls/spt_global_config.yaml.clean $MY_PROJFOLDER/yamls/global_config.yaml
48echo "# s/public-network-name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}"
49sed -i "s/public-network-name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/global_config.yaml
50echo "# s/mtu-value/ -> default"
51sed -i "s/mtu-value/default/g" $MY_PROJFOLDER/yamls/global_config.yaml
Alexa0053b92022-10-14 16:38:28 -050052#
53echo "# Done!"