Jeepyb User | dd14e0b | 2017-02-28 15:19:32 +0000 | [diff] [blame] | 1 | #!/bin/bash -x |
| 2 | exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1 |
| 3 | |
| 4 | CWD="$(dirname "$(readlink -f "$0")")" |
| 5 | |
| 6 | # Import common functions |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 7 | COMMONS="$CWD"/common_functions.sh |
Jeepyb User | dd14e0b | 2017-02-28 15:19:32 +0000 | [diff] [blame] | 8 | if [ ! -f "$COMMONS" ]; then |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 9 | echo "File $COMMONS does not exist" |
| 10 | exit 1 |
Jeepyb User | dd14e0b | 2017-02-28 15:19:32 +0000 | [diff] [blame] | 11 | fi |
| 12 | . "$COMMONS" |
| 13 | |
| 14 | # Install opencontrail database services |
| 15 | salt -C 'I@opencontrail:database' state.sls opencontrail.database -b 1 |
| 16 | # Install opencontrail control services |
| 17 | salt -C 'I@opencontrail:control' state.sls opencontrail -b 1 |
| 18 | |
| 19 | # Provision opencontrail control services |
Olivier Bourdon | 53f5891 | 2017-06-20 12:53:34 +0200 | [diff] [blame] | 20 | hosts=($(salt -C 'I@opencontrail:control' test.ping | egrep ':$' | cut -d \. -f 1)) |
| 21 | vip=$(salt-call pillar.get _param:opencontrail_control_address | grep '^ ' | sed -e 's/ *//') |
Jeepyb User | dd14e0b | 2017-02-28 15:19:32 +0000 | [diff] [blame] | 22 | nb=$(( ${#hosts[@]} - 1 )) |
| 23 | for i in $(seq 0 $nb); do |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 24 | 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 User | dd14e0b | 2017-02-28 15:19:32 +0000 | [diff] [blame] | 27 | done |
| 28 | |
| 29 | # Test opencontrail |
| 30 | salt -C 'I@opencontrail:control' cmd.run "contrail-status" |
| 31 | salt -C 'I@keystone:server' cmd.run ". /root/keystonerc; neutron net-list; nova net-list" |