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