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 + registrySynch"
28 echo " demo-k8s.sh <namespace> init_customer"
29 echo " - Create demo customer (Demonstration) and services, etc."
31 echo " demo-k8s.sh <namespace> registrySynch [ repo <chart name> | path [ <path to helm charts> ]"
32 echo " [ <chart prefix> ] ]"
33 echo " - Synchronize chart museum inside of onap k8s cluster with"
34 echo " onap helm charts git repository (OOM)"
35 echo " By default following charts are synchronized:"
36 echo " - oom/kubernetes/dcaegen2-services/charts/,"
37 echo " - oom/kubernetes/common/common/charts,"
38 echo " - oom/kubernetes/common/postgres/charts/,"
39 echo " - oom/kubernetes/common/repositoryGenerator/charts/,"
40 echo " - oom/kubernetes/common/readinessCheck/charts/,"
41 echo " User is able also to synchronize custom helm charts by providing"
42 echo " flag 'path' and path to charts into command and chart name/s prefix for example:"
43 echo " demo-k8s.sh onap registrySynch /home/ubuntu/oom/kubernetes/common/postgres/charts/ postgres"
44 echo " - Synchronize chart museum inside of onap k8s cluster with"
45 echo " onap installation server 'local' helm charts repository"
46 echo " By default following charts are synchronized:"
47 echo " - local/certInitializer"
48 echo " User is able also to synchronize custom helm charts by providing"
49 echo " flag 'repo' and chart name in 'local' repo into command for example:"
50 echo " demo-k8s.sh onap registrySynch repo certInitializer"
52 echo " demo-k8s.sh <namespace> distribute [<prefix>]"
53 echo " - Distribute demo models (demoVFW and demoVLB)"
55 echo " demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
56 echo " - Preload data for VNF for the <module_name>"
58 echo " demo-k8s.sh <namespace> appc <module_name>"
59 echo " - provide APPC with vFW module mount point for closed loop"
61 echo " demo-k8s.sh <namespace> init_robot [ <etc_hosts_prefix> ]"
62 echo " - Initialize robot after all ONAP VMs have started"
64 echo " demo-k8s.sh <namespace> instantiateVFW"
65 echo " - Instantiate vFW module for the demo customer (DemoCust<uuid>)"
67 echo " demo-k8s.sh <namespace> instantiateVFWdirectso csar_filename"
68 echo " - Instantiate vFW module using direct SO interface using previously distributed model "
69 echo " that is in /tmp/csar in robot container"
71 echo " demo-k8s.sh <namespace> instantiateVLB_CDS"
72 echo " - Instantiate vLB module using CDS with a preloaded CBA "
74 echo " demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
75 echo " - Delete the module created by instantiateVFW"
77 echo " demo-k8s.sh <namespace> vfwclosedloop <pgn-ip-address>"
78 echo " - vFWCL: Sets the packet generator to high and low rates, and checks whether the policy "
79 echo " kicks in to modulate the rates back to medium"
81 echo " demo-k8s.sh <namespace> <command> [<parameters>] execscript"
82 echo " - Optional parameter to execute user custom scripts located in scripts/demoscript directory"
86 # Check if execscript flag is used and drop it from input arguments
88 if [ "${!#}" = "execscript" ]; then
95 echo "Number of parameters:"
107 ## if more than 1 tag is supplied, the must be provided with -i or -e
118 echo "WEB Site Password for user 'test': "
122 if [ "$WEB_PASSWORD" = "" ]; then
124 echo "WEB Password is required for user 'test'"
127 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
130 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
136 dcaeRegistrySynch=true
152 TAG="InitDistribution"
155 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
163 echo "Usage: demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
166 VARIABLES="$VARIABLES -v VNF_NAME:$1"
168 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
172 TAG="APPCMountPointDemo"
175 echo "Usage: demo-k8s.sh <namespace> appc <module_name>"
178 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
183 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
186 instantiateVFWdirectso)
187 TAG="instantiateVFWdirectso"
190 echo "Usage: demo-k8s.sh <namespace> instantiateVFWdirectso <csar_filename>"
193 VARIABLES="$VARIABLES -v CSAR_FILE:$1 -v GLOBAL_BUILD_NUMBER:$$"
197 TAG="instantiateVLB_CDS"
198 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
205 echo "Usage: demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
209 VARIABLES="$VARIABLES -V /share/${VARFILE}"
217 TAG="distributeVFWNG"
221 TAG="DistributeDemoVFWDT"
224 instantiateDemoVFWDT)
225 TAG="instantiateVFWDT"
231 VARIABLES="$VARIABLES -v PACKET_GENERATOR_HOST:$1 -v pkg_host:$1"
235 dcaeRegistrySynch=true
236 echo $dcaeRegistrySynch
239 if [ "$1" = "path" ]; then
241 customHelmChartsPath=$1
243 customHelmChartsPref=$1
245 elif [ "$1" = "repo" ]; then
247 customHelmChartFromLocalRepo=$1
248 echo $customHelmChartFromLocalRepo
251 echo "demo-k8s.sh <namespace> registrySynch { repo <chart name> | path [ <path to helm charts> ] [ <chart prefix> ] }"
262 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
263 HELM_RELEASE=$(kubectl --namespace onap get pods | sed 's/ .*//' | grep robot | sed 's/-.*//')
266 SCRIPTDIR=scripts/demoscript
268 ETEHOME=/var/opt/ONAP
270 if [ $execscript ]; then
271 for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
272 [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && . "$DIR/$SCRIPTDIR/$script"
276 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- sh -c "ls -1q /share/logs/ | wc -l")
277 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_demo_$key
278 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
280 if [ $dcaeRegistrySynch ]; then
285 if [ -n "$customHelmChartsPath" ]; then
286 ./registry-initialize.sh -d $customHelmChartsPath -n $NAMESPACE -r $HELM_RELEASE -p customHelmChartsPref
287 elif [ -n "$customHelmChartFromLocalRepo" ]; then
288 ./registry-initialize.sh -h $customHelmChartFromLocalRepo -n $NAMESPACE -r $HELM_RELEASE
290 ./registry-initialize.sh -d ../../dcaegen2-services/charts/ -n $NAMESPACE -r $HELM_RELEASE
291 ./registry-initialize.sh -d ../../dcaegen2-services/charts/ -n $NAMESPACE -r $HELM_RELEASE -p common
292 ./registry-initialize.sh -h certInitializer -n $NAMESPACE -r $HELM_RELEASE
293 ./registry-initialize.sh -h repositoryGenerator -n $NAMESPACE -r $HELM_RELEASE
294 ./registry-initialize.sh -h readinessCheck -n $NAMESPACE -r $HELM_RELEASE
295 ./registry-initialize.sh -h dcaegen2-services-common -n $NAMESPACE -r $HELM_RELEASE
296 ./registry-initialize.sh -h postgres -n $NAMESPACE -r $HELM_RELEASE
297 ./registry-initialize.sh -h serviceAccount -n $NAMESPACE -r $HELM_RELEASE
298 ./registry-initialize.sh -h mongo -n $NAMESPACE -r $HELM_RELEASE
299 ./registry-initialize.sh -h common -n $NAMESPACE -r $HELM_RELEASE
304 if [ -n "$TAG" ]; then
305 VARIABLEFILES="-V /share/config/robot_properties.py"
306 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} -i ${TAG} --display $DISPLAY_NUM 2> ${TAG}.out