Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / cloud-scripts / remote-install-osm.sh
1 #!/usr/bin/env bash
2 #######################################################################################
3 # Copyright ETSI Contributors and Others.
4 #
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
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
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
14 # implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #######################################################################################
18
19 ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@"${OSM_HOSTNAME}" \
20 'sudo apt-get update -y && sudo apt-get upgrade -y && sudo reboot'
21
22 sleep 90
23
24 # OSM installation
25 INSTALLER_PARAMETERS="-R ${REPO_BASE} -t ${DOCKER_TAG} -r ${REPO_NAME} -y"
26 echo "INSTALLER_URL: $INSTALLER_URL"
27 echo "INSTALLER_PARAMETERS: $INSTALLER_PARAMETERS"
28 ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_HOSTNAME} << EOF 2>&1
29 set -eux
30 wget "${INSTALLER_URL}"
31 chmod +x install_osm.sh
32 ./install_osm.sh ${INSTALLER_PARAMETERS} 2>&1 | tee osm_install_log.txt
33 set +eux
34 EOF
35
36 # # Installs additional tools for telemetry
37 # set +eux
38 # ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_HOSTNAME} 'sudo apt-get install -y sysstat'
39 # set -eux
40
41 # Gets Juju password from LCM env file
42 set +eux
43 JUJU_PWD=$(ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_HOSTNAME} 'kubectl -n osm exec -ti deploy/lcm -- env | grep OSMLCM_VCA_SECRET | cut -d = -f 2')
44 set -eux
45
46 # Updates environment variables and logs them
47 export JUJU_PASSWORD="${JUJU_PWD}"
48
49 # Logs new/updated environment variables
50 cat <<EOF >> ${ROBOT_REPORT_FOLDER}/osm_environment.rc
51 export JUJU_PASSWORD="${JUJU_PWD}"
52 EOF
53
54 echo Environment was updated at ${ROBOT_REPORT_FOLDER}/osm_environment.rc