2 # Copyright (C) 2018 Amdocs, Bell Canada
3 # Modifications Copyright (C) 2019 Samsung
4 # Modifications Copyright (C) 2020 Nokia
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # Execute tags built to support the hands-on demo
22 echo "Usage: demo-k8s.sh <namespace> <command> [<parameters>] [execscript]"
24 echo " demo-k8s.sh <namespace> init"
25 echo " - Execute both init_customer + distribute"
27 echo " demo-k8s.sh <namespace> init_customer"
28 echo " - Create demo customer (Demonstration) and services, etc."
30 echo " demo-k8s.sh <namespace> distribute [<prefix>]"
31 echo " - Distribute demo models (demoVFW and demoVLB)"
33 echo " demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
34 echo " - Preload data for VNF for the <module_name>"
36 echo " demo-k8s.sh <namespace> appc <module_name>"
37 echo " - provide APPC with vFW module mount point for closed loop"
39 echo " demo-k8s.sh <namespace> init_robot [ <etc_hosts_prefix> ]"
40 echo " - Initialize robot after all ONAP VMs have started"
42 echo " demo-k8s.sh <namespace> instantiateVFW"
43 echo " - Instantiate vFW module for the demo customer (DemoCust<uuid>)"
45 echo " demo-k8s.sh <namespace> instantiateVFWdirectso csar_filename"
46 echo " - Instantiate vFW module using direct SO interface using previously distributed model "
47 echo " that is in /tmp/csar in robot container"
49 echo " demo-k8s.sh <namespace> instantiateVLB_CDS"
50 echo " - Instantiate vLB module using CDS with a preloaded CBA "
52 echo " demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
53 echo " - Delete the module created by instantiateVFW"
55 echo " demo-k8s.sh <namespace> vfwclosedloop <pgn-ip-address>"
56 echo " - vFWCL: Sets the packet generator to high and low rates, and checks whether the policy "
57 echo " kicks in to modulate the rates back to medium"
59 echo " demo-k8s.sh <namespace> <command> [<parameters>] execscript"
60 echo " - Optional parameter to execute user custom scripts located in scripts/demoscript directory"
64 # Check if execscript flag is used and drop it from input arguments
66 if [[ "${!#}" = "execscript" ]]; then
73 echo "Number of parameters:"
85 ## if more than 1 tag is supplied, the must be provided with -i or -e
96 read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD
97 if [ "$WEB_PASSWORD" = "" ]; then
99 echo "WEB Password is required for user 'test'"
102 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
105 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
126 TAG="InitDistribution"
129 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
137 echo "Usage: demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
140 VARIABLES="$VARIABLES -v VNF_NAME:$1"
142 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
146 TAG="APPCMountPointDemo"
149 echo "Usage: demo-k8s.sh <namespace> appc <module_name>"
152 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
157 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
160 instantiateVFWdirectso)
161 TAG="instantiateVFWdirectso"
164 echo "Usage: demo-k8s.sh <namespace> instantiateVFWdirectso <csar_filename>"
167 VARIABLES="$VARIABLES -v CSAR_FILE:$1 -v GLOBAL_BUILD_NUMBER:$$"
171 TAG="instantiateVLB_CDS"
172 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
179 echo "Usage: demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
183 VARIABLES="$VARIABLES -V /share/${VARFILE}"
191 TAG="distributeVFWNG"
195 TAG="DistributeDemoVFWDT"
198 instantiateDemoVFWDT)
199 TAG="instantiateVFWDT"
205 VARIABLES="$VARIABLES -v PACKET_GENERATOR_HOST:$1 -v pkg_host:$1"
216 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
219 SCRIPTDIR=scripts/demoscript
221 ETEHOME=/var/opt/ONAP
223 if [ $execscript ]; then
224 for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
225 [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
229 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l")
230 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_demo_$key
231 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
233 VARIABLEFILES="-V /share/config/robot_properties.py"
235 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} -i ${TAG} --display $DISPLAY_NUM 2> ${TAG}.out