aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndreas Geissler <andreas-geissler@telekom.de>2022-10-19 17:49:04 +0200
committerAndreas Geissler <andreas-geissler@telekom.de>2022-10-19 17:52:13 +0200
commitd273edeccd97122de1caec74243d702a652cacb9 (patch)
tree4414e752f4a6aebc6fa29ef79b36d9b5f5571858 /scripts
parented3c78887493baa5855ac5256683b68ab7b74073 (diff)
[GITLAB] Initial content for gitlab project xtesting-onap
Issue-ID: INT-2150 Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de> Change-Id: I6a429e2f661474fe54b13b6513eca64f13e99b50
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.netrc3
-rwxr-xr-xscripts/output_summary.sh161
-rwxr-xr-xscripts/output_summary_s3.sh162
-rwxr-xr-xscripts/push_results_to_lf.sh118
-rwxr-xr-xscripts/run_chaos_tests.sh116
-rwxr-xr-xscripts/run_stability_tests.sh99
-rwxr-xr-xscripts/run_tern.sh184
7 files changed, 843 insertions, 0 deletions
diff --git a/scripts/.netrc b/scripts/.netrc
new file mode 100644
index 0000000..64b5c65
--- /dev/null
+++ b/scripts/.netrc
@@ -0,0 +1,3 @@
+machine nexus.onap.org
+login onap-integration
+password LF_IT_NEXUS_PWD
diff --git a/scripts/output_summary.sh b/scripts/output_summary.sh
new file mode 100755
index 0000000..d67f2aa
--- /dev/null
+++ b/scripts/output_summary.sh
@@ -0,0 +1,161 @@
+#!/bin/bash
+
+echo '_____________________________ Results ______________________'
+echo ''
+echo '************************************************************'
+echo '************************************************************'
+echo '************ Infrastructure-healthcheck Results ************'
+echo '************************************************************'
+echo '************************************************************'
+if [ -f "./public/$1/infrastructure-healthcheck/k8s/kubernetes-status/onap-k8s.log" ]; then
+ echo '--------> onap-k8s'
+ grep '>>>' "./public/$1/infrastructure-healthcheck/k8s/kubernetes-status/onap-k8s.log" | tr ',' '\n' | sed 's/>>>/ */; s/\[\([^]]\)/[\'$'\n - \\1/; s/^[ ]\([^\* ]\)/ - \\1/'
+else
+ echo '--------> onap-k8s NOT executed'
+fi
+if [ -f "./public/$1/infrastructure-healthcheck/k8s/onap-helm/onap-helm.log" ]; then
+ echo '--------> onap-helm'
+ grep '>>>' "./public/$1/infrastructure-healthcheck/k8s/onap-helm/onap-helm.log" | tr ',' '\n' | sed 's/>>>/ */; s/\[\([^]]\)/[\'$'\n - \\1/; s/^[ ]\([^\* ]\)/ - \\1/'
+else
+ echo '--------> onap-helm NOT executed'
+fi
+echo ''
+echo '************************************************************'
+echo '************************************************************'
+echo '********************* Healthcheck Results ******************'
+echo '************************************************************'
+echo '************************************************************'
+if [ -f "./public/$1/xtesting-healthcheck/full/xtesting.log" ]; then
+ echo '--------> robot full healthcheck tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-healthcheck/full/xtesting.log"
+else
+ echo '--------> robot full healthcheck tests NOT executed'
+fi
+echo ''
+echo '************************************************************'
+echo '************************************************************'
+echo '********************* Basic tests Results ******************'
+echo '************************************************************'
+echo '************************************************************'
+if [ -f "./public/$1/xtesting-healthcheck/healthdist/xtesting.log" ]; then
+ echo '--------> healthdist (vFW onboarding and distribution)'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-healthcheck/healthdist/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> healthdist tests NOT executed'
+fi
+if [ -f "./public/$1/xtesting-healthcheck/postinstall/xtesting.log" ]; then
+ echo '--------> postinstall tests (dmaap and A&AI)'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-healthcheck/postinstall/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> postinstall tests NOT executed'
+fi
+if [ -f "./public/$1/xtesting-smoke-usecases-robot/cmpv2/xtesting.log" ]; then
+ echo '--------> CMPv2 tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-smoke-usecases-robot/cmpv2/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> CMPv2 tests NOT executed'
+fi
+if [ -f "./public/$1/xtesting-smoke-usecases-robot/dcaemod/xtesting.log" ]; then
+ echo '--------> DCAEMOD tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-smoke-usecases-robot/dcaemod/xtesting.log" | grep '|'
+else
+ echo '--------> DCAEMOD tests NOT executed'
+fi
+if [ -f "./public/$1/xtesting-smoke-usecases-robot/hv-ves/xtesting.log" ]; then
+ echo '--------> HV-VES tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-smoke-usecases-robot/hv-ves/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> HV-VES tests NOT executed'
+fi
+if [ -f "./public/$1/xtesting-smoke-usecases-robot/ves-collector/xtesting.log" ]; then
+ echo '--------> VES collector tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-smoke-usecases-robot/ves-collector/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> VES collector tests NOT executed'
+fi
+if [ -f "./public/$1/smoke-usecases/basic_onboard/xtesting.log" ]; then
+ echo "--------> Basic Onboard tests (SDC)"
+ NORMAL_RUN=$(grep -A2 RESULT "./public/$1/smoke-usecases/basic_onboard/xtesting.log" | grep basic_onboard | grep -v ERROR | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "./public/$1/smoke-usecases/basic_onboard/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "basic_onboard: $RESULT"
+ echo "basic_onboard hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+
+else
+ echo "--------> Basic onboard tests NOT executed"
+fi
+if [ -f "./public/$1/smoke-usecases/basic_cds/xtesting.log" ]; then
+ echo "--------> CDS tests"
+ NORMAL_RUN=$(grep -A2 RESULT "./public/$1/smoke-usecases/basic_cds/xtesting.log" | grep basic_cds | grep -v ERROR | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "./public/$1/smoke-usecases/basic_cds/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "basic_cds: $RESULT"
+ echo "basic_cds hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+else
+ echo "--------> CDS tests NOT executed"
+fi
+echo ''
+
+echo '************************************************************'
+echo '************************************************************'
+echo '******************** End to End usecases *******************'
+echo '************************************************************'
+echo '************************************************************'
+for test in pnf-registrate 5gbulkpm;do
+ if [ -f "./public/$1/xtesting-smoke-usecases-robot/$test/xtesting.log" ]; then
+ echo "--------> $test tests"
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "./public/$1/xtesting-smoke-usecases-robot/$test/xtesting.log" | grep '::' | grep '|'
+ else
+ echo "--------> $test tests NOT executed"
+ fi
+done
+
+for test in basic_vm basic_network basic_cnf basic_vm_macro basic_clamp pnf_macro cds_resource_resolution basic_cnf_macro;do
+ if [ -f "./public/$1/smoke-usecases/$test/xtesting.log" ]; then
+ echo "--------> $test tests"
+ NORMAL_RUN=$(grep -A2 RESULT "./public/$1/smoke-usecases/$test/xtesting.log" |grep $test | grep -v ERROR | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "./public/$1/smoke-usecases/$test/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "$test: $RESULT"
+ echo "$test hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+ else
+ echo "--------> $test tests NOT executed"
+ fi
+done
+echo ''
+
+echo '************************************************************'
+echo '************************************************************'
+echo '********************** Security tests **********************'
+echo '************************************************************'
+echo '************************************************************'
+for test in nonssl_endpoints jdpw_ports kube_hunter root_pods unlimitted_pods;do
+ if [ -f "./public/$1/security/$test/xtesting.log" ]; then
+ echo "--------> $test tests"
+ NORMAL_RUN=$(grep -A2 RESULT "./public/$1/security/$test/xtesting.log" |grep $test | grep -v -E -- 'DEBUG|INFO|ERROR' | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "./public/$1/security/$test/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "$test: $RESULT"
+ echo "$test hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+ else
+ echo "--------> $test tests NOT executed"
+ fi
+done
+echo ''
+echo '____________________________________________________________'
diff --git a/scripts/output_summary_s3.sh b/scripts/output_summary_s3.sh
new file mode 100755
index 0000000..411216c
--- /dev/null
+++ b/scripts/output_summary_s3.sh
@@ -0,0 +1,162 @@
+#!/bin/bash
+
+echo '_____________________________ Results ______________________'
+echo ''
+echo '************************************************************'
+echo '************************************************************'
+echo '************ Infrastructure-healthcheck Results ************'
+echo '************************************************************'
+echo '************************************************************'
+if [ -f "$1/k8s/k8s/kubernetes-status/onap-k8s.log" ]; then
+ echo '--------> onap-k8s'
+ grep '>>>' "$1/k8s/k8s/kubernetes-status/onap-k8s.log" | tr ',' '\n' | sed 's/>>>/ */; s/\[\([^]]\)/[\'$'\n - \\1/; s/^[ ]\([^\* ]\)/ - \\1/'
+else
+ echo '--------> onap-k8s NOT executed'
+fi
+if [ -f "$1/k8s/k8s/onap-helm/onap-helm.log" ]; then
+echo '--------> onap-helm'
+grep '>>>' "$1/k8s/k8s/onap-helm/onap-helm.log" | tr ',' '\n' | sed 's/>>>/ */; s/\[\([^]]\)/[\'$'\n - \\1/; s/^[ ]\([^\* ]\)/ - \\1/'
+else
+ echo '--------> onap-helm NOT executed'
+fi
+echo ''
+echo '************************************************************'
+echo '************************************************************'
+echo '********************* Healthcheck Results ******************'
+echo '************************************************************'
+echo '************************************************************'
+if [ -f "$1/full/xtesting.log" ]; then
+ echo '--------> robot full healthcheck tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/full/xtesting.log"
+else
+ echo '--------> robot full healthcheck tests NOT executed'
+fi
+echo ''
+echo '************************************************************'
+echo '************************************************************'
+echo '********************* Basic tests Results ******************'
+echo '************************************************************'
+echo '************************************************************'
+if [ -f "$1/healthdist/xtesting.log" ]; then
+ echo '--------> healthdist (vFW onboarding and distribution)'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/healthdist/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> healthdist tests NOT executed'
+fi
+if [ -f "$1/postinstall/xtesting.log" ]; then
+ echo '--------> postinstall tests (dmaap and A&AI)'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/postinstall/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> postinstall tests NOT executed'
+fi
+if [ -f "$1/cmpv2/xtesting.log" ]; then
+ echo '--------> CMPv2 tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/cmpv2/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> CMPv2 tests NOT executed'
+fi
+if [ -f "$1/dcaemod/xtesting.log" ]; then
+ echo '--------> DCAEMOD tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/dcaemod/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> DCAEMOD tests NOT executed'
+fi
+if [ -f "$1/hv-ves/xtesting.log" ]; then
+ echo '--------> HV-VES tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/hv-ves/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> HV-VES tests NOT executed'
+fi
+if [ -f "$1/ves-collector/xtesting.log" ]; then
+ echo '--------> VES collector tests'
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/ves-collector/xtesting.log" | grep '::' | grep '|'
+else
+ echo '--------> VES collector tests NOT executed'
+fi
+if [ -f "$1/basic_onboard/xtesting.log" ]; then
+ echo "--------> Basic Onboard tests (SDC)"
+ NORMAL_RUN=$(grep -A2 RESULT "$1/basic_onboard/xtesting.log" | grep basic_onboard | grep -v ERROR | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "$1/basic_onboard/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "basic_onboard: $RESULT"
+ echo "basic_onboard hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+
+else
+ echo "--------> Basic onboard tests NOT executed"
+fi
+if [ -f "$1/basic_cds/xtesting.log" ]; then
+ echo "--------> CDS tests"
+ NORMAL_RUN=$(grep -A2 RESULT "$1/basic_cds/xtesting.log" | grep basic_cds | grep -v ERROR | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "$1/basic_cds/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "basic_cds: $RESULT"
+ echo "basic_cds hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+
+else
+ echo "--------> CDS tests NOT executed"
+fi
+echo ''
+
+echo '************************************************************'
+echo '************************************************************'
+echo '******************** End to End usecases *******************'
+echo '************************************************************'
+echo '************************************************************'
+for test in pnf-registrate 5gbulkpm;do
+ if [ -f "$1/$test/xtesting.log" ]; then
+ echo "--------> $test tests"
+ sed -n '/xtesting.core.robotframework - INFO - $/,/Output/p' "$1/$test/xtesting.log" | grep '::' | grep '|'
+ else
+ echo "--------> $test tests NOT executed"
+ fi
+done
+
+for test in basic_vm basic_network basic_cnf basic_vm_macro basic_clamp pnf_macro cds_resource_resolution basic_cnf_macro;do
+ if [ -f "$1/$test/xtesting.log" ]; then
+ echo "--------> $test tests"
+ NORMAL_RUN=$(grep -A2 RESULT "$1/$test/xtesting.log" |grep $test | grep -v ERROR | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "$1/$test/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "$test: $RESULT"
+ echo "$test hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+ else
+ echo "--------> $test tests NOT executed"
+ fi
+done
+echo ''
+
+echo '************************************************************'
+echo '************************************************************'
+echo '********************** Security tests **********************'
+echo '************************************************************'
+echo '************************************************************'
+for test in nonssl_endpoints jdpw_ports kube_hunter root_pods unlimitted_pods;do
+ if [ -f "$1/$test/xtesting.log" ]; then
+ echo "--------> $test tests"
+ NORMAL_RUN=$(grep -A2 RESULT "$1/$test/xtesting.log" |grep $test | grep -v -E -- 'DEBUG|INFO|ERROR' | awk {'print $2 ": " $8 " (" $6 ")"'})
+ if [ -z "$NORMAL_RUN" ]
+ then
+ RESULT=$(tail -n 1 "$1/$test/xtesting.log" | cut -d'-' -f6 | cut -d':' -f 2)
+ echo "$test: $RESULT"
+ echo "$test hasn't finished well, check logs"
+ else
+ echo "$NORMAL_RUN"
+ fi
+ else
+ echo "--------> $test tests NOT executed"
+ fi
+done
+echo ''
+echo '____________________________________________________________'
diff --git a/scripts/push_results_to_lf.sh b/scripts/push_results_to_lf.sh
new file mode 100755
index 0000000..5a0cbe7
--- /dev/null
+++ b/scripts/push_results_to_lf.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+# backup results to LF server
+
+NEXUS_URL=https://nexus.onap.org
+SILO=onap-integration
+ARCHIVES_DIR=/tmp
+
+# We need minio client in order to retrieve files when on S3 mode
+if [ -z "${S3_ENDPOINT_URL}" ]
+then
+ echo "S3 vars are not set, not installing mc"
+else
+ wget https://dl.min.io/client/mc/release/linux-amd64/mc
+ chmod +x mc
+ ./mc alias set s3 "${S3_ENDPOINT_URL}" "${S3_ACCESS_KEY}" "${S3_SECRET_KEY}"
+fi
+
+# We need lftools to push results tyo LF
+pip install lftools
+
+# create .netrc
+# netrc contains credentials to push artifacts to LF
+# the password is defined as a gitlab-ci variable
+if [ ! -f ~/.netrc ]; then
+ # If .netrc does not exist create one from the template
+ cp scripts/.netrc ~
+else
+ # if one already exists, save this config in /tmp
+ # and replace it by the template
+ mv ~/.netrc /tmp
+ cp scripts/.netrc ~
+fi
+sed -i 's/LF_IT_NEXUS_PWD/'$LF_RESULTS_BACKUP'/g' ~/.netrc
+chmod 600 ~/.netrc
+
+# prepare the archives
+echo "Prepare the archive for $pod"
+if [ -z "$GERRIT_REVIEW" ]
+then
+ if [[ $1 == *"weekly"* ]]
+ then
+ FREQUENCY="weekly"
+ else
+ FREQUENCY="daily"
+ fi
+ if [ -z "${CI_PIPELINE_CREATED_AT}" ]
+ then
+ NEXUS_PATH="${SILO}/$FREQUENCY/$pod/$(date +'%Y-%m')/$(date +'%d_%H-%M')"
+ else
+ NEXUS_PATH="${SILO}/$FREQUENCY/$pod/$(date -d${CI_PIPELINE_CREATED_AT} +'%Y-%m')/$(date -d${CI_PIPELINE_CREATED_AT} +'%d_%H-%M')"
+ fi
+else
+ if [ -z "$EXPERIMENTAL" ]
+ then
+ NEXUS_PATH="${SILO}/gating/$GERRIT_REVIEW-$GERRIT_PATCHSET"
+ else
+ NEXUS_PATH="${SILO}/experimental-gating/$GERRIT_REVIEW-$GERRIT_PATCHSET"
+ fi
+fi
+mkdir -p $ARCHIVES_DIR/archives
+
+if [ -z "${CI_PIPELINE_ID}" ]
+then
+ CI_PIPELINE_ID="64"
+fi
+
+if [ -z "${S3_ENDPOINT_URL}" ]
+then
+ echo "*** non S3 mode, use legacy method ***"
+ cp -rf $1/* $ARCHIVES_DIR/archives
+else
+ echo "*** S3 mode ***"
+ if [ -z "$GERRIT_REVIEW" ]
+ then
+ echo "** non gating result"
+ if [ -z "${CI_PIPELINE_CREATED_AT}" ]
+ then
+ DATE=$(date "+%Y-%m-%d")
+ else
+ DATE=$(date -d${CI_PIPELINE_CREATED_AT} "+%Y-%m-%d")
+ fi
+ IDENTIFIER="${pod}/${DATE}-${CI_PIPELINE_ID}"
+ if [ -z "$FREQUENCY" ]
+ then
+ TEST_TYPE="daily"
+ else
+ TEST_TYPE="${FREQUENCY}"
+ fi
+ else
+ echo "** gating result"
+ TEST_TYPE="gating"
+ IDENTIFIER="${GERRIT_REVIEW}-${GERRIT_PATCHSET}-${CI_PIPELINE_ID}"
+ fi
+ if [ -z "$EXPERIMENTAL" ]
+ then
+ echo "* not an experimental test"
+ else
+ echo "* experimental test"
+ TEST_TYPE="${TEST_TYPE}-experimental"
+ fi
+
+ S3_PATH="s3/onap/${TEST_TYPE}/${IDENTIFIER}/"
+ cp -rf $1/index.html $ARCHIVES_DIR/archives/index.html
+ ./mc cp --recursive "${S3_PATH}" $ARCHIVES_DIR/archives
+ scripts/output_summary_s3.sh $ARCHIVES_DIR/archives
+fi
+
+# Push results to LF nexus
+echo " call lftools"
+lftools deploy archives $NEXUS_URL $NEXUS_PATH $ARCHIVES_DIR
+echo "Results uploaded to $NEXUS_URL/content/sites/logs/$NEXUS_PATH"
+
+# clean
+rm -Rf $ARCHIVES_TMP_DIR
+# restore old .netrc
+if [ -f ~/tmp/.netrc ]; then
+ mv ~/tmp/.netrc ~/.netrc
+fi
diff --git a/scripts/run_chaos_tests.sh b/scripts/run_chaos_tests.sh
new file mode 100755
index 0000000..f57b97e
--- /dev/null
+++ b/scripts/run_chaos_tests.sh
@@ -0,0 +1,116 @@
+#!/usr/bin/env bash
+#
+# Copyright Oranges (c) 2021 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+
+# This script will do the following:
+# - execute a list of chaos tests
+# - an aggregation of the results in an html page
+
+#set -euxo pipefail
+
+CHAOS_TESTS_LOCATION=${STABILITY_TESTS_LOCATION:-/tmp/resiliency}
+ARCHIVES_LOCATION=${ARCHIVES_LOCATION:-/tmp/resiliency/}
+CHAOS_DRAIN_SDC=$ARCHIVES_LOCATION/archives/chaos/chaos-drain
+
+prepare_chaos_tests() {
+ # current release has bug with image name parsing, need to install
+ # from source until release (end of March 2021)
+ local chaos_tests_location=$1
+ mkdir -p $CHAOS_DRAIN_SDC
+ cd $chaos_tests_location
+ python3 -m venv resiliency_tests_env
+ cd resiliency_tests_env
+ . bin/activate
+ pip install pip --upgrade
+ pip install git+https://gitlab.com/Orange-OpenSource/lfn/onap/integration/onaptests_chaos.git
+ cd $chaos_tests_location
+}
+
+launch_chaos_tests() {
+ local chaos_tests_location=$1
+ cd $chaos_tests_location
+
+ # the goal of this script is to run sequentially
+ # the selected resiliency tests
+
+ TEST_DIR=$(pwd)
+ NB_RETRY_MAX=10
+ TARGET_NODE="compute01-onap-master"
+
+ for test in node-cpu-hog node-memory-hog node-drain pod-delete-aai
+ do
+ echo "Setup $test RBAC"
+ rbac_file=$test"-rbac.yaml"
+ kubectl apply -f $TEST_DIR/$test/$rbac_file
+ echo "launch chaos for $test"
+ if [ $test = "node-drain" ]
+ then
+ kubectl cordon $TARGET_NODE
+ fi
+
+ chaos_file=$test"-chaos.yaml"
+ kubectl apply -f $TEST_DIR/$test/$chaos_file
+
+ # check the chaos is Completed
+ echo "Wait for chaos completion"
+ check_status=1
+ nb_retry=0
+ while [ $nb_retry -lt 10 ] && [ $check_status -gt 0 ]
+ do
+ kubectl get chaosengine -n onap $test | grep Completed
+ check_status=$?
+ let "nb_retry++"
+ sleep 30
+ done
+ echo "Chaos $test completed"
+ done
+
+ if [ $test = "node-drain" ]
+ then
+ kubectl uncordon $TARGET_NODE
+ fi
+
+ sleep 120
+
+ # get the results, wait for the result of the last test to be Completed
+ # we expect that the previous ones are completed
+ check_status=1
+ nb_retry=0
+ while [ $nb_retry -lt 10 ] && [ $check_status -gt 0 ]
+ do
+ kubectl describe chaosengine -n onap node-drain | grep Completed
+ check_status=$?
+ let "nb_retry++"
+ sleep 30
+ echo "Test still running...."
+ done
+
+ # we collect all the chaosresults in json files
+ for result in $(kubectl get chaosresult -n onap |awk {'print $1'} | grep -v NAME)
+ do
+ result_file=$result".json"
+ kubectl get chaosresult -n onap $result -o json > $result_file
+ done
+
+ # Cleanup chaos resources
+ kubectl delete chaosengine -n onap --all
+ kubectl delete chaosresult -n onap --all
+}
+
+generate_html_page() {
+ echo "Generate html page"
+ generate_chaos_reporting -r /tmp/resiliency/reporting_chaos.html
+}
+
+echo "Prepare chaos tests"
+prepare_chaos_tests $CHAOS_TESTS_LOCATION
+
+launch_chaos_tests $CHAOS_TESTS_LOCATION
+
+generate_html_page
diff --git a/scripts/run_stability_tests.sh b/scripts/run_stability_tests.sh
new file mode 100755
index 0000000..e69a56e
--- /dev/null
+++ b/scripts/run_stability_tests.sh
@@ -0,0 +1,99 @@
+#!/usr/bin/env bash
+#
+# Copyright Oranges (c) 2021 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+
+# This script will do the following:
+# 1. prepare the benchmark env
+# 2. clone onaptests_bench
+# 3. run 2 tests:
+# - 5 // onboarding during 24h (basic_onboard)
+# - 10 // instantiation using a_la_carte bpmn during 24h (basic_vm)
+# 4. push results via lftools taking ARCHIVES_LOCATION as argument.
+# Requires CI_PIPELINE_CREATED_AT, $POD, $LF_RESULTS_BACKUP vars to be set
+#
+# Dependencies:
+# - python3-venv
+# - libssl-dev
+# - onaptests_bench
+
+set -euxo pipefail
+
+STABILITY_TESTS_LOCATION=${STABILITY_TESTS_LOCATION:-"$HOME"}
+ARCHIVES_LOCATION=${ARCHIVES_LOCATION:-/tmp/stability/}
+RESULTS_STABILITY_SDC=$ARCHIVES_LOCATION/archives/stability/results_sdc_5_24h/
+RESULTS_STABILITY_INSTANTIATION=$ARCHIVES_LOCATION/archives/stability/results_instantiation_10_24h/
+
+prepare_stability_tests() {
+ # current release has bug with image name parsing, need to install
+ # from source until release (end of March 2021)
+ local stability_tests_location=$1
+ mkdir -p $RESULTS_STABILITY_SDC
+ mkdir -p $RESULTS_STABILITY_INSTANTIATION
+ echo $CI_PIPELINE_CREATED_AT
+
+ cd /tmp
+ echo "Create virtualenv to launch stability tests"
+ python3 -m venv stability_tests_env
+ cd stability_tests_env
+ . bin/activate
+ echo "Install onaptests_bench as a python module"
+ export CRYPTOGRAPHY_DONT_BUILD_RUST=1
+ pip install pip --upgrade
+ pip install --no-cache-dir git+https://gitlab.com/Orange-OpenSource/lfn/onap/integration/onaptests_bench.git
+}
+
+launch_stability_tests() {
+ local stability_tests_location=$1
+ cd /tmp/stability_tests_env
+ . bin/activate
+ # Tests are launched sequentially
+ echo "===========> Launch Instantiation stability test"
+ run_stability_tests -t basic_vm -s 10 -d 1440 -r $RESULTS_STABILITY_INSTANTIATION
+ echo "===========> Launch SDC stability test"
+ run_stability_tests -t basic_onboard -s 5 -d 1440 -r $RESULTS_STABILITY_SDC
+}
+
+push_results() {
+ local archives_location=$1
+ local nexus_url="https://nexus.onap.org"
+ local nexus_path="onap-integration/weekly/$POD/$(date -d${CI_PIPELINE_CREATED_AT} +'%Y-%m')/$(date -d${CI_PIPELINE_CREATED_AT} +'%d_%H-%M')"
+ sudo chown -Rf debian:debian $ARCHIVES_LOCATION
+ echo "===========> Send Result to LF Backend"
+ echo "nexus url:"$nexus_url
+ echo "nexus_path"$nexus_path
+ lftools deploy archives $nexus_url $nexus_path $archives_location
+}
+
+echo "Prepare stability tests"
+prepare_stability_tests $STABILITY_TESTS_LOCATION
+
+launch_stability_tests $STABILITY_TESTS_LOCATION
+
+echo "push results to LF backend.."
+push_results ${ARCHIVES_LOCATION}
+
+# Once the stability tests results have been pushed to LF, we can
+# - sync the results of the tests checking the versions
+# - start the resiliency tests
+
+# push the versions if results exist
+if [ -f /dockerdata-nfs/onap/integration/security/versions/versions_reporting.html ]; then
+ mkdir -p /tmp/versions/archives/security/versions/
+ cp /dockerdata-nfs/onap/integration/security/versions/versions_reporting.html /tmp/versions/archives/security/versions/versions.html
+ push_results /tmp/versions
+fi
+
+# execute the resiliency tests then push the results to LF backend
+cd /tmp/resiliency
+./run_chaos_tests.sh
+if [ -f /tmp/resiliency/reporting_chaos.html ]; then
+ mkdir -p /tmp/resiliency/archives/resiliency
+ cp /tmp/resiliency/reporting_chaos.html /tmp/resiliency/archives/resiliency/reporting_chaos.html
+ push_results /tmp/resiliency
+fi
diff --git a/scripts/run_tern.sh b/scripts/run_tern.sh
new file mode 100755
index 0000000..d6fb3ce
--- /dev/null
+++ b/scripts/run_tern.sh
@@ -0,0 +1,184 @@
+#!/usr/bin/env bash
+#
+# Copyright Samsung Electronics (c) 2021 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+
+# This script will do the following:
+# 1. install tern in $TERN_LOCATION/ternenv (defaults to $HOME)
+# 2. query kubectl for all images from $K8NAMESPACE
+# 3. run tern analysis on each image while generating $HTML_REPORT in
+# current directory & placing results in $OUT directory. Each report
+# and log will have the image name with '/' substituted to '_'.
+# 4. push results via lftools taking ARCHIVES_LOCATION as argument.
+# Requires CI_PIPELINE_CREATED_AT, $POD, $LF_RESULTS_BACKUP vars to be set
+#
+# Dependencies:
+# - fuse-overlayfs
+# - attr
+# - python3-venv
+# - jq
+# - lftools (python package)
+
+set -euxo pipefail
+
+TERN_LOCATION=${TERN_LOCATION:-"$HOME"}
+OUT=${OUT:-tern}
+HTML_REPORT=${HTML_REPORT:-index.html}
+K8NAMESPACE=${K8NAMESPACE:-onap}
+ARCHIVES_LOCATION=${ARCHIVES_LOCATION:-/tmp/tern}
+
+install_tern() {
+ # current release has bug with image name parsing, need to install
+ # from source until release (end of March 2021)
+ local tern_location=$1
+ local initial_dir=$(pwd)
+ cd $tern_location
+ python3 -m venv ternenv
+ cd ternenv
+ . bin/activate
+ git clone https://github.com/tern-tools/tern --branch main || true
+ cd tern
+ git pull origin main
+ git checkout 52fd8f3ee915c0c637d82dbeb0856219780688c7
+ python3 -m pip install wheel
+ python3 -m pip install .
+ cd $initial_dir
+ echo "===========> Tern installed"
+}
+
+init_tern() {
+ local tern_location=$1
+ local initial_dir=$(pwd)
+ cd $tern_location
+ cd ternenv
+ . bin/activate
+ cd $initial_dir
+}
+
+
+print_head() {
+ local html_report=$1
+
+ echo '<!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>ONAP Tern analysis</title>
+ </head>
+ <body>
+ <table>
+ <caption>Results</caption>
+ <thead>
+ <tr>
+ <th>Image</th>
+ <th>Version</th>
+ <th>Report</th>
+ <th>Log</th>
+ <th>Pkgs with GPLv3</th>
+ <th>Pkgs with undefined lic</th>
+ <th>Notes</th>
+ </tr>
+ </thead>
+ <tbody>' >> $html_report
+}
+
+print_tail() {
+ local html_report=$1
+
+ echo ' </tbody>
+ </table>
+ </body>
+ </html>' >> $html_report
+}
+
+print_image() {
+ local html_report=$1
+ local full_img_name=$2
+ local report=$3
+ local log=$4
+
+
+ local pkglicenses=""
+ local gplv3pkgs=""
+ local licnotfound=""
+ local notes=""
+
+ local img=${2%:*}
+ local ver=${2##*:}
+
+ if [[ -s "$report" ]]
+ then
+ pkglicenses=$(jq '.images | .[].image.layers | .[]?.packages | .[] | "\(.name) \(.pkg_licenses) \(.pkg_license)"' ${report}) || true
+ gplv3pkgs=$(echo "${pkglicenses}" |grep GPL-3 | awk '{ print substr($1,2); }' | tr '\n' ' ') || true
+ licnotfound=$(echo "${pkglicenses}" |grep -e ' \[\] \"' | awk '{ print substr($1,2); }' | tr '\n' ' ') || true
+ else
+ if [[ $(grep -m 1 -hEe "(Traceback|CRITICAL)" $log) ]];
+ then
+ notes='Report not generated, check logs for traceback/critical error'
+ fi
+ fi
+
+ echo " <tr>
+ <td>${img}</td>
+ <td>${ver}</td>
+ <td><a href="${report}">Report</a></td>
+ <td><a href="${log}">Log</a></td>
+ <td>${gplv3pkgs}</td>
+ <td>${licnotfound}</td>
+ <td>${notes}</td>
+ </tr>" >> $1
+}
+
+analyze() {
+ local img=$1
+ local report=$2
+ local log=$3
+ echo "$img analysis started"
+ tern report -f json -i ${img} 1> ${report} 2> ${log} || true
+}
+
+get_images() {
+ local namespace=$1
+ kubectl get pods --namespace $namespace \
+ -o jsonpath="{.items[*].spec.containers[*].image}" |\
+ tr -s '[[:space:]]' '\n' | sort | uniq -u
+}
+
+push_results() {
+ local archives_location=$1
+ local nexus_url="https://nexus.onap.org"
+ local nexus_path="onap-integration/weekly/$POD/$(date -d${CI_PIPELINE_CREATED_AT} +'%Y-%m')/$(date -d${CI_PIPELINE_CREATED_AT} +'%d_%H-%M')"
+ echo "===========> Send Result to LF Backend"
+ echo "nexus_url:"$nexus_url
+ echo "nexus_path"$nexus_path
+ cd $archives_location && lftools deploy archives $nexus_url $nexus_path $archives_location
+}
+
+images=( $(get_images $K8NAMESPACE) )
+
+mkdir -p $OUT
+rm -f $HTML_REPORT
+install_tern $TERN_LOCATION
+
+print_head ${HTML_REPORT}
+
+for (( i=0; i<${#images[@]}; i++ ))
+do
+
+ fname=${images[$i]//\//_}
+ report=${OUT}/${fname}".json"
+ log=${OUT}/${fname}".log"
+
+ analyze ${images[$i]} ${report} ${log}
+ print_image ${HTML_REPORT} ${images[$i]} ${report} ${log}
+done
+
+print_tail ${HTML_REPORT}
+echo "===========> Finished analysis of all images in "$K8NAMESPACE
+
+push_results ${ARCHIVES_LOCATION}