blob: 9c9b36cc27364977af59e6bf40b3f037216b70bb [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"
23 kubectl exec toolset --stdin -n qa-space -- bash -c "cd /artifacts/cmp-check; bash /opt/cmp-check/prepare.sh"
24fi
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
44
45#
46echo "# Done!"