Commit Graph

209 Commits

Author SHA1 Message Date
Rodolfo Alonso Hernandez f7baab86ac Bump Neutron to 23.0.0.0b3
That syncs the Neutron code with the latest neutron-lib version
released (3.8.0).

This patch also adds the "network.ha" definition extension to
the tests core plugin.

NOTE: both LP bugs must be fixed in one patch to fix the unit
tests CI job.

Closes-Bug: #2033493
Closes-Bug: #2033508
Change-Id: Ie22d9bcb943205e20380b92dc33d48f398a86470
2023-08-31 11:03:14 +00:00
Rodolfo Alonso Hernandez 513ea649be [alembic] Alembic operations require keywords only arguments
Since [1] (release 1.11.0), the Alembic operations "now enforce
keyword-only arguments as passed as keyword and not positionally"
(from the commit message).

This change is compatible with the previous versions (as confirmed
in the CI).

[1]df75e85489

Closes-Bug: #2019948
Change-Id: I71f59da65edc163aa5891cf0b0d9768d2538b7a7
2023-05-17 11:28:39 +00:00
Felix Huettner bf54f03ce5 fix unittest issues caused by neutron rbac changes
neutron recently merged a commit enabling secure rbacs by default [1].
However this commit breaks the unittests of neutron-dynamic-routing.
To fix this we run multiple calls as admin, to allow them to succeed.

[1]: 670cc383e0

Closes-Bug: 2019097
Change-Id: Iadc9b819ce4aaf6029e77f53ce0616aa70119c70
2023-05-17 10:23:32 +02:00
Rodolfo Alonso Hernandez c080147b0f [sqlalchemy-20] Add reader context to ``get_bgp_peers``
Closes-Bug: #2016137
Change-Id: Iafe35cd481bdc98b594d62ec6945991dcde6089c
2023-04-13 14:52:37 +02:00
Nurmatov Mamatisa 4810b8e631 Use neutron-lib policy rules
Change-Id: I09c1c2f55e144e65da3c05a474216e387393d873
2023-03-09 10:47:39 +03:00
elajkat 37a8a1aae6 Use SLQAlchemy ORM "relationship" instead of "relation"
Similar patch: [2]
"relation" was deprecated in SQLAlchemy 1.4 [1].

[1]https://docs.sqlalchemy.org/en/14/orm/relationship_api.html#sqlalchemy.orm.relation
[2]: https://review.opendev.org/c/openstack/neutron/+/872271

Change-Id: I0ec4b79f18df828e96e989a8e97dd3d7a879e1ea
Closes-Bug: #2004258
2023-02-01 09:14:08 +01:00
ROBERTO BARTZEN ACOSTA feff164b60 Fix address_scope calculation
Fix in the iteration to obtain address_scope linked to a subnet.
A network can be linked to more than one subnet (ipv4 and ipv6),
but if one of them does not have an address_scope, a null object
element access failure occurs.

Closes-bug: #1998104
Change-Id: Ic6d48a86043aaf4b458bb2230883a355fc841ee9
2022-11-30 10:59:36 +00:00
Takashi Natsume 1c15cd1bc5 Fix misuse of assertTrue
Replace assertTrue with assertEqual.

Change-Id: I0f0b6e5a7a4b7799ecda2fcc5b5179c0f97fd44f
Closes-Bug: 1989254
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2022-09-10 22:17:59 +09:00
Zuul ddac34b384 Merge "Don't run periodic actions for StaticScheduler" 2022-08-18 09:28:17 +00:00
Zuul 4583487487 Merge "[sqlalchemy-20] Add (still) missing DB context decorator" 2022-08-16 09:40:23 +00:00
Zuul f2a827ec0c Merge "[sqlalchemy-20] Add missing DB context decorators" 2022-08-16 09:40:17 +00:00
Takashi Kajinami d98b177a26 [sqlalchemy-20] Add (still) missing DB context decorator
This fixes one query still being executed without context decorator,
which is causing the warning messages.

Related-Bug: #1980671
Closes-Bug: #1984238
Change-Id: I3eba9c919e153dd253988fee31a7cebaf3cad773
2022-08-12 01:46:53 +09:00
Zuul e6f8165254 Merge "Fix missing functions in StaticScheduler" 2022-08-04 10:41:02 +00:00
Dr. Jens Harbott acfcd04dd4 Don't run periodic actions for StaticScheduler
We want bindings to be fully static when using the StaticScheduler, so
do not run the periodic actions in that scenario.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: I2d874ce7170cdf3d81940dbe64960247b244fe87
2022-08-02 09:38:02 +02:00
Dr. Jens Harbott 2e7b595268 [sqlalchemy-20] Add missing DB context decorators
Some more queries were being executed without context decorator,
leading to warning messages in the log.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: Ia66bcd0c90f0013d8bd7b2792759e3a6474bb5e0
2022-08-02 08:52:01 +02:00
Dr. Jens Harbott 012f2358d2 Fix missing functions in StaticScheduler
Seems the original approach was too simple, it is causing some
tracebacks due to missing functions.

Closes-Bug: 1980235
Change-Id: I15ef7ec34eeccf4dfcce94b3bca2c853c4c4a609
2022-08-01 16:41:39 +02:00
Zuul 608037e8fa Merge "[sqlalchemy-20] Add missing DB context decorator" 2022-07-11 12:20:45 +00:00
Dr. Jens Harbott 0d2782fb7e [sqlalchemy-20] Add missing DB context decorator
One query was being executed without context decorator, leading to
warning messages in the log.

Closes-Bug: 1980671
Change-Id: Iebdc16e32193a6bc1eea5ea69c16f4aca5bd4526
2022-07-04 16:55:45 +02:00
Renat Nurgaliyev b9c085b85f
Consume BGP service plugin queue in RPC workers
This patch adds BGP service plugin RPC queue to RPC workers, like it is
done in other Neutron service plugins (l3-plugin, metering, etc.).
Without it some RPC requests and AMQP heartbeats are not processed in
time, causing AMQP connection dropping, and other unpredictable unwanted
behavior.

Closes-Bug: #1974057
Change-Id: I1b13f01ca47c8390f1361e01d5eb313fe2fc417f
2022-05-18 18:09:16 +02:00
silvacarloss 180396b18c Register common config options by default
The [1] change modified the behavior Neutron had, which used to
force the default config options to be automatically set.

Neutron-dynamic-routing expects some of the default config options
to be set while initializing some services. If they are not set
the initialization will fail [2].

This change invokes the method that sets such config options to
fix this initialization issue.

[1] https://review.opendev.org/c/openstack/neutron/+/837392
[2] https://paste.opendev.org/show/b8DReLeBPl9xTGooN8wu/

Releated-Bug: #1968606
Change-Id: Ib3bdf9b19feb68647460814cc973699622d0a6e8
2022-04-21 08:38:46 +00:00
Dr. Jens Harbott 8a0ddf6051
Add a StaticScheduler without automatic scheduling
The automatic scheduling that was introduced in [0] is having some
issues. Add a StaticScheduler that can be used as an alternative for
deployments that want explicit control over where their BGP speakers are
getting scheduled.

Add a job that runs with the new scheduler.

[0] https://review.opendev.org/c/openstack/neutron-dynamic-routing/+/478455

Depends-On: https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/815294
Closes-Bug: 1920065
Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: Ib7fcd0c7371bc75089b10024ee1b6e75c98f0188
2021-11-04 15:21:51 +01:00
Zuul be4bf54c30 Merge "Drop dsvm-functional tox env and related files" 2021-09-27 08:44:55 +00:00
Nurmatov Mamatisa cae03eaa49 Use payload style callback
Neutron-lib registry.notify will be removed

Change-Id: I5d773851136759117b048660d34209a601054a69
2021-09-13 12:31:13 +00:00
Manu B 630678b5f9 Payload changes for FLOATING_IP events
Depends-On: https://review.opendev.org/#/c/798009

Signed-off-by: Manu B <manu.b@est.tech>
Change-Id: I4c6e04b82426ebbe41273fbc584ee3e8df70aead
2021-09-06 07:01:24 +00:00
Boden R 891ca86212 use payloads for ROUTER_INTERFACE events
This patch switches the code over to the payload style of callbacks [1]
for ROUTER_INTERFACE events for those that are not using them yet.

Depends-On: https://review.opendev.org/#/c/639814/

[1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html

Change-Id: I332e9745b57a22f0ca9338b52dab69c53ff59fcc
2021-09-02 09:49:44 +00:00
elajkat b8b8788d23 Use payload for PORT and FLOATING_IP events
* Updated callback functions port_callback,
  floatingip_update_callback to include payload
* Fixed unit test cases

Change-Id: I84956d86ea45039a8841b2b1f4f02bf373efcef5
Signed-off-by: Manu B <manu.b@est.tech>
2021-09-02 09:49:30 +00:00
Jens Harbott 03876054ad Drop dsvm-functional tox env and related files
We no longer run any devstack-gate-based jobs, remove the tox env for it
and the auxillary files.

Change-Id: Ide2fe6ca75370c52180795cc2596be482c862523
2021-08-11 09:22:22 +02:00
elajkat c021b106d9 Use bgp api-def from neutron-lib
As neutron-dynamic-routing is a Neutron stadium project the api-def
and the api-ref should be in neutron-lib.

Change-Id: Idccc69f025a0d1ec0453d13a7d81b94e3a15149d
Depends-On: https://review.opendev.org/c/openstack/neutron-lib/+/788322
2021-05-31 12:32:55 +00:00
Aggelos Kolaitis 43f50d5d9b
Fix TypeError when formatting BGP IP address.
floating_ip_address may be a netaddr.IPAddress, and using '+'
to append the /32 suffix raises a TypeError. Explicitly convert to
string before appending the suffix.

Additionally, introduce a unit test case for floatingip_update_callback
to test that the error does not re-appear.

Closes-Bug: #1924237
Signed-off-by: Aggelos Kolaitis <akolaitis@admin.grnet.gr>
Change-Id: I98d266fb986649f1d14969c968baa2f93b469f73
2021-04-15 21:02:15 +03:00
elajkat 6a6f49b609 Migrate to new engine facade
Partially-Implements blueprint: enginefacade-switch

Change-Id: I70636da4b3d4aa633286366f47ea997111b3bc2e
2020-12-15 17:35:17 +00:00
Nate Johnston 4212b70538 Fix outerjoin to comply with SQLAlchemy 1.3 strictness
The outerjoin in neutron_dynamic_routing/db/bgp_db.py does not meet
with the stricter new standards in SQLAlchemy 1.3, so this finds a
more compliant form.

[1] https://docs.sqlalchemy.org/en/13/changelog/migration_13.html#query-join-handles-ambiguity-in-deciding-the-left-side-more-explicitly

Change-Id: I603a2febb1755b6db17e6ac9cb22015a1f3336d4
Closes-Bug: #1898634
2020-10-08 05:01:55 +00:00
Zuul 818fe4935c Merge "Switch from unittest2 compat methods to Python 3.x methods" 2020-08-12 22:21:13 +00:00
Zuul e6274b2d16 Merge "Clean up workaround in bgp_dragent_scheduler" 2020-08-07 12:57:10 +00:00
melissaml 6c094dbb3c Switch from unittest2 compat methods to Python 3.x methods
With the removal of Python 2.x we can remove the unittest2 compat
wrappers and switch to assertCountEqual instead of assertItemsEqual

We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.

[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277

Change-Id: If5dc6ebffc7b4f031b0350a4fe77a660a1e7becf
2020-07-05 19:38:34 +08:00
Dr. Jens Harbott 76de6240c9 Clean up workaround in bgp_dragent_scheduler
This was added as a workaround until neutron gets a new release in [0].
We can switch to the new code now.

[0] I5661e8689d8e3ea861fdd0393e6f25c42cd324c3

Change-Id: Ie5b3d5c5b978494abf8d58f3f0a92cb95209fb56
2020-06-14 12:31:13 +00:00
zhanghao f8f9463cf7 Remove usage of six
With python3.x, classes can use 'metaclass=' instead of
'six.add_metaclass', 'six.integer_type' can be replaced
by 'int', 'six.string_type' and 'six.text_type' are just
'str'.

Change-Id: I40a020aa4a8e69a8dd7e800352dc54a9e694d500
2020-05-27 06:58:27 -04:00
Zuul f51744b4fe Merge "Use unittest.mock instead of third party mock" 2020-05-26 13:13:34 +00:00
Sean McGinnis 95cdf705a1
Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Ic767e59531bc2515cc1c20675792fe88300e3f30
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-05-13 07:02:49 -05:00
Corey Bryant 44e77ea9a9 Monkey patch original current_thread _active
Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Change-Id: I8e8a9ce5085b7915994317af5ea903cf8a39e809
Closes-Bug: #1863021
2020-05-05 05:44:16 +00:00
Bernard Cafarelli fd72823d20
Switch functional job to Zuulv3 syntax
This patch switches from legacy job to a Zuul v3 job inheriting from
neutron-functional job definition.

Also cleaning up relevant files for legacy job

Change-Id: I419c98d58637d57c3a2436630dd787b17f9027d5
2020-01-21 11:50:43 +01:00
Nate Johnston e760a49f67 Remove tempest tests that have moved to neutron-tempest-plugin
This patch removes all tempest tests from neutron-dynamic-routing
repository as all of them are now moved to neutron-tempest-plugin repo.
It also removes all tempest job definitions which are now replaced by
job neutron-tempest-plugin-dynamic-routing defined in
neutron-tempest-plugin repo directly.

Change-Id: I94a443c92fe2317ba2591ae3a227ec8df82ec294
2019-11-19 10:24:16 -05:00
Zuul 05b3f52bf7 Merge "bgp: Gracefully handle missing last_known_router_id" 2019-11-13 22:31:21 +00:00
Jens Harbott e2d4cede45 Fix resource_filter.bind method that was changed in neutron
This happened in [0], we need to add a partial workaround until a new
neutron release is made.

[0] https://review.opendev.org/288271

Change-Id: I5661e8689d8e3ea861fdd0393e6f25c42cd324c3
2019-11-11 12:33:54 +00:00
Boden R 979b676e3a use payloads for ROUTER_GATEWAY events
This patch switches the code over to the payload style of callbacks [1]
for ROUTER_GATEWAY events for those that are not using them yet.
The unit tests are also updated where needed to account for the
payload style callbacks and publish() method. Finally the patch
normalizes the passing of gateway IPs which are currently referred to
as 'gw_ips' and 'gateway_ips' depending on the event; now all events use
'gateway_ips'.

Depends-On: https://review.opendev.org/#/c/638274/

[1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html

Change-Id: I8f797f31b3413e4879400ad2832539314d6e9cfc
2019-07-30 11:19:55 -06:00
Benoît Knecht 4780fe548b bgp: Gracefully handle missing last_known_router_id
When a server is deleted before its floating IP has been disassociated,
the notification doens't contain a `last_known_router_id` key, which
results in a `KeyError` exception being thrown.

This commit gracefully handles this situation by setting
`last_router_id` to `None` when `last_known_router_id` is missing.

Change-Id: If127a33cec7ce6c4d264a191df37c30decab4daa
Closes-Bug: #1795816
2019-06-14 10:30:12 +02:00
Ryan Tidwell a32c6f8c23
Convert CI jobs to python 3
This change ensures all CI jobs run against neutron-dynamic-routing
run with python 3 and all test code is compatible with python 3.

Change-Id: I77f940dca9239d710bb146e8cdf1d6058f2fbdd4
2019-05-21 13:58:53 -05:00
gujin dace47cc07 Replace git.openstack.org URLs with opendev.org URLs
Change-Id: Ied57440e9e9f918ca685bd3738716cd52f7719b2
2019-05-13 21:09:03 +08:00
Zuul d81049babb Merge "Ignore DrAgentAssociationError in test_remove_add_speaker_agent" 2019-05-06 10:23:31 +00:00
zhulingjie bb7a0fb1cb Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Iaeebe7f3f76339f0c34c9e0f4db838ec192dbd83
2019-04-29 13:50:34 +08:00
Boden R ec6bfd4f6c stop using common_db_mixin
This patch removes all use of common_db_mixin. All methods of that
class are available in some form from neutron-lib and we are removing
the mixing from neutron soon.

Change-Id: I80d17a491d4468a94f4ae184f1b453f41cdf92a2
2019-03-28 11:47:38 -06:00