From 5267c5bfed58714714c29030ef1a1673141f0d5b Mon Sep 17 00:00:00 2001 From: Yang Youseok Date: Fri, 8 Jun 2018 18:31:57 +0900 Subject: [PATCH] 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 --- openstack/network/v2/port.py | 2 ++ openstack/tests/unit/network/v2/test_port.py | 7 ++++++- .../add_support_port_binding_attrs-c70966724eb970f3.yaml | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/add_support_port_binding_attrs-c70966724eb970f3.yaml diff --git a/openstack/network/v2/port.py b/openstack/network/v2/port.py index 335e885eb..64d034aeb 100644 --- a/openstack/network/v2/port.py +++ b/openstack/network/v2/port.py @@ -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', diff --git a/openstack/tests/unit/network/v2/test_port.py b/openstack/tests/unit/network/v2/test_port.py index 23f3475e7..2fb241214 100644 --- a/openstack/tests/unit/network/v2/test_port.py +++ b/openstack/tests/unit/network/v2/test_port.py @@ -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", diff --git a/releasenotes/notes/add_support_port_binding_attrs-c70966724eb970f3.yaml b/releasenotes/notes/add_support_port_binding_attrs-c70966724eb970f3.yaml new file mode 100644 index 000000000..bcee489ca --- /dev/null +++ b/releasenotes/notes/add_support_port_binding_attrs-c70966724eb970f3.yaml @@ -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'.