Offline procedure preparations, p3
Related-PROD: PROD-36856
Change-Id: Id27983047f5a71cc459df4a50ac9429f999e47cf
diff --git a/k8s/workspace/create-rally-deployments.sh b/k8s/workspace/create-rally-deployments.sh
index 942c81f..71a4041 100644
--- a/k8s/workspace/create-rally-deployments.sh
+++ b/k8s/workspace/create-rally-deployments.sh
@@ -7,6 +7,10 @@
exit 1
fi
+# Updating filder and file permissions
+kubectl exec -n qa-space --stdin rally -- sudo chown rally /artifacts
+kubectl exec -n qa-space --stdin rally -- sudo chown rally /rally/rally-files/*
+
###
if [ ! -z $(kubectl exec -n qa-space --stdin rally -- rally env list | grep openstack | cut -d' ' -f2) ]; then
echo "# Openstack env already created"
@@ -22,7 +26,6 @@
kubectl exec -n qa-space --stdin rally -- rally env list
else
echo "# Creating kubernetes env"
- kubectl exec -n qa-space --stdin rally -- sudo chown rally /artifacts
kubectl cp $MY_PROJFOLDER/envs/mos-kubeconfig.yaml qa-space/rally:/artifacts/mos-kubeconfig.yaml
kubectl exec -n qa-space --stdin rally -- bash -c "bash /rally/rally-files/init-rally-kube.sh"
fi
diff --git a/k8s/workspace/init-workspace.sh b/k8s/workspace/init-workspace.sh
index 6b889c2..0e546aa 100644
--- a/k8s/workspace/init-workspace.sh
+++ b/k8s/workspace/init-workspace.sh
@@ -11,17 +11,21 @@
export MY_PROJFOLDER=/artifacts
echo "# Using folder '$MY_PROJFOLDER'"
cd $MY_PROJFOLDER
-[ -f envs ] && mkdir envs
-[ -f yamls ] && mkdir yamls
-[ -f reports ] && mkdir reports
-[ -f tmp ] && mkdir tmp
+[ ! -d envs ] && mkdir envs
+[ ! -d yamls ] && mkdir yamls
+[ ! -d reports ] && mkdir reports
+[ ! -d tmp ] && mkdir tmp
# move mcc konfig to default place
if [ -f $MY_PROJFOLDER/mcc-kubeconfig.yaml ]; then
mv $MY_PROJFOLDER/mcc-kubeconfig.yaml $MY_PROJFOLDER/envs/mcc-kubeconfig.yaml
fi
+if [ -f $MY_PROJFOLDER/node.key ]; then
+ mv $MY_PROJFOLDER/node.key $MY_PROJFOLDER/envs/node.key
+fi
if [ ! -f $MY_PROJFOLDER/envs/mcc-kubeconfig.yaml ]; then
echo "ERROR: MCC kubeconfig not found either at '$MY_PROJFOLDER/mcc-kubeconfig.yaml' or '$MY_PROJFOLDER/envs/mcc-kubeconfig.yaml'"
+ exit 1
fi
echo " "
@@ -70,6 +74,12 @@
cp -v /opt/res-files/k8s/workspace/* $MY_PROJFOLDER/envs/
[ ! -d $MY_PROJFOLDER/scripts ] && mkdir $MY_PROJFOLDER/scripts
mv -v $MY_PROJFOLDER/envs/*.sh $MY_PROJFOLDER/scripts/
+
+cp -v /opt/res-files/k8s/yamls/qa-rally.yaml $MY_PROJFOLDER/yamls
+cp -v /opt/res-files/k8s/yamls/qa-res.yaml $MY_PROJFOLDER/yamls
+cp -v /opt/res-files/k8s/yamls/qa-toolset-bare.yaml $MY_PROJFOLDER/yamls
+cp -v /opt/res-files/k8s/yamls/qa-toolset.yaml $MY_PROJFOLDER/yamls
+
# remove duplicate init
rm -v $MY_PROJFOLDER/scripts/init-workspace.sh
# update IP Addresses
diff --git a/k8s/workspace/run-perf-k8s.sh b/k8s/workspace/run-k8s-perf.sh
similarity index 100%
rename from k8s/workspace/run-perf-k8s.sh
rename to k8s/workspace/run-k8s-perf.sh
diff --git a/k8s/workspace/run-openstack-func-full.sh b/k8s/workspace/run-openstack-func-full.sh
new file mode 100644
index 0000000..a11dbe0
--- /dev/null
+++ b/k8s/workspace/run-openstack-func-full.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+tenv=mos
+. /opt/si-tests/.sivenv/bin/activate
+cd $MY_PROJFOLDER/tmp
+. $MY_PROJFOLDER/env.sh
+. $MY_PROJFOLDER/envs/${tenv}rc
+# Just in case
+unset TARGET_CLUSTER
+unset TARGET_NAMESPACE
+
+#
+echo "# Creating schema"
+[ -f "/artifacts/tmp/artifacts/test_scheme.yaml" ] && rm -v $MY_PROJFOLDER/tmp/artifacts/test_scheme.yaml
+cat <<'EOF' >artifacts/test_scheme.yaml
+---
+smoke: false
+concurrency: 8
+blacklist-file: /etc/tempest/test-blacklist
+enabled: true
+fail_on_test: true
+type: tempest
+# regex: test
+EOF
+cat artifacts/test_scheme.yaml
+echo " "
+env | grep TEMPEST_
+echo " "
+#
+echo "# Checking auto-allocation"
+cmd="openstack network auto allocated topology create --check-resources"
+kubectl -n qa-space exec toolset --stdin -- $cmd
+if [ $? -ne 0 ]; then
+ cmd="openstack network set --default --external ${TEMPEST_CUSTOM_PUBLIC_NET}"
+ echo "# Trying to set network: '${cmd}'"
+ kubectl -n qa-space exec toolset --stdin -- $cmd
+ echo "# Checking again"
+ cmd="openstack network auto allocated topology create --check-resources"
+ kubectl -n qa-space exec toolset --stdin -- $cmd
+ [ $? -ne 0 ] && printf "\n\n# WARNING: Check functional tests pod for errors on test init\n\n"
+fi
+
+# run tests
+pytest -vv /opt/si-tests/si_tests/tests/lcm/test_run_tempest.py
+deactivate
+
+# report
+if [ -d $MY_PROJFOLDER/reports/${tenv}-func ]; then
+ echo "# Generating repors"
+ yes | rm $MY_PROJFOLDER/reports/${tenv}-func/*
+else
+ mkdir $MY_PROJFOLDER/reports/${tenv}-func
+fi
+cp ./artifacts/*.xml $MY_PROJFOLDER/reports/${tenv}-func/
+cd $MY_PROJFOLDER/reports/
+tparser -f r_xml -d -r $MY_CLIENTSHORTNAME-${tenv}-openstack-func-full-latest.html $MY_PROJFOLDER/reports/${tenv}-func/
+cd $MY_PROJFOLDER
diff --git a/k8s/workspace/run-openstack-func-smoke.sh b/k8s/workspace/run-openstack-func-smoke.sh
index 3d044e5..340a771 100644
--- a/k8s/workspace/run-openstack-func-smoke.sh
+++ b/k8s/workspace/run-openstack-func-smoke.sh
@@ -23,6 +23,8 @@
EOF
cat artifacts/test_scheme.yaml
echo " "
+env | grep TEMPEST_
+echo " "
#
echo "# Checking auto-allocation"
cmd="openstack network auto allocated topology create --check-resources"
@@ -38,7 +40,7 @@
fi
# run tests
-pytest -v /opt/si-tests/si_tests/tests/lcm/test_run_tempest.py
+pytest -vv /opt/si-tests/si_tests/tests/lcm/test_run_tempest.py
deactivate
# report
diff --git a/k8s/workspace/run-openstack-perf.sh b/k8s/workspace/run-openstack-perf.sh
new file mode 100644
index 0000000..c66b5a0
--- /dev/null
+++ b/k8s/workspace/run-openstack-perf.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+function kexec() {
+ kubectl exec -n qa-space --tty --stdin rally -- bash -c "${1}"
+}
+
+# consts
+concurrency=10
+run_times=200
+
+tenv=mos
+. /opt/si-tests/.sivenv/bin/activate
+cd $MY_PROJFOLDER/tmp
+. $MY_PROJFOLDER/env.sh
+. $MY_PROJFOLDER/envs/${tenv}rc
+# Just in case
+unset TARGET_CLUSTER
+unset TARGET_NAMESPACE
+dryrun=0
+#
+if [ ! -z ${1+x} ]; then
+ echo "# Using Dry-run mode"
+ dryrun=1
+fi
+
+##
+echo "### Checking rally environments"
+status=$(kubectl -n qa-space get pod | grep rally | tr -s " " | cut -d' ' -f3)
+if [ ${status} != "Running" ]; then
+ echo "# 'rally' container is not Running"
+ echo "# Consider creating resources and/or creating environments"
+ exit 1
+fi
+
+###
+uuid=$(kubectl exec -n qa-space --stdin rally -- rally env list | grep openstack | cut -d' ' -f2)
+if [ -z ${uuid} ]; then
+ echo "# Openstack env not found. Please, run 'create-rally-deployments.sh'"
+ kubectl exec -n qa-space --stdin rally -- rally env list
+else
+ echo "# Running Openstack performance tests"
+ if [ ${dryrun} == 1 ]; then
+ scenario=/rally/rally-files/openstack-mos-scn-i1.json
+ else
+ scenario=/rally/rally-files/openstack-mos-scn.json.clean
+ fi
+ task_scn=/artifacts/openstack-scenario.json
+ # prepare scenario
+ kexec "cp -v ${scenario} ${task_scn}"
+ declare $(kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest")
+ echo "# Updating network UUID to ${fixed_net_left_id}"
+ kexec "sed -i \"s/fixed-net-id/${fixed_net_left_id}/g\" ${task_scn}"
+ echo "# Updating concurrency to ${concurrency}"
+ kexec "sed -i \"s/concurrent-threads/${concurrency}/g\" ${task_scn}"
+ echo "# Updating running times to ${run_times}"
+ kexec "sed -i \"s/run-times-number/${run_times}/g\" ${task_scn}"
+ # run
+ kexec "rally env use ${uuid}; rally task start ${task_scn}"
+ # generate report
+ echo "# Generating report"
+ fname=$MY_CLIENTSHORTNAME-mos-openstack-perf-latest.html
+ kubectl exec -n qa-space --stdin rally -- rally task report $(kubectl exec -n qa-space --stdin rally -- rally task list | grep openstack | cut -d' ' -f2 | tail -1) --html-static --out ${fname}
+ kubectl cp qa-space/rally:/rally/${fname} $MY_PROJFOLDER/reports/${fname}
+fi
diff --git a/k8s/workspace/run-openstack-spt.sh b/k8s/workspace/run-openstack-spt.sh
new file mode 100644
index 0000000..156fd1d
--- /dev/null
+++ b/k8s/workspace/run-openstack-spt.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+tenv=mos
+. $MY_PROJFOLDER/envs/${tenv}rc
+##
+echo "### Checking openstack resources"
+status=$(kubectl -n qa-space get pod | grep toolset | tr -s " " | cut -d' ' -f3)
+if [ ${status} != "Running" ]; then
+ echo "# 'toolset' container is not Running"
+ exit 1
+fi
+admin_uuid=$(kubectl exec toolset --stdin -n qa-space -- bash -c "openstack user show cvp.admin -c id -f value")
+if [ ! -z ${TEMPEST_CUSTOM_PUBLIC_NET+x} ]; then
+ echo "# Copying global_config.yaml"
+ kubectl cp $MY_PROJFOLDER/yamls/global_config.yaml qa-space/toolset:/opt/mos-spt/global_config.yaml
+ echo " "
+ echo "# Running spt checks"
+ echo " "
+ kubectl exec toolset --stdin --tty -n qa-space -- bash -c "cd /opt/mos-spt; . .venv/bin/activate; pytest -rs -o log_cli=true --tb=short tests/test_vm2vm.py"
+else
+ echo "# Public network not set: TEMPEST_CUSTOM_PUBLIC_NET=${TEMPEST_CUSTOM_PUBLIC_NET}"
+ exit 1
+fi
diff --git a/k8s/workspace/update-openstack-resources.sh b/k8s/workspace/update-openstack-resources.sh
index 9c9b36c..f566676 100644
--- a/k8s/workspace/update-openstack-resources.sh
+++ b/k8s/workspace/update-openstack-resources.sh
@@ -20,7 +20,7 @@
echo "# Creating openstack resources"
echo " "
kubectl exec toolset --stdin -n qa-space -- bash -c "mkdir /artifacts/cmp-check"
- kubectl exec toolset --stdin -n qa-space -- bash -c "cd /artifacts/cmp-check; bash /opt/cmp-check/prepare.sh"
+ kubectl exec toolset --tty --stdin -n qa-space -- bash -c "cd /artifacts/cmp-check; bash /opt/cmp-check/prepare.sh -w \$(pwd)"
fi
#
@@ -41,6 +41,13 @@
sed -i "s/public_net_uuid/${netid}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
echo "# s/public_net_name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}"
sed -i "s/public_net_name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/tempest_custom.yaml
+echo " "
+echo "# Updating SPT global_config.yaml"
+cp -v /opt/res-files/k8s/yamls/spt_global_config.yaml.clean $MY_PROJFOLDER/yamls/global_config.yaml
+echo "# s/public-network-name/ -> ${TEMPEST_CUSTOM_PUBLIC_NET}"
+sed -i "s/public-network-name/${TEMPEST_CUSTOM_PUBLIC_NET}/g" $MY_PROJFOLDER/yamls/global_config.yaml
+echo "# s/mtu-value/ -> default"
+sed -i "s/mtu-value/default/g" $MY_PROJFOLDER/yamls/global_config.yaml
#
echo "# Done!"