Browse Source

OSP-232: move imports from neutron.db to neutron_lib

 - partially fixes OSP-232, since neutron.db.common_db_mixin used
   by most classes is still not moved to neutron_lib

Change-Id: I46342d8fb52a26c2a272ed07b24785b1defce502
Aditya Prakash Vaja 4 months ago
parent
commit
1058f9d1ba

+ 5
- 3
networking_bigswitch/plugins/bigswitch/db/network_template_db.py View File

@@ -13,12 +13,14 @@
13 13
 #    License for the specific language governing permissions and limitations
14 14
 #    under the License.
15 15
 
16
+import sqlalchemy as sa
17
+
16 18
 from networking_bigswitch.plugins.bigswitch.i18n import _
17 19
 from neutron.db import common_db_mixin
18 20
 from neutron_lib.db import model_base
21
+from neutron_lib.db import utils as db_utils
19 22
 from neutron_lib import exceptions
20 23
 from oslo_db import exception as db_exc
21
-import sqlalchemy as sa
22 24
 from sqlalchemy.orm import exc
23 25
 
24 26
 
@@ -36,7 +38,7 @@ class NetworkTemplateNotFound(exceptions.NotFound):
36 38
 class NetworkTemplateDbMixin(common_db_mixin.CommonDbMixin):
37 39
     # internal methods
38 40
     def _make_networktemplate_dict(self, template, fields=None):
39
-        return self._fields({
41
+        return db_utils.resource_fields({
40 42
             'id': template.id,
41 43
             'body': template.body,
42 44
             'name': template.name}, fields)
@@ -108,7 +110,7 @@ class NetworkTemplateAssignmentDbMixin(common_db_mixin.CommonDbMixin):
108 110
     # internal methods
109 111
     def _make_networktemplateassignment_dict(self, templateassignment,
110 112
                                              fields=None):
111
-        return self._fields({
113
+        return db_utils.resource_fields({
112 114
             'id': templateassignment.id,
113 115
             'template_id': templateassignment.template_id,
114 116
             'tenant_id': templateassignment.tenant_id,

+ 5
- 4
networking_bigswitch/plugins/bigswitch/db/reachability_test_db.py View File

@@ -13,14 +13,15 @@
13 13
 #    License for the specific language governing permissions and limitations
14 14
 #    under the License.
15 15
 
16
+import sqlalchemy as sa
17
+
16 18
 from networking_bigswitch.plugins.bigswitch.i18n import _
17 19
 from networking_bigswitch.plugins.bigswitch.utils import Util
18 20
 from neutron.db import common_db_mixin
19 21
 from neutron_lib.db import model_base
22
+from neutron_lib.db import utils as db_utils
20 23
 from neutron_lib import exceptions
21 24
 from oslo_serialization import jsonutils
22
-
23
-import sqlalchemy as sa
24 25
 from sqlalchemy.dialects.mysql.base import VARCHAR
25 26
 from sqlalchemy.orm import exc
26 27
 from sqlalchemy.types import Enum, TIMESTAMP, TypeDecorator
@@ -130,7 +131,7 @@ class ReachabilityTestSegmentNameMissing(exceptions.NeutronException):
130 131
 class ReachabilityTestDbMixin(common_db_mixin.CommonDbMixin):
131 132
     # internal methods
132 133
     def _make_reachabilitytest_dict(self, reachabilitytest, fields=None):
133
-        return self._fields({
134
+        return db_utils.resource_fields({
134 135
             'id': reachabilitytest.id,
135 136
             'tenant_id': reachabilitytest.tenant_id,
136 137
             'name': reachabilitytest.name,
@@ -285,7 +286,7 @@ class ReachabilityQuickTestDbMixin(common_db_mixin.CommonDbMixin):
285 286
     # internal methods
286 287
     def _make_reachabilityquicktest_dict(self, reachabilityquicktest,
287 288
                                          fields=None):
288
-        return self._fields({
289
+        return db_utils.resource_fields({
289 290
             'id': reachabilityquicktest.id,
290 291
             'tenant_id': reachabilityquicktest.tenant_id,
291 292
             'name': reachabilityquicktest.name,

+ 4
- 2
networking_bigswitch/plugins/bigswitch/db/tenant_policy_db.py View File

@@ -13,6 +13,8 @@
13 13
 #    License for the specific language governing permissions and limitations
14 14
 #    under the License.
15 15
 
16
+import sqlalchemy as sa
17
+
16 18
 from networking_bigswitch.plugins.bigswitch.i18n import _
17 19
 from networking_bigswitch.plugins.bigswitch.utils import Util
18 20
 from neutron.db import common_db_mixin
@@ -20,12 +22,12 @@ from neutron.db.models import l3 as l3_models
20 22
 from neutron_lib.api import validators
21 23
 from neutron_lib.db import api as db_api
22 24
 from neutron_lib.db import model_base
25
+from neutron_lib.db import utils as db_utils
23 26
 from neutron_lib import exceptions as n_exc
24 27
 from oslo_config import cfg
25 28
 from oslo_db import exception as db_exc
26 29
 from oslo_log import log as logging
27 30
 from oslo_utils import uuidutils
28
-import sqlalchemy as sa
29 31
 from sqlalchemy.orm import exc, relationship
30 32
 from sqlalchemy.types import Enum
31 33
 
@@ -89,7 +91,7 @@ class TenantPolicyDbMixin(common_db_mixin.CommonDbMixin):
89 91
     # internal methods
90 92
     def _make_tenantpolicy_dict(self, tenantpolicy, fields=None):
91 93
         nexthops = [hop['nexthop'] for hop in tenantpolicy.nexthops]
92
-        return self._fields({
94
+        return db_utils.resource_fields({
93 95
             'id': tenantpolicy.id,
94 96
             'tenant_id': tenantpolicy.tenant_id,
95 97
             'priority': tenantpolicy.priority,

Loading…
Cancel
Save