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 ################################################################################
21 if [ ! -z "$1" ]; then echo "$1"; fi
22 read -n 1 -p "Press any key to continue, or CTRL-C to abort" mainmenuinput
27 echo "This script sets up the IP address references for RIC and SMO clusters."
29 echo "Reading RIC cluster IP address from envirronment variable \$RIC_IP."
30 if [ -z $(echo ${RIC_IP} | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}") ]; then
31 read -p "Not found or not in right format. Enter the external IP address of the RIC cluster: " RIC_IP
37 echo "Reading SMO cluster IP address from envirronment variable \$SMO_IP."
38 if [ -z $(echo ${SMO_IP} | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}") ]; then
39 read -p "Not found or not in right format. Enter the external IP address of the SMO cluster: " SMO_IP
46 echo "Ready to configure demo scripts and Helm charts using RIC cluster at ${RIC_IP} and SMO cluster at ${SMO_IP}."
47 echo "If not correct, abort from this script, then export the correct values for the RIC_IP and SMO_IP environment variables."
50 export RIC_IP="$RIC_IP"
51 export SMO_IP="$SMO_IP"
53 # run fixes from git clone's root directory
55 cd $(git rev-parse --show-toplevel)
57 if [ ! "$(ls -A ./ric-dep)" ]; then
58 echo "ric-dep directory empty, running submodule command to fetch"
59 git submodule update --init --recursive
63 echo "Inject the RIC cluster IP address (${RIC_IP}) into NONRTRIC recipe..."
64 #./nonrtric/RECIPE_EXAMPLE/example_recipe.yaml:137:192.168.130.80
65 sed -i -e 's/"baseUrl":"http:\/\/192.168.130.80:32080\/a1mediator"/"baseUrl":"http:\/\/'"${RIC_IP}"':32080\/a1mediator"/g' ./nonrtric/RECIPE_EXAMPLE/example_recipe.yaml
68 echo "Inject the RIC and SMO cluster IP addresses (${RIC_IP} and ${SMO_IP}) into RICAUX recipe..."
69 #./ric-aux/RECIPE_EXAMPLE/example_recipe.yaml:40:ricip: "10.0.0.1"
70 #./ric-aux/RECIPE_EXAMPLE/example_recipe.yaml:40:auxip: "10.0.0.1"
71 sed -i -e 's/ricip: "10.0.0.1"/ricip: "'"${RIC_IP}"'"/g' ./ric-aux/RECIPE_EXAMPLE/example_recipe.yaml
72 sed -i -e 's/auxip: "10.0.0.1"/auxip: "'"${SMO_IP}"'"/g' ./ric-aux/RECIPE_EXAMPLE/example_recipe.yaml
74 echo "Inject the RIC and SMO cluster IP addresses (${RIC_IP} and ${SMO_IP}) into RIC recipe..."
75 #ric-dep/RECIPE_EXAMPLE/example_recipe.yaml:39: ricip: "10.0.0.1"
76 #ric-dep/RECIPE_EXAMPLE/example_recipe.yaml:40: auxip: "10.0.0.1"
77 sed -i -e 's/ricip: "10.0.0.1"/ricip: "'"${RIC_IP}"'"/g' ./ric-dep/RECIPE_EXAMPLE/example_recipe.yaml
78 sed -i -e 's/auxip: "10.0.0.1"/auxip: "'"${SMO_IP}"'"/g' ./ric-dep/RECIPE_EXAMPLE/example_recipe.yaml