Fix sorting API responses

neutron introduced a limitation on the sort_key parameter with [0],
making all sorting for lbaas API invalid. Add the necessary attributes
in order to allow all the sorting again that is happening in the
unit tests. It might be necessary or useful to add further keys later.

[0] https://review.opendev.org/705198

Change-Id: I9d7ec77921ad094ce68b114e2c16665e48818a72
This commit is contained in:
Jens Harbott 2020-11-05 15:31:03 +00:00
parent 7a4ef6704b
commit 91ea6fb093
2 changed files with 8 additions and 0 deletions

View File

@ -87,6 +87,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': None},
'default': '',
'is_sort_key': True,
'is_visible': True},
'description': {'allow_post': True, 'allow_put': True,
'validate': {
@ -157,6 +158,7 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
'is_visible': True},
'value': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': None},
'is_sort_key': True,
'is_visible': True},
'admin_state_up': {'allow_post': True, 'allow_put': True,
'default': True,

View File

@ -166,6 +166,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'default': '',
'is_sort_key': True,
'is_visible': True},
'tenant_id': {'allow_post': True, 'allow_put': False,
'validate': {'type:not_empty_string':
@ -216,6 +217,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'default': '',
'is_sort_key': True,
'is_visible': True},
'description': {'allow_post': True, 'allow_put': True,
'validate': {
@ -251,6 +253,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'protocol_port': {'allow_post': True, 'allow_put': False,
'validate': {'type:range': [1, 65535]},
'convert_to': converters.convert_to_int,
'is_sort_key': True,
'is_visible': True},
'admin_state_up': {'allow_post': True, 'allow_put': True,
'default': True,
@ -269,6 +272,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'is_visible': True},
'name': {'allow_post': True, 'allow_put': True,
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'is_sort_key': True,
'is_visible': True, 'default': ''},
'description': {'allow_post': True, 'allow_put': True,
'validate': {
@ -285,6 +289,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'protocol': {'allow_post': True, 'allow_put': False,
'validate': {'type:values':
lb_const.POOL_SUPPORTED_PROTOCOLS},
'is_sort_key': True,
'is_visible': True},
'lb_algorithm': {'allow_post': True, 'allow_put': True,
'validate': {
@ -393,6 +398,7 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
'protocol_port': {'allow_post': True, 'allow_put': False,
'validate': {'type:range': [1, 65535]},
'convert_to': converters.convert_to_int,
'is_sort_key': True,
'is_visible': True},
'weight': {'allow_post': True, 'allow_put': True,
'default': 1,