Adds router_external Boolean to ProviderNet

Updates OS::Neutron::ProviderNet resource type.
router_external maps to router:external Neutron Net property.

Change-Id: I2f07f87ce5aaa0a5963eab2f557fdbfffe359158
This commit is contained in:
Matthew Flusche 2015-12-08 22:51:56 +00:00
parent 98fc4c7e37
commit 561365e4a4
2 changed files with 21 additions and 4 deletions

View File

@ -29,9 +29,11 @@ class ProviderNet(net.Net):
PROPERTIES = (
NAME, PROVIDER_NETWORK_TYPE, PROVIDER_PHYSICAL_NETWORK,
PROVIDER_SEGMENTATION_ID, ADMIN_STATE_UP, SHARED,
ROUTER_EXTERNAL,
) = (
'name', 'network_type', 'physical_network',
'segmentation_id', 'admin_state_up', 'shared',
'router_external',
)
ATTRIBUTES = (
@ -72,6 +74,13 @@ class ProviderNet(net.Net):
default=True,
update_allowed=True
),
ROUTER_EXTERNAL: properties.Schema(
properties.Schema.BOOLEAN,
_('Whether the network contains an external router.'),
default=False,
update_allowed=True,
support_status=support.SupportStatus(version='6.0.0')
),
}
attributes_schema = {
@ -117,6 +126,9 @@ class ProviderNet(net.Net):
props,
ProviderNet.PROVIDER_SEGMENTATION_ID)
if ProviderNet.ROUTER_EXTERNAL in props:
props['router:external'] = props.pop(ProviderNet.ROUTER_EXTERNAL)
def handle_create(self):
"""Creates the resource with provided properties.

View File

@ -37,6 +37,7 @@ resources:
network_type: vlan
physical_network: physnet_1
segmentation_id: 101
router_external: False
shared: true
'''
@ -50,6 +51,7 @@ stpna = {
"provider:network_type": "vlan",
"provider:physical_network": "physnet_1",
"provider:segmentation_id": "101",
"router:external": False,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
}
@ -79,6 +81,7 @@ class NeutronProviderNetTest(common.HeatTestCase):
'provider:network_type': 'vlan',
'provider:physical_network': 'physnet_1',
'provider:segmentation_id': '101',
'router:external': False,
'shared': True}
}).AndReturn(stpnb)
@ -152,7 +155,8 @@ class NeutronProviderNetTest(common.HeatTestCase):
{'network': {
'provider:network_type': 'vlan',
'provider:physical_network': 'physnet_1',
'provider:segmentation_id': '102'
'provider:segmentation_id': '102',
'router:external': 'True'
}}).AndReturn(None)
neutronclient.Client.update_network(
@ -169,9 +173,10 @@ class NeutronProviderNetTest(common.HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
prop_diff = {
"network_type": "vlan",
"physical_network": "physnet_1",
"segmentation_id": "102"
'network_type': 'vlan',
'physical_network': 'physnet_1',
'segmentation_id': '102',
'router_external': 'True'
}
update_snippet = rsrc_defn.ResourceDefinition(rsrc.name, rsrc.type(),
prop_diff)