3 # Copyright (C) 2018 Amdocs, Bell Canada
4 # Modifications Copyright (C) 2019 Samsung
5 # Modifications Copyright (C) 2020 Nokia
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 # Execute tags built to support the hands-on demo
23 echo "Usage: demo-k8s.sh <namespace> <command> [<parameters>] [execscript]"
25 echo " demo-k8s.sh <namespace> init"
26 echo " - Execute both init_customer + distribute"
28 echo " demo-k8s.sh <namespace> init_customer"
29 echo " - Create demo customer (Demonstration) and services, etc."
31 echo " demo-k8s.sh <namespace> distribute [<prefix>]"
32 echo " - Distribute demo models (demoVFW and demoVLB)"
34 echo " demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
35 echo " - Preload data for VNF for the <module_name>"
37 echo " demo-k8s.sh <namespace> appc <module_name>"
38 echo " - provide APPC with vFW module mount point for closed loop"
40 echo " demo-k8s.sh <namespace> init_robot [ <etc_hosts_prefix> ]"
41 echo " - Initialize robot after all ONAP VMs have started"
43 echo " demo-k8s.sh <namespace> instantiateVFW"
44 echo " - Instantiate vFW module for the demo customer (DemoCust<uuid>)"
46 echo " demo-k8s.sh <namespace> instantiateVFWdirectso csar_filename"
47 echo " - Instantiate vFW module using direct SO interface using previously distributed model "
48 echo " that is in /tmp/csar in robot container"
50 echo " demo-k8s.sh <namespace> instantiateVLB_CDS"
51 echo " - Instantiate vLB module using CDS with a preloaded CBA "
53 echo " demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
54 echo " - Delete the module created by instantiateVFW"
56 echo " demo-k8s.sh <namespace> vfwclosedloop <pgn-ip-address>"
57 echo " - vFWCL: Sets the packet generator to high and low rates, and checks whether the policy "
58 echo " kicks in to modulate the rates back to medium"
60 echo " demo-k8s.sh <namespace> <command> [<parameters>] execscript"
61 echo " - Optional parameter to execute user custom scripts located in scripts/demoscript directory"
65 # Check if execscript flag is used and drop it from input arguments
67 if [ "${!#}" = "execscript" ]; then
74 echo "Number of parameters:"
86 ## if more than 1 tag is supplied, the must be provided with -i or -e
97 echo "WEB Site Password for user 'test': "
101 if [ "$WEB_PASSWORD" = "" ]; then
103 echo "WEB Password is required for user 'test'"
106 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
109 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
130 TAG="InitDistribution"
133 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
141 echo "Usage: demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
144 VARIABLES="$VARIABLES -v VNF_NAME:$1"
146 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
150 TAG="APPCMountPointDemo"
153 echo "Usage: demo-k8s.sh <namespace> appc <module_name>"
156 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
161 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
164 instantiateVFWdirectso)
165 TAG="instantiateVFWdirectso"
168 echo "Usage: demo-k8s.sh <namespace> instantiateVFWdirectso <csar_filename>"
171 VARIABLES="$VARIABLES -v CSAR_FILE:$1 -v GLOBAL_BUILD_NUMBER:$$"
175 TAG="instantiateVLB_CDS"
176 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
183 echo "Usage: demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
187 VARIABLES="$VARIABLES -V /share/${VARFILE}"
195 TAG="distributeVFWNG"
199 TAG="DistributeDemoVFWDT"
202 instantiateDemoVFWDT)
203 TAG="instantiateVFWDT"
209 VARIABLES="$VARIABLES -v PACKET_GENERATOR_HOST:$1 -v pkg_host:$1"
220 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
223 SCRIPTDIR=scripts/demoscript
225 ETEHOME=/var/opt/ONAP
227 if [ $execscript ]; then
228 for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
229 [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && . "$DIR/$SCRIPTDIR/$script"
233 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l")
234 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_demo_$key
235 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
237 VARIABLEFILES="-V /share/config/robot_properties.py"
239 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} -i ${TAG} --display $DISPLAY_NUM 2> ${TAG}.out