install_osm: defaults to lightweight
[osm/devops.git] / installers / install_osm.sh
1 #!/bin/bash
2 # Copyright 2016 Telefónica Investigación y Desarrollo S.A.U.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 function usage(){
17 echo -e "usage: $0 [OPTIONS]"
18 echo -e "Install OSM from binaries or source code (by default, from binaries)"
19 echo -e " OPTIONS"
20 echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules"
21 echo -e " --source: install OSM from source code using the latest stable tag"
22 echo -e " -r <repo>: use specified repository name for osm packages"
23 echo -e " -R <release>: use specified release for osm binaries (deb packages, lxd images, ...)"
24 echo -e " -u <repo base>: use specified repository url for osm packages"
25 echo -e " -k <repo key>: use specified repository public key url"
26 echo -e " -b <refspec>: install OSM from source code using a specific branch (master, v2.0, ...) or tag"
27 echo -e " -b master (main dev branch)"
28 echo -e " -b v2.0 (v2.0 branch)"
29 echo -e " -b tags/v1.1.0 (a specific tag)"
30 echo -e " ..."
31 echo -e " --lxdimages: download lxd images from OSM repository instead of creating them from scratch"
32 echo -e " -l <lxd_repo>: use specified repository url for lxd images"
33 echo -e " -p <path>: use specified repository path for lxd images"
34 echo -e " --lightweight: install lightweight build of OSM (default installation)"
35 echo -e " --soui: install classic build of OSM (based on LXD containers, with SO and UI)"
36 echo -e " --vimemu: additionally fetch, build, and deploy the VIM emulator as a docker container"
37 echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch"
38 # echo -e " --reconfigure: reconfigure the modules (DO NOT change NAT rules)"
39 echo -e " --nat: install only NAT rules"
40 echo -e " --noconfigure: DO NOT install osmclient, DO NOT install NAT rules, DO NOT configure modules"
41 # echo -e " --update: update to the latest stable release or to the latest commit if using a specific branch"
42 echo -e " --showopts: print chosen options and exit (only for debugging)"
43 echo -e " -y: do not prompt for confirmation, assumes yes"
44 echo -e " -D <devops path> use local devops installation path"
45 echo -e " -h / --help: print this help"
46 }
47
48 #Uninstall OSM: remove containers
49 function uninstall(){
50 echo -e "\nUninstalling OSM"
51 if [ $RC_CLONE ] || [ -n "$TEST_INSTALLER" ]; then
52 $OSM_DEVOPS/jenkins/host/clean_container RO
53 $OSM_DEVOPS/jenkins/host/clean_container VCA
54 $OSM_DEVOPS/jenkins/host/clean_container MON
55 $OSM_DEVOPS/jenkins/host/clean_container SO
56 #$OSM_DEVOPS/jenkins/host/clean_container UI
57 else
58 lxc stop RO && lxc delete RO
59 lxc stop VCA && lxc delete VCA
60 lxc stop MON && lxc delete MON
61 lxc stop SO-ub && lxc delete SO-ub
62 fi
63 echo -e "\nDeleting imported lxd images if they exist"
64 lxc image show osm-ro &>/dev/null && lxc image delete osm-ro
65 lxc image show osm-vca &>/dev/null && lxc image delete osm-vca
66 lxc image show osm-soui &>/dev/null && lxc image delete osm-soui
67 return 0
68 }
69
70 #Uninstall lightweight OSM: remove dockers
71 function uninstall_lightweight(){
72 echo -e "\nUninstalling lightweight OSM"
73 docker stack rm osm
74 COUNTER=0
75 result=11
76 while [ ${COUNTER} -lt 30 ]; do
77 sleep 1
78 result=$(docker stack ps osm | wc -l)
79 #echo "Dockers running: $result"
80 if [ "${result}" == "0" ]; then
81 break
82 fi
83 let COUNTER=COUNTER+1
84 done
85 if [ "${result}" == "0" ]; then
86 echo "All dockers of the stack osm were removed"
87 else
88 FATAL "Some dockers of the stack osm could not be removed. Could not uninstall OSM in single shot. Try to uninstall again"
89 fi
90 sleep 5
91 docker image rm osm/ro
92 docker image rm osm/lcm
93 docker image rm osm/light-ui
94 docker image rm osm/nbi
95 docker image rm osm/mon
96 docker image rm osm/pm
97 return 0
98 }
99
100 #Configure NAT rules, based on the current IP addresses of containers
101 function nat(){
102 echo -e "\nChecking required packages: iptables-persistent"
103 dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \
104 sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install iptables-persistent
105 echo -e "\nConfiguring NAT rules"
106 echo -e " Required root privileges"
107 sudo $OSM_DEVOPS/installers/nat_osm
108 }
109
110 function FATAL(){
111 echo "FATAL error: Cannot install OSM due to \"$1\""
112 exit 1
113 }
114
115 #Update RO, SO and UI:
116 function update(){
117 echo -e "\nUpdating components"
118
119 echo -e " Updating RO"
120 CONTAINER="RO"
121 MDG="RO"
122 INSTALL_FOLDER="/opt/openmano"
123 echo -e " Fetching the repo"
124 lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all
125 BRANCH=""
126 BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'`
127 [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'"
128 CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1`
129 CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD`
130 echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)"
131 # COMMIT_ID either was previously set with -b option, or is an empty string
132 CHECKOUT_ID=$COMMIT_ID
133 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS"
134 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH"
135 if [[ $CHECKOUT_ID == "tags/"* ]]; then
136 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID`
137 else
138 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID`
139 fi
140 echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)"
141 if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then
142 echo " Nothing to be done."
143 else
144 echo " Update required."
145 lxc exec $CONTAINER -- service osm-ro stop
146 lxc exec $CONTAINER -- git -C /opt/openmano stash
147 lxc exec $CONTAINER -- git -C /opt/openmano pull --rebase
148 lxc exec $CONTAINER -- git -C /opt/openmano checkout $CHECKOUT_ID
149 lxc exec $CONTAINER -- git -C /opt/openmano stash pop
150 lxc exec $CONTAINER -- /opt/openmano/database_utils/migrate_mano_db.sh
151 lxc exec $CONTAINER -- service osm-ro start
152 fi
153 echo
154
155 echo -e " Updating SO and UI"
156 CONTAINER="SO-ub"
157 MDG="SO"
158 INSTALL_FOLDER="" # To be filled in
159 echo -e " Fetching the repo"
160 lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all
161 BRANCH=""
162 BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'`
163 [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'"
164 CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1`
165 CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD`
166 echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)"
167 # COMMIT_ID either was previously set with -b option, or is an empty string
168 CHECKOUT_ID=$COMMIT_ID
169 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS"
170 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH"
171 if [[ $CHECKOUT_ID == "tags/"* ]]; then
172 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID`
173 else
174 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID`
175 fi
176 echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)"
177 if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then
178 echo " Nothing to be done."
179 else
180 echo " Update required."
181 # Instructions to be added
182 # lxc exec SO-ub -- ...
183 fi
184 echo
185 echo -e "Updating MON Container"
186 CONTAINER="MON"
187 MDG="MON"
188 INSTALL_FOLDER="/root/MON"
189 echo -e " Fetching the repo"
190 lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all
191 BRANCH=""
192 BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'`
193 [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'"
194 CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1`
195 CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD`
196 echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)"
197 # COMMIT_ID either was previously set with -b option, or is an empty string
198 CHECKOUT_ID=$COMMIT_ID
199 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS"
200 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH"
201 if [[ $CHECKOUT_ID == "tags/"* ]]; then
202 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID`
203 else
204 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID`
205 fi
206 echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)"
207 if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then
208 echo " Nothing to be done."
209 else
210 echo " Update required."
211 fi
212 echo
213 }
214
215 function so_is_up() {
216 if [ -n "$1" ]; then
217 SO_IP=$1
218 else
219 SO_IP=`lxc list SO-ub -c 4|grep eth0 |awk '{print $2}'`
220 fi
221 time=0
222 step=5
223 timelength=300
224 while [ $time -le $timelength ]
225 do
226 if [[ `curl -k -X GET https://$SO_IP:8008/api/operational/vcs/info \
227 -H 'accept: application/vnd.yang.data+json' \
228 -H 'authorization: Basic YWRtaW46YWRtaW4=' \
229 -H 'cache-control: no-cache' 2> /dev/null | jq '.[].components.component_info[] | select(.component_name=="RW.Restconf")' 2>/dev/null | grep "RUNNING" | wc -l` -eq 1 ]]
230 then
231 echo "RW.Restconf running....SO is up"
232 return 0
233 fi
234
235 sleep $step
236 echo -n "."
237 time=$((time+step))
238 done
239
240 FATAL "OSM Failed to startup. SO failed to startup"
241 }
242
243 function vca_is_up() {
244 if [[ `lxc exec VCA -- juju status | grep "osm" | wc -l` -eq 1 ]]; then
245 echo "VCA is up and running"
246 return 0
247 fi
248
249 FATAL "OSM Failed to startup. VCA failed to startup"
250 }
251
252 function mon_is_up() {
253 if [[ `curl http://$RO_IP:9090/openmano/ | grep "works" | wc -l` -eq 1 ]]; then
254 echo "MON is up and running"
255 return 0
256 fi
257
258 FATAL "OSM Failed to startup. MON failed to startup"
259 }
260
261 function ro_is_up() {
262 if [ -n "$1" ]; then
263 RO_IP=$1
264 else
265 RO_IP=`lxc list RO -c 4|grep eth0 |awk '{print $2}'`
266 fi
267 time=0
268 step=2
269 timelength=20
270 while [ $time -le $timelength ]; do
271 if [[ `curl http://$RO_IP:9090/openmano/ | grep "works" | wc -l` -eq 1 ]]; then
272 echo "RO is up and running"
273 return 0
274 fi
275 sleep $step
276 echo -n "."
277 time=$((time+step))
278 done
279
280 FATAL "OSM Failed to startup. RO failed to startup"
281 }
282
283
284 function configure_RO(){
285 . $OSM_DEVOPS/installers/export_ips
286 echo -e " Configuring RO"
287 lxc exec RO -- sed -i -e "s/^\#\?log_socket_host:.*/log_socket_host: $SO_CONTAINER_IP/g" /etc/osm/openmanod.cfg
288 lxc exec RO -- service osm-ro restart
289
290 ro_is_up
291
292 lxc exec RO -- openmano tenant-delete -f osm >/dev/null
293 lxc exec RO -- openmano tenant-create osm > /dev/null
294 lxc exec RO -- sed -i '/export OPENMANO_TENANT=osm/d' .bashrc
295 lxc exec RO -- sed -i '$ i export OPENMANO_TENANT=osm' .bashrc
296 lxc exec RO -- sh -c 'echo "export OPENMANO_TENANT=osm" >> .bashrc'
297 }
298
299 function configure_VCA(){
300 echo -e " Configuring VCA"
301 JUJU_PASSWD=`date +%s | sha256sum | base64 | head -c 32`
302 echo -e "$JUJU_PASSWD\n$JUJU_PASSWD" | lxc exec VCA -- juju change-user-password
303 }
304
305 function configure_SOUI(){
306 . $OSM_DEVOPS/installers/export_ips
307 JUJU_CONTROLLER_IP=`lxc exec VCA -- lxc list -c 4 |grep eth0 |awk '{print $2}'`
308 RO_TENANT_ID=`lxc exec RO -- openmano tenant-list osm |awk '{print $1}'`
309
310 echo -e " Configuring MON"
311 #Information to be added about SO socket for logging
312
313 echo -e " Configuring SO"
314 sudo route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP
315 sudo sed -i "$ i route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP" /etc/rc.local
316 # make journaling persistent
317 lxc exec SO-ub -- mkdir -p /var/log/journal
318 lxc exec SO-ub -- systemd-tmpfiles --create --prefix /var/log/journal
319 lxc exec SO-ub -- systemctl restart systemd-journald
320
321 echo RIFT_EXTERNAL_ADDRESS=$DEFAULT_IP | lxc exec SO-ub -- tee -a /usr/rift/etc/default/launchpad
322
323 lxc exec SO-ub -- systemctl restart launchpad
324
325 so_is_up $SO_CONTAINER_IP
326
327 #delete existing config agent (could be there on reconfigure)
328 curl -k --request DELETE \
329 --url https://$SO_CONTAINER_IP:8008/api/config/config-agent/account/osmjuju \
330 --header 'accept: application/vnd.yang.data+json' \
331 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
332 --header 'cache-control: no-cache' \
333 --header 'content-type: application/vnd.yang.data+json' &> /dev/null
334
335 result=$(curl -k --request POST \
336 --url https://$SO_CONTAINER_IP:8008/api/config/config-agent \
337 --header 'accept: application/vnd.yang.data+json' \
338 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
339 --header 'cache-control: no-cache' \
340 --header 'content-type: application/vnd.yang.data+json' \
341 --data '{"account": [ { "name": "osmjuju", "account-type": "juju", "juju": { "ip-address": "'$JUJU_CONTROLLER_IP'", "port": "17070", "user": "admin", "secret": "'$JUJU_PASSWD'" } } ]}')
342 [[ $result =~ .*success.* ]] || FATAL "Failed config-agent configuration: $result"
343
344 #R1/R2 config line
345 #result=$(curl -k --request PUT \
346 # --url https://$SO_CONTAINER_IP:8008/api/config/resource-orchestrator \
347 # --header 'accept: application/vnd.yang.data+json' \
348 # --header 'authorization: Basic YWRtaW46YWRtaW4=' \
349 # --header 'cache-control: no-cache' \
350 # --header 'content-type: application/vnd.yang.data+json' \
351 # --data '{ "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'" }, "name": "osmopenmano", "account-type": "openmano" }')
352
353 result=$(curl -k --request PUT \
354 --url https://$SO_CONTAINER_IP:8008/api/config/project/default/ro-account/account \
355 --header 'accept: application/vnd.yang.data+json' \
356 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
357 --header 'cache-control: no-cache' \
358 --header 'content-type: application/vnd.yang.data+json' \
359 --data '{"rw-ro-account:account": [ { "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'"}, "name": "osmopenmano", "ro-account-type": "openmano" }]}')
360 [[ $result =~ .*success.* ]] || FATAL "Failed resource-orchestrator configuration: $result"
361
362 result=$(curl -k --request PATCH \
363 --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/redirect-uri \
364 --header 'accept: application/vnd.yang.data+json' \
365 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
366 --header 'cache-control: no-cache' \
367 --header 'content-type: application/vnd.yang.data+json' \
368 --data '{"redirect-uri": "https://'$DEFAULT_IP':8443/callback" }')
369 [[ $result =~ .*success.* ]] || FATAL "Failed redirect-uri configuration: $result"
370
371 result=$(curl -k --request PATCH \
372 --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/post-logout-redirect-uri \
373 --header 'accept: application/vnd.yang.data+json' \
374 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
375 --header 'cache-control: no-cache' \
376 --header 'content-type: application/vnd.yang.data+json' \
377 --data '{"post-logout-redirect-uri": "https://'$DEFAULT_IP':8443/?api_server=https://'$DEFAULT_IP'" }')
378 [[ $result =~ .*success.* ]] || FATAL "Failed post-logout-redirect-uri configuration: $result"
379
380 lxc exec SO-ub -- tee /etc/network/interfaces.d/60-rift.cfg <<EOF
381 auto lo:1
382 iface lo:1 inet static
383 address $DEFAULT_IP
384 netmask 255.255.255.255
385 EOF
386 lxc exec SO-ub ifup lo:1
387 }
388
389 #Configure RO, VCA, and SO with the initial configuration:
390 # RO -> tenant:osm, logs to be sent to SO
391 # VCA -> juju-password
392 # SO -> route to Juju Controller, add RO account, add VCA account
393 function configure(){
394 #Configure components
395 echo -e "\nConfiguring components"
396 configure_RO
397 configure_VCA
398 configure_SOUI
399 }
400
401 function install_lxd() {
402 sudo apt-get update
403 sudo apt-get install -y lxd
404 newgrp lxd
405 lxd init --auto
406 lxd waitready
407 lxc network create lxdbr0 ipv4.address=auto ipv4.nat=true ipv6.address=none ipv6.nat=false
408 DEFAULT_INTERFACE=$(route -n | awk '$1~/^0.0.0.0/ {print $8}')
409 DEFAULT_MTU=$(ip addr show $DEFAULT_INTERFACE | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
410 lxc profile device set default eth0 mtu $DEFAULT_MTU
411 #sudo systemctl stop lxd-bridge
412 #sudo systemctl --system daemon-reload
413 #sudo systemctl enable lxd-bridge
414 #sudo systemctl start lxd-bridge
415 }
416
417 function ask_user(){
418 # ask to the user and parse a response among 'y', 'yes', 'n' or 'no'. Case insensitive
419 # Params: $1 text to ask; $2 Action by default, can be 'y' for yes, 'n' for no, other or empty for not allowed
420 # Return: true(0) if user type 'yes'; false (1) if user type 'no'
421 read -e -p "$1" USER_CONFIRMATION
422 while true ; do
423 [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'y' ] && return 0
424 [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'n' ] && return 1
425 [ "${USER_CONFIRMATION,,}" == "yes" ] || [ "${USER_CONFIRMATION,,}" == "y" ] && return 0
426 [ "${USER_CONFIRMATION,,}" == "no" ] || [ "${USER_CONFIRMATION,,}" == "n" ] && return 1
427 read -e -p "Please type 'yes' or 'no': " USER_CONFIRMATION
428 done
429 }
430
431 function launch_container_from_lxd(){
432 export OSM_MDG=$1
433 OSM_load_config
434 export OSM_BASE_IMAGE=$2
435 if ! container_exists $OSM_BUILD_CONTAINER; then
436 CONTAINER_OPTS=""
437 [[ "$OSM_BUILD_CONTAINER_PRIVILEGED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.privileged=true"
438 [[ "$OSM_BUILD_CONTAINER_ALLOW_NESTED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.nesting=true"
439 create_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER $CONTAINER_OPTS
440 wait_container_up $OSM_BUILD_CONTAINER
441 fi
442 }
443
444 function install_osmclient(){
445 CLIENT_RELEASE=${RELEASE#"-R "}
446 CLIENT_REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
447 CLIENT_REPOSITORY=${REPOSITORY#"-r "}
448 [ -z "$REPOSITORY_BASE" ] && REPOSITORY_BASE="-u https://osm-download.etsi.org/repository/osm/debian"
449 CLIENT_REPOSITORY_BASE=${REPOSITORY_BASE#"-u "}
450 key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY
451 curl $key_location | sudo apt-key add -
452 sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient"
453 sudo apt-get update
454 sudo apt-get install -y python-pip
455 sudo -H pip install pip==9.0.3
456 sudo -H pip install python-magic
457 sudo apt-get install -y python-osmclient
458 #sed 's,OSM_SOL005=[^$]*,OSM_SOL005=True,' -i ${HOME}/.bashrc
459 #echo 'export OSM_HOSTNAME=localhost' >> ${HOME}/.bashrc
460 #echo 'export OSM_SOL005=True' >> ${HOME}/.bashrc
461 [ -z "$INSTALL_LIGHTWEIGHT" ] && export OSM_HOSTNAME=`lxc list | awk '($2=="SO-ub"){print $6}'`
462 [ -z "$INSTALL_LIGHTWEIGHT" ] && export OSM_RO_HOSTNAME=`lxc list | awk '($2=="RO"){print $6}'`
463 [ -n "$INSTALL_LIGHTWEIGHT" ] && export OSM_HOSTNAME=localhost
464 echo -e "\nOSM client installed"
465 echo -e "You might be interested in adding the following OSM client env variables to your .bashrc file:"
466 echo " export OSM_HOSTNAME=${OSM_HOSTNAME}"
467 [ -n "$INSTALL_LIGHTWEIGHT" ] && echo " export OSM_SOL005=True"
468 [ -z "$INSTALL_LIGHTWEIGHT" ] && echo " export OSM_RO_HOSTNAME=${OSM_RO_HOSTNAME}"
469 return 0
470 }
471
472 function install_from_lxdimages(){
473 LXD_RELEASE=${RELEASE#"-R "}
474 if [ -n "$LXD_REPOSITORY_PATH" ]; then
475 LXD_IMAGE_DIR="$LXD_REPOSITORY_PATH"
476 else
477 LXD_IMAGE_DIR="$(mktemp -d -q --tmpdir "osmimages.XXXXXX")"
478 trap 'rm -rf "$LXD_IMAGE_DIR"' EXIT
479 fi
480 echo -e "\nDeleting previous lxd images if they exist"
481 lxc image show osm-ro &>/dev/null && lxc image delete osm-ro
482 lxc image show osm-vca &>/dev/null && lxc image delete osm-vca
483 lxc image show osm-soui &>/dev/null && lxc image delete osm-soui
484 echo -e "\nImporting osm-ro"
485 [ -z "$LXD_REPOSITORY_PATH" ] && wget -O $LXD_IMAGE_DIR/osm-ro.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-ro.tar.gz
486 lxc image import $LXD_IMAGE_DIR/osm-ro.tar.gz --alias osm-ro
487 rm -f $LXD_IMAGE_DIR/osm-ro.tar.gz
488 echo -e "\nImporting osm-vca"
489 [ -z "$LXD_REPOSITORY_PATH" ] && wget -O $LXD_IMAGE_DIR/osm-vca.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-vca.tar.gz
490 lxc image import $LXD_IMAGE_DIR/osm-vca.tar.gz --alias osm-vca
491 rm -f $LXD_IMAGE_DIR/osm-vca.tar.gz
492 echo -e "\nImporting osm-soui"
493 [ -z "$LXD_REPOSITORY_PATH" ] && wget -O $LXD_IMAGE_DIR/osm-soui.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-soui.tar.gz
494 lxc image import $LXD_IMAGE_DIR/osm-soui.tar.gz --alias osm-soui
495 rm -f $LXD_IMAGE_DIR/osm-soui.tar.gz
496 launch_container_from_lxd RO osm-ro
497 ro_is_up && track RO
498 launch_container_from_lxd VCA osm-vca
499 vca_is_up && track VCA
500 launch_container_from_lxd MON osm-mon
501 mon_is_up && track MON
502 launch_container_from_lxd SO osm-soui
503 #so_is_up && track SOUI
504 track SOUI
505 }
506
507 function install_docker_ce() {
508 # installs and configures Docker CE
509 echo "Installing Docker CE ..."
510 sudo apt-get -qq update
511 sudo apt-get install -y apt-transport-https ca-certificates software-properties-common
512 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
513 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
514 sudo apt-get -qq update
515 sudo apt-get install -y docker-ce
516 echo "Adding user to group 'docker'"
517 sudo groupadd -f docker
518 sudo usermod -aG docker $USER
519 echo "... Docker CE installation done"
520 sleep 2
521 sudo service docker restart
522 echo "... restarted Docker service"
523 }
524
525 function install_docker_compose() {
526 # installs and configures docker-compose
527 echo "Installing Docker Compose ..."
528 sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
529 sudo chmod +x /usr/local/bin/docker-compose
530 echo "... Docker Compose installation done"
531 }
532
533 function install_juju() {
534 echo "Installing juju"
535 sudo snap install juju --classic
536 sudo dpkg-reconfigure -p medium lxd
537 sg lxd -c "juju bootstrap localhost osm"
538 echo "Finished installation of juju"
539 }
540
541 function generate_docker_images() {
542 echo "Pulling and generating docker images"
543 newgrp docker << EONG
544 docker pull wurstmeister/kafka
545 docker pull wurstmeister/zookeeper
546 docker pull mongo
547 docker pull mysql:5
548 git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/MON
549 docker build ${LWTEMPDIR}/MON -f ${LWTEMPDIR}/MON/docker/Dockerfile -t osm/mon || ! echo "cannot build MON docker image" >&2
550 docker build ${LWTEMPDIR}/MON/policy_module -f ${LWTEMPDIR}/MON/policy_module/Dockerfile -t osm/pm || ! echo "cannot build PM docker image" >&2
551 git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NBI
552 docker build ${LWTEMPDIR}/NBI -f ${LWTEMPDIR}/NBI/Dockerfile.local -t osm/nbi || ! echo "cannot build NBI docker image" >&2
553 git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO
554 docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/docker/Dockerfile-local -t osm/ro || ! echo "cannot build RO docker image" >&2
555 docker build ${LWTEMPDIR}/RO/lcm -t osm/lcm || ! echo "cannot build LCM docker image" >&2
556 git -C ${LWTEMPDIR} clone https://github.com/superfluidity/osm-light-ui.git
557 docker build ${LWTEMPDIR}/osm-light-ui -t osm/light-ui -f ${LWTEMPDIR}/osm-light-ui/code/docker/Dockerfile
558 # git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
559 # docker build ${LWTEMPDIR}/LW-UI -t osm/light-ui -f ${LWTEMPDIR}/LW-UI/Dockerfile
560 EONG
561 echo "Finished generation of docker images"
562 }
563
564 function generate_docker_env_files() {
565 echo "Generating docker env files"
566 OSMLCM_VCA_HOST=`juju show-controller|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
567 OSMLCM_VCA_SECRET=`grep password ${HOME}/.local/share/juju/accounts.yaml |awk '{print $2}'`
568 MYSQL_ROOT_PASSWORD=`date +%s | sha256sum | base64 | head -c 32`
569 echo "OSMLCM_VCA_HOST=${OSMLCM_VCA_HOST}" |sudo tee ${OSM_DEVOPS}/installers/docker/lcm.env
570 echo "OSMLCM_VCA_SECRET=${OSMLCM_VCA_SECRET}" |sudo tee -a ${OSM_DEVOPS}/installers/docker/lcm.env
571 echo "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |sudo tee ${OSM_DEVOPS}/installers/docker/ro-db.env
572 echo "RO_DB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |sudo tee ${OSM_DEVOPS}/installers/docker/ro.env
573 echo "OS_NOTIFIER_URI=http://${DEFAULT_IP}:8662" |sudo tee ${OSM_DEVOPS}/installers/docker/mon.env
574 echo "Finished generation of docker env files"
575 }
576
577 function deploy_lightweight() {
578 echo "Deploying lightweight build"
579 newgrp docker << EONG
580 docker swarm init --advertise-addr ${DEFAULT_IP}
581 docker network create --driver=overlay --attachable --opt com.docker.network.driver.mtu=${DEFAULT_MTU} netOSM
582 docker stack deploy -c ${OSM_DEVOPS}/installers/docker/docker-compose.yaml osm
583 #docker-compose -f /usr/share/osm-devops/installers/docker/docker-compose.yaml up -d
584 EONG
585 echo "Finished deployment of lightweight build"
586 }
587
588 function install_lightweight() {
589 echo "Installing lightweight build of OSM"
590 LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")"
591 trap 'rm -rf "${LWTEMPDIR}"' EXIT
592 DEFAULT_IF=`route -n |awk '$1~/^0.0.0.0/ {print $8}'`
593 DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'`
594 DEFAULT_MTU=$(ip addr show ${DEFAULT_IF} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
595 need_packages_lw="lxd"
596 echo -e "Checking required packages: $need_packages_lw"
597 dpkg -l $need_packages_lw &>/dev/null \
598 || ! echo -e "One or several required packages are not installed. Updating apt cache requires root privileges." \
599 || sudo apt-get update \
600 || FATAL "failed to run apt-get update"
601 dpkg -l $need_packages_lw &>/dev/null \
602 || ! echo -e "Installing $need_packages_lw requires root privileges." \
603 || sudo apt-get install -y $need_packages_lw \
604 || FATAL "failed to install $need_packages_lw"
605 install_juju
606 install_docker_ce
607 #install_docker_compose
608 generate_docker_images
609 generate_docker_env_files
610 deploy_lightweight
611 install_osmclient
612 return 0
613 }
614
615 function install_vimemu() {
616 # install Docker
617 install_docker_ce
618 # clone vim-emu repository (attention: branch is currently master only)
619 echo "Cloning vim-emu repository ..."
620 git clone https://osm.etsi.org/gerrit/osm/vim-emu.git
621 # build vim-emu docker
622 echo "Building vim-emu Docker container..."
623 sudo docker build -t vim-emu-img -f vim-emu/Dockerfile vim-emu/
624 # start vim-emu container as daemon
625 echo "Starting vim-emu Docker container 'vim-emu' ..."
626 sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py
627 echo "Waiting for 'vim-emu' container to start ..."
628 sleep 5
629 export VIMEMU_HOSTNAME=$(sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu)
630 echo "vim-emu running at ${VIMEMU_HOSTNAME} ..."
631 echo -e "You might be interested in adding the following OSM client env variables to your .bashrc file:"
632 echo " export OSM_HOSTNAME=${OSM_HOSTNAME}"
633 echo " export OSM_RO_HOSTNAME=${OSM_RO_HOSTNAME}"
634 echo -e "You might be interested in adding the following vim-emu env variables to your .bashrc file:"
635 echo " export VIMEMU_HOSTNAME=${VIMEMU_HOSTNAME}"
636 echo -e "\nTo add the emulated VIM to OSM you should do:"
637 echo " osm vim-create --name emu-vim1 --user username --password password --auth_url http://${VIMEMU_HOSTNAME}:6001/v2.0 --tenant tenantName --account_type openstack"
638 }
639
640 function dump_vars(){
641 echo "DEVELOP=$DEVELOP"
642 echo "INSTALL_FROM_SOURCE=$INSTALL_FROM_SOURCE"
643 echo "UNINSTALL=$UNINSTALL"
644 echo "NAT=$NAT"
645 echo "UPDATE=$UPDATE"
646 echo "RECONFIGURE=$RECONFIGURE"
647 echo "TEST_INSTALLER=$TEST_INSTALLER"
648 echo "INSTALL_VIMEMU=$INSTALL_VIMEMU"
649 echo "INSTALL_LXD=$INSTALL_LXD"
650 echo "INSTALL_FROM_LXDIMAGES=$INSTALL_FROM_LXDIMAGES"
651 echo "LXD_REPOSITORY_BASE=$LXD_REPOSITORY_BASE"
652 echo "LXD_REPOSITORY_PATH=$LXD_REPOSITORY_PATH"
653 echo "INSTALL_LIGHTWEIGHT=$INSTALL_LIGHTWEIGHT"
654 echo "RELEASE=$RELEASE"
655 echo "REPOSITORY=$REPOSITORY"
656 echo "REPOSITORY_BASE=$REPOSITORY_BASE"
657 echo "REPOSITORY_KEY=$REPOSITORY_KEY"
658 echo "NOCONFIGURE=$NOCONFIGURE"
659 echo "SHOWOPTS=$SHOWOPTS"
660 echo "Install from specific refspec (-b): $COMMIT_ID"
661 }
662
663 function track(){
664 ctime=`date +%s`
665 duration=$((ctime - SESSION_ID))
666 url="http://www.woopra.com/track/ce?project=osm.etsi.org&cookie=${SESSION_ID}"
667 #url="${url}&ce_campaign_name=${CAMPAIGN_NAME}"
668 event_name="bin"
669 [ -n "$INSTALL_FROM_SOURCE" ] && event_name="src"
670 [ -n "$INSTALL_FROM_LXDIMAGES" ] && event_name="lxd"
671 event_name="${event_name}_$1"
672 url="${url}&event=${event_name}&ce_duration=${duration}"
673 wget -q -O /dev/null $url
674 }
675
676 UNINSTALL=""
677 DEVELOP=""
678 NAT=""
679 UPDATE=""
680 RECONFIGURE=""
681 TEST_INSTALLER=""
682 INSTALL_LXD=""
683 SHOWOPTS=""
684 COMMIT_ID=""
685 ASSUME_YES=""
686 INSTALL_FROM_SOURCE=""
687 RELEASE="-R ReleaseTHREE"
688 REPOSITORY="-r stable"
689 INSTALL_VIMEMU=""
690 INSTALL_FROM_LXDIMAGES=""
691 LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd"
692 LXD_REPOSITORY_PATH=""
693 INSTALL_LIGHTWEIGHT="y"
694 NOCONFIGURE=""
695 RELEASE_DAILY=""
696 SESSION_ID=`date +%s`
697 OSM_DEVOPS=
698
699 while getopts ":hy-:b:r:k:u:R:l:p:D:" o; do
700 case "${o}" in
701 h)
702 usage && exit 0
703 ;;
704 b)
705 COMMIT_ID=${OPTARG}
706 ;;
707 r)
708 REPOSITORY="-r ${OPTARG}"
709 ;;
710 R)
711 RELEASE="-R ${OPTARG}"
712 ;;
713 k)
714 REPOSITORY_KEY="-k ${OPTARG}"
715 ;;
716 u)
717 REPOSITORY_BASE="-u ${OPTARG}"
718 ;;
719 l)
720 LXD_REPOSITORY_BASE="${OPTARG}"
721 ;;
722 p)
723 LXD_REPOSITORY_PATH="${OPTARG}"
724 ;;
725 D)
726 OSM_DEVOPS="${OPTARG}"
727 ;;
728 -)
729 [ "${OPTARG}" == "help" ] && usage && exit 0
730 [ "${OPTARG}" == "source" ] && INSTALL_FROM_SOURCE="y" && continue
731 [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
732 [ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue
733 [ "${OPTARG}" == "nat" ] && NAT="y" && continue
734 [ "${OPTARG}" == "update" ] && UPDATE="y" && continue
735 [ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue
736 [ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue
737 [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue
738 [ "${OPTARG}" == "lxdimages" ] && INSTALL_FROM_LXDIMAGES="y" && continue
739 [ "${OPTARG}" == "lightweight" ] && INSTALL_LIGHTWEIGHT="y" && continue
740 [ "${OPTARG}" == "soui" ] && INSTALL_LIGHTWEIGHT="" && && continue
741 [ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue
742 [ "${OPTARG}" == "noconfigure" ] && NOCONFIGURE="y" && continue
743 [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue
744 [ "${OPTARG}" == "daily" ] && RELEASE_DAILY="y" && continue
745 echo -e "Invalid option: '--$OPTARG'\n" >&2
746 usage && exit 1
747 ;;
748 \?)
749 echo -e "Invalid option: '-$OPTARG'\n" >&2
750 usage && exit 1
751 ;;
752 y)
753 ASSUME_YES="y"
754 ;;
755 *)
756 usage && exit 1
757 ;;
758 esac
759 done
760
761 if [ -n "$SHOWOPTS" ]; then
762 dump_vars
763 exit 0
764 fi
765
766 [ -n "$RELEASE_DAILY" ] && echo -e "\nInstalling from daily build repo" && RELEASE="-R ReleaseTHREE-daily" && REPOSITORY="-r testing" && COMMIT_ID="master"
767
768 # if develop, we force master
769 [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
770
771 # forcing source from master removed. Now only install from source when explicit
772 # [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y"
773
774 if [ -z "$OSM_DEVOPS" ]; then
775 if [ -n "$TEST_INSTALLER" ]; then
776 echo -e "\nUsing local devops repo for OSM installation"
777 TEMPDIR="$(dirname $(realpath $(dirname $0)))"
778 else
779 echo -e "\nCreating temporary dir for OSM installation"
780 TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
781 trap 'rm -rf "$TEMPDIR"' EXIT
782 fi
783 fi
784
785 need_packages="git jq wget curl tar"
786 echo -e "Checking required packages: $need_packages"
787 dpkg -l $need_packages &>/dev/null \
788 || ! echo -e "One or several required packages are not installed. Updating apt cache requires root privileges." \
789 || sudo apt-get update \
790 || FATAL "failed to run apt-get update"
791 dpkg -l $need_packages &>/dev/null \
792 || ! echo -e "Installing $need_packages requires root privileges." \
793 || sudo apt-get install -y $need_packages \
794 || FATAL "failed to install $need_packages"
795
796 if [ -z "$OSM_DEVOPS" ]; then
797 if [ -z "$TEST_INSTALLER" ]; then
798 echo -e "\nCloning devops repo temporarily"
799 git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
800 RC_CLONE=$?
801 fi
802
803 echo -e "\nGuessing the current stable release"
804 LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | sort -V | tail -n1`
805 [ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
806 echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
807 [ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
808
809 if [ -n "$RELEASE_DAILY" ]; then
810 echo "Using master/HEAD devops"
811 git -C $TEMPDIR checkout master
812 elif [ -z "$TEST_INSTALLER" ]; then
813 git -C $TEMPDIR checkout tags/$LATEST_STABLE_DEVOPS
814 fi
815 OSM_DEVOPS=$TEMPDIR
816 fi
817
818 OSM_JENKINS="$OSM_DEVOPS/jenkins"
819 . $OSM_JENKINS/common/all_funcs
820
821 [ -n "$INSTALL_LIGHTWEIGHT" ] && [ -n "$UNINSTALL" ] && uninstall_lightweight && echo -e "\nDONE" && exit 0
822 [ -n "$UNINSTALL" ] && uninstall && echo -e "\nDONE" && exit 0
823 [ -n "$NAT" ] && nat && echo -e "\nDONE" && exit 0
824 [ -n "$UPDATE" ] && update && echo -e "\nDONE" && exit 0
825 [ -n "$RECONFIGURE" ] && configure && echo -e "\nDONE" && exit 0
826
827 #Installation starts here
828 [ -n "$INSTALL_LIGHTWEIGHT" ] && install_lightweight && echo -e "\nDONE" && exit 0
829 echo -e "\nInstalling OSM from refspec: $COMMIT_ID"
830 if [ -n "$INSTALL_FROM_SOURCE" ] && [ -z "$ASSUME_YES" ]; then
831 ! ask_user "The installation will take about 75-90 minutes. Continue (Y/n)? " y && echo "Cancelled!" && exit 1
832 fi
833
834 echo -e "Checking required packages: lxd"
835 lxd --version &>/dev/null || FATAL "lxd not present, exiting."
836 [ -n "$INSTALL_LXD" ] && echo -e "\nInstalling and configuring lxd" && install_lxd
837
838 wget -q -O- https://osm-download.etsi.org/ftp/osm-4.0-four/README.txt &> /dev/null
839 track start
840
841 # use local devops for containers
842 export OSM_USE_LOCAL_DEVOPS=true
843 if [ -n "$INSTALL_FROM_SOURCE" ]; then #install from source
844 echo -e "\nCreating the containers and building from source ..."
845 $OSM_DEVOPS/jenkins/host/start_build RO --notest checkout $COMMIT_ID || FATAL "RO container build failed (refspec: '$COMMIT_ID')"
846 ro_is_up && track RO
847 $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA container build failed"
848 vca_is_up && track VCA
849 $OSM_DEVOPS/jenkins/host/start_build MON || FATAL "MON install failed"
850 mon_is_up && track MON
851 $OSM_DEVOPS/jenkins/host/start_build SO checkout $COMMIT_ID || FATAL "SO container build failed (refspec: '$COMMIT_ID')"
852 $OSM_DEVOPS/jenkins/host/start_build UI checkout $COMMIT_ID || FATAL "UI container build failed (refspec: '$COMMIT_ID')"
853 #so_is_up && track SOUI
854 track SOUI
855 elif [ -n "$INSTALL_FROM_LXDIMAGES" ]; then #install from LXD images stored in OSM repo
856 echo -e "\nInstalling from lxd images ..."
857 install_from_lxdimages
858 else #install from binaries
859 echo -e "\nCreating the containers and installing from binaries ..."
860 $OSM_DEVOPS/jenkins/host/install RO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "RO install failed"
861 ro_is_up && track RO
862 $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA install failed"
863 vca_is_up && track VCA
864 $OSM_DEVOPS/jenkins/host/install MON || FATAL "MON build failed"
865 mon_is_up && track MON
866 $OSM_DEVOPS/jenkins/host/install SO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "SO install failed"
867 $OSM_DEVOPS/jenkins/host/install UI $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "UI install failed"
868 #so_is_up && track SOUI
869 track SOUI
870 fi
871
872 #Install iptables-persistent and configure NAT rules
873 [ -z "$NOCONFIGURE" ] && nat
874
875 #Configure components
876 [ -z "$NOCONFIGURE" ] && configure
877
878 #Install osmclient
879 [ -z "$NOCONFIGURE" ] && install_osmclient
880
881 #Install vim-emu (optional)
882 if [ -n "$INSTALL_VIMEMU" ]; then
883 echo -e "\nInstalling vim-emu ..."
884 install_vimemu
885 fi
886
887 wget -q -O- https://osm-download.etsi.org/ftp/osm-4.0-four/README2.txt &> /dev/null
888 track end
889 echo -e "\nDONE"
890