Merge "Add shim extension admin_state_down_before_update"

This commit is contained in:
Zuul 2019-07-10 15:35:16 +00:00 committed by Gerrit Code Review
commit 7778e3118b
5 changed files with 64 additions and 0 deletions

View File

@ -52,6 +52,17 @@ Resource timestamps
The ``standard-attr-timestamp`` extension adds the ``created_at`` and
``updated_at`` attributes to all resources that have standard attributes.
Router admin state down before update extension
===============================================
The ``router-admin-state-down-before-update`` extension adds the requirement
that the administrative state of a distributed virtual router (DVR) be set to
DOWN (``admin_state_up=False``) prior to modifying the ``distributed``
parameter of the router. The API will return an error response code of 400 if
the router's ``distributed`` attribute is modified without first setting the
router's ``admin_state_up=False``.
This extension requires the ``dvr`` extension.
Router availability zone extension
==================================

View File

@ -86,6 +86,7 @@ from neutron_lib.api.definitions import qos_rule_type_details
from neutron_lib.api.definitions import qos_rules_alias
from neutron_lib.api.definitions import rbac_security_groups
from neutron_lib.api.definitions import revisionifmatch
from neutron_lib.api.definitions import router_admin_state_down_before_update
from neutron_lib.api.definitions import router_availability_zone
from neutron_lib.api.definitions import router_interface_fip
from neutron_lib.api.definitions import routerservicetype
@ -191,6 +192,7 @@ _ALL_API_DEFINITIONS = {
qos_rules_alias,
rbac_security_groups,
revisionifmatch,
router_admin_state_down_before_update,
router_availability_zone,
router_interface_fip,
routerservicetype,

View File

@ -0,0 +1,28 @@
# 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 dvr as dvr_apidef
ALIAS = 'router-admin-state-down-before-update'
IS_SHIM_EXTENSION = True
IS_STANDARD_ATTR_EXTENSION = False
NAME = "Enforce Router's Admin State Down Before Update Extension"
DESCRIPTION = ('Ensure that the admin state of a router is DOWN '
'(admin_state_up=False) before updating the distributed '
'attribute')
UPDATED_TIMESTAMP = '2019-07-02T15:56:00'
RESOURCE_ATTRIBUTE_MAP = {}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [dvr_apidef.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -0,0 +1,18 @@
# 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 router_admin_state_down_before_update
from neutron_lib.tests.unit.api.definitions import base
class AdminStateDownToUpdateDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = router_admin_state_down_before_update

View File

@ -0,0 +1,5 @@
---
features:
- Router API is modified through a regime API extension to neutron-lib that
enforces the admin state of a router be DOWN (admin_state_up=False) prior
to modifying the distributed attribute of the router.