Guillaume Lambert | 85b1492 | 2021-03-12 13:53:18 +0100 | [diff] [blame] | 1 | #!/bin/sh |
Guillaume Lambert | 824f996 | 2021-03-09 16:56:08 +0100 | [diff] [blame] | 2 | |
Sylvain Desbureaux | 16bdf24 | 2020-12-07 10:28:24 +0100 | [diff] [blame] | 3 | # Copyright © 2018 Amdocs, Bell Canada |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
Sylvain Desbureaux | 16bdf24 | 2020-12-07 10:28:24 +0100 | [diff] [blame] | 17 | # |
| 18 | # Run the testsuite for the passed tag. Valid tags are listed in usage help |
| 19 | # Please clean up logs when you are done... |
| 20 | # |
Guillaume Lambert | 5f4af05 | 2021-03-09 21:52:32 +0100 | [diff] [blame] | 21 | if [ "$1" = "" ] || [ "$2" = "" ]; then |
Sylvain Desbureaux | 16bdf24 | 2020-12-07 10:28:24 +0100 | [diff] [blame] | 22 | echo "Usage: ete-k8s.sh [namespace] [tag] [execscript]" |
| 23 | echo "" |
| 24 | echo " List of test case tags (filename for intent: tag)" |
| 25 | echo "" |
| 26 | echo " cds.robot: cds" |
| 27 | echo "" |
| 28 | echo " clamp.robot: clamp" |
| 29 | echo "" |
| 30 | echo " demo.robot: InitDemo, InitCustomer, APPCCDTPreloadDemo, APPCMountPointDemo, DistributeDemoVFWDT, DistributeVFWNG," |
| 31 | echo " InitDistribution, PreloadDemo, deleteVNF, instantiateDemoVFWCL, instantiateVFW, " |
| 32 | echo " instantiateVFWCL, instantiateVFWDT, instantiateVFWCLDN" |
| 33 | echo "" |
| 34 | echo " health-check.robot: health, core, small, medium, 3rdparty, api, datarouter, externalapi, health-aaf, health-aai, health-appc," |
| 35 | echo " health-clamp, health-cli, health-dcae, health-dmaap, health-log, health-modeling, health-msb," |
| 36 | echo " health-multicloud, health-oof, health-policy, health-pomba, health-portal, health-sdc, health-sdnc," |
| 37 | echo " health-so, health-uui, health-vfc, health-vid, health-vnfsdk, healthdist, healthlogin, healthmr," |
| 38 | echo " healthportalapp, multicloud, oom" |
| 39 | echo "" |
| 40 | echo " hvves.robot: HVVES, ete" |
| 41 | echo "" |
| 42 | echo " model-distribution-vcpe.robot: distributevCPEResCust" |
| 43 | echo "" |
| 44 | echo " model-distribution.robot: distribute, distributeVFWDT, distributeVLB" |
| 45 | echo "" |
| 46 | echo " oof-*.robot: cmso, has, homing" |
| 47 | echo "" |
| 48 | echo " pnf-registration.robot: ete, pnf_registrate" |
| 49 | echo "" |
| 50 | echo " post-install-tests.robot: dmaapacl, postinstall" |
| 51 | echo "" |
| 52 | echo " sdc-dcae-d.robot: sdc-dcae-d" |
| 53 | echo "" |
| 54 | echo " security.robot: security" |
| 55 | echo "" |
| 56 | echo " update_onap_page.robot: UpdateWebPage" |
| 57 | echo "" |
| 58 | echo " vnf-orchestration-direct-so.robot: instantiateVFWdirectso" |
| 59 | echo "" |
| 60 | echo " vnf-orchestration.robot: instantiate, instantiateNoDelete, stability72hr" |
| 61 | echo "" |
| 62 | echo " [execscript] - optional parameter to execute user custom scripts located in scripts/etescript directory" |
| 63 | exit |
| 64 | fi |
| 65 | |
| 66 | set -x |
| 67 | |
| 68 | export NAMESPACE="$1" |
| 69 | |
| 70 | POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot) |
| 71 | |
| 72 | TAGS="-i $2" |
| 73 | |
| 74 | DIR=$(dirname "$0") |
| 75 | SCRIPTDIR=scripts/etescript |
| 76 | |
| 77 | ETEHOME=/var/opt/ONAP |
| 78 | |
Guillaume Lambert | ba6e50f | 2021-04-26 21:46:56 +0200 | [diff] [blame] | 79 | if [ "${!#}" = "execscript" ]; then |
Sylvain Desbureaux | 16bdf24 | 2020-12-07 10:28:24 +0100 | [diff] [blame] | 80 | for script in $(ls -1 "$DIR/$SCRIPTDIR"); do |
Guillaume Lambert | d9017ef | 2021-03-08 21:38:31 +0100 | [diff] [blame] | 81 | [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && . "$DIR/$SCRIPTDIR/$script" |
Sylvain Desbureaux | 16bdf24 | 2020-12-07 10:28:24 +0100 | [diff] [blame] | 82 | done |
| 83 | fi |
| 84 | |
| 85 | export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l") |
| 86 | OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_ete_$2 |
| 87 | DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90)) |
| 88 | |
| 89 | VARIABLEFILES="-V /share/config/robot_properties.py" |
| 90 | VARIABLES="-v GLOBAL_BUILD_NUMBER:$$" |
| 91 | |
| 92 | case $2 in |
| 93 | security) |
| 94 | if [ -z "$NODEPORTS_FILE" ]; then |
| 95 | echo "Security tests require gathering additional information on ONAP cluster." |
| 96 | echo "It is unavailable from within Robot pod." |
| 97 | echo "" |
| 98 | echo "Rerun command with \"execscript\" argument, e.g." |
| 99 | echo "$ $0 onap security execscript" |
| 100 | exit |
| 101 | fi |
| 102 | VARIABLES="${VARIABLES} -v ACTUAL_NODEPORTS_FILE:${NODEPORTS_FILE}" |
| 103 | ;; |
| 104 | esac |
| 105 | |
| 106 | kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} ${TAGS} --display $DISPLAY_NUM |