| Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame^] | 1 | #!/bin/bash | 
 | 2 | if [ -z ${TEMPEST_CUSTOM_PUBLIC_NET+x} ]; then | 
 | 3 | 	echo "# WARNING: Public network is empty" | 
 | 4 | fi | 
 | 5 | # mosrc | 
 | 6 | . $MY_PROJFOLDER/envs/mosrc | 
 | 7 |  | 
 | 8 | ## | 
 | 9 | echo "### Checking openstack resources" | 
 | 10 | status=$(kubectl -n qa-space get pod | grep toolset | tr -s " " | cut -d' ' -f3) | 
 | 11 | if [ ${status} != "Running" ]; then | 
 | 12 | 	echo "# 'toolset' container is not Running" | 
 | 13 | 	exit 1 | 
 | 14 | fi | 
 | 15 | if [ ! -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" | 
 | 19 | else | 
 | 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" | 
 | 24 | fi | 
 | 25 |  | 
 | 26 | # | 
 | 27 | echo " " | 
 | 28 | echo "# Filling tempest_custom.yaml" | 
 | 29 | cp -v /opt/res-files/k8s/yamls/tempest_custom.yaml.clean $MY_PROJFOLDER/yamls/tempest_custom.yaml | 
 | 30 | declare $(kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest") | 
 | 31 | echo "# Getting network details" | 
 | 32 | netid=$(kubectl exec toolset --stdin -n qa-space -- openstack network show ${TEMPEST_CUSTOM_PUBLIC_NET} -c id -f value) | 
 | 33 | subnetid=$(kubectl exec toolset --stdin -n qa-space -- openstack subnet list -f value | grep ${TEMPEST_CUSTOM_PUBLIC_NET} | cut -d' ' -f1) | 
 | 34 | echo "# image_ref_uuid -> ${cirros51_id}" | 
 | 35 | sed -i "s/image_ref_uuid/${cirros51_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml | 
 | 36 | echo "# image_ref_alt_uuid -> ${cirros52_id}" | 
 | 37 | sed -i "s/image_ref_alt_uuid/${cirros52_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml | 
 | 38 | echo "# s/public_subnet_uuid/ -> ${subnetid}" | 
 | 39 | sed -i "s/public_subnet_uuid/${subnetid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml | 
 | 40 | echo "# s/public_net_uuid/ -> ${netid}" | 
 | 41 | sed -i "s/public_net_uuid/${netid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml | 
 | 42 | echo "# s/public_net_name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}" | 
 | 43 | sed -i "s/public_net_name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml | 
 | 44 |  | 
 | 45 | #  | 
 | 46 | echo "# Done!" |