aboutsummaryrefslogtreecommitdiffstats
path: root/mcp/config/states/networks
diff options
context:
space:
mode:
authorGuillermo Herrero <guillermo.herrero@enea.com>2018-01-11 13:23:28 +0100
committerGuillermo Herrero <guillermo.herrero@enea.com>2018-01-22 12:07:17 +0100
commit7c79115c2a1b6716f23f73be244bd1840a9e6f82 (patch)
treef6d44c8a2ce3c478d9c71548fed7db5b46350bbe /mcp/config/states/networks
parent252fd2b6fe32a77a4014ce33ead9f77817b1d2c9 (diff)
Add support for different public network netmask
- Remove hardcoded /24 mask - Use PDF as source for public network, with reclass params: opnfv_net_public, _mask, _gw, _pool_start, _pool_end JIRA: FUEL-315 Change-Id: Idf3a4ed8f63f58fa90d9c1dcb7751ef3b1c9bd36 Signed-off-by: Guillermo Herrero <guillermo.herrero@enea.com>
Diffstat (limited to 'mcp/config/states/networks')
-rwxr-xr-xmcp/config/states/networks27
1 files changed, 15 insertions, 12 deletions
diff --git a/mcp/config/states/networks b/mcp/config/states/networks
index 5beabdb6a..222a0726d 100755
--- a/mcp/config/states/networks
+++ b/mcp/config/states/networks
@@ -9,17 +9,20 @@
CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
-# Determine public network based on external IPs from compute node
-# NOTE: mask currently hardcoded to /24
-PUBLIC_NET=$(salt --out yaml -C 'I@nova:compute and *01*' pillar.get _param:external_address | \
- awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
+source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
-[ -n "${PUBLIC_NET}" ] || PUBLIC_NET=$(salt --out yaml -C 'I@nova:compute and *01*' \
- pillar.get _param:openstack_compute_node01_external_address | \
- awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
+PUBLIC_NET=$(get_nova_compute_pillar_data 'opnfv_net_public')
+PUBLIC_NET_GATEWAY=$(get_nova_compute_pillar_data 'opnfv_net_public_gw')
+POOL_START_IP=$(get_nova_compute_pillar_data 'opnfv_net_public_pool_start')
+POOL_END_IP=$(get_nova_compute_pillar_data 'opnfv_net_public_pool_end')
-[ -n "${PUBLIC_NET}" ] && PUBLIC_NET="${PUBLIC_NET%.*}.0/24" || PUBLIC_NET="10.16.0.0/24"
+# Default values
+PUBLIC_NET="${PUBLIC_NET:-10.16.0.0/24}"
+PUBLIC_NET_GATEWAY="${PUBLIC_NET_GATEWAY:-10.16.0.1}"
+POOL_START_IP="${POOL_START_IP:-10.16.0.130}"
+POOL_END_IP="${POOL_END_IP:-10.16.0.254}"
+# Print openstack status and setup network
salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
openstack compute service list; \
openstack network agent list; \
@@ -27,8 +30,8 @@ salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
openstack volume service list"
salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
openstack network create --external --default --provider-network-type flat \
- --provider-physical-network physnet1 floating_net"
+ --provider-physical-network physnet1 floating_net"
salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
- openstack subnet create --gateway ${PUBLIC_NET%.*}.1 --no-dhcp \
- --allocation-pool start=${PUBLIC_NET%.*}.130,end=${PUBLIC_NET%.*}.254 \
- --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet"
+ openstack subnet create --gateway ${PUBLIC_NET_GATEWAY} --no-dhcp \
+ --allocation-pool start=${POOL_START_IP},end=${POOL_END_IP} \
+ --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet"