Add ACTION_STATUS to dummy of API definition
Neutron API extension may need specific action status for the API. Some extensions(e.g. tag and tag-ext) already have it. Change-Id: I0979b727171ad7b91641e0d9e0697da1e47c493f
This commit is contained in:
parent
c4a921ec35
commit
9817dc494b
|
@ -104,6 +104,16 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
|
|||
ACTION_MAP = {
|
||||
}
|
||||
|
||||
# The action status: it associates response statuses with methods to be
|
||||
# performed on the API resource (mandatory). For example:
|
||||
#
|
||||
# ACTION_STATUS = {
|
||||
# 'create': 201,
|
||||
# 'delete': 204
|
||||
# }
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions (mandatory).
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -37,6 +37,16 @@ KNOWN_HTTP_ACTIONS = (
|
|||
'PUT',
|
||||
)
|
||||
|
||||
KNOWN_ACTION_STATUSES = (
|
||||
200,
|
||||
201,
|
||||
202,
|
||||
203,
|
||||
204,
|
||||
205,
|
||||
206,
|
||||
)
|
||||
|
||||
KNOWN_EXTENSIONS = (
|
||||
'address-scope',
|
||||
'agent',
|
||||
|
|
|
@ -179,6 +179,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
|
|||
ACTION_MAP = {
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [l3.ALIAS]
|
||||
|
||||
|
|
|
@ -69,6 +69,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
|
|||
ACTION_MAP = {
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -48,6 +48,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = None
|
|||
# The action map.
|
||||
ACTION_MAP = {}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
l3.ALIAS,
|
||||
|
|
|
@ -166,6 +166,10 @@ ACTION_MAP = {
|
|||
'firewall_policy': {'insert_rule': 'PUT', 'remove_rule': 'PUT'},
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -182,6 +182,10 @@ ACTION_MAP = {
|
|||
'firewall_policy': {'insert_rule': 'PUT', 'remove_rule': 'PUT'},
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -60,6 +60,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
|
|||
ACTION_MAP = {
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -151,6 +151,10 @@ ACTION_MAP = {
|
|||
}
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -126,6 +126,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
|
|||
# The action map.
|
||||
ACTION_MAP = {}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
firewall.ALIAS,
|
||||
|
|
|
@ -80,6 +80,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {}
|
|||
# the API resource.
|
||||
ACTION_MAP = {}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = []
|
||||
|
||||
|
|
|
@ -188,6 +188,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = None
|
|||
ACTION_MAP = {
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -98,6 +98,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = None
|
|||
ACTION_MAP = {
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
]
|
||||
|
|
|
@ -48,6 +48,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = None
|
|||
# The action map.
|
||||
ACTION_MAP = {}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
l3.ALIAS,
|
||||
|
|
|
@ -89,6 +89,10 @@ ACTION_MAP = {
|
|||
}
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [
|
||||
"binding",
|
||||
|
|
|
@ -64,6 +64,10 @@ SUB_RESOURCE_ATTRIBUTE_MAP = None
|
|||
# The action map.
|
||||
ACTION_MAP = None
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [trunk.ALIAS]
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ class DefinitionBaseTestCase(test_base.BaseTestCase):
|
|||
self.resource_map = self.extension_module.RESOURCE_ATTRIBUTE_MAP
|
||||
self.subresource_map = self.extension_module.SUB_RESOURCE_ATTRIBUTE_MAP
|
||||
self.action_map = self.extension_module.ACTION_MAP
|
||||
self.action_status = self.extension_module.ACTION_STATUS
|
||||
self.required_extensions = self.extension_module.REQUIRED_EXTENSIONS
|
||||
self.optional_extensions = self.extension_module.OPTIONAL_EXTENSIONS
|
||||
|
||||
|
@ -93,6 +94,7 @@ class DefinitionBaseTestCase(test_base.BaseTestCase):
|
|||
self.assertFalse(self.extension_attributes)
|
||||
self.assertFalse(self.resource_map)
|
||||
self.assertFalse(self.action_map)
|
||||
self.assertFalse(self.action_status)
|
||||
|
||||
def test_is_standard_attr_extension(self):
|
||||
if self.is_standard_attr_extension:
|
||||
|
@ -154,6 +156,14 @@ class DefinitionBaseTestCase(test_base.BaseTestCase):
|
|||
self.assertIn(action, base.KNOWN_HTTP_ACTIONS,
|
||||
'HTTP verb is unknown, check for typos.')
|
||||
|
||||
def test_action_status(self):
|
||||
if not self.action_status:
|
||||
self.skipTest('API definition has no action status.')
|
||||
|
||||
for status in self.action_status.values():
|
||||
self.assertIn(status, base.KNOWN_ACTION_STATUSES,
|
||||
'HTTP status is unknown, check for typos.')
|
||||
|
||||
def test_required_extensions(self):
|
||||
if not self.required_extensions:
|
||||
self.skipTest('API definition has no required extensions.')
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
features:
|
||||
- The ``ACTION_STATUS`` is added to API definitions for neutron extension has
|
||||
specific ``action_status``.
|
Loading…
Reference in New Issue