2 ##############################################################################
3 # Copyright (c) 2017 Mirantis Inc., Enea AB and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
10 CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
12 # Determine public network based on external IPs from compute node
13 # NOTE: mask currently hardcoded to /24
14 PUBLIC_NET=$(salt --out yaml -C 'I@nova:compute and *01*' pillar.get _param:external_address | \
15 awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
17 [ -n "${PUBLIC_NET}" ] || PUBLIC_NET=$(salt --out yaml -C 'I@nova:compute and *01*' \
18 pillar.get _param:openstack_compute_node01_external_address | \
19 awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
21 [ -n "${PUBLIC_NET}" ] && PUBLIC_NET="${PUBLIC_NET%.*}.0/24" || PUBLIC_NET="10.16.0.0/24"
23 salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
24 openstack compute service list; \
25 openstack network agent list; \
26 openstack stack list; \
27 openstack volume service list"
28 salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
29 openstack network create --external --default --provider-network-type flat \
30 --provider-physical-network physnet1 floating_net"
31 salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
32 openstack subnet create --gateway ${PUBLIC_NET%.*}.1 --no-dhcp \
33 --allocation-pool start=${PUBLIC_NET%.*}.130,end=${PUBLIC_NET%.*}.254 \
34 --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet"