9bbe82a7ff58903acd437daab89ee12a6d6ab321
[it/test.git] / ric_robot_suite / helm / ric-robot / ete-k8s.sh
1 #!/bin/bash
2 ################################################################################
3 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
4 #   Copyright (c) 2019 Nokia.                                                  #
5 #                                                                              #
6 #   Licensed under the Apache License, Version 2.0 (the "License");            #
7 #   you may not use this file except in compliance with the License.           #
8 #   You may obtain a copy of the License at                                    #
9 #                                                                              #
10 #       http://www.apache.org/licenses/LICENSE-2.0                             #
11 #                                                                              #
12 #   Unless required by applicable law or agreed to in writing, software        #
13 #   distributed under the License is distributed on an "AS IS" BASIS,          #
14 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
15 #   See the License for the specific language governing permissions and        #
16 #   limitations under the License.                                             #
17 ################################################################################
18
19
20 #
21 # Run the testsuite for the passed tag. Valid tags are health
22 # Please clean up logs when you are done...
23 # Note: Do not run multiple concurrent ete.sh as the --display is not parameterized and tests will collide
24 #
25 if [ "$1" == "" ] || [ "$2" == "" ]; then
26    echo "Usage: ete-k8s.sh <namespace> <tag> [input variable]"
27    echo "  <tag>: health etetests e2mgrtests"
28    echo "  [input variable] is added to runTags with "-v" prepended"
29    echo "         example :   TEST_NODE_B_IP:10.240.0.217 "
30    echo "         example :   \"TEST_NODE_B_IP:10.240.0.217 -v TEST_NODE_B_PORT:34622 -v TEST_NODE_B_NAME:AAAA123456\""
31    echo "         note:   TEST_NODE_B_NAME is 4 upper case letters and then 6 numbers in Dashboard validation  "
32    echo "           "
33    echo "  <tag>         "
34    echo "         health   "
35    echo "         etetests  "
36    echo "         e2setup   "
37    echo "         x2setup   "
38    echo "         e2setup_dash   "
39    echo "         x2setup_dash   "
40    exit
41 fi
42
43
44 if [ "$3" != "" ] ; then
45     VARIABLES="-v $3"
46 fi
47
48 #set -x
49
50 export NAMESPACE="$1"
51
52 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
53
54
55 TAGS="-i $2"
56
57 ETEHOME=/var/opt/RIC
58 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec  ${POD}  -- bash -c "ls -1q /share/logs/ | wc -l")
59 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_ete_$2
60 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
61
62 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py"
63 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
64
65 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} ${TAGS} --display $DISPLAY_NUM