[docs] Limit git submodule recurse to depth 1
[releng.git] / jjb / fuel / fuel-lab-reconfig.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -o errexit
11 set -o nounset
12 set -o pipefail
13
14 # check to see if ucs login info file exists
15 if [ -e ~/.ssh/ucs_creds ];then
16     source ~/.ssh/ucs_creds
17 else
18     echo "Unable to find UCS credentials for LF lab reconfiguration...Exiting"
19     exit 1
20 fi
21
22 # clone releng
23 echo "Cloning releng repo..."
24 if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/releng; then
25     echo "Unable to clone releng repo...Exiting"
26     exit 1
27 fi
28
29 # log info to console
30 echo "Starting the lab reconfiguration for $INSTALLER_TYPE..."
31 echo "--------------------------------------------------------"
32 echo
33
34 # create venv
35 $WORKSPACE/releng/utils/lab-reconfiguration/create_venv.sh
36
37 # disable nounset because 'activate' script contains unbound variable(s)
38 set +o nounset
39 # enter venv
40 source $WORKSPACE/releng/utils/lab-reconfiguration/venv/bin/activate
41 # set nounset back again
42 set -o nounset
43
44 # verify we are in venv
45 if [[ ! $(which python | grep venv) ]]; then
46     echo "Unable to activate venv...Exiting"
47     exit 1
48 fi
49
50 python $WORKSPACE/releng/utils/lab-reconfiguration/reconfigUcsNet.py -i $ucs_host -u $ucs_user -p $ucs_password -f $WORKSPACE/releng/utils/lab-reconfiguration/fuel.yaml
51
52 # while undergoing reboot
53 sleep 30
54
55 # check to see if slave is back up
56 ping_counter=0
57 ping_flag=0
58 while [ "$ping_counter" -lt 20 ]; do
59     if [[ $(ping -c 5 172.30.10.72) ]]; then
60         ping_flag=1
61         break
62     fi
63     ((ping_counter++))
64     sleep 10
65 done
66
67 if [ "$ping_flag" -eq 1 ]; then
68     echo "Slave is pingable, now wait 180 seconds for services to start"
69     sleep 180
70 else
71     echo "Slave did not come back up after reboot: please check lf-pod2"
72     exit 1
73 fi
74
75 set +o nounset
76 deactivate
77
78 echo
79 echo "--------------------------------------------------------"
80 echo "Done!"