blob: 71736916d47fdff7a498ed5a616ba0fa4ff72f66 [file] [log] [blame]
Jeepyb Userdd14e0b2017-02-28 15:19:32 +00001#!/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
Simon Pasquierd3a0b912017-05-02 15:32:20 +02007COMMONS="$CWD"/common_functions.sh
Jeepyb Userdd14e0b2017-02-28 15:19:32 +00008if [ ! -f "$COMMONS" ]; then
Simon Pasquierd3a0b912017-05-02 15:32:20 +02009 echo "File $COMMONS does not exist"
10 exit 1
Jeepyb Userdd14e0b2017-02-28 15:19:32 +000011fi
12. "$COMMONS"
13
14# Install opencontrail database services
15salt -C 'I@opencontrail:database' state.sls opencontrail.database -b 1
16# Install opencontrail control services
17salt -C 'I@opencontrail:control' state.sls opencontrail -b 1
18
19# Provision opencontrail control services
Olivier Bourdon53f58912017-06-20 12:53:34 +020020hosts=($(salt -C 'I@opencontrail:control' test.ping | egrep ':$' | cut -d \. -f 1))
21vip=$(salt-call pillar.get _param:opencontrail_control_address | grep '^ ' | sed -e 's/ *//')
Jeepyb Userdd14e0b2017-02-28 15:19:32 +000022nb=$(( ${#hosts[@]} - 1 ))
23for i in $(seq 0 $nb); do
Simon Pasquierd3a0b912017-05-02 15:32:20 +020024 h=${hosts[$i]}
25 ip=$(salt-call pillar.get linux:network:host:"${h}":address | grep '^ ' | sed -e 's/ *//')
26 salt -C 'I@opencontrail:control:id:1' cmd.run "/usr/share/contrail-utils/provision_control.py --api_server_ip $vip --api_server_port 8082 --host_name $h --host_ip $ip --router_asn 64512 --admin_password workshop --admin_user admin --admin_tenant_name admin --oper add"
Jeepyb Userdd14e0b2017-02-28 15:19:32 +000027done
28
29# Test opencontrail
30salt -C 'I@opencontrail:control' cmd.run "contrail-status"
31salt -C 'I@keystone:server' cmd.run ". /root/keystonerc; neutron net-list; nova net-list"