beef up the AI/ML framework tests by adding InfluxDB as data source and populate...
[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:36421 -v TEST_NODE_B_NAME:AAAA123456\""
31    echo "         NOTE1:  TEST_NODE_B_NAME is 4 upper case letters and then 6 numbers in Dashboard validation  "
32    echo "         NOTE2:  TEST_NODE_B_PORT real nodeB's use 36422 but e2sim must be on a port other than 36422"
33    echo "           "
34    echo "  <tag>         "
35    echo "         health   "
36    echo "         etetests  "
37    echo "         e2setup   "
38    echo "         x2setup   "
39    echo "         e2setup_dash   "
40    echo "         x2setup_dash   "
41    exit
42 fi
43
44
45 if [ "$3" != "" ] ; then
46     VARIABLES="-v $3"
47 fi
48
49 #set -x
50
51 export NAMESPACE="$1"
52
53 POD=$(kubectl --namespace  $NAMESPACE get pod -l robotImplementation=ric-robot --no-headers=true | sed 's/ .*//')
54
55
56 TAGS="-i $2"
57
58 ETEHOME=/var/opt/RIC
59 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec  ${POD}  -- bash -c "ls -1q /share/logs/ | wc -l")
60 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_ete_$2
61 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
62
63 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py"
64 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
65
66 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} ${TAGS} --display $DISPLAY_NUM