neutron/neutron/tests/unit
Fernando Royo 789a46df61 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
(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-11 17:30:59 +01:00
..
agent [OVN] Allow to execute `MetadataProxyHandler` in a local thread 2022-10-05 19:35:44 +02:00
api Port update will trigger less notifications to the DHCP agents 2022-07-29 13:59:40 +00:00
cmd Sanitize MAC addresses 2021-07-08 16:46:55 +00:00
common Merge "[OVN] Rate limit the "Disallow caching" log from hash ring" into stable/xena 2022-09-23 18:49:28 +00:00
conf Add policy rules for extraroute-atomic API 2021-06-15 06:45:20 +00:00
core_extensions Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
db Check subnet overlapping after add router interface 2022-11-11 17:30:59 +01:00
debug Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
extensions Allow shared net to be added on router 2022-11-08 08:49:58 +00:00
hacking Remove "six" library 2020-07-28 16:55:52 +00:00
ipam Remove exception `IpAddressAllocationNotFound` 2022-03-17 06:27:24 +00:00
notifiers Retry connections to Nova 2022-09-09 08:34:58 +00:00
objects Script to remove duplicated port bindings 2022-09-30 00:24:55 +02:00
pecan_wsgi Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
plugins Disable in-band management for bridges before setting up controllers 2022-10-18 07:04:08 +00:00
privileged Add retry for privsep get_link_devices 2022-06-09 18:18:32 +05:30
quota New Quota driver `DbQuotaNoLockDriver` 2021-05-20 07:55:59 +00:00
scheduler use payloads for PORT AFTER_DELETE events 2021-07-11 06:00:08 +00:00
services Bump revision number of objects when description is changed 2022-08-29 08:51:47 +00:00
tests Merge "Replace assertItemsEqual with assertCountEqual" 2021-04-26 19:12:38 +00:00
__init__.py Don't set use_stderr to False for tests 2017-04-15 01:41:29 +00:00
_test_extension_portbindings.py Remove "six" library 2020-07-28 16:55:52 +00:00
dummy_plugin.py Remove Neutron LBaaS 2019-09-20 07:46:06 +00:00
extension_stubs.py Consume ServicePluginBase from neutron-lib 2017-03-17 12:06:57 -06:00
fake_resources.py [OVN] Update the DHCP options when the metadata port is modified 2021-10-11 10:25:41 +00:00
test_auth.py Fix context deprecation warnings 2018-02-13 15:02:49 -05:00
test_manager.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_neutron_plugin_base_v2.py Add unit test to validate non DB base core plugin can be loaded 2017-11-15 21:21:35 +00:00
test_opts.py Provide the rpc_response_max_timeout parameter to sriov-agent 2021-06-06 23:56:14 +09:00
test_policy.py Always perform policy checks if enforce_new_defaults == true 2021-03-18 08:51:00 +01:00
test_service.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_worker.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_wsgi.py Remove "six" library 2020-07-28 16:55:52 +00:00
testlib_api.py Remove usage of six.text_type and six.string_type 2020-05-22 14:02:55 -04:00