From 8170e51adb38b257724f32c40286bbcb3f537941 Mon Sep 17 00:00:00 2001 From: Boden R Date: Tue, 13 Nov 2018 11:09:08 -0700 Subject: [PATCH] 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 --- lower-constraints.txt | 2 +- neutron_dynamic_routing/db/bgp_db.py | 5 +++-- requirements.txt | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index be73f054..b2530af4 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -53,7 +53,7 @@ munch==2.1.0 netaddr==0.7.18 netifaces==0.10.4 neutron==13.0.0.0b2 -neutron-lib==1.18.0 +neutron-lib==1.20.0 openstackdocstheme==1.18.1 openstacksdk==0.11.2 os-client-config==1.28.0 diff --git a/neutron_dynamic_routing/db/bgp_db.py b/neutron_dynamic_routing/db/bgp_db.py index 01d2c13f..accf5ce0 100644 --- a/neutron_dynamic_routing/db/bgp_db.py +++ b/neutron_dynamic_routing/db/bgp_db.py @@ -28,6 +28,7 @@ from neutron.plugins.ml2 import models as ml2_models from neutron_lib.api import validators from neutron_lib import constants as lib_consts from neutron_lib.db import model_base +from neutron_lib.db import model_query from neutron_lib import exceptions as n_exc from neutron_lib.exceptions import l3 as l3_exc from oslo_db import exception as oslo_db_exc @@ -433,14 +434,14 @@ class BgpDbMixin(common_db.CommonDbMixin): def _get_bgp_speaker_peer_binding(self, context, bgp_speaker_id, bgp_peer_id): - query = self._model_query(context, BgpSpeakerPeerBinding) + query = model_query.query_with_hooks(context, BgpSpeakerPeerBinding) return query.filter( BgpSpeakerPeerBinding.bgp_speaker_id == bgp_speaker_id, BgpSpeakerPeerBinding.bgp_peer_id == bgp_peer_id).one() def _get_bgp_speaker_network_binding(self, context, bgp_speaker_id, network_id): - query = self._model_query(context, BgpSpeakerNetworkBinding) + query = model_query.query_with_hooks(context, BgpSpeakerNetworkBinding) return query.filter( BgpSpeakerNetworkBinding.bgp_speaker_id == bgp_speaker_id, BgpSpeakerNetworkBinding.network_id == network_id).one() diff --git a/requirements.txt b/requirements.txt index c54a6b39..873d64a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ netaddr>=0.7.18 # BSD SQLAlchemy>=1.2.0 # MIT alembic>=0.8.10 # MIT six>=1.10.0 # MIT -neutron-lib>=1.18.0 # Apache-2.0 +neutron-lib>=1.20.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0 oslo.db>=4.27.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0