neutron/neutron/tests/unit/db
Fernando Royo 98abcb6eac Check subnet overlapping after add router interface
When simultaneous attempts are made to add an interface
to the same router including overlapping networks in cidrs,
both attempts are successful. There is a check to avoid this
overlap but is performed when creating the network interface
and it is done over the ports already attached to the router,
so at this moment the check is not able to detect the
overlapping. Furthermore, the create_port operation over the
ML2 plugin  must be executed in isolated transactions, so
trying to control the execution context or adding additional
steps to the transaction is not feasible.

This patch checks once the RouterPort is created on the
neutron database if there is more than one overlapping port,
triggering in that case the exception that will remove the
the culprit of overlapping.

Note: Added clean of l3_obj.RouterPort to avoid errors on
setUp of test class L3TestCase, pick from [1]. Also added
cfg allow_overlapping_ips to True for fullstack job, this one
had been deprecated and enabled by default in newer releases
but added in order to run the backported tests over this
stable branch.

Conflicts:
       neutron/db/l3_db.py
       neutron/tests/unit/db/test_l3_db.py
(manually cherry picked from commit 1abb77d7a6)

[1] https://review.opendev.org/c/openstack/neutron/+/804846/18/neutron/tests/unit/db/test_l3_db.py#612

Closes-Bug: #1987666
Change-Id: I7cec8b53e72e7abf34012906e6adfecf079525af
(cherry picked from commit 1abb77d7a6)
2022-11-07 19:29:51 +01:00
..
metering Add source_ip_prefix and destination_ip_prefix to metering label rules 2020-09-29 09:06:03 -03:00
quota Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
test__utils.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_agents_db.py Set process name for agents 2020-07-01 12:28:29 +02:00
test_agentschedulers_db.py Handle properly ObjectNotFound while deleting network from DHCP agent 2022-05-05 10:45:41 +00:00
test_allowedaddresspairs_db.py Switch to new engine facade in test_allowedaddresspairs_db module 2020-03-20 02:18:04 +01:00
test_db_base_plugin_common.py Replace to_dict() calls with a function decorator 2015-08-03 11:42:25 +03:00
test_db_base_plugin_v2.py [OVN] Sync QoS policies 2022-07-01 08:45:21 +00:00
test_dvr_mac_db.py Replace assertItemsEqual with assertCountEqual 2021-08-24 10:00:56 +00:00
test_extraroute_db.py Replace assertItemsEqual with assertCountEqual 2021-08-24 10:00:56 +00:00
test_ipam_backend_mixin.py Replace assertItemsEqual with assertCountEqual 2021-08-24 10:00:56 +00:00
test_ipam_pluggable_backend.py Allow to pass EUI64 IP address as fixed ip for the port 2022-10-10 12:32:41 +00:00
test_l3_db.py Check subnet overlapping after add router interface 2022-11-07 19:29:51 +01:00
test_l3_dvr_db.py Replace assertItemsEqual with assertCountEqual 2021-08-24 10:00:56 +00:00
test_l3_hamode_db.py [L3HA] Don't update HA router's ports if router isn't active on agents 2022-10-11 03:39:48 +00:00
test_migration.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_ovn_hash_ring_db.py Match created_at and updated_at timestamp in TestHashRing 2020-10-08 14:45:51 +00:00
test_ovn_revision_numbers_db.py Merge "Support remote address group in SG rules" 2020-11-28 11:26:39 +00:00
test_portsecurity_db.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_portsecurity_db_common.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_provisioning_blocks.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_rbac_db_mixin.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_securitygroups_db.py Do not allow a tenant to create a default SG for another one 2022-09-21 14:52:09 +00:00
test_segments_db.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00