2 # Copyright (C) 2018 Amdocs, Bell Canada
3 # Modifications Copyright (C) 2019 Samsung
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # Execute tags built to support the hands-on demo
21 echo "Usage: demo-k8s.sh <namespace> <command> [<parameters>]"
23 echo " demo-k8s.sh <namespace> init"
24 echo " - Execute both init_customer + distribute"
26 echo " demo-k8s.sh <namespace> init_customer"
27 echo " - Create demo customer (Demonstration) and services, etc."
29 echo " demo-k8s.sh <namespace> distribute [<prefix>]"
30 echo " - Distribute demo models (demoVFW and demoVLB)"
32 echo " demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
33 echo " - Preload data for VNF for the <module_name>"
35 echo " demo-k8s.sh <namespace> appc <module_name>"
36 echo " - provide APPC with vFW module mount point for closed loop"
38 echo " demo-k8s.sh <namespace> init_robot [ <etc_hosts_prefix> ]"
39 echo " - Initialize robot after all ONAP VMs have started"
41 echo " demo-k8s.sh <namespace> instantiateVFW"
42 echo " - Instantiate vFW module for the demo customer (DemoCust<uuid>)"
44 echo " demo-k8s.sh <namespace> instantiateVFWdirectso csar_filename"
45 echo " - Instantiate vFW module using direct SO interface using previously distributed model "
46 echo " that is in /tmp/csar in robot container"
48 echo " demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
49 echo " - Delete the module created by instantiateVFW"
51 echo " demo-k8s.sh <namespace> heatbridge <stack_name> <service_instance_id> <service> <oam-ip-address>"
52 echo " - Run heatbridge against the stack for the given service instance and service"
54 echo " demo-k8s.sh <namespace> vfwclosedloop <pgn-ip-address>"
55 echo " - vFWCL: Sets the packet generator to high and low rates, and checks whether the policy "
56 echo " kicks in to modulate the rates back to medium"
62 echo "Number of parameters:"
74 ## if more than 1 tag is supplied, the must be provided with -i or -e
85 read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD
86 if [ "$WEB_PASSWORD" = "" ]; then
88 echo "WEB Password is required for user 'test'"
91 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
94 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
107 TAG="InitDistribution"
110 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
118 echo "Usage: demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
121 VARIABLES="$VARIABLES -v VNF_NAME:$1"
123 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
127 TAG="APPCMountPointDemo"
130 echo "Usage: demo-k8s.sh <namespace> appc <module_name>"
133 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
138 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
141 instantiateVFWdirectso)
142 TAG="instantiateVFWdirectso"
145 echo "Usage: demo-k8s.sh <namespace> instantiateVFWdirectso <csar_filename>"
148 VARIABLES="$VARIABLES -v CSAR_FILE:$1 -v GLOBAL_BUILD_NUMBER:$$"
155 echo "Usage: demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
159 if [ -e /opt/eteshare/${VARFILE} ]; then
160 VARIABLES="$VARIABLES -V /share/${VARFILE}"
162 echo "Cache file ${VARFILE} is not found"
171 echo "Usage: demo-k8s.sh <namespace> heatbridge <stack_name> <service_instance_id> <service> <oam-ip-address>"
174 VARIABLES="$VARIABLES -v HB_STACK:$1"
176 VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$1"
178 VARIABLES="$VARIABLES -v HB_SERVICE:$1"
180 VARIABLES="$VARIABLES -v HB_IPV4_OAM_ADDRESS:$1"
188 TAG="distributeVFWNG"
192 TAG="DistributeDemoVFWDT"
195 instantiateDemoVFWDT)
196 TAG="instantiateVFWDT"
202 VARIABLES="$VARIABLES -v PACKET_GENERATOR_HOST:$1 -v pkg_host:$1"
213 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
215 ETEHOME=/var/opt/ONAP
217 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l")
218 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_demo_$key
219 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
221 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
223 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} -i ${TAG} --display $DISPLAY_NUM 2> ${TAG}.out