Merge "Add extension "subnet-external-network""

This commit is contained in:
Zuul 2024-02-23 16:26:12 +00:00 committed by Gerrit Code Review
commit d131b53403
10 changed files with 102 additions and 5 deletions

View File

@ -1661,6 +1661,12 @@ subnet-network_id-query:
in: query
required: false
type: string
subnet-router:external:
description: |
The membership of a subnet to an external network.
in: query
required: false
type: boolean
subnet-segment_id-query:
description: |
Filter the subnet list result by the ID of a network segment the subnet

View File

@ -27,6 +27,7 @@
"service_types": [],
"subnetpool_id": null,
"tags": ["tag1,tag2"],
"updated_at": "2016-10-10T14:35:47Z"
"updated_at": "2016-10-10T14:35:47Z",
"router:external": false
}
}

View File

@ -27,6 +27,7 @@
"revision_number": 2,
"service_types": [],
"subnetpool_id": null,
"tags": ["tag1,tag2"]
"tags": ["tag1,tag2"],
"router:external": false
}
}

View File

@ -24,6 +24,7 @@
"updated_at": "2016-03-08T20:19:41",
"id": "08eae331-0402-425a-923c-34f7cfe39c1b",
"description": "",
"tags": ["tag1,tag2"]
"tags": ["tag1,tag2"],
"router:external": false
}
}

View File

@ -28,7 +28,8 @@
"service_types": [],
"subnetpool_id": null,
"tags": ["tag1,tag2"],
"updated_at": "2016-10-10T14:35:34Z"
"updated_at": "2016-10-10T14:35:34Z",
"router:external": false
},
{
"name": "my_subnet",
@ -58,7 +59,8 @@
"service_types": [],
"subnetpool_id": null,
"tags": ["tag1,tag2"],
"updated_at": "2016-10-10T14:35:47Z"
"updated_at": "2016-10-10T14:35:47Z",
"router:external": true
}
]
}

View File

@ -165,6 +165,7 @@ Response Parameters
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
@ -289,6 +290,7 @@ Response Parameters
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
@ -372,6 +374,7 @@ Response Parameters
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
@ -428,6 +431,7 @@ Response Parameters
- subnetpool_id: subnet-subnetpool_id
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------
@ -502,6 +506,7 @@ Response Parameters
- updated_at: updated_at_resource
- tags: tags
- dns_publish_fixed_ip: subnet-dns_publish_fixed_ip
- router:external: subnet-router:external
Response Example
----------------

View File

@ -146,6 +146,7 @@ from neutron_lib.api.definitions import standard_attr_segment
from neutron_lib.api.definitions import stateful_security_group
from neutron_lib.api.definitions import subnet
from neutron_lib.api.definitions import subnet_dns_publish_fixed_ip
from neutron_lib.api.definitions import subnet_external_network
from neutron_lib.api.definitions import subnet_onboard
from neutron_lib.api.definitions import subnet_segmentid_enforce
from neutron_lib.api.definitions import subnet_segmentid_writable
@ -302,6 +303,7 @@ _ALL_API_DEFINITIONS = {
stateful_security_group,
subnet,
subnet_dns_publish_fixed_ip,
subnet_external_network,
subnet_onboard,
subnet_segmentid_enforce,
subnet_segmentid_writable,

View File

@ -0,0 +1,49 @@
# Copyright (c) 2024 Red Hat Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import converters
from neutron_lib.api.definitions import external_net as extnet_def
from neutron_lib.api.definitions import subnet as subnet_def
ALIAS = 'subnet-external-network'
IS_SHIM_EXTENSION = False
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Subnet belongs to an external network'
API_PREFIX = ''
DESCRIPTION = 'Informs if the subnet belongs to an external network'
UPDATED_TIMESTAMP = '2024-02-05T18:00:00-00:00'
RESOURCE_NAME = extnet_def.EXTERNAL # 'router:external'
RESOURCE_ATTRIBUTE_MAP = {
subnet_def.COLLECTION_NAME: {
RESOURCE_NAME: {
'allow_post': False,
'allow_put': False,
'default': False,
'is_visible': True,
'is_filter': False,
'convert_to': converters.convert_to_boolean,
'enforce_policy': True,
'required_by_policy': True
}
}
}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
ACTION_STATUS = {}
REQUIRED_EXTENSIONS = []
OPTIONAL_EXTENSIONS = []

View File

@ -0,0 +1,22 @@
# Copyright (c) 2024 Red Hat Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api.definitions import subnet_external_network
from neutron_lib.tests.unit.api.definitions import base
class SubnetExternalNetworkDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = subnet_external_network
extension_attributes = (subnet_external_network.RESOURCE_NAME,)

View File

@ -0,0 +1,8 @@
---
features:
- |
Added new extension ``subnet-router:external``. This extension adds a
new field to the ``subnet`` resource definition, called
``router:external``, that is a boolean that represents if the subnet
belongs to an external network. This is the same parameter name used in
the external network flag.