neutron/neutron/tests/unit/objects
Rodolfo Alonso Hernandez 1afe935de8 Filter by owner SGs when retrieving the SG rules
Retrieving the SG rules now is used the admin context. This allows to
get all possible rules, independently of the user calling. The filters
passed and the RBAC policies filter those results, returning only:
- The SG rules belonging to the user.
- The SG rules belonging to a SG owned by the user.

However, if the SG list is too long, the query can take a lot of time.
Instead of this, the filtering is done in the DB query. If no filters
are passed to "get_security_group_rules" and the context is not the
admin context, only the rules specified in the first paragraph will
be retrieved.

Because overwriting the method "get_objects" is too complex, an
intermediate query is done to retrieve the SG rule IDs. Those IDs
will be used as a filter in the "get_objects" call.

Conflicts:
      neutron/objects/securitygroup.py
      neutron/tests/unit/db/test_securitygroups_db.py
      neutron/tests/unit/objects/test_securitygroup.py

Closes-Bug: #1863201

Change-Id: I25d3da929f8d0b6ee15d7b90ec59b9d58a4ae6a5
(cherry picked from commit d874c46bff)
(cherry picked from commit d3905264b7)
(cherry picked from commit 61dc621c1b)
2020-04-15 07:34:18 +00:00
..
db use object utils from neutron-lib 2018-06-11 11:10:53 -06:00
extensions [OVO] Switch to use own registry 2017-11-22 17:44:22 +01:00
logapi Enable an update test in UT of logging 2017-07-07 12:01:49 +09:00
plugins OVO for FlatAllocation 2016-12-22 13:25:50 +00:00
port Fix all pep8 E265 errors 2018-04-30 16:35:52 -04:00
qos Refactor duplicated implementation of _get_policy_obj 2018-06-20 09:51:02 +08:00
__init__.py objects.base: avoid db access if object does not have changes 2015-07-03 02:02:17 +03:00
test_address_scope.py Use BaseDbObjectTestCase in AddressScope UT 2016-10-12 14:17:15 -05:00
test_agent.py Add DictOfMiscValuesField in OVO for dict usage 2017-01-05 07:57:06 +00:00
test_auto_allocate.py Refactoring _create_test methods for OVO UTs 2017-04-17 12:05:19 -07:00
test_base.py Filter by owner SGs when retrieving the SG rules 2020-04-15 07:34:18 +00:00
test_common_types.py Support protocol numbers in security group API 2017-11-10 17:06:02 -05:00
test_flavor.py Refactoring _create_test methods for OVO UTs 2017-04-17 12:05:19 -07:00
test_floatingip.py Refactoring _create_test methods for OVO UTs 2017-04-17 12:05:19 -07:00
test_ipam.py Refactoring _create_test methods for OVO UTs 2017-04-17 12:05:19 -07:00
test_l3_hamode.py tests: generate unique network ids for L3HARouterVRIdAllocation 2017-09-15 13:25:35 -06:00
test_l3agent.py Add specific values to specific fields in get_random_object_fields() 2017-07-25 15:16:25 +09:00
test_metering.py Metering to OVO 2017-04-26 11:44:58 -07:00
test_network.py Allow objects to opt in new engine facade 2018-02-09 04:07:34 +00:00
test_objects.py Merge "[server side] Floating IP port forwarding OVO and db script" 2018-07-18 23:44:37 +00:00
test_port_forwarding.py [server side] Floating IP port forwarding OVO and db script 2018-07-16 11:17:45 +08:00
test_ports.py Pluralize binding relationship in Port 2018-07-13 19:37:36 -05:00
test_provisioning_blocks.py Refactoring _create_test methods for OVO UTs 2017-04-17 12:05:19 -07:00
test_quota.py Use flake8-import-order plugin 2017-07-05 03:15:27 +00:00
test_rbac_db.py Allow objects to opt in new engine facade 2018-02-09 04:07:34 +00:00
test_router.py Use Router OVO in external_net_db 2018-02-08 14:42:29 +00:00
test_securitygroup.py Filter by owner SGs when retrieving the SG rules 2020-04-15 07:34:18 +00:00
test_servicetype.py ProviderResourceAssociation to OVO 2016-11-18 13:09:29 -06:00
test_subnet.py tests: don't configure plugin for tests that don't need it 2018-04-12 16:01:58 -07:00
test_subnetpool.py Use unique subnetpools in SubnetPoolPrefixDbObjectTestCase 2017-01-12 05:56:04 +00:00
test_tag.py Refactoring _create_test methods for OVO UTs 2017-04-17 12:05:19 -07:00
test_trunk.py objects: support tenant_id filter for get_* if project_id is present 2017-06-30 11:08:29 -04:00