neutron/neutron/tests/unit/objects
Ihar Hrachyshka b74af5ff65 Fixed PortBindingLevelDbObjectTestCase
The test class was not inheriting from testlib_api.SqlTestCase which
means that the test cases were never executed.

Once it was executed, it became obvious that the object has an issue
with SQL query scalability. Specifically, it was failing the
test_get_objects_queries_constant test case that validates that the
number of queries to fetch a single object is the same as for multiple
objects. This happens because PortBindingLevel's 'segment' synthetic
field is not constructed from db model relationship but through issuing
a get_object OVO call that triggers a query per fetched PortBindingLevel
object.

To fix the issue, the patch added a new 'segment' relationship to
PortBindingLevel db model, and made OVO use attributes from the
relationship to construct 'segment' synthetic field.

Another issue revealed by enabling the test class is that foreign_key
definition for the 'segment' synthetic field located in NetworkSegment
object refers to 'segment_id' field but the field with this name is not
defined on PortBindingLevel object. The easiest thing we can do to
resolve the discrepancy is adding the 'segment_id' UUID typed field to
PortBindingLevel, which is what the patch does. (An alternative could be
hacking our way around the lack of the field, building another layer of
complexity in the base OVO class for this special case; I figured it's
probably counterproductive, and we can live with 'segment_id' field even
though it's arguably somewhat redundant - 'segment' object field already
carries the ID.)

Adding a new field to PortBindingLevel object means that we need to bump
its version, as well as versions of all objects that use the newly
modified field type for their own fields. The only object that refers to
the type is Port.  That's why we also bump the version of Port object.
To make older agents that use RPC callbacks work with the change, we
also provide corresponding obj_make_compatible methods for both Port and
PortBindingLevel objects.

Change-Id: I1ec56c57f87218520c2080c0b3450f1eabc13224
2018-05-17 10:20:59 +09:00
..
db tests: don't configure plugin for tests that don't need it 2018-04-12 16:01:58 -07: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 Fix all pep8 E129 errors 2018-05-03 13:44:04 +09: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 Fixed PortBindingLevelDbObjectTestCase 2018-05-17 10:20:59 +09: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 Fixed PortBindingLevelDbObjectTestCase 2018-05-17 10:20:59 +09:00
test_ports.py Fixed PortBindingLevelDbObjectTestCase 2018-05-17 10:20:59 +09: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 Integrate Security Groups OVO 2017-06-13 19:27:27 +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
test_utils.py objects: introduce a util function to handle tenant_id filter 2016-08-03 08:42:38 +00:00