Merge "use constants rather than static strings"
This commit is contained in:
commit
a64fd6f327
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import port
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
@ -42,10 +43,10 @@ DESCRIPTION = "Expose status of underlying data plane"
|
||||
UPDATED_TIMESTAMP = "2017-01-24T10:00:00-00:00"
|
||||
|
||||
# The name of the resource introduced or being extended.
|
||||
RESOURCE_NAME = 'port'
|
||||
RESOURCE_NAME = port.RESOURCE_NAME
|
||||
|
||||
# The plural for the resource introduced or being extended.
|
||||
COLLECTION_NAME = 'ports'
|
||||
COLLECTION_NAME = port.COLLECTION_NAME
|
||||
|
||||
# The specific resources and/or attributes for the extension (optional).
|
||||
DATA_PLANE_STATUS = 'data_plane_status'
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api.definitions import port
|
||||
|
||||
|
||||
# Common definitions for maximum string field length
|
||||
@ -89,12 +90,12 @@ UPDATED_TIMESTAMP = "2013-03-17T12:00:00-00:00"
|
||||
# The name of the resource introduced or being extended
|
||||
# (in case it is defined by another extension, or it is
|
||||
# a core resource).
|
||||
RESOURCE_NAME = 'port'
|
||||
RESOURCE_NAME = port.RESOURCE_NAME
|
||||
|
||||
# The plural for the resource introduced or being extended
|
||||
# (in case it is defined by another extension, or it is a
|
||||
# core resource).
|
||||
COLLECTION_NAME = 'ports'
|
||||
COLLECTION_NAME = port.COLLECTION_NAME
|
||||
|
||||
# The resource attribute map for the extension. It is effectively the
|
||||
# bulk of the API contract alongside ACTION_MAP (mandatory).
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api.definitions import constants as api_const
|
||||
from neutron_lib.api.definitions import port
|
||||
from neutron_lib.db import constants as db_const
|
||||
|
||||
# The alias of the extension.
|
||||
@ -119,10 +120,11 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'is_visible': True, 'required_by_policy': True,
|
||||
'enforce_policy': True},
|
||||
'ports': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid_list': None},
|
||||
'convert_to': converters.convert_none_to_empty_list,
|
||||
'default': None, 'is_visible': True},
|
||||
port.COLLECTION_NAME: {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid_list': None},
|
||||
'convert_to':
|
||||
converters.convert_none_to_empty_list,
|
||||
'default': None, 'is_visible': True},
|
||||
'tenant_id': {'allow_post': True, 'allow_put': False,
|
||||
'required_by_policy': True,
|
||||
'validate': {'type:string':
|
||||
@ -160,10 +162,11 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'is_visible': True, 'required_by_policy': True,
|
||||
'enforce_policy': True},
|
||||
'firewall_rules': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid_list': None},
|
||||
'convert_to': converters.convert_none_to_empty_list,
|
||||
'default': None, 'is_visible': True},
|
||||
api_const.FIREWALL_RULES: {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:uuid_list': None},
|
||||
'convert_to':
|
||||
converters.convert_none_to_empty_list,
|
||||
'default': None, 'is_visible': True},
|
||||
'audited': {'allow_post': True, 'allow_put': True, 'default': False,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'is_visible': True},
|
||||
|
@ -10,6 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import constants as api_const
|
||||
from neutron_lib import constants
|
||||
|
||||
# The alias of the extension.
|
||||
@ -40,7 +41,7 @@ UPDATED_TIMESTAMP = "2016-01-01T10:00:00-00:00"
|
||||
RESOURCE_NAME = "firewall"
|
||||
|
||||
# The plural for the resource
|
||||
COLLECTION_NAME = "firewalls"
|
||||
COLLECTION_NAME = api_const.FIREWALLS
|
||||
|
||||
RESOURCE_ATTRIBUTE_MAP = {
|
||||
COLLECTION_NAME: {
|
||||
|
@ -11,6 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api.definitions import subnet
|
||||
from neutron_lib.db import constants as db_const
|
||||
|
||||
|
||||
@ -39,9 +40,9 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'validate': {
|
||||
'type:string': db_const.NAME_FIELD_SIZE},
|
||||
'default': '', 'is_visible': True},
|
||||
'subnets': {'allow_post': False, 'allow_put': False,
|
||||
'default': [],
|
||||
'is_visible': True},
|
||||
subnet.COLLECTION_NAME: {'allow_post': False, 'allow_put': False,
|
||||
'default': [],
|
||||
'is_visible': True},
|
||||
'admin_state_up': {'allow_post': True, 'allow_put': True,
|
||||
'default': True,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
|
@ -13,6 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api.definitions import network
|
||||
from neutron_lib.api.definitions import port
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
@ -54,14 +56,14 @@ UPDATED_TIMESTAMP = "2012-07-23T10:00:00-00:00"
|
||||
|
||||
|
||||
RESOURCE_ATTRIBUTE_MAP = {
|
||||
'networks': {
|
||||
network.COLLECTION_NAME: {
|
||||
PORTSECURITY: {'allow_post': True, 'allow_put': True,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'enforce_policy': True,
|
||||
'default': DEFAULT_PORT_SECURITY,
|
||||
'is_visible': True},
|
||||
},
|
||||
'ports': {
|
||||
port.COLLECTION_NAME: {
|
||||
PORTSECURITY: {'allow_post': True, 'allow_put': True,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import port
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
@ -137,10 +138,10 @@ DESCRIPTION = "Expose port bindings of a virtual port to external application"
|
||||
UPDATED_TIMESTAMP = "2014-02-03T10:00:00-00:00"
|
||||
|
||||
# The name of the resource.
|
||||
RESOURCE_NAME = 'port'
|
||||
RESOURCE_NAME = port.RESOURCE_NAME
|
||||
|
||||
# The plural for the resource.
|
||||
COLLECTION_NAME = 'ports'
|
||||
COLLECTION_NAME = port.COLLECTION_NAME
|
||||
|
||||
RESOURCE_ATTRIBUTE_MAP = {
|
||||
COLLECTION_NAME: {
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api.definitions import network
|
||||
from neutron_lib import constants
|
||||
|
||||
# The alias of the extension.
|
||||
@ -44,10 +45,10 @@ DESCRIPTION = "Expose mapping of virtual networks to physical networks"
|
||||
UPDATED_TIMESTAMP = "2012-09-07T10:00:00-00:00"
|
||||
|
||||
# The name of the resource.
|
||||
RESOURCE_NAME = 'network'
|
||||
RESOURCE_NAME = network.RESOURCE_NAME
|
||||
|
||||
# The plural for the resource.
|
||||
COLLECTION_NAME = 'networks'
|
||||
COLLECTION_NAME = network.COLLECTION_NAME
|
||||
|
||||
NETWORK_TYPE = 'provider:network_type'
|
||||
PHYSICAL_NETWORK = 'provider:physical_network'
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import port
|
||||
from neutron_lib.api.definitions import trunk
|
||||
from neutron_lib import constants
|
||||
|
||||
@ -41,10 +42,10 @@ DESCRIPTION = "Expose trunk port details"
|
||||
TIMESTAMP = "2016-01-01T10:00:00-00:00"
|
||||
|
||||
# The name of the resource introduced or being extended.
|
||||
RESOURCE_NAME = 'port'
|
||||
RESOURCE_NAME = port.RESOURCE_NAME
|
||||
|
||||
# The plural for the resource introduced or being extended.
|
||||
COLLECTION_NAME = 'ports'
|
||||
COLLECTION_NAME = port.COLLECTION_NAME
|
||||
|
||||
# The specific resources and/or attributes for the extension (optional).
|
||||
TRUNK_DETAILS = 'trunk_details'
|
||||
|
Loading…
Reference in New Issue
Block a user