blob: 7175793f4c76f000e23deea7cbe9d625ef56d310 [file] [log] [blame]
garciadeblas93c61312016-09-28 15:12:48 +02001#!/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
16function usage(){
17 echo -e "usage: $0 [OPTIONS]"
garciadeblasa1fc4572017-04-24 19:08:21 +020018 echo -e "Install OSM from binaries or source code (by default, from binaries)"
garciadeblas93c61312016-09-28 15:12:48 +020019 echo -e " OPTIONS"
garciadeblas0d934c12017-11-17 15:39:17 +010020 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"
Mike Marchetti425f8ce2017-06-15 13:02:16 -040022 echo -e " -r <repo>: use specified repository name for osm packages"
garciadeblas0d934c12017-11-17 15:39:17 +010023 echo -e " -R <release>: use specified release for osm binaries (deb packages, lxd images, ...)"
Mike Marchetti425f8ce2017-06-15 13:02:16 -040024 echo -e " -u <repo base>: use specified repository url for osm packages"
25 echo -e " -k <repo key>: use specified repository public key url"
garciadeblas0d934c12017-11-17 15:39:17 +010026 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"
peustermd74dc842018-01-24 15:32:17 +010033 echo -e " --vimemu: additionally fetch, build, and deploy the VIM emulator as a docker container"
garciadeblas0d934c12017-11-17 15:39:17 +010034 echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch"
35# echo -e " --reconfigure: reconfigure the modules (DO NOT change NAT rules)"
36 echo -e " --nat: install only NAT rules"
37 echo -e " --noconfigure: DO NOT install osmclient, DO NOT install NAT rules, DO NOT configure modules"
38# echo -e " --update: update to the latest stable release or to the latest commit if using a specific branch"
39 echo -e " --showopts: print chosen options and exit (only for debugging)"
40 echo -e " -y: do not prompt for confirmation, assumes yes"
41 echo -e " -h / --help: print this help"
garciadeblas93c61312016-09-28 15:12:48 +020042}
43
garciadeblas55490d42016-10-29 14:22:03 +020044#Uninstall OSM: remove containers
45function uninstall(){
garciadeblasa1fc4572017-04-24 19:08:21 +020046 echo -e "\nUninstalling OSM"
garciadeblas55490d42016-10-29 14:22:03 +020047 if [ $RC_CLONE ] || [ -n "$TEST_INSTALLER" ]; then
48 $OSM_DEVOPS/jenkins/host/clean_container RO
49 $OSM_DEVOPS/jenkins/host/clean_container VCA
50 $OSM_DEVOPS/jenkins/host/clean_container SO
51 #$OSM_DEVOPS/jenkins/host/clean_container UI
52 else
53 lxc stop RO && lxc delete RO
54 lxc stop VCA && lxc delete VCA
55 lxc stop SO-ub && lxc delete SO-ub
56 fi
garciadeblas54e7eed2018-03-19 17:38:04 +010057 echo -e "\nDeleting imported lxd images if they exist"
58 lxc image show osm-ro &>/dev/null && lxc image delete osm-ro
59 lxc image show osm-vca &>/dev/null && lxc image delete osm-vca
60 lxc image show osm-soui &>/dev/null && lxc image delete osm-soui
garciadeblas55490d42016-10-29 14:22:03 +020061}
62
63#Configure NAT rules, based on the current IP addresses of containers
64function nat(){
65 echo -e "\nChecking required packages: iptables-persistent"
66 dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \
67 sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install iptables-persistent
68 echo -e "\nConfiguring NAT rules"
69 echo -e " Required root privileges"
70 sudo $OSM_DEVOPS/installers/nat_osm
71}
72
Mike Marchettid8577f52017-10-19 15:27:48 -040073function FATAL(){
74 echo "FATAL error: Cannot install OSM due to \"$1\""
75 exit 1
76}
77
garciadeblas2a382732017-01-12 12:11:14 +010078#Update RO, SO and UI:
79function update(){
80 echo -e "\nUpdating components"
81
82 echo -e " Updating RO"
83 CONTAINER="RO"
84 MDG="RO"
85 INSTALL_FOLDER="/opt/openmano"
86 echo -e " Fetching the repo"
87 lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all
88 BRANCH=""
89 BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'`
Jokin Garayc17db012017-03-08 17:45:39 +010090 [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'"
garciadeblas2a382732017-01-12 12:11:14 +010091 CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1`
92 CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD`
93 echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)"
94 # COMMIT_ID either was previously set with -b option, or is an empty string
95 CHECKOUT_ID=$COMMIT_ID
96 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS"
97 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH"
98 if [[ $CHECKOUT_ID == "tags/"* ]]; then
99 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID`
100 else
101 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID`
102 fi
103 echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)"
104 if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then
105 echo " Nothing to be done."
106 else
107 echo " Update required."
garciadeblasa1fc4572017-04-24 19:08:21 +0200108 lxc exec $CONTAINER -- service osm-ro stop
garciadeblas2a382732017-01-12 12:11:14 +0100109 lxc exec $CONTAINER -- git -C /opt/openmano stash
110 lxc exec $CONTAINER -- git -C /opt/openmano pull --rebase
111 lxc exec $CONTAINER -- git -C /opt/openmano checkout $CHECKOUT_ID
112 lxc exec $CONTAINER -- git -C /opt/openmano stash pop
113 lxc exec $CONTAINER -- /opt/openmano/database_utils/migrate_mano_db.sh
garciadeblasa1fc4572017-04-24 19:08:21 +0200114 lxc exec $CONTAINER -- service osm-ro start
garciadeblas2a382732017-01-12 12:11:14 +0100115 fi
116 echo
117
118 echo -e " Updating SO and UI"
119 CONTAINER="SO-ub"
120 MDG="SO"
121 INSTALL_FOLDER="" # To be filled in
122 echo -e " Fetching the repo"
123 lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all
124 BRANCH=""
125 BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'`
Jokin Garayc17db012017-03-08 17:45:39 +0100126 [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'"
garciadeblas2a382732017-01-12 12:11:14 +0100127 CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1`
128 CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD`
129 echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)"
130 # COMMIT_ID either was previously set with -b option, or is an empty string
131 CHECKOUT_ID=$COMMIT_ID
132 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS"
133 [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH"
134 if [[ $CHECKOUT_ID == "tags/"* ]]; then
135 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID`
136 else
137 REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID`
138 fi
139 echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)"
140 if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then
141 echo " Nothing to be done."
142 else
143 echo " Update required."
144 # Instructions to be added
145 # lxc exec SO-ub -- ...
146 fi
147 echo
148}
149
Mike Marchetti2b951282017-10-10 15:43:15 -0400150function so_is_up() {
garciadeblas0d934c12017-11-17 15:39:17 +0100151 if [ -n "$1" ]; then
152 SO_IP=$1
153 else
154 SO_IP=`lxc list SO-ub -c 4|grep eth0 |awk '{print $2}'`
155 fi
Mike Marchetti6930bc02017-05-31 16:33:02 -0400156 time=0
157 step=5
158 timelength=300
159 while [ $time -le $timelength ]
160 do
Mike Marchetti2b951282017-10-10 15:43:15 -0400161 if [[ `curl -k -X GET https://$SO_IP:8008/api/operational/vcs/info \
162 -H 'accept: application/vnd.yang.data+json' \
163 -H 'authorization: Basic YWRtaW46YWRtaW4=' \
164 -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 ]]
165 then
166 echo "RW.Restconf running....SO is up"
167 return 0
Mike Marchetti6930bc02017-05-31 16:33:02 -0400168 fi
Mike Marchetti2b951282017-10-10 15:43:15 -0400169
Mike Marchetti6930bc02017-05-31 16:33:02 -0400170 sleep $step
171 echo -n "."
172 time=$((time+step))
173 done
Mike Marchetti2b951282017-10-10 15:43:15 -0400174
garciadeblas0d934c12017-11-17 15:39:17 +0100175 FATAL "OSM Failed to startup. SO failed to startup"
Mike Marchetti6930bc02017-05-31 16:33:02 -0400176}
177
garciadeblas0d934c12017-11-17 15:39:17 +0100178function vca_is_up() {
179 if [[ `lxc exec VCA -- juju status | grep "osm" | wc -l` -eq 1 ]]; then
180 echo "VCA is up and running"
181 return 0
182 fi
garciadeblas55490d42016-10-29 14:22:03 +0200183
garciadeblas0d934c12017-11-17 15:39:17 +0100184 FATAL "OSM Failed to startup. VCA failed to startup"
185}
186
187function ro_is_up() {
188 if [ -n "$1" ]; then
189 RO_IP=$1
190 else
191 RO_IP=`lxc list RO -c 4|grep eth0 |awk '{print $2}'`
192 fi
193 time=0
194 step=2
195 timelength=20
196 while [ $time -le $timelength ]; do
197 if [[ `curl http://$RO_IP:9090/openmano/ | grep "works" | wc -l` -eq 1 ]]; then
198 echo "RO is up and running"
199 return 0
200 fi
201 sleep $step
202 echo -n "."
203 time=$((time+step))
204 done
205
206 FATAL "OSM Failed to startup. RO failed to startup"
207}
208
209
210function configure_RO(){
211 . $OSM_DEVOPS/installers/export_ips
garciadeblas55490d42016-10-29 14:22:03 +0200212 echo -e " Configuring RO"
garciadeblasa1fc4572017-04-24 19:08:21 +0200213 lxc exec RO -- sed -i -e "s/^\#\?log_socket_host:.*/log_socket_host: $SO_CONTAINER_IP/g" /etc/osm/openmanod.cfg
214 lxc exec RO -- service osm-ro restart
Mike Marchetti6930bc02017-05-31 16:33:02 -0400215
garciadeblas0d934c12017-11-17 15:39:17 +0100216 ro_is_up
Mike Marchetti6930bc02017-05-31 16:33:02 -0400217
garciadeblasd8718f12016-10-30 19:39:01 +0100218 lxc exec RO -- openmano tenant-delete -f osm >/dev/null
garciadeblas1b7107e2017-12-21 15:32:02 +0100219 lxc exec RO -- openmano tenant-create osm > /dev/null
tierno15f4f222017-06-14 13:23:01 +0200220 lxc exec RO -- sed -i '/export OPENMANO_TENANT=osm/d' .bashrc
221 lxc exec RO -- sed -i '$ i export OPENMANO_TENANT=osm' .bashrc
garciadeblas1b7107e2017-12-21 15:32:02 +0100222 lxc exec RO -- sh -c 'echo "export OPENMANO_TENANT=osm" >> .bashrc'
garciadeblas0d934c12017-11-17 15:39:17 +0100223}
garciadeblas55490d42016-10-29 14:22:03 +0200224
garciadeblas0d934c12017-11-17 15:39:17 +0100225function configure_VCA(){
garciadeblas55490d42016-10-29 14:22:03 +0200226 echo -e " Configuring VCA"
227 JUJU_PASSWD=`date +%s | sha256sum | base64 | head -c 32`
228 echo -e "$JUJU_PASSWD\n$JUJU_PASSWD" | lxc exec VCA -- juju change-user-password
garciadeblas0d934c12017-11-17 15:39:17 +0100229}
230
231function configure_SOUI(){
232 . $OSM_DEVOPS/installers/export_ips
garciadeblas55490d42016-10-29 14:22:03 +0200233 JUJU_CONTROLLER_IP=`lxc exec VCA -- lxc list -c 4 |grep eth0 |awk '{print $2}'`
garciadeblas1b7107e2017-12-21 15:32:02 +0100234 RO_TENANT_ID=`lxc exec RO -- openmano tenant-list osm |awk '{print $1}'`
garciadeblas55490d42016-10-29 14:22:03 +0200235
236 echo -e " Configuring SO"
237 sudo route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP
garciadeblas2f4c93b2017-04-10 18:12:12 +0200238 sudo sed -i "$ i route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP" /etc/rc.local
Jeremy Mordkoff5cc6ccc2017-10-05 15:21:07 -0400239 # make journaling persistent
240 lxc exec SO-ub -- mkdir -p /var/log/journal
241 lxc exec SO-ub -- systemd-tmpfiles --create --prefix /var/log/journal
242 lxc exec SO-ub -- systemctl restart systemd-journald
243
Jeremy Mordkoff3b3edea2017-10-03 16:21:56 -0400244 echo RIFT_EXTERNAL_ADDRESS=$DEFAULT_IP | lxc exec SO-ub -- tee -a /usr/rift/etc/default/launchpad
245
Mike Marchetti6930bc02017-05-31 16:33:02 -0400246 lxc exec SO-ub -- systemctl restart launchpad
garciadeblas55490d42016-10-29 14:22:03 +0200247
Mike Marchetti6930bc02017-05-31 16:33:02 -0400248 so_is_up $SO_CONTAINER_IP
249
250 #delete existing config agent (could be there on reconfigure)
251 curl -k --request DELETE \
252 --url https://$SO_CONTAINER_IP:8008/api/config/config-agent/account/osmjuju \
253 --header 'accept: application/vnd.yang.data+json' \
254 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
255 --header 'cache-control: no-cache' \
256 --header 'content-type: application/vnd.yang.data+json' &> /dev/null
257
258 result=$(curl -k --request POST \
garciadeblas55490d42016-10-29 14:22:03 +0200259 --url https://$SO_CONTAINER_IP:8008/api/config/config-agent \
260 --header 'accept: application/vnd.yang.data+json' \
261 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
262 --header 'cache-control: no-cache' \
263 --header 'content-type: application/vnd.yang.data+json' \
Mike Marchetti6930bc02017-05-31 16:33:02 -0400264 --data '{"account": [ { "name": "osmjuju", "account-type": "juju", "juju": { "ip-address": "'$JUJU_CONTROLLER_IP'", "port": "17070", "user": "admin", "secret": "'$JUJU_PASSWD'" } } ]}')
265 [[ $result =~ .*success.* ]] || FATAL "Failed config-agent configuration: $result"
garciadeblas55490d42016-10-29 14:22:03 +0200266
Mike Marchetti397a65d2017-10-02 22:36:16 -0400267 #R1/R2 config line
268 #result=$(curl -k --request PUT \
269 # --url https://$SO_CONTAINER_IP:8008/api/config/resource-orchestrator \
270 # --header 'accept: application/vnd.yang.data+json' \
271 # --header 'authorization: Basic YWRtaW46YWRtaW4=' \
272 # --header 'cache-control: no-cache' \
273 # --header 'content-type: application/vnd.yang.data+json' \
274 # --data '{ "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'" }, "name": "osmopenmano", "account-type": "openmano" }')
275
Mike Marchetti6930bc02017-05-31 16:33:02 -0400276 result=$(curl -k --request PUT \
Mike Marchetti397a65d2017-10-02 22:36:16 -0400277 --url https://$SO_CONTAINER_IP:8008/api/config/project/default/ro-account/account \
garciadeblas55490d42016-10-29 14:22:03 +0200278 --header 'accept: application/vnd.yang.data+json' \
279 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
Mike Marchetti397a65d2017-10-02 22:36:16 -0400280 --header 'cache-control: no-cache' \
garciadeblas55490d42016-10-29 14:22:03 +0200281 --header 'content-type: application/vnd.yang.data+json' \
Mike Marchetti397a65d2017-10-02 22:36:16 -0400282 --data '{"rw-ro-account:account": [ { "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'"}, "name": "osmopenmano", "ro-account-type": "openmano" }]}')
Mike Marchetti6930bc02017-05-31 16:33:02 -0400283 [[ $result =~ .*success.* ]] || FATAL "Failed resource-orchestrator configuration: $result"
Jeremy Mordkoff2059b392017-10-03 17:34:10 -0400284
Jeremy Mordkoff34151f22017-10-04 19:45:37 -0400285 result=$(curl -k --request PATCH \
286 --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/redirect-uri \
287 --header 'accept: application/vnd.yang.data+json' \
288 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
289 --header 'cache-control: no-cache' \
290 --header 'content-type: application/vnd.yang.data+json' \
291 --data '{"redirect-uri": "https://'$DEFAULT_IP':8443/callback" }')
292 [[ $result =~ .*success.* ]] || FATAL "Failed redirect-uri configuration: $result"
293
294 result=$(curl -k --request PATCH \
295 --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/post-logout-redirect-uri \
296 --header 'accept: application/vnd.yang.data+json' \
297 --header 'authorization: Basic YWRtaW46YWRtaW4=' \
298 --header 'cache-control: no-cache' \
299 --header 'content-type: application/vnd.yang.data+json' \
300 --data '{"post-logout-redirect-uri": "https://'$DEFAULT_IP':8443/?api_server=https://'$DEFAULT_IP'" }')
301 [[ $result =~ .*success.* ]] || FATAL "Failed post-logout-redirect-uri configuration: $result"
302
Jeremy Mordkofff4b6e622017-10-04 12:05:41 -0400303 lxc exec SO-ub -- tee /etc/network/interfaces.d/60-rift.cfg <<EOF
304auto lo:1
305iface lo:1 inet static
306 address $DEFAULT_IP
307 netmask 255.255.255.255
308EOF
309 lxc exec SO-ub ifup lo:1
garciadeblas0d934c12017-11-17 15:39:17 +0100310}
Jeremy Mordkoff2059b392017-10-03 17:34:10 -0400311
garciadeblas0d934c12017-11-17 15:39:17 +0100312#Configure RO, VCA, and SO with the initial configuration:
313# RO -> tenant:osm, logs to be sent to SO
314# VCA -> juju-password
315# SO -> route to Juju Controller, add RO account, add VCA account
316function configure(){
317 #Configure components
318 echo -e "\nConfiguring components"
319 configure_RO
320 configure_VCA
321 configure_SOUI
garciadeblas55490d42016-10-29 14:22:03 +0200322}
323
garciadeblas2a5a6512016-12-19 10:19:52 +0100324function install_lxd() {
garciadeblas0d934c12017-11-17 15:39:17 +0100325 sudo apt-get update
326 sudo apt-get install -y lxd
327 newgrp lxd
garciadeblas2a5a6512016-12-19 10:19:52 +0100328 lxd init --auto
329 lxd waitready
garciadeblas0d934c12017-11-17 15:39:17 +0100330 lxc network create lxdbr0 ipv4.address=auto ipv4.nat=true ipv6.address=none ipv6.nat=false
331 DEFAULT_INTERFACE=$(route -n | awk '$1~/^0.0.0.0/ {print $8}')
332 DEFAULT_MTU=$( ip addr show $DEFAULT_INTERFACE | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
333 lxc profile device set default eth0 mtu $DEFAULT_MTU
334 #sudo systemctl stop lxd-bridge
335 #sudo systemctl --system daemon-reload
336 #sudo systemctl enable lxd-bridge
337 #sudo systemctl start lxd-bridge
garciadeblas2a5a6512016-12-19 10:19:52 +0100338}
339
tierno53881d72017-04-25 11:58:57 +0200340function ask_user(){
341 # ask to the user and parse a response among 'y', 'yes', 'n' or 'no'. Case insensitive
342 # Params: $1 text to ask; $2 Action by default, can be 'y' for yes, 'n' for no, other or empty for not allowed
343 # Return: true(0) if user type 'yes'; false (1) if user type 'no'
344 read -e -p "$1" USER_CONFIRMATION
345 while true ; do
346 [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'y' ] && return 0
347 [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'n' ] && return 1
348 [ "${USER_CONFIRMATION,,}" == "yes" ] || [ "${USER_CONFIRMATION,,}" == "y" ] && return 0
349 [ "${USER_CONFIRMATION,,}" == "no" ] || [ "${USER_CONFIRMATION,,}" == "n" ] && return 1
350 read -e -p "Please type 'yes' or 'no': " USER_CONFIRMATION
351 done
352}
garciadeblas2a5a6512016-12-19 10:19:52 +0100353
garciadeblas0d934c12017-11-17 15:39:17 +0100354function launch_container_from_lxd(){
355 export OSM_MDG=$1
356 OSM_load_config
357 export OSM_BASE_IMAGE=$2
358 if ! container_exists $OSM_BUILD_CONTAINER; then
359 CONTAINER_OPTS=""
360 [[ "$OSM_BUILD_CONTAINER_PRIVILEGED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.privileged=true"
361 [[ "$OSM_BUILD_CONTAINER_ALLOW_NESTED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.nesting=true"
362 create_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER $CONTAINER_OPTS
363 wait_container_up $OSM_BUILD_CONTAINER
364 fi
365}
366
367function install_osmclient(){
368 CLIENT_RELEASE=${RELEASE#"-R "}
369 CLIENT_REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
370 CLIENT_REPOSITORY="stable"
371 [ -z "$REPOSITORY_BASE" ] && REPOSITORY_BASE="-u https://osm-download.etsi.org/repository/osm/debian"
372 CLIENT_REPOSITORY_BASE=${REPOSITORY_BASE#"-u "}
373 key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY
374 curl $key_location | sudo apt-key add -
375 sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient"
376 sudo apt-get update
377 sudo apt-get install -y python-osmclient
378 export OSM_HOSTNAME=`lxc list | awk '($2=="SO-ub"){print $6}'`
379 export OSM_RO_HOSTNAME=`lxc list | awk '($2=="RO"){print $6}'`
380 echo -e "\nOSM client installed"
381 echo -e "You might be interested in adding the following OSM client env variables to your .bashrc file:"
382 echo " export OSM_HOSTNAME=${OSM_HOSTNAME}"
383 echo " export OSM_RO_HOSTNAME=${OSM_RO_HOSTNAME}"
384}
385
386function install_from_lxdimages(){
387 LXD_RELEASE=${RELEASE#"-R "}
388 LXD_IMAGE_DIR="$(mktemp -d -q --tmpdir "osmimages.XXXXXX")"
389 trap 'rm -rf "$LXD_IMAGE_DIR"' EXIT
390 wget -O $LXD_IMAGE_DIR/osm-ro.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-ro.tar.gz
garciadeblas54e7eed2018-03-19 17:38:04 +0100391 echo -e "\nDeleting previous lxd images if they exist"
392 lxc image show osm-ro &>/dev/null && lxc image delete osm-ro
393 lxc image show osm-vca &>/dev/null && lxc image delete osm-vca
394 lxc image show osm-soui &>/dev/null && lxc image delete osm-soui
395 echo -e "\nImporting osm-ro"
garciadeblas0d934c12017-11-17 15:39:17 +0100396 lxc image import $LXD_IMAGE_DIR/osm-ro.tar.gz --alias osm-ro
397 rm -f $LXD_IMAGE_DIR/osm-ro.tar.gz
398 wget -O $LXD_IMAGE_DIR/osm-vca.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-vca.tar.gz
garciadeblas54e7eed2018-03-19 17:38:04 +0100399 echo -e "\nImporting osm-vca"
garciadeblas0d934c12017-11-17 15:39:17 +0100400 lxc image import $LXD_IMAGE_DIR/osm-vca.tar.gz --alias osm-vca
401 rm -f $LXD_IMAGE_DIR/osm-vca.tar.gz
garciadeblas54e7eed2018-03-19 17:38:04 +0100402 echo -e "\nImporting osm-soui"
garciadeblas0d934c12017-11-17 15:39:17 +0100403 wget -O $LXD_IMAGE_DIR/osm-soui.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-soui.tar.gz
404 lxc image import $LXD_IMAGE_DIR/osm-soui.tar.gz --alias osm-soui
405 rm -f $LXD_IMAGE_DIR/osm-soui.tar.gz
406 launch_container_from_lxd RO osm-ro
407 ro_is_up && track RO
408 launch_container_from_lxd VCA osm-vca
409 vca_is_up && track VCA
410 launch_container_from_lxd SO osm-soui
411 #so_is_up && track SOUI
412 track SOUI
413}
414
peusterm3a3e7a52017-12-22 13:10:54 +0100415function install_docker_ce() {
416 # installs and configures Docker CE
417 echo "Installing Docker CE ..."
peusterme2c017e2018-02-07 11:51:11 +0100418 sudo apt-get -qq update
419 sudo apt-get install -y apt-transport-https ca-certificates software-properties-common
peusterm3a3e7a52017-12-22 13:10:54 +0100420 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
421 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
422 sudo apt-get -qq update
peusterme2c017e2018-02-07 11:51:11 +0100423 sudo apt-get install -y docker-ce
peusterm3a3e7a52017-12-22 13:10:54 +0100424 echo "Adding user to group 'docker'"
peusterme2c017e2018-02-07 11:51:11 +0100425 sudo groupadd -f docker
peusterm3a3e7a52017-12-22 13:10:54 +0100426 sudo usermod -aG docker $USER
427 echo "... Docker CE installation done"
peusterme2c017e2018-02-07 11:51:11 +0100428 sleep 2
429 sudo service docker restart
430 echo "... restarted Docker service"
peusterm3a3e7a52017-12-22 13:10:54 +0100431}
432
433function install_vimemu() {
434 # install Docker
435 install_docker_ce
436 # clone vim-emu repository (attention: branch is currently master only)
437 echo "Cloning vim-emu repository ..."
438 git clone https://osm.etsi.org/gerrit/osm/vim-emu.git
439 # build vim-emu docker
440 echo "Building vim-emu Docker container..."
peusterme2c017e2018-02-07 11:51:11 +0100441 sudo docker build -t vim-emu-img -f vim-emu/Dockerfile vim-emu/
peusterm3a3e7a52017-12-22 13:10:54 +0100442 # start vim-emu container as daemon
443 echo "Starting vim-emu Docker container 'vim-emu' ..."
peusterme2c017e2018-02-07 11:51:11 +0100444 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
peusterm3a3e7a52017-12-22 13:10:54 +0100445 echo "Waiting for 'vim-emu' container to start ..."
446 sleep 5
peusterme2c017e2018-02-07 11:51:11 +0100447 export VIMEMU_HOSTNAME=$(sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu)
peusterm3a3e7a52017-12-22 13:10:54 +0100448 echo "vim-emu running at $VIMEMU_HOSTNAME ..."
peustermd74dc842018-01-24 15:32:17 +0100449 echo -e "You might be interested in adding the following OSM client env variables to your .bashrc file:"
450 echo " export OSM_HOSTNAME=${OSM_HOSTNAME}"
451 echo " export OSM_RO_HOSTNAME=${OSM_RO_HOSTNAME}"
452 echo -e "You might be interested in adding the following vim-emu env variables to your .bashrc file:"
peusterm3a3e7a52017-12-22 13:10:54 +0100453 echo " export VIMEMU_HOSTNAME=${VIMEMU_HOSTNAME}"
454 echo -e "\nTo add the emulated VIM to OSM you should do:"
peustermd74dc842018-01-24 15:32:17 +0100455 echo " osm vim-create --name emu-vim1 --user username --password password --auth_url http://$VIMEMU_HOSTNAME:6001/v2.0 --tenant tenantName --account_type openstack"
peusterm3a3e7a52017-12-22 13:10:54 +0100456}
457
garciadeblas0d934c12017-11-17 15:39:17 +0100458function dump_vars(){
459 echo "DEVELOP=$DEVELOP"
460 echo "INSTALL_FROM_SOURCE=$INSTALL_FROM_SOURCE"
461 echo "UNINSTALL=$UNINSTALL"
462 echo "NAT=$NAT"
463 echo "UPDATE=$UPDATE"
464 echo "RECONFIGURE=$RECONFIGURE"
465 echo "TEST_INSTALLER=$TEST_INSTALLER"
peusterm3a3e7a52017-12-22 13:10:54 +0100466 echo "INSTALL_VIMEMU=$INSTALL_VIMEMU"
garciadeblas0d934c12017-11-17 15:39:17 +0100467 echo "INSTALL_LXD=$INSTALL_LXD"
468 echo "INSTALL_FROM_LXDIMAGES=$INSTALL_FROM_LXDIMAGES"
469 echo "LXD_REPOSITORY_BASE=$LXD_REPOSITORY_BASE"
470 echo "RELEASE=$RELEASE"
471 echo "REPOSITORY=$REPOSITORY"
472 echo "REPOSITORY_BASE=$REPOSITORY_BASE"
473 echo "REPOSITORY_KEY=$REPOSITORY_KEY"
474 echo "NOCONFIGURE=$NOCONFIGURE"
475 echo "SHOWOPTS=$SHOWOPTS"
476 echo "Install from specific refspec (-b): $COMMIT_ID"
477}
478
479function track(){
480 ctime=`date +%s`
481 duration=$((ctime - SESSION_ID))
482 url="http://www.woopra.com/track/ce?project=osm.etsi.org&cookie=${SESSION_ID}"
483 #url="${url}&ce_campaign_name=${CAMPAIGN_NAME}"
484 event_name="bin"
485 [ -n "$INSTALL_FROM_SOURCE" ] && event_name="src"
486 [ -n "$INSTALL_FROM_LXDIMAGES" ] && event_name="lxd"
487 event_name="${event_name}_$1"
488 url="${url}&event=${event_name}&ce_duration=${duration}"
489 wget -q -O /dev/null $url
490}
491
garciadeblas93c61312016-09-28 15:12:48 +0200492UNINSTALL=""
493DEVELOP=""
494NAT=""
garciadeblas2a382732017-01-12 12:11:14 +0100495UPDATE=""
garciadeblas55490d42016-10-29 14:22:03 +0200496RECONFIGURE=""
497TEST_INSTALLER=""
garciadeblas0d934c12017-11-17 15:39:17 +0100498INSTALL_LXD=""
garciadeblas2a5a6512016-12-19 10:19:52 +0100499SHOWOPTS=""
500COMMIT_ID=""
tierno2cc8e252017-03-08 17:12:05 +0100501ASSUME_YES=""
garciadeblasa1fc4572017-04-24 19:08:21 +0200502INSTALL_FROM_SOURCE=""
garciadeblas82442292017-11-16 14:48:12 +0100503RELEASE="-R ReleaseTHREE"
peusterm3a3e7a52017-12-22 13:10:54 +0100504INSTALL_VIMEMU=""
garciadeblas0d934c12017-11-17 15:39:17 +0100505INSTALL_FROM_LXDIMAGES=""
506LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd"
507NOCONFIGURE=""
Mike Marchettica56c642017-12-16 16:04:52 -0500508RELEASE_DAILY=""
garciadeblas0d934c12017-11-17 15:39:17 +0100509SESSION_ID=`date +%s`
510
511while getopts ":hy-:b:r:k:u:R:l:" o; do
garciadeblas93c61312016-09-28 15:12:48 +0200512 case "${o}" in
513 h)
514 usage && exit 0
515 ;;
garciadeblas2a5a6512016-12-19 10:19:52 +0100516 b)
517 COMMIT_ID=${OPTARG}
518 ;;
Mike Marchetti425f8ce2017-06-15 13:02:16 -0400519 r)
520 REPOSITORY="-r ${OPTARG}"
521 ;;
522 R)
523 RELEASE="-R ${OPTARG}"
524 ;;
525 k)
526 REPOSITORY_KEY="-k ${OPTARG}"
527 ;;
528 u)
529 REPOSITORY_BASE="-u ${OPTARG}"
530 ;;
garciadeblas0d934c12017-11-17 15:39:17 +0100531 l)
532 LXD_REPOSITORY_BASE="${OPTARG}"
533 ;;
garciadeblas93c61312016-09-28 15:12:48 +0200534 -)
535 [ "${OPTARG}" == "help" ] && usage && exit 0
garciadeblasa1fc4572017-04-24 19:08:21 +0200536 [ "${OPTARG}" == "source" ] && INSTALL_FROM_SOURCE="y" && continue
garciadeblas93c61312016-09-28 15:12:48 +0200537 [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
538 [ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue
539 [ "${OPTARG}" == "nat" ] && NAT="y" && continue
garciadeblas2a382732017-01-12 12:11:14 +0100540 [ "${OPTARG}" == "update" ] && UPDATE="y" && continue
garciadeblas55490d42016-10-29 14:22:03 +0200541 [ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue
542 [ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue
garciadeblas0d934c12017-11-17 15:39:17 +0100543 [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue
544 [ "${OPTARG}" == "lxdimages" ] && INSTALL_FROM_LXDIMAGES="y" && continue
peusterm3a3e7a52017-12-22 13:10:54 +0100545 [ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue
garciadeblas0d934c12017-11-17 15:39:17 +0100546 [ "${OPTARG}" == "noconfigure" ] && NOCONFIGURE="y" && continue
garciadeblas2a5a6512016-12-19 10:19:52 +0100547 [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue
Mike Marchettica56c642017-12-16 16:04:52 -0500548 [ "${OPTARG}" == "daily" ] && RELEASE_DAILY="y" && continue
garciadeblas93c61312016-09-28 15:12:48 +0200549 echo -e "Invalid option: '--$OPTARG'\n" >&2
550 usage && exit 1
551 ;;
552 \?)
553 echo -e "Invalid option: '-$OPTARG'\n" >&2
554 usage && exit 1
555 ;;
tierno2cc8e252017-03-08 17:12:05 +0100556 y)
557 ASSUME_YES="y"
558 ;;
garciadeblas93c61312016-09-28 15:12:48 +0200559 *)
560 usage && exit 1
561 ;;
562 esac
563done
564
garciadeblasa6ff9862017-04-07 02:00:29 +0200565if [ -n "$SHOWOPTS" ]; then
garciadeblas0d934c12017-11-17 15:39:17 +0100566 dump_vars
garciadeblasa6ff9862017-04-07 02:00:29 +0200567 exit 0
568fi
569
Mike Marchettica56c642017-12-16 16:04:52 -0500570[ -n "$RELEASE_DAILY" ] && echo -e "\nInstalling from daily build repo" && RELEASE="-R ReleaseTHREE-daily" && REPOSITORY="-r testing" && COMMIT_ID="master"
571
Mike Marchetti6930bc02017-05-31 16:33:02 -0400572# if develop, we force master
garciadeblas2a5a6512016-12-19 10:19:52 +0100573[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
Mike Marchetti6930bc02017-05-31 16:33:02 -0400574
Mike Marchetti0d567602017-09-29 14:30:28 -0400575# forcing source from master removed. Now only install from source when explicit
576# [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y"
garciadeblas2a5a6512016-12-19 10:19:52 +0100577
garciadeblas55490d42016-10-29 14:22:03 +0200578if [ -n "$TEST_INSTALLER" ]; then
579 echo -e "\nUsing local devops repo for OSM installation"
580 TEMPDIR="$(dirname $(realpath $(dirname $0)))"
581else
582 echo -e "\nCreating temporary dir for OSM installation"
583 TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
584 trap 'rm -rf "$TEMPDIR"' EXIT
585fi
garciadeblas93c61312016-09-28 15:12:48 +0200586
Mike Marchetti2b951282017-10-10 15:43:15 -0400587need_packages="git jq"
588for package in $need_packages; do
589 echo -e "Checking required packages: $package"
Mike Marchettid8577f52017-10-19 15:27:48 -0400590 dpkg -l $package &>/dev/null \
591 || ! echo -e " $package not installed.\nInstalling $package requires root privileges" \
592 || sudo apt-get install -y $package \
593 || FATAL "failed to install $package"
Mike Marchetti2b951282017-10-10 15:43:15 -0400594done
595
garciadeblas55490d42016-10-29 14:22:03 +0200596if [ -z "$TEST_INSTALLER" ]; then
597 echo -e "\nCloning devops repo temporarily"
598 git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
599 RC_CLONE=$?
garciadeblas55490d42016-10-29 14:22:03 +0200600fi
garciadeblas2a382732017-01-12 12:11:14 +0100601
602echo -e "\nGuessing the current stable release"
Mike Marchetti91df8352017-10-17 13:47:48 -0400603LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | sort -V | tail -n1`
garciadeblas2a382732017-01-12 12:11:14 +0100604[ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
garciadeblasa6ff9862017-04-07 02:00:29 +0200605echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
606[ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
Mike Marchettica56c642017-12-16 16:04:52 -0500607
608if [ -n "$RELEASE_DAILY" ]; then
609 echo "Using master/HEAD devops"
610 git -C $TEMPDIR checkout master
611elif [ -z "$TEST_INSTALLER" ]; then
612 git -C $TEMPDIR checkout tags/$LATEST_STABLE_DEVOPS
613fi
garciadeblas2a382732017-01-12 12:11:14 +0100614
garciadeblas93c61312016-09-28 15:12:48 +0200615OSM_DEVOPS=$TEMPDIR
garciadeblas0fe45dd2016-10-04 07:54:17 +0200616OSM_JENKINS="$TEMPDIR/jenkins"
617. $OSM_JENKINS/common/all_funcs
garciadeblas93c61312016-09-28 15:12:48 +0200618
garciadeblasd8718f12016-10-30 19:39:01 +0100619[ -n "$UNINSTALL" ] && uninstall && echo -e "\nDONE" && exit 0
620[ -n "$NAT" ] && nat && echo -e "\nDONE" && exit 0
garciadeblas2a382732017-01-12 12:11:14 +0100621[ -n "$UPDATE" ] && update && echo -e "\nDONE" && exit 0
garciadeblasd8718f12016-10-30 19:39:01 +0100622[ -n "$RECONFIGURE" ] && configure && echo -e "\nDONE" && exit 0
garciadeblas93c61312016-09-28 15:12:48 +0200623
624#Installation starts here
garciadeblasa1fc4572017-04-24 19:08:21 +0200625echo -e "\nInstalling OSM from refspec: $COMMIT_ID"
626if [ -n "$INSTALL_FROM_SOURCE" ] && [ -z "$ASSUME_YES" ]; then
tierno53881d72017-04-25 11:58:57 +0200627 ! ask_user "The installation will take about 75-90 minutes. Continue (Y/n)? " y && echo "Cancelled!" && exit 1
tierno2cc8e252017-03-08 17:12:05 +0100628fi
629
garciadeblasa1fc4572017-04-24 19:08:21 +0200630echo -e "\nChecking required packages: wget, curl, tar"
631dpkg -l wget curl tar &>/dev/null || ! echo -e " One or several packages are not installed.\nInstalling required packages\n Root privileges are required" || sudo apt-get install -y wget curl tar
632
Jokin Garayc0a65962017-03-09 14:51:48 +0100633echo -e "Checking required packages: lxd"
garciadeblasd880f722017-04-07 20:14:57 +0200634lxd --version &>/dev/null || FATAL "lxd not present, exiting."
garciadeblas0d934c12017-11-17 15:39:17 +0100635[ -n "$INSTALL_LXD" ] && echo -e "\nInstalling and configuring lxd" && install_lxd
garciadeblas2a5a6512016-12-19 10:19:52 +0100636
Mike Marchettib884a462017-10-05 13:28:33 -0400637wget -q -O- https://osm-download.etsi.org/ftp/osm-3.0-three/README.txt &> /dev/null
garciadeblas0d934c12017-11-17 15:39:17 +0100638track start
garciadeblas93c61312016-09-28 15:12:48 +0200639
Mike Marchettid1e08b92017-09-29 16:14:11 -0400640# use local devops for containers
641export OSM_USE_LOCAL_DEVOPS=true
garciadeblas0d934c12017-11-17 15:39:17 +0100642if [ -n "$INSTALL_FROM_SOURCE" ]; then #install from source
garciadeblasa1fc4572017-04-24 19:08:21 +0200643 echo -e "\nCreating the containers and building from source ..."
644 $OSM_DEVOPS/jenkins/host/start_build RO --notest checkout $COMMIT_ID || FATAL "RO container build failed (refspec: '$COMMIT_ID')"
garciadeblas0d934c12017-11-17 15:39:17 +0100645 ro_is_up && track RO
garciadeblasa1fc4572017-04-24 19:08:21 +0200646 $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA container build failed"
garciadeblas0d934c12017-11-17 15:39:17 +0100647 vca_is_up && track VCA
garciadeblasa1fc4572017-04-24 19:08:21 +0200648 $OSM_DEVOPS/jenkins/host/start_build SO checkout $COMMIT_ID || FATAL "SO container build failed (refspec: '$COMMIT_ID')"
649 $OSM_DEVOPS/jenkins/host/start_build UI checkout $COMMIT_ID || FATAL "UI container build failed (refspec: '$COMMIT_ID')"
garciadeblas0d934c12017-11-17 15:39:17 +0100650 #so_is_up && track SOUI
651 track SOUI
652elif [ -n "$INSTALL_FROM_LXDIMAGES" ]; then #install from LXD images stored in OSM repo
653 echo -e "\nInstalling from lxd images ..."
654 install_from_lxdimages
655else #install from binaries
656 echo -e "\nCreating the containers and installing from binaries ..."
657 $OSM_DEVOPS/jenkins/host/install RO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "RO install failed"
658 ro_is_up && track RO
659 $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA install failed"
660 vca_is_up && track VCA
661 $OSM_DEVOPS/jenkins/host/install SO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "SO install failed"
662 $OSM_DEVOPS/jenkins/host/install UI $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "UI install failed"
663 #so_is_up && track SOUI
664 track SOUI
garciadeblasa1fc4572017-04-24 19:08:21 +0200665fi
garciadeblas93c61312016-09-28 15:12:48 +0200666
garciadeblas55490d42016-10-29 14:22:03 +0200667#Install iptables-persistent and configure NAT rules
garciadeblas0d934c12017-11-17 15:39:17 +0100668[ -z "$NOCONFIGURE" ] && nat
garciadeblas93c61312016-09-28 15:12:48 +0200669
670#Configure components
garciadeblas0d934c12017-11-17 15:39:17 +0100671[ -z "$NOCONFIGURE" ] && configure
672
673#Install osmclient
674[ -z "$NOCONFIGURE" ] && install_osmclient
garciadeblas93c61312016-09-28 15:12:48 +0200675
peusterm3a3e7a52017-12-22 13:10:54 +0100676#Install vim-emu (optional)
677if [ -n "$INSTALL_VIMEMU" ]; then
678 echo -e "\nInstalling vim-emu ..."
679 install_vimemu
680fi
681
Mike Marchettib884a462017-10-05 13:28:33 -0400682wget -q -O- https://osm-download.etsi.org/ftp/osm-3.0-three/README2.txt &> /dev/null
garciadeblas0d934c12017-11-17 15:39:17 +0100683track end
Jokin Garay3eb9ce72017-03-09 14:48:11 +0100684echo -e "\nDONE"
garciadeblas0d934c12017-11-17 15:39:17 +0100685