Commit Graph

51 Commits

Author SHA1 Message Date
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
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
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
Zuul ddac34b384 Merge "Don't run periodic actions for StaticScheduler" 2022-08-18 09:28: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
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 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
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
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
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
Ryan Tidwell 69e9888b01
Implement DVR-aware fixed IP lookups
This change adds DVR-aware announcements for routable fixed IP's
to be sent, thereby routing traffic directly to the appropriate
compute node instead of the centralized router on the network node.

Change-Id: I3aecdd7979dba97dab12a6550655c90a57f56cb3
Partial-Bug: #1775250
2019-03-03 10:00:06 -06:00
Boden R 51986c5f75 stop using common db mixin methods
All of the methods of common db mixin are available via neutron-lib
and the mixin will be removed before long.
This patch switches the code over to use neutron-lib's APIs rather
than those of the mixin.

This commit also includes the following unrelated change
to pass the gate.
----------------------------------------
tox.ini: Remove symbolic links to fix issues in py3 jobs

2019-02-11 21:38:47.092425 | ubuntu-xenial | py35 runtests: commands[1] | find . -type d -name __pycache__ -delete
2019-02-11 21:38:47.093110 | ubuntu-xenial | setting PATH=/home/zuul/src/git.openstack.org/openstack/neutron-dynamic-routing/.tox/py35/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
2019-02-11 21:38:47.097926 | ubuntu-xenial |   /home/zuul/src/git.openstack.org/openstack/neutron-dynamic-routing$ /usr/bin/find . -type d -name __pycache__ -delete
2019-02-11 21:38:47.101454 | ubuntu-xenial | /usr/bin/find: cannot delete ‘./.tox/py35/lib/python3.5/plat-x86_64-linux-gnu/__pycache__’: Directory not empty
2019-02-11 21:38:47.101813 | ubuntu-xenial | /usr/bin/find: cannot delete ‘./.tox/py35/lib/python3.5/collections/__pycache__’: Directory not empty
2019-02-11 21:38:47.102118 | ubuntu-xenial | /usr/bin/find: cannot delete ‘./.tox/py35/lib/python3.5/encodings/__pycache__’: Directory not empty
2019-02-11 21:38:47.304506 | ubuntu-xenial | /usr/bin/find: cannot delete ‘./.tox/py35/lib/python3.5/importlib/__pycache__’: Directory not empty
2019-02-11 21:38:47.309574 | ubuntu-xenial | ERROR: InvocationError for command '/usr/bin/find . -type d -name __pycache__ -delete' (exited with code 1)
----------------------------------------

Change-Id: If4fa99d98e9507d9fefa84cd39d7d1d3381801a0
2019-02-20 11:51:04 +09:00
Zuul b1d4b8baa6 Merge "use context manager from neutron-lib" 2018-12-08 05:33:16 +00:00
Boden R 8170e51adb use neutron-lib for _model_query
The model_query module is in neutron-lib and the CommonDBMixin will
eventually be removed. This patch swiches use of the _model_query
method over to query_with_hooks from neutron-lib.

This patch also bumps the neutron-lib version up to 1.20.0

Change-Id: I3f2711239772a41ccb6a0d7eb19f11326f125e86
2018-12-03 13:30:21 -07:00
Boden R 155f66337c use context manager from neutron-lib
Access to neutron.db.api's context manager is already in neutron-lib
and in fact neutron is already using it as a shim. This patch switches
over context manager access to use neutron-lib's accessors.
Also see https://review.openstack.org/#/c/613122

Change-Id: Id07fb7da50f80a3434c6bf790ffddf2bb25a6796
2018-12-03 13:29:08 -07:00
Gary Kotton 4692ac30ec Fix pep8 issues with import order
TrivialFix to unblock gate.

Change-Id: Iba94d636907215091e6193824f67bae1a731c463
2018-04-12 04:39:13 -07:00
Jens Harbott fd497a491a Fix failure when adding a speaker to an agent
When get_bgp_speaker_with_advertised_routes() collects the data for BGP
peers, it needs to include the auth_type field, otherwise adding the
speaker to an agent will fail.

Change-Id: I668397be4a531ba5c0628eb23df9a84d0de8c28c
Closes-Bug: 1750121
2018-02-20 11:01:30 +00:00
Gary Kotton cc7f704848 Tag the alembic migration revisions for Queens
This allows the database to be upgraded with the command:
  neutron-db-manage upgrade queens

Change-Id: Ia33058ec98e76204dd96060c80299a837cc46fce
2018-02-09 07:12:42 +02:00
Boden R 1f46de716d use l3 api def from neutron-lib
Commit I81748aa0e48b1275df3e1ea41b1d36a117d0097d added the l3 extension
API definition to neutron-lib, commit
I2324a3a02789c798248cab41c278a2d9981d24be rehomed the l3 exceptions and
Ifd79eb1a92853e49bd4ef028e7a7bd89811c6957 shims the l3 exceptions in
neutron.

This patch consumes the l3 API definition from neutron-lib
in prep for If2e66e06b83e15ee2851ea2bc3b64ad366e675dd

Change-Id: Ie5f87829ce55fed290bce4be933b9e2b0615be46
2017-11-28 06:33:35 -07:00
Hirofumi Ichihara 972756f603 Support 4-Byte AS Numbers
Now neutron_dynamic_routing supports 2 byte AS numbers only.
This patch expands AS numbers constraint so that it supports
4 byte AS numbers. It expects that operators use asplain
notation to set AS numbers[1]. That's backward compatible with
existing 2 byte AS numbers.

[1]: https://tools.ietf.org/html/rfc5396

Change-Id: I06ae0c42d983e88e1f38c501d5c85a7956f195ad
Closes-Bug: #1573092
2017-11-06 09:39:34 +00:00
fumihiko kakuma 24625be6c5 Fix unmatched argument
add_agent_status_check_worker() does not pass context to
schedule_all_unscheduled_bgp_speakers()

Change-Id: Ib48decfc3d15cb23625d744026a3af0ee0c84446
2017-10-23 20:27:06 +00:00
fumihiko kakuma 0e7e93051e Reschedule a bgp speaker binded to a down dr-agent
If a bgp speaker is binded to a down dr-agent, unbind and reschedule it.
If there is an unbinded bgp speaker, schedule it.

Change-Id: If5de81f1ca9b7781f48fd9bea84848f4261ccbe6
2017-08-29 08:33:25 +09:00
Jenkins ffbb088b93 Merge "The parameter "fields" is lack in call to self._make_bgp_peer_dict." 2017-07-28 07:37:01 +00:00
Akihiro Motoki 1c9168176c Update the documentation link for doc migration
Change-Id: Ic57e6ddbc8407fb2ceb7a7b8995486bf06390258
2017-07-20 03:58:14 +00:00
zhaojingjing0067370 4720f5b41b The parameter "fields" is lack in call to self._make_bgp_peer_dict.
If "fields" vaule is not "None" in the function
"get_bgp_peers_by_bgp_speaker", this value should
be put into the called function "self._make_bgp_peer_dict(x)".

Change-Id: Icfb50a4ae59f3008c81bd39bd16c8827841b33d7
2017-07-20 08:49:05 +08:00
Gary Kotton 6a4916e313 Use flake8-import-order plugin
Automate the process

Change-Id: Ic2ff59ed8b5e4677117a5fca5ab32c26b2401724
2017-07-07 07:06:10 +00:00
Roey Chen 14c664fee0 Use Neutron new engine-facade
Change-Id: If977c1759b727ae0fb0a7738d71b2bf8a6065bf2
2017-05-29 06:11:58 -07:00
fumihiko kakuma 086384c3b1 Enable neutron-dynamic-routing scheduler
This executes the dr scheduler on the callback for create_bgp_speaker.
Also add the following variable for devstack.
  BGP_SCHEDULER_DRIVER: specify dr scheduler driver

Change-Id: Ibf94cc2183783f9bdb2dd245ad28d304ca930589
2017-04-04 14:49:02 +09:00
fumihiko kakuma f7a4b32137 Fix relocated DB models
Some DB models were relocated and their deprecated import paths were
cleaned up[1].

[1] Iadbf44d52ee8e30712807384152a29ce1a8b8f72

Change-Id: I58972e3465ed9e3b7d8cdd24abc463d55ce1b7d5
2017-02-28 08:54:48 +09:00
LIU Yulong 0980985b2f Let the bgp_plugin to query floating IP bgp next_hop
When a dvr floating IP is associated to a port, the bgp plugin
`floatingip_update_callback` will immediately send a notification
`start_route_advertisements` to DR agent, there is a new floating
IP bgp route.
But this bgp route is not correct, its next_hop is set to dvr router
snat gateway IP address. And then after `periodic_interval` seconds,
the DR agent will resync that DVR fip route with new next_hop to the
correct FIP namespace fg-device IP address.

This patch will let the bgp_plugin to handle the floating IP bgp route
next_hop query.

Change-Id: Ic6bb7f4263c6e2da315178be2ed041eb7020c905
Closes-bug: #1615919
2016-11-30 18:28:02 +00:00
Henry Gessau e1bf61996a Use DB field sizes instead of _MAX_LEN constants
The following _MAX_LEN constants are being removed from
neutron/api/v2/attributes.py in [1]. The corresponding DB field size
constants from neutron_lib.db.constants should be used instead.

 NAME_MAX_LEN              -->  NAME_FIELD_SIZE
 TENANT_ID_MAX_LEN         -->  PROJECT_ID_FIELD_SIZE
 DESCRIPTION_MAX_LEN       -->  DESCRIPTION_FIELD_SIZE
 LONG_DESCRIPTION_MAX_LEN  -->  LONG_DESCRIPTION_FIELD_SIZE
 DEVICE_ID_MAX_LEN         -->  DEVICE_ID_FIELD_SIZE
 DEVICE_OWNER_MAX_LEN      -->  DEVICE_NAME_FIELD_SIZE

In alembic migration scripts, the raw numerical value shall be used.

For more information, see [2].

[1] https://review.openstack.org/399891
[2] http://lists.openstack.org/pipermail/openstack-dev/2016-October/105789.html

Change-Id: I038d6d32eefa57c5fc57b870a33d09bef1db296c
2016-11-26 00:14:16 -05:00
Jenkins 266650f3ad Merge "Switch to using neutron-lib's model_base" 2016-11-24 18:07:44 +00:00
Armando Migliaccio 4bf0a474c6 Switch to using neutron-lib's model_base
Change-Id: I36722c0d47f65853184bd19145475500c27aa9d3
2016-11-24 17:12:16 +00:00
vikram.choudhary 29882d27fa Removing Alembic migration devref document
This patch removes unwanted devref documents w.r.t. alembic migration.
IMO, separate devref for sub-project is not required as it's already
documented @
http://docs.openstack.org/developer/neutron/devref/alembic_migrations.html#independent-sub-project-tables

Change-Id: Ida41846ff5d1be0058fd6881cceaa834c37268d7
Partial-Bug: #1560003
2016-10-25 04:20:06 +00:00
Jenkins 26a252e3d7 Merge "Tag the alembic migration revisions for Newton" 2016-09-14 13:48:01 +00:00
Henry Gessau af902a0654 Tag the alembic migration revisions for Newton
This allows the database to be upgraded with the command:
  neutron-db-manage upgrade newton

Migration f399fa0f5f25 is the newton milestone for the expand
branch. It was tagged earlier (although it shouldn't have been).

Migration 61cc795e43e8 was erroneously tagged, so remove the
tag from there.

Also clean up a deprecated use of model_base because the
deprecation warning was cluttering up the output of
neutron-db-manage.

Depends-On: I5b9c02814bdc1945422184a84c49f9e67dcf24a9

Partial-Bug: #1623108

Change-Id: If1820978c1eb6a8c2dbff20b349c0d4108a49258
2016-09-13 20:18:38 -04:00
Jenkins 4357e920e2 Merge "Fixes KeyError while updating bgp peer" 2016-09-14 00:04:58 +00:00
Sreekumar S 89ed530fec Fixes KeyError while updating bgp peer
This will fix the issue of KeyError being thrown when
'password' is not supplied while updating bgp peer.
The dict get() method is used to return None when
'password' key is not available.

Two unit tests are also added which will test the cases
1) Exception thrown if the auth type is 'none', and a
password is supplied when updating
2) When the password is not supplied

Change-Id: Ief9e88ca12b04eb08b0cc4e60f9d883f1e282ae9
Closes-Bug: #1616066
2016-09-08 20:44:42 +05:30
Gary Kotton 9872cecbb8 Use relocated address scope import
Commit 72a722e69d4579e0df680735ab63305d522736aa moved the file.
We now use the correct import and not the deprecated one.

Change-Id: Ida4a0f622c2b25efdbbccb47ecb2694c6de67677
Closes-bug: #1620516
2016-09-08 00:43:32 -07:00
Gary Kotton c8a632acf6 Use model_base from neutron-lib
This removes the deprecation warnings.

In addition to this this also changed HasTenant
to HasProject

Change-Id: I6cce8dffb5f85276d904b101bcd46c04a12a147d
Closes-bug: #1620334
2016-09-06 01:58:20 -07:00
Jenkins 8be07afef2 Merge "remove unused LOG" 2016-08-17 06:12:24 +00:00
Henry Gessau acb95a15c1 Remove temporary local HasProject
Now that the tenant_id rename has merged in Neutron we can
remove the temporary work-around.

Related Blueprint: keystone-v3

Change-Id: Ic69bb5edee913686bd85c19d9fb0bcae0b3907b3
2016-08-12 00:18:19 -04:00
LIU Yulong 11965147fe BGP: exclude legacy fip in DVR fip host routes query
When query a bgpspeaker's routes, the DVR fip host routes query
will get the routes including the central fip routes. This will
let the central fip has more than one next_hop routes.

This patch adds a RouterExtraAttributes check for the distributed
routers during the DVR fip host routes query.

Change-Id: Idb237d4563236c24c19abd8234cfdec4f2373eee
Closes-Bug: #1608406
2016-08-08 16:09:47 +08:00
Henry Gessau b116f47e7e Rename DB columns: tenant -> project
All occurences of ``tenant_id`` across the neutron database are
being renamed to ``project_id``.

This neutron-dynamic-routing change accompanies the neutron change:
I87a8ef342ccea004731ba0192b23a8e79bc382dc

Change-Id: If6a4db955a2e00635a37605dc165cf9f2f0fac31
Partially-Implements: blueprint keystone-v3
2016-07-21 14:58:09 +00:00
ji-xuepeng 78eff22b59 remove unused LOG
This is to remove unused LOG to keep code clean.

Change-Id: I42db7a0f335cc5a2759a4b18ffc33be1e6a4f75e
2016-07-10 15:05:32 +08:00
YAMAMOTO Takashi e2581d50e7 Fix _get_id_for
Raise BadRequest on the absense of the attribute.
Also, ensure that the value is actually a UUID-like.

Closes-Bug: #1595078
Change-Id: I6c236d5e4acdd6f13eca2877163facc2860a9445
2016-06-23 14:58:47 +09:00
steve.ruan 908feafbe5 Fix bgp-speaker-network-remove error
Table name BgpSpeakerPeerBinding is missing in the filter

Change-Id: Icf3d8f41b64d2813517f3509c440c29c5c36681d
Closes-Bug: #1584661
2016-05-24 02:54:46 -05:00
Ryan Tidwell 270b37f22b Move BGP service plugin, agent, and tests out of Neutron repo
This patch moves the BGP service plugin, agent, driver, and
tests out of the neutron repository and into the
neutron-dynamic-routing repository.

Partially-Implements: blueprint bgp-spinout
Partial-Bug: #1560003
Co-Authored-By: vikram.choudhary <vikram.choudhary@huawei.com>

Change-Id: I80ea28a51d7b18e67d6ed4cd2da22520f950300f
2016-05-16 12:22:24 +00:00