Use constants from neutron-lib
With this we enable the deprecation warnings by default. Related-Blueprint: neutron-lib Change-Id: I5b9e53751dd164010e5bbeb15f534ac0fe2a5105
This commit is contained in:
parent
cdb47fe53a
commit
4148a347b3
@ -17,6 +17,7 @@ import collections
|
||||
import os
|
||||
|
||||
import eventlet
|
||||
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,7 @@ 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
|
||||
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
|
||||
@ -428,7 +429,7 @@ class DhcpPluginApi(object):
|
||||
self.host = host
|
||||
target = oslo_messaging.Target(
|
||||
topic=topic,
|
||||
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
namespace=n_const.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
version='1.0')
|
||||
self.client = n_rpc.get_client(target)
|
||||
|
||||
@ -580,7 +581,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 == constants.AGENT_REVIVED:
|
||||
if agent_status == n_const.AGENT_REVIVED:
|
||||
LOG.info(_LI("Agent has just been revived. "
|
||||
"Scheduling full sync"))
|
||||
self.schedule_resync("Agent has just been revived")
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import eventlet
|
||||
import netaddr
|
||||
from neutron_lib import constants as lib_const
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -646,7 +647,7 @@ class L3NATAgentWithStateReport(L3NATAgent):
|
||||
'interface_driver': self.conf.interface_driver,
|
||||
'log_agent_heartbeats': self.conf.AGENT.log_agent_heartbeats},
|
||||
'start_flag': True,
|
||||
'agent_type': l3_constants.AGENT_TYPE_L3}
|
||||
'agent_type': lib_const.AGENT_TYPE_L3}
|
||||
report_interval = self.conf.AGENT.report_interval
|
||||
if report_interval:
|
||||
self.heartbeat = loopingcall.FixedIntervalLoopingCall(
|
||||
@ -663,9 +664,9 @@ class L3NATAgentWithStateReport(L3NATAgent):
|
||||
ex_gw_port = ri.get_ex_gw_port()
|
||||
if ex_gw_port:
|
||||
num_ex_gw_ports += 1
|
||||
num_interfaces += len(ri.router.get(l3_constants.INTERFACE_KEY,
|
||||
num_interfaces += len(ri.router.get(lib_const.INTERFACE_KEY,
|
||||
[]))
|
||||
num_floating_ips += len(ri.router.get(l3_constants.FLOATINGIP_KEY,
|
||||
num_floating_ips += len(ri.router.get(lib_const.FLOATINGIP_KEY,
|
||||
[]))
|
||||
configurations = self.agent_state['configurations']
|
||||
configurations['routers'] = num_routers
|
||||
|
@ -13,6 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.agent.l3.dvr_edge_router import DvrEdgeRouter
|
||||
from neutron.agent.l3 import dvr_snat_ns
|
||||
from neutron.agent.l3.ha_router import HaRouter
|
||||
@ -75,7 +77,7 @@ class DvrEdgeHaRouter(DvrEdgeRouter, HaRouter):
|
||||
snat_interface = self._get_snat_int_device_name(port['id'])
|
||||
self.driver.unplug(snat_interface,
|
||||
namespace=self.ha_namespace,
|
||||
prefix=l3_constants.SNAT_INT_DEV_PREFIX)
|
||||
prefix=constants.SNAT_INT_DEV_PREFIX)
|
||||
self._clear_vips(snat_interface)
|
||||
super(DvrEdgeHaRouter, self)._external_gateway_removed(
|
||||
ex_gw_port, interface_name)
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as l3_constants
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _LE
|
||||
@ -20,7 +21,6 @@ from neutron.agent.l3 import dvr_snat_ns
|
||||
from neutron.agent.l3 import router_info as router
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.common import constants as l3_constants
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -16,6 +16,7 @@ import binascii
|
||||
import collections
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as l3_constants
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
@ -24,7 +25,7 @@ from neutron._i18n import _LE, _LW
|
||||
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 l3_constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions
|
||||
from neutron.common import utils as common_utils
|
||||
|
||||
@ -347,7 +348,7 @@ 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(l3_constants.FLOATINGIP_AGENT_INTF_KEY, [])
|
||||
fip_ports = self.router.get(n_const.FLOATINGIP_AGENT_INTF_KEY, [])
|
||||
return next(
|
||||
(p for p in fip_ports if p['network_id'] == ext_net_id), None)
|
||||
|
||||
|
@ -16,6 +16,7 @@ import os
|
||||
import shutil
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as n_consts
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _LE
|
||||
@ -23,7 +24,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 n_consts
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.extensions import portbindings
|
||||
|
||||
|
@ -12,9 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as l3_constants
|
||||
|
||||
from neutron.agent.l3 import router_info as router
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import constants as l3_constants
|
||||
|
||||
|
||||
class LegacyRouter(router.RouterInfo):
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import collections
|
||||
import netaddr
|
||||
from neutron_lib import constants as l3_constants
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _, _LE, _LW
|
||||
@ -21,7 +22,7 @@ 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 l3_constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils as common_utils
|
||||
@ -351,7 +352,7 @@ class RouterInfo(object):
|
||||
def _internal_network_updated(self, port, subnet_id, prefix, old_prefix,
|
||||
updated_cidrs):
|
||||
interface_name = self.get_internal_device_name(port['id'])
|
||||
if prefix != l3_constants.PROVISIONAL_IPV6_PD_PREFIX:
|
||||
if prefix != n_const.PROVISIONAL_IPV6_PD_PREFIX:
|
||||
fixed_ips = port['fixed_ips']
|
||||
for fixed_ip in fixed_ips:
|
||||
if fixed_ip['subnet_id'] == subnet_id:
|
||||
@ -432,7 +433,7 @@ class RouterInfo(object):
|
||||
if 'subnets' in port:
|
||||
for subnet in port['subnets']:
|
||||
if (netaddr.IPNetwork(subnet['cidr']).version == 6 and
|
||||
subnet['cidr'] != l3_constants.PROVISIONAL_IPV6_PD_PREFIX):
|
||||
subnet['cidr'] != n_const.PROVISIONAL_IPV6_PD_PREFIX):
|
||||
return True
|
||||
|
||||
def enable_radvd(self, internal_ports=None):
|
||||
@ -707,7 +708,7 @@ class RouterInfo(object):
|
||||
'snat', '-m mark ! --mark %s/%s '
|
||||
'-m conntrack --ctstate DNAT '
|
||||
'-j SNAT --to-source %s'
|
||||
% (ext_in_mark, l3_constants.ROUTER_MARK_MASK, ex_gw_ip))
|
||||
% (ext_in_mark, n_const.ROUTER_MARK_MASK, ex_gw_ip))
|
||||
return [dont_snat_traffic_to_internal_ports_if_not_to_floating_ip,
|
||||
snat_internal_traffic_to_floating_ip]
|
||||
|
||||
@ -721,7 +722,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, l3_constants.ROUTER_MARK_MASK))
|
||||
(interface_name, mark, n_const.ROUTER_MARK_MASK))
|
||||
return [mark_packets_entering_external_gateway_port]
|
||||
|
||||
def _empty_snat_chains(self, iptables_manager):
|
||||
|
@ -21,6 +21,7 @@ import shutil
|
||||
import time
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -34,7 +35,7 @@ from neutron.agent.common import utils as agent_common_utils
|
||||
from neutron.agent.linux import external_process
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils as common_utils
|
||||
@ -351,8 +352,8 @@ class Dnsmasq(DhcpLocalProcess):
|
||||
# static to preserve previous behavior
|
||||
addr_mode = getattr(subnet, 'ipv6_address_mode', None)
|
||||
ra_mode = getattr(subnet, 'ipv6_ra_mode', None)
|
||||
if (addr_mode in [constants.DHCPV6_STATEFUL,
|
||||
constants.DHCPV6_STATELESS] or
|
||||
if (addr_mode in [n_const.DHCPV6_STATEFUL,
|
||||
n_const.DHCPV6_STATELESS] or
|
||||
not addr_mode and not ra_mode):
|
||||
mode = 'static'
|
||||
|
||||
@ -510,7 +511,7 @@ class Dnsmasq(DhcpLocalProcess):
|
||||
fixed_ips,
|
||||
key=lambda fip: ((fip.subnet_id in v6_nets) and (
|
||||
v6_nets[fip.subnet_id].ipv6_address_mode == (
|
||||
constants.DHCPV6_STATELESS))),
|
||||
n_const.DHCPV6_STATELESS))),
|
||||
reverse=True)
|
||||
|
||||
def _iter_hosts(self):
|
||||
@ -545,11 +546,11 @@ class Dnsmasq(DhcpLocalProcess):
|
||||
no_opts = False
|
||||
if alloc.subnet_id in v6_nets:
|
||||
addr_mode = v6_nets[alloc.subnet_id].ipv6_address_mode
|
||||
no_dhcp = addr_mode in (constants.IPV6_SLAAC,
|
||||
constants.DHCPV6_STATELESS)
|
||||
no_dhcp = addr_mode in (n_const.IPV6_SLAAC,
|
||||
n_const.DHCPV6_STATELESS)
|
||||
# we don't setup anything for SLAAC. It doesn't make sense
|
||||
# to provide options for a client that won't use DHCP
|
||||
no_opts = addr_mode == constants.IPV6_SLAAC
|
||||
no_opts = addr_mode == n_const.IPV6_SLAAC
|
||||
|
||||
# If dns_name attribute is supported by ports API, return the
|
||||
# dns_assignment generated by the Neutron server. Otherwise,
|
||||
@ -770,7 +771,7 @@ class Dnsmasq(DhcpLocalProcess):
|
||||
addr_mode = getattr(subnet, 'ipv6_address_mode', None)
|
||||
if (not subnet.enable_dhcp or
|
||||
(subnet.ip_version == 6 and
|
||||
addr_mode == constants.IPV6_SLAAC)):
|
||||
addr_mode == n_const.IPV6_SLAAC)):
|
||||
continue
|
||||
if subnet.dns_nameservers:
|
||||
options.append(
|
||||
@ -1124,7 +1125,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 == constants.DEVICE_ID_RESERVED_DHCP_PORT:
|
||||
if port_device_id == n_const.DEVICE_ID_RESERVED_DHCP_PORT:
|
||||
try:
|
||||
port = self.plugin.update_dhcp_port(
|
||||
port.id, {'port': {'network_id': network.id,
|
||||
|
@ -16,6 +16,7 @@
|
||||
import abc
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_log import versionutils
|
||||
@ -56,7 +57,7 @@ class LinuxInterfaceDriver(object):
|
||||
|
||||
# from linux IF_NAMESIZE
|
||||
DEV_NAME_LEN = 14
|
||||
DEV_NAME_PREFIX = n_const.TAP_DEVICE_PREFIX
|
||||
DEV_NAME_PREFIX = constants.TAP_DEVICE_PREFIX
|
||||
|
||||
def __init__(self, conf):
|
||||
self.conf = conf
|
||||
@ -181,8 +182,8 @@ class LinuxInterfaceDriver(object):
|
||||
# Manage on-link routes (routes without an associated address)
|
||||
new_onlink_cidrs = set(s['cidr'] for s in extra_subnets or [])
|
||||
|
||||
v4_onlink = device.route.list_onlink_routes(n_const.IP_VERSION_4)
|
||||
v6_onlink = device.route.list_onlink_routes(n_const.IP_VERSION_6)
|
||||
v4_onlink = device.route.list_onlink_routes(constants.IP_VERSION_4)
|
||||
v6_onlink = device.route.list_onlink_routes(constants.IP_VERSION_6)
|
||||
existing_onlink_cidrs = set(r['cidr'] for r in v4_onlink + v6_onlink)
|
||||
|
||||
for route in new_onlink_cidrs - existing_onlink_cidrs:
|
||||
@ -292,7 +293,7 @@ class NullDriver(LinuxInterfaceDriver):
|
||||
class OVSInterfaceDriver(LinuxInterfaceDriver):
|
||||
"""Driver for creating an internal interface on an OVS bridge."""
|
||||
|
||||
DEV_NAME_PREFIX = n_const.TAP_DEVICE_PREFIX
|
||||
DEV_NAME_PREFIX = constants.TAP_DEVICE_PREFIX
|
||||
|
||||
def __init__(self, conf):
|
||||
super(OVSInterfaceDriver, self).__init__(conf)
|
||||
@ -302,7 +303,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
|
||||
def _get_tap_name(self, dev_name, prefix=None):
|
||||
if self.conf.ovs_use_veth:
|
||||
dev_name = dev_name.replace(prefix or self.DEV_NAME_PREFIX,
|
||||
n_const.TAP_DEVICE_PREFIX)
|
||||
constants.TAP_DEVICE_PREFIX)
|
||||
return dev_name
|
||||
|
||||
def _ovs_add_port(self, bridge, device_name, port_id, mac_address,
|
||||
@ -381,7 +382,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
|
||||
class IVSInterfaceDriver(LinuxInterfaceDriver):
|
||||
"""Driver for creating an internal interface on an IVS bridge."""
|
||||
|
||||
DEV_NAME_PREFIX = n_const.TAP_DEVICE_PREFIX
|
||||
DEV_NAME_PREFIX = constants.TAP_DEVICE_PREFIX
|
||||
|
||||
def __init__(self, conf):
|
||||
super(IVSInterfaceDriver, self).__init__(conf)
|
||||
@ -389,7 +390,7 @@ class IVSInterfaceDriver(LinuxInterfaceDriver):
|
||||
|
||||
def _get_tap_name(self, dev_name, prefix=None):
|
||||
dev_name = dev_name.replace(prefix or self.DEV_NAME_PREFIX,
|
||||
n_const.TAP_DEVICE_PREFIX)
|
||||
constants.TAP_DEVICE_PREFIX)
|
||||
return dev_name
|
||||
|
||||
def _ivs_add_port(self, device_name, port_id, mac_address):
|
||||
@ -450,7 +451,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
|
||||
|
||||
# Enable agent to define the prefix
|
||||
tap_name = device_name.replace(prefix or self.DEV_NAME_PREFIX,
|
||||
n_const.TAP_DEVICE_PREFIX)
|
||||
constants.TAP_DEVICE_PREFIX)
|
||||
# Create ns_veth in a namespace if one is configured.
|
||||
root_veth, ns_veth = ip.add_veth(tap_name, device_name,
|
||||
namespace2=namespace)
|
||||
|
@ -18,6 +18,7 @@ import re
|
||||
|
||||
import eventlet
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -26,7 +27,6 @@ import six
|
||||
|
||||
from neutron._i18n import _, _LE
|
||||
from neutron.agent.common import utils
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -17,6 +17,7 @@ import collections
|
||||
import re
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
@ -28,7 +29,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.agent.linux import utils
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils as c_utils
|
||||
|
@ -13,7 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
|
||||
OF_STATE_NOT_TRACKED = "-trk"
|
||||
OF_STATE_TRACKED = "+trk"
|
||||
@ -42,6 +44,6 @@ protocol_to_nw_proto = {
|
||||
PROTOCOLS_WITH_PORTS = (constants.PROTO_NAME_TCP, constants.PROTO_NAME_UDP)
|
||||
|
||||
ethertype_to_dl_type_map = {
|
||||
constants.IPv4: constants.ETHERTYPE_IP,
|
||||
constants.IPv6: constants.ETHERTYPE_IPV6,
|
||||
constants.IPv4: n_const.ETHERTYPE_IP,
|
||||
constants.IPv6: n_const.ETHERTYPE_IPV6,
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as lib_const
|
||||
from neutron_lib import exceptions
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -367,14 +368,14 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
||||
self._initialize_ingress(port)
|
||||
|
||||
def _initialize_egress_ipv6_icmp(self, port):
|
||||
for icmp_type in constants.ICMPV6_ALLOWED_TYPES:
|
||||
for icmp_type in lib_const.ICMPV6_ALLOWED_TYPES:
|
||||
self._add_flow(
|
||||
table=ovs_consts.BASE_EGRESS_TABLE,
|
||||
priority=95,
|
||||
in_port=port.ofport,
|
||||
reg_port=port.ofport,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
nw_proto=constants.PROTO_NUM_IPV6_ICMP,
|
||||
nw_proto=lib_const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=icmp_type,
|
||||
actions='normal'
|
||||
)
|
||||
@ -439,7 +440,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
||||
reg_port=port.ofport,
|
||||
in_port=port.ofport,
|
||||
dl_type=dl_type,
|
||||
nw_proto=constants.PROTO_NUM_UDP,
|
||||
nw_proto=lib_const.PROTO_NUM_UDP,
|
||||
tp_src=src_port,
|
||||
tp_dst=dst_port,
|
||||
actions='resubmit(,{:d})'.format(
|
||||
@ -455,7 +456,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
||||
in_port=port.ofport,
|
||||
reg_port=port.ofport,
|
||||
dl_type=dl_type,
|
||||
nw_proto=constants.PROTO_NUM_UDP,
|
||||
nw_proto=lib_const.PROTO_NUM_UDP,
|
||||
tp_src=src_port,
|
||||
tp_dst=dst_port,
|
||||
actions='drop'
|
||||
@ -546,14 +547,14 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
||||
)
|
||||
|
||||
def _initialize_ingress_ipv6_icmp(self, port):
|
||||
for icmp_type in constants.ICMPV6_ALLOWED_TYPES:
|
||||
for icmp_type in lib_const.ICMPV6_ALLOWED_TYPES:
|
||||
self._add_flow(
|
||||
table=ovs_consts.BASE_INGRESS_TABLE,
|
||||
priority=100,
|
||||
reg_port=port.ofport,
|
||||
dl_dst=port.mac,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
nw_proto=constants.PROTO_NUM_IPV6_ICMP,
|
||||
nw_proto=lib_const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=icmp_type,
|
||||
actions='strip_vlan,output:{:d}'.format(port.ofport),
|
||||
)
|
||||
@ -579,7 +580,7 @@ class OVSFirewallDriver(firewall.FirewallDriver):
|
||||
priority=95,
|
||||
reg_port=port.ofport,
|
||||
dl_type=dl_type,
|
||||
nw_proto=constants.PROTO_NUM_UDP,
|
||||
nw_proto=lib_const.PROTO_NUM_UDP,
|
||||
tp_src=src_port,
|
||||
tp_dst=dst_port,
|
||||
actions='strip_vlan,output:{:d}'.format(port.ofport),
|
||||
|
@ -20,7 +20,6 @@ from oslo_log import log as logging
|
||||
from neutron.agent import firewall
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux.openvswitch_firewall import constants as ovsfw_consts
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants \
|
||||
as ovs_consts
|
||||
@ -83,7 +82,7 @@ def create_protocol_flows(direction, flow_template, port, rule):
|
||||
try:
|
||||
flow_template['nw_proto'] = ovsfw_consts.protocol_to_nw_proto[protocol]
|
||||
if rule['ethertype'] == n_consts.IPv6 and protocol == 'icmp':
|
||||
flow_template['nw_proto'] = constants.PROTO_NUM_IPV6_ICMP
|
||||
flow_template['nw_proto'] = n_consts.PROTO_NUM_IPV6_ICMP
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
@ -26,6 +26,7 @@ import threading
|
||||
import eventlet
|
||||
from eventlet.green import subprocess
|
||||
from eventlet import greenthread
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_rootwrap import client
|
||||
@ -35,7 +36,6 @@ from six.moves import http_client as httplib
|
||||
|
||||
from neutron._i18n import _, _LE
|
||||
from neutron.agent.common import config
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils
|
||||
from neutron import wsgi
|
||||
|
||||
|
@ -16,6 +16,7 @@ import hashlib
|
||||
import hmac
|
||||
|
||||
import httplib2
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -112,7 +113,7 @@ class MetadataProxyHandler(object):
|
||||
filters = {}
|
||||
if router_id:
|
||||
filters['device_id'] = [router_id]
|
||||
filters['device_owner'] = n_const.ROUTER_INTERFACE_OWNERS
|
||||
filters['device_owner'] = constants.ROUTER_INTERFACE_OWNERS
|
||||
if ip_address:
|
||||
filters['fixed_ips'] = {'ip_address': [ip_address]}
|
||||
if networks:
|
||||
@ -251,7 +252,7 @@ class UnixDomainMetadataProxy(object):
|
||||
'log_agent_heartbeats': cfg.CONF.AGENT.log_agent_heartbeats,
|
||||
},
|
||||
'start_flag': True,
|
||||
'agent_type': n_const.AGENT_TYPE_METADATA}
|
||||
'agent_type': constants.AGENT_TYPE_METADATA}
|
||||
report_interval = cfg.CONF.AGENT.report_interval
|
||||
if report_interval:
|
||||
self.heartbeat = loopingcall.FixedIntervalLoopingCall(
|
||||
|
@ -16,12 +16,13 @@
|
||||
from datetime import datetime
|
||||
import itertools
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron._i18n import _LW
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
|
||||
@ -68,7 +69,7 @@ class PluginReportStateAPI(object):
|
||||
"""
|
||||
def __init__(self, topic):
|
||||
target = oslo_messaging.Target(topic=topic, version='1.0',
|
||||
namespace=constants.RPC_NAMESPACE_STATE)
|
||||
namespace=n_const.RPC_NAMESPACE_STATE)
|
||||
self.client = n_rpc.get_client(target)
|
||||
|
||||
def report_state(self, context, agent_state, use_call=False):
|
||||
|
@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -21,7 +22,7 @@ from neutron._i18n import _LE, _LW
|
||||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants
|
||||
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
|
||||
@ -118,7 +119,7 @@ class DhcpAgentNotifyAPI(object):
|
||||
return enabled_agents
|
||||
|
||||
def _is_reserved_dhcp_port(self, port):
|
||||
return port.get('device_id') == constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
return port.get('device_id') == n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
|
||||
def _notify_agents(self, context, method, payload, network_id):
|
||||
"""Notify all the agents that are hosting the network."""
|
||||
|
@ -15,11 +15,11 @@
|
||||
|
||||
import random
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron._i18n import _LE
|
||||
from neutron.common import constants
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils
|
||||
|
@ -12,11 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
import six
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils
|
||||
|
@ -17,6 +17,7 @@ import copy
|
||||
import itertools
|
||||
import operator
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@ -25,8 +26,7 @@ import oslo_messaging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron._i18n import _, _LW
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import utils
|
||||
from neutron.db import api as db_api
|
||||
@ -65,7 +65,7 @@ class DhcpRpcCallback(object):
|
||||
# DHCP agent since Juno, so similar rationale for not bumping the
|
||||
# major version as above applies here too.
|
||||
target = oslo_messaging.Target(
|
||||
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
namespace=n_const.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
version='1.4')
|
||||
|
||||
def _get_active_networks(self, context, **kwargs):
|
||||
@ -203,7 +203,7 @@ class DhcpRpcCallback(object):
|
||||
port['port']['device_owner'] = constants.DEVICE_OWNER_DHCP
|
||||
port['port'][portbindings.HOST_ID] = host
|
||||
if 'mac_address' not in port['port']:
|
||||
port['port']['mac_address'] = attributes.ATTR_NOT_SPECIFIED
|
||||
port['port']['mac_address'] = constants.ATTR_NOT_SPECIFIED
|
||||
plugin = manager.NeutronManager.get_plugin()
|
||||
return self._port_action(plugin, context, port, 'create_port')
|
||||
|
||||
@ -216,7 +216,7 @@ class DhcpRpcCallback(object):
|
||||
port['port'][portbindings.HOST_ID] = host
|
||||
plugin = manager.NeutronManager.get_plugin()
|
||||
old_port = plugin.get_port(context, port['id'])
|
||||
if (old_port['device_id'] != constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
if (old_port['device_id'] != n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
and old_port['device_id'] !=
|
||||
utils.get_dhcp_agent_device_id(port['port']['network_id'], host)):
|
||||
raise n_exc.DhcpPortInUse(port_id=port['id'])
|
||||
|
@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -20,7 +21,7 @@ import oslo_messaging
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron import context as neutron_context
|
||||
from neutron.db import api as db_api
|
||||
@ -119,7 +120,7 @@ class L3RpcCallback(object):
|
||||
gw_port_host,
|
||||
router.get('gw_port'),
|
||||
router['id'])
|
||||
for p in router.get(constants.SNAT_ROUTER_INTF_KEY, []):
|
||||
for p in router.get(n_const.SNAT_ROUTER_INTF_KEY, []):
|
||||
self._ensure_host_set_on_port(context,
|
||||
gw_port_host,
|
||||
p, router['id'])
|
||||
|
@ -15,8 +15,10 @@
|
||||
|
||||
import functools
|
||||
import re
|
||||
import sys
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
@ -24,12 +26,12 @@ import six
|
||||
import webob.exc
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.common import constants
|
||||
from neutron.common import _deprecate
|
||||
from neutron.common import constants as n_const
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
ATTR_NOT_SPECIFIED = object()
|
||||
# Defining a constant to avoid repeating string literal in several modules
|
||||
SHARED = 'shared'
|
||||
|
||||
@ -75,7 +77,7 @@ def _verify_dict_keys(expected_keys, target_dict, strict=True):
|
||||
|
||||
|
||||
def is_attr_set(attribute):
|
||||
return not (attribute is None or attribute is ATTR_NOT_SPECIFIED)
|
||||
return not (attribute is None or attribute is constants.ATTR_NOT_SPECIFIED)
|
||||
|
||||
|
||||
def _validate_list_of_items(item_validator, data, *args, **kwargs):
|
||||
@ -192,8 +194,8 @@ def _validate_mac_address(data, valid_values=None):
|
||||
valid_mac = False
|
||||
|
||||
if valid_mac:
|
||||
valid_mac = not netaddr.EUI(data) in map(netaddr.EUI,
|
||||
constants.INVALID_MAC_ADDRESSES)
|
||||
valid_mac = not netaddr.EUI(data) in map(
|
||||
netaddr.EUI, constants.INVALID_MAC_ADDRESSES)
|
||||
# TODO(arosen): The code in this file should be refactored
|
||||
# so it catches the correct exceptions. _validate_no_whitespace
|
||||
# raises AttributeError if data is None.
|
||||
@ -600,13 +602,10 @@ def convert_to_list(data):
|
||||
return [data]
|
||||
|
||||
|
||||
HEX_ELEM = '[0-9A-Fa-f]'
|
||||
UUID_PATTERN = '-'.join([HEX_ELEM + '{8}', HEX_ELEM + '{4}',
|
||||
HEX_ELEM + '{4}', HEX_ELEM + '{4}',
|
||||
HEX_ELEM + '{12}'])
|
||||
# Note: In order to ensure that the MAC address is unicast the first byte
|
||||
# must be even.
|
||||
MAC_PATTERN = "^%s[aceACE02468](:%s{2}){5}$" % (HEX_ELEM, HEX_ELEM)
|
||||
MAC_PATTERN = "^%s[aceACE02468](:%s{2}){5}$" % (constants.HEX_ELEM,
|
||||
constants.HEX_ELEM)
|
||||
|
||||
# Dictionary that maintains a list of validation functions
|
||||
validators = {'type:dict': _validate_dict,
|
||||
@ -721,12 +720,12 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'convert_to': convert_to_boolean,
|
||||
'is_visible': True},
|
||||
'mac_address': {'allow_post': True, 'allow_put': True,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:mac_address': None},
|
||||
'enforce_policy': True,
|
||||
'is_visible': True},
|
||||
'fixed_ips': {'allow_post': True, 'allow_put': True,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'convert_list_to': convert_kvp_list_to_dict,
|
||||
'validate': {'type:fixed_ips': None},
|
||||
'enforce_policy': True,
|
||||
@ -764,7 +763,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'is_visible': True},
|
||||
'subnetpool_id': {'allow_post': True,
|
||||
'allow_put': False,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'required_by_policy': False,
|
||||
'validate': {'type:subnetpool_id_or_none': None},
|
||||
'is_visible': True},
|
||||
@ -772,31 +771,31 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'allow_put': False,
|
||||
'validate': {'type:non_negative': None},
|
||||
'convert_to': convert_to_int,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'required_by_policy': False,
|
||||
'is_visible': False},
|
||||
'cidr': {'allow_post': True,
|
||||
'allow_put': False,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:subnet_or_none': None},
|
||||
'required_by_policy': False,
|
||||
'is_visible': True},
|
||||
'gateway_ip': {'allow_post': True, 'allow_put': True,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:ip_address_or_none': None},
|
||||
'is_visible': True},
|
||||
'allocation_pools': {'allow_post': True, 'allow_put': True,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:ip_pools': None},
|
||||
'is_visible': True},
|
||||
'dns_nameservers': {'allow_post': True, 'allow_put': True,
|
||||
'convert_to': convert_none_to_empty_list,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:nameservers': None},
|
||||
'is_visible': True},
|
||||
'host_routes': {'allow_post': True, 'allow_put': True,
|
||||
'convert_to': convert_none_to_empty_list,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:hostroutes': None},
|
||||
'is_visible': True},
|
||||
'tenant_id': {'allow_post': True, 'allow_put': False,
|
||||
@ -808,13 +807,13 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'convert_to': convert_to_boolean,
|
||||
'is_visible': True},
|
||||
'ipv6_ra_mode': {'allow_post': True, 'allow_put': False,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:values': constants.IPV6_MODES},
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:values': n_const.IPV6_MODES},
|
||||
'is_visible': True},
|
||||
'ipv6_address_mode': {'allow_post': True, 'allow_put': False,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:values':
|
||||
constants.IPV6_MODES},
|
||||
n_const.IPV6_MODES},
|
||||
'is_visible': True},
|
||||
SHARED: {'allow_post': False,
|
||||
'allow_put': False,
|
||||
@ -847,7 +846,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'allow_put': True,
|
||||
'validate': {'type:non_negative': None},
|
||||
'convert_to': convert_to_int,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True},
|
||||
'ip_version': {'allow_post': False,
|
||||
'allow_put': False,
|
||||
@ -856,17 +855,17 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'allow_put': True,
|
||||
'validate': {'type:non_negative': None},
|
||||
'convert_to': convert_to_int,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True},
|
||||
'min_prefixlen': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:non_negative': None},
|
||||
'convert_to': convert_to_int,
|
||||
'is_visible': True},
|
||||
'max_prefixlen': {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:non_negative': None},
|
||||
'convert_to': convert_to_int,
|
||||
'is_visible': True},
|
||||
@ -951,7 +950,7 @@ def fill_default_value(attr_info, res_dict,
|
||||
def convert_value(attr_info, res_dict, exc_cls=ValueError):
|
||||
for attr, attr_vals in six.iteritems(attr_info):
|
||||
if (attr not in res_dict or
|
||||
res_dict[attr] is ATTR_NOT_SPECIFIED):
|
||||
res_dict[attr] is constants.ATTR_NOT_SPECIFIED):
|
||||
continue
|
||||
# Convert values if necessary
|
||||
if 'convert_to' in attr_vals:
|
||||
@ -990,3 +989,22 @@ def verify_attributes(res_dict, attr_info):
|
||||
if extra_keys:
|
||||
msg = _("Unrecognized attribute(s) '%s'") % ', '.join(extra_keys)
|
||||
raise webob.exc.HTTPBadRequest(msg)
|
||||
|
||||
|
||||
# Shim added to move the following to neutron_lib.constants:
|
||||
# ATTR_NOT_SPECIFIED
|
||||
# HEX_ELEM
|
||||
# UUID_PATTERN
|
||||
|
||||
# Neutron-lib migration shim. This will wrap any constants that are moved
|
||||
# to that library in a deprecation warning, until they can be updated to
|
||||
# import directly from their new location.
|
||||
# If you're wondering why we bother saving _OLD_REF, it is because if we
|
||||
# do not, then the original module we are overwriting gets garbage collected,
|
||||
# and then you will find some super strange behavior with inherited classes
|
||||
# and the like. Saving a ref keeps it around.
|
||||
|
||||
# WARNING: THESE MUST BE THE LAST TWO LINES IN THIS MODULE
|
||||
_OLD_REF = sys.modules[__name__]
|
||||
sys.modules[__name__] = _deprecate._DeprecateSubset(globals(), constants)
|
||||
# WARNING: THESE MUST BE THE LAST TWO LINES IN THIS MODULE
|
||||
|
@ -17,6 +17,7 @@ import collections
|
||||
import copy
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -30,7 +31,7 @@ from neutron.api import api_common
|
||||
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.api.v2 import resource as wsgi_resource
|
||||
from neutron.common import constants as const
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.db import api as db_api
|
||||
@ -80,7 +81,7 @@ class Controller(object):
|
||||
# use plugin's dhcp notifier, if this is already instantiated
|
||||
agent_notifiers = getattr(plugin, 'agent_notifiers', {})
|
||||
self._dhcp_agent_notifier = (
|
||||
agent_notifiers.get(const.AGENT_TYPE_DHCP) or
|
||||
agent_notifiers.get(constants.AGENT_TYPE_DHCP) or
|
||||
dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
|
||||
)
|
||||
if cfg.CONF.notify_nova_on_port_data_changes:
|
||||
@ -602,7 +603,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[const.ATTRIBUTES_TO_UPDATE] = body[self._resource].keys()
|
||||
orig_obj[n_const.ATTRIBUTES_TO_UPDATE] = body[self._resource].keys()
|
||||
try:
|
||||
policy.enforce(request.context,
|
||||
action,
|
||||
|
@ -17,6 +17,7 @@ import itertools
|
||||
import re
|
||||
import time
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
@ -32,7 +33,6 @@ from neutron.agent.linux import dhcp
|
||||
from neutron.agent.linux import external_process
|
||||
from neutron.agent.linux import interface
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import config
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ def eligible_for_deletion(conf, namespace, force=False):
|
||||
else:
|
||||
prefixes = itertools.chain(*NS_PREFIXES.values())
|
||||
ns_mangling_pattern = '(%s%s)' % ('|'.join(prefixes),
|
||||
attributes.UUID_PATTERN)
|
||||
constants.UUID_PATTERN)
|
||||
|
||||
# filter out namespaces without UUID as the name
|
||||
if not re.match(ns_mangling_pattern, namespace):
|
||||
|
@ -18,6 +18,7 @@ import shutil
|
||||
import tempfile
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as n_consts
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
@ -31,7 +32,7 @@ from neutron.agent.linux import ip_lib
|
||||
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.common import constants as n_consts
|
||||
from neutron.common import constants
|
||||
from neutron.plugins.common import constants as const
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
|
||||
import constants as ovs_const
|
||||
@ -135,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=n_consts.ETHERTYPE_IPV6,
|
||||
dl_type=constants.ETHERTYPE_IPV6,
|
||||
nw_proto=n_consts.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=n_consts.ICMPV6_TYPE_NA,
|
||||
nd_target='fdf8:f53b:82e4::10',
|
||||
|
@ -14,7 +14,6 @@
|
||||
import copy
|
||||
import debtcollector
|
||||
import inspect
|
||||
import os
|
||||
|
||||
from neutron._i18n import _
|
||||
|
||||
@ -29,16 +28,12 @@ class _DeprecateSubset(object):
|
||||
if (not name.startswith("__") and not inspect.ismodule(a) and
|
||||
name in vars(self.other_mod)):
|
||||
|
||||
# These should be enabled after most have been cleaned up
|
||||
# in neutron proper, which may not happen during the busy M-3.
|
||||
|
||||
if os.getenv('NEUTRON_SHOW_DEPRECATION_WARNINGS'):
|
||||
debtcollector.deprecate(
|
||||
name,
|
||||
message='moved to neutron_lib',
|
||||
version='mitaka',
|
||||
removal_version='newton',
|
||||
stacklevel=4)
|
||||
debtcollector.deprecate(
|
||||
name,
|
||||
message='moved to neutron_lib',
|
||||
version='mitaka',
|
||||
removal_version='newton',
|
||||
stacklevel=4)
|
||||
|
||||
return vars(self.other_mod)[name]
|
||||
|
||||
|
@ -22,13 +22,6 @@ from neutron.common import _deprecate
|
||||
|
||||
ROUTER_PORT_OWNERS = lib_constants.ROUTER_INTERFACE_OWNERS_SNAT + \
|
||||
(lib_constants.DEVICE_OWNER_ROUTER_GW,)
|
||||
# TODO(anilvenkata) Below constants should be added to neutron-lib
|
||||
DEVICE_OWNER_HA_REPLICATED_INT = (lib_constants.DEVICE_OWNER_NETWORK_PREFIX +
|
||||
"ha_router_replicated_interface")
|
||||
ROUTER_INTERFACE_OWNERS = lib_constants.ROUTER_INTERFACE_OWNERS + \
|
||||
(DEVICE_OWNER_HA_REPLICATED_INT,)
|
||||
ROUTER_INTERFACE_OWNERS_SNAT = lib_constants.ROUTER_INTERFACE_OWNERS_SNAT + \
|
||||
(DEVICE_OWNER_HA_REPLICATED_INT,)
|
||||
|
||||
ROUTER_STATUS_ACTIVE = 'ACTIVE'
|
||||
# NOTE(kevinbenton): a BUILD status for routers could be added in the future
|
||||
@ -65,96 +58,23 @@ ETHERTYPE_ARP = 0x0806
|
||||
ETHERTYPE_IP = 0x0800
|
||||
ETHERTYPE_IPV6 = 0x86DD
|
||||
|
||||
# Protocol names and numbers for Security Groups/Firewalls
|
||||
PROTO_NAME_AH = 'ah'
|
||||
PROTO_NAME_DCCP = 'dccp'
|
||||
PROTO_NAME_EGP = 'egp'
|
||||
PROTO_NAME_ESP = 'esp'
|
||||
PROTO_NAME_GRE = 'gre'
|
||||
PROTO_NAME_ICMP = 'icmp'
|
||||
PROTO_NAME_IGMP = 'igmp'
|
||||
PROTO_NAME_IPV6_ENCAP = 'ipv6-encap'
|
||||
PROTO_NAME_IPV6_FRAG = 'ipv6-frag'
|
||||
PROTO_NAME_IPV6_ICMP = 'ipv6-icmp'
|
||||
PROTO_NAME_IPV6_NONXT = 'ipv6-nonxt'
|
||||
PROTO_NAME_IPV6_OPTS = 'ipv6-opts'
|
||||
PROTO_NAME_IPV6_ROUTE = 'ipv6-route'
|
||||
PROTO_NAME_OSPF = 'ospf'
|
||||
PROTO_NAME_PGM = 'pgm'
|
||||
PROTO_NAME_RSVP = 'rsvp'
|
||||
PROTO_NAME_SCTP = 'sctp'
|
||||
PROTO_NAME_TCP = 'tcp'
|
||||
PROTO_NAME_UDP = 'udp'
|
||||
PROTO_NAME_UDPLITE = 'udplite'
|
||||
PROTO_NAME_VRRP = 'vrrp'
|
||||
|
||||
# TODO(amotoki): It should be moved to neutron-lib.
|
||||
# For backward-compatibility of security group rule API,
|
||||
# we keep the old value for IPv6 ICMP.
|
||||
# It should be clean up in the future.
|
||||
PROTO_NAME_IPV6_ICMP_LEGACY = 'icmpv6'
|
||||
|
||||
PROTO_NUM_AH = 51
|
||||
PROTO_NUM_DCCP = 33
|
||||
PROTO_NUM_EGP = 8
|
||||
PROTO_NUM_ESP = 50
|
||||
PROTO_NUM_GRE = 47
|
||||
PROTO_NUM_ICMP = 1
|
||||
PROTO_NUM_IGMP = 2
|
||||
PROTO_NUM_IPV6_ENCAP = 41
|
||||
PROTO_NUM_IPV6_FRAG = 44
|
||||
PROTO_NUM_IPV6_ICMP = 58
|
||||
PROTO_NUM_IPV6_NONXT = 59
|
||||
PROTO_NUM_IPV6_OPTS = 60
|
||||
PROTO_NUM_IPV6_ROUTE = 43
|
||||
PROTO_NUM_OSPF = 89
|
||||
PROTO_NUM_PGM = 113
|
||||
PROTO_NUM_RSVP = 46
|
||||
PROTO_NUM_SCTP = 132
|
||||
PROTO_NUM_TCP = 6
|
||||
PROTO_NUM_UDP = 17
|
||||
PROTO_NUM_UDPLITE = 136
|
||||
PROTO_NUM_VRRP = 112
|
||||
|
||||
IP_PROTOCOL_MAP = {PROTO_NAME_AH: PROTO_NUM_AH,
|
||||
PROTO_NAME_DCCP: PROTO_NUM_DCCP,
|
||||
PROTO_NAME_EGP: PROTO_NUM_EGP,
|
||||
PROTO_NAME_ESP: PROTO_NUM_ESP,
|
||||
PROTO_NAME_GRE: PROTO_NUM_GRE,
|
||||
PROTO_NAME_ICMP: PROTO_NUM_ICMP,
|
||||
PROTO_NAME_IGMP: PROTO_NUM_IGMP,
|
||||
PROTO_NAME_IPV6_ENCAP: PROTO_NUM_IPV6_ENCAP,
|
||||
PROTO_NAME_IPV6_FRAG: PROTO_NUM_IPV6_FRAG,
|
||||
PROTO_NAME_IPV6_ICMP: PROTO_NUM_IPV6_ICMP,
|
||||
PROTO_NAME_IPV6_NONXT: PROTO_NUM_IPV6_NONXT,
|
||||
PROTO_NAME_IPV6_OPTS: PROTO_NUM_IPV6_OPTS,
|
||||
PROTO_NAME_IPV6_ROUTE: PROTO_NUM_IPV6_ROUTE,
|
||||
PROTO_NAME_OSPF: PROTO_NUM_OSPF,
|
||||
PROTO_NAME_PGM: PROTO_NUM_PGM,
|
||||
PROTO_NAME_RSVP: PROTO_NUM_RSVP,
|
||||
PROTO_NAME_SCTP: PROTO_NUM_SCTP,
|
||||
PROTO_NAME_TCP: PROTO_NUM_TCP,
|
||||
PROTO_NAME_UDP: PROTO_NUM_UDP,
|
||||
PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE,
|
||||
PROTO_NAME_VRRP: PROTO_NUM_VRRP}
|
||||
|
||||
IP_PROTOCOL_NAME_ALIASES = {PROTO_NAME_IPV6_ICMP_LEGACY: PROTO_NAME_IPV6_ICMP}
|
||||
IP_PROTOCOL_NAME_ALIASES = {
|
||||
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 IP_PROTOCOL_MAP.items()}
|
||||
IP_PROTOCOL_NUM_TO_NAME_MAP = {
|
||||
str(v): k for k, v in lib_constants.IP_PROTOCOL_MAP.items()}
|
||||
|
||||
# List of ICMPv6 types that should be allowed by default:
|
||||
# Multicast Listener Query (130),
|
||||
# Multicast Listener Report (131),
|
||||
# Multicast Listener Done (132),
|
||||
# Neighbor Solicitation (135),
|
||||
ICMPV6_TYPE_NC = 135
|
||||
# Neighbor Advertisement (136)
|
||||
ICMPV6_TYPE_NA = 136
|
||||
ICMPV6_ALLOWED_TYPES = [130, 131, 132, 135, 136]
|
||||
ICMPV6_TYPE_RA = 134
|
||||
|
||||
DHCPV6_STATEFUL = 'dhcpv6-stateful'
|
||||
DHCPV6_STATELESS = 'dhcpv6-stateless'
|
||||
@ -163,33 +83,18 @@ IPV6_MODES = [DHCPV6_STATEFUL, DHCPV6_STATELESS, IPV6_SLAAC]
|
||||
|
||||
IPV6_LLA_PREFIX = 'fe80::/64'
|
||||
|
||||
# Human-readable ID to which the subnetpool ID should be set to
|
||||
# indicate that IPv6 Prefix Delegation is enabled for a given subnet
|
||||
IPV6_PD_POOL_ID = 'prefix_delegation'
|
||||
|
||||
# Special provisional prefix for IPv6 Prefix Delegation
|
||||
PROVISIONAL_IPV6_PD_PREFIX = '::/64'
|
||||
|
||||
# Timeout in seconds for getting an IPv6 LLA
|
||||
LLA_TASK_TIMEOUT = 40
|
||||
|
||||
# Linux interface max length
|
||||
DEVICE_NAME_MAX_LEN = 15
|
||||
|
||||
# vhost-user device names start with "vhu"
|
||||
VHOST_USER_DEVICE_PREFIX = 'vhu'
|
||||
# Device names start with "macvtap"
|
||||
MACVTAP_DEVICE_PREFIX = 'macvtap'
|
||||
# The vswitch side of a veth pair for a nova iptables filter setup
|
||||
VETH_DEVICE_PREFIX = 'qvo'
|
||||
# prefix for SNAT interface in DVR
|
||||
SNAT_INT_DEV_PREFIX = 'sg-'
|
||||
|
||||
# Possible prefixes to partial port IDs in interface names used by the OVS,
|
||||
# Linux Bridge, and IVS VIF drivers in Nova and the neutron agents. See the
|
||||
# 'get_ovs_interfaceid' method in Nova (nova/virt/libvirt/vif.py) for details.
|
||||
INTERFACE_PREFIXES = (lib_constants.TAP_DEVICE_PREFIX, VETH_DEVICE_PREFIX,
|
||||
SNAT_INT_DEV_PREFIX)
|
||||
INTERFACE_PREFIXES = (lib_constants.TAP_DEVICE_PREFIX,
|
||||
lib_constants.VETH_DEVICE_PREFIX,
|
||||
lib_constants.SNAT_INT_DEV_PREFIX)
|
||||
|
||||
ATTRIBUTES_TO_UPDATE = 'attributes_to_update'
|
||||
|
||||
|
@ -19,6 +19,7 @@ IPv6-related utilities and helper functions.
|
||||
import os
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as const
|
||||
from oslo_log import log
|
||||
|
||||
from neutron._i18n import _, _LI
|
||||
@ -83,4 +84,4 @@ def is_ipv6_pd_enabled(subnet):
|
||||
"""Returns True if the subnetpool_id of the given subnet is equal to
|
||||
constants.IPV6_PD_POOL_ID
|
||||
"""
|
||||
return subnet.get('subnetpool_id') == constants.IPV6_PD_POOL_ID
|
||||
return subnet.get('subnetpool_id') == const.IPV6_PD_POOL_ID
|
||||
|
@ -35,6 +35,7 @@ import uuid
|
||||
|
||||
from eventlet.green import subprocess
|
||||
import netaddr
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@ -46,7 +47,6 @@ import six
|
||||
from stevedore import driver
|
||||
|
||||
from neutron._i18n import _, _LE
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.db import api as db_api
|
||||
|
||||
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
||||
|
@ -12,13 +12,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_utils import uuidutils
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import constants
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import model_base
|
||||
from neutron.extensions import address_scope as ext_address_scope
|
||||
|
@ -16,6 +16,7 @@
|
||||
import datetime
|
||||
|
||||
from eventlet import greenthread
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
@ -34,7 +35,7 @@ from neutron.api.v2 import attributes
|
||||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron import context
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db import model_base
|
||||
@ -350,7 +351,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
|
||||
Returns agent status 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 = constants.AGENT_ALIVE
|
||||
status = n_const.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)
|
||||
@ -368,7 +369,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 = constants.AGENT_REVIVED
|
||||
status = n_const.AGENT_REVIVED
|
||||
if 'resource_versions' not in agent_state:
|
||||
# updating agent_state with resource_versions taken
|
||||
# from db so that
|
||||
@ -392,7 +393,7 @@ class AgentDbMixin(ext_agent.AgentPluginBase, AgentAvailabilityZoneMixin):
|
||||
greenthread.sleep(0)
|
||||
context.session.add(agent_db)
|
||||
self._log_heartbeat(agent_state, agent_db, configurations_dict)
|
||||
status = constants.AGENT_NEW
|
||||
status = n_const.AGENT_NEW
|
||||
greenthread.sleep(0)
|
||||
return status
|
||||
|
||||
@ -452,7 +453,7 @@ class AgentExtRpcCallback(object):
|
||||
"""
|
||||
|
||||
target = oslo_messaging.Target(version='1.1',
|
||||
namespace=constants.RPC_NAMESPACE_STATE)
|
||||
namespace=n_const.RPC_NAMESPACE_STATE)
|
||||
START_TIME = timeutils.utcnow()
|
||||
|
||||
def __init__(self, plugin=None):
|
||||
|
@ -17,6 +17,7 @@ import datetime
|
||||
import random
|
||||
import time
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import loopingcall
|
||||
@ -26,7 +27,7 @@ from sqlalchemy import orm
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron._i18n import _, _LE, _LI, _LW
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron import context as ncontext
|
||||
from neutron.db import agents_db
|
||||
@ -392,7 +393,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'] = constants.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
port['device_id'] = n_const.DEVICE_ID_RESERVED_DHCP_PORT
|
||||
self.update_port(context, port['id'], dict(port=port))
|
||||
with context.session.begin():
|
||||
context.session.delete(binding)
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import itertools
|
||||
|
||||
from neutron_lib import constants as lib_consts
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_db import exception as oslo_db_exc
|
||||
from oslo_log import log as logging
|
||||
@ -24,8 +25,6 @@ from sqlalchemy import orm
|
||||
from sqlalchemy.orm import aliased
|
||||
from sqlalchemy.orm import exc as sa_exc
|
||||
|
||||
from neutron_lib import constants as lib_consts
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.db import address_scope_db
|
||||
|
@ -15,13 +15,14 @@
|
||||
|
||||
import functools
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions
|
||||
from neutron.common import utils
|
||||
from neutron.db import common_db_mixin
|
||||
@ -274,7 +275,7 @@ class DbBasePluginCommon(common_db_mixin.CommonDbMixin):
|
||||
'name': network['name'],
|
||||
'tenant_id': network['tenant_id'],
|
||||
'admin_state_up': network['admin_state_up'],
|
||||
'mtu': network.get('mtu', constants.DEFAULT_NETWORK_MTU),
|
||||
'mtu': network.get('mtu', n_const.DEFAULT_NETWORK_MTU),
|
||||
'status': network['status'],
|
||||
'subnets': [subnet['id']
|
||||
for subnet in network['subnets']]}
|
||||
|
@ -16,6 +16,7 @@
|
||||
import functools
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as exc
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@ -33,7 +34,7 @@ from neutron.callbacks import events
|
||||
from neutron.callbacks import exceptions
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils
|
||||
@ -326,7 +327,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
'id': n.get('id') or uuidutils.generate_uuid(),
|
||||
'name': n['name'],
|
||||
'admin_state_up': n['admin_state_up'],
|
||||
'mtu': n.get('mtu', constants.DEFAULT_NETWORK_MTU),
|
||||
'mtu': n.get('mtu', n_const.DEFAULT_NETWORK_MTU),
|
||||
'status': n.get('status', constants.NET_STATUS_ACTIVE),
|
||||
'description': n.get('description')}
|
||||
network = models_v2.Network(**args)
|
||||
@ -532,8 +533,8 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
"subnets.")
|
||||
raise exc.BadRequest(resource='subnets', msg=reason)
|
||||
|
||||
mode_list = [constants.IPV6_SLAAC,
|
||||
constants.DHCPV6_STATELESS]
|
||||
mode_list = [n_const.IPV6_SLAAC,
|
||||
n_const.DHCPV6_STATELESS]
|
||||
|
||||
ra_mode = subnet.get('ipv6_ra_mode')
|
||||
if ra_mode not in mode_list:
|
||||
@ -607,10 +608,10 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
:param subnet: The subnet dict from the request
|
||||
"""
|
||||
use_default_subnetpool = subnet.get('use_default_subnetpool')
|
||||
if use_default_subnetpool == attributes.ATTR_NOT_SPECIFIED:
|
||||
if use_default_subnetpool == constants.ATTR_NOT_SPECIFIED:
|
||||
use_default_subnetpool = False
|
||||
subnetpool_id = subnet.get('subnetpool_id')
|
||||
if subnetpool_id == attributes.ATTR_NOT_SPECIFIED:
|
||||
if subnetpool_id == constants.ATTR_NOT_SPECIFIED:
|
||||
subnetpool_id = None
|
||||
|
||||
if use_default_subnetpool and subnetpool_id:
|
||||
@ -655,8 +656,8 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
def create_subnet(self, context, subnet):
|
||||
|
||||
s = subnet['subnet']
|
||||
cidr = s.get('cidr', attributes.ATTR_NOT_SPECIFIED)
|
||||
prefixlen = s.get('prefixlen', attributes.ATTR_NOT_SPECIFIED)
|
||||
cidr = s.get('cidr', constants.ATTR_NOT_SPECIFIED)
|
||||
prefixlen = s.get('prefixlen', constants.ATTR_NOT_SPECIFIED)
|
||||
has_cidr = attributes.is_attr_set(cidr)
|
||||
has_prefixlen = attributes.is_attr_set(prefixlen)
|
||||
|
||||
@ -684,7 +685,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
subnetpool_id = None
|
||||
self._validate_subnet(context, s)
|
||||
else:
|
||||
prefix = constants.PROVISIONAL_IPV6_PD_PREFIX
|
||||
prefix = n_const.PROVISIONAL_IPV6_PD_PREFIX
|
||||
subnet['subnet']['cidr'] = prefix
|
||||
self._validate_subnet_for_pd(s)
|
||||
else:
|
||||
@ -974,7 +975,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
|
||||
sp = subnetpool['subnetpool']
|
||||
sp_reader = subnet_alloc.SubnetPoolReader(sp)
|
||||
if sp_reader.address_scope_id is attributes.ATTR_NOT_SPECIFIED:
|
||||
if sp_reader.address_scope_id is constants.ATTR_NOT_SPECIFIED:
|
||||
sp_reader.address_scope_id = None
|
||||
if sp_reader.is_default:
|
||||
self._check_default_subnetpool_exists(context,
|
||||
@ -1016,9 +1017,9 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
|
||||
def _updated_subnetpool_dict(self, model, new_pool):
|
||||
updated = {}
|
||||
new_prefixes = new_pool.get('prefixes', attributes.ATTR_NOT_SPECIFIED)
|
||||
new_prefixes = new_pool.get('prefixes', constants.ATTR_NOT_SPECIFIED)
|
||||
orig_prefixes = [str(x.cidr) for x in model['prefixes']]
|
||||
if new_prefixes is not attributes.ATTR_NOT_SPECIFIED:
|
||||
if new_prefixes is not constants.ATTR_NOT_SPECIFIED:
|
||||
orig_set = netaddr.IPSet(orig_prefixes)
|
||||
new_set = netaddr.IPSet(new_prefixes)
|
||||
if not orig_set.issubset(new_set):
|
||||
@ -1038,8 +1039,8 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
return updated
|
||||
|
||||
def _write_key(self, key, update, orig, new_dict):
|
||||
new_val = new_dict.get(key, attributes.ATTR_NOT_SPECIFIED)
|
||||
if new_val is not attributes.ATTR_NOT_SPECIFIED:
|
||||
new_val = new_dict.get(key, constants.ATTR_NOT_SPECIFIED)
|
||||
if new_val is not constants.ATTR_NOT_SPECIFIED:
|
||||
update[key] = new_dict[key]
|
||||
else:
|
||||
update[key] = orig[key]
|
||||
@ -1233,7 +1234,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
self._get_network(context, network_id)
|
||||
|
||||
# Create the port
|
||||
if p['mac_address'] is attributes.ATTR_NOT_SPECIFIED:
|
||||
if p['mac_address'] is constants.ATTR_NOT_SPECIFIED:
|
||||
db_port = self._create_port(context, network_id, port_data)
|
||||
p['mac_address'] = db_port['mac_address']
|
||||
else:
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@ -26,7 +27,6 @@ from neutron._i18n import _, _LE
|
||||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils
|
||||
from neutron.db import model_base
|
||||
from neutron.db import models_v2
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as l3_constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
@ -26,7 +27,6 @@ from neutron.callbacks import events
|
||||
from neutron.callbacks import exceptions as c_exc
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import l3_db
|
||||
from neutron.db import model_base
|
||||
|
@ -17,6 +17,7 @@ import collections
|
||||
import itertools
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as const
|
||||
from neutron_lib import exceptions as exc
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@ -51,7 +52,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
|
||||
|
||||
@staticmethod
|
||||
def _gateway_ip_str(subnet, cidr_net):
|
||||
if subnet.get('gateway_ip') is attributes.ATTR_NOT_SPECIFIED:
|
||||
if subnet.get('gateway_ip') is const.ATTR_NOT_SPECIFIED:
|
||||
return str(netaddr.IPNetwork(cidr_net).network + 1)
|
||||
return subnet.get('gateway_ip')
|
||||
|
||||
@ -311,7 +312,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
|
||||
# Subnets are all the subnets belonging to the same network.
|
||||
if not subnets:
|
||||
msg = _('IP allocation requires subnets for network')
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
raise exc.InvalidInput(error_message=msg)
|
||||
|
||||
if 'subnet_id' in fixed:
|
||||
def get_matching_subnet():
|
||||
@ -370,7 +371,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
|
||||
# (non-optional, e.g. IPv6 SLAAC) addresses.
|
||||
# NOTE: Need to check the SNAT ports for DVR routers here since
|
||||
# they consume an IP.
|
||||
if device_owner in constants.ROUTER_INTERFACE_OWNERS_SNAT:
|
||||
if device_owner in const.ROUTER_INTERFACE_OWNERS_SNAT:
|
||||
return True
|
||||
|
||||
subnet = self._get_subnet(context, subnet_id)
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
@ -22,8 +23,7 @@ from sqlalchemy import orm
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.db import ipam_backend_mixin
|
||||
from neutron.db import models_v2
|
||||
@ -246,7 +246,7 @@ class IpamNonPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
|
||||
|
||||
is_auto_addr_subnet = ipv6_utils.is_auto_address_subnet(subnet)
|
||||
if ('ip_address' in fixed and
|
||||
subnet['cidr'] != constants.PROVISIONAL_IPV6_PD_PREFIX):
|
||||
subnet['cidr'] != n_const.PROVISIONAL_IPV6_PD_PREFIX):
|
||||
# Ensure that the IP's are unique
|
||||
if not IpamNonPluggableBackend._check_unique_ip(
|
||||
context, network_id,
|
||||
@ -352,7 +352,7 @@ class IpamNonPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
|
||||
v4, v6_stateful, v6_stateless = self._classify_subnets(
|
||||
context, subnets)
|
||||
|
||||
fixed_configured = p['fixed_ips'] is not attributes.ATTR_NOT_SPECIFIED
|
||||
fixed_configured = p['fixed_ips'] is not constants.ATTR_NOT_SPECIFIED
|
||||
if fixed_configured:
|
||||
configured_ips = self._test_fixed_ips_for_port(context,
|
||||
p["network_id"],
|
||||
@ -435,7 +435,7 @@ class IpamNonPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
|
||||
|
||||
# gateway_ip and allocation pools should be validated or generated
|
||||
# only for specific request
|
||||
if subnet['cidr'] is not attributes.ATTR_NOT_SPECIFIED:
|
||||
if subnet['cidr'] is not constants.ATTR_NOT_SPECIFIED:
|
||||
subnet['gateway_ip'] = self._gateway_ip_str(subnet,
|
||||
subnet['cidr'])
|
||||
# allocation_pools are converted to list of IPRanges
|
||||
|
@ -16,6 +16,7 @@
|
||||
import copy
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
@ -23,8 +24,6 @@ from oslo_utils import excutils
|
||||
from sqlalchemy import and_
|
||||
|
||||
from neutron._i18n import _, _LE
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.db import ipam_backend_mixin
|
||||
from neutron.db import models_v2
|
||||
@ -191,7 +190,7 @@ class IpamPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
|
||||
v4, v6_stateful, v6_stateless = self._classify_subnets(
|
||||
context, subnets)
|
||||
|
||||
fixed_configured = p['fixed_ips'] is not attributes.ATTR_NOT_SPECIFIED
|
||||
fixed_configured = p['fixed_ips'] is not constants.ATTR_NOT_SPECIFIED
|
||||
if fixed_configured:
|
||||
ips = self._test_fixed_ips_for_port(context,
|
||||
p["network_id"],
|
||||
@ -411,7 +410,7 @@ class IpamPluggableBackend(ipam_backend_mixin.IpamBackendMixin):
|
||||
|
||||
# gateway_ip and allocation pools should be validated or generated
|
||||
# only for specific request
|
||||
if subnet['cidr'] is not attributes.ATTR_NOT_SPECIFIED:
|
||||
if subnet['cidr'] is not constants.ATTR_NOT_SPECIFIED:
|
||||
subnet['gateway_ip'] = self._gateway_ip_str(subnet,
|
||||
subnet['cidr'])
|
||||
subnet['allocation_pools'] = self._prepare_allocation_pools(
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
@ -26,7 +27,7 @@ from sqlalchemy.orm import joinedload
|
||||
from sqlalchemy import sql
|
||||
|
||||
from neutron._i18n import _, _LE, _LI, _LW
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron import context as n_ctx
|
||||
from neutron.db import agents_db
|
||||
@ -148,8 +149,8 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
|
||||
|
||||
def _get_agent_mode(self, agent_db):
|
||||
agent_conf = self.get_configuration_dict(agent_db)
|
||||
return agent_conf.get(constants.L3_AGENT_MODE,
|
||||
constants.L3_AGENT_MODE_LEGACY)
|
||||
return agent_conf.get(n_const.L3_AGENT_MODE,
|
||||
n_const.L3_AGENT_MODE_LEGACY)
|
||||
|
||||
def validate_agent_router_combination(self, context, agent, router):
|
||||
"""Validate if the router can be correctly assigned to the agent.
|
||||
@ -166,10 +167,10 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
|
||||
|
||||
agent_mode = self._get_agent_mode(agent)
|
||||
|
||||
if agent_mode == constants.L3_AGENT_MODE_DVR:
|
||||
if agent_mode == n_const.L3_AGENT_MODE_DVR:
|
||||
raise l3agentscheduler.DVRL3CannotAssignToDvrAgent()
|
||||
|
||||
if (agent_mode == constants.L3_AGENT_MODE_LEGACY and
|
||||
if (agent_mode == n_const.L3_AGENT_MODE_LEGACY and
|
||||
router.get('distributed')):
|
||||
raise l3agentscheduler.RouterL3AgentMismatch(
|
||||
router_id=router['id'], agent_id=agent['id'])
|
||||
@ -249,7 +250,7 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
|
||||
"""
|
||||
agent = self._get_agent(context, agent_id)
|
||||
agent_mode = self._get_agent_mode(agent)
|
||||
if agent_mode == constants.L3_AGENT_MODE_DVR:
|
||||
if agent_mode == n_const.L3_AGENT_MODE_DVR:
|
||||
raise l3agentscheduler.DVRL3CannotRemoveFromDvrAgent()
|
||||
|
||||
self._unbind_router(context, router_id, agent_id)
|
||||
@ -481,10 +482,10 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
|
||||
continue
|
||||
|
||||
agent_conf = self.get_configuration_dict(l3_agent)
|
||||
agent_mode = agent_conf.get(constants.L3_AGENT_MODE,
|
||||
constants.L3_AGENT_MODE_LEGACY)
|
||||
if (agent_mode == constants.L3_AGENT_MODE_DVR or
|
||||
(agent_mode == constants.L3_AGENT_MODE_LEGACY and
|
||||
agent_mode = agent_conf.get(n_const.L3_AGENT_MODE,
|
||||
n_const.L3_AGENT_MODE_LEGACY)
|
||||
if (agent_mode == n_const.L3_AGENT_MODE_DVR or
|
||||
(agent_mode == n_const.L3_AGENT_MODE_LEGACY and
|
||||
is_router_distributed)):
|
||||
continue
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
import itertools
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as l3_constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
@ -31,7 +32,7 @@ from neutron.callbacks import events
|
||||
from neutron.callbacks import exceptions
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import utils
|
||||
@ -191,7 +192,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
||||
query = (context.session.query(Router.id).
|
||||
filter(
|
||||
Router.id.in_(router_ids),
|
||||
Router.status != l3_constants.ROUTER_STATUS_ALLOCATING))
|
||||
Router.status != n_const.ROUTER_STATUS_ALLOCATING))
|
||||
valid_routers = set(r.id for r in query)
|
||||
if router_ids - valid_routers:
|
||||
LOG.debug("Removing routers that were either concurrently "
|
||||
@ -204,7 +205,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
||||
with context.session.begin(subtransactions=True):
|
||||
# pre-generate id so it will be available when
|
||||
# configuring external gw port
|
||||
status = router.get('status', l3_constants.ROUTER_STATUS_ACTIVE)
|
||||
status = router.get('status', n_const.ROUTER_STATUS_ACTIVE)
|
||||
router_db = Router(id=(router.get('id') or
|
||||
uuidutils.generate_uuid()),
|
||||
tenant_id=tenant_id,
|
||||
@ -240,12 +241,12 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
||||
|
||||
def update_router(self, context, id, router):
|
||||
r = router['router']
|
||||
gw_info = r.pop(EXTERNAL_GW_INFO, attributes.ATTR_NOT_SPECIFIED)
|
||||
gw_info = r.pop(EXTERNAL_GW_INFO, l3_constants.ATTR_NOT_SPECIFIED)
|
||||
# check whether router needs and can be rescheduled to the proper
|
||||
# l3 agent (associated with given external network);
|
||||
# do check before update in DB as an exception will be raised
|
||||
# in case no proper l3 agent found
|
||||
if gw_info != attributes.ATTR_NOT_SPECIFIED:
|
||||
if gw_info != l3_constants.ATTR_NOT_SPECIFIED:
|
||||
candidates = self._check_router_needs_rescheduling(
|
||||
context, id, gw_info)
|
||||
# Update the gateway outside of the DB update since it involves L2
|
||||
@ -330,7 +331,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
||||
# Port has no 'tenant-id', as it is hidden from user
|
||||
port_data = {'tenant_id': '', # intentionally not set
|
||||
'network_id': network_id,
|
||||
'fixed_ips': ext_ips or attributes.ATTR_NOT_SPECIFIED,
|
||||
'fixed_ips': ext_ips or l3_constants.ATTR_NOT_SPECIFIED,
|
||||
'device_id': router['id'],
|
||||
'device_owner': DEVICE_OWNER_ROUTER_GW,
|
||||
'admin_state_up': True,
|
||||
@ -547,7 +548,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
||||
router_subnets.append(ip['subnet_id'])
|
||||
# Ignore temporary Prefix Delegation CIDRs
|
||||
new_subnets = [s for s in new_subnets
|
||||
if s['cidr'] != l3_constants.PROVISIONAL_IPV6_PD_PREFIX]
|
||||
if s['cidr'] != n_const.PROVISIONAL_IPV6_PD_PREFIX]
|
||||
id_filter = {'id': router_subnets}
|
||||
subnets = self._core_plugin.get_subnets(context.elevated(),
|
||||
filters=id_filter)
|
||||
@ -1742,7 +1743,7 @@ def _notify_subnetpool_address_scope_update(resource, event,
|
||||
models_v2.Subnet.network_id == models_v2.Port.network_id)
|
||||
query = query.filter(
|
||||
models_v2.Subnet.subnetpool_id == subnetpool_id,
|
||||
RouterPort.port_type.in_(l3_constants.ROUTER_PORT_OWNERS))
|
||||
RouterPort.port_type.in_(n_const.ROUTER_PORT_OWNERS))
|
||||
query = query.distinct()
|
||||
|
||||
router_ids = [r[0] for r in query]
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
import collections
|
||||
|
||||
from neutron_lib import constants as const
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log_helper
|
||||
@ -54,9 +55,9 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
|
||||
router_device_owners = (
|
||||
l3_db.L3_NAT_db_mixin.router_device_owners +
|
||||
(l3_const.DEVICE_OWNER_DVR_INTERFACE,
|
||||
l3_const.DEVICE_OWNER_ROUTER_SNAT,
|
||||
l3_const.DEVICE_OWNER_AGENT_GW))
|
||||
(const.DEVICE_OWNER_DVR_INTERFACE,
|
||||
const.DEVICE_OWNER_ROUTER_SNAT,
|
||||
const.DEVICE_OWNER_AGENT_GW))
|
||||
|
||||
extra_attributes = (
|
||||
l3_attrs_db.ExtraAttributesMixin.extra_attributes + [{
|
||||
@ -110,8 +111,8 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
self, context, router_id, router_db, data):
|
||||
"""Update the model to support the dvr case of a router."""
|
||||
if data.get('distributed'):
|
||||
old_owner = l3_const.DEVICE_OWNER_ROUTER_INTF
|
||||
new_owner = l3_const.DEVICE_OWNER_DVR_INTERFACE
|
||||
old_owner = const.DEVICE_OWNER_ROUTER_INTF
|
||||
new_owner = const.DEVICE_OWNER_DVR_INTERFACE
|
||||
for rp in router_db.attached_ports.filter_by(port_type=old_owner):
|
||||
rp.port_type = new_owner
|
||||
rp.port.device_owner = new_owner
|
||||
@ -168,7 +169,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
# on all hosts when it is the last gateway port in the
|
||||
# given external network.
|
||||
filters = {'network_id': [gw_ext_net_id],
|
||||
'device_owner': [l3_const.DEVICE_OWNER_ROUTER_GW]}
|
||||
'device_owner': [const.DEVICE_OWNER_ROUTER_GW]}
|
||||
ext_net_gw_ports = self._core_plugin.get_ports(
|
||||
context.elevated(), filters)
|
||||
if not ext_net_gw_ports:
|
||||
@ -198,7 +199,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
if router_is_uuid:
|
||||
router = self._get_router(context, router)
|
||||
if is_distributed_router(router):
|
||||
return l3_const.DEVICE_OWNER_DVR_INTERFACE
|
||||
return const.DEVICE_OWNER_DVR_INTERFACE
|
||||
return super(L3_NAT_with_dvr_db_mixin,
|
||||
self)._get_device_owner(context, router)
|
||||
|
||||
@ -289,7 +290,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
# same network id if one exists
|
||||
cs_port = self._find_router_port_by_network_and_device_owner(
|
||||
router, subnet['network_id'],
|
||||
l3_const.DEVICE_OWNER_ROUTER_SNAT)
|
||||
const.DEVICE_OWNER_ROUTER_SNAT)
|
||||
if cs_port:
|
||||
fixed_ips = list(cs_port['port']['fixed_ips'])
|
||||
fixed_ips.append(fixed_ip)
|
||||
@ -322,7 +323,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
def _port_has_ipv6_address(self, port, csnat_port_check=True):
|
||||
"""Overridden to return False if DVR SNAT port."""
|
||||
if csnat_port_check:
|
||||
if port['device_owner'] == l3_const.DEVICE_OWNER_ROUTER_SNAT:
|
||||
if port['device_owner'] == const.DEVICE_OWNER_ROUTER_SNAT:
|
||||
return False
|
||||
return super(L3_NAT_with_dvr_db_mixin,
|
||||
self)._port_has_ipv6_address(port)
|
||||
@ -350,7 +351,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
# If router has a gateway port, check if it has IPV6 subnet
|
||||
cs_port = (
|
||||
self._find_router_port_by_network_and_device_owner(
|
||||
router, network_id, l3_const.DEVICE_OWNER_ROUTER_SNAT))
|
||||
router, network_id, const.DEVICE_OWNER_ROUTER_SNAT))
|
||||
if cs_port:
|
||||
fixed_ips = (
|
||||
[fixedip for fixedip in
|
||||
@ -415,7 +416,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
qry = context.session.query(l3_db.RouterPort)
|
||||
qry = qry.filter(
|
||||
l3_db.RouterPort.router_id.in_(router_ids),
|
||||
l3_db.RouterPort.port_type == l3_const.DEVICE_OWNER_ROUTER_SNAT
|
||||
l3_db.RouterPort.port_type == const.DEVICE_OWNER_ROUTER_SNAT
|
||||
)
|
||||
interfaces = collections.defaultdict(list)
|
||||
for rp in qry:
|
||||
@ -472,14 +473,14 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
for floating_ip in floating_ips:
|
||||
router = routers_dict.get(floating_ip['router_id'])
|
||||
if router:
|
||||
router_floatingips = router.get(l3_const.FLOATINGIP_KEY, [])
|
||||
router_floatingips = router.get(const.FLOATINGIP_KEY, [])
|
||||
if router['distributed']:
|
||||
if (floating_ip.get('host', None) != host and
|
||||
floating_ip.get('dest_host') is None):
|
||||
continue
|
||||
LOG.debug("Floating IP host: %s", floating_ip['host'])
|
||||
router_floatingips.append(floating_ip)
|
||||
router[l3_const.FLOATINGIP_KEY] = router_floatingips
|
||||
router[const.FLOATINGIP_KEY] = router_floatingips
|
||||
if not fip_sync_interfaces:
|
||||
fip_sync_interfaces = self._get_fip_sync_interfaces(
|
||||
context, agent.id)
|
||||
@ -492,7 +493,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
if not fip_agent_id:
|
||||
return []
|
||||
filters = {'device_id': [fip_agent_id],
|
||||
'device_owner': [l3_const.DEVICE_OWNER_AGENT_GW]}
|
||||
'device_owner': [const.DEVICE_OWNER_AGENT_GW]}
|
||||
interfaces = self._core_plugin.get_ports(context.elevated(), filters)
|
||||
LOG.debug("Return the FIP ports: %s ", interfaces)
|
||||
return interfaces
|
||||
@ -502,7 +503,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
active=None):
|
||||
routers, interfaces, floating_ips = self._get_router_info_list(
|
||||
context, router_ids=router_ids, active=active,
|
||||
device_owners=l3_const.ROUTER_INTERFACE_OWNERS)
|
||||
device_owners=const.ROUTER_INTERFACE_OWNERS)
|
||||
dvr_router_ids = set(router['id'] for router in routers
|
||||
if is_distributed_router(router))
|
||||
floating_ip_port_ids = [fip['port_id'] for fip in floating_ips
|
||||
@ -576,7 +577,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
filters = {
|
||||
'network_id': [network_id],
|
||||
'device_id': [agent_id],
|
||||
'device_owner': [l3_const.DEVICE_OWNER_AGENT_GW]
|
||||
'device_owner': [const.DEVICE_OWNER_AGENT_GW]
|
||||
}
|
||||
ports = self._core_plugin.get_ports(context, filters)
|
||||
if ports:
|
||||
@ -586,7 +587,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
self, context, host_id, ext_net_id):
|
||||
"""Function to delete FIP gateway port with given ext_net_id."""
|
||||
# delete any fip agent gw port
|
||||
device_filter = {'device_owner': [l3_const.DEVICE_OWNER_AGENT_GW],
|
||||
device_filter = {'device_owner': [const.DEVICE_OWNER_AGENT_GW],
|
||||
'network_id': [ext_net_id]}
|
||||
ports = self._core_plugin.get_ports(context,
|
||||
filters=device_filter)
|
||||
@ -620,7 +621,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
create a new one.
|
||||
"""
|
||||
l3_agent_db = self._get_agent_by_type_and_host(
|
||||
context, l3_const.AGENT_TYPE_L3, host)
|
||||
context, const.AGENT_TYPE_L3, host)
|
||||
if l3_agent_db:
|
||||
LOG.debug("Agent ID exists: %s", l3_agent_db['id'])
|
||||
f_port = self._get_agent_gw_ports_exist_for_network(
|
||||
@ -631,7 +632,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
port_data = {'tenant_id': '',
|
||||
'network_id': network_id,
|
||||
'device_id': l3_agent_db['id'],
|
||||
'device_owner': l3_const.DEVICE_OWNER_AGENT_GW,
|
||||
'device_owner': const.DEVICE_OWNER_AGENT_GW,
|
||||
portbindings.HOST_ID: host,
|
||||
'admin_state_up': True,
|
||||
'name': ''}
|
||||
@ -652,7 +653,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
qry = context.session.query(l3_db.RouterPort)
|
||||
qry = qry.filter_by(
|
||||
router_id=router_id,
|
||||
port_type=l3_const.DEVICE_OWNER_ROUTER_SNAT
|
||||
port_type=const.DEVICE_OWNER_ROUTER_SNAT
|
||||
)
|
||||
|
||||
ports = [self._core_plugin._make_port_dict(rp.port, None)
|
||||
@ -666,7 +667,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
'network_id': network_id,
|
||||
'fixed_ips': [{'subnet_id': subnet_id}],
|
||||
'device_id': router.id,
|
||||
'device_owner': l3_const.DEVICE_OWNER_ROUTER_SNAT,
|
||||
'device_owner': const.DEVICE_OWNER_ROUTER_SNAT,
|
||||
'admin_state_up': True,
|
||||
'name': ''}
|
||||
snat_port = p_utils.create_port(self._core_plugin, context,
|
||||
@ -679,7 +680,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
router_port = l3_db.RouterPort(
|
||||
port_id=snat_port['id'],
|
||||
router_id=router.id,
|
||||
port_type=l3_const.DEVICE_OWNER_ROUTER_SNAT
|
||||
port_type=const.DEVICE_OWNER_ROUTER_SNAT
|
||||
)
|
||||
context.session.add(router_port)
|
||||
|
||||
@ -705,7 +706,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
int_ports = (
|
||||
rp.port for rp in
|
||||
router.attached_ports.filter_by(
|
||||
port_type=l3_const.DEVICE_OWNER_DVR_INTERFACE
|
||||
port_type=const.DEVICE_OWNER_DVR_INTERFACE
|
||||
)
|
||||
)
|
||||
LOG.info(_LI('SNAT interface port list does not exist,'
|
||||
@ -729,7 +730,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
ip_address = fixed_ip['ip_address']
|
||||
subnet = fixed_ip['subnet_id']
|
||||
filters = {'fixed_ips': {'subnet_id': [subnet]},
|
||||
'device_owner': [l3_const.DEVICE_OWNER_DVR_INTERFACE]}
|
||||
'device_owner': [const.DEVICE_OWNER_DVR_INTERFACE]}
|
||||
ports = self._core_plugin.get_ports(context, filters=filters)
|
||||
router_id = next((port['device_id'] for port in ports), None)
|
||||
if not router_id:
|
||||
@ -807,7 +808,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
ports = [
|
||||
rp.port.id for rp in
|
||||
router.attached_ports.filter_by(
|
||||
port_type=l3_const.DEVICE_OWNER_ROUTER_SNAT)
|
||||
port_type=const.DEVICE_OWNER_ROUTER_SNAT)
|
||||
if rp.port
|
||||
]
|
||||
|
||||
@ -828,7 +829,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
l3_port_check=False)
|
||||
|
||||
def create_floatingip(self, context, floatingip,
|
||||
initial_status=l3_const.FLOATINGIP_STATUS_ACTIVE):
|
||||
initial_status=const.FLOATINGIP_STATUS_ACTIVE):
|
||||
floating_ip = self._create_floatingip(
|
||||
context, floatingip, initial_status)
|
||||
self._notify_floating_ip_change(context, floating_ip)
|
||||
@ -878,7 +879,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||
def _get_address_pair_active_port_with_fip(
|
||||
self, context, port_dict, port_addr_pair_ip):
|
||||
port_valid_state = (port_dict['admin_state_up'] or
|
||||
(port_dict['status'] == l3_const.PORT_STATUS_ACTIVE))
|
||||
(port_dict['status'] == const.PORT_STATUS_ACTIVE))
|
||||
if not port_valid_state:
|
||||
return
|
||||
query = context.session.query(l3_db.FloatingIP).filter(
|
||||
|
@ -13,13 +13,14 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy import or_
|
||||
|
||||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import constants as const
|
||||
from neutron.common import utils as n_utils
|
||||
|
||||
from neutron.db import agentschedulers_db
|
||||
@ -286,8 +287,8 @@ class L3_DVRsch_db_mixin(l3agent_sch_db.L3AgentSchedulerDbMixin):
|
||||
|
||||
# dvr routers are not explicitly scheduled to agents on hosts with
|
||||
# dvr serviceable ports, so need special handling
|
||||
if self._get_agent_mode(agent_db) in [n_const.L3_AGENT_MODE_DVR,
|
||||
n_const.L3_AGENT_MODE_DVR_SNAT]:
|
||||
if self._get_agent_mode(agent_db) in [const.L3_AGENT_MODE_DVR,
|
||||
const.L3_AGENT_MODE_DVR_SNAT]:
|
||||
if not router_ids:
|
||||
result_set |= set(self._get_dvr_router_ids_for_host(
|
||||
context, agent_db['host']))
|
||||
|
@ -16,6 +16,7 @@
|
||||
import functools
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@ -29,7 +30,7 @@ from sqlalchemy import orm
|
||||
|
||||
from neutron._i18n import _, _LI
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron.db import agents_db
|
||||
from neutron.db.availability_zone import router as router_az_db
|
||||
@ -60,12 +61,12 @@ L3_HA_OPTS = [
|
||||
"scheduled on. If it is set to 0 then the router will "
|
||||
"be scheduled on every agent.")),
|
||||
cfg.IntOpt('min_l3_agents_per_router',
|
||||
default=constants.MINIMUM_AGENTS_FOR_HA,
|
||||
default=n_const.MINIMUM_AGENTS_FOR_HA,
|
||||
help=_("Minimum number of L3 agents which a HA router will be "
|
||||
"scheduled on. If it is set to 0 then the router will "
|
||||
"be scheduled on every agent.")),
|
||||
cfg.StrOpt('l3_ha_net_cidr',
|
||||
default=constants.L3_HA_NET_CIDR,
|
||||
default=n_const.L3_HA_NET_CIDR,
|
||||
help=_('Subnet used for the l3 HA admin network.')),
|
||||
cfg.StrOpt('l3_ha_network_type', default='',
|
||||
help=_("The network type to use when creating the HA network "
|
||||
@ -109,11 +110,11 @@ class L3HARouterAgentPortBinding(model_base.BASEV2):
|
||||
ondelete='CASCADE'))
|
||||
agent = orm.relationship(agents_db.Agent)
|
||||
|
||||
state = sa.Column(sa.Enum(constants.HA_ROUTER_STATE_ACTIVE,
|
||||
constants.HA_ROUTER_STATE_STANDBY,
|
||||
state = sa.Column(sa.Enum(n_const.HA_ROUTER_STATE_ACTIVE,
|
||||
n_const.HA_ROUTER_STATE_STANDBY,
|
||||
name='l3_ha_states'),
|
||||
default=constants.HA_ROUTER_STATE_STANDBY,
|
||||
server_default=constants.HA_ROUTER_STATE_STANDBY)
|
||||
default=n_const.HA_ROUTER_STATE_STANDBY,
|
||||
server_default=n_const.HA_ROUTER_STATE_STANDBY)
|
||||
|
||||
|
||||
class L3HARouterNetwork(model_base.BASEV2):
|
||||
@ -177,7 +178,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
raise l3_ha.HAMaximumAgentsNumberNotValid(
|
||||
max_agents=max_agents, min_agents=min_agents)
|
||||
|
||||
if min_agents < constants.MINIMUM_AGENTS_FOR_HA:
|
||||
if min_agents < n_const.MINIMUM_AGENTS_FOR_HA:
|
||||
raise l3_ha.HAMinimumAgentsNumberNotValid()
|
||||
|
||||
def __init__(self):
|
||||
@ -242,7 +243,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
def _create_ha_subnet(self, context, network_id, tenant_id):
|
||||
args = {'network_id': network_id,
|
||||
'tenant_id': '',
|
||||
'name': constants.HA_SUBNET_NAME % tenant_id,
|
||||
'name': n_const.HA_SUBNET_NAME % tenant_id,
|
||||
'ip_version': 4,
|
||||
'cidr': cfg.CONF.l3_ha_net_cidr,
|
||||
'enable_dhcp': False,
|
||||
@ -281,7 +282,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
admin_ctx = context.elevated()
|
||||
|
||||
args = {'network':
|
||||
{'name': constants.HA_NETWORK_NAME % tenant_id,
|
||||
{'name': n_const.HA_NETWORK_NAME % tenant_id,
|
||||
'tenant_id': '',
|
||||
'shared': False,
|
||||
'admin_state_up': True}}
|
||||
@ -313,8 +314,8 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
|
||||
min_agents = cfg.CONF.min_l3_agents_per_router
|
||||
num_agents = len(self.get_l3_agents(context, active=True,
|
||||
filters={'agent_modes': [constants.L3_AGENT_MODE_LEGACY,
|
||||
constants.L3_AGENT_MODE_DVR_SNAT]}))
|
||||
filters={'agent_modes': [n_const.L3_AGENT_MODE_LEGACY,
|
||||
n_const.L3_AGENT_MODE_DVR_SNAT]}))
|
||||
max_agents = cfg.CONF.max_l3_agents_per_router
|
||||
if max_agents:
|
||||
if max_agents > num_agents:
|
||||
@ -363,7 +364,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
'admin_state_up': True,
|
||||
'device_id': router_id,
|
||||
'device_owner': constants.DEVICE_OWNER_ROUTER_HA_INTF,
|
||||
'name': constants.HA_PORT_NAME % tenant_id}
|
||||
'name': n_const.HA_PORT_NAME % tenant_id}
|
||||
creation = functools.partial(p_utils.create_port, self._core_plugin,
|
||||
context, {'port': args})
|
||||
content = functools.partial(self._create_ha_port_binding, context,
|
||||
@ -455,7 +456,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
if is_ha:
|
||||
# we set the allocating status to hide it from the L3 agents
|
||||
# until we have created all of the requisite interfaces/networks
|
||||
router['router']['status'] = constants.ROUTER_STATUS_ALLOCATING
|
||||
router['router']['status'] = n_const.ROUTER_STATUS_ALLOCATING
|
||||
|
||||
router_dict = super(L3_HA_NAT_db_mixin,
|
||||
self).create_router(context, router)
|
||||
@ -473,7 +474,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
self.schedule_router(context, router_dict['id'])
|
||||
router_dict['status'] = self._update_router_db(
|
||||
context, router_dict['id'],
|
||||
{'status': constants.ROUTER_STATUS_ACTIVE})['status']
|
||||
{'status': n_const.ROUTER_STATUS_ACTIVE})['status']
|
||||
self._notify_ha_interfaces_updated(context, router_db.id,
|
||||
schedule_routers=False)
|
||||
except Exception:
|
||||
@ -525,7 +526,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
# Keep in mind that if we want conversion to be hitless, this
|
||||
# status cannot be used because agents treat hidden routers as
|
||||
# deleted routers.
|
||||
data['status'] = constants.ROUTER_STATUS_ALLOCATING
|
||||
data['status'] = n_const.ROUTER_STATUS_ALLOCATING
|
||||
|
||||
with context.session.begin(subtransactions=True):
|
||||
router_db = super(L3_HA_NAT_db_mixin, self)._update_router_db(
|
||||
@ -557,7 +558,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
|
||||
self.schedule_router(context, router_id)
|
||||
router_db = super(L3_HA_NAT_db_mixin, self)._update_router_db(
|
||||
context, router_id, {'status': constants.ROUTER_STATUS_ACTIVE})
|
||||
context, router_id, {'status': n_const.ROUTER_STATUS_ACTIVE})
|
||||
self._notify_ha_interfaces_updated(context, router_db.id,
|
||||
schedule_routers=False)
|
||||
|
||||
@ -638,11 +639,11 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
bindings = self.get_ha_router_port_bindings(context, [router_id])
|
||||
dead_agents = [
|
||||
binding.agent for binding in bindings
|
||||
if binding.state == constants.HA_ROUTER_STATE_ACTIVE and
|
||||
if binding.state == n_const.HA_ROUTER_STATE_ACTIVE and
|
||||
not binding.agent.is_active]
|
||||
for dead_agent in dead_agents:
|
||||
self.update_routers_states(
|
||||
context, {router_id: constants.HA_ROUTER_STATE_STANDBY},
|
||||
context, {router_id: n_const.HA_ROUTER_STATE_STANDBY},
|
||||
dead_agent.host)
|
||||
|
||||
if dead_agents:
|
||||
@ -668,7 +669,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
# and l2pop would not work correctly.
|
||||
return next(
|
||||
(agent.host for agent, state in bindings
|
||||
if state == constants.HA_ROUTER_STATE_ACTIVE),
|
||||
if state == n_const.HA_ROUTER_STATE_ACTIVE),
|
||||
None)
|
||||
|
||||
@log_helpers.log_method_call
|
||||
@ -683,7 +684,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
|
||||
router = routers_dict.get(binding.router_id)
|
||||
router[constants.HA_INTERFACE_KEY] = port_dict
|
||||
router[constants.HA_ROUTER_STATE_KEY] = binding.state
|
||||
router[n_const.HA_ROUTER_STATE_KEY] = binding.state
|
||||
|
||||
for router in routers_dict.values():
|
||||
interface = router.get(constants.HA_INTERFACE_KEY)
|
||||
@ -696,8 +697,8 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
def get_ha_sync_data_for_host(self, context, host, agent,
|
||||
router_ids=None, active=None):
|
||||
agent_mode = self._get_agent_mode(agent)
|
||||
dvr_agent_mode = (agent_mode in [constants.L3_AGENT_MODE_DVR_SNAT,
|
||||
constants.L3_AGENT_MODE_DVR])
|
||||
dvr_agent_mode = (agent_mode in [n_const.L3_AGENT_MODE_DVR_SNAT,
|
||||
n_const.L3_AGENT_MODE_DVR])
|
||||
if (dvr_agent_mode and n_utils.is_extension_supported(
|
||||
self, constants.L3_DISTRIBUTED_EXT_ALIAS)):
|
||||
# DVR has to be handled differently
|
||||
@ -734,7 +735,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
|
||||
constants.DEVICE_OWNER_ROUTER_SNAT]}
|
||||
ports = self._core_plugin.get_ports(admin_ctx, filters=device_filter)
|
||||
active_ports = (port for port in ports
|
||||
if states[port['device_id']] == constants.HA_ROUTER_STATE_ACTIVE)
|
||||
if states[port['device_id']] == n_const.HA_ROUTER_STATE_ACTIVE)
|
||||
|
||||
for port in active_ports:
|
||||
port[portbindings.HOST_ID] = host
|
||||
|
@ -12,11 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as consts
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron._i18n import _LE
|
||||
from neutron.common import constants as consts
|
||||
from neutron.common import utils
|
||||
from neutron import manager
|
||||
from neutron.plugins.common import constants as service_constants
|
||||
|
@ -26,10 +26,9 @@ revision = '7bbb25278f53'
|
||||
down_revision = '4ffceebfcdc'
|
||||
|
||||
from alembic import op
|
||||
from neutron_lib import constants
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.common import constants
|
||||
|
||||
|
||||
ROUTER_ATTR_TABLE = 'router_extra_attributes'
|
||||
ROUTER_PORTS_TABLE = 'routerports'
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
@ -27,7 +28,7 @@ from neutron.callbacks import events
|
||||
from neutron.callbacks import exceptions
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db import db_base_plugin_v2
|
||||
@ -420,8 +421,8 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
||||
# problems with comparing int and string in PostgreSQL. Here this
|
||||
# string is converted to int to give an opportunity to use it as
|
||||
# before.
|
||||
if protocol in constants.IP_PROTOCOL_NAME_ALIASES:
|
||||
protocol = constants.IP_PROTOCOL_NAME_ALIASES[protocol]
|
||||
if protocol in n_const.IP_PROTOCOL_NAME_ALIASES:
|
||||
protocol = n_const.IP_PROTOCOL_NAME_ALIASES[protocol]
|
||||
return int(constants.IP_PROTOCOL_MAP.get(protocol, protocol))
|
||||
|
||||
def _get_ip_proto_name_and_num(self, protocol):
|
||||
@ -430,8 +431,8 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
||||
protocol = str(protocol)
|
||||
if protocol in constants.IP_PROTOCOL_MAP:
|
||||
return [protocol, str(constants.IP_PROTOCOL_MAP.get(protocol))]
|
||||
elif protocol in constants.IP_PROTOCOL_NUM_TO_NAME_MAP:
|
||||
return [constants.IP_PROTOCOL_NUM_TO_NAME_MAP.get(protocol),
|
||||
elif protocol in n_const.IP_PROTOCOL_NUM_TO_NAME_MAP:
|
||||
return [n_const.IP_PROTOCOL_NUM_TO_NAME_MAP.get(protocol),
|
||||
protocol]
|
||||
return [protocol, protocol]
|
||||
|
||||
@ -468,7 +469,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
||||
if rule['protocol'] in [constants.PROTO_NAME_IPV6_ENCAP,
|
||||
constants.PROTO_NAME_IPV6_FRAG,
|
||||
constants.PROTO_NAME_IPV6_ICMP,
|
||||
constants.PROTO_NAME_IPV6_ICMP_LEGACY,
|
||||
n_const.PROTO_NAME_IPV6_ICMP_LEGACY,
|
||||
constants.PROTO_NAME_IPV6_NONXT,
|
||||
constants.PROTO_NAME_IPV6_OPTS,
|
||||
constants.PROTO_NAME_IPV6_ROUTE]:
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as const
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
@ -32,7 +33,7 @@ LOG = logging.getLogger(__name__)
|
||||
DIRECTION_IP_PREFIX = {'ingress': 'source_ip_prefix',
|
||||
'egress': 'dest_ip_prefix'}
|
||||
|
||||
DHCP_RULE_PORT = {4: (67, 68, n_const.IPv4), 6: (547, 546, n_const.IPv6)}
|
||||
DHCP_RULE_PORT = {4: (67, 68, const.IPv4), 6: (547, 546, const.IPv6)}
|
||||
|
||||
|
||||
class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
|
||||
@ -133,7 +134,7 @@ class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
|
||||
sg_provider_updated_networks = set()
|
||||
sec_groups = set()
|
||||
for port in ports:
|
||||
if port['device_owner'] == n_const.DEVICE_OWNER_DHCP:
|
||||
if port['device_owner'] == const.DEVICE_OWNER_DHCP:
|
||||
sg_provider_updated_networks.add(
|
||||
port['network_id'])
|
||||
# For IPv6, provider rule need to be updated in case router
|
||||
@ -141,7 +142,7 @@ class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
|
||||
# NOTE (Swami): ROUTER_INTERFACE_OWNERS check is required
|
||||
# since it includes the legacy router interface device owners
|
||||
# and DVR router interface device owners.
|
||||
elif port['device_owner'] in n_const.ROUTER_INTERFACE_OWNERS:
|
||||
elif port['device_owner'] in const.ROUTER_INTERFACE_OWNERS:
|
||||
if any(netaddr.IPAddress(fixed_ip['ip_address']).version == 6
|
||||
for fixed_ip in port['fixed_ips']):
|
||||
sg_provider_updated_networks.add(
|
||||
@ -308,7 +309,7 @@ class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
|
||||
models_v2.IPAllocation.ip_address)
|
||||
query = query.join(models_v2.IPAllocation)
|
||||
query = query.filter(models_v2.Port.network_id.in_(network_ids))
|
||||
owner = n_const.DEVICE_OWNER_DHCP
|
||||
owner = const.DEVICE_OWNER_DHCP
|
||||
query = query.filter(models_v2.Port.device_owner == owner)
|
||||
ips = {}
|
||||
|
||||
@ -371,7 +372,7 @@ class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
|
||||
query = query.filter(
|
||||
models_v2.IPAllocation.ip_address == subnet['gateway_ip'])
|
||||
query = query.filter(
|
||||
models_v2.Port.device_owner.in_(n_const.ROUTER_INTERFACE_OWNERS))
|
||||
models_v2.Port.device_owner.in_(const.ROUTER_INTERFACE_OWNERS))
|
||||
try:
|
||||
mac_address = query.one()[0]
|
||||
except (exc.NoResultFound, exc.MultipleResultsFound):
|
||||
@ -431,10 +432,10 @@ class SecurityGroupServerRpcMixin(sg_db.SecurityGroupDbMixin):
|
||||
ra_ips = ips.get(port['network_id'])
|
||||
for ra_ip in ra_ips:
|
||||
ra_rule = {'direction': 'ingress',
|
||||
'ethertype': n_const.IPv6,
|
||||
'protocol': n_const.PROTO_NAME_IPV6_ICMP,
|
||||
'ethertype': const.IPv6,
|
||||
'protocol': const.PROTO_NAME_IPV6_ICMP,
|
||||
'source_ip_prefix': ra_ip,
|
||||
'source_port_range_min': n_const.ICMPV6_TYPE_RA}
|
||||
'source_port_range_min': const.ICMPV6_TYPE_RA}
|
||||
port['security_group_rules'].append(ra_rule)
|
||||
|
||||
def _apply_provider_rule(self, context, ports):
|
||||
|
@ -17,12 +17,12 @@ import shlex
|
||||
import socket
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _LW
|
||||
from neutron.agent.linux import dhcp
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import constants
|
||||
from neutron.extensions import portbindings
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import abc
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as nexception
|
||||
import six
|
||||
|
||||
@ -62,7 +63,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
attr.SUBNETPOOLS: {
|
||||
ADDRESS_SCOPE_ID: {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'validate': {'type:uuid_or_none': None},
|
||||
'is_visible': True}
|
||||
},
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as nexception
|
||||
from oslo_config import cfg
|
||||
import webob.exc
|
||||
@ -103,7 +104,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'validate': {'type:validate_allowed_address_pairs':
|
||||
None},
|
||||
'enforce_policy': True,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True},
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
|
||||
|
||||
EXTENDED_ATTRIBUTES_2_0 = {
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
import abc
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
|
||||
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
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.extensions import agent
|
||||
from neutron import manager
|
||||
|
@ -14,13 +14,13 @@
|
||||
|
||||
import abc
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
import six
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
|
||||
DISTRIBUTED = 'distributed'
|
||||
EXTENDED_ATTRIBUTES_2_0 = {
|
||||
@ -28,7 +28,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
DISTRIBUTED: {'allow_post': True,
|
||||
'allow_put': True,
|
||||
'is_visible': True,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'convert_to': attributes.convert_to_boolean_if_not_none,
|
||||
'enforce_policy': True},
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as nexception
|
||||
|
||||
from neutron._i18n import _
|
||||
@ -41,7 +42,8 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'routes': {'allow_post': False, 'allow_put': True,
|
||||
'validate': {'type:hostroutes': None},
|
||||
'convert_to': attr.convert_none_to_empty_list,
|
||||
'is_visible': True, 'default': attr.ATTR_NOT_SPECIFIED},
|
||||
'is_visible': True,
|
||||
'default': constants.ATTR_NOT_SPECIFIED},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,19 +12,19 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
|
||||
HA_INFO = 'ha'
|
||||
EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'routers': {
|
||||
HA_INFO: {'allow_post': True, 'allow_put': True,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED, 'is_visible': True,
|
||||
'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True,
|
||||
'enforce_policy': True,
|
||||
'convert_to': attributes.convert_to_boolean_if_not_none}
|
||||
}
|
||||
@ -90,7 +90,7 @@ class HAMaximumAgentsNumberNotValid(exceptions.NeutronException):
|
||||
class HAMinimumAgentsNumberNotValid(exceptions.NeutronException):
|
||||
message = (_("min_l3_agents_per_router config parameter is not valid. "
|
||||
"It has to be equal to or more than %s for HA.") %
|
||||
constants.MINIMUM_AGENTS_FOR_HA)
|
||||
n_const.MINIMUM_AGENTS_FOR_HA)
|
||||
|
||||
|
||||
class L3_ext_ha_mode(extensions.ExtensionDescriptor):
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import abc
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_log import log as logging
|
||||
import webob.exc
|
||||
@ -23,7 +24,6 @@ from neutron._i18n import _, _LE
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
from neutron.api.v2 import resource
|
||||
from neutron.common import constants
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.extensions import agent
|
||||
from neutron import manager
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as nexception
|
||||
import webob.exc
|
||||
|
||||
@ -34,14 +35,14 @@ class SegmentsContainDuplicateEntry(nexception.InvalidInput):
|
||||
|
||||
def _convert_and_validate_segments(segments, valid_values=None):
|
||||
for segment in segments:
|
||||
segment.setdefault(pnet.NETWORK_TYPE, attr.ATTR_NOT_SPECIFIED)
|
||||
segment.setdefault(pnet.PHYSICAL_NETWORK, attr.ATTR_NOT_SPECIFIED)
|
||||
segment.setdefault(pnet.NETWORK_TYPE, constants.ATTR_NOT_SPECIFIED)
|
||||
segment.setdefault(pnet.PHYSICAL_NETWORK, constants.ATTR_NOT_SPECIFIED)
|
||||
segmentation_id = segment.get(pnet.SEGMENTATION_ID)
|
||||
if segmentation_id:
|
||||
segment[pnet.SEGMENTATION_ID] = attr.convert_to_int(
|
||||
segmentation_id)
|
||||
else:
|
||||
segment[pnet.SEGMENTATION_ID] = attr.ATTR_NOT_SPECIFIED
|
||||
segment[pnet.SEGMENTATION_ID] = constants.ATTR_NOT_SPECIFIED
|
||||
if len(segment.keys()) != 3:
|
||||
msg = (_("Unrecognized attribute(s) '%s'") %
|
||||
', '.join(set(segment.keys()) -
|
||||
@ -75,7 +76,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
SEGMENTS: {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:convert_segments': None},
|
||||
'convert_list_to': attr.convert_kvp_list_to_dict,
|
||||
'default': attr.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'enforce_policy': True,
|
||||
'is_visible': True},
|
||||
}
|
||||
|
@ -13,8 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
|
||||
# The type of vnic that this port should be attached to
|
||||
VNIC_TYPE = 'binding:vnic_type'
|
||||
@ -102,11 +103,11 @@ VNIC_TYPES = [VNIC_NORMAL, VNIC_DIRECT, VNIC_MACVTAP, VNIC_BAREMETAL,
|
||||
EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'ports': {
|
||||
VIF_TYPE: {'allow_post': False, 'allow_put': False,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'enforce_policy': True,
|
||||
'is_visible': True},
|
||||
VIF_DETAILS: {'allow_post': False, 'allow_put': False,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'enforce_policy': True,
|
||||
'is_visible': True},
|
||||
VNIC_TYPE: {'allow_post': True, 'allow_put': True,
|
||||
@ -115,11 +116,11 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'validate': {'type:values': VNIC_TYPES},
|
||||
'enforce_policy': True},
|
||||
HOST_ID: {'allow_post': True, 'allow_put': True,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'enforce_policy': True},
|
||||
PROFILE: {'allow_post': True, 'allow_put': True,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'enforce_policy': True,
|
||||
'validate': {'type:dict_or_none': None},
|
||||
'is_visible': True},
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as nexception
|
||||
|
||||
from neutron._i18n import _
|
||||
@ -44,7 +45,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'ports': {
|
||||
PORTSECURITY: {'allow_post': True, 'allow_put': True,
|
||||
'convert_to': attributes.convert_to_boolean,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'enforce_policy': True,
|
||||
'is_visible': True},
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
from neutron._i18n import _
|
||||
@ -33,19 +34,19 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'networks': {
|
||||
NETWORK_TYPE: {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:string': NETWORK_TYPE_MAX_LEN},
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'enforce_policy': True,
|
||||
'is_visible': True},
|
||||
PHYSICAL_NETWORK: {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:string':
|
||||
PHYSICAL_NETWORK_MAX_LEN},
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'enforce_policy': True,
|
||||
'is_visible': True},
|
||||
SEGMENTATION_ID: {'allow_post': True, 'allow_put': True,
|
||||
'convert_to': attributes.convert_to_int,
|
||||
'enforce_policy': True,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True},
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
import abc
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as const
|
||||
from neutron_lib import exceptions as nexception
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
@ -25,7 +26,7 @@ from neutron._i18n import _
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.api.v2 import base
|
||||
from neutron.common import constants as const
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions
|
||||
from neutron import manager
|
||||
from neutron.quota import resource_registry
|
||||
@ -217,7 +218,7 @@ attr.validators['type:name_not_default'] = _validate_name_not_default
|
||||
# in neutron.common.constants. IP_PROTOCOL_MAP in neutron-lib should
|
||||
# be updated and neutron should consume it once Mitaka backport is done.
|
||||
sg_supported_protocols = ([None] + list(const.IP_PROTOCOL_MAP.keys()) +
|
||||
list(const.IP_PROTOCOL_NAME_ALIASES.keys()))
|
||||
list(n_const.IP_PROTOCOL_NAME_ALIASES.keys()))
|
||||
sg_supported_ethertypes = ['IPv4', 'IPv6']
|
||||
SECURITYGROUPS = 'security_groups'
|
||||
SECURITYGROUPRULES = 'security_group_rules'
|
||||
@ -283,7 +284,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'allow_put': True,
|
||||
'is_visible': True,
|
||||
'convert_to': convert_to_uuid_list_or_none,
|
||||
'default': attr.ATTR_NOT_SPECIFIED}}}
|
||||
'default': const.ATTR_NOT_SPECIFIED}}}
|
||||
security_group_quota_opts = [
|
||||
cfg.IntOpt('quota_security_group',
|
||||
default=10,
|
||||
|
@ -13,8 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.common import constants
|
||||
|
||||
|
||||
class Subnetallocation(extensions.ExtensionDescriptor):
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -33,7 +34,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
|
||||
'networks': {
|
||||
VLANTRANSPARENT: {'allow_post': True, 'allow_put': False,
|
||||
'convert_to': attributes.convert_to_boolean,
|
||||
'default': attributes.ATTR_NOT_SPECIFIED,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True},
|
||||
},
|
||||
}
|
||||
|
@ -13,12 +13,12 @@
|
||||
import abc
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.ipam import exceptions as ipam_exc
|
||||
|
@ -17,13 +17,12 @@ import math
|
||||
import operator
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as lib_exc
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import models_v2
|
||||
from neutron.ipam import driver
|
||||
@ -259,8 +258,8 @@ class SubnetPoolReader(object):
|
||||
return netaddr.IPNetwork(cidr).prefixlen
|
||||
|
||||
def _read_id(self, subnetpool):
|
||||
id = subnetpool.get('id', attributes.ATTR_NOT_SPECIFIED)
|
||||
if id is attributes.ATTR_NOT_SPECIFIED:
|
||||
id = subnetpool.get('id', constants.ATTR_NOT_SPECIFIED)
|
||||
if id is constants.ATTR_NOT_SPECIFIED:
|
||||
id = uuidutils.generate_uuid()
|
||||
self.id = id
|
||||
|
||||
@ -291,13 +290,13 @@ class SubnetPoolReader(object):
|
||||
prefixlen_attr = type + '_prefixlen'
|
||||
prefix_attr = type + '_prefix'
|
||||
prefixlen = subnetpool.get(prefixlen_attr,
|
||||
attributes.ATTR_NOT_SPECIFIED)
|
||||
constants.ATTR_NOT_SPECIFIED)
|
||||
wildcard = self._sp_helper.wildcard(self.ip_version)
|
||||
|
||||
if prefixlen is attributes.ATTR_NOT_SPECIFIED and default_bound:
|
||||
if prefixlen is constants.ATTR_NOT_SPECIFIED and default_bound:
|
||||
prefixlen = default_bound
|
||||
|
||||
if prefixlen is not attributes.ATTR_NOT_SPECIFIED:
|
||||
if prefixlen is not constants.ATTR_NOT_SPECIFIED:
|
||||
prefix_cidr = '/'.join((wildcard,
|
||||
str(prefixlen)))
|
||||
setattr(self, prefix_attr, prefix_cidr)
|
||||
@ -316,7 +315,7 @@ class SubnetPoolReader(object):
|
||||
raise n_exc.PrefixVersionMismatch()
|
||||
self.default_quota = subnetpool.get('default_quota')
|
||||
|
||||
if self.default_quota is attributes.ATTR_NOT_SPECIFIED:
|
||||
if self.default_quota is constants.ATTR_NOT_SPECIFIED:
|
||||
self.default_quota = None
|
||||
|
||||
self.ip_version = ip_version
|
||||
@ -324,7 +323,7 @@ class SubnetPoolReader(object):
|
||||
|
||||
def _read_address_scope(self, subnetpool):
|
||||
self.address_scope_id = subnetpool.get('address_scope_id',
|
||||
attributes.ATTR_NOT_SPECIFIED)
|
||||
constants.ATTR_NOT_SPECIFIED)
|
||||
|
||||
def _compact_subnetpool_prefix_list(self, prefix_list):
|
||||
"""Compact any overlapping prefixes in prefix_list and return the
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from neutron.common import constants
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
def check_subnet_ip(cidr, ip_address):
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from keystoneauth1 import loading as ks_loading
|
||||
from neutron_lib import constants
|
||||
from novaclient import client as nova_client
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
from oslo_config import cfg
|
||||
@ -22,7 +23,6 @@ from oslo_utils import uuidutils
|
||||
from sqlalchemy.orm import attributes as sql_attr
|
||||
|
||||
from neutron._i18n import _LE, _LI, _LW
|
||||
from neutron.common import constants
|
||||
from neutron import context
|
||||
from neutron import manager
|
||||
from neutron.notifiers import batch_notifier
|
||||
|
@ -12,6 +12,7 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
import six
|
||||
|
||||
@ -122,7 +123,7 @@ class EtherTypeEnumField(obj_fields.AutoTypedField):
|
||||
|
||||
class IpProtocolEnumField(obj_fields.AutoTypedField):
|
||||
AUTO_TYPE = obj_fields.Enum(
|
||||
valid_values=list(constants.IP_PROTOCOL_MAP.keys()))
|
||||
valid_values=list(n_const.IP_PROTOCOL_MAP.keys()))
|
||||
|
||||
|
||||
class MACAddress(obj_fields.FieldType):
|
||||
|
@ -16,11 +16,11 @@
|
||||
import abc
|
||||
import sys
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_versionedobjects import base as obj_base
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
import six
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db.qos import models as qos_db_model
|
||||
|
@ -13,13 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from pecan import hooks
|
||||
|
||||
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.common import constants
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron import manager
|
||||
from neutron.pecan_wsgi import constants as pecan_constants
|
||||
|
@ -18,6 +18,7 @@ Common utilities and helper functions for OpenStack Networking Plugins.
|
||||
|
||||
import hashlib
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from neutron_lib import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -26,7 +27,6 @@ import webob.exc
|
||||
|
||||
from neutron._i18n import _, _LI
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.plugins.common import constants as p_const
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
@ -21,7 +22,6 @@ from sqlalchemy import or_
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron._i18n import _LE
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import securitygroups_db as sg_db
|
||||
from neutron.db import segments_db
|
||||
|
@ -13,11 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from neutron._i18n import _LW
|
||||
from neutron.common import constants
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.plugins.ml2 import db
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
|
@ -18,6 +18,7 @@ import collections
|
||||
import sys
|
||||
import time
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import loopingcall
|
||||
@ -29,7 +30,7 @@ from neutron.agent import rpc as agent_rpc
|
||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.common import config as common_config
|
||||
from neutron.common import constants
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import topics
|
||||
from neutron import context
|
||||
from neutron.plugins.ml2.drivers.agent import _agent_manager_base as amb
|
||||
@ -118,7 +119,7 @@ class CommonAgentLoop(service.Service):
|
||||
agent_status = self.state_rpc.report_state(self.context,
|
||||
self.agent_state,
|
||||
True)
|
||||
if agent_status == constants.AGENT_REVIVED:
|
||||
if agent_status == n_const.AGENT_REVIVED:
|
||||
LOG.info(_LI('%s Agent has just been revived. '
|
||||
'Doing a full sync.'),
|
||||
self.agent_type)
|
||||
|
@ -13,11 +13,11 @@
|
||||
# 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 log as logging
|
||||
|
||||
from neutron._i18n import _LW
|
||||
from neutron.common import constants as const
|
||||
from neutron import context as n_context
|
||||
from neutron.db import api as db_api
|
||||
from neutron.plugins.ml2.common import exceptions as ml2_exc
|
||||
|
@ -16,11 +16,11 @@
|
||||
import abc
|
||||
import itertools
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log_helpers
|
||||
import six
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
import sys
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -35,7 +36,6 @@ from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import utils
|
||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||
from neutron.common import config as common_config
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils as n_utils
|
||||
|
@ -13,8 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.agent import securitygroups_rpc
|
||||
from neutron.common import constants
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.plugins.common import constants as p_constants
|
||||
from neutron.plugins.ml2.drivers import mech_agent
|
||||
|
@ -17,6 +17,7 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -27,7 +28,6 @@ from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import utils
|
||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||
from neutron.common import config as common_config
|
||||
from neutron.common import constants
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron.plugins.common import constants as p_constants
|
||||
|
@ -14,7 +14,8 @@
|
||||
# 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
|
||||
|
||||
from neutron.plugins.common import utils as p_utils
|
||||
|
||||
MAX_VLAN_POSTFIX_LEN = 5
|
||||
|
@ -14,9 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_log import log
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.plugins.common import constants as p_constants
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
|
@ -20,6 +20,7 @@ import socket
|
||||
import sys
|
||||
import time
|
||||
|
||||
from neutron_lib import constants as n_constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -32,7 +33,6 @@ from neutron.agent import rpc as agent_rpc
|
||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.common import config as common_config
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron import context
|
||||
|
@ -13,11 +13,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from neutron._i18n import _, _LE, _LW
|
||||
from neutron.common import constants
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.plugins.common import constants as p_const
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
|
@ -12,11 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.agent.common import config
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.plugins.common import constants as p_const
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
|
||||
import constants
|
||||
|
@ -29,7 +29,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
class OVSDVRProcessMixin(object):
|
||||
|
@ -21,7 +21,9 @@
|
||||
|
||||
import netaddr
|
||||
|
||||
from neutron.common import constants as const
|
||||
from neutron_lib import constants as const
|
||||
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.plugins.common import constants as p_const
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.openflow.ovs_ofctl \
|
||||
@ -119,14 +121,14 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
||||
for ip in ip_addresses:
|
||||
self.install_normal(
|
||||
table_id=constants.ARP_SPOOF_TABLE, priority=2,
|
||||
dl_type=const.ETHERTYPE_IPV6,
|
||||
dl_type=n_const.ETHERTYPE_IPV6,
|
||||
nw_proto=const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=const.ICMPV6_TYPE_NA, nd_target=ip, in_port=port)
|
||||
|
||||
# Now that the rules are ready, direct icmpv6 neighbor advertisement
|
||||
# traffic from the port into the anti-spoof table.
|
||||
self.add_flow(table=constants.LOCAL_SWITCHING,
|
||||
priority=10, dl_type=const.ETHERTYPE_IPV6,
|
||||
priority=10, dl_type=n_const.ETHERTYPE_IPV6,
|
||||
nw_proto=const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=const.ICMPV6_TYPE_NA, in_port=port,
|
||||
actions=("resubmit(,%s)" % constants.ARP_SPOOF_TABLE))
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
import sys
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron._i18n import _LE, _LI, _LW
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron.plugins.common import constants as p_const
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
|
||||
|
@ -20,6 +20,7 @@ import sys
|
||||
import time
|
||||
|
||||
import netaddr
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
@ -39,7 +40,7 @@ from neutron.agent import securitygroups_rpc as sg_rpc
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
from neutron.api.rpc.handlers import dvr_rpc
|
||||
from neutron.common import config
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import constants as c_const
|
||||
from neutron.common import ipv6_utils as ipv6
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils as n_utils
|
||||
@ -311,7 +312,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
|
||||
agent_status = self.state_rpc.report_state(self.context,
|
||||
self.agent_state,
|
||||
True)
|
||||
if agent_status == n_const.AGENT_REVIVED:
|
||||
if agent_status == c_const.AGENT_REVIVED:
|
||||
LOG.info(_LI('Agent has just been revived. '
|
||||
'Doing a full sync.'))
|
||||
self.fullsync = True
|
||||
@ -913,7 +914,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
|
||||
if netaddr.IPNetwork(ip).version == 6}
|
||||
# Allow neighbor advertisements for LLA address.
|
||||
ipv6_addresses |= {str(ipv6.get_ipv6_addr_by_EUI64(
|
||||
n_const.IPV6_LLA_PREFIX, mac))
|
||||
c_const.IPV6_LLA_PREFIX, mac))
|
||||
for mac in mac_addresses}
|
||||
if not has_zero_prefixlen_address(ipv6_addresses):
|
||||
# Install protection only when prefix is not zero because a /0
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
import os
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron.agent import securitygroups_rpc
|
||||
from neutron.common import constants
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.plugins.common import constants as p_constants
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
@ -143,7 +144,7 @@ class TypeManager(stevedore.named.NamedExtensionManager):
|
||||
|
||||
def _get_attribute(self, attrs, key):
|
||||
value = attrs.get(key)
|
||||
if value is attributes.ATTR_NOT_SPECIFIED:
|
||||
if value is constants.ATTR_NOT_SPECIFIED:
|
||||
value = None
|
||||
return value
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from eventlet import greenthread
|
||||
from neutron_lib import constants as const
|
||||
from neutron_lib import exceptions as exc
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
@ -41,7 +42,7 @@ from neutron.callbacks import events
|
||||
from neutron.callbacks import exceptions
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
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 rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
@ -255,7 +256,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
port_id = port['id']
|
||||
changes = False
|
||||
|
||||
host = attributes.ATTR_NOT_SPECIFIED
|
||||
host = const.ATTR_NOT_SPECIFIED
|
||||
if attrs and portbindings.HOST_ID in attrs:
|
||||
host = attrs.get(portbindings.HOST_ID) or ''
|
||||
|
||||
@ -276,7 +277,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if attrs and portbindings.PROFILE in attrs:
|
||||
profile = attrs.get(portbindings.PROFILE) or {}
|
||||
|
||||
if profile not in (None, attributes.ATTR_NOT_SPECIFIED,
|
||||
if profile not in (None, const.ATTR_NOT_SPECIFIED,
|
||||
self._get_profile(binding)):
|
||||
binding.profile = jsonutils.dumps(profile)
|
||||
if len(binding.profile) > models.BINDING_PROFILE_LEN:
|
||||
@ -1611,7 +1612,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
# REVISIT(rkukura): Consider calling into MechanismDrivers to
|
||||
# process device names, or having MechanismDrivers supply list
|
||||
# of device prefixes to strip.
|
||||
for prefix in const.INTERFACE_PREFIXES:
|
||||
for prefix in n_const.INTERFACE_PREFIXES:
|
||||
if device.startswith(prefix):
|
||||
return device[len(prefix):]
|
||||
# REVISIT(irenab): Consider calling into bound MD to
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants as n_const
|
||||
from neutron_lib import exceptions
|
||||
from oslo_log import log
|
||||
import oslo_messaging
|
||||
@ -24,7 +25,6 @@ from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
|
||||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.extensions import portbindings
|
||||
|
@ -16,6 +16,7 @@
|
||||
import collections
|
||||
import re
|
||||
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import exceptions as lib_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
@ -90,10 +91,10 @@ def _is_attribute_explicitly_set(attribute_name, resource, target, action):
|
||||
# default value of an attribute, but check whether it was explicitly
|
||||
# marked as being updated instead.
|
||||
return (attribute_name in target[const.ATTRIBUTES_TO_UPDATE] and
|
||||
target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED)
|
||||
target[attribute_name] is not constants.ATTR_NOT_SPECIFIED)
|
||||
return ('default' in resource[attribute_name] and
|
||||
attribute_name in target and
|
||||
target[attribute_name] is not attributes.ATTR_NOT_SPECIFIED and
|
||||
target[attribute_name] is not constants.ATTR_NOT_SPECIFIED and
|
||||
target[attribute_name] != resource[attribute_name]['default'])
|
||||
|
||||
|
||||
|
@ -17,13 +17,13 @@
|
||||
import collections
|
||||
import heapq
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy import sql
|
||||
|
||||
from neutron._i18n import _LI, _LW
|
||||
from neutron.common import constants
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import agentschedulers_db
|
||||
from neutron.db import api as db_api
|
||||
|
@ -19,6 +19,7 @@ import functools
|
||||
import itertools
|
||||
import random
|
||||
|
||||
from neutron_lib import constants as lib_const
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
@ -135,7 +136,7 @@ class L3Scheduler(object):
|
||||
:returns: True if routers have been successfully assigned to host
|
||||
"""
|
||||
l3_agent = plugin.get_enabled_agent_on_host(
|
||||
context, constants.AGENT_TYPE_L3, host)
|
||||
context, lib_const.AGENT_TYPE_L3, host)
|
||||
if not l3_agent:
|
||||
return False
|
||||
|
||||
@ -143,7 +144,7 @@ class L3Scheduler(object):
|
||||
context, plugin, router_ids)
|
||||
if not unscheduled_routers:
|
||||
if utils.is_extension_supported(
|
||||
plugin, constants.L3_HA_MODE_EXT_ALIAS):
|
||||
plugin, lib_const.L3_HA_MODE_EXT_ALIAS):
|
||||
return self._schedule_ha_routers_to_additional_agent(
|
||||
plugin, context, l3_agent)
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
from netaddr import IPAddress
|
||||
from neutron_lib import constants as n_const
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
@ -22,7 +23,6 @@ from neutron.api.rpc.handlers import bgp_speaker_rpc as bs_rpc
|
||||
from neutron.callbacks import events
|
||||
from neutron.callbacks import registry
|
||||
from neutron.callbacks import resources
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron import context
|
||||
from neutron.db import bgp_db
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user