Updated the settings for Tempest configuration
See the ticket [1] as the reason of the changes.
List of the main changes:
* Ability to set the CUSTOM_PUBLIC_NET_NAME - floating network
in the offline and online methods of execution.
* The cvp.* flavors and images are not passed in tempest config.
* tempest_custom.yaml.clean file has reduced number of options
(the old and irrelevant are removed).
[1] https://mirantis.jira.com/browse/PRODX-39383
Related-PROD: PROD-37187
Change-Id: I31e8c8e4b3d8eda706cbba46b4435d31f8f8eb4e
diff --git a/k8s/workspace/init-workspace.sh b/k8s/workspace/init-workspace.sh
index 7b835e7..1c49be0 100644
--- a/k8s/workspace/init-workspace.sh
+++ b/k8s/workspace/init-workspace.sh
@@ -70,6 +70,7 @@
ewriteln "export MY_CLIENTNAME='ClientName'"
ewriteln "export MY_CLIENTSHORTNAME='clname'"
ewriteln "export MY_PROJNAME='MOS_DEPLOY'"
+CUSTOM_PUBLIC_NET_NAME=""
ewriteln "export MY_PROJFOLDER=/artifacts"
# NS & CLUSTER
@@ -154,12 +155,28 @@
echo " "
keystone_pod=$(kubectl --kubeconfig $MY_PROJFOLDER/envs/mos-kubeconfig.yaml get pod -n openstack -o=custom-columns=NAME:.metadata.name | grep keystone-client)
- echo "# Extracting network: taking the first found external network"
- cmd="openstack network list --external -c Name -f value | head -n1"
- echo "# Running 'kubectl --kubeconfig $MY_PROJFOLDER/envs/mos-kubeconfig.yaml -n openstack exec ${keystone_pod} -c keystone-client --stdin -- sh -c '${cmd}'"
- vPUBNET=$(kubectl --kubeconfig $MY_PROJFOLDER/envs/mos-kubeconfig.yaml -n openstack exec ${keystone_pod} -c keystone-client --stdin -- sh -c "${cmd}")
- echo "-> 'openstack network list --external -c Name -f value | head -n1': '${vPUBNET}'"
- ewriteln "export TEMPEST_CUSTOM_PUBLIC_NET=${vPUBNET}"
+ if [ -n "${CUSTOM_PUBLIC_NET_NAME:-}" ]; then
+ # if CUSTOM_PUBLIC_NET_NAME is set to some specific net, check it is present on the cloud
+ echo "# Checking that the external network ${CUSTOM_PUBLIC_NET_NAME} is present on the cloud"
+ cmd="openstack network show ${CUSTOM_PUBLIC_NET_NAME} -c id -f value 2>/dev/null"
+ echo "# Running 'kubectl --kubeconfig $MY_PROJFOLDER/envs/mos-kubeconfig.yaml -n openstack exec ${keystone_pod} -c keystone-client --stdin -- sh -c '${cmd}'"
+ network_exists=$(kubectl --kubeconfig $MY_PROJFOLDER/envs/mos-kubeconfig.yaml -n openstack exec "${keystone_pod}" -c keystone-client --stdin -- sh -c "${cmd}")
+ if [ -n "$network_exists" ]; then
+ echo "# Setting TEMPEST_CUSTOM_PUBLIC_NET to ${CUSTOM_PUBLIC_NET_NAME}"
+ ewriteln "export TEMPEST_CUSTOM_PUBLIC_NET=${CUSTOM_PUBLIC_NET_NAME}"
+ else
+ echo "The custom external (floating) network ${CUSTOM_PUBLIC_NET_NAME} is not found on the cloud. Set CUSTOM_PUBLIC_NET_NAME=\"\" to automatically pick some public network."
+ exit 1
+ fi
+ else
+ # else if it is not set by the QA engineer, let's extract the first external network and use it
+ echo "# Extracting network: taking the first found external network"
+ cmd="openstack network list --external -c Name -f value | head -n1"
+ echo "# Running 'kubectl --kubeconfig $MY_PROJFOLDER/envs/mos-kubeconfig.yaml -n openstack exec ${keystone_pod} -c keystone-client --stdin -- sh -c '${cmd}'"
+ vPUBNET=$(kubectl --kubeconfig $MY_PROJFOLDER/envs/mos-kubeconfig.yaml -n openstack exec ${keystone_pod} -c keystone-client --stdin -- sh -c "${cmd}")
+ echo "-> 'openstack network list --external -c Name -f value | head -n1': '${vPUBNET}'"
+ ewriteln "export TEMPEST_CUSTOM_PUBLIC_NET=${vPUBNET}"
+ fi
echo "# Extracting volume types"
cmd_all="openstack volume type list -f value -c Name"
@@ -170,9 +187,9 @@
echo "# Default volume type used: ${vVOLTYPE}"
ewriteln "export TEMPEST_CUSTOM_VOLUME_TYPE=${vVOLTYPE}"
# hardcoded values
- ewriteln "export TEMPEST_CUSTOM_FLAVOR=cvp.tiny"
- ewriteln "export TEMPEST_CUSTOM_IMAGE=cvp.cirros.51"
- ewriteln "export TEMPEST_CUSTOM_IMAGE_ALT=cvp.cirros.52"
+ ewriteln "# export TEMPEST_CUSTOM_FLAVOR=cvp.tiny"
+ ewriteln "# export TEMPEST_CUSTOM_IMAGE=cvp.cirros.51"
+ ewriteln "# export TEMPEST_CUSTOM_IMAGE_ALT=cvp.cirros.52"
#prepare tempest custom yaml
cp /opt/res-files/k8s/yamls/tempest_custom.yaml.clean $MY_PROJFOLDER/yamls/tempest_custom.yaml
ewriteln 'export TEMPEST_CUSTOM_PARAMETERS=$(cat $MY_PROJFOLDER/yamls/tempest_custom.yaml)'
diff --git a/k8s/workspace/update-openstack-resources.sh b/k8s/workspace/update-openstack-resources.sh
index ef477ee..4713e04 100644
--- a/k8s/workspace/update-openstack-resources.sh
+++ b/k8s/workspace/update-openstack-resources.sh
@@ -1,6 +1,8 @@
#!/bin/bash
+echo "Sourcing $MY_PROJFOLDER/env.sh"
+. $MY_PROJFOLDER/env.sh
if [ -z ${TEMPEST_CUSTOM_PUBLIC_NET+x} ]; then
- echo "# WARNING: Public network is empty"
+ 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."
fi
# mosrc
. $MY_PROJFOLDER/envs/mosrc
@@ -17,10 +19,10 @@
echo " "
kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest"
else
- echo "# Creating openstack resources"
+ echo "# Creating openstack resources"
echo " "
kubectl exec toolset --stdin -n qa-space -- bash -c "mkdir /artifacts/cmp-check"
- kubectl exec toolset --tty --stdin -n qa-space -- bash -c "cd /artifacts/cmp-check; bash /opt/cmp-check/prepare.sh -w \$(pwd)"
+ 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)"
fi
#
@@ -32,12 +34,12 @@
echo "# Getting network details"
netid=$(kubectl exec toolset --stdin -n qa-space -- openstack network show ${TEMPEST_CUSTOM_PUBLIC_NET} -c id -f value)
subnetid=$(kubectl exec toolset --stdin -n qa-space -- openstack subnet list -f value | grep ${netid} | cut -d' ' -f1)
-echo "# image_ref_name -> ${cirros51_name}"
-sed -i "s/image_ref_name/${cirros51_name}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
-echo "# image_ref_uuid -> ${cirros51_id}"
-sed -i "s/image_ref_uuid/${cirros51_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
-echo "# image_ref_alt_uuid -> ${cirros52_id}"
-sed -i "s/image_ref_alt_uuid/${cirros52_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
+#echo "# image_ref_name -> ${cirros51_name}"
+#sed -i "s/image_ref_name/${cirros51_name}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
+#echo "# image_ref_uuid -> ${cirros51_id}"
+#sed -i "s/image_ref_uuid/${cirros51_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
+#echo "# image_ref_alt_uuid -> ${cirros52_id}"
+#sed -i "s/image_ref_alt_uuid/${cirros52_id}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
echo "# s/public_subnet_uuid/ -> ${subnetid}"
sed -i "s/public_subnet_uuid/${subnetid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
echo "# s/public_net_uuid/ -> ${netid}"