Make VLAN ranges option when defining provider networks

The provider_network library expects VLAN ranges to be defined within
the provider network definition. In cases where this was not desired,
operators would set dummy ranges (i.e. 1:1) to work around this requirement.
The changes introduced in this patch make 'range' optional.

Change-Id: I0ab1720e5abd74dccf121e8bc075e55d9fbce6e1
This commit is contained in:
James Denton 2020-12-04 12:15:20 -06:00 committed by Jonathan Rosser
parent 81d7d55cad
commit 98b3af136a
2 changed files with 33 additions and 4 deletions

View File

@ -100,6 +100,12 @@ EXAMPLES = """
# group_binds:
# - neutron_linuxbridge_agent
# - network:
# host_bind_override: "bond1"
# type: "vlan"
# net_name: "physnet1"
# group_binds:
# - neutron_linuxbridge_agent
# - network:
# container_bridge: "br-provider"
# container_type: "veth"
# container_interface: "eth11"
@ -221,11 +227,17 @@ class ProviderNetworksParsing(object):
):
if "vlan" not in self.network_types:
self.network_types.append('vlan')
for vlan_range in net['network']['range'].split(','):
self.network_vlan_ranges.append(
'%s:%s' % (
net['network']['net_name'], vlan_range.strip()
if "range" in net['network']:
for vlan_range in net['network']['range'].split(','):
self.network_vlan_ranges.append(
'%s:%s' % (
net['network']['net_name'],
vlan_range.strip()
)
)
else:
self.network_vlan_ranges.append(
net['network']['net_name']
)
elif net['network']['type'] == "vxlan":
if "vxlan" not in self.network_types:

View File

@ -0,0 +1,17 @@
---
fixes:
- |
When defining provider networks, vlan ranges are no longer required.
When a vlan range is not specified, the provider label ``net_name``
still be set in ``network_vlan_ranges``, but automatic VLAN
allocation will not be available.
Implementation Example:
.. code-block:: text
host_bind_override: "bond1"
type: "vlan"
net_name: "physnet1"
group_binds:
- neutron_linuxbridge_agent