OVO: Allow port queries based on security_group_ids
This is needed to retrieve all ports in a given set of security groups. Partially-Implements: blueprint push-notifications Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db Change-Id: Iffa1bd341d9d20277ec153aa1dac6f61f05ec5bd
This commit is contained in:
parent
8c8ae29082
commit
1db5ace55e
|
@ -263,6 +263,8 @@ class Port(base.NeutronDbObject):
|
|||
# field in later object iterations
|
||||
}
|
||||
|
||||
extra_filter_names = {'security_group_ids'}
|
||||
|
||||
fields_no_update = ['project_id', 'network_id']
|
||||
|
||||
synthetic_fields = [
|
||||
|
|
|
@ -233,6 +233,12 @@ class PortDbObjectTestCase(obj_test_base.BaseDbObjectTestCase,
|
|||
|
||||
obj = ports.Port.get_object(self.context, id=obj.id)
|
||||
self.assertEqual(groups, obj.security_group_ids)
|
||||
self.assertEqual([obj],
|
||||
ports.Port.get_objects(
|
||||
self.context, security_group_ids=(sg1_id, )))
|
||||
self.assertEqual([obj],
|
||||
ports.Port.get_objects(
|
||||
self.context, security_group_ids=(sg2_id, )))
|
||||
|
||||
sg3_id = self._create_test_security_group_id()
|
||||
obj.security_group_ids = {sg3_id}
|
||||
|
|
Loading…
Reference in New Issue