Offline procedure preparations, p1

  Related-PROD: PROD-36856

Change-Id: Iec9ca205112d1de457cdb438f28928c8dbb7bd6a
diff --git a/k8s/rally-files/openstack-mos-scn-i1.json b/k8s/rally-files/openstack-mos-scn-i1.json
index d67156c..74c2ed3 100644
--- a/k8s/rally-files/openstack-mos-scn-i1.json
+++ b/k8s/rally-files/openstack-mos-scn-i1.json
@@ -7,7 +7,7 @@
 {% set users = 1 %}
 {% set tenants = 1 %}
 {% set rbd_image = "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img" %}
-{% set heat_template = "/rally/rally-files/res-files/rally/default.yaml.template" %}
+{% set heat_template = "/rally/rally-files/default.yaml.template" %}
 {% set fixed_net = "id" %}
 
 {
diff --git a/k8s/workspace/init-workspace.sh b/k8s/workspace/init-workspace.sh
new file mode 100644
index 0000000..ad35877
--- /dev/null
+++ b/k8s/workspace/init-workspace.sh
@@ -0,0 +1,70 @@
+### initial folders
+function ewriteln() {
+	echo ${1} | tee -a $MY_PROJFOLDER/env.sh
+}
+
+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
+
+# 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/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'"
+fi
+echo " "
+
+### prepare needed variables
+echo "# Updating '$MY_PROJFOLDER/env.sh'"
+export KUBECONFIG=$MY_PROJFOLDER/envs/mcc-kubeconfig.yaml
+if [ ! -f $MY_PROJFOLDER/env.sh ]; then
+	touch $MY_PROJFOLDER/env.sh
+else
+	truncate -s 0 $MY_PROJFOLDER/env.sh
+	echo "$MY_PROJFOLDER/env.sh has been truncated"
+fi
+
+ewriteln "export MY_PROJFOLDER=/artifacts"
+# NS & CLUSTER
+cls=$(kubectl get cluster -A --no-headers | grep -v default)
+declare nn=()
+tifs=$IFS
+IFS=" "
+echo $cls | cut -d" " -f1-2 | while read -r -a nn;
+do
+    ewriteln "export MOS_NS=$(echo ${nn[0]})"
+    ewriteln "export MOS_CLUSTER=$(echo ${nn[1]})"
+done
+IFS=$tifs
+ewriteln "export MOS_SC=kubernetes-nvme"
+ewriteln "export OSH_DEPLOYMENT_NAME='avt-openstack'"
+ewriteln "export SI_BINARIES_DIR=$(which helm | rev | cut -d'/' -f2- | rev)"
+ewriteln "export HELM_BINARY_PATH=$(which helm)"
+ewriteln "export TEMPEST_CUSTOM_PUBLIC_NET=public"
+ewriteln "export TEMPEST_CUSTOM_IMAGE=cvp.cirros.51"
+ewriteln "export TEMPEST_CUSTOM_IMAGE_ALT=cvp.cirros.52"
+ewriteln 'export TEMPEST_CUSTOM_PARAMETERS=$(cat /artifacts/yamls/tempest_custom.yaml)'
+
+# extract MOS kubeconfig
+echo " "
+echo "Extracting mos-kubeconfig.yaml"
+if [[ ! -z ${MOS_CLUSTER+x} ]]; then
+	kubectl --kubeconfig $MY_PROJFOLDER/envs/mcc-kubeconfig.yaml -n ${MOS_NS} get secrets ${MOS_CLUSTER}-kubeconfig -o jsonpath='{.data.admin\.conf}'  | base64 -d | sed 's/:5443/:443/g' | tee $MY_PROJFOLDER/envs/mos-kubeconfig.yaml
+else
+	echo "MOS_CLUSTER variable empty/invalid: '$MOS_CLUSTER'"
+fi
+
+# generate additional files
+echo "Preparing additional files"
+# copy files
+cp -v /opt/res-files/k8s/workspace/* $MY_PROJFOLDER/envs/
+
+# end
+echo " "
+echo "# Done!"
diff --git a/k8s/workspace/mcc-checker.env b/k8s/workspace/mcc-checker.env
new file mode 100644
index 0000000..6f789b2
--- /dev/null
+++ b/k8s/workspace/mcc-checker.env
@@ -0,0 +1,16 @@
+# Main log file of the tests
+MCP_LOGFILE = 'client-cfg-check.log'
+# SSH is used when environment is not local to get salt password
+# in order set options and user for the ssh, 
+# please, use ~/.ssh/config
+# SSH hostname of salt/k8s master node
+MCP_SSH_KEY=/Users/savex/proj/avature-mcc/envs/node.key
+MCP_SSH_USER=mcc-user
+MCP_SSH_HOST=ip_address
+MCP_ENV_HOST=ip_address
+### K8s section
+# All vars start with KUBE
+KUBE_CONFIG_ROOT=/root
+KUBE_SCRIPTS_FOLDER=cfg-checker-scripts
+KUBE_NODE_USER=mcc-user
+KUBE_NODE_KEYPATH=/artifacts/envs/node.key
diff --git a/k8s/workspace/mccrc b/k8s/workspace/mccrc
new file mode 100644
index 0000000..45f408e
--- /dev/null
+++ b/k8s/workspace/mccrc
@@ -0,0 +1,2 @@
+#!/bin/bash
+export KUBECONFIG=$MY_PROJFOLDER/envs/mcc-kubeconfig.yaml
diff --git a/k8s/workspace/mos-checker.env b/k8s/workspace/mos-checker.env
new file mode 100644
index 0000000..0d16295
--- /dev/null
+++ b/k8s/workspace/mos-checker.env
@@ -0,0 +1,16 @@
+# Main log file of the tests
+MCP_LOGFILE = 'client-cfg-check.log'
+# SSH is used when environment is not local to get salt password
+# in order set options and user for the ssh, 
+# please, use ~/.ssh/config
+# SSH hostname of salt/k8s master node
+MCP_SSH_KEY=/artifacts/envs/node.key
+MCP_SSH_USER=mcc-user
+MCP_SSH_HOST=ip_address
+MCP_ENV_HOST=ip_address
+### K8s section
+# All vars start with KUBE
+KUBE_CONFIG_ROOT=/root
+KUBE_SCRIPTS_FOLDER=cfg-checker-scripts
+KUBE_NODE_USER=mcc-user
+KUBE_NODE_KEYPATH=/artifacts/envs/node.key
diff --git a/k8s/workspace/mosrc b/k8s/workspace/mosrc
new file mode 100644
index 0000000..80d8cf9
--- /dev/null
+++ b/k8s/workspace/mosrc
@@ -0,0 +1,2 @@
+#!/bin/bash
+export KUBECONFIG=$MY_PROJFOLDER/envs/mos-kubeconfig.yaml
diff --git a/k8s/workspace/target-mcc b/k8s/workspace/target-mcc
new file mode 100644
index 0000000..4c05923
--- /dev/null
+++ b/k8s/workspace/target-mcc
@@ -0,0 +1,4 @@
+#!/bin/bash
+export TARGET_CLUSTER=kaas-mgmt
+export TARGET_NAMESPACE=default
+
diff --git a/k8s/workspace/target-mos b/k8s/workspace/target-mos
new file mode 100644
index 0000000..fe5278e
--- /dev/null
+++ b/k8s/workspace/target-mos
@@ -0,0 +1,3 @@
+#!/bin/bash
+export TARGET_NAMESPACE=${MOS_NS}
+export TARGET_CLUSTER=${MOS_CLUSTER}