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> init_robot [ <etc_hosts_prefix> ]"
59 echo " - Initialize robot after all ONAP VMs have started"
61 echo " demo-k8s.sh <namespace> instantiateVFW"
62 echo " - Instantiate vFW module for the demo customer (DemoCust<uuid>)"
64 echo " demo-k8s.sh <namespace> instantiateVFWdirectso csar_filename"
65 echo " - Instantiate vFW module using direct SO interface using previously distributed model "
66 echo " that is in /tmp/csar in robot container"
68 echo " demo-k8s.sh <namespace> instantiateVLB_CDS"
69 echo " - Instantiate vLB module using CDS with a preloaded CBA "
71 echo " demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
72 echo " - Delete the module created by instantiateVFW"
74 echo " demo-k8s.sh <namespace> vfwclosedloop <pgn-ip-address>"
75 echo " - vFWCL: Sets the packet generator to high and low rates, and checks whether the policy "
76 echo " kicks in to modulate the rates back to medium"
78 echo " demo-k8s.sh <namespace> <command> [<parameters>] execscript"
79 echo " - Optional parameter to execute user custom scripts located in scripts/demoscript directory"
83 # Check if execscript flag is used and drop it from input arguments
85 if [ "${!#}" = "execscript" ]; then
92 echo "Number of parameters:"
104 ## if more than 1 tag is supplied, the must be provided with -i or -e
115 echo "WEB Site Password for user 'test': "
119 if [ "$WEB_PASSWORD" = "" ]; then
121 echo "WEB Password is required for user 'test'"
124 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
127 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
133 dcaeRegistrySynch=true
149 TAG="InitDistribution"
152 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
160 echo "Usage: demo-k8s.sh <namespace> preload <vnf_name> <module_name>"
163 VARIABLES="$VARIABLES -v VNF_NAME:$1"
165 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
170 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
173 instantiateVFWdirectso)
174 TAG="instantiateVFWdirectso"
177 echo "Usage: demo-k8s.sh <namespace> instantiateVFWdirectso <csar_filename>"
180 VARIABLES="$VARIABLES -v CSAR_FILE:$1 -v GLOBAL_BUILD_NUMBER:$$"
184 TAG="instantiateVLB_CDS"
185 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
192 echo "Usage: demo-k8s.sh <namespace> deleteVNF <module_name from instantiateVFW>"
196 VARIABLES="$VARIABLES -V /share/${VARFILE}"
204 TAG="distributeVFWNG"
208 TAG="DistributeDemoVFWDT"
211 instantiateDemoVFWDT)
212 TAG="instantiateVFWDT"
218 VARIABLES="$VARIABLES -v PACKET_GENERATOR_HOST:$1 -v pkg_host:$1"
222 dcaeRegistrySynch=true
223 echo $dcaeRegistrySynch
226 if [ "$1" = "path" ]; then
228 customHelmChartsPath=$1
230 customHelmChartsPref=$1
232 elif [ "$1" = "repo" ]; then
234 customHelmChartFromLocalRepo=$1
235 echo $customHelmChartFromLocalRepo
238 echo "demo-k8s.sh <namespace> registrySynch { repo <chart name> | path [ <path to helm charts> ] [ <chart prefix> ] }"
249 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
250 HELM_RELEASE=$(kubectl --namespace onap get pods | sed 's/ .*//' | grep robot | sed 's/-.*//')
253 SCRIPTDIR=scripts/demoscript
255 ETEHOME=/var/opt/ONAP
257 if [ $execscript ]; then
258 for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
259 [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && . "$DIR/$SCRIPTDIR/$script"
263 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- sh -c "ls -1q /share/logs/ | wc -l")
264 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_demo_$key
265 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
267 if [ $dcaeRegistrySynch ]; then
272 if [ -n "$customHelmChartsPath" ]; then
273 ./registry-initialize.sh -d $customHelmChartsPath -n $NAMESPACE -r $HELM_RELEASE -p customHelmChartsPref
274 elif [ -n "$customHelmChartFromLocalRepo" ]; then
275 ./registry-initialize.sh -h $customHelmChartFromLocalRepo -n $NAMESPACE -r $HELM_RELEASE
277 ./registry-initialize.sh -d ../../dcaegen2-services/charts/ -n $NAMESPACE -r $HELM_RELEASE
278 ./registry-initialize.sh -d ../../dcaegen2-services/charts/ -n $NAMESPACE -r $HELM_RELEASE -p common
279 ./registry-initialize.sh -h certInitializer -n $NAMESPACE -r $HELM_RELEASE
280 ./registry-initialize.sh -h repositoryGenerator -n $NAMESPACE -r $HELM_RELEASE
281 ./registry-initialize.sh -h readinessCheck -n $NAMESPACE -r $HELM_RELEASE
282 ./registry-initialize.sh -h dcaegen2-services-common -n $NAMESPACE -r $HELM_RELEASE
283 ./registry-initialize.sh -h postgres -n $NAMESPACE -r $HELM_RELEASE
284 ./registry-initialize.sh -h serviceAccount -n $NAMESPACE -r $HELM_RELEASE
285 ./registry-initialize.sh -h mongo -n $NAMESPACE -r $HELM_RELEASE
286 ./registry-initialize.sh -h common -n $NAMESPACE -r $HELM_RELEASE
291 if [ -n "$TAG" ]; then
292 VARIABLEFILES="-V /share/config/robot_properties.py"
293 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} -i ${TAG} --display $DISPLAY_NUM 2> ${TAG}.out