Merge "consume common constants from lib"
This commit is contained in:
commit
048c880c30
neutron
agent
api/rpc
common
db
agents_db.pyagentschedulers_db.pyl3_db.pyl3_hamode_db.py
migration/alembic_migrations/versions
newton/expand
ocata/expand
pike/expand
qos
extensions
objects
pecan_wsgi/controllers
plugins/ml2
services/qos/drivers
tests
fullstack
functional/agent/l2/extensions
tempest/api
tools.pyunit
agent
api/rpc/handlers
db
extensions
objects
plugins/ml2/drivers
agent
linuxbridge/agent/extension_drivers
mech_sriov/agent/extension_drivers
openvswitch/agent
services/qos/drivers
@ -17,6 +17,7 @@ import collections
|
||||
import os
|
||||
|
||||
import eventlet
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import context
|
||||
from neutron_lib import exceptions
|
||||
@ -737,7 +738,7 @@ class DhcpAgentWithStateReport(DhcpAgent):
|
||||
ctx = context.get_admin_context_without_session()
|
||||
agent_status = self.state_rpc.report_state(
|
||||
ctx, self.agent_state, True)
|
||||
if agent_status == n_const.AGENT_REVIVED:
|
||||
if agent_status == agent_consts.AGENT_REVIVED:
|
||||
LOG.info("Agent has just been revived. "
|
||||
"Scheduling full sync")
|
||||
self.schedule_resync("Agent has just been revived")
|
||||
|
@ -21,12 +21,11 @@ import six
|
||||
from neutron_lib.api.definitions import port_security as psec
|
||||
from neutron_lib import constants as n_const
|
||||
|
||||
import neutron.common.constants as const
|
||||
from neutron.common import utils
|
||||
|
||||
|
||||
INGRESS_DIRECTION = const.INGRESS_DIRECTION
|
||||
EGRESS_DIRECTION = const.EGRESS_DIRECTION
|
||||
INGRESS_DIRECTION = n_const.INGRESS_DIRECTION
|
||||
EGRESS_DIRECTION = n_const.EGRESS_DIRECTION
|
||||
|
||||
DIRECTION_IP_PREFIX = {INGRESS_DIRECTION: 'source_ip_prefix',
|
||||
EGRESS_DIRECTION: 'dest_ip_prefix'}
|
||||
|
@ -16,6 +16,7 @@
|
||||
import abc
|
||||
import collections
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
@ -25,7 +26,6 @@ from neutron.api.rpc.callbacks.consumer import registry
|
||||
from neutron.api.rpc.callbacks import events
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.api.rpc.handlers import resources_rpc
|
||||
from neutron.common import constants
|
||||
from neutron import manager
|
||||
from neutron.services.qos import qos_consts
|
||||
|
||||
|
@ -17,6 +17,7 @@ import itertools
|
||||
|
||||
import eventlet
|
||||
import netaddr
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
from neutron_lib.callbacks import resources
|
||||
@ -731,7 +732,7 @@ class L3NATAgentWithStateReport(L3NATAgent):
|
||||
agent_status = self.state_rpc.report_state(self.context,
|
||||
self.agent_state,
|
||||
True)
|
||||
if agent_status == l3_constants.AGENT_REVIVED:
|
||||
if agent_status == agent_consts.AGENT_REVIVED:
|
||||
LOG.info('Agent has just been revived. '
|
||||
'Doing a full sync.')
|
||||
self.fullsync = True
|
||||
|
@ -1284,7 +1284,7 @@ class DeviceManager(object):
|
||||
{'device_id': device_id, 'network_id': network.id})
|
||||
for port in network.ports:
|
||||
port_device_id = getattr(port, 'device_id', None)
|
||||
if port_device_id == n_const.DEVICE_ID_RESERVED_DHCP_PORT:
|
||||
if port_device_id == constants.DEVICE_ID_RESERVED_DHCP_PORT:
|
||||
try:
|
||||
port = self.plugin.update_dhcp_port(
|
||||
port.id, {'port': {'network_id': network.id,
|
||||
|
@ -640,9 +640,9 @@ class IptablesFirewallDriver(firewall.FirewallDriver):
|
||||
protocol = 'ipv6-icmp'
|
||||
iptables_rule = ['-p', protocol]
|
||||
|
||||
if (is_port and protocol in n_const.IPTABLES_PROTOCOL_MAP):
|
||||
if (is_port and protocol in constants.IPTABLES_PROTOCOL_MAP):
|
||||
# iptables adds '-m protocol' when the port number is specified
|
||||
iptables_rule += ['-m', n_const.IPTABLES_PROTOCOL_MAP[protocol]]
|
||||
iptables_rule += ['-m', constants.IPTABLES_PROTOCOL_MAP[protocol]]
|
||||
return iptables_rule
|
||||
|
||||
def _port_arg(self, direction, protocol, port_range_min, port_range_max):
|
||||
|
@ -22,7 +22,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils
|
||||
@ -144,7 +143,7 @@ class DhcpAgentNotifyAPI(object):
|
||||
return enabled_agents
|
||||
|
||||
def _is_reserved_dhcp_port(self, port):
|
||||
return port.get('device_id') == n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
return port.get('device_id') == constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
|
||||
def _notify_agents(self, context, method, payload, network_id):
|
||||
"""Notify all the agents that are hosting the network."""
|
||||
|
@ -281,7 +281,7 @@ class DhcpRpcCallback(object):
|
||||
plugin = directory.get_plugin()
|
||||
try:
|
||||
old_port = plugin.get_port(context, port['id'])
|
||||
if (old_port['device_id'] != n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
if (old_port['device_id'] != constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
and old_port['device_id'] !=
|
||||
utils.get_dhcp_agent_device_id(port['port']['network_id'],
|
||||
host)):
|
||||
|
@ -19,11 +19,6 @@ from neutron_lib import constants as lib_constants
|
||||
ROUTER_PORT_OWNERS = lib_constants.ROUTER_INTERFACE_OWNERS_SNAT + \
|
||||
(lib_constants.DEVICE_OWNER_ROUTER_GW,)
|
||||
|
||||
ROUTER_STATUS_ACTIVE = 'ACTIVE'
|
||||
ROUTER_STATUS_ERROR = 'ERROR'
|
||||
|
||||
DEVICE_ID_RESERVED_DHCP_PORT = "reserved_dhcp_port"
|
||||
|
||||
HA_ROUTER_STATE_KEY = '_ha_state'
|
||||
METERING_LABEL_KEY = '_metering_labels'
|
||||
FLOATINGIP_AGENT_INTF_KEY = '_floatingip_agent_interfaces'
|
||||
@ -50,23 +45,10 @@ ETHERTYPE_IPV6 = 0x86DD
|
||||
IP_PROTOCOL_NAME_ALIASES = {lib_constants.PROTO_NAME_IPV6_ICMP_LEGACY:
|
||||
lib_constants.PROTO_NAME_IPV6_ICMP}
|
||||
|
||||
VALID_DSCP_MARKS = [0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34,
|
||||
36, 38, 40, 46, 48, 56]
|
||||
|
||||
IP_PROTOCOL_NUM_TO_NAME_MAP = {
|
||||
str(v): k for k, v in lib_constants.IP_PROTOCOL_MAP.items()}
|
||||
|
||||
# When using iptables-save we specify '-p {proto} -m {module}',
|
||||
# but sometimes those values are not identical. This is a map
|
||||
# of known protocols that require a '-m {module}', along with
|
||||
# the module name that should be used.
|
||||
IPTABLES_PROTOCOL_MAP = {lib_constants.PROTO_NAME_DCCP: 'dccp',
|
||||
lib_constants.PROTO_NAME_ICMP: 'icmp',
|
||||
lib_constants.PROTO_NAME_IPV6_ICMP: 'icmp6',
|
||||
lib_constants.PROTO_NAME_SCTP: 'sctp',
|
||||
lib_constants.PROTO_NAME_TCP: 'tcp',
|
||||
lib_constants.PROTO_NAME_UDP: 'udp'}
|
||||
|
||||
# TODO(boden): consume with I9642ed9b513a43c5558f9611f43227299707284a
|
||||
# Special provisional prefix for IPv6 Prefix Delegation
|
||||
PROVISIONAL_IPV6_PD_PREFIX = '::/64'
|
||||
|
||||
@ -87,11 +69,6 @@ INTERFACE_PREFIXES = (lib_constants.TAP_DEVICE_PREFIX,
|
||||
|
||||
ATTRIBUTES_TO_UPDATE = 'attributes_to_update'
|
||||
|
||||
# Maximum value integer can take in MySQL and PostgreSQL
|
||||
# In SQLite integer can be stored in 1, 2, 3, 4, 6, or 8 bytes,
|
||||
# but here it will be limited by this value for consistency.
|
||||
DB_INTEGER_MAX_VALUE = 2 ** 31 - 1
|
||||
|
||||
# TODO(amuller): Re-define the RPC namespaces once Oslo messaging supports
|
||||
# Targets with multiple namespaces. Neutron will then implement callbacks
|
||||
# for its RPC clients in order to support rolling upgrades.
|
||||
@ -115,18 +92,6 @@ IPV6_MIN_MTU = 1280
|
||||
|
||||
ROUTER_MARK_MASK = "0xffff"
|
||||
|
||||
# Agent states as detected by server, used to reply on agent's state report
|
||||
# agent has just been registered
|
||||
AGENT_NEW = 'new'
|
||||
# agent is alive
|
||||
AGENT_ALIVE = 'alive'
|
||||
# agent has just returned to alive after being dead
|
||||
AGENT_REVIVED = 'revived'
|
||||
|
||||
INGRESS_DIRECTION = 'ingress'
|
||||
EGRESS_DIRECTION = 'egress'
|
||||
|
||||
VALID_DIRECTIONS = (INGRESS_DIRECTION, EGRESS_DIRECTION)
|
||||
VALID_ETHERTYPES = (lib_constants.IPv4, lib_constants.IPv6)
|
||||
|
||||
IP_ALLOWED_VERSIONS = [lib_constants.IP_VERSION_4, lib_constants.IP_VERSION_6]
|
||||
@ -163,10 +128,8 @@ IPAM_ALLOCATION_STATUS_ALLOCATED = 'ALLOCATED'
|
||||
VALID_IPAM_ALLOCATION_STATUSES = (IPAM_ALLOCATION_STATUS_ALLOCATED,)
|
||||
|
||||
# Port binding states for Live Migration
|
||||
PORT_BINDING_STATUS_ACTIVE = 'ACTIVE'
|
||||
PORT_BINDING_STATUS_INACTIVE = 'INACTIVE'
|
||||
PORT_BINDING_STATUSES = (PORT_BINDING_STATUS_ACTIVE,
|
||||
PORT_BINDING_STATUS_INACTIVE)
|
||||
PORT_BINDING_STATUSES = (lib_constants.ACTIVE,
|
||||
lib_constants.INACTIVE)
|
||||
|
||||
VALID_FLOATINGIP_STATUS = (lib_constants.FLOATINGIP_STATUS_ACTIVE,
|
||||
lib_constants.FLOATINGIP_STATUS_DOWN,
|
||||
|
@ -16,6 +16,7 @@
|
||||
import datetime
|
||||
|
||||
from eventlet import greenthread
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
@ -318,7 +319,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
|
||||
Status is from server point of view: alive, new or revived.
|
||||
It could be used by agent to do some sync with the server if needed.
|
||||
"""
|
||||
status = n_const.AGENT_ALIVE
|
||||
status = agent_consts.AGENT_ALIVE
|
||||
with context.session.begin(subtransactions=True):
|
||||
res_keys = ['agent_type', 'binary', 'host', 'topic']
|
||||
res = dict((k, agent_state[k]) for k in res_keys)
|
||||
@ -336,7 +337,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
|
||||
agent_db = self._get_agent_by_type_and_host(
|
||||
context, agent_state['agent_type'], agent_state['host'])
|
||||
if not agent_db.is_active:
|
||||
status = n_const.AGENT_REVIVED
|
||||
status = agent_consts.AGENT_REVIVED
|
||||
if 'resource_versions' not in agent_state:
|
||||
# updating agent_state with resource_versions taken
|
||||
# from db so that
|
||||
@ -362,7 +363,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
|
||||
context.session.add(agent_db)
|
||||
event_type = events.AFTER_CREATE
|
||||
self._log_heartbeat(agent_state, agent_db, configurations_dict)
|
||||
status = n_const.AGENT_NEW
|
||||
status = agent_consts.AGENT_NEW
|
||||
greenthread.sleep(0)
|
||||
|
||||
registry.notify(resources.AGENT, event_type, self, context=context,
|
||||
|
@ -27,7 +27,6 @@ from sqlalchemy.orm import exc
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.agent.common import utils as agent_utils
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron.db import agents_db
|
||||
from neutron.db.availability_zone import network as network_az
|
||||
@ -432,7 +431,7 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
|
||||
# DHCP agent per network so we don't have to worry about one
|
||||
# update_port passing and another failing
|
||||
for port in ports:
|
||||
port['device_id'] = n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
port['device_id'] = constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
self.update_port(context, port['id'], dict(port=port))
|
||||
binding_obj.delete()
|
||||
|
||||
|
@ -210,7 +210,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
||||
tenant_id=router['tenant_id'],
|
||||
name=router['name'],
|
||||
admin_state_up=router['admin_state_up'],
|
||||
status=n_const.ROUTER_STATUS_ACTIVE,
|
||||
status=constants.ACTIVE,
|
||||
description=router.get('description'))
|
||||
context.session.add(router_db)
|
||||
registry.notify(resources.ROUTER, events.PRECOMMIT_CREATE,
|
||||
|
@ -414,7 +414,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
router_id)
|
||||
router['status'] = self._update_router_db(
|
||||
context, router_id,
|
||||
{'status': n_const.ROUTER_STATUS_ERROR})['status']
|
||||
{'status': constants.ERROR})['status']
|
||||
|
||||
@registry.receives(resources.ROUTER, [events.PRECOMMIT_UPDATE])
|
||||
def _validate_migration(self, resource, event, trigger, context,
|
||||
|
@ -26,10 +26,9 @@ revision = '0f5bef0f87d4'
|
||||
down_revision = 'a5648cfeeadf'
|
||||
|
||||
from alembic import op
|
||||
from neutron_lib import constants
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.common import constants
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
|
@ -26,10 +26,10 @@ revision = 'a9c43481023c'
|
||||
down_revision = '929c968efe70'
|
||||
|
||||
from alembic import op
|
||||
from neutron_lib import constants
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.engine.reflection import Inspector as insp
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.db import migration
|
||||
|
||||
MYSQL_ENGINE = 'mysql'
|
||||
@ -45,7 +45,7 @@ def upgrade():
|
||||
sa.Column('status',
|
||||
sa.String(length=16),
|
||||
nullable=False,
|
||||
server_default=constants.PORT_BINDING_STATUS_ACTIVE))
|
||||
server_default=constants.ACTIVE))
|
||||
|
||||
if (engine.name == MYSQL_ENGINE):
|
||||
op.execute("ALTER TABLE ml2_port_bindings DROP PRIMARY KEY,"
|
||||
|
@ -26,9 +26,9 @@ revision = '2b42d90729da'
|
||||
down_revision = '804a3c76314c'
|
||||
|
||||
from alembic import op
|
||||
from neutron_lib import constants
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
|
@ -13,11 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import constants as db_const
|
||||
from neutron_lib.db import model_base
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import rbac_db_models
|
||||
from neutron.db import standard_attr
|
||||
|
@ -19,6 +19,7 @@ import re
|
||||
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib import constants as common_constants
|
||||
from neutron_lib.db import constants as db_const
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services import base as service_base
|
||||
@ -27,7 +28,6 @@ import six
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
from neutron.api.v2 import resource_helper
|
||||
from neutron.common import constants as common_constants
|
||||
from neutron.objects.qos import rule as rule_object
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.services.qos import qos_consts
|
||||
@ -85,12 +85,12 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
|
||||
'allow_post': True, 'allow_put': True,
|
||||
'is_visible': True, 'default': None,
|
||||
'validate': {'type:range': [0,
|
||||
common_constants.DB_INTEGER_MAX_VALUE]}},
|
||||
db_const.DB_INTEGER_MAX_VALUE]}},
|
||||
'max_burst_kbps': {
|
||||
'allow_post': True, 'allow_put': True,
|
||||
'is_visible': True, 'default': 0,
|
||||
'validate': {'type:range': [0,
|
||||
common_constants.DB_INTEGER_MAX_VALUE]}}}),
|
||||
db_const.DB_INTEGER_MAX_VALUE]}}}),
|
||||
},
|
||||
'dscp_marking_rules': {
|
||||
'parent': {'collection_name': 'policies',
|
||||
@ -111,7 +111,7 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
|
||||
'allow_post': True, 'allow_put': True,
|
||||
'is_visible': True,
|
||||
'validate': {'type:range': [0,
|
||||
common_constants.DB_INTEGER_MAX_VALUE]}},
|
||||
db_const.DB_INTEGER_MAX_VALUE]}},
|
||||
'direction': {
|
||||
'allow_post': True, 'allow_put': True,
|
||||
'is_visible': True, 'default': 'egress',
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib import constants as common_constants
|
||||
|
||||
from neutron.common import constants as common_constants
|
||||
from neutron.extensions import qos
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.db import constants as const
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from neutron_lib.plugins import directory
|
||||
from oslo_config import cfg
|
||||
@ -25,7 +26,6 @@ from neutron._i18n import _
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
from neutron.api.v2 import resource
|
||||
from neutron.common import constants as const
|
||||
from neutron.common import exceptions
|
||||
from neutron import quota
|
||||
from neutron.quota import resource_registry
|
||||
|
@ -157,7 +157,7 @@ class IPVersionEnumField(obj_fields.AutoTypedField):
|
||||
class DscpMark(IntegerEnum):
|
||||
def __init__(self, valid_values=None, **kwargs):
|
||||
super(DscpMark, self).__init__(
|
||||
valid_values=constants.VALID_DSCP_MARKS)
|
||||
valid_values=lib_constants.VALID_DSCP_MARKS)
|
||||
|
||||
|
||||
class DscpMarkField(obj_fields.AutoTypedField):
|
||||
@ -165,7 +165,7 @@ class DscpMarkField(obj_fields.AutoTypedField):
|
||||
|
||||
|
||||
class FlowDirectionEnumField(obj_fields.AutoTypedField):
|
||||
AUTO_TYPE = obj_fields.Enum(valid_values=constants.VALID_DIRECTIONS)
|
||||
AUTO_TYPE = obj_fields.Enum(valid_values=lib_constants.VALID_DIRECTIONS)
|
||||
|
||||
|
||||
class IpamAllocationStatusEnumField(obj_fields.AutoTypedField):
|
||||
|
@ -13,11 +13,11 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_utils import versionutils
|
||||
from oslo_versionedobjects import base as obj_base
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db.models import dns as dns_models
|
||||
@ -76,7 +76,7 @@ class PortBinding(PortBindingBase):
|
||||
'vif_details': common_types.DictOfMiscValuesField(nullable=True),
|
||||
'vnic_type': obj_fields.StringField(),
|
||||
'status': common_types.PortBindingStatusEnumField(
|
||||
default=constants.PORT_BINDING_STATUS_ACTIVE),
|
||||
default=constants.ACTIVE),
|
||||
}
|
||||
|
||||
primary_keys = ['port_id', 'host']
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
import itertools
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_utils import versionutils
|
||||
from oslo_versionedobjects import base as obj_base
|
||||
from oslo_versionedobjects import exception
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db import models_v2
|
||||
|
@ -24,7 +24,6 @@ from oslo_versionedobjects import exception
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
import six
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db.qos import models as qos_db_model
|
||||
from neutron.objects import base
|
||||
@ -110,7 +109,7 @@ class QosBandwidthLimitRule(QosRule):
|
||||
'max_kbps': obj_fields.IntegerField(nullable=True),
|
||||
'max_burst_kbps': obj_fields.IntegerField(nullable=True),
|
||||
'direction': common_types.FlowDirectionEnumField(
|
||||
default=n_const.EGRESS_DIRECTION)
|
||||
default=constants.EGRESS_DIRECTION)
|
||||
}
|
||||
|
||||
rule_type = qos_consts.RULE_TYPE_BANDWIDTH_LIMIT
|
||||
@ -119,7 +118,7 @@ class QosBandwidthLimitRule(QosRule):
|
||||
_target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
if _target_version < (1, 3) and 'direction' in primitive:
|
||||
direction = primitive.pop('direction')
|
||||
if direction == n_const.INGRESS_DIRECTION:
|
||||
if direction == constants.INGRESS_DIRECTION:
|
||||
raise exception.IncompatibleObjectVersion(
|
||||
objver=target_version,
|
||||
objtype="QosBandwidthLimitRule")
|
||||
|
@ -23,7 +23,6 @@ from pecan import request
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.pecan_wsgi.controllers import utils
|
||||
from neutron.quota import resource_registry
|
||||
|
||||
@ -91,7 +90,7 @@ class QuotaController(utils.NeutronPecanController):
|
||||
'allow_put': True,
|
||||
'convert_to': converters.convert_to_int,
|
||||
'validate': {
|
||||
'type:range': [-1, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [-1, db_const.DB_INTEGER_MAX_VALUE]},
|
||||
'is_visible': True}
|
||||
# The quota resource must always declare a tenant_id attribute,
|
||||
# otherwise the attribute will be stripped off when generating the
|
||||
|
@ -19,6 +19,7 @@ import contextlib
|
||||
import sys
|
||||
import time
|
||||
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
from neutron_lib.callbacks import resources as local_resources
|
||||
@ -37,7 +38,6 @@ from neutron.agent import securitygroups_rpc as agent_sg_rpc
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
|
||||
from neutron.common import config as common_config
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import topics
|
||||
from neutron.plugins.ml2.drivers.agent import _agent_manager_base as amb
|
||||
from neutron.plugins.ml2.drivers.agent import capabilities
|
||||
@ -126,7 +126,7 @@ class CommonAgentLoop(service.Service):
|
||||
agent_status = self.state_rpc.report_state(self.context,
|
||||
self.agent_state,
|
||||
True)
|
||||
if agent_status == n_const.AGENT_REVIVED:
|
||||
if agent_status == agent_consts.AGENT_REVIVED:
|
||||
LOG.info('%s Agent has just been revived. '
|
||||
'Doing a full sync.',
|
||||
self.agent_type)
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as const
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log
|
||||
@ -19,7 +20,6 @@ from oslo_log import log
|
||||
from neutron.agent.l2.extensions import qos_linux as qos
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.agent.linux import tc_lib
|
||||
import neutron.common.constants as const
|
||||
from neutron.services.qos.drivers.linuxbridge import driver
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
@ -14,11 +14,11 @@
|
||||
|
||||
import collections
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.agent.l2.extensions import qos_linux as qos
|
||||
from neutron.common import constants
|
||||
from neutron.services.qos.drivers.openvswitch import driver
|
||||
from neutron.services.qos import qos_consts
|
||||
|
||||
|
@ -22,6 +22,7 @@ import sys
|
||||
import time
|
||||
|
||||
import netaddr
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib.callbacks import events as callback_events
|
||||
from neutron_lib.callbacks import registry
|
||||
@ -51,7 +52,6 @@ from neutron.api.rpc.callbacks import resources
|
||||
from neutron.api.rpc.handlers import dvr_rpc
|
||||
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
|
||||
from neutron.common import config
|
||||
from neutron.common import constants as c_const
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron.conf.agent import xenapi_conf
|
||||
@ -313,7 +313,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
|
||||
agent_status = self.state_rpc.report_state(self.context,
|
||||
self.agent_state,
|
||||
True)
|
||||
if agent_status == c_const.AGENT_REVIVED:
|
||||
if agent_status == agent_consts.AGENT_REVIVED:
|
||||
LOG.info('Agent has just been revived. '
|
||||
'Doing a full sync.')
|
||||
self.fullsync = True
|
||||
|
@ -14,11 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import model_base
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.db import models_v2
|
||||
|
||||
BINDING_PROFILE_LEN = 4095
|
||||
@ -49,8 +49,8 @@ class PortBinding(model_base.BASEV2):
|
||||
vif_details = sa.Column(sa.String(4095), nullable=False, default='',
|
||||
server_default='')
|
||||
status = sa.Column(sa.String(16), nullable=False,
|
||||
default=constants.PORT_BINDING_STATUS_ACTIVE,
|
||||
server_default=constants.PORT_BINDING_STATUS_ACTIVE)
|
||||
default=constants.ACTIVE,
|
||||
server_default=constants.ACTIVE)
|
||||
|
||||
# Add a relationship to the Port model in order to instruct SQLAlchemy to
|
||||
# eagerly load port bindings
|
||||
|
@ -14,10 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import constants as db_consts
|
||||
from neutron_lib.services.qos import base
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.services.qos import qos_consts
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -27,9 +28,9 @@ DRIVER = None
|
||||
SUPPORTED_RULES = {
|
||||
qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: {
|
||||
qos_consts.MAX_KBPS: {
|
||||
'type:range': [0, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.MAX_BURST: {
|
||||
'type:range': [0, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.DIRECTION: {
|
||||
'type:values': constants.VALID_DIRECTIONS}
|
||||
},
|
||||
|
@ -14,10 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import constants as db_consts
|
||||
from neutron_lib.services.qos import base
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.services.qos import qos_consts
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -27,9 +28,9 @@ DRIVER = None
|
||||
SUPPORTED_RULES = {
|
||||
qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: {
|
||||
qos_consts.MAX_KBPS: {
|
||||
'type:range': [0, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.MAX_BURST: {
|
||||
'type:range': [0, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.DIRECTION: {
|
||||
'type:values': constants.VALID_DIRECTIONS}
|
||||
},
|
||||
|
@ -14,10 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import constants as db_consts
|
||||
from neutron_lib.services.qos import base
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.services.qos import qos_consts
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -27,15 +28,15 @@ DRIVER = None
|
||||
SUPPORTED_RULES = {
|
||||
qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: {
|
||||
qos_consts.MAX_KBPS: {
|
||||
'type:range': [0, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.MAX_BURST: {
|
||||
'type:range': [0, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.DIRECTION: {
|
||||
'type:values': [constants.EGRESS_DIRECTION]}
|
||||
},
|
||||
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: {
|
||||
qos_consts.MIN_KBPS: {
|
||||
'type:range': [0, constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.DIRECTION: {'type:values': [constants.EGRESS_DIRECTION]}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ from oslo_utils import uuidutils
|
||||
import testscenarios
|
||||
|
||||
from neutron.agent.linux import tc_lib
|
||||
from neutron.common import constants as common_constants
|
||||
from neutron.common import utils
|
||||
from neutron.services.qos import qos_consts
|
||||
from neutron.tests.common.agents import l2_extensions
|
||||
@ -51,10 +50,10 @@ class BaseQoSRuleTestCase(object):
|
||||
|
||||
@property
|
||||
def reverse_direction(self):
|
||||
if self.direction == common_constants.INGRESS_DIRECTION:
|
||||
return common_constants.EGRESS_DIRECTION
|
||||
elif self.direction == common_constants.EGRESS_DIRECTION:
|
||||
return common_constants.INGRESS_DIRECTION
|
||||
if self.direction == constants.INGRESS_DIRECTION:
|
||||
return constants.EGRESS_DIRECTION
|
||||
elif self.direction == constants.EGRESS_DIRECTION:
|
||||
return constants.INGRESS_DIRECTION
|
||||
|
||||
def setUp(self):
|
||||
host_desc = [
|
||||
@ -195,8 +194,8 @@ class _TestBwLimitQoS(BaseQoSRuleTestCase):
|
||||
class TestBwLimitQoSOvs(_TestBwLimitQoS, base.BaseFullStackTestCase):
|
||||
l2_agent_type = constants.AGENT_TYPE_OVS
|
||||
direction_scenarios = [
|
||||
('ingress', {'direction': common_constants.INGRESS_DIRECTION}),
|
||||
('egress', {'direction': common_constants.EGRESS_DIRECTION})
|
||||
('ingress', {'direction': constants.INGRESS_DIRECTION}),
|
||||
('egress', {'direction': constants.EGRESS_DIRECTION})
|
||||
]
|
||||
scenarios = testscenarios.multiply_scenarios(
|
||||
direction_scenarios, fullstack_utils.get_ovs_interface_scenarios())
|
||||
@ -205,17 +204,17 @@ class TestBwLimitQoSOvs(_TestBwLimitQoS, base.BaseFullStackTestCase):
|
||||
def _get_expected_burst_value(limit, direction):
|
||||
# For egress bandwidth limit this value should be calculated as
|
||||
# bandwidth_limit * qos_consts.DEFAULT_BURST_RATE
|
||||
if direction == common_constants.EGRESS_DIRECTION:
|
||||
if direction == constants.EGRESS_DIRECTION:
|
||||
return TestBwLimitQoSOvs._get_expected_egress_burst_value(limit)
|
||||
else:
|
||||
return 0
|
||||
|
||||
def _wait_for_bw_rule_applied(self, vm, limit, burst, direction):
|
||||
if direction == common_constants.EGRESS_DIRECTION:
|
||||
if direction == constants.EGRESS_DIRECTION:
|
||||
utils.wait_until_true(
|
||||
lambda: vm.bridge.get_egress_bw_limit_for_port(
|
||||
vm.port.name) == (limit, burst))
|
||||
elif direction == common_constants.INGRESS_DIRECTION:
|
||||
elif direction == constants.INGRESS_DIRECTION:
|
||||
utils.wait_until_true(
|
||||
lambda: vm.bridge.get_ingress_bw_limit_for_port(
|
||||
vm.port.name) == (limit, burst))
|
||||
@ -224,15 +223,15 @@ class TestBwLimitQoSOvs(_TestBwLimitQoS, base.BaseFullStackTestCase):
|
||||
class TestBwLimitQoSLinuxbridge(_TestBwLimitQoS, base.BaseFullStackTestCase):
|
||||
l2_agent_type = constants.AGENT_TYPE_LINUXBRIDGE
|
||||
scenarios = [
|
||||
('egress', {'direction': common_constants.EGRESS_DIRECTION}),
|
||||
('ingress', {'direction': common_constants.INGRESS_DIRECTION}),
|
||||
('egress', {'direction': constants.EGRESS_DIRECTION}),
|
||||
('ingress', {'direction': constants.INGRESS_DIRECTION}),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def _get_expected_burst_value(limit, direction):
|
||||
# For egress bandwidth limit this value should be calculated as
|
||||
# bandwidth_limit * qos_consts.DEFAULT_BURST_RATE
|
||||
if direction == common_constants.EGRESS_DIRECTION:
|
||||
if direction == constants.EGRESS_DIRECTION:
|
||||
return TestBwLimitQoSLinuxbridge._get_expected_egress_burst_value(
|
||||
limit)
|
||||
else:
|
||||
@ -259,10 +258,10 @@ class TestBwLimitQoSLinuxbridge(_TestBwLimitQoS, base.BaseFullStackTestCase):
|
||||
linuxbridge_agent_config.DEFAULT_KERNEL_HZ_VALUE,
|
||||
namespace=vm.host.host_namespace
|
||||
)
|
||||
if direction == common_constants.EGRESS_DIRECTION:
|
||||
if direction == constants.EGRESS_DIRECTION:
|
||||
utils.wait_until_true(
|
||||
lambda: tc.get_filters_bw_limits() == (limit, burst))
|
||||
elif direction == common_constants.INGRESS_DIRECTION:
|
||||
elif direction == constants.INGRESS_DIRECTION:
|
||||
utils.wait_until_true(
|
||||
lambda: tc.get_tbf_bw_limits() == (limit, burst))
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
import copy
|
||||
|
||||
import mock
|
||||
from neutron_lib import constants
|
||||
from oslo_utils import uuidutils
|
||||
import testscenarios
|
||||
|
||||
from neutron.api.rpc.callbacks.consumer import registry as consumer_reg
|
||||
from neutron.api.rpc.callbacks import events
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.common import constants
|
||||
from neutron.objects.qos import policy
|
||||
from neutron.objects.qos import rule
|
||||
from neutron.tests.common.agents import l2_extensions
|
||||
|
@ -403,7 +403,7 @@ class BaseNetworkTest(test.BaseTestCase):
|
||||
@classmethod
|
||||
def create_qos_bandwidth_limit_rule(cls, policy_id, max_kbps,
|
||||
max_burst_kbps,
|
||||
direction=constants.EGRESS_DIRECTION):
|
||||
direction=const.EGRESS_DIRECTION):
|
||||
"""Wrapper utility that returns a test QoS bandwidth limit rule."""
|
||||
body = cls.admin_client.create_bandwidth_limit_rule(
|
||||
policy_id, max_kbps, max_burst_kbps, direction)
|
||||
|
@ -275,7 +275,7 @@ def get_random_floatingip_status():
|
||||
|
||||
|
||||
def get_random_flow_direction():
|
||||
return random.choice(n_const.VALID_DIRECTIONS)
|
||||
return random.choice(constants.VALID_DIRECTIONS)
|
||||
|
||||
|
||||
def get_random_ha_states():
|
||||
|
@ -20,6 +20,7 @@ import uuid
|
||||
|
||||
import eventlet
|
||||
import mock
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib import constants as const
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
@ -32,7 +33,6 @@ from neutron.agent.linux import dhcp
|
||||
from neutron.agent.linux import interface
|
||||
from neutron.agent.metadata import driver as metadata_driver
|
||||
from neutron.common import config as common_config
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron.conf.agent import common as config
|
||||
from neutron.conf.agent import dhcp as dhcp_config
|
||||
@ -474,11 +474,11 @@ class TestDhcpAgent(base.BaseTestCase):
|
||||
with mock.patch.object(dhcp.state_rpc,
|
||||
'report_state') as report_state,\
|
||||
mock.patch.object(dhcp, "run"):
|
||||
report_state.return_value = n_const.AGENT_ALIVE
|
||||
report_state.return_value = agent_consts.AGENT_ALIVE
|
||||
dhcp._report_state()
|
||||
self.assertEqual({}, dhcp.needs_resync_reasons)
|
||||
|
||||
report_state.return_value = n_const.AGENT_REVIVED
|
||||
report_state.return_value = agent_consts.AGENT_REVIVED
|
||||
dhcp._report_state()
|
||||
self.assertEqual(dhcp.needs_resync_reasons[None],
|
||||
['Agent has just been revived'])
|
||||
|
@ -14,7 +14,9 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from neutron_lib import constants as common_constants
|
||||
from neutron_lib import context
|
||||
from neutron_lib.db import constants as db_consts
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.l2.extensions import qos
|
||||
@ -23,7 +25,6 @@ from neutron.api.rpc.callbacks.consumer import registry
|
||||
from neutron.api.rpc.callbacks import events
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.api.rpc.handlers import resources_rpc
|
||||
from neutron.common import constants as common_constants
|
||||
from neutron.objects.qos import policy
|
||||
from neutron.objects.qos import rule
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent import (
|
||||
@ -62,9 +63,9 @@ class FakeDriver(qos_linux.QosLinuxAgentDriver):
|
||||
SUPPORTED_RULES = {
|
||||
qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: {
|
||||
qos_consts.MAX_KBPS: {
|
||||
'type:range': [0, common_constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.MAX_BURST: {
|
||||
'type:range': [0, common_constants.DB_INTEGER_MAX_VALUE]},
|
||||
'type:range': [0, db_consts.DB_INTEGER_MAX_VALUE]},
|
||||
qos_consts.DIRECTION: {
|
||||
'type:values': [common_constants.EGRESS_DIRECTION,
|
||||
common_constants.INGRESS_DIRECTION]}
|
||||
|
@ -20,6 +20,7 @@ from itertools import combinations as iter_combinations
|
||||
import eventlet
|
||||
import mock
|
||||
import netaddr
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib import constants as lib_constants
|
||||
from neutron_lib import exceptions as exc
|
||||
@ -329,12 +330,12 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
||||
'report_state') as report_state:
|
||||
agent = l3_agent.L3NATAgentWithStateReport(host=HOSTNAME,
|
||||
conf=self.conf)
|
||||
report_state.return_value = n_const.AGENT_REVIVED
|
||||
report_state.return_value = agent_consts.AGENT_REVIVED
|
||||
agent._report_state()
|
||||
self.assertTrue(agent.fullsync)
|
||||
|
||||
agent.fullsync = False
|
||||
report_state.return_value = n_const.AGENT_ALIVE
|
||||
report_state.return_value = agent_consts.AGENT_ALIVE
|
||||
agent._report_state()
|
||||
self.assertFalse(agent.fullsync)
|
||||
|
||||
|
@ -25,7 +25,6 @@ from oslo_utils import fileutils
|
||||
import testtools
|
||||
|
||||
from neutron.agent.linux import dhcp
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.conf.agent import common as config
|
||||
from neutron.conf.agent import dhcp as dhcp_config
|
||||
from neutron.conf import common as base_config
|
||||
@ -91,7 +90,7 @@ class FakeReservedPort(object):
|
||||
FakeIPAllocation('fdca:3ba5:a17a:4ba3::2',
|
||||
'ffffffff-ffff-ffff-ffff-ffffffffffff')]
|
||||
self.mac_address = '00:00:80:aa:bb:ee'
|
||||
self.device_id = n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
self.device_id = constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
self.extra_dhcp_opts = []
|
||||
self.id = id
|
||||
|
||||
|
@ -23,7 +23,6 @@ from neutron_lib.plugins import directory
|
||||
from oslo_db import exception as db_exc
|
||||
|
||||
from neutron.api.rpc.handlers import dhcp_rpc
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions
|
||||
from neutron.common import utils
|
||||
from neutron.db import provisioning_blocks
|
||||
@ -177,7 +176,7 @@ class TestDhcpRpcCallback(base.BaseTestCase):
|
||||
|
||||
def test_update_port_missing_port_on_update(self):
|
||||
self.plugin.get_port.return_value = {
|
||||
'device_id': n_const.DEVICE_ID_RESERVED_DHCP_PORT}
|
||||
'device_id': constants.DEVICE_ID_RESERVED_DHCP_PORT}
|
||||
self.plugin.update_port.side_effect = n_exc.PortNotFound(port_id='66')
|
||||
self.assertIsNone(self.callbacks.update_dhcp_port(
|
||||
context='ctx', host='host', port_id='66',
|
||||
@ -251,7 +250,7 @@ class TestDhcpRpcCallback(base.BaseTestCase):
|
||||
self.assertEqual(expected_port, port)
|
||||
|
||||
self.plugin.get_port.return_value = {
|
||||
'device_id': n_const.DEVICE_ID_RESERVED_DHCP_PORT}
|
||||
'device_id': constants.DEVICE_ID_RESERVED_DHCP_PORT}
|
||||
self.callbacks._port_action = _fake_port_action
|
||||
self.callbacks.update_dhcp_port(mock.Mock(),
|
||||
host='foo_host',
|
||||
@ -303,7 +302,7 @@ class TestDhcpRpcCallback(base.BaseTestCase):
|
||||
'id': 'foo_port_id'
|
||||
}
|
||||
self.plugin.get_port.return_value = {
|
||||
'device_id': n_const.DEVICE_ID_RESERVED_DHCP_PORT}
|
||||
'device_id': constants.DEVICE_ID_RESERVED_DHCP_PORT}
|
||||
self.callbacks.update_dhcp_port(mock.Mock(),
|
||||
host='foo_host',
|
||||
port_id='foo_port_id',
|
||||
|
@ -31,7 +31,6 @@ from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.rpc.handlers import dhcp_rpc
|
||||
from neutron.api.rpc.handlers import l3_rpc
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import agentschedulers_db
|
||||
from neutron.db.models import agent as agent_model
|
||||
@ -640,7 +639,7 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
|
||||
network_id=port1['port']['network_id'])
|
||||
port_list = self.deserialize('json', port_res)
|
||||
self.assertEqual(port_list['ports'][0]['device_id'],
|
||||
n_const.DEVICE_ID_RESERVED_DHCP_PORT)
|
||||
constants.DEVICE_ID_RESERVED_DHCP_PORT)
|
||||
|
||||
def _test_get_active_networks_from_admin_state_down_agent(self,
|
||||
keep_services):
|
||||
@ -1441,7 +1440,7 @@ class OvsDhcpAgentNotifierTestCase(test_agent.AgentDBTestMixIn,
|
||||
return dhcp_notifier_schedule.call_count > 1
|
||||
|
||||
def test_reserved_dhcp_port_creation(self):
|
||||
device_id = n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
device_id = constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
self.assertFalse(self._is_schedule_network_called(device_id))
|
||||
|
||||
def test_unreserved_dhcp_port_creation(self):
|
||||
|
@ -477,7 +477,7 @@ class L3HATestCase(L3HATestFramework):
|
||||
|
||||
@mock.patch('neutron.db.l3_hamode_db.VR_ID_RANGE', new=set(range(1, 1)))
|
||||
def test_vr_id_depleted(self):
|
||||
self.assertEqual(n_const.ROUTER_STATUS_ERROR,
|
||||
self.assertEqual(constants.ERROR,
|
||||
self._create_router()['status'])
|
||||
|
||||
@mock.patch('neutron.db.l3_hamode_db.VR_ID_RANGE', new=set(range(1, 2)))
|
||||
@ -698,7 +698,7 @@ class L3HATestCase(L3HATestFramework):
|
||||
'_notify_router_updated'):
|
||||
with mock.patch.object(self.plugin, method,
|
||||
side_effect=ValueError):
|
||||
self.assertEqual(n_const.ROUTER_STATUS_ERROR,
|
||||
self.assertEqual(constants.ERROR,
|
||||
self._create_router()['status'])
|
||||
|
||||
def test_get_active_host_for_ha_router(self):
|
||||
|
@ -17,6 +17,7 @@ import sys
|
||||
|
||||
import mock
|
||||
from neutron_lib import context
|
||||
from neutron_lib.db import constants
|
||||
from oslo_config import cfg
|
||||
import testtools
|
||||
from webob import exc
|
||||
@ -25,7 +26,6 @@ import webtest
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import router
|
||||
from neutron.common import config
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions
|
||||
from neutron.conf import quota as qconf
|
||||
from neutron.db.quota import driver
|
||||
|
@ -11,11 +11,11 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_utils import uuidutils
|
||||
from oslo_versionedobjects import exception
|
||||
import testtools
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import models_v2
|
||||
from neutron.objects.db import api as db_api
|
||||
|
@ -15,7 +15,6 @@ from neutron_lib import constants
|
||||
from oslo_utils import uuidutils
|
||||
from oslo_versionedobjects import exception
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.objects.qos import policy
|
||||
from neutron.objects.qos import rule
|
||||
from neutron.services.qos import qos_consts
|
||||
@ -120,7 +119,7 @@ class QosBandwidthLimitRuleObjectTestCase(test_base.BaseObjectIfaceTestCase):
|
||||
self.assertEqual(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT, dict_['type'])
|
||||
|
||||
def test_bandwidth_limit_object_version_degradation(self):
|
||||
self.db_objs[0]['direction'] = n_const.EGRESS_DIRECTION
|
||||
self.db_objs[0]['direction'] = constants.EGRESS_DIRECTION
|
||||
rule_obj = rule.QosBandwidthLimitRule(self.context, **self.db_objs[0])
|
||||
primitive_rule = rule_obj.obj_to_primitive('1.2')
|
||||
self.assertNotIn(
|
||||
@ -132,7 +131,7 @@ class QosBandwidthLimitRuleObjectTestCase(test_base.BaseObjectIfaceTestCase):
|
||||
self.db_objs[0]['max_burst_kbps'],
|
||||
primitive_rule['versioned_object.data']['max_burst_kbps'])
|
||||
|
||||
self.db_objs[0]['direction'] = n_const.INGRESS_DIRECTION
|
||||
self.db_objs[0]['direction'] = constants.INGRESS_DIRECTION
|
||||
rule_obj = rule.QosBandwidthLimitRule(self.context, **self.db_objs[0])
|
||||
self.assertRaises(
|
||||
exception.IncompatibleObjectVersion,
|
||||
|
@ -14,6 +14,8 @@
|
||||
# class on the common base class for all objects
|
||||
|
||||
import mock
|
||||
from neutron_lib import constants as lib_consts
|
||||
from neutron_lib.db import constants as db_consts
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron.common import constants
|
||||
@ -30,15 +32,15 @@ DRIVER_SUPPORTED_PARAMETERS = [
|
||||
{
|
||||
'parameter_name': qos_consts.MAX_KBPS,
|
||||
'parameter_type': constants.VALUES_TYPE_RANGE,
|
||||
'parameter_values': {"start": 0, "end": constants.DB_INTEGER_MAX_VALUE}
|
||||
'parameter_values': {"start": 0, "end": db_consts.DB_INTEGER_MAX_VALUE}
|
||||
}, {
|
||||
'parameter_name': qos_consts.MAX_BURST,
|
||||
'parameter_type': constants.VALUES_TYPE_RANGE,
|
||||
'parameter_values': {"start": 0, "end": constants.DB_INTEGER_MAX_VALUE}
|
||||
'parameter_values': {"start": 0, "end": db_consts.DB_INTEGER_MAX_VALUE}
|
||||
}, {
|
||||
'parameter_name': qos_consts.DIRECTION,
|
||||
'parameter_type': constants.VALUES_TYPE_CHOICES,
|
||||
'parameter_values': constants.VALID_DIRECTIONS
|
||||
'parameter_values': lib_consts.VALID_DIRECTIONS
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -17,6 +17,7 @@ import random
|
||||
|
||||
import mock
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import context
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from neutron_lib.objects import exceptions as o_exc
|
||||
@ -30,7 +31,6 @@ from oslo_versionedobjects import fields as obj_fields
|
||||
from oslo_versionedobjects import fixture
|
||||
import testtools
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.db import _model_query as model_query
|
||||
from neutron.db.models import l3 as l3_model
|
||||
from neutron.db import standard_attr
|
||||
|
@ -84,7 +84,7 @@ class DscpMarkFieldTest(test_base.BaseTestCase, TestField):
|
||||
super(DscpMarkFieldTest, self).setUp()
|
||||
self.field = common_types.DscpMarkField()
|
||||
self.coerce_good_values = [(val, val)
|
||||
for val in constants.VALID_DSCP_MARKS]
|
||||
for val in const.VALID_DSCP_MARKS]
|
||||
self.coerce_bad_values = ['6', 'str', [], {}, object()]
|
||||
self.to_primitive_values = self.coerce_good_values
|
||||
self.from_primitive_values = self.coerce_good_values
|
||||
@ -176,7 +176,7 @@ class FlowDirectionEnumFieldTest(test_base.BaseTestCase, TestField):
|
||||
super(FlowDirectionEnumFieldTest, self).setUp()
|
||||
self.field = common_types.FlowDirectionEnumField()
|
||||
self.coerce_good_values = [(val, val)
|
||||
for val in constants.VALID_DIRECTIONS]
|
||||
for val in const.VALID_DIRECTIONS]
|
||||
self.coerce_bad_values = ['test', '8', 10, []]
|
||||
self.to_primitive_values = self.coerce_good_values
|
||||
self.from_primitive_values = self.coerce_good_values
|
||||
|
@ -15,6 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
from neutron_lib.callbacks import resources
|
||||
@ -23,7 +24,6 @@ from oslo_config import cfg
|
||||
import testtools
|
||||
|
||||
from neutron.agent.linux import bridge_lib
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.plugins.ml2.drivers.agent import _agent_manager_base as amb
|
||||
from neutron.plugins.ml2.drivers.agent import _common_agent as ca
|
||||
from neutron.tests import base
|
||||
@ -537,7 +537,7 @@ class TestCommonAgentLoop(base.BaseTestCase):
|
||||
def test_report_state_revived(self):
|
||||
with mock.patch.object(self.agent.state_rpc,
|
||||
"report_state") as report_st:
|
||||
report_st.return_value = n_const.AGENT_REVIVED
|
||||
report_st.return_value = agent_consts.AGENT_REVIVED
|
||||
self.agent._report_state()
|
||||
self.assertTrue(self.agent.fullsync)
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
|
||||
import mock
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.linux import tc_lib
|
||||
from neutron.common import constants
|
||||
from neutron.objects.qos import rule
|
||||
from neutron.plugins.ml2.drivers.linuxbridge.agent.common import config # noqa
|
||||
from neutron.plugins.ml2.drivers.linuxbridge.agent.extension_drivers import (
|
||||
|
@ -14,10 +14,10 @@
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import context
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.objects.qos import policy
|
||||
from neutron.objects.qos import rule
|
||||
from neutron.plugins.ml2.drivers.mech_sriov.agent.common import exceptions
|
||||
|
@ -13,10 +13,10 @@
|
||||
import copy
|
||||
|
||||
import mock
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import context
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.objects.qos import policy
|
||||
from neutron.objects.qos import rule
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent import (
|
||||
|
@ -16,6 +16,7 @@ import sys
|
||||
import time
|
||||
|
||||
import mock
|
||||
from neutron_lib.agent import constants as agent_consts
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
@ -27,7 +28,6 @@ from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.common import utils
|
||||
from neutron.agent.linux import async_process
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import constants as c_const
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.plugins.common import constants as p_const
|
||||
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
||||
@ -1089,7 +1089,7 @@ class TestOvsNeutronAgent(object):
|
||||
def test_report_state_revived(self):
|
||||
with mock.patch.object(self.agent.state_rpc,
|
||||
"report_state") as report_st:
|
||||
report_st.return_value = c_const.AGENT_REVIVED
|
||||
report_st.return_value = agent_consts.AGENT_REVIVED
|
||||
self.agent._report_state()
|
||||
self.assertTrue(self.agent.fullsync)
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
import mock
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib import constants as lib_consts
|
||||
from neutron_lib import context
|
||||
from neutron_lib.services.qos import base as qos_driver_base
|
||||
from oslo_utils import uuidutils
|
||||
@ -95,7 +96,7 @@ class TestQoSDriversRulesValidations(TestQosDriversManagerBase):
|
||||
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: {
|
||||
"min_kbps": {'type:values': None},
|
||||
'direction': {
|
||||
'type:values': constants.VALID_DIRECTIONS}
|
||||
'type:values': lib_consts.VALID_DIRECTIONS}
|
||||
}
|
||||
},
|
||||
'vif_types': [portbindings.VIF_TYPE_OVS],
|
||||
@ -156,7 +157,7 @@ class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
||||
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: {
|
||||
"min_kbps": {'type:values': None},
|
||||
'direction': {
|
||||
'type:values': constants.VALID_DIRECTIONS}
|
||||
'type:values': lib_consts.VALID_DIRECTIONS}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -166,11 +167,11 @@ class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
||||
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: {
|
||||
"min_kbps": {'type:values': None},
|
||||
'direction': {
|
||||
'type:values': constants.VALID_DIRECTIONS}
|
||||
'type:values': lib_consts.VALID_DIRECTIONS}
|
||||
},
|
||||
qos_consts.RULE_TYPE_DSCP_MARKING: {
|
||||
"dscp_mark": {
|
||||
'type:values': constants.VALID_DSCP_MARKS}
|
||||
'type:values': lib_consts.VALID_DSCP_MARKS}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,11 +196,11 @@ class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
||||
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: {
|
||||
"min_kbps": {'type:values': None},
|
||||
'direction': {
|
||||
'type:values': constants.VALID_DIRECTIONS}
|
||||
'type:values': lib_consts.VALID_DIRECTIONS}
|
||||
},
|
||||
qos_consts.RULE_TYPE_DSCP_MARKING: {
|
||||
"dscp_mark": {
|
||||
'type:values': constants.VALID_DSCP_MARKS}
|
||||
'type:values': lib_consts.VALID_DSCP_MARKS}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,11 +246,11 @@ class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
||||
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: {
|
||||
"min_kbps": {'type:range': [0, 1000]},
|
||||
'direction': {
|
||||
'type:values': constants.VALID_DIRECTIONS}
|
||||
'type:values': lib_consts.VALID_DIRECTIONS}
|
||||
},
|
||||
qos_consts.RULE_TYPE_DSCP_MARKING: {
|
||||
"dscp_mark": {
|
||||
'type:values': constants.VALID_DSCP_MARKS}
|
||||
'type:values': lib_consts.VALID_DSCP_MARKS}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user