2 ################################################################################
3 # Copyright (c) 2020 AT&T Intellectual Property. #
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. #
16 ################################################################################
18 echo "===> Starting at $(date)"
20 # to run in backgroudn nohup:
21 # nohup bash -c "./install && date" &
24 # where this scrpt is located
25 SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
26 # where we are when starting
29 if [ "$1" == "initlocalrepo" ]; then
30 echo && echo "===> Initialize local Helm repo"
31 rm -rf ~/.helm && helm init -c # without this step helm serve may not work.
33 helm repo add local http://127.0.0.1:8879
36 echo && echo "===> Cleaning up any previous deployment"
37 echo "======> Deleting all Helm deployments"
38 helm list | sed -e 1d | cut -f1 | xargs helm delete --purge
40 echo "======> Clearing out all ONAP deployment resources"
41 kubectl delete ns onap
42 kubectl get pv --all-namespaces |cut -f1 -d' ' |xargs kubectl delete pv
43 kubectl get clusterrolebindings | grep onap | cut -f1 -d' ' |xargs kubectl delete clusterrolebindings
44 rm -rf /dockerdata-nfs
46 echo "======> Clearing out all RICAUX deployment resources"
47 kubectl delete ns ricaux
48 kubectl delete ns ricinfra
49 rm -rf /opt/data/dashboard-data
51 echo "======> Clearing out all NONRTRIC deployment resources"
52 kubectl delete ns nonrtric
54 echo "======> Preparing for redeployment"
55 mkdir -p /dockerdata-nfs
56 mkdir -p /opt/data/dashboard-data
57 kubectl label --overwrite nodes "$(hostname)" local-storage=enable
58 kubectl label --overwrite nodes "$(hostname)" aaf-storage=enable
59 kubectl label --overwrite nodes "$(hostname)" portal-storage=enable
61 echo "======> Preparing working directory"
68 echo && echo "===> Deploying OAM (ONAP Lite)"
71 echo "======> Building ONAP helm charts. !! This will take very long time (hours)."
72 cat << EOF >> override-oam.yaml
75 masterPassword: Berlin1234!
138 mountpointRegistrarEnabled: true
139 mountpointStateProviderEnabled: true
168 git clone -b frankfurt http://gerrit.onap.org/r/oom --recurse-submodules smo-oom
170 REPOROOTDIR=$(git rev-parse --show-toplevel)
171 git fetch "https://gerrit.onap.org/r/oom" refs/changes/31/106331/6 && git checkout FETCH_HEAD
172 # HEAD is now at 275f7de9 [SDNC] oom for clustered disaggregated SDN-R
173 cp -R ./kubernetes/helm/plugins/ ~/.helm
178 # should see 35 charts
184 echo "======> Deploying ONAP-lite"
185 helm deploy dev local/onap --namespace onap -f ./override-oam.yaml
187 echo "======> Waiting for ONAP-lite to reach operatoinal state"
188 NUM_SDNR_RUNNING_PODS="0"
189 NUM_MR_RUNNING_PODS="0"
191 while [ "$NUM_MR_RUNNING_PODS" -lt "7" ] || [ "$NUM_SDNR_RUNNING_PODS" -lt "7" ]
194 NUM_SDNR_RUNNING_PODS=$(kubectl get pods --all-namespaces | grep "sdn[\/0-9a-z \-]*Running" | wc -l)
195 NUM_SDNC_COMPLETED_JOBS=$(kubectl get pods --all-namespaces | grep "sdn[\/0-9a-z \-]*Completed" | wc -l)
196 NUM_MR_RUNNING_PODS=$(kubectl get pods --all-namespaces | grep "message-router[\/0-9a-z \-]*Running" | wc -l)
198 echo "${NUM_SDNR_RUNNING_PODS}/7 SDNC-SDNR pods and ${NUM_MR_RUNNING_PODS}/7 Message Router pods running"
202 echo && echo "===> Deploy NONRTRIIC"
203 git clone http://gerrit.o-ran-sc.org/r/it/dep smo-dep
205 REPOROOTDIR=$(git rev-parse --show-toplevel)
208 ./deploy-nonrtric -f ${REPOROOTDIR}/RECIPE_EXAMPLE/NONRTRIC/example_recipe.yaml
209 echo "======> Waiting for NONRTRIC to reach operatoinal state"
210 NUM_A1C_RUNNING_PODS="0"
211 NUM_A1SIM_RUNNING_PODS="0"
212 NUM_CP_RUNNING_PODS="0"
213 NUM_DB_RUNNING_PODS="0"
214 NUM_PMS_RUNNING_PODS="0"
216 while [ "$NUM_A1C_RUNNING_PODS" -lt "1" ] || [ "$NUM_CP_RUNNING_PODS" -lt "1" ] || \
217 [ "$NUM_DB_RUNNING_PODS" -lt "1" ]|| [ "$NUM_PMS_RUNNING_PODS" -lt "1" ] || \
218 [ "$NUM_A1SIM_RUNNING_PODS" -lt "4" ]
221 NUM_A1C_RUNNING_PODS=$(kubectl get pods -n nonrtric | grep "a1controller[\/0-9a-z \-]*Running" | wc -l)
222 NUM_A1SIM_RUNNING_PODS=$(kubectl get pods -n nonrtric | grep "a1-sim[\/0-9a-z \-]*Running" | wc -l)
223 NUM_CP_RUNNING_PODS=$(kubectl get pods -n nonrtric | grep "controlpanel[\/0-9a-z \-]*Running" | wc -l)
224 NUM_DB_RUNNING_PODS=$(kubectl get pods -n nonrtric | grep "db[\/0-9a-z \-]*Running" | wc -l)
225 NUM_PMS_RUNNING_PODS=$(kubectl get pods -n nonrtric | grep "policymanagementservice[\/0-9a-z \-]*Running" | wc -l)
227 echo "${NUM_A1C_RUNNING_PODS}/1 A1Controller pods, ${NUM_CP_RUNNING_PODS}/1 ControlPanel pods, "
228 echo "${NUM_DB_RUNNING_PODS}/1 DB pods, ${NUM_PMS_RUNNING_PODS}/1 PolicyManagementService pods, "
229 echo "and ${NUM_A1SIM_RUNNING_PODS}/4 A1Sim pods running"
234 echo && echo "===> Deploying VES collector and its ingress"
235 kubectl create ns ricinfra
237 cd ${REPOROOTDIR}/ric-aux/helm/infrastructure
240 helm install -f ${REPOROOTDIR}/RECIPE_EXAMPLE/AUX/example_recipe.yaml --name bronze-infra --namespace ricaux ./infrastructure
242 cd ${REPOROOTDIR}/ric-aux/helm/ves
245 helm install -f ${REPOROOTDIR}/RECIPE_EXAMPLE/AUX/example_recipe.yaml --name bronze-ves --namespace ricaux ./ves
248 # edit RECIPE_EXAMPLE/AUX/example_recipe.yaml file
249 #./bin/prepare-common-templates
251 #./install -f ${REPOROOTDIR}/RECIPE_EXAMPLE/AUX/example_recipe.yaml -c "ves"
254 kubectl get pods --all-namespaces
256 echo "===> Completing at $(date)"