summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/network-environment.yaml17
-rw-r--r--build/nics-template.yaml.jinja26
-rw-r--r--config/network/network_settings.yaml2
-rw-r--r--config/network/network_settings_v6.yaml2
-rw-r--r--config/network/network_settings_vlans.yaml2
-rw-r--r--docs/installationprocedure/requirements.rst2
-rwxr-xr-xlib/post-install-functions.sh19
-rw-r--r--lib/python/apex/deploy_settings.py2
-rw-r--r--lib/python/apex/inventory.py2
-rw-r--r--lib/python/apex/network_environment.py41
-rw-r--r--lib/python/apex/network_settings.py28
-rwxr-xr-xlib/undercloud-functions.sh2
12 files changed, 65 insertions, 60 deletions
diff --git a/build/network-environment.yaml b/build/network-environment.yaml
index bd65dd9d..8367371b 100644
--- a/build/network-environment.yaml
+++ b/build/network-environment.yaml
@@ -46,24 +46,7 @@ resource_registry:
parameter_defaults:
NeutronExternalNetworkBridge: 'br-ex'
- ControlPlaneSubnetCidr: "24"
- ControlPlaneDefaultRoute: 192.0.2.1
- ExternalNetCidr: 192.168.37.0/24
- ExternalAllocationPools: [{'start': '192.168.37.50', 'end': '192.168.37.99'}]
- ExternalInterfaceDefaultRoute: 192.168.37.1
- EC2MetadataIp: 192.0.2.1
- DnsServers: ["8.8.8.8","8.8.4.4"]
- TenantNetCidr: 172.17.0.0/24
- TenantAllocationPools: [{'start': '172.17.0.10', 'end': '172.17.0.200'}]
- StorageNetCidr: 172.18.0.0/24
- StorageAllocationPools: [{'start': '172.18.0.10', 'end': '172.18.0.200'}]
- # Customize the VLAN IDs to match the local environment
- InternalApiNetworkVlanID: 10 # usually collapsed onto Admin/Provisioning
- StorageNetworkVlanID: 20
- # StorageMgmtNetworkVlanID: 30 # NOT IMPLEMENTED
- TenantNetworkVlanID: 40
- ExternalNetworkVlanID: 50
ServiceNetMap:
NeutronTenantNetwork: tenant
CeilometerApiNetwork: internal_api
diff --git a/build/nics-template.yaml.jinja2 b/build/nics-template.yaml.jinja2
index ee830114..c7d0a1b8 100644
--- a/build/nics-template.yaml.jinja2
+++ b/build/nics-template.yaml.jinja2
@@ -85,13 +85,13 @@ resources:
os_net_config:
network_config:
-
- {%- if nets['tenant']['nic_mapping'][role]['vlan'] is number or nets['storage']['nic_mapping'][role]['vlan'] is number or nets['api']['nic_mapping'][role]['vlan'] is number or nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
+ {%- if not nets['external'][0]['enabled'] or nets['tenant']['nic_mapping'][role]['vlan'] is number or nets['storage']['nic_mapping'][role]['vlan'] is number or nets['api']['nic_mapping'][role]['vlan'] is number or nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
type: ovs_bridge
name: {get_input: bridge_name}
members:
-
type: interface
- name: {{ nets[role]['admin']['members'][0] }}
+ name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
# force the MAC address of the bridge to this interface
primary: true
{%- if nets['external'][0]['enabled'] and nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
@@ -147,7 +147,7 @@ resources:
-
ip_netmask: 169.254.169.254/32
next_hop: {get_param: EC2MetadataIp}
- {%- if external_net_af == 6 or role == 'compute' %}
+ {%- if external_net_af == 6 or role == 'compute' or not nets['external'][0]['enabled'] %}
-
default: true
next_hop: {get_param: ControlPlaneDefaultRoute}
diff --git a/config/network/network_settings.yaml b/config/network/network_settings.yaml
index c052a438..1cba64bb 100644
--- a/config/network/network_settings.yaml
+++ b/config/network/network_settings.yaml
@@ -215,3 +215,5 @@ apex:
introspection_range:
- 192.0.2.100
- 192.0.2.120 # Range used for introspection phase (examining nodes). This cannot overlap with dhcp_range or overcloud_ip_range.
+ # If the external network 'public' is disabled, then this range will be re-used to configure the floating ip range
+ # for the overcloud default external network
diff --git a/config/network/network_settings_v6.yaml b/config/network/network_settings_v6.yaml
index 6b1dd5de..54c4113f 100644
--- a/config/network/network_settings_v6.yaml
+++ b/config/network/network_settings_v6.yaml
@@ -178,3 +178,5 @@ apex:
introspection_range:
- 192.0.2.100
- 192.0.2.120 # Range used for introspection phase (examining nodes). This cannot overlap with dhcp_range or overcloud_ip_range.
+ # If the external network 'public' is disabled, then this range will be re-used to configure the floating ip range
+ # for the overcloud default external network
diff --git a/config/network/network_settings_vlans.yaml b/config/network/network_settings_vlans.yaml
index 4e3da2f4..d892289f 100644
--- a/config/network/network_settings_vlans.yaml
+++ b/config/network/network_settings_vlans.yaml
@@ -215,3 +215,5 @@ apex:
introspection_range:
- 192.0.2.100
- 192.0.2.120 # Range used for introspection phase (examining nodes). This cannot overlap with dhcp_range or overcloud_ip_range.
+ # If the external network 'public' is disabled, then this range will be re-used to configure the floating ip range
+ # for the overcloud default external network
diff --git a/docs/installationprocedure/requirements.rst b/docs/installationprocedure/requirements.rst
index 1b3fe87d..507b671e 100644
--- a/docs/installationprocedure/requirements.rst
+++ b/docs/installationprocedure/requirements.rst
@@ -33,7 +33,7 @@ Network requirements include:
- Private Tenant-Networking Network*
- - External Network
+ - External Network*
- Storage Network*
diff --git a/lib/post-install-functions.sh b/lib/post-install-functions.sh
index 1055994e..102b86f5 100755
--- a/lib/post-install-functions.sh
+++ b/lib/post-install-functions.sh
@@ -13,7 +13,10 @@
function configure_post_install {
local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip af external_network_ipv6
external_network_ipv6=False
- opnfv_attach_networks="admin external"
+ opnfv_attach_networks="admin"
+ if [[ $enabled_network_list =~ "external" ]]; then
+ opnfv_attach_networks+=' external'
+ fi
echo -e "${blue}INFO: Post Install Configuration Running...${reset}"
@@ -94,8 +97,11 @@ else
fi
if [ "$external_network_ipv6" == "True" ]; then
neutron subnet-create --name external-net --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') external --ip_version 6 --ipv6_ra_mode slaac --ipv6_address_mode slaac --gateway ${external_gateway} --allocation-pool start=${external_floating_ip_range%%,*},end=${external_floating_ip_range##*,} ${external_cidr}
-else
+elif [[ "$enabled_network_list" =~ "external" ]]; then
neutron subnet-create --name external-net --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') --disable-dhcp external --gateway ${external_gateway} --allocation-pool start=${external_floating_ip_range%%,*},end=${external_floating_ip_range##*,} ${external_cidr}
+else
+ # we re-use the introspection range for floating ips with single admin network
+ neutron subnet-create --name external-net --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') --disable-dhcp external --gateway ${admin_gateway} --allocation-pool start=${admin_introspection_range%%,*},end=${admin_introspection_range##*,} ${admin_cidr}
fi
echo "Removing sahara endpoint and service"
@@ -145,8 +151,13 @@ EOI
# for virtual, we NAT external network through Undercloud
# same goes for baremetal if only jumphost has external connectivity
if [ "$virtual" == "TRUE" ] || ! test_overcloud_connectivity && [ "$external_network_ipv6" != "True" ]; then
- if ! configure_undercloud_nat ${external_cidr}; then
- echo -e "${red}ERROR: Unable to NAT undercloud with external net: ${external_cidr}${reset}"
+ if [[ "$enabled_network_list" =~ "external" ]]; then
+ nat_cidr=${external_cidr}
+ else
+ nat_cidr=${admin_cidr}
+ fi
+ if ! configure_undercloud_nat ${nat_cidr}; then
+ echo -e "${red}ERROR: Unable to NAT undercloud with external net: ${nat_cidr}${reset}"
exit 1
else
echo -e "${blue}INFO: Undercloud VM has been setup to NAT Overcloud external network${reset}"
diff --git a/lib/python/apex/deploy_settings.py b/lib/python/apex/deploy_settings.py
index a27d13f1..963520a6 100644
--- a/lib/python/apex/deploy_settings.py
+++ b/lib/python/apex/deploy_settings.py
@@ -38,7 +38,7 @@ class DeploySettings(dict):
"""
def __init__(self, filename):
init_dict = {}
- if type(filename) is str:
+ if isinstance(filename, str):
with open(filename, 'r') as deploy_settings_file:
init_dict = yaml.safe_load(deploy_settings_file)
else:
diff --git a/lib/python/apex/inventory.py b/lib/python/apex/inventory.py
index 37143566..711eb18f 100644
--- a/lib/python/apex/inventory.py
+++ b/lib/python/apex/inventory.py
@@ -22,7 +22,7 @@ class Inventory(dict):
"""
def __init__(self, source, ha=True, virtual=False):
init_dict = {}
- if type(source) is str:
+ if isinstance(source, str):
with open(source, 'r') as inventory_file:
yaml_dict = yaml.safe_load(inventory_file)
# collapse node identifiers from the structure
diff --git a/lib/python/apex/network_environment.py b/lib/python/apex/network_environment.py
index b931a758..4fc6f583 100644
--- a/lib/python/apex/network_environment.py
+++ b/lib/python/apex/network_environment.py
@@ -21,6 +21,7 @@ from .common.constants import (
COMPUTE_PRE,
PRE_CONFIG_DIR
)
+from .network_settings import NetworkSettings
HEAT_NONE = 'OS::Heat::None'
PORTS = '/ports'
@@ -63,15 +64,13 @@ class NetworkEnvironment(dict):
Create Network Environment according to Network Settings
"""
init_dict = {}
- if type(filename) is str:
+ if isinstance(filename, str):
with open(filename, 'r') as net_env_fh:
init_dict = yaml.safe_load(net_env_fh)
super().__init__(init_dict)
- try:
- enabled_nets = net_settings.enabled_network_list
- except:
- raise NetworkEnvException('Invalid Network Setting object')
+ if not isinstance(net_settings, NetworkSettings):
+ raise NetworkEnvException('Invalid Network Settings object')
self._set_tht_dir()
@@ -86,19 +85,21 @@ class NetworkEnvironment(dict):
nets[ADMIN_NETWORK]['installer_vm']['ip']
self[param_def]['DnsServers'] = net_settings['dns_servers']
- if EXTERNAL_NETWORK in enabled_nets:
- external_cidr = nets[EXTERNAL_NETWORK][0]['cidr']
+ if EXTERNAL_NETWORK in net_settings.enabled_network_list:
+ external_cidr = net_settings.get_network(EXTERNAL_NETWORK)['cidr']
self[param_def]['ExternalNetCidr'] = str(external_cidr)
- if type(nets[EXTERNAL_NETWORK][0]['installer_vm']['vlan']) is int:
+ external_vlan = self._get_vlan(net_settings.get_network(
+ EXTERNAL_NETWORK))
+ if isinstance(external_vlan, int):
self[param_def]['NeutronExternalNetworkBridge'] = '""'
- self[param_def]['ExternalNetworkVlanID'] = \
- nets[EXTERNAL_NETWORK][0]['installer_vm']['vlan']
- external_range = nets[EXTERNAL_NETWORK][0]['overcloud_ip_range']
+ self[param_def]['ExternalNetworkVlanID'] = external_vlan
+ external_range = net_settings.get_network(EXTERNAL_NETWORK)[
+ 'overcloud_ip_range']
self[param_def]['ExternalAllocationPools'] = \
[{'start': str(external_range[0]),
'end': str(external_range[1])}]
self[param_def]['ExternalInterfaceDefaultRoute'] = \
- nets[EXTERNAL_NETWORK][0]['gateway']
+ net_settings.get_network(EXTERNAL_NETWORK)['gateway']
if external_cidr.version == 6:
postfix = '/external_v6.yaml'
@@ -110,7 +111,7 @@ class NetworkEnvironment(dict):
# apply resource registry update for EXTERNAL_RESOURCES
self._config_resource_reg(EXTERNAL_RESOURCES, postfix)
- if TENANT_NETWORK in enabled_nets:
+ if TENANT_NETWORK in net_settings.enabled_network_list:
tenant_range = nets[TENANT_NETWORK]['overcloud_ip_range']
self[param_def]['TenantAllocationPools'] = \
[{'start': str(tenant_range[0]),
@@ -123,7 +124,7 @@ class NetworkEnvironment(dict):
postfix = '/tenant.yaml'
tenant_vlan = self._get_vlan(nets[TENANT_NETWORK])
- if type(tenant_vlan) is int:
+ if isinstance(tenant_vlan, int):
self[param_def]['TenantNetworkVlanID'] = tenant_vlan
else:
postfix = '/noop.yaml'
@@ -131,7 +132,7 @@ class NetworkEnvironment(dict):
# apply resource registry update for TENANT_RESOURCES
self._config_resource_reg(TENANT_RESOURCES, postfix)
- if STORAGE_NETWORK in enabled_nets:
+ if STORAGE_NETWORK in net_settings.enabled_network_list:
storage_range = nets[STORAGE_NETWORK]['overcloud_ip_range']
self[param_def]['StorageAllocationPools'] = \
[{'start': str(storage_range[0]),
@@ -143,7 +144,7 @@ class NetworkEnvironment(dict):
else:
postfix = '/storage.yaml'
storage_vlan = self._get_vlan(nets[STORAGE_NETWORK])
- if type(storage_vlan) is int:
+ if isinstance(storage_vlan, int):
self[param_def]['StorageNetworkVlanID'] = storage_vlan
else:
postfix = '/noop.yaml'
@@ -151,7 +152,7 @@ class NetworkEnvironment(dict):
# apply resource registry update for STORAGE_RESOURCES
self._config_resource_reg(STORAGE_RESOURCES, postfix)
- if API_NETWORK in enabled_nets:
+ if API_NETWORK in net_settings.enabled_network_list:
api_range = nets[API_NETWORK]['overcloud_ip_range']
self[param_def]['InternalApiAllocationPools'] = \
[{'start': str(api_range[0]),
@@ -163,7 +164,7 @@ class NetworkEnvironment(dict):
else:
postfix = '/internal_api.yaml'
api_vlan = self._get_vlan(nets[API_NETWORK])
- if type(api_vlan) is int:
+ if isinstance(api_vlan, int):
self[param_def]['InternalApiNetworkVlanID'] = api_vlan
else:
postfix = '/noop.yaml'
@@ -184,9 +185,9 @@ class NetworkEnvironment(dict):
self[param_def][flag] = True
def _get_vlan(self, network):
- if type(network['nic_mapping'][CONTROLLER]['vlan']) is int:
+ if isinstance(network['nic_mapping'][CONTROLLER]['vlan'], int):
return network['nic_mapping'][CONTROLLER]['vlan']
- elif type(network['nic_mapping'][COMPUTE]['vlan']) is int:
+ elif isinstance(network['nic_mapping'][COMPUTE]['vlan'], int):
return network['nic_mapping'][COMPUTE]['vlan']
else:
return 'native'
diff --git a/lib/python/apex/network_settings.py b/lib/python/apex/network_settings.py
index 951000dc..64065ca7 100644
--- a/lib/python/apex/network_settings.py
+++ b/lib/python/apex/network_settings.py
@@ -14,7 +14,6 @@ import ipaddress
from copy import copy
from . import ip_utils
-from .common import utils
from .common.constants import (
CONTROLLER,
COMPUTE,
@@ -42,7 +41,7 @@ class NetworkSettings(dict):
"""
def __init__(self, filename):
init_dict = {}
- if type(filename) is str:
+ if isinstance(filename, str):
with open(filename, 'r') as network_settings_file:
init_dict = yaml.safe_load(network_settings_file)
else:
@@ -55,7 +54,7 @@ class NetworkSettings(dict):
def merge(pri, sec):
for key, val in sec.items():
if key in pri:
- if type(val) is dict:
+ if isinstance(val, dict):
merge(pri[key], val)
# else
# do not overwrite what's already there
@@ -71,7 +70,14 @@ class NetworkSettings(dict):
def get_network(self, network):
if network == EXTERNAL_NETWORK and self['networks'][network]:
- return self['networks'][network][0]
+ for net in self['networks'][network]:
+ if 'public' in net:
+ return net
+
+ raise NetworkSettingsException("The external network, "
+ "'public', should be defined "
+ "when external networks are "
+ "enabled")
else:
return self['networks'][network]
@@ -92,10 +98,7 @@ class NetworkSettings(dict):
if _network.get('enabled', True):
logging.info("{} enabled".format(network))
self._config_required_settings(network)
- if network == EXTERNAL_NETWORK:
- nicmap = _network['nic_mapping']
- else:
- nicmap = _network['nic_mapping']
+ nicmap = _network['nic_mapping']
iface = nicmap[CONTROLLER]['members'][0]
self._config_ip_range(network=network,
interface=iface,
@@ -137,7 +140,7 @@ class NetworkSettings(dict):
if interfaces:
interface = interfaces[0]
- if type(_role.get('vlan', 'native')) is not int and \
+ if not isinstance(_role.get('vlan', 'native'), int) and \
any(y == interface for x, y in self.nics[role].items()):
raise NetworkSettingsException(
"Duplicate {} already specified for "
@@ -183,7 +186,6 @@ class NetworkSettings(dict):
ip = ipaddress.ip_address(_network['installer_vm']['ip'])
nic_if = ip_utils.get_interface(ucloud_if_list[0], ip.version)
if nic_if:
- ucloud_if_list = [nic_if]
logging.info("{}_bridged_interface: {}".
format(network, nic_if))
else:
@@ -312,16 +314,16 @@ class NetworkSettings(dict):
flatten lists to delim separated strings
flatten dics to underscored key names and string values
"""
- if type(obj) is list:
+ if isinstance(obj, list):
return "{}=\'{}\'\n".format(name,
delim.join(map(lambda x: str(x),
obj)))
- elif type(obj) is dict:
+ elif isinstance(obj, dict):
flat_str = ''
for k in obj:
flat_str += flatten("{}_{}".format(name, k), obj[k])
return flat_str
- elif type(obj) is str:
+ elif isinstance(obj, str):
return "{}='{}'\n".format(name, obj)
else:
return "{}={}\n".format(name, str(obj))
diff --git a/lib/undercloud-functions.sh b/lib/undercloud-functions.sh
index bd93aa78..a5d3b78d 100755
--- a/lib/undercloud-functions.sh
+++ b/lib/undercloud-functions.sh
@@ -253,6 +253,7 @@ sudo systemctl restart openstack-heat-api
EOI
# configure external network
+if [[ "$enabled_network_list" =~ "external" ]]; then
ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" << EOI
if [[ "$external_installer_vm_vlan" != "native" ]]; then
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-vlan${external_installer_vm_vlan}
@@ -274,6 +275,7 @@ else
fi
fi
EOI
+fi
# WORKAROUND: must restart the above services to fix sync problem with nova compute manager
# TODO: revisit and file a bug if necessary. This should eventually be removed