Use neutron-lib standard_attr

Now only neutron uses neutron/db/standard_attr.py
Shim can be removed

Change-Id: I980265335c5f3f6b5ee2e5fbcad9491aad91defe
This commit is contained in:
Nurmatov Mamatisa 2021-09-13 17:13:51 +03:00 committed by Slawek Kaplonski
parent 0fa97ecceb
commit ce3b86eef3
24 changed files with 23 additions and 51 deletions

View File

@ -13,11 +13,11 @@
from neutron_lib.api.definitions import address_group as ag from neutron_lib.api.definitions import address_group as ag
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from neutron.db import rbac_db_models from neutron.db import rbac_db_models
from neutron.db import standard_attr
class AddressAssociation(model_base.BASEV2): class AddressAssociation(model_base.BASEV2):

View File

@ -13,12 +13,12 @@
from neutron_lib.api.definitions import l3 as l3_apidef from neutron_lib.api.definitions import l3 as l3_apidef
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from neutron.db.models import l3agent as rb_model from neutron.db.models import l3agent as rb_model
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import standard_attr
class RouterPort(model_base.BASEV2): class RouterPort(model_base.BASEV2):

View File

@ -15,10 +15,9 @@
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from neutron.db import standard_attr
class Log(standard_attr.HasStandardAttributes, model_base.BASEV2, class Log(standard_attr.HasStandardAttributes, model_base.BASEV2,
model_base.HasId, model_base.HasProject): model_base.HasId, model_base.HasProject):

View File

@ -16,10 +16,9 @@ from neutron_lib.api.definitions import network_segment_range as range_apidef
from neutron_lib import constants from neutron_lib import constants
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from neutron.db import standard_attr
class NetworkSegmentRange(standard_attr.HasStandardAttributes, class NetworkSegmentRange(standard_attr.HasStandardAttributes,
model_base.BASEV2, model_base.HasId, model_base.BASEV2, model_base.HasId,

View File

@ -14,12 +14,12 @@
# under the License. # under the License.
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from neutron.db.models import l3 from neutron.db.models import l3
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import standard_attr
from neutron_lib.api.definitions import fip_pf_description as apidef from neutron_lib.api.definitions import fip_pf_description as apidef
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const

View File

@ -11,10 +11,9 @@
# under the License. # under the License.
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from neutron.db import standard_attr
class ProvisioningBlock(model_base.BASEV2): class ProvisioningBlock(model_base.BASEV2):
# the standard attr id of the thing we want to block # the standard attr id of the thing we want to block

View File

@ -14,13 +14,13 @@
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from sqlalchemy import sql from sqlalchemy import sql
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import rbac_db_models from neutron.db import rbac_db_models
from neutron.db import standard_attr
from neutron.extensions import securitygroup as sg from neutron.extensions import securitygroup as sg

View File

@ -16,11 +16,11 @@
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import standard_attr
from neutron.extensions import segment from neutron.extensions import segment

View File

@ -13,11 +13,10 @@
# #
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from neutron.db import standard_attr
class Tag(model_base.BASEV2): class Tag(model_base.BASEV2):
standard_attr_id = sa.Column( standard_attr_id = sa.Column(

View File

@ -20,13 +20,13 @@ from neutron_lib.api.definitions import subnetpool as subnetpool_def
from neutron_lib import constants from neutron_lib import constants
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from sqlalchemy import sql from sqlalchemy import sql
from neutron.db.network_dhcp_agent_binding import models as ndab_model from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.db import rbac_db_models from neutron.db import rbac_db_models
from neutron.db import standard_attr
# NOTE(ralonsoh): move to neutron_lib.db.model_base # NOTE(ralonsoh): move to neutron_lib.db.model_base

View File

@ -16,6 +16,7 @@
import datetime import datetime
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api
from neutron_lib.db import standard_attr
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log from oslo_log import log
@ -28,7 +29,6 @@ from neutron.db.models import l3 # noqa
from neutron.db.models import ovn as ovn_models from neutron.db.models import ovn as ovn_models
from neutron.db.models import securitygroup # noqa from neutron.db.models import securitygroup # noqa
from neutron.db import models_v2 # noqa from neutron.db import models_v2 # noqa
from neutron.db import standard_attr
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -16,12 +16,12 @@
from neutron_lib import constants from neutron_lib import constants
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
import sqlalchemy as sa import sqlalchemy as sa
from neutron.db.models import l3 from neutron.db.models import l3
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import rbac_db_models from neutron.db import rbac_db_models
from neutron.db import standard_attr
class QosPolicy(standard_attr.HasStandardAttributes, model_base.BASEV2, class QosPolicy(standard_attr.HasStandardAttributes, model_base.BASEV2,

View File

@ -1,23 +0,0 @@
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron_lib.db import standard_attr
# TODO(boden): remove shims when all consumers use lib for this module
StandardAttribute = standard_attr.StandardAttribute
HasStandardAttributes = standard_attr.HasStandardAttributes
get_standard_attr_resource_model_map = (
standard_attr.get_standard_attr_resource_model_map)
get_tag_resource_parent_map = standard_attr.get_tag_resource_parent_map

View File

@ -13,8 +13,7 @@
# under the License. # under the License.
from neutron_lib.db import resource_extend from neutron_lib.db import resource_extend
from neutron_lib.db import standard_attr
from neutron.db import standard_attr
@resource_extend.has_resource_extenders @resource_extend.has_resource_extenders

View File

@ -15,7 +15,7 @@
import itertools import itertools
from neutron.db import standard_attr from neutron_lib.db import standard_attr
def stdattrs_extended_resources(attributes): def stdattrs_extended_resources(attributes):

View File

@ -18,6 +18,7 @@ from neutron_lib.api.definitions import port
from neutron_lib.api import extensions as api_extensions from neutron_lib.api import extensions as api_extensions
from neutron_lib.api import faults from neutron_lib.api import faults
from neutron_lib.api import validators from neutron_lib.api import validators
from neutron_lib.db import standard_attr
from neutron_lib import exceptions from neutron_lib import exceptions
from neutron_lib.plugins import directory from neutron_lib.plugins import directory
from neutron_lib import rpc as n_rpc from neutron_lib import rpc as n_rpc
@ -27,7 +28,6 @@ import webob.exc
from neutron._i18n import _ from neutron._i18n import _
from neutron.api import extensions from neutron.api import extensions
from neutron.api.v2 import resource as api_resource from neutron.api.v2 import resource as api_resource
from neutron.db import standard_attr
TAG = 'tag' TAG = 'tag'

View File

@ -18,6 +18,7 @@ import functools
import itertools import itertools
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api
from neutron_lib.db import standard_attr
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc
from neutron_lib.objects import exceptions as o_exc from neutron_lib.objects import exceptions as o_exc
from neutron_lib.objects.extensions import standardattributes from neutron_lib.objects.extensions import standardattributes
@ -34,7 +35,6 @@ from sqlalchemy import orm
from sqlalchemy.orm import query as sqla_query from sqlalchemy.orm import query as sqla_query
from neutron._i18n import _ from neutron._i18n import _
from neutron.db import standard_attr
from neutron.objects.db import api as obj_db_api from neutron.objects.db import api as obj_db_api

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from neutron_lib.db import standard_attr
from neutron_lib.objects.extensions import standardattributes as stdattr_obj from neutron_lib.objects.extensions import standardattributes as stdattr_obj
from oslo_versionedobjects import fields as obj_fields from oslo_versionedobjects import fields as obj_fields
from neutron.db import standard_attr
from neutron.objects import base from neutron.objects import base

View File

@ -13,12 +13,12 @@
import functools import functools
from neutron_lib.db import model_query from neutron_lib.db import model_query
from neutron_lib.db import standard_attr
from sqlalchemy.orm import aliased from sqlalchemy.orm import aliased
from oslo_versionedobjects import fields as obj_fields from oslo_versionedobjects import fields as obj_fields
from neutron.db.models import tag as tag_model from neutron.db.models import tag as tag_model
from neutron.db import standard_attr
from neutron.objects import base from neutron.objects import base

View File

@ -14,6 +14,7 @@
from neutron_lib.api.definitions import revisionifmatch from neutron_lib.api.definitions import revisionifmatch
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api
from neutron_lib.db import resource_extend from neutron_lib.db import resource_extend
from neutron_lib.db import standard_attr
from neutron_lib.services import base as service_base from neutron_lib.services import base as service_base
from oslo_log import log as logging from oslo_log import log as logging
import sqlalchemy import sqlalchemy
@ -22,7 +23,6 @@ from sqlalchemy.orm import session as se
import webob.exc import webob.exc
from neutron._i18n import _ from neutron._i18n import _
from neutron.db import standard_attr
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -15,12 +15,12 @@
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api
from neutron_lib.db import model_query from neutron_lib.db import model_query
from neutron_lib.db import resource_extend from neutron_lib.db import resource_extend
from neutron_lib.db import standard_attr
from neutron_lib.objects import exceptions as obj_exc from neutron_lib.objects import exceptions as obj_exc
from neutron_lib.plugins import directory from neutron_lib.plugins import directory
from oslo_log import helpers as log_helpers from oslo_log import helpers as log_helpers
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from neutron.db import standard_attr
from neutron.extensions import tagging from neutron.extensions import tagging
from neutron.objects import tag as tag_obj from neutron.objects import tag as tag_obj

View File

@ -15,11 +15,11 @@
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api
from neutron_lib.db import model_query from neutron_lib.db import model_query
from neutron_lib.db import resource_extend from neutron_lib.db import resource_extend
from neutron_lib.db import standard_attr
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc
from oslo_utils import timeutils from oslo_utils import timeutils
from sqlalchemy.orm import session as se from sqlalchemy.orm import session as se
from neutron.db import standard_attr
CHANGED_SINCE = 'changed_since' CHANGED_SINCE = 'changed_since'
TIME_FORMAT_WHOLE_SECONDS = '%Y-%m-%dT%H:%M:%S' TIME_FORMAT_WHOLE_SECONDS = '%Y-%m-%dT%H:%M:%S'

View File

@ -15,12 +15,12 @@
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const
from neutron_lib.db import model_base from neutron_lib.db import model_base
from neutron_lib.db import standard_attr
from neutron_lib.services.trunk import constants from neutron_lib.services.trunk import constants
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import sql from sqlalchemy import sql
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import standard_attr
class Trunk(standard_attr.HasStandardAttributes, model_base.BASEV2, class Trunk(standard_attr.HasStandardAttributes, model_base.BASEV2,

View File

@ -27,6 +27,7 @@ from neutron_lib.callbacks import registry
from neutron_lib import constants from neutron_lib import constants
from neutron_lib import context from neutron_lib import context
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api
from neutron_lib.db import standard_attr
from neutron_lib import exceptions as lib_exc from neutron_lib import exceptions as lib_exc
from neutron_lib import fixture from neutron_lib import fixture
from neutron_lib.plugins import directory from neutron_lib.plugins import directory
@ -57,7 +58,6 @@ from neutron.db import ipam_backend_mixin
from neutron.db.models import l3 as l3_models from neutron.db.models import l3 as l3_models
from neutron.db.models import securitygroup as sg_models from neutron.db.models import securitygroup as sg_models
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db import standard_attr
from neutron.ipam.drivers.neutrondb_ipam import driver as ipam_driver from neutron.ipam.drivers.neutrondb_ipam import driver as ipam_driver
from neutron.ipam import exceptions as ipam_exc from neutron.ipam import exceptions as ipam_exc
from neutron.objects import network as network_obj from neutron.objects import network as network_obj