rehome shared constant
The SHARED constant is used in a number of projects [1]. This patch rehomes the constant to neutron-lib for consumption and switches all neutron-lib static uses of 'shared' to use the new constant. [1] http://codesearch.openstack.org/?q=att.*%5C.SHARED Change-Id: If123044496b54a8bfc115ab41b8506ec5d7ba5a3
This commit is contained in:
parent
040565797c
commit
624d75828f
|
@ -50,13 +50,13 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'type:string': db_constants.PROJECT_ID_FIELD_SIZE},
|
'type:string': db_constants.PROJECT_ID_FIELD_SIZE},
|
||||||
'required_by_policy': True,
|
'required_by_policy': True,
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
'shared': {'allow_post': True,
|
constants.SHARED: {'allow_post': True,
|
||||||
'allow_put': True,
|
'allow_put': True,
|
||||||
'default': False,
|
'default': False,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'convert_to': converters.convert_to_boolean,
|
||||||
'is_visible': True,
|
'is_visible': True,
|
||||||
'required_by_policy': True,
|
'required_by_policy': True,
|
||||||
'enforce_policy': True},
|
'enforce_policy': True},
|
||||||
'ip_version': {'allow_post': True, 'allow_put': False,
|
'ip_version': {'allow_post': True, 'allow_put': False,
|
||||||
'convert_to': converters.convert_to_int,
|
'convert_to': converters.convert_to_int,
|
||||||
'validate': {'type:values': [4, 6]},
|
'validate': {'type:values': [4, 6]},
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
# 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 import constants
|
||||||
|
|
||||||
|
|
||||||
KNOWN_ATTRIBUTES = (
|
KNOWN_ATTRIBUTES = (
|
||||||
'admin_state_up',
|
'admin_state_up',
|
||||||
'allocation_pools',
|
'allocation_pools',
|
||||||
|
@ -38,7 +41,7 @@ KNOWN_ATTRIBUTES = (
|
||||||
'prefixes',
|
'prefixes',
|
||||||
'prefixlen',
|
'prefixlen',
|
||||||
'project_id',
|
'project_id',
|
||||||
'shared',
|
constants.SHARED,
|
||||||
'status',
|
'status',
|
||||||
'subnets',
|
'subnets',
|
||||||
'subnetpool_id',
|
'subnetpool_id',
|
||||||
|
|
|
@ -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 import constants
|
||||||
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.
|
||||||
|
@ -59,11 +60,13 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'firewall_policy_id': {'allow_post': False, 'allow_put': False,
|
'firewall_policy_id': {'allow_post': False, 'allow_put': False,
|
||||||
'validate': {'type:uuid_or_none': None},
|
'validate': {'type:uuid_or_none': None},
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
'shared': {'allow_post': True, 'allow_put': True,
|
constants.SHARED: {
|
||||||
'default': False,
|
'allow_post': True, 'allow_put': True,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'default': False,
|
||||||
'is_visible': True, 'required_by_policy': True,
|
'convert_to': converters.convert_to_boolean,
|
||||||
'enforce_policy': True},
|
'is_visible': True, 'required_by_policy': True,
|
||||||
|
'enforce_policy': True
|
||||||
|
},
|
||||||
'protocol': {
|
'protocol': {
|
||||||
'allow_post': True, 'allow_put': True,
|
'allow_post': True, 'allow_put': True,
|
||||||
'is_visible': True, 'default': None,
|
'is_visible': True, 'default': None,
|
||||||
|
@ -115,10 +118,12 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'validate': {'type:string':
|
'validate': {'type:string':
|
||||||
db_const.DESCRIPTION_FIELD_SIZE},
|
db_const.DESCRIPTION_FIELD_SIZE},
|
||||||
'is_visible': True, 'default': ''},
|
'is_visible': True, 'default': ''},
|
||||||
'shared': {'allow_post': True, 'allow_put': True,
|
constants.SHARED: {
|
||||||
'default': False, 'enforce_policy': True,
|
'allow_post': True, 'allow_put': True,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'default': False, 'enforce_policy': True,
|
||||||
'is_visible': True, 'required_by_policy': True},
|
'convert_to': converters.convert_to_boolean,
|
||||||
|
'is_visible': True, 'required_by_policy': True
|
||||||
|
},
|
||||||
'firewall_rules': {'allow_post': True, 'allow_put': True,
|
'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,
|
||||||
|
@ -147,10 +152,12 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'convert_to': converters.convert_to_boolean},
|
'convert_to': converters.convert_to_boolean},
|
||||||
'status': {'allow_post': False, 'allow_put': False,
|
'status': {'allow_post': False, 'allow_put': False,
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
'shared': {'allow_post': True, 'allow_put': True,
|
constants.SHARED: {
|
||||||
'default': False, 'enforce_policy': True,
|
'allow_post': True, 'allow_put': True,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'default': False, 'enforce_policy': True,
|
||||||
'is_visible': False, 'required_by_policy': True},
|
'convert_to': converters.convert_to_boolean,
|
||||||
|
'is_visible': False, 'required_by_policy': True
|
||||||
|
},
|
||||||
'firewall_policy_id': {'allow_post': True, 'allow_put': True,
|
'firewall_policy_id': {'allow_post': True, 'allow_put': True,
|
||||||
'validate': {'type:uuid_or_none': None},
|
'validate': {'type:uuid_or_none': None},
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
|
|
|
@ -13,6 +13,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.api.definitions import port
|
||||||
|
from neutron_lib import constants
|
||||||
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.
|
||||||
|
@ -62,10 +63,12 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'firewall_policy_id': {'allow_post': False, 'allow_put': False,
|
'firewall_policy_id': {'allow_post': False, 'allow_put': False,
|
||||||
'validate': {'type:uuid_or_none': None},
|
'validate': {'type:uuid_or_none': None},
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
'shared': {'allow_post': True, 'allow_put': True,
|
constants.SHARED: {
|
||||||
'default': False, 'is_visible': True,
|
'allow_post': True, 'allow_put': True,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'default': False, 'is_visible': True,
|
||||||
'required_by_policy': True, 'enforce_policy': True},
|
'convert_to': converters.convert_to_boolean,
|
||||||
|
'required_by_policy': True, 'enforce_policy': True
|
||||||
|
},
|
||||||
'protocol': {
|
'protocol': {
|
||||||
'allow_post': True, 'allow_put': True,
|
'allow_post': True, 'allow_put': True,
|
||||||
'is_visible': True, 'default': None,
|
'is_visible': True, 'default': None,
|
||||||
|
@ -126,10 +129,12 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'convert_to': converters.convert_to_boolean},
|
'convert_to': converters.convert_to_boolean},
|
||||||
'status': {'allow_post': False, 'allow_put': False,
|
'status': {'allow_post': False, 'allow_put': False,
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
'shared': {'allow_post': True, 'allow_put': True, 'default': False,
|
constants.SHARED: {
|
||||||
'convert_to': converters.convert_to_boolean,
|
'allow_post': True, 'allow_put': True, 'default': False,
|
||||||
'is_visible': True, 'required_by_policy': True,
|
'convert_to': converters.convert_to_boolean,
|
||||||
'enforce_policy': True},
|
'is_visible': True, 'required_by_policy': True,
|
||||||
|
'enforce_policy': True
|
||||||
|
},
|
||||||
port.COLLECTION_NAME: {'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':
|
'convert_to':
|
||||||
|
@ -168,10 +173,12 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'validate': {'type:string':
|
'validate': {'type:string':
|
||||||
db_const.DESCRIPTION_FIELD_SIZE},
|
db_const.DESCRIPTION_FIELD_SIZE},
|
||||||
'is_visible': True, 'default': ''},
|
'is_visible': True, 'default': ''},
|
||||||
'shared': {'allow_post': True, 'allow_put': True, 'default': False,
|
constants.SHARED: {
|
||||||
'convert_to': converters.convert_to_boolean,
|
'allow_post': True, 'allow_put': True, 'default': False,
|
||||||
'is_visible': True, 'required_by_policy': True,
|
'convert_to': converters.convert_to_boolean,
|
||||||
'enforce_policy': True},
|
'is_visible': True, 'required_by_policy': True,
|
||||||
|
'enforce_policy': True
|
||||||
|
},
|
||||||
api_const.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':
|
'convert_to':
|
||||||
|
|
|
@ -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 import constants
|
||||||
from neutron_lib.db import constants as db_const
|
from neutron_lib.db import constants as db_const
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
||||||
'is_visible': True
|
'is_visible': True
|
||||||
},
|
},
|
||||||
'shared': {
|
constants.SHARED: {
|
||||||
'allow_post': True, 'allow_put': False,
|
'allow_post': True, 'allow_put': False,
|
||||||
'is_visible': True, 'default': False,
|
'is_visible': True, 'default': False,
|
||||||
'convert_to': converters.convert_to_boolean
|
'convert_to': converters.convert_to_boolean
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
from neutron_lib.api import converters
|
from neutron_lib.api import converters
|
||||||
from neutron_lib.api.definitions import subnet
|
from neutron_lib.api.definitions import subnet
|
||||||
|
from neutron_lib import constants
|
||||||
from neutron_lib.db import constants as db_const
|
from neutron_lib.db import constants as db_const
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,13 +55,15 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
|
||||||
'required_by_policy': True,
|
'required_by_policy': True,
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
'shared': {'allow_post': True,
|
constants.SHARED: {
|
||||||
'allow_put': True,
|
'allow_post': True,
|
||||||
'default': False,
|
'allow_put': True,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'default': False,
|
||||||
'is_visible': True,
|
'convert_to': converters.convert_to_boolean,
|
||||||
'required_by_policy': True,
|
'is_visible': True,
|
||||||
'enforce_policy': True},
|
'required_by_policy': True,
|
||||||
|
'enforce_policy': True
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'allow_post': True, 'allow_put': True,
|
'allow_post': True, 'allow_put': True,
|
||||||
'is_visible': True, 'default': '',
|
'is_visible': True, 'default': '',
|
||||||
'validate': {'type:string': db_const.NAME_FIELD_SIZE}},
|
'validate': {'type:string': db_const.NAME_FIELD_SIZE}},
|
||||||
'shared': {
|
constants.SHARED: {
|
||||||
'allow_post': True, 'allow_put': True,
|
'allow_post': True, 'allow_put': True,
|
||||||
'is_visible': True, 'default': False,
|
'is_visible': True, 'default': False,
|
||||||
'convert_to': converters.convert_to_boolean
|
'convert_to': converters.convert_to_boolean
|
||||||
|
|
|
@ -100,13 +100,15 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'validate': {
|
'validate': {
|
||||||
'type:values': constants.IPV6_MODES},
|
'type:values': constants.IPV6_MODES},
|
||||||
'is_visible': True},
|
'is_visible': True},
|
||||||
'shared': {'allow_post': False,
|
constants.SHARED: {
|
||||||
'allow_put': False,
|
'allow_post': False,
|
||||||
'default': False,
|
'allow_put': False,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'default': False,
|
||||||
'is_visible': False,
|
'convert_to': converters.convert_to_boolean,
|
||||||
'required_by_policy': True,
|
'is_visible': False,
|
||||||
'enforce_policy': True},
|
'required_by_policy': True,
|
||||||
|
'enforce_policy': True
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,13 +79,15 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||||
'is_visible': True,
|
'is_visible': True,
|
||||||
'required_by_policy': True,
|
'required_by_policy': True,
|
||||||
'enforce_policy': True},
|
'enforce_policy': True},
|
||||||
'shared': {'allow_post': True,
|
constants.SHARED: {
|
||||||
'allow_put': False,
|
'allow_post': True,
|
||||||
'default': False,
|
'allow_put': False,
|
||||||
'convert_to': converters.convert_to_boolean,
|
'default': False,
|
||||||
'is_visible': True,
|
'convert_to': converters.convert_to_boolean,
|
||||||
'required_by_policy': True,
|
'is_visible': True,
|
||||||
'enforce_policy': True},
|
'required_by_policy': True,
|
||||||
|
'enforce_policy': True
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,6 +350,8 @@ UUID_PATTERN = '-'.join([HEX_ELEM + '{8}', HEX_ELEM + '{4}',
|
||||||
HEX_ELEM + '{4}', HEX_ELEM + '{4}',
|
HEX_ELEM + '{4}', HEX_ELEM + '{4}',
|
||||||
HEX_ELEM + '{12}'])
|
HEX_ELEM + '{12}'])
|
||||||
|
|
||||||
|
SHARED = 'shared'
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Device related constants
|
# Device related constants
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_lib.api.definitions import firewall_v2
|
from neutron_lib.api.definitions import firewall_v2
|
||||||
|
from neutron_lib import constants
|
||||||
from neutron_lib.tests.unit.api.definitions import base
|
from neutron_lib.tests.unit.api.definitions import base
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ class FirewallDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||||
'egress_firewall_policy_id', 'enabled',
|
'egress_firewall_policy_id', 'enabled',
|
||||||
'firewall_policy_id', 'firewall_rules',
|
'firewall_policy_id', 'firewall_rules',
|
||||||
'ingress_firewall_policy_id', 'ip_version',
|
'ingress_firewall_policy_id', 'ip_version',
|
||||||
'ports', 'position', 'protocol', 'shared',
|
'ports', 'position', 'protocol', constants.SHARED,
|
||||||
'source_ip_address', 'source_port',
|
'source_ip_address', 'source_port',
|
||||||
'source_firewall_group_id',
|
'source_firewall_group_id',
|
||||||
'destination_firewall_group_id')
|
'destination_firewall_group_id')
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- The ``SHARED`` constant is now available in
|
||||||
|
``neutron_lib.constants``.
|
Loading…
Reference in New Issue