remove neutron.common.constants
All of the externally consumed variables from neutron.common.constants now live in neutron-lib. This patch removes neutron.common.constants and switches all uses over to lib. NeutronLibImpact Depends-On: https://review.openstack.org/#/c/647836/ Change-Id: I3c2f28ecd18996a1cee1ae3af399166defe9da87changes/61/648761/2
parent
fb6094fe8d
commit
9bbe9911c4
|
@ -188,7 +188,7 @@ service plugins. Such as router and floatingip owner check for ``router``
|
|||
service plugin. Developers can register the extension resource name and service
|
||||
plugin name which were registered in neutron-lib into
|
||||
``EXT_PARENT_RESOURCE_MAPPING`` which is located in
|
||||
``neutron.common.constants``.
|
||||
``neutron_lib.services.constants``.
|
||||
|
||||
The check, performed in the ``__call__`` method, works as follows:
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ from neutron._i18n import _
|
|||
from neutron.agent.common import ip_lib
|
||||
from neutron.agent.common import utils
|
||||
from neutron.agent.ovsdb import impl_idl
|
||||
from neutron.common import constants as common_constants
|
||||
from neutron.common import _constants as common_constants
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.conf.agent import ovs_conf
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
|
||||
|
@ -826,8 +826,8 @@ class OVSBridge(BaseOVS):
|
|||
|
||||
def update_ingress_bw_limit_for_port(self, port_name, max_kbps,
|
||||
max_burst_kbps):
|
||||
max_bw_in_bits = max_kbps * common_constants.SI_BASE
|
||||
max_burst_in_bits = max_burst_kbps * common_constants.SI_BASE
|
||||
max_bw_in_bits = max_kbps * p_const.SI_BASE
|
||||
max_burst_in_bits = max_burst_kbps * p_const.SI_BASE
|
||||
port_type = self._get_port_val(port_name, "type")
|
||||
if port_type in constants.OVS_DPDK_PORT_TYPES:
|
||||
self._update_ingress_bw_limit_for_dpdk_port(
|
||||
|
@ -847,18 +847,18 @@ class OVSBridge(BaseOVS):
|
|||
other_config = qos_res['other_config']
|
||||
max_bw_in_bits = other_config.get('max-rate')
|
||||
if max_bw_in_bits is not None:
|
||||
qos_max_kbps = int(max_bw_in_bits) / common_constants.SI_BASE
|
||||
qos_max_kbps = int(max_bw_in_bits) / p_const.SI_BASE
|
||||
|
||||
queue_res = self.find_queue(port_name, QOS_DEFAULT_QUEUE)
|
||||
if queue_res:
|
||||
other_config = queue_res['other_config']
|
||||
max_bw_in_bits = other_config.get('max-rate')
|
||||
if max_bw_in_bits is not None:
|
||||
queue_max_kbps = int(max_bw_in_bits) / common_constants.SI_BASE
|
||||
queue_max_kbps = int(max_bw_in_bits) / p_const.SI_BASE
|
||||
max_burst_in_bits = other_config.get('burst')
|
||||
if max_burst_in_bits is not None:
|
||||
max_burst_kbit = (
|
||||
int(max_burst_in_bits) / common_constants.SI_BASE)
|
||||
int(max_burst_in_bits) / p_const.SI_BASE)
|
||||
|
||||
if qos_max_kbps == queue_max_kbps:
|
||||
max_kbps = qos_max_kbps
|
||||
|
@ -879,12 +879,12 @@ class OVSBridge(BaseOVS):
|
|||
if max_bw_in_bytes is not None:
|
||||
max_kbps = common_utils.bits_to_kilobits(
|
||||
common_utils.bytes_to_bits(int(float(max_bw_in_bytes))),
|
||||
common_constants.SI_BASE)
|
||||
p_const.SI_BASE)
|
||||
max_burst_in_bytes = other_config.get("cbs")
|
||||
if max_burst_in_bytes is not None:
|
||||
max_burst_kbit = common_utils.bits_to_kilobits(
|
||||
common_utils.bytes_to_bits(int(float(max_burst_in_bytes))),
|
||||
common_constants.SI_BASE)
|
||||
p_const.SI_BASE)
|
||||
return max_kbps, max_burst_kbit
|
||||
|
||||
def delete_ingress_bw_limit_for_port(self, port_name):
|
||||
|
|
|
@ -39,7 +39,6 @@ from neutron.agent.linux import dhcp
|
|||
from neutron.agent.linux import external_process
|
||||
from neutron.agent.metadata import driver as metadata_driver
|
||||
from neutron.agent import rpc as agent_rpc
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron import manager
|
||||
|
||||
|
@ -714,7 +713,7 @@ class DhcpPluginApi(object):
|
|||
self.host = host
|
||||
target = oslo_messaging.Target(
|
||||
topic=topic,
|
||||
namespace=n_const.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
version='1.0')
|
||||
self.client = n_rpc.get_client(target)
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ from neutron.agent.linux import pd
|
|||
from neutron.agent.linux import utils as linux_utils
|
||||
from neutron.agent.metadata import driver as metadata_driver
|
||||
from neutron.agent import rpc as agent_rpc
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils
|
||||
from neutron import manager
|
||||
|
@ -593,7 +592,7 @@ class L3NATAgent(ha.AgentMixin,
|
|||
# For HA routers check that DB state matches actual state
|
||||
if router.get('ha') and not is_dvr_only_agent and is_ha_router:
|
||||
self.check_ha_state_for_router(
|
||||
router['id'], router.get(l3_constants.HA_ROUTER_STATE_KEY))
|
||||
router['id'], router.get(lib_const.HA_ROUTER_STATE_KEY))
|
||||
ri.router = router
|
||||
registry.notify(resources.ROUTER, events.BEFORE_UPDATE,
|
||||
self, router=ri)
|
||||
|
|
|
@ -29,7 +29,6 @@ from neutron.agent.l3 import namespaces
|
|||
from neutron.agent.l3 import router_info
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.ipam import utils as ipam_utils
|
||||
|
||||
|
@ -70,7 +69,7 @@ class FipNamespace(namespaces.Namespace):
|
|||
use_ipv6=self.use_ipv6)
|
||||
path = os.path.join(agent_conf.state_path, 'fip-linklocal-networks')
|
||||
self.local_subnets = lla.LinkLocalAllocator(
|
||||
path, constants.DVR_FIP_LL_CIDR)
|
||||
path, lib_constants.DVR_FIP_LL_CIDR)
|
||||
self.destroyed = False
|
||||
self._stale_fips_checked = False
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import six
|
|||
from neutron.agent.l3 import dvr_fip_ns
|
||||
from neutron.agent.l3 import dvr_router_base
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils as common_utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -475,7 +474,8 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
|
|||
|
||||
def get_floating_agent_gw_interface(self, ext_net_id):
|
||||
"""Filter Floating Agent GW port for the external network."""
|
||||
fip_ports = self.router.get(n_const.FLOATINGIP_AGENT_INTF_KEY, [])
|
||||
fip_ports = self.router.get(
|
||||
lib_constants.FLOATINGIP_AGENT_INTF_KEY, [])
|
||||
return next(
|
||||
(p for p in fip_ports if p['network_id'] == ext_net_id), None)
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.agent.l3 import router_info as router
|
||||
from neutron.common import constants as l3_constants
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -31,7 +31,7 @@ class DvrRouterBase(router.RouterInfo):
|
|||
self.snat_ports = self.get_snat_interfaces()
|
||||
|
||||
def get_snat_interfaces(self):
|
||||
return self.router.get(l3_constants.SNAT_ROUTER_INTF_KEY, [])
|
||||
return self.router.get(constants.SNAT_ROUTER_INTF_KEY, [])
|
||||
|
||||
def get_snat_port_for_internal_port(self, int_port, snat_ports=None):
|
||||
"""Return the SNAT port for the given internal interface port."""
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
import collections
|
||||
|
||||
import netaddr
|
||||
from neutron_lib.agent import l3_extension
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import rpc as n_rpc
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_log import log as logging
|
||||
|
@ -25,9 +27,7 @@ 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_lib.agent import l3_extension
|
||||
from neutron_lib import constants as lib_consts
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
DEFAULT_PORT_FORWARDING_CHAIN = 'fip-pf'
|
||||
|
@ -174,7 +174,7 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
|
|||
device = ip_lib.IPDevice(interface_name, namespace=namespace)
|
||||
|
||||
is_distributed = ri.router.get('distributed')
|
||||
ha_port = ri.router.get(lib_consts.HA_INTERFACE_KEY, None)
|
||||
ha_port = ri.router.get(constants.HA_INTERFACE_KEY, None)
|
||||
fip_statuses = {}
|
||||
for port_forwarding in port_forwardings:
|
||||
# check if the port forwarding is managed in this agent from
|
||||
|
@ -202,10 +202,10 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
|
|||
fip_ip)
|
||||
else:
|
||||
ri._add_vip(fip_cidr, interface_name)
|
||||
status = lib_consts.FLOATINGIP_STATUS_ACTIVE
|
||||
status = constants.FLOATINGIP_STATUS_ACTIVE
|
||||
except Exception:
|
||||
# Any error will causes the fip status to be set 'ERROR'
|
||||
status = lib_consts.FLOATINGIP_STATUS_ERROR
|
||||
status = constants.FLOATINGIP_STATUS_ERROR
|
||||
LOG.warning("Unable to configure floating IP %(fip_id)s "
|
||||
"for port forwarding %(pf_id)s",
|
||||
{'fip_id': port_forwarding.floatingip_id,
|
||||
|
@ -218,7 +218,7 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
|
|||
if status:
|
||||
fip_statuses[port_forwarding.floatingip_id] = status
|
||||
|
||||
if ha_port and ha_port['status'] == lib_consts.PORT_STATUS_ACTIVE:
|
||||
if ha_port and ha_port['status'] == constants.PORT_STATUS_ACTIVE:
|
||||
ri.enable_keepalived()
|
||||
|
||||
for port_forwarding in port_forwardings:
|
||||
|
@ -266,8 +266,8 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
|
|||
is_distributed = ri.router.get('distributed')
|
||||
agent_mode = ri.agent_conf.agent_mode
|
||||
if (is_distributed and
|
||||
agent_mode in [lib_consts.L3_AGENT_MODE_DVR_NO_EXTERNAL,
|
||||
lib_consts.L3_AGENT_MODE_DVR]):
|
||||
agent_mode in [constants.L3_AGENT_MODE_DVR_NO_EXTERNAL,
|
||||
constants.L3_AGENT_MODE_DVR]):
|
||||
# just support centralized cases
|
||||
return False
|
||||
return True
|
||||
|
@ -343,7 +343,7 @@ class PortForwardingAgentExtension(l3_extension.L3AgentExtension):
|
|||
def _sync_and_remove_fip(self, context, fip_id_cidrs, device, ri):
|
||||
if not fip_id_cidrs:
|
||||
return
|
||||
ha_port = ri.router.get(lib_consts.HA_INTERFACE_KEY)
|
||||
ha_port = ri.router.get(constants.HA_INTERFACE_KEY)
|
||||
fip_ids = [item[0] for item in fip_id_cidrs]
|
||||
pfs = self.resource_rpc.bulk_pull(context, resources.PORTFORWARDING,
|
||||
filter_kwargs={
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
import os
|
||||
|
||||
import eventlet
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import fileutils
|
||||
import webob
|
||||
|
||||
from neutron.agent.linux import utils as agent_utils
|
||||
from neutron.common import constants
|
||||
from neutron.notifiers import batch_notifier
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -27,7 +27,6 @@ from neutron.agent.l3 import router_info as router
|
|||
from neutron.agent.linux import external_process
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import keepalived
|
||||
from neutron.common import constants as const
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.extensions import revisions
|
||||
from neutron.extensions import timestamp
|
||||
|
@ -294,11 +293,12 @@ class HaRouter(router.RouterInfo):
|
|||
|
||||
if self._should_delete_ipv6_lladdr(ipv6_lladdr):
|
||||
self.driver.configure_ipv6_ra(self.ha_namespace, interface_name,
|
||||
const.ACCEPT_RA_DISABLED)
|
||||
n_consts.ACCEPT_RA_DISABLED)
|
||||
device.addr.flush(n_consts.IP_VERSION_6)
|
||||
else:
|
||||
self.driver.configure_ipv6_ra(self.ha_namespace, interface_name,
|
||||
const.ACCEPT_RA_WITHOUT_FORWARDING)
|
||||
self.driver.configure_ipv6_ra(
|
||||
self.ha_namespace, interface_name,
|
||||
n_consts.ACCEPT_RA_WITHOUT_FORWARDING)
|
||||
|
||||
self._remove_vip(ipv6_lladdr)
|
||||
self._add_vip(ipv6_lladdr, interface_name, scope='link')
|
||||
|
|
|
@ -25,7 +25,6 @@ from neutron.agent.l3 import namespaces
|
|||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.agent.linux import ra
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.ipam import utils as ipam_utils
|
||||
|
@ -705,13 +704,14 @@ class RouterInfo(object):
|
|||
if not self.is_v6_gateway_set(gateway_ips):
|
||||
# There is no IPv6 gw_ip, use RouterAdvt for default route.
|
||||
self.driver.configure_ipv6_ra(
|
||||
ns_name, interface_name, n_const.ACCEPT_RA_WITH_FORWARDING)
|
||||
ns_name, interface_name,
|
||||
lib_constants.ACCEPT_RA_WITH_FORWARDING)
|
||||
else:
|
||||
# Otherwise, disable it
|
||||
disable_ra = True
|
||||
if disable_ra:
|
||||
self.driver.configure_ipv6_ra(ns_name, interface_name,
|
||||
n_const.ACCEPT_RA_DISABLED)
|
||||
lib_constants.ACCEPT_RA_DISABLED)
|
||||
self.driver.configure_ipv6_forwarding(ns_name, interface_name, enabled)
|
||||
# This will make sure the 'all' setting is the same as the interface,
|
||||
# which is needed for forwarding to work. Don't disable once it's
|
||||
|
@ -858,7 +858,7 @@ class RouterInfo(object):
|
|||
'snat', '-m mark ! --mark %s/%s '
|
||||
'-m conntrack --ctstate DNAT '
|
||||
'-j SNAT --to-source %s'
|
||||
% (ext_in_mark, n_const.ROUTER_MARK_MASK, ex_gw_ip))
|
||||
% (ext_in_mark, lib_constants.ROUTER_MARK_MASK, ex_gw_ip))
|
||||
return [dont_snat_traffic_to_internal_ports_if_not_to_floating_ip,
|
||||
snat_internal_traffic_to_floating_ip]
|
||||
|
||||
|
@ -872,7 +872,7 @@ class RouterInfo(object):
|
|||
mark = self.agent_conf.external_ingress_mark
|
||||
mark_packets_entering_external_gateway_port = (
|
||||
'mark', '-i %s -j MARK --set-xmark %s/%s' %
|
||||
(interface_name, mark, n_const.ROUTER_MARK_MASK))
|
||||
(interface_name, mark, lib_constants.ROUTER_MARK_MASK))
|
||||
return [mark_packets_entering_external_gateway_port]
|
||||
|
||||
def _empty_snat_chains(self, iptables_manager):
|
||||
|
@ -1035,7 +1035,7 @@ class RouterInfo(object):
|
|||
'-j MARK --set-xmark %(value)s/%(mask)s' %
|
||||
{'interface_name': INTERNAL_DEV_PREFIX + '+',
|
||||
'value': self.agent_conf.metadata_access_mark,
|
||||
'mask': n_const.ROUTER_MARK_MASK})
|
||||
'mask': lib_constants.ROUTER_MARK_MASK})
|
||||
self.iptables_manager.ipv4['mangle'].add_rule(
|
||||
'PREROUTING', mark_metadata_for_internal_interfaces)
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ from neutron.agent.linux import external_process
|
|||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.cmd import runtime_checks as checks
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.ipam import utils as ipam_utils
|
||||
|
@ -1517,7 +1516,7 @@ class DeviceManager(object):
|
|||
root_namespace=True)
|
||||
if ipv6_utils.is_enabled_and_bind_by_default():
|
||||
self.driver.configure_ipv6_ra(network.namespace, 'default',
|
||||
n_const.ACCEPT_RA_DISABLED)
|
||||
constants.ACCEPT_RA_DISABLED)
|
||||
|
||||
if ip_lib.ensure_device_is_ready(interface_name,
|
||||
namespace=network.namespace):
|
||||
|
|
|
@ -25,7 +25,6 @@ import six
|
|||
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -39,7 +38,7 @@ def _get_veth(name1, name2, namespace2):
|
|||
@six.add_metaclass(abc.ABCMeta)
|
||||
class LinuxInterfaceDriver(object):
|
||||
|
||||
DEV_NAME_LEN = n_const.LINUX_DEV_LEN
|
||||
DEV_NAME_LEN = constants.LINUX_DEV_LEN
|
||||
DEV_NAME_PREFIX = constants.TAP_DEVICE_PREFIX
|
||||
|
||||
def __init__(self, conf):
|
||||
|
|
|
@ -15,12 +15,12 @@ import re
|
|||
|
||||
import eventlet
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron.agent.linux import utils as linux_utils
|
||||
from neutron.common import constants as n_const
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
CONTRACK_MGRS = {}
|
||||
|
@ -186,7 +186,7 @@ class IpConntrackManager(object):
|
|||
if match:
|
||||
# strip off any prefix that the interface is using
|
||||
short_port_id = (
|
||||
match.group('dev')[n_const.LINUX_DEV_PREFIX_LEN:])
|
||||
match.group('dev')[constants.LINUX_DEV_PREFIX_LEN:])
|
||||
self._device_zone_map[short_port_id] = int(match.group('zone'))
|
||||
LOG.debug("Populated conntrack zone map: %s", self._device_zone_map)
|
||||
|
||||
|
@ -196,11 +196,11 @@ class IpConntrackManager(object):
|
|||
# map is populated strictly based on interface names that we don't know
|
||||
# the full UUID of.
|
||||
if self.zone_per_port:
|
||||
identifier = port['device'][n_const.LINUX_DEV_PREFIX_LEN:]
|
||||
identifier = port['device'][constants.LINUX_DEV_PREFIX_LEN:]
|
||||
else:
|
||||
identifier = port['network_id']
|
||||
return identifier[:(n_const.LINUX_DEV_LEN -
|
||||
n_const.LINUX_DEV_PREFIX_LEN)]
|
||||
return identifier[:(constants.LINUX_DEV_LEN -
|
||||
constants.LINUX_DEV_PREFIX_LEN)]
|
||||
|
||||
def get_device_zone(self, port, create=True):
|
||||
device_key = self._device_key(port)
|
||||
|
|
|
@ -31,7 +31,6 @@ from neutron.agent.linux import ipset_manager
|
|||
from neutron.agent.linux import iptables_comments as ic
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.common import _constants as const
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils as c_utils
|
||||
|
||||
|
@ -49,7 +48,7 @@ libc = ctypes.CDLL(util.find_library('libc.so.6'))
|
|||
|
||||
|
||||
def get_hybrid_port_name(port_name):
|
||||
return (constants.TAP_DEVICE_PREFIX + port_name)[:n_const.LINUX_DEV_LEN]
|
||||
return (constants.TAP_DEVICE_PREFIX + port_name)[:constants.LINUX_DEV_LEN]
|
||||
|
||||
|
||||
class mac_iptables(netaddr.mac_eui48):
|
||||
|
@ -356,7 +355,7 @@ class IptablesFirewallDriver(firewall.FirewallDriver):
|
|||
comment=ic.INPUT_TO_SG)
|
||||
|
||||
def _get_br_device_name(self, port):
|
||||
return ('brq' + port['network_id'])[:n_const.LINUX_DEV_LEN]
|
||||
return ('brq' + port['network_id'])[:constants.LINUX_DEV_LEN]
|
||||
|
||||
def _get_jump_rules(self, port, create=True):
|
||||
zone = self.ipconntrack.get_device_zone(port, create=create)
|
||||
|
@ -696,7 +695,7 @@ class IptablesFirewallDriver(firewall.FirewallDriver):
|
|||
|
||||
def _protocol_name_map(self):
|
||||
if not self._iptables_protocol_name_map:
|
||||
tmp_map = n_const.IPTABLES_PROTOCOL_NAME_MAP.copy()
|
||||
tmp_map = constants.IPTABLES_PROTOCOL_NAME_MAP.copy()
|
||||
tmp_map.update(self._local_protocol_name_map())
|
||||
self._iptables_protocol_name_map = tmp_map
|
||||
return self._iptables_protocol_name_map
|
||||
|
@ -948,7 +947,7 @@ class OVSHybridIptablesFirewallDriver(IptablesFirewallDriver):
|
|||
'%s%s' % (CHAIN_NAME_PREFIX[direction], port['device']))
|
||||
|
||||
def _get_br_device_name(self, port):
|
||||
return ('qvb' + port['device'])[:n_const.LINUX_DEV_LEN]
|
||||
return ('qvb' + port['device'])[:constants.LINUX_DEV_LEN]
|
||||
|
||||
def _get_device_name(self, port):
|
||||
device_name = super(
|
||||
|
|
|
@ -25,6 +25,7 @@ import os
|
|||
import re
|
||||
import sys
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from neutron_lib.exceptions import l3 as l3_exc
|
||||
from neutron_lib.utils import runtime
|
||||
|
@ -37,7 +38,6 @@ from neutron._i18n import _
|
|||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import iptables_comments as ic
|
||||
from neutron.agent.linux import utils as linux_utils
|
||||
from neutron.common import constants
|
||||
from neutron.conf.agent import common as config
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -17,6 +17,7 @@ import itertools
|
|||
import os
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from neutron_lib.utils import file as file_utils
|
||||
from oslo_config import cfg
|
||||
|
@ -25,7 +26,6 @@ from oslo_utils import fileutils
|
|||
|
||||
from neutron._i18n import _
|
||||
from neutron.agent.linux import external_process
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils
|
||||
|
||||
VALID_STATES = ['MASTER', 'BACKUP']
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
|
||||
OF_STATE_NOT_TRACKED = "-trk"
|
||||
OF_STATE_TRACKED = "+trk"
|
||||
|
@ -47,6 +46,6 @@ REVERSE_IP_PROTOCOL_MAP_WITH_PORTS = {
|
|||
PROTOCOLS_WITH_PORTS}
|
||||
|
||||
ethertype_to_dl_type_map = {
|
||||
constants.IPv4: n_const.ETHERTYPE_IP,
|
||||
constants.IPv6: n_const.ETHERTYPE_IPV6,
|
||||
constants.IPv4: constants.ETHERTYPE_IP,
|
||||
constants.IPv6: constants.ETHERTYPE_IPV6,
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ from neutron.agent.linux.openvswitch_firewall import constants as ovsfw_consts
|
|||
from neutron.agent.linux.openvswitch_firewall import exceptions
|
||||
from neutron.agent.linux.openvswitch_firewall import iptables
|
||||
from neutron.agent.linux.openvswitch_firewall import rules
|
||||
from neutron.common import constants
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants \
|
||||
as ovs_consts
|
||||
|
||||
|
@ -732,7 +731,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
priority=95,
|
||||
in_port=port.ofport,
|
||||
reg_port=port.ofport,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
dl_type=lib_const.ETHERTYPE_IPV6,
|
||||
nw_proto=lib_const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=icmp_type,
|
||||
actions='resubmit(,%d)' % (
|
||||
|
@ -804,7 +803,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
in_port=port.ofport,
|
||||
reg_port=port.ofport,
|
||||
dl_src=mac_addr,
|
||||
dl_type=constants.ETHERTYPE_ARP,
|
||||
dl_type=lib_const.ETHERTYPE_ARP,
|
||||
arp_spa=ip_addr,
|
||||
actions='resubmit(,%d)' % (
|
||||
ovs_consts.ACCEPTED_EGRESS_TRAFFIC_NORMAL_TABLE)
|
||||
|
@ -813,7 +812,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
table=ovs_consts.BASE_EGRESS_TABLE,
|
||||
priority=65,
|
||||
reg_port=port.ofport,
|
||||
dl_type=constants.ETHERTYPE_IP,
|
||||
dl_type=lib_const.ETHERTYPE_IP,
|
||||
in_port=port.ofport,
|
||||
dl_src=mac_addr,
|
||||
nw_src=ip_addr,
|
||||
|
@ -831,7 +830,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
priority=65,
|
||||
reg_port=port.ofport,
|
||||
in_port=port.ofport,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
dl_type=lib_const.ETHERTYPE_IPV6,
|
||||
dl_src=mac_addr,
|
||||
ipv6_src=ip_addr,
|
||||
actions='ct(table={:d},zone=NXM_NX_REG{:d}[0..15])'.format(
|
||||
|
@ -841,8 +840,8 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
|
||||
# DHCP discovery
|
||||
for dl_type, src_port, dst_port in (
|
||||
(constants.ETHERTYPE_IP, 68, 67),
|
||||
(constants.ETHERTYPE_IPV6, 546, 547)):
|
||||
(lib_const.ETHERTYPE_IP, 68, 67),
|
||||
(lib_const.ETHERTYPE_IPV6, 546, 547)):
|
||||
self._add_flow(
|
||||
table=ovs_consts.BASE_EGRESS_TABLE,
|
||||
priority=80,
|
||||
|
@ -857,8 +856,8 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
)
|
||||
# Ban dhcp service running on an instance
|
||||
for dl_type, src_port, dst_port in (
|
||||
(constants.ETHERTYPE_IP, 67, 68),
|
||||
(constants.ETHERTYPE_IPV6, 547, 546)):
|
||||
(lib_const.ETHERTYPE_IP, 67, 68),
|
||||
(lib_const.ETHERTYPE_IPV6, 547, 546)):
|
||||
self._add_flow(
|
||||
table=ovs_consts.BASE_EGRESS_TABLE,
|
||||
priority=70,
|
||||
|
@ -877,7 +876,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
priority=70,
|
||||
in_port=port.ofport,
|
||||
reg_port=port.ofport,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
dl_type=lib_const.ETHERTYPE_IPV6,
|
||||
nw_proto=lib_const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=lib_const.ICMPV6_TYPE_RA,
|
||||
actions='resubmit(,%d)' % ovs_consts.DROPPED_TRAFFIC_TABLE
|
||||
|
@ -906,7 +905,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
ovsfw_consts.REG_PORT,
|
||||
ovs_consts.BASE_INGRESS_TABLE),
|
||||
)
|
||||
for ethertype in [constants.ETHERTYPE_IP, constants.ETHERTYPE_IPV6]:
|
||||
for ethertype in [lib_const.ETHERTYPE_IP, lib_const.ETHERTYPE_IPV6]:
|
||||
self._add_flow(
|
||||
table=ovs_consts.ACCEPT_OR_INGRESS_TABLE,
|
||||
priority=90,
|
||||
|
@ -964,7 +963,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
ct_state=ovsfw_consts.OF_STATE_NOT_ESTABLISHED,
|
||||
actions='resubmit(,%d)' % ovs_consts.DROPPED_TRAFFIC_TABLE
|
||||
)
|
||||
for ethertype in [constants.ETHERTYPE_IP, constants.ETHERTYPE_IPV6]:
|
||||
for ethertype in [lib_const.ETHERTYPE_IP, lib_const.ETHERTYPE_IPV6]:
|
||||
self._add_flow(
|
||||
table=ovs_consts.RULES_EGRESS_TABLE,
|
||||
priority=40,
|
||||
|
@ -983,7 +982,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
table=ovs_consts.BASE_INGRESS_TABLE,
|
||||
priority=100,
|
||||
reg_port=port.ofport,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
dl_type=lib_const.ETHERTYPE_IPV6,
|
||||
nw_proto=lib_const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=icmp_type,
|
||||
actions='output:{:d}'.format(port.ofport)
|
||||
|
@ -994,7 +993,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
self._add_flow(
|
||||
table=ovs_consts.BASE_INGRESS_TABLE,
|
||||
priority=100,
|
||||
dl_type=constants.ETHERTYPE_ARP,
|
||||
dl_type=lib_const.ETHERTYPE_ARP,
|
||||
reg_port=port.ofport,
|
||||
actions='output:{:d}'.format(port.ofport)
|
||||
)
|
||||
|
@ -1002,8 +1001,8 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
|
||||
# DHCP offers
|
||||
for dl_type, src_port, dst_port in (
|
||||
(constants.ETHERTYPE_IP, 67, 68),
|
||||
(constants.ETHERTYPE_IPV6, 547, 546)):
|
||||
(lib_const.ETHERTYPE_IP, 67, 68),
|
||||
(lib_const.ETHERTYPE_IPV6, 547, 546)):
|
||||
self._add_flow(
|
||||
table=ovs_consts.BASE_INGRESS_TABLE,
|
||||
priority=95,
|
||||
|
@ -1016,7 +1015,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
)
|
||||
|
||||
# Track untracked
|
||||
for dl_type in (constants.ETHERTYPE_IP, constants.ETHERTYPE_IPV6):
|
||||
for dl_type in (lib_const.ETHERTYPE_IP, lib_const.ETHERTYPE_IPV6):
|
||||
self._add_flow(
|
||||
table=ovs_consts.BASE_INGRESS_TABLE,
|
||||
priority=90,
|
||||
|
@ -1071,7 +1070,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
|||
ct_state=ovsfw_consts.OF_STATE_NOT_ESTABLISHED,
|
||||
actions='resubmit(,%d)' % ovs_consts.DROPPED_TRAFFIC_TABLE
|
||||
)
|
||||
for ethertype in [constants.ETHERTYPE_IP, constants.ETHERTYPE_IPV6]:
|
||||
for ethertype in [lib_const.ETHERTYPE_IP, lib_const.ETHERTYPE_IPV6]:
|
||||
self._add_flow(
|
||||
table=ovs_consts.RULES_INGRESS_TABLE,
|
||||
priority=40,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron_lib import constants as n_const
|
||||
|
||||
|
||||
def get_device_port_name(port_id):
|
||||
|
|
|
@ -27,7 +27,6 @@ from oslo_utils import netutils
|
|||
import six
|
||||
from stevedore import driver
|
||||
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -244,7 +243,7 @@ class PrefixDelegation(object):
|
|||
gw_ifname,
|
||||
ns_name,
|
||||
lla_with_mask),
|
||||
timeout=l3_constants.LLA_TASK_TIMEOUT,
|
||||
timeout=n_const.LLA_TASK_TIMEOUT,
|
||||
sleep=2)
|
||||
|
||||
def _lla_available(self, gw_ifname, ns_name, lla_with_mask):
|
||||
|
|
|
@ -27,7 +27,6 @@ import six
|
|||
|
||||
from neutron.agent.linux import external_process
|
||||
from neutron.agent.linux import utils
|
||||
from neutron.common import constants as n_const
|
||||
|
||||
RADVD_SERVICE_NAME = 'radvd'
|
||||
RADVD_SERVICE_CMD = 'radvd'
|
||||
|
@ -43,7 +42,7 @@ CONFIG_TEMPLATE = jinja2.Template("""interface {{ interface_name }}
|
|||
MinRtrAdvInterval {{ min_rtr_adv_interval }};
|
||||
MaxRtrAdvInterval {{ max_rtr_adv_interval }};
|
||||
|
||||
{% if network_mtu >= n_const.IPV6_MIN_MTU %}
|
||||
{% if network_mtu >= constants.IPV6_MIN_MTU %}
|
||||
AdvLinkMTU {{network_mtu}};
|
||||
{% endif %}
|
||||
|
||||
|
@ -128,7 +127,7 @@ class DaemonMonitor(object):
|
|||
auto_config_prefixes=auto_config_prefixes,
|
||||
stateful_config_prefixes=stateful_config_prefixes,
|
||||
dns_servers=dns_servers[0:MAX_RDNSS_ENTRIES],
|
||||
n_const=n_const,
|
||||
n_const=constants,
|
||||
constants=constants,
|
||||
min_rtr_adv_interval=self._agent_conf.min_rtr_adv_interval,
|
||||
max_rtr_adv_interval=self._agent_conf.max_rtr_adv_interval,
|
||||
|
|
|
@ -33,7 +33,6 @@ from neutron._i18n import _
|
|||
from neutron.agent.linux import utils as agent_utils
|
||||
from neutron.agent import rpc as agent_rpc
|
||||
from neutron.common import cache_utils as cache
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.conf.agent.metadata import config
|
||||
|
||||
|
@ -63,7 +62,7 @@ class MetadataPluginAPI(object):
|
|||
def __init__(self, topic):
|
||||
target = oslo_messaging.Target(
|
||||
topic=topic,
|
||||
namespace=n_const.RPC_NAMESPACE_METADATA,
|
||||
namespace=constants.RPC_NAMESPACE_METADATA,
|
||||
version='1.0')
|
||||
self.client = n_rpc.get_client(target)
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import pwd
|
|||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
from neutron_lib.callbacks import resources
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
@ -29,7 +30,6 @@ from neutron._i18n import _
|
|||
from neutron.agent.l3 import ha_router
|
||||
from neutron.agent.l3 import namespaces
|
||||
from neutron.agent.linux import external_process
|
||||
from neutron.common import constants
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -31,7 +31,7 @@ from oslo_utils import uuidutils
|
|||
|
||||
from neutron.agent import resource_cache
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import _constants as n_const
|
||||
from neutron import objects
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -78,7 +78,7 @@ class PluginReportStateAPI(object):
|
|||
"""
|
||||
def __init__(self, topic):
|
||||
target = oslo_messaging.Target(topic=topic, version='1.2',
|
||||
namespace=n_const.RPC_NAMESPACE_STATE)
|
||||
namespace=constants.RPC_NAMESPACE_STATE)
|
||||
self.client = lib_rpc.get_client(target)
|
||||
|
||||
def has_alive_neutron_server(self, context, **kwargs):
|
||||
|
@ -321,7 +321,7 @@ class CacheBackedPluginApi(PluginApi):
|
|||
LOG.debug("Device %s has no active binding in this host",
|
||||
port_obj)
|
||||
return {'device': device,
|
||||
n_const.NO_ACTIVE_BINDING: True}
|
||||
constants.NO_ACTIVE_BINDING: True}
|
||||
net = self.remote_resource_cache.get_resource_by_id(
|
||||
resources.NETWORK, port_obj.network_id)
|
||||
net_qos_policy_id = net.qos_policy_id
|
||||
|
|
|
@ -22,7 +22,7 @@ from oslo_log import log as logging
|
|||
import oslo_messaging
|
||||
|
||||
from neutron.agent import firewall
|
||||
from neutron.common import constants as common_constants
|
||||
from neutron.common import _constants as common_constants
|
||||
from neutron.conf.agent import securitygroups_rpc as sc_cfg
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
import functools
|
||||
|
||||
from neutron_lib.api import attributes
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
|
@ -27,7 +28,6 @@ from webob import exc
|
|||
|
||||
from neutron._i18n import _
|
||||
from neutron.api import extensions
|
||||
from neutron.common import constants
|
||||
from neutron import wsgi
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import oslo_messaging
|
|||
from oslo_utils import excutils
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron.db import provisioning_blocks
|
||||
from neutron.extensions import segment as segment_ext
|
||||
|
@ -73,7 +72,7 @@ class DhcpRpcCallback(object):
|
|||
# the major version as above applies here too.
|
||||
|
||||
target = oslo_messaging.Target(
|
||||
namespace=n_const.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
version='1.6')
|
||||
|
||||
def _get_active_networks(self, context, **kwargs):
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
# under the License.
|
||||
|
||||
from neutron_lib.agent import topics
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib import rpc as n_rpc
|
||||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron.common import constants
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -150,7 +148,7 @@ class L3RpcCallback(object):
|
|||
gw_port_host,
|
||||
router.get('gw_port'),
|
||||
router['id'])
|
||||
for p in router.get(n_const.SNAT_ROUTER_INTF_KEY, []):
|
||||
for p in router.get(constants.SNAT_ROUTER_INTF_KEY, []):
|
||||
self._ensure_host_set_on_port(
|
||||
context, gw_port_host, p, router['id'],
|
||||
ha_router_port=router.get('ha'))
|
||||
|
|
|
@ -13,11 +13,10 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.plugins import directory
|
||||
import oslo_messaging
|
||||
|
||||
from neutron.common import constants
|
||||
|
||||
|
||||
class MetadataRpcCallback(object):
|
||||
"""Metadata agent RPC callback in plugin implementations.
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
import collections
|
||||
|
||||
from neutron_lib.agent import topics
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from neutron_lib import rpc as n_rpc
|
||||
from oslo_log import helpers as log_helpers
|
||||
|
@ -28,7 +29,6 @@ from neutron.api.rpc.callbacks import exceptions as rpc_exc
|
|||
from neutron.api.rpc.callbacks.producer import registry as prod_registry
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.api.rpc.callbacks import version_manager
|
||||
from neutron.common import constants
|
||||
from neutron.objects import base as obj_base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -17,6 +17,7 @@ import collections
|
|||
from neutron_lib.agent import topics
|
||||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib import rpc as n_rpc
|
||||
from neutron_lib.utils import net
|
||||
|
@ -24,7 +25,6 @@ from oslo_log import log as logging
|
|||
import oslo_messaging
|
||||
|
||||
from neutron.api.rpc.handlers import resources_rpc
|
||||
from neutron.common import constants
|
||||
from neutron.db import securitygroups_rpc_base as sg_rpc_base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -20,6 +20,7 @@ from neutron_lib.api import attributes
|
|||
from neutron_lib.api import faults
|
||||
from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import api as db_api
|
||||
from neutron_lib import exceptions
|
||||
from neutron_lib import rpc as n_rpc
|
||||
|
@ -32,7 +33,6 @@ import webob.exc
|
|||
from neutron._i18n import _
|
||||
from neutron.api import api_common
|
||||
from neutron.api.v2 import resource as wsgi_resource
|
||||
from neutron.common import constants as n_const
|
||||
from neutron import policy
|
||||
from neutron import quota
|
||||
from neutron.quota import resource_registry
|
||||
|
@ -652,7 +652,7 @@ class Controller(object):
|
|||
# Make a list of attributes to be updated to inform the policy engine
|
||||
# which attributes are set explicitly so that it can distinguish them
|
||||
# from the ones that are set to their default values.
|
||||
orig_obj[n_const.ATTRIBUTES_TO_UPDATE] = body[self._resource].keys()
|
||||
orig_obj[constants.ATTRIBUTES_TO_UPDATE] = body[self._resource].keys()
|
||||
# Then get the ext_parent_id, format to ext_parent_parent_resource_id
|
||||
if self._parent_id_name in orig_obj:
|
||||
self._set_parent_id_into_ext_resources_request(
|
||||
|
@ -798,13 +798,13 @@ class Controller(object):
|
|||
self.parent['member_name'] in
|
||||
service_const.EXT_PARENT_RESOURCE_MAPPING):
|
||||
resource_item.setdefault(
|
||||
"%s_%s" % (n_const.EXT_PARENT_PREFIX,
|
||||
"%s_%s" % (constants.EXT_PARENT_PREFIX,
|
||||
self._parent_id_name),
|
||||
parent_id)
|
||||
# If this func is called by create/update/delete, we just add.
|
||||
else:
|
||||
resource_item.setdefault(
|
||||
"%s_%s" % (n_const.EXT_PARENT_PREFIX, self._parent_id_name),
|
||||
"%s_%s" % (constants.EXT_PARENT_PREFIX, self._parent_id_name),
|
||||
parent_id)
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ from neutron.agent.linux import ip_link_support
|
|||
from neutron.agent.linux import keepalived
|
||||
from neutron.agent.linux import utils as agent_utils
|
||||
from neutron.cmd import runtime_checks
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
|
||||
import constants as ovs_const
|
||||
|
@ -137,7 +136,7 @@ def icmpv6_header_match_supported():
|
|||
return ofctl_arg_supported(cmd='add-flow',
|
||||
table=ovs_const.ARP_SPOOF_TABLE,
|
||||
priority=1,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
dl_type=n_consts.ETHERTYPE_IPV6,
|
||||
nw_proto=n_consts.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=n_consts.ICMPV6_TYPE_NA,
|
||||
nd_target='fdf8:f53b:82e4::10',
|
||||
|
|
|
@ -40,3 +40,19 @@ SG_PORT_PROTO_NAMES = [
|
|||
IPTABLES_MULTIPORT_ONLY_PROTOCOLS = [
|
||||
constants.PROTO_NAME_UDPLITE
|
||||
]
|
||||
|
||||
# Number of resources for neutron agent side functions to deal
|
||||
# with large sets.
|
||||
# Setting this value does not count on special conditions, it is just a human
|
||||
# countable or scalable number. [1] gives us the method to test the scale
|
||||
# issue. And we have tested the value of 1000, 500, 200, 100. But for 100,
|
||||
# ovs-agent will have a lower timeout probability. And according to the
|
||||
# testing result, step size 100 can indeed cost about 10% much more time
|
||||
# than 500/1000. But such extra time looks inevitably needed to be sacrificed
|
||||
# for the restart success rate.
|
||||
# [1] http://paste.openstack.org/show/745685/
|
||||
AGENT_RES_PROCESSING_STEP = 100
|
||||
|
||||
# Number of resources for neutron to divide the large RPC
|
||||
# call data sets.
|
||||
RPC_RES_PROCESSING_STEP = 20
|
||||
|
|
|
@ -1,257 +0,0 @@
|
|||
# Copyright (c) 2012 OpenStack Foundation.
|
||||
#
|
||||
# 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 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_ALLOCATING = 'ALLOCATING'
|
||||
ROUTER_STATUS_ERROR = 'ERROR'
|
||||
|
||||
VALID_ROUTER_STATUS = (ROUTER_STATUS_ACTIVE,
|
||||
ROUTER_STATUS_ALLOCATING,
|
||||
ROUTER_STATUS_ERROR)
|
||||
|
||||
HA_ROUTER_STATE_KEY = '_ha_state'
|
||||
METERING_LABEL_KEY = '_metering_labels'
|
||||
FLOATINGIP_AGENT_INTF_KEY = '_floatingip_agent_interfaces'
|
||||
SNAT_ROUTER_INTF_KEY = '_snat_router_interfaces'
|
||||
|
||||
HA_NETWORK_NAME = 'HA network tenant %s'
|
||||
HA_SUBNET_NAME = 'HA subnet tenant %s'
|
||||
HA_PORT_NAME = 'HA port tenant %s'
|
||||
HA_ROUTER_STATE_ACTIVE = 'active'
|
||||
HA_ROUTER_STATE_STANDBY = 'standby'
|
||||
HA_ROUTER_STATE_UNKNOWN = 'unknown'
|
||||
VALID_HA_STATES = (HA_ROUTER_STATE_ACTIVE, HA_ROUTER_STATE_STANDBY,
|
||||
HA_ROUTER_STATE_UNKNOWN)
|
||||
|
||||
PAGINATION_INFINITE = 'infinite'
|
||||
|
||||
SORT_DIRECTION_ASC = 'asc'
|
||||
SORT_DIRECTION_DESC = 'desc'
|
||||
|
||||
ETHERTYPE_NAME_ARP = 'arp'
|
||||
ETHERTYPE_ARP = 0x0806
|
||||
ETHERTYPE_IP = 0x0800
|
||||
ETHERTYPE_IPV6 = 0x86DD
|
||||
|
||||
IP_PROTOCOL_NAME_ALIASES = {lib_constants.PROTO_NAME_IPV6_ICMP_LEGACY:
|
||||
lib_constants.PROTO_NAME_IPV6_ICMP}
|
||||
|
||||
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}',
|
||||
# but sometimes those values are not identical. This is a map
|
||||
# of known protocol numbers that require a name to be used and
|
||||
# protocol names that require a different name to be used,
|
||||
# because that is how iptables-save will display them.
|
||||
#
|
||||
# This is how the list was created, so there is a possibility
|
||||
# it will need to be updated in the future:
|
||||
#
|
||||
# $ for num in {0..255}; do iptables -A INPUT -p $num; done
|
||||
# $ iptables-save
|
||||
#
|
||||
# These cases are special, and were found by inspection:
|
||||
# - 'ipv6-encap' uses 'ipv6'
|
||||
# - 'icmpv6' uses 'ipv6-icmp'
|
||||
# - 'pgm' uses '113' instead of its name
|
||||
# - protocol '0' uses no -p argument
|
||||
IPTABLES_PROTOCOL_NAME_MAP = {lib_constants.PROTO_NAME_IPV6_ENCAP: 'ipv6',
|
||||
lib_constants.PROTO_NAME_IPV6_ICMP_LEGACY:
|
||||
'ipv6-icmp',
|
||||
lib_constants.PROTO_NAME_PGM: '113',
|
||||
'0': None,
|
||||
'1': 'icmp',
|
||||
'2': 'igmp',
|
||||
'3': 'ggp',
|
||||
'4': 'ipencap',
|
||||
'5': 'st',
|
||||
'6': 'tcp',
|
||||
'8': 'egp',
|
||||
'9': 'igp',
|
||||
'12': 'pup',
|
||||
'17': 'udp',
|
||||
'20': 'hmp',
|
||||
'22': 'xns-idp',
|
||||
'27': 'rdp',
|
||||
'29': 'iso-tp4',
|
||||
'33': 'dccp',
|
||||
'36': 'xtp',
|
||||
'37': 'ddp',
|
||||
'38': 'idpr-cmtp',
|
||||
'41': 'ipv6',
|
||||
'43': 'ipv6-route',
|
||||
'44': 'ipv6-frag',
|
||||
'45': 'idrp',
|
||||