blob: 5def090ad32831e797cda152fc1afa3e0c35d38f [file] [log] [blame]
Simon Pasquierd3a0b912017-05-02 15:32:20 +02001#!/bin/bash -x
2exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1
3
4CWD="$(dirname "$(readlink -f "$0")")"
5
6# Import common functions
7COMMONS="$CWD"/common_functions.sh
8if [ ! -f "$COMMONS" ]; then
9 echo "File $COMMONS does not exist"
10 exit 1
11fi
12. "$COMMONS"
13
14# Configure compute nodes
15salt "cmp*" state.apply
16salt "cmp*" state.apply
17
18# Provision opencontrail virtual routers
19hosts=($(salt-call pillar.get linux:network:host | egrep 'cmp0.*:' | sed -e 's/ *//' -e 's/://'))
Olivier Bourdon53f58912017-06-20 12:53:34 +020020vip=$(salt-call pillar.get _param:opencontrail_control_address | grep '^ ' | sed -e 's/ *//')
Simon Pasquierd3a0b912017-05-02 15:32:20 +020021nb=$(( ${#hosts[@]} - 1 ))
22for i in $(seq 0 $nb); do
23 h=${hosts[$i]}
24 ip=$(salt-call pillar.get linux:network:host:"${h}":address | grep '^ ' | sed -e 's/ *//')
25 salt -C 'I@opencontrail:control:id:1' cmd.run "/usr/share/contrail-utils/provision_vrouter.py --host_name $h --host_ip $ip --api_server_ip $vip --oper add --admin_user admin --admin_password workshop --admin_tenant_name admin"
26done
27
28# Reboot compute nodes
29salt "cmp*" system.reboot
30
31# Wait for all compute nodes in current deployment to be available
32wait_for "$(get_nodes_names "cmp[0-9]" | wc -l)" "cmp*"