Annotate filter parameters for all resources

Add a 'is_filter' keyword for each resource's attribute that can be
used as filter. In the future, we will rely on this to perform
filter validation: https://review.openstack.org/#/c/554368/ .

This patch processes the following resources: ports, segments,
trunks, address scopes, floating IPs, routers, subnetpools,
subnets, agents, availability zones, flavors, log, metering,
qos related resources.

Note: This patch processes the attributes that are documented
as filter parameter in api-ref.

Change-Id: I595b27a83fb2c185a4889030d619ce4d877fa881
Related-Bug: #1749820
This commit is contained in:
Hongbin Lu 2018-05-08 18:29:48 +00:00
parent 48b09a44bb
commit eb27424cb0
17 changed files with 112 additions and 16 deletions

View File

@ -36,29 +36,34 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {'allow_post': False,
'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True,
'primary_key': True},
'name': {'allow_post': True,
'allow_put': True,
'default': '',
'validate': {'type:string': db_constants.NAME_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
'tenant_id': {'allow_post': True,
'allow_put': False,
'validate': {
'type:string': db_constants.PROJECT_ID_FIELD_SIZE},
'required_by_policy': True,
'is_filter': True,
'is_visible': True},
constants.SHARED: {'allow_post': True,
'allow_put': True,
'default': False,
'convert_to': converters.convert_to_boolean,
'is_visible': True,
'is_filter': True,
'required_by_policy': True,
'enforce_policy': True},
'ip_version': {'allow_post': True, 'allow_put': False,
'convert_to': converters.convert_to_int,
'validate': {'type:values': [4, 6]},
'is_filter': True,
'is_visible': True},
},
'subnetpools': {
@ -66,6 +71,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {'type:uuid_or_none': None},
'is_filter': True,
'is_visible': True}
},
'networks': {

View File

@ -29,17 +29,19 @@ RESOURCE_ATTRIBUTE_MAP = {
COLLECTION_NAME: {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True},
'agent_type': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'is_filter': True, 'is_visible': True},
'binary': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'is_filter': True, 'is_visible': True},
'topic': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'is_filter': True, 'is_visible': True},
'host': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'is_filter': True, 'is_visible': True},
'admin_state_up': {'allow_post': False, 'allow_put': True,
'convert_to': converters.convert_to_boolean,
'is_filter': True,
'is_visible': True},
'created_at': {'allow_post': False, 'allow_put': False,
'is_visible': True},
@ -48,12 +50,12 @@ RESOURCE_ATTRIBUTE_MAP = {
'heartbeat_timestamp': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'alive': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'is_filter': True, 'is_visible': True},
'configurations': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'description': {
'allow_post': False, 'allow_put': True,
'is_visible': True,
'is_visible': True, 'is_filter': True,
'validate': {
'type:string_or_none': constants.DESCRIPTION_FIELD_SIZE}},
}

View File

@ -32,13 +32,13 @@ RESOURCE_NAME = 'availability_zone'
COLLECTION_NAME = RESOURCE_NAME + 's'
RESOURCE_ATTRIBUTE_MAP = {
COLLECTION_NAME: {
'name': {'is_visible': True},
'resource': {'is_visible': True},
'state': {'is_visible': True}
'name': {'is_visible': True, 'is_filter': True},
'resource': {'is_visible': True, 'is_filter': True},
'state': {'is_visible': True, 'is_filter': True}
},
agent.COLLECTION_NAME: {
RESOURCE_NAME: {
'allow_post': False, 'allow_put': False,
'allow_post': False, 'allow_put': False, 'is_filter': True,
'is_visible': True}
}
}

View File

@ -31,18 +31,21 @@ RESOURCE_ATTRIBUTE_MAP = {
FLAVORS: {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_visible': True, 'is_filter': True,
'primary_key': True},
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'is_filter': True,
'is_visible': True, 'default': ''},
'description': {'allow_post': True, 'allow_put': True,
'validate': {'type:string_or_none':
db_const.LONG_DESCRIPTION_FIELD_SIZE},
'is_filter': True,
'is_visible': True, 'default': ''},
'service_type': {'allow_post': True, 'allow_put': False,
'validate':
{'type:service_plugin_type': None},
'is_filter': True,
'is_visible': True},
'tenant_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
@ -54,22 +57,23 @@ RESOURCE_ATTRIBUTE_MAP = {
'is_visible': True, 'default': []},
'enabled': {'allow_post': True, 'allow_put': True,
'convert_to': converters.convert_to_boolean_if_not_none,
'default': True,
'default': True, 'is_filter': True,
'is_visible': True},
},
SERVICE_PROFILES: {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_visible': True, 'is_filter': True,
'primary_key': True},
'description': {'allow_post': True, 'allow_put': True,
'validate': {'type:string_or_none':
db_const.LONG_DESCRIPTION_FIELD_SIZE},
'is_filter': True,
'is_visible': True, 'default': ''},
'driver': {'allow_post': True, 'allow_put': True,
'validate': {'type:string':
db_const.LONG_DESCRIPTION_FIELD_SIZE},
'is_visible': True,
'is_visible': True, 'is_filter': True,
'default': ''},
'metainfo': {'allow_post': True, 'allow_put': True,
'is_visible': True,
@ -81,6 +85,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'is_visible': True},
'enabled': {'allow_post': True, 'allow_put': True,
'convert_to': converters.convert_to_boolean_if_not_none,
'is_filter': True,
'is_visible': True, 'default': True},
},
}

View File

@ -34,6 +34,7 @@ RESOURCE_ATTRIBUTE_MAP = {
IP_ALLOCATION: {
'allow_post': False,
'allow_put': False,
'is_filter': True,
'is_visible': True
}
}

View File

@ -64,13 +64,16 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'primary_key': True},
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': constants.NAME_FIELD_SIZE},
'is_filter': True,
'is_visible': True, 'default': ''},
'admin_state_up': {'allow_post': True, 'allow_put': True,
'default': True,
'convert_to': converters.convert_to_boolean,
'is_filter': True,
'is_visible': True},
'status': {'allow_post': False, 'allow_put': False,
'is_visible': True},
@ -78,6 +81,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'required_by_policy': True,
'validate': {
'type:string': constants.PROJECT_ID_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
EXTERNAL_GW_INFO: {'allow_post': True, 'allow_put': True,
'is_visible': True, 'default': None,
@ -100,6 +104,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'primary_key': True},
'floating_ip_address': {'allow_post': True, 'allow_put': False,
'validate': {'type:ip_address_or_none': None},
@ -111,23 +116,29 @@ RESOURCE_ATTRIBUTE_MAP = {
'default': None},
'floating_network_id': {'allow_post': True, 'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True},
'router_id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid_or_none': None},
'is_filter': True,
'is_visible': True, 'default': None},
'port_id': {'allow_post': True, 'allow_put': True,
'validate': {'type:uuid_or_none': None},
'is_filter': True,
'is_visible': True, 'default': None,
'required_by_policy': True},
'fixed_ip_address': {'allow_post': True, 'allow_put': True,
'validate': {'type:ip_address_or_none': None},
'is_filter': True,
'is_visible': True, 'default': None},
'tenant_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {
'type:string': constants.PROJECT_ID_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
'status': {'allow_post': False, 'allow_put': False,
'is_filter': True,
'is_visible': True},
},
}

View File

@ -58,33 +58,41 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'primary_key': True},
'project_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {
'type:string':
db_const.PROJECT_ID_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'is_filter': True,
'default': '', 'is_visible': True},
'resource_type': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {
'type:string':
db_const.RESOURCE_TYPE_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
'resource_id': {'allow_post': True, 'allow_put': False,
'validate': {'type:uuid_or_none': None},
'is_filter': True,
'default': None, 'is_visible': True},
'event': {'allow_post': True, 'allow_put': False,
'validate': {'type:values': LOG_EVENTS},
'is_filter': True,
'default': ALL_EVENT, 'is_visible': True},
'target_id': {'allow_post': True, 'allow_put': False,
'validate': {'type:uuid_or_none': None},
'is_filter': True,
'default': None, 'is_visible': True},
'enabled': {'allow_post': True, 'allow_put': True,
'is_visible': True, 'default': True,
'is_filter': True,
'convert_to': converters.convert_to_boolean},
},
LOG_TYPES: {

View File

@ -32,17 +32,20 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {
'allow_post': False, 'allow_put': False,
'is_visible': True,
'is_filter': True,
'primary_key': True
},
'name': {
'allow_post': True, 'allow_put': False,
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'is_filter': True,
'is_visible': True, 'default': ''
},
'description': {
'allow_post': True, 'allow_put': False,
'validate': {
'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE},
'is_filter': True,
'is_visible': True, 'default': ''
},
'tenant_id': {
@ -50,10 +53,12 @@ RESOURCE_ATTRIBUTE_MAP = {
'required_by_policy': True,
'validate': {
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'is_filter': True,
'is_visible': True
},
constants.SHARED: {
'allow_post': True, 'allow_put': False,
'is_filter': True,
'is_visible': True, 'default': False,
'convert_to': converters.convert_to_boolean
}
@ -61,27 +66,30 @@ RESOURCE_ATTRIBUTE_MAP = {
METERING_LABEL_RULES: {
'id': {
'allow_post': False, 'allow_put': False,
'is_visible': True,
'is_visible': True, 'is_filter': True,
'primary_key': True
},
'metering_label_id': {
'allow_post': True, 'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True, 'required_by_policy': True
},
'direction': {
'allow_post': True, 'allow_put': False,
'is_visible': True,
'is_visible': True, 'is_filter': True,
'validate': {'type:values': ['ingress', 'egress']}
},
'excluded': {
'allow_post': True, 'allow_put': False,
'is_visible': True, 'default': False,
'is_filter': True,
'convert_to': converters.convert_to_boolean
},
'remote_ip_prefix': {
'allow_post': True, 'allow_put': False,
'is_visible': True, 'required_by_policy': True,
'is_filter': True,
'validate': {'type:subnet': None}
},
'tenant_id': {

View File

@ -28,24 +28,29 @@ RESOURCE_ATTRIBUTE_MAP = {
COLLECTION_NAME: {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True,
'primary_key': True},
'name': {'allow_post': True, 'allow_put': True, 'default': '',
'validate': {
'type:string': db_const.NAME_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
'network_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True},
'admin_state_up': {'allow_post': True, 'allow_put': True,
'default': True,
'convert_to': converters.convert_to_boolean,
'is_filter': True,
'is_visible': True},
'mac_address': {'allow_post': True, 'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {'type:mac_address': None},
'enforce_policy': True,
'is_filter': True,
'is_visible': True},
'fixed_ips': {'allow_post': True, 'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
@ -53,23 +58,28 @@ RESOURCE_ATTRIBUTE_MAP = {
converters.convert_kvp_list_to_dict,
'validate': {'type:fixed_ips': None},
'enforce_policy': True,
'is_filter': True,
'is_visible': True},
'device_id': {'allow_post': True, 'allow_put': True,
'validate': {
'type:string': db_const.DEVICE_ID_FIELD_SIZE},
'default': '',
'is_filter': True,
'is_visible': True},
'device_owner': {'allow_post': True, 'allow_put': True,
'validate': {
'type:string': db_const.DEVICE_OWNER_FIELD_SIZE},
'default': '', 'enforce_policy': True,
'is_filter': True,
'is_visible': True},
'tenant_id': {'allow_post': True, 'allow_put': False,
'validate': {
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'required_by_policy': True,
'is_filter': True,
'is_visible': True},
'status': {'allow_post': False, 'allow_put': False,
'is_filter': True,
'is_visible': True},
}
}

View File

@ -169,6 +169,7 @@ RESOURCE_ATTRIBUTE_MAP = {
HOST_ID: {'allow_post': True, 'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
'is_visible': True,
'is_filter': True,
'enforce_policy': True},
PROFILE: {'allow_post': True, 'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,

View File

@ -32,6 +32,7 @@ _QOS_RULE_COMMON_FIELDS = {
'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'primary_key': True
},
'tenant_id': {
@ -53,21 +54,25 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {
'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True, 'primary_key': True
},
'name': {
'allow_post': True, 'allow_put': True,
'is_visible': True, 'default': '',
'is_filter': True,
'validate': {'type:string': db_const.NAME_FIELD_SIZE}},
constants.SHARED: {
'allow_post': True, 'allow_put': True,
'is_visible': True, 'default': False,
'is_filter': True,
'convert_to': converters.convert_to_boolean
},
'tenant_id': {
'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'is_filter': True,
'is_visible': True
},
'rules': {
@ -114,12 +119,14 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
'allow_post': True, 'allow_put': True,
'convert_to': converters.convert_to_int,
'is_visible': True,
'is_filter': True,
'validate': {
'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]}
},
'max_burst_kbps': {
'allow_post': True, 'allow_put': True,
'is_visible': True, 'default': 0,
'is_filter': True,
'convert_to': converters.convert_to_int,
'validate': {
'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]}}}),
@ -132,6 +139,7 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
'allow_post': True, 'allow_put': True,
'convert_to': converters.convert_to_int,
'is_visible': True,
'is_filter': True,
'validate': {
'type:values': constants.VALID_DSCP_MARKS}}})
},
@ -142,12 +150,14 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
**{'min_kbps': {
'allow_post': True, 'allow_put': True,
'is_visible': True,
'is_filter': True,
'convert_to': converters.convert_to_int,
'validate': {
'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]}},
'direction': {
'allow_post': True, 'allow_put': True,
'is_visible': True, 'default': constants.EGRESS_DIRECTION,
'is_filter': True,
'validate': {
'type:values': [constants.EGRESS_DIRECTION]}}})
}

View File

@ -38,6 +38,7 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
'allow_post': True,
'allow_put': True,
'is_visible': True,
'is_filter': True,
'default': constants.EGRESS_DIRECTION,
'validate': {
'type:values': constants.VALID_DIRECTIONS

View File

@ -30,6 +30,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'allow_put': True,
'default': False,
'convert_to': converters.convert_to_boolean,
'is_filter': True,
'is_visible': True
}
}

View File

@ -43,6 +43,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {
'type:uuid': None
},
'is_filter': True,
'is_visible': True,
'primary_key': True
},
@ -59,6 +60,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {
'type:uuid': None
},
'is_filter': True,
'is_visible': True
},
PHYSICAL_NETWORK: {
@ -68,6 +70,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {
'type:string': provider_net.PHYSICAL_NETWORK_MAX_LEN
},
'is_filter': True,
'is_visible': True
},
NETWORK_TYPE: {
@ -76,6 +79,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {
'type:string': provider_net.NETWORK_TYPE_MAX_LEN
},
'is_filter': True,
'is_visible': True
},
SEGMENTATION_ID: {
@ -92,6 +96,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {
'type:string_or_none': NAME_LEN
},
'is_filter': True,
'is_visible': True
},
'description': {
@ -112,6 +117,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {
'type:uuid_or_none': None
},
'is_filter': True,
'is_visible': True
}
}

View File

@ -29,24 +29,29 @@ RESOURCE_ATTRIBUTE_MAP = {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'primary_key': True},
'name': {'allow_post': True, 'allow_put': True, 'default': '',
'validate': {
'type:string': db_const.NAME_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
'ip_version': {'allow_post': True, 'allow_put': False,
'convert_to': converters.convert_to_int,
'validate': {'type:values': [4, 6]},
'is_filter': True,
'is_visible': True},
'network_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True},
'subnetpool_id': {'allow_post': True,
'allow_put': False,
'default': constants.ATTR_NOT_SPECIFIED,
'required_by_policy': False,
'validate': {'type:subnetpool_id_or_none': None},
'is_filter': True,
'is_visible': True},
'prefixlen': {'allow_post': True,
'allow_put': False,
@ -60,10 +65,12 @@ RESOURCE_ATTRIBUTE_MAP = {
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {'type:subnet_or_none': None},
'required_by_policy': False,
'is_filter': True,
'is_visible': True},
'gateway_ip': {'allow_post': True, 'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {'type:ip_address_or_none': None},
'is_filter': True,
'is_visible': True},
'allocation_pools': {'allow_post': True, 'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
@ -85,20 +92,24 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'required_by_policy': True,
'is_filter': True,
'is_visible': True},
'enable_dhcp': {'allow_post': True, 'allow_put': True,
'default': True,
'convert_to': converters.convert_to_boolean,
'is_filter': True,
'is_visible': True},
'ipv6_ra_mode': {'allow_post': True, 'allow_put': False,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {
'type:values': constants.IPV6_MODES},
'is_filter': True,
'is_visible': True},
'ipv6_address_mode': {'allow_post': True, 'allow_put': False,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {
'type:values': constants.IPV6_MODES},
'is_filter': True,
'is_visible': True},
constants.SHARED: {
'allow_post': False,

View File

@ -30,16 +30,19 @@ RESOURCE_ATTRIBUTE_MAP = {
'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
'is_filter': True,
'primary_key': True},
'name': {'allow_post': True,
'allow_put': True,
'validate': {'type:not_empty_string': None},
'is_filter': True,
'is_visible': True},
'tenant_id': {'allow_post': True,
'allow_put': False,
'validate': {
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'required_by_policy': True,
'is_filter': True,
'is_visible': True},
'prefixes': {'allow_post': True,
'allow_put': True,
@ -50,33 +53,39 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {'type:non_negative': None},
'convert_to': converters.convert_to_int,
'default': constants.ATTR_NOT_SPECIFIED,
'is_filter': True,
'is_visible': True},
'ip_version': {'allow_post': False,
'allow_put': False,
'is_filter': True,
'is_visible': True},
'default_prefixlen': {'allow_post': True,
'allow_put': True,
'validate': {'type:non_negative': None},
'convert_to': converters.convert_to_int,
'default': constants.ATTR_NOT_SPECIFIED,
'is_filter': True,
'is_visible': True},
'min_prefixlen': {'allow_post': True,
'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {'type:non_negative': None},
'convert_to': converters.convert_to_int,
'is_filter': True,
'is_visible': True},
'max_prefixlen': {'allow_post': True,
'allow_put': True,
'default': constants.ATTR_NOT_SPECIFIED,
'validate': {'type:non_negative': None},
'convert_to': converters.convert_to_int,
'is_filter': True,
'is_visible': True},
'is_default': {'allow_post': True,
'allow_put': True,
'default': False,
'convert_to': converters.convert_to_boolean,
'is_visible': True,
'is_filter': True,
'required_by_policy': True,
'enforce_policy': True},
constants.SHARED: {
@ -85,6 +94,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'default': False,
'convert_to': converters.convert_to_boolean,
'is_visible': True,
'is_filter': True,
'required_by_policy': True,
'enforce_policy': True
}

View File

@ -51,21 +51,26 @@ RESOURCE_ATTRIBUTE_MAP = {
'admin_state_up': {'allow_post': True, 'allow_put': True,
'default': True,
'convert_to': converters.convert_to_boolean,
'is_filter': True,
'is_visible': True},
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True, 'primary_key': True},
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'is_filter': True,
'default': '', 'is_visible': True},
'tenant_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate':
{'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'is_filter': True,
'is_visible': True},
'port_id': {'allow_post': True, 'allow_put': False,
'required_by_policy': True,
'validate': {'type:uuid': None},
'is_filter': True,
'is_visible': True},
'status': {'allow_post': False, 'allow_put': False,
'is_visible': True},