Use neutron-lib constans, exceptions & validators
This eliminates some deprecation warnings Change-Id: If8485cb8be33b15795cee74ce3f367339b6b531c
This commit is contained in:
parent
456e169f46
commit
36ada05a0f
|
@ -19,9 +19,6 @@ from gbpservice.contrib.nfp.config_orchestrator.common import topics
|
|||
from gbpservice.nfp.core import log as nfp_logging
|
||||
import netaddr
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import l3_db
|
||||
from neutron.db.l3_db import DEVICE_OWNER_ROUTER_INTF
|
||||
from neutron.db.l3_db import EXTERNAL_GW_INFO
|
||||
|
@ -29,6 +26,8 @@ from neutron.db.l3_db import RouterPort
|
|||
from neutron.db import models_v2
|
||||
from neutron.extensions import l3
|
||||
from neutron.plugins.common import constants as n_const
|
||||
from neutron_lib import constants as nlib_const
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
import neutron_fwaas.extensions
|
||||
from neutron_fwaas.services.firewall import fwaas_plugin as ref_fw_plugin
|
||||
|
@ -65,7 +64,7 @@ class NFPFirewallPlugin(ref_fw_plugin.FirewallPlugin):
|
|||
# pop router_id as this goes in the router association db
|
||||
# and not firewall db
|
||||
router_ids = firewall['firewall'].pop('router_ids', None)
|
||||
if router_ids == attr.ATTR_NOT_SPECIFIED:
|
||||
if router_ids == nlib_const.ATTR_NOT_SPECIFIED:
|
||||
return tenant_id
|
||||
|
||||
def set_routers_for_firewall(self, context, fw):
|
||||
|
@ -143,7 +142,7 @@ def _is_net_reachable_from_net(self, context, tenant_id, from_net_id,
|
|||
Port = models_v2.Port
|
||||
devices_on_nets = context.session.query(Port.device_id).filter(
|
||||
Port.tenant_id == tenant_id,
|
||||
Port.device_owner.notin_([l3_constants.DEVICE_OWNER_DHCP]),
|
||||
Port.device_owner.notin_([nlib_const.DEVICE_OWNER_DHCP]),
|
||||
Port.network_id.in_(nets)).subquery()
|
||||
return context.session.query(Port.network_id).filter(
|
||||
Port.tenant_id == tenant_id,
|
||||
|
@ -290,7 +289,7 @@ def _get_router_for_floatingip(self, context, internal_port,
|
|||
RouterPort.router_id, models_v2.IPAllocation.ip_address).join(
|
||||
models_v2.Port, models_v2.IPAllocation).filter(
|
||||
models_v2.Port.network_id == internal_port['network_id'],
|
||||
RouterPort.port_type.in_(l3_constants.ROUTER_INTERFACE_OWNERS),
|
||||
RouterPort.port_type.in_(nlib_const.ROUTER_INTERFACE_OWNERS),
|
||||
models_v2.IPAllocation.subnet_id == internal_subnet_id
|
||||
).join(gw_port, gw_port.device_id == RouterPort.router_id).filter(
|
||||
gw_port.network_id == external_network_id).distinct()
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# limitations under the License.
|
||||
|
||||
from neutron.callbacks import registry
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.extensions import address_scope
|
||||
from neutron.extensions import l3
|
||||
from neutron.extensions import securitygroup as ext_sg
|
||||
|
@ -20,6 +19,7 @@ from neutron import manager
|
|||
from neutron.notifiers import nova
|
||||
from neutron.plugins.common import constants as pconst
|
||||
from neutron import quota
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ from neutron.api.v2 import attributes as attr
|
|||
from neutron import context
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import models_v2
|
||||
from neutron_lib.api import validators
|
||||
from neutron_lib.db import model_base
|
||||
from oslo_log import helpers as log
|
||||
from oslo_utils import uuidutils
|
||||
|
@ -1046,7 +1047,7 @@ class GroupPolicyDbPlugin(gpolicy.GroupPolicyPluginBase,
|
|||
|
||||
@staticmethod
|
||||
def validate_ip_pool(ip_pool, ip_version):
|
||||
attr._validate_subnet(ip_pool)
|
||||
validators.validate_subnet(ip_pool)
|
||||
ip_net = netaddr.IPNetwork(ip_pool)
|
||||
if ip_net.version != ip_version:
|
||||
raise gpolicy.InvalidIpPoolVersion(ip_pool=ip_pool,
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import exceptions as nexc
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as nexc
|
||||
from oslo_log import helpers as log
|
||||
from oslo_utils import uuidutils
|
||||
import sqlalchemy as sa
|
||||
|
|
|
@ -17,10 +17,11 @@ from sqlalchemy import orm
|
|||
from sqlalchemy import sql
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import models_v2
|
||||
from neutron_lib.api import validators
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
|
||||
class ImplicitSubnetpool(model_base.BASEV2):
|
||||
|
@ -102,7 +103,7 @@ class ImplicitSubnetpoolMixin(object):
|
|||
|
||||
def update_implicit_subnetpool(self, context, subnetpool):
|
||||
is_implicit = False
|
||||
if attr.is_attr_set(subnetpool.get('is_implicit')):
|
||||
if validators.is_attr_set(subnetpool.get('is_implicit')):
|
||||
is_implicit = subnetpool['is_implicit']
|
||||
with context.session.begin(subtransactions=True):
|
||||
if is_implicit:
|
||||
|
|
|
@ -26,7 +26,7 @@ down_revision = '1bf7555fa01a'
|
|||
|
||||
|
||||
from alembic import op
|
||||
from neutron.common import constants
|
||||
from neutron_lib import constants
|
||||
import sqlalchemy as sa
|
||||
|
||||
from gbpservice.neutron.services.grouppolicy.common import (
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
import ast
|
||||
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import models_v2
|
||||
from neutron import manager
|
||||
from neutron.plugins.common import constants as pconst
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_log import helpers as log
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
# under the License.
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.common import exceptions as nexc
|
||||
from neutron_lib.api import converters as conv
|
||||
from neutron_lib import constants as nlib_const
|
||||
from neutron_lib import exceptions as nexc
|
||||
from oslo_config import cfg
|
||||
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
|
|
|
@ -16,13 +16,12 @@ import re
|
|||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.api.v2 import resource_helper
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron.common import exceptions as nexc
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.services import service_base
|
||||
from neutron_lib.api import converters as conv
|
||||
from neutron_lib.api import validators as valid
|
||||
from neutron_lib import constants as nlib_const
|
||||
from neutron_lib import exceptions as nexc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
|
@ -205,9 +204,9 @@ gp_supported_actions = [None, gp_constants.GP_ACTION_ALLOW,
|
|||
gp_supported_directions = [None, gp_constants.GP_DIRECTION_IN,
|
||||
gp_constants.GP_DIRECTION_OUT,
|
||||
gp_constants.GP_DIRECTION_BI]
|
||||
gp_supported_protocols = [None, n_constants.PROTO_NAME_TCP,
|
||||
n_constants.PROTO_NAME_UDP,
|
||||
n_constants.PROTO_NAME_ICMP]
|
||||
gp_supported_protocols = [None, nlib_const.PROTO_NAME_TCP,
|
||||
nlib_const.PROTO_NAME_UDP,
|
||||
nlib_const.PROTO_NAME_ICMP]
|
||||
gp_network_service_param_types = [
|
||||
gp_constants.GP_NETWORK_SVC_PARAM_TYPE_IP_SINGLE,
|
||||
gp_constants.GP_NETWORK_SVC_PARAM_TYPE_IP_POOL,
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron_lib.api import converters as conv
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
EXTENDED_ATTRIBUTES_2_0 = {
|
||||
|
|
|
@ -14,7 +14,6 @@ import netaddr
|
|||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import l3_db
|
||||
|
@ -22,6 +21,7 @@ from neutron.db import models_v2
|
|||
from neutron.db import securitygroups_db
|
||||
from neutron.plugins.ml2 import db as ml2_db
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_log import log
|
||||
from sqlalchemy import event
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ import abc
|
|||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.api.v2 import resource_helper
|
||||
from neutron.common import exceptions as nexc
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.services import service_base
|
||||
from neutron_lib.api import converters as conv
|
||||
from neutron_lib.api import validators as valid
|
||||
from neutron_lib import exceptions as nexc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
import copy
|
||||
import re
|
||||
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron import context as nctx
|
||||
from neutron.extensions import portbindings
|
||||
from neutron import manager
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
from neutron_lib import constants as n_constants
|
||||
from opflexagent import constants as ofcst
|
||||
from oslo_log import log
|
||||
from oslo_utils import importutils
|
||||
|
|
|
@ -26,8 +26,6 @@ from aim import context as aim_context
|
|||
from aim import utils as aim_utils
|
||||
from neutron.agent import securitygroups_rpc
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron.common import exceptions as n_exceptions
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics as n_topics
|
||||
from neutron.db import address_scope_db
|
||||
|
@ -42,6 +40,8 @@ from neutron import manager
|
|||
from neutron.plugins.common import constants as pconst
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
from neutron.plugins.ml2 import models
|
||||
from neutron_lib import constants as n_constants
|
||||
from neutron_lib import exceptions as n_exceptions
|
||||
from opflexagent import constants as ofcst
|
||||
from opflexagent import rpc as ofrpc
|
||||
from oslo_config import cfg
|
||||
|
|
|
@ -37,6 +37,7 @@ from neutron.plugins.ml2.common import exceptions as ml2_exc
|
|||
from neutron.plugins.ml2 import managers as ml2_managers
|
||||
from neutron.plugins.ml2 import plugin as ml2_plugin
|
||||
from neutron.quota import resource_registry
|
||||
from neutron_lib.api import validators
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import excutils
|
||||
|
@ -399,7 +400,7 @@ class Ml2PlusPlugin(ml2_plugin.Ml2Plugin,
|
|||
self.mechanism_manager.delete_subnetpool_postcommit(mech_context)
|
||||
|
||||
def _update_implicit_subnetpool(self, context, request, result):
|
||||
if attributes.is_attr_set(request['subnetpool'].get('is_implicit')):
|
||||
if validators.is_attr_set(request['subnetpool'].get('is_implicit')):
|
||||
result['is_implicit'] = request['subnetpool']['is_implicit']
|
||||
result['is_implicit'] = (
|
||||
self.update_implicit_subnetpool(context, result))
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
"""Exceptions used by Group Policy plugin and drivers."""
|
||||
|
||||
from neutron.common import exceptions
|
||||
from neutron_lib import exceptions
|
||||
|
||||
|
||||
class GroupPolicyDriverError(exceptions.NeutronException):
|
||||
|
|
|
@ -19,12 +19,12 @@ from aim import context as aim_context
|
|||
from aim import utils as aim_utils
|
||||
from neutron.agent.linux import dhcp
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context as n_context
|
||||
from neutron.db import models_v2
|
||||
from neutron import manager
|
||||
from neutron import policy
|
||||
from neutron_lib import constants as n_constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log
|
||||
|
|
|
@ -23,8 +23,6 @@ from apic_ml2.neutron.plugins.ml2.drivers.cisco.apic import config # noqa
|
|||
from apicapi import apic_manager
|
||||
from neutron.agent.linux import dhcp
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
from neutron import context as nctx
|
||||
|
@ -36,7 +34,9 @@ from neutron.plugins.common import constants as p_const
|
|||
from neutron.plugins.ml2 import driver_api as n_api
|
||||
from neutron.plugins.ml2 import models as ml2_models
|
||||
from neutron.plugins.ml2 import rpc as neu_rpc
|
||||
from neutron_lib import constants as n_constants
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from opflexagent import constants as ofcst
|
||||
from opflexagent import rpc
|
||||
from oslo_concurrency import lockutils
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
import copy
|
||||
import six
|
||||
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron_lib import constants as n_constants
|
||||
|
||||
from gbpservice.neutron.db.grouppolicy import group_policy_mapping_db as gpdb
|
||||
from gbpservice.neutron.services.grouppolicy.common import constants as g_const
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron_lib.api import validators
|
||||
|
||||
from gbpservice.neutron.db.grouppolicy.extensions import group_proxy_db as db
|
||||
from gbpservice.neutron.db.grouppolicy import group_policy_db as gp_db
|
||||
|
@ -34,7 +34,7 @@ class ProxyGroupDriver(api.ExtensionDriver):
|
|||
def process_create_policy_target_group(self, session, data, result):
|
||||
data = data['policy_target_group']
|
||||
proxied = data.get('proxied_group_id')
|
||||
if attributes.is_attr_set(proxied):
|
||||
if validators.is_attr_set(proxied):
|
||||
# Set value for proxied group
|
||||
record = (session.query(db.GroupProxyMapping).filter_by(
|
||||
policy_target_group_id=proxied).first())
|
||||
|
@ -50,7 +50,7 @@ class ProxyGroupDriver(api.ExtensionDriver):
|
|||
proxy_group_id=result['id'],
|
||||
proxied_group_id=None)
|
||||
session.add(record)
|
||||
if not attributes.is_attr_set(data.get('proxy_type')):
|
||||
if not validators.is_attr_set(data.get('proxy_type')):
|
||||
data['proxy_type'] = driver_proxy_group.DEFAULT_PROXY_TYPE
|
||||
record = (session.query(db.GroupProxyMapping).filter_by(
|
||||
policy_target_group_id=result['id']).one())
|
||||
|
@ -62,7 +62,7 @@ class ProxyGroupDriver(api.ExtensionDriver):
|
|||
policy_target_group_id=result['id']).one())
|
||||
record.enforce_service_chains = data['enforce_service_chains']
|
||||
result['enforce_service_chains'] = data['enforce_service_chains']
|
||||
elif attributes.is_attr_set(data.get('proxy_type')):
|
||||
elif validators.is_attr_set(data.get('proxy_type')):
|
||||
raise driver_proxy_group.ProxyTypeSetWithoutProxiedPTG()
|
||||
|
||||
@api.default_extension_behavior(db.GroupProxyMapping)
|
||||
|
|
|
@ -16,13 +16,13 @@ import operator
|
|||
from keystoneclient import exceptions as k_exceptions
|
||||
from keystoneclient.v2_0 import client as k_client
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context as n_context
|
||||
from neutron.db import models_v2
|
||||
from neutron.extensions import l3 as ext_l3
|
||||
from neutron.extensions import securitygroup as ext_sg
|
||||
from neutron_lib import constants as n_const
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log
|
||||
from oslo_log import log as logging
|
||||
|
@ -212,7 +212,7 @@ class ImplicitResourceOperations(local_api.LocalAPI,
|
|||
|
||||
def _sg_rule(self, plugin_context, tenant_id, sg_id, direction,
|
||||
protocol=None, port_range=None, cidr=None,
|
||||
ethertype=const.IPv4, unset=False):
|
||||
ethertype=n_const.IPv4, unset=False):
|
||||
if port_range:
|
||||
port_min, port_max = (gpdb.GroupPolicyDbPlugin.
|
||||
_get_min_max_ports_from_range(port_range))
|
||||
|
@ -2513,7 +2513,7 @@ class ResourceMappingDriver(api.PolicyDriver, ImplicitResourceOperations,
|
|||
|
||||
sg_id = self._get_default_security_group(plugin_context, ptg_id,
|
||||
tenant_id)
|
||||
ip_v = {4: const.IPv4, 6: const.IPv6}
|
||||
ip_v = {4: n_const.IPv4, 6: n_const.IPv6}
|
||||
if not sg_id:
|
||||
sg_name = DEFAULT_SG_PREFIX % ptg_id
|
||||
sg = self._create_gbp_sg(plugin_context, tenant_id, sg_name,
|
||||
|
@ -2541,7 +2541,7 @@ class ResourceMappingDriver(api.PolicyDriver, ImplicitResourceOperations,
|
|||
self._sg_rule(plugin_context, tenant_id, sg_id, 'egress',
|
||||
cidr='169.254.0.0/16', ethertype=ip_v[4])
|
||||
for ether_type in ip_v:
|
||||
for proto in [const.PROTO_NAME_TCP, const.PROTO_NAME_UDP]:
|
||||
for proto in [n_const.PROTO_NAME_TCP, n_const.PROTO_NAME_UDP]:
|
||||
self._sg_rule(plugin_context, tenant_id, sg_id, 'egress',
|
||||
protocol=proto, port_range='53',
|
||||
ethertype=ip_v[ether_type])
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import excutils
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
import abc
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron_lib.api import validators
|
||||
import six
|
||||
from sqlalchemy.orm import exc as orm_exc
|
||||
|
||||
|
@ -1962,7 +1962,7 @@ class ExtensionDriver(object):
|
|||
tables if needed.
|
||||
"""
|
||||
kwargs = dict((x, data[type][x] if
|
||||
attributes.is_attr_set(data[type][x]) else None)
|
||||
validators.is_attr_set(data[type][x]) else None)
|
||||
for x in keys)
|
||||
kwargs[type + '_' + 'id'] = result['id']
|
||||
record = table(**kwargs)
|
||||
|
@ -1988,7 +1988,7 @@ class ExtensionDriver(object):
|
|||
return
|
||||
for key in keys:
|
||||
value = data[type].get(key)
|
||||
if attributes.is_attr_set(value) and value != getattr(record, key):
|
||||
if validators.is_attr_set(value) and value != getattr(record, key):
|
||||
setattr(record, key, value)
|
||||
result[key] = getattr(record, key)
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import api as db_api
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_policy import policy as oslo_policy
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import constants as q_const
|
||||
from neutron import context as n_ctx
|
||||
from neutron.extensions import l3
|
||||
from neutron import manager
|
||||
from neutron_lib import constants as q_const
|
||||
|
||||
from apic_ml2.neutron.services.l3_router import apic_driver_api
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import common_db_mixin
|
||||
from neutron.db import dns_db
|
||||
from neutron.db import extraroute_db
|
||||
from neutron.db import l3_gwmode_db
|
||||
from neutron.plugins.common import constants
|
||||
from neutron_lib import constants as q_const
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_log import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
"""Exceptions used by ServiceChain plugin and drivers."""
|
||||
|
||||
from neutron.common import exceptions
|
||||
from neutron_lib import exceptions
|
||||
|
||||
|
||||
class ServiceChainDriverError(exceptions.NeutronException):
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
"""Exceptions used by NodeCompositionPlugin and drivers."""
|
||||
|
||||
from neutron.common import exceptions
|
||||
from neutron_lib import exceptions
|
||||
|
||||
|
||||
class NodeDriverError(exceptions.NeutronException):
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import stevedore
|
||||
|
|
|
@ -19,10 +19,10 @@ import threading
|
|||
|
||||
from keystoneclient import exceptions as k_exceptions
|
||||
from keystoneclient.v2_0 import client as keyclient
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.plugins.common import constants as pconst
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
# under the License.
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.db import address_scope_db as as_db
|
||||
from neutron.db import models_v2
|
||||
from neutron_lib.api import validators
|
||||
from neutron_lib.db import model_base
|
||||
import oslo_db.sqlalchemy.session
|
||||
import sqlalchemy as sa
|
||||
|
@ -127,7 +127,7 @@ class TestAddressScopeExtension(model_base.BASEV2):
|
|||
class TestDBExtensionDriver(TestExtensionDriverBase):
|
||||
def _get_value(self, data, key):
|
||||
value = data[key]
|
||||
if not attributes.is_attr_set(value):
|
||||
if not validators.is_attr_set(value):
|
||||
value = ''
|
||||
return value
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ from aim import utils as aim_utils
|
|||
|
||||
from keystoneclient.v3 import client as ksc_client
|
||||
from neutron.api import extensions
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron import context as n_context
|
||||
from neutron.db import api as db_api
|
||||
from neutron import manager
|
||||
|
@ -40,6 +39,7 @@ from neutron.tests.unit.api import test_extensions
|
|||
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
|
||||
from neutron.tests.unit.extensions import test_address_scope
|
||||
from neutron.tests.unit.extensions import test_l3
|
||||
from neutron_lib import constants as n_constants
|
||||
from opflexagent import constants as ofcst
|
||||
import webob.exc
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron_lib import constants
|
||||
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
|
||||
|
@ -20,84 +20,84 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
|||
gp.POLICY_TARGETS: {
|
||||
'pt_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.POLICY_TARGET_GROUPS: {
|
||||
'ptg_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.L2_POLICIES: {
|
||||
'l2p_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.L3_POLICIES: {
|
||||
'l3p_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.POLICY_CLASSIFIERS: {
|
||||
'pc_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.POLICY_ACTIONS: {
|
||||
'pa_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.POLICY_RULES: {
|
||||
'pr_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.POLICY_RULE_SETS: {
|
||||
'prs_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.NETWORK_SERVICE_POLICIES: {
|
||||
'nsp_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.EXTERNAL_SEGMENTS: {
|
||||
'es_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.EXTERNAL_POLICIES: {
|
||||
'ep_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
gp.NAT_POOLS: {
|
||||
'np_extension': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
},
|
||||
|
|
|
@ -25,7 +25,6 @@ from aim.db import model_base as aim_model_base
|
|||
from keystoneclient.v3 import client as ksc_client
|
||||
from netaddr import IPSet
|
||||
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron import context as nctx
|
||||
from neutron.db import api as db_api
|
||||
from neutron import manager
|
||||
|
@ -33,6 +32,7 @@ from neutron.notifiers import nova
|
|||
from neutron.plugins.common import constants as service_constants
|
||||
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
|
||||
from neutron.tests.unit.extensions import test_address_scope
|
||||
from neutron_lib import constants as n_constants
|
||||
from opflexagent import constants as ocst
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
|
|
@ -18,7 +18,6 @@ import six
|
|||
from keystonemiddleware import auth_token # noqa
|
||||
import mock
|
||||
import netaddr
|
||||
from neutron.common import constants as cst
|
||||
from neutron import context as nctx
|
||||
from neutron.db import api as db_api
|
||||
from neutron.extensions import external_net as external_net
|
||||
|
@ -28,6 +27,7 @@ from neutron.plugins.common import constants as pconst
|
|||
from neutron.tests.unit.extensions import test_l3
|
||||
from neutron.tests.unit.extensions import test_securitygroup
|
||||
from neutron.tests.unit.plugins.ml2 import test_plugin as n_test_plugin
|
||||
from neutron_lib import constants as cst
|
||||
from neutron_lib.db import model_base
|
||||
from oslo_utils import uuidutils
|
||||
import webob.exc
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
# under the License.
|
||||
|
||||
import mock
|
||||
from neutron.common import constants as q_const
|
||||
from neutron import context
|
||||
from neutron_lib import constants as q_const
|
||||
|
||||
import apicapi.apic_mapper # noqa
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
# under the License.
|
||||
|
||||
import mock
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron_lib import constants as q_const
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
from gbpservice.neutron.services.l3_router import l3_apic
|
||||
from gbpservice.neutron.tests.unit.services.grouppolicy import (
|
||||
|
|
|
@ -15,12 +15,12 @@ import webob.exc
|
|||
|
||||
import mock
|
||||
from neutron.common import config # noqa
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context as n_context
|
||||
from neutron.db import api as db_api
|
||||
from neutron import manager
|
||||
from neutron.plugins.common import constants as pconst
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ import re
|
|||
|
||||
import mock
|
||||
from neutron.api.v2 import attributes as nattr
|
||||
from neutron.common import constants as n_consts
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.api.v2 import test_base
|
||||
from neutron.tests.unit.extensions import base as test_extensions_base
|
||||
from neutron_lib import constants as n_consts
|
||||
from oslo_utils import uuidutils
|
||||
from webob import exc
|
||||
|
||||
|
|
Loading…
Reference in New Issue