remove description API attr from securitygroup

This patch removes the explicit API definition of the 'description'
attribute from the security group API extension. This
attributes is redundant as its added by default by the
standardattrdescription extension and moreover are clobbered by the
latter.

In addition this patch updates the UTs to account for the extension
manager not adding the standardattrdescription to the security group
definition during test runtime.

Also note that the segment API extension has the same issue, but will be
handled with the consumption of https://review.openstack.org/#/c/562331/

Change-Id: I1fcc2adf13792705fc4bb6faf757ee59faee1349
Partial-Bug: 1757513
This commit is contained in:
Boden R 2018-05-03 11:23:01 -06:00
parent 2b11c8a054
commit 0c112a9f89
2 changed files with 9 additions and 4 deletions

View File

@ -31,6 +31,7 @@ from neutron.api import extensions
from neutron.api.v2 import base
from neutron.common import exceptions
from neutron.conf import quota
from neutron.extensions import standardattrdescription as stdattr_ext
from neutron.quota import resource_registry
@ -224,10 +225,6 @@ RESOURCE_ATTRIBUTE_MAP = {
'is_visible': True, 'default': '',
'validate': {
'type:name_not_default': db_const.NAME_FIELD_SIZE}},
'description': {'allow_post': True, 'allow_put': True,
'validate': {
'type:string': db_const.DESCRIPTION_FIELD_SIZE},
'is_visible': True, 'default': ''},
'tenant_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {
@ -338,6 +335,9 @@ class Securitygroup(api_extensions.ExtensionDescriptor):
else:
return {}
def get_required_extensions(self):
return [stdattr_ext.Standardattrdescription.get_alias()]
@six.add_metaclass(abc.ABCMeta)
class SecurityGroupPluginBase(object):

View File

@ -55,6 +55,11 @@ class SecurityGroupTestExtensionManager(object):
ext_sg.RESOURCE_ATTRIBUTE_MAP[ext_sg.SECURITYGROUPRULES])
sg_rule_attr_desc = ext_res[ext_sg.SECURITYGROUPRULES]
existing_sg_rule_attr_map.update(sg_rule_attr_desc)
if ext_sg.SECURITYGROUPS in ext_res:
existing_sg_attr_map = (
ext_sg.RESOURCE_ATTRIBUTE_MAP[ext_sg.SECURITYGROUPS])
sg_attr_desc = ext_res[ext_sg.SECURITYGROUPS]
existing_sg_attr_map.update(sg_attr_desc)
return ext_sg.Securitygroup.get_resources()
def get_actions(self):