summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarekpl <marek.pondel@nokia.com>2019-08-02 18:11:42 +0200
committerMarek Pondel <marek.pondel@nokia.com>2019-08-12 14:07:30 +0000
commit8c7fd19f5cf6a0874bb95a6a230c2f045b7fa3ff (patch)
treedf2d023f9740f9eb91f628463c3d6df88a45da13
parentb871d7ffd39eef96df17810eadf5c79ff1656526 (diff)
hv-ves ete script added
hv-ves ete script added Issue-ID: DCAEGEN2-1226 Signed-off-by: marekpl <marek.pondel@nokia.com> Change-Id: I85f83152b305100d0f201dc8315865fdc598b1eb (cherry picked from commit 1b6baa471cd767eca4da6b44c645110c80987e4a)
-rwxr-xr-xdemo-k8s.sh25
-rwxr-xr-xete-k8s.sh34
-rwxr-xr-xeteHelm-k8s.sh12
-rw-r--r--etescripts/README1
-rw-r--r--scripts/demoscript/README1
-rw-r--r--scripts/etescript/README1
-rwxr-xr-xscripts/etescript/hvves-etescript.sh77
-rw-r--r--scripts/helmscript/README1
8 files changed, 131 insertions, 21 deletions
diff --git a/demo-k8s.sh b/demo-k8s.sh
index 3671d6c..14a44b1 100755
--- a/demo-k8s.sh
+++ b/demo-k8s.sh
@@ -18,7 +18,7 @@
#
function usage
{
- echo "Usage: demo-k8s.sh <namespace> <command> [<parameters>]"
+ echo "Usage: demo-k8s.sh <namespace> <command> [<parameters>] [execscript]"
echo " "
echo " demo-k8s.sh <namespace> init"
echo " - Execute both init_customer + distribute"
@@ -52,11 +52,21 @@ function usage
echo " - Run heatbridge against the stack for the given service instance and service"
echo " "
echo " demo-k8s.sh <namespace> vfwclosedloop <pgn-ip-address>"
- echo " - vFWCL: Sets the packet generator to high and low rates, and checks whether the policy "
- echo " kicks in to modulate the rates back to medium"
+ echo " - vFWCL: Sets the packet generator to high and low rates, and checks whether the policy "
+ echo " kicks in to modulate the rates back to medium"
+ echo " "
+ echo " demo-k8s.sh <namespace> <command> [<parameters>] execscript
+ echo " - Optional parameter to execute user custom scripts located in scripts/demoscript directory"
echo " "
}
+# Check if execscript flag is used and drop it from input arguments
+
+if [[ "${!#}" == "execscript" ]]; then
+ set -- "${@:1:$#-1}"
+ execscript=true
+fi
+
# Set the defaults
echo "Number of parameters:"
@@ -212,8 +222,17 @@ set -x
POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
+DIR=$(dirname "$0")
+SCRIPTDIR=scripts/demoscript
+
ETEHOME=/var/opt/ONAP
+if [ $execscript ]; then
+ for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
+ [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
+ done
+fi
+
export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l")
OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_demo_$key
DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
diff --git a/ete-k8s.sh b/ete-k8s.sh
index 9e17c5d..c048170 100755
--- a/ete-k8s.sh
+++ b/ete-k8s.sh
@@ -19,7 +19,7 @@
# Please clean up logs when you are done...
#
if [ "$1" == "" ] || [ "$2" == "" ]; then
- echo "Usage: ete-k8s.sh [namespace] [tag] [loadScript]"
+ echo "Usage: ete-k8s.sh [namespace] [tag] [execscript]"
echo ""
echo " List of test case tags (filename for intent: tag)"
echo ""
@@ -36,23 +36,25 @@ if [ "$1" == "" ] || [ "$2" == "" ]; then
echo " health-so, health-uui, health-vfc, health-vid, health-vnfsdk, healthdist, healthlogin, healthmr,"
echo " healthportalapp, multicloud, oom"
echo ""
- echo " hvves.robot: HVVES, ete"
+ echo " hvves.robot: HVVES, ete"
echo ""
- echo " model-distribution-vcpe.robot: distributevCPEResCust"
+ echo " model-distribution-vcpe.robot: distributevCPEResCust"
echo ""
- echo " model-distribution.robot: distribute, distributeVFWDT, distributeVLB"
+ echo " model-distribution.robot: distribute, distributeVFWDT, distributeVLB"
echo ""
- echo " oof-*.robot: cmso, has, homing"
+ echo " oof-*.robot: cmso, has, homing"
echo ""
- echo " pnf-registration.robot: ete, pnf_registrate"
+ echo " pnf-registration.robot: ete, pnf_registrate"
echo ""
- echo " post-install-tests.robot dmaapacl, postinstall"
+ echo " post-install-tests.robot dmaapacl, postinstall"
echo ""
- echo " update_onap_page.robot: UpdateWebPage"
+ echo " update_onap_page.robot: UpdateWebPage"
echo ""
- echo " vnf-orchestration-direct-so.robot: instantiateVFWdirectso"
+ echo " vnf-orchestration-direct-so.robot: instantiateVFWdirectso"
echo ""
- echo " vnf-orchestration.robot: instantiate, instantiateNoDelete, stability72hr"
+ echo " vnf-orchestration.robot: instantiate, instantiateNoDelete, stability72hr"
+ echo ""
+ echo " [execscript] - optional parameter to execute user custom scripts located in scripts/etescript directory"
exit
fi
@@ -65,16 +67,16 @@ POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
TAGS="-i $2"
DIR=$(dirname "$0")
-ETESCRIPTDIR=etescripts
-ETESCRIPTEXEC=${3:-}
+SCRIPTDIR=scripts/etescript
+
+ETEHOME=/var/opt/ONAP
-if [[ "$2" == "ete" ]] && [[ "$ETESCRIPTEXEC" == "loadScript" ]]; then
- for script in $(ls -1 "$DIR/$ETESCRIPTDIR"); do
- [ -f "$DIR/$ETESCRIPTDIR/$script" ] && [ -x "$DIR/$ETESCRIPTDIR/$script" ] && "$DIR/$ETESCRIPTDIR/$script"
+if [[ "${!#}" == "execscript" ]]; then
+ for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
+ [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
done
fi
-ETEHOME=/var/opt/ONAP
export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l")
OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_ete_$2
DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
diff --git a/eteHelm-k8s.sh b/eteHelm-k8s.sh
index 0895208..9f8cbb2 100755
--- a/eteHelm-k8s.sh
+++ b/eteHelm-k8s.sh
@@ -19,8 +19,9 @@
# Please clean up logs when you are done...
#
if [ "$1" == "" ] ; then
- echo "Usage: eteHelm-k8s.sh [namespace]"
+ echo "Usage: eteHelm-k8s.sh [namespace] [execscript]"
echo " list projects via helm list and runs health-check with those tags except dev and dev-consul"
+ echo " [execscript] - optional parameter to execute user custom scripts located in scripts/helmscript directory"
exit
fi
@@ -38,8 +39,17 @@ do
TAGS="$TAGS -i $project"
done
+DIR=$(dirname "$0")
+SCRIPTDIR=scripts/helmscript
ETEHOME=/var/opt/ONAP
+
+if [[ "${!#}" == "execscript" ]]; then
+ for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
+ [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
+ done
+fi
+
export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l")
OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_ete_helmlist
DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
diff --git a/etescripts/README b/etescripts/README
deleted file mode 100644
index d620838..0000000
--- a/etescripts/README
+++ /dev/null
@@ -1 +0,0 @@
-Directory contains scripts that will be run before 'ete' robot testcases execution.
diff --git a/scripts/demoscript/README b/scripts/demoscript/README
new file mode 100644
index 0000000..aad63f4
--- /dev/null
+++ b/scripts/demoscript/README
@@ -0,0 +1 @@
+Directory contains scripts that will be run before 'demo' tests.
diff --git a/scripts/etescript/README b/scripts/etescript/README
new file mode 100644
index 0000000..380787e
--- /dev/null
+++ b/scripts/etescript/README
@@ -0,0 +1 @@
+Directory contains scripts that will be run before 'ete' tests.
diff --git a/scripts/etescript/hvves-etescript.sh b/scripts/etescript/hvves-etescript.sh
new file mode 100755
index 0000000..5d22c4b
--- /dev/null
+++ b/scripts/etescript/hvves-etescript.sh
@@ -0,0 +1,77 @@
+# Copyright © 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#!/bin/bash
+
+#
+# Generate HV-VES SSL related certs.
+# Copy the stuff to HV-VES and Robot pods.
+#
+
+
+HVVESPOD=$(kubectl -n $NAMESPACE get pods --no-headers=true -o custom-columns=:metadata.name | grep hv-ves)
+
+
+generate_ca_key_cert () {
+ openssl genrsa -out $1/ca.key 2048
+ openssl req -new -x509 -days 36500 -key $1/ca.key -out $1/ca.pem -subj /CN=dcae-hv-ves-ca.onap
+}
+
+generate_server_key_csr () {
+ openssl genrsa -out $1/server.key 2048
+ openssl req -new -key $1/server.key -out $1/server.csr -subj /CN=dcae-hv-ves-collector.onap
+}
+
+generate_client_key_csr () {
+ openssl genrsa -out $1/client.key 2048
+ openssl req -new -key $1/client.key -out $1/client.csr -subj /CN=dcae-hv-ves-client.onap
+}
+
+sign_server_and_client_cert () {
+ openssl x509 -req -days 36500 -in $1/server.csr -CA $1/ca.pem -CAkey $1/ca.key -out $1/server.pem -set_serial 00
+ openssl x509 -req -days 36500 -in $1/client.csr -CA $1/ca.pem -CAkey $1/ca.key -out $1/client.pem -set_serial 00
+}
+
+create_pkcs12_ca_and_server () {
+ openssl pkcs12 -export -out $1/ca.p12 -inkey $1/ca.key -in $1/ca.pem -passout pass:
+ openssl pkcs12 -export -out $1/server.p12 -inkey $1/server.key -in $1/server.pem -passout pass:
+}
+
+copy_server_certs_to_hvves () {
+ for f in {ca.p12,server.p12}
+ do
+ kubectl cp $1/$f $2/$3:$4
+ done
+}
+
+copy_client_certs_to_robot () {
+ for f in {ca.pem,client.key,client.pem}
+ do
+ kubectl cp $1/$f $2/$3:$4
+ done
+}
+
+cleanup () {
+ rm -f $1/{ca,server,client}.???
+}
+
+
+generate_ca_key_cert "$DIR/$SCRIPTDIR"
+generate_server_key_csr "$DIR/$SCRIPTDIR"
+generate_client_key_csr "$DIR/$SCRIPTDIR"
+sign_server_and_client_cert "$DIR/$SCRIPTDIR"
+create_pkcs12_ca_and_server "$DIR/$SCRIPTDIR"
+copy_server_certs_to_hvves "$DIR/$SCRIPTDIR" "$NAMESPACE" "$HVVESPOD" "/tmp"
+copy_client_certs_to_robot "$DIR/$SCRIPTDIR" "$NAMESPACE" "$POD" "/tmp"
+cleanup "$DIR/$SCRIPTDIR"
diff --git a/scripts/helmscript/README b/scripts/helmscript/README
new file mode 100644
index 0000000..7666bf5
--- /dev/null
+++ b/scripts/helmscript/README
@@ -0,0 +1 @@
+Directory contains scripts that will be run before 'eteHelm' tests.