From 7c79115c2a1b6716f23f73be244bd1840a9e6f82 Mon Sep 17 00:00:00 2001 From: Guillermo Herrero Date: Thu, 11 Jan 2018 13:23:28 +0100 Subject: 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 --- mcp/config/states/networks | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'mcp/config') 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" -- cgit 1.2.3-korg