Support port binding extended attributes for querying port

Currently Port class does not have port binding extended attributes for
QueryParameters, so there is no way to filter using those properties.

Add those properties to QueryParameters to pass query validation so
that user can query using port binding attributes.

Change-Id: I48e4a2efce88f6e2c68ae63337a2cf5bb7303013
This commit is contained in:
Yang Youseok 2018-06-08 18:31:57 +09:00 committed by Slawek Kaplonski
parent 25e45570ef
commit 5267c5bfed
3 changed files with 13 additions and 1 deletions

View File

@ -30,6 +30,8 @@ class Port(resource.Resource, tag.TagMixin):
# NOTE: we skip query on list or datetime fields for now
_query_mapping = resource.QueryParameters(
'binding:host_id', 'binding:profile', 'binding:vif_details',
'binding:vif_type', 'binding:vnic_type',
'description', 'device_id', 'device_owner', 'fixed_ips', 'ip_address',
'mac_address', 'name', 'network_id', 'status', 'subnet_id',
is_admin_state_up='admin_state_up',

View File

@ -68,7 +68,12 @@ class TestPort(base.TestCase):
self.assertTrue(sot.allow_delete)
self.assertTrue(sot.allow_list)
self.assertDictEqual({"description": "description",
self.assertDictEqual({"binding:host_id": "binding:host_id",
"binding:profile": "binding:profile",
"binding:vif_details": "binding:vif_details",
"binding:vif_type": "binding:vif_type",
"binding:vnic_type": "binding:vnic_type",
"description": "description",
"device_id": "device_id",
"device_owner": "device_owner",
"fixed_ips": "fixed_ips",

View File

@ -0,0 +1,5 @@
---
features:
- Add support for query of port binding extended attributes including
'binding:host_id', 'binding:vnic_type', 'binding:vif_type',
'binding:vif_details', and 'binding:profile'.