Supports 'availability_zone_hints' for Neutron networks and routers

This patch adds the property 'availability_zone_hints' for OS::Neutron::Router,
OS::Neutron::Net and OS::Neutron::ProviderNet resources.

Story: 1644974
Task: 17156
Signed-off-by: Alejandro <agarcia@whitestack.com>
Change-Id: I71caefae01560dc106badbefd3859813d8417b2a
This commit is contained in:
Alejandro García 2022-01-19 14:47:01 +00:00 committed by Juan Pablo Suazo
parent 9ed612906e
commit 77c6681278
7 changed files with 48 additions and 8 deletions

View File

@ -33,11 +33,11 @@ class Net(neutron.NeutronResource):
PROPERTIES = ( PROPERTIES = (
NAME, VALUE_SPECS, ADMIN_STATE_UP, TENANT_ID, SHARED, NAME, VALUE_SPECS, ADMIN_STATE_UP, TENANT_ID, SHARED,
DHCP_AGENT_IDS, PORT_SECURITY_ENABLED, QOS_POLICY, DHCP_AGENT_IDS, PORT_SECURITY_ENABLED, QOS_POLICY,
DNS_DOMAIN, TAGS, DNS_DOMAIN, AVAILABILITY_ZONE_HINTS, TAGS,
) = ( ) = (
'name', 'value_specs', 'admin_state_up', 'tenant_id', 'shared', 'name', 'value_specs', 'admin_state_up', 'tenant_id', 'shared',
'dhcp_agent_ids', 'port_security_enabled', 'qos_policy', 'dhcp_agent_ids', 'port_security_enabled', 'qos_policy',
'dns_domain', 'tags', 'dns_domain', 'availability_zone_hints', 'tags',
) )
ATTRIBUTES = ( ATTRIBUTES = (
@ -118,6 +118,12 @@ class Net(neutron.NeutronResource):
update_allowed=True, update_allowed=True,
support_status=support.SupportStatus(version='7.0.0') support_status=support.SupportStatus(version='7.0.0')
), ),
AVAILABILITY_ZONE_HINTS: properties.Schema(
properties.Schema.LIST,
_('Availability zone candidates for the network. It requires the '
'availability_zone extension to be available.'),
support_status=support.SupportStatus(version='19.0.0')
),
TAGS: properties.Schema( TAGS: properties.Schema(
properties.Schema.LIST, properties.Schema.LIST,
_('The tags to be added to the network.'), _('The tags to be added to the network.'),

View File

@ -37,11 +37,13 @@ class ProviderNet(net.Net):
PROPERTIES = ( PROPERTIES = (
NAME, PROVIDER_NETWORK_TYPE, PROVIDER_PHYSICAL_NETWORK, NAME, PROVIDER_NETWORK_TYPE, PROVIDER_PHYSICAL_NETWORK,
PROVIDER_SEGMENTATION_ID, ADMIN_STATE_UP, SHARED, PROVIDER_SEGMENTATION_ID, ADMIN_STATE_UP, SHARED,
PORT_SECURITY_ENABLED, ROUTER_EXTERNAL, DNS_DOMAIN, TAGS, PORT_SECURITY_ENABLED, ROUTER_EXTERNAL, DNS_DOMAIN,
AVAILABILITY_ZONE_HINTS, TAGS,
) = ( ) = (
'name', 'network_type', 'physical_network', 'name', 'network_type', 'physical_network',
'segmentation_id', 'admin_state_up', 'shared', 'segmentation_id', 'admin_state_up', 'shared',
'port_security_enabled', 'router_external', 'dns_domain', 'tags', 'port_security_enabled', 'router_external', 'dns_domain',
'availability_zone_hints', 'tags',
) )
@ -119,6 +121,13 @@ class ProviderNet(net.Net):
update_allowed=True, update_allowed=True,
support_status=support.SupportStatus(version='15.0.0') support_status=support.SupportStatus(version='15.0.0')
), ),
AVAILABILITY_ZONE_HINTS: properties.Schema(
properties.Schema.LIST,
_('Availability zone candidates for the network. It requires the '
'availability_zone extension to be available.'),
update_allowed=True,
support_status=support.SupportStatus(version='19.0.0')
),
} }
attributes_schema = { attributes_schema = {

View File

@ -35,10 +35,12 @@ class Router(neutron.NeutronResource):
PROPERTIES = ( PROPERTIES = (
NAME, EXTERNAL_GATEWAY, VALUE_SPECS, ADMIN_STATE_UP, NAME, EXTERNAL_GATEWAY, VALUE_SPECS, ADMIN_STATE_UP,
L3_AGENT_ID, L3_AGENT_IDS, DISTRIBUTED, HA, TAGS, L3_AGENT_ID, L3_AGENT_IDS, DISTRIBUTED, HA, AVAILABILITY_ZONE_HINTS,
TAGS,
) = ( ) = (
'name', 'external_gateway_info', 'value_specs', 'admin_state_up', 'name', 'external_gateway_info', 'value_specs', 'admin_state_up',
'l3_agent_id', 'l3_agent_ids', 'distributed', 'ha', 'tags', 'l3_agent_id', 'l3_agent_ids', 'distributed', 'ha',
'availability_zone_hints', 'tags',
) )
_EXTERNAL_GATEWAY_KEYS = ( _EXTERNAL_GATEWAY_KEYS = (
@ -171,6 +173,13 @@ class Router(neutron.NeutronResource):
'do not support distributed and ha at the same time.'), 'do not support distributed and ha at the same time.'),
support_status=support.SupportStatus(version='2015.1') support_status=support.SupportStatus(version='2015.1')
), ),
AVAILABILITY_ZONE_HINTS: properties.Schema(
properties.Schema.LIST,
_('Availability zone candidates for the router. It requires the '
'availability_zone extension to be available.'),
update_allowed=True,
support_status=support.SupportStatus(version='19.0.0')
),
TAGS: properties.Schema( TAGS: properties.Schema(
properties.Schema.LIST, properties.Schema.LIST,
_('The tags to be added to the router.'), _('The tags to be added to the router.'),

View File

@ -40,6 +40,8 @@ resources:
- 28c25a04-3f73-45a7-a2b4-59e183943ddc - 28c25a04-3f73-45a7-a2b4-59e183943ddc
port_security_enabled: False port_security_enabled: False
dns_domain: openstack.org. dns_domain: openstack.org.
availability_zone_hints:
- az1
value_specs: {'mtu': 1500} value_specs: {'mtu': 1500}
tags: tags:
- tag1 - tag1
@ -186,6 +188,7 @@ class NeutronNetTest(common.HeatTestCase):
'dns_domain': u'openstack.org.', 'dns_domain': u'openstack.org.',
'shared': True, 'shared': True,
'port_security_enabled': False, 'port_security_enabled': False,
'availability_zone_hints': ['az1'],
'mtu': 1500} 'mtu': 1500}
} }
) )

View File

@ -40,6 +40,8 @@ resources:
segmentation_id: 101 segmentation_id: 101
router_external: False router_external: False
shared: true shared: true
availability_zone_hints:
- az1
tags: tags:
- tag1 - tag1
- tag2 - tag2
@ -128,7 +130,8 @@ class NeutronProviderNetTest(common.HeatTestCase):
'provider:physical_network': 'physnet_1', 'provider:physical_network': 'physnet_1',
'provider:segmentation_id': '101', 'provider:segmentation_id': '101',
'router:external': False, 'router:external': False,
'shared': True 'shared': True,
'availability_zone_hints': ['az1'],
} }
}) })
self.mockclient.replace_tag.assert_called_with( self.mockclient.replace_tag.assert_called_with(
@ -180,7 +183,8 @@ class NeutronProviderNetTest(common.HeatTestCase):
'provider:physical_network': 'physnet_1', 'provider:physical_network': 'physnet_1',
'provider:segmentation_id': '101', 'provider:segmentation_id': '101',
'router:external': False, 'router:external': False,
'shared': True} 'shared': True,
'availability_zone_hints': ['az1']}
}) })
self.mockclient.replace_tag.assert_called_with( self.mockclient.replace_tag.assert_called_with(
resource_type, resource_type,
@ -243,6 +247,7 @@ class NeutronProviderNetTest(common.HeatTestCase):
'port_security_enabled': True, 'port_security_enabled': True,
'segmentation_id': None, 'segmentation_id': None,
'router_external': False, 'router_external': False,
'availability_zone_hints': [],
'tags': ['tag1', 'tag2'], 'tags': ['tag1', 'tag2'],
} }

View File

@ -36,6 +36,8 @@ resources:
properties: properties:
l3_agent_ids: l3_agent_ids:
- 792ff887-6c85-4a56-b518-23f24fa65581 - 792ff887-6c85-4a56-b518-23f24fa65581
availability_zone_hints:
- az1
router_interface: router_interface:
type: OS::Neutron::RouterInterface type: OS::Neutron::RouterInterface
@ -262,6 +264,7 @@ class NeutronRouterTest(common.HeatTestCase):
create_body = { create_body = {
'router': { 'router': {
'name': utils.PhysName(stack.name, 'router'), 'name': utils.PhysName(stack.name, 'router'),
'availability_zone_hints': ['az1'],
'admin_state_up': True}} 'admin_state_up': True}}
router_base_info = { router_base_info = {
'router': { 'router': {

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds the 'availability_zone_hints' property for the OS::Neutron::Router,
OS::Neutron::Net and OS::Neutron::ProviderNet resources.