rehome network ip availability extension api definition

This patch rehomes neutron's network ip availability extension's API
definition into neutron-lib. UTs and a release note are also included.

Change-Id: I44451faa51b47e14ea17c60c035f3f497f00d7f6
This commit is contained in:
Boden R 2017-08-17 11:42:20 -06:00
parent 8c400f893a
commit ed7c83ffa4
4 changed files with 87 additions and 0 deletions

View File

@ -28,6 +28,7 @@ from neutron_lib.api.definitions import l3
from neutron_lib.api.definitions import logging
from neutron_lib.api.definitions import logging_resource
from neutron_lib.api.definitions import network
from neutron_lib.api.definitions import network_ip_availability
from neutron_lib.api.definitions import network_mtu
from neutron_lib.api.definitions import port
from neutron_lib.api.definitions import port_security
@ -59,6 +60,7 @@ _ALL_API_DEFINITIONS = {
logging,
logging_resource,
network,
network_ip_availability,
network_mtu,
port,
port_security,

View File

@ -0,0 +1,59 @@
# Copyright 2016 GoDaddy.
#
# 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.
ALIAS = 'network-ip-availability'
IS_SHIM_EXTENSION = False
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Network IP Availability'
API_PREFIX = ''
DESCRIPTION = 'Provides IP availability data for each network and subnet.'
UPDATED_TIMESTAMP = '2015-09-24T00:00:00-00:00'
RESOURCE_NAME = "network_ip_availability"
RESOURCE_PLURAL = "network_ip_availabilities"
COLLECTION_NAME = RESOURCE_PLURAL.replace('_', '-')
RESOURCE_ATTRIBUTE_MAP = {
RESOURCE_PLURAL: {
'network_id': {
'allow_post': False, 'allow_put': False,
'is_visible': True
},
'network_name': {
'allow_post': False, 'allow_put': False,
'is_visible': True
},
'tenant_id': {
'allow_post': False, 'allow_put': False,
'is_visible': True
},
'total_ips': {
'allow_post': False, 'allow_put': False,
'is_visible': True
},
'used_ips': {
'allow_post': False, 'allow_put': False,
'is_visible': True
},
'subnet_ip_availability': {
'allow_post': False, 'allow_put': False,
'is_visible': True
}
# TODO(wwriverrat) Make composite attribute for subnet_ip_availability
}
}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = []
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -0,0 +1,22 @@
# 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 network_ip_availability
from neutron_lib.tests.unit.api.definitions import base
class NetworkIPAvailabilityDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = network_ip_availability
extension_resources = (network_ip_availability.RESOURCE_PLURAL,)
extension_attributes = ('total_ips', 'used_ips',
'subnet_ip_availability',
'network_name',)

View File

@ -0,0 +1,4 @@
---
features:
- The ``network-ip-availability`` extension's API definition is now available
in ``neutron_lib.api.definitions.network_ip_availability``.