Remove usage of six.add_metaclass
With python 3.x, classes can use the metaclass= logic to not require usage of the six library. One step in removing all of six usage from neutron. Change-Id: I2f815e412d9a96eb5faf2b3bb3a1e393a9db9309
This commit is contained in:
parent
8b2550d376
commit
08a60f7483
@ -16,8 +16,6 @@
|
||||
import abc
|
||||
import contextlib
|
||||
|
||||
import six
|
||||
|
||||
from neutron_lib.api.definitions import port_security as psec
|
||||
from neutron_lib import constants as n_const
|
||||
from neutron_lib.utils import runtime
|
||||
@ -49,8 +47,7 @@ def load_firewall_driver_class(driver):
|
||||
'neutron.agent.firewall_drivers', driver)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class FirewallDriver(object):
|
||||
class FirewallDriver(object, metaclass=abc.ABCMeta):
|
||||
"""Firewall Driver base class.
|
||||
|
||||
Defines methods that any driver providing security groups
|
||||
|
@ -21,7 +21,6 @@ from neutron_lib import constants
|
||||
from neutron_lib.services.qos import constants as qos_consts
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from neutron.api.rpc.callbacks.consumer import registry
|
||||
from neutron.api.rpc.callbacks import events
|
||||
@ -32,8 +31,7 @@ from neutron import manager
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class QosAgentDriver(object):
|
||||
class QosAgentDriver(object, metaclass=abc.ABCMeta):
|
||||
"""Defines stable abstract interface for QoS Agent Driver.
|
||||
|
||||
QoS Agent driver defines the interface to be implemented by Agent
|
||||
|
@ -20,7 +20,6 @@ from neutron_lib import constants as lib_constants
|
||||
from neutron_lib.exceptions import l3 as l3_exc
|
||||
from neutron_lib.utils import helpers
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.agent.l3 import namespaces
|
||||
@ -42,8 +41,7 @@ ADDRESS_SCOPE_MARK_ID_MAX = 2048
|
||||
DEFAULT_ADDRESS_SCOPE = "noscope"
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseRouterInfo(object):
|
||||
class BaseRouterInfo(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self,
|
||||
agent,
|
||||
|
@ -161,8 +161,7 @@ class NetModel(DictModel):
|
||||
return self._ns_name
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class DhcpBase(object):
|
||||
class DhcpBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, conf, network, process_monitor,
|
||||
version=None, plugin=None):
|
||||
@ -216,8 +215,7 @@ class DhcpBase(object):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class DhcpLocalProcess(DhcpBase):
|
||||
class DhcpLocalProcess(DhcpBase, metaclass=abc.ABCMeta):
|
||||
PORTS = []
|
||||
|
||||
def __init__(self, conf, network, process_monitor, version=None,
|
||||
|
@ -22,7 +22,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import fileutils
|
||||
import psutil
|
||||
import six
|
||||
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import utils
|
||||
@ -37,8 +36,7 @@ agent_cfg.register_external_process_opts()
|
||||
agent_cfg.register_process_monitor_opts(cfg.CONF)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class MonitoredProcess(object):
|
||||
class MonitoredProcess(object, metaclass=abc.ABCMeta):
|
||||
@abc.abstractproperty
|
||||
def active(self):
|
||||
"""Boolean representing the running state of the process."""
|
||||
|
@ -22,7 +22,6 @@ from neutron_lib import exceptions
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from pyroute2.netlink import exceptions as pyroute2_exc
|
||||
import six
|
||||
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.linux import ip_lib
|
||||
@ -36,8 +35,7 @@ def _get_veth(name1, name2, namespace2):
|
||||
ip_lib.IPDevice(name2, namespace=namespace2))
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class LinuxInterfaceDriver(object):
|
||||
class LinuxInterfaceDriver(object, metaclass=abc.ABCMeta):
|
||||
|
||||
DEV_NAME_LEN = constants.LINUX_DEV_LEN
|
||||
DEV_NAME_PREFIX = constants.TAP_DEVICE_PREFIX
|
||||
|
@ -15,15 +15,12 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
from neutron.conf.agent import common as agent_conf
|
||||
|
||||
agent_conf.register_pddriver_opts()
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PDDriverBase(object):
|
||||
class PDDriverBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, router_id, subnet_id, ri_ifname):
|
||||
self.router_id = router_id
|
||||
|
@ -15,7 +15,6 @@ import collections
|
||||
|
||||
from neutron_lib.callbacks import exceptions
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from neutron.api.rpc.callbacks import exceptions as rpc_exc
|
||||
from neutron.api.rpc.callbacks import resources
|
||||
@ -31,8 +30,7 @@ def _validate_resource_type(resource_type):
|
||||
raise exceptions.Invalid(element='resource', value=resource_type)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class ResourceCallbacksManager(object):
|
||||
class ResourceCallbacksManager(object, metaclass=abc.ABCMeta):
|
||||
"""A callback system that allows information providers in a loose manner.
|
||||
"""
|
||||
|
||||
|
@ -14,11 +14,8 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseChecks(object):
|
||||
class BaseChecks(object, metaclass=abc.ABCMeta):
|
||||
|
||||
"""Base class providing upgrade checks.
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
NETWORK = 'network'
|
||||
PORT = 'port'
|
||||
@ -27,8 +25,7 @@ EVENT_UPDATE = 'update'
|
||||
CORE_RESOURCES = [NETWORK, PORT]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class CoreResourceExtension(object):
|
||||
class CoreResourceExtension(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def process_fields(self, context, resource_type, event_type,
|
||||
|
@ -17,7 +17,6 @@ import abc
|
||||
from neutron_lib.api.definitions import address_scope as apidef
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.plugins import directory
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -45,8 +44,7 @@ class Address_scope(api_extensions.APIExtensionDescriptor):
|
||||
return [ex]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AddressScopePluginBase(object):
|
||||
class AddressScopePluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_address_scope(self, context, address_scope):
|
||||
|
@ -19,7 +19,6 @@ from neutron_lib.api.definitions import agent as apidef
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib import exceptions
|
||||
from neutron_lib.plugins import directory
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -45,8 +44,7 @@ class Agent(api_extensions.APIExtensionDescriptor):
|
||||
return [ex]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AgentPluginBase(object):
|
||||
class AgentPluginBase(object, metaclass=abc.ABCMeta):
|
||||
"""REST API to operate the Agent.
|
||||
|
||||
All of method must be in an admin context.
|
||||
|
@ -17,7 +17,6 @@ import abc
|
||||
from neutron_lib.api.definitions import availability_zone as az_def
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.plugins import directory
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -40,8 +39,7 @@ class Availability_zone(api_extensions.APIExtensionDescriptor):
|
||||
return [ex]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AvailabilityZonePluginBase(object):
|
||||
class AvailabilityZonePluginBase(object, metaclass=abc.ABCMeta):
|
||||
"""REST API to operate the Availability Zone."""
|
||||
|
||||
@abc.abstractmethod
|
||||
|
@ -22,7 +22,6 @@ from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.api import faults
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib import rpc as n_rpc
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import resource
|
||||
@ -100,8 +99,7 @@ class Dhcpagentscheduler(api_extensions.APIExtensionDescriptor):
|
||||
return exts
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class DhcpAgentSchedulerPluginBase(object):
|
||||
class DhcpAgentSchedulerPluginBase(object, metaclass=abc.ABCMeta):
|
||||
"""REST API to operate the DHCP agent scheduler.
|
||||
|
||||
All of method must be in an admin context.
|
||||
|
@ -16,7 +16,6 @@ import abc
|
||||
|
||||
from neutron_lib.api.definitions import dvr as apidef
|
||||
from neutron_lib.api import extensions
|
||||
import six
|
||||
|
||||
|
||||
class Dvr(extensions.APIExtensionDescriptor):
|
||||
@ -25,8 +24,7 @@ class Dvr(extensions.APIExtensionDescriptor):
|
||||
api_definition = apidef
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class DVRMacAddressPluginBase(object):
|
||||
class DVRMacAddressPluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_dvr_mac_address_list(self, context):
|
||||
|
@ -21,7 +21,6 @@ from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.plugins import constants as plugin_consts
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services import base as service_base
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -77,8 +76,8 @@ class Floating_ip_port_forwarding(api_extensions.APIExtensionDescriptor):
|
||||
return resources
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PortForwardingPluginBase(service_base.ServicePluginBase):
|
||||
class PortForwardingPluginBase(service_base.ServicePluginBase,
|
||||
metaclass=abc.ABCMeta):
|
||||
|
||||
path_prefix = apidef.API_PREFIX
|
||||
|
||||
|
@ -16,7 +16,6 @@ import itertools
|
||||
from neutron_lib.api.definitions import floatingip_pools as apidef
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.plugins import constants
|
||||
import six
|
||||
|
||||
from neutron.api.v2 import resource_helper
|
||||
|
||||
@ -42,8 +41,7 @@ class Floatingip_pools(api_extensions.APIExtensionDescriptor):
|
||||
return resources
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class FloatingIPPoolPluginBase(object):
|
||||
class FloatingIPPoolPluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_floatingip_pools(self, context, filters=None, fields=None,
|
||||
|
@ -18,7 +18,6 @@ import abc
|
||||
from neutron_lib.api.definitions import l3 as l3_apidef
|
||||
from neutron_lib.api import extensions
|
||||
from neutron_lib.plugins import constants
|
||||
import six
|
||||
|
||||
from neutron.api.v2 import resource_helper
|
||||
from neutron.conf import quota
|
||||
@ -42,8 +41,7 @@ class L3(extensions.APIExtensionDescriptor):
|
||||
register_quota=True)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class RouterPluginBase(object):
|
||||
class RouterPluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_router(self, context, router):
|
||||
|
@ -21,7 +21,6 @@ from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.plugins import constants as plugin_consts
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services import base as service_base
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -81,8 +80,8 @@ class L3_conntrack_helper(api_extensions.APIExtensionDescriptor):
|
||||
return resources
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class ConntrackHelperPluginBase(service_base.ServicePluginBase):
|
||||
class ConntrackHelperPluginBase(service_base.ServicePluginBase,
|
||||
metaclass=abc.ABCMeta):
|
||||
|
||||
path_prefix = apidef.API_PREFIX
|
||||
|
||||
|
@ -24,7 +24,6 @@ from neutron_lib.plugins import constants as plugin_constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib import rpc as n_rpc
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob.exc
|
||||
|
||||
from neutron._i18n import _
|
||||
@ -187,8 +186,7 @@ class RouterDoesntSupportScheduling(exceptions.Conflict):
|
||||
message = _("Router %(router_id)s does not support agent scheduling.")
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class L3AgentSchedulerPluginBase(object):
|
||||
class L3AgentSchedulerPluginBase(object, metaclass=abc.ABCMeta):
|
||||
"""REST API to operate the l3 agent scheduler.
|
||||
|
||||
All of method must be in an admin context.
|
||||
|
@ -20,7 +20,6 @@ from neutron_lib.api.definitions import logging as apidef
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.plugins import constants as plugin_const
|
||||
from neutron_lib.services import base as service_base
|
||||
import six
|
||||
|
||||
from neutron.api.v2 import resource_helper
|
||||
|
||||
@ -50,8 +49,7 @@ class Logging(api_extensions.APIExtensionDescriptor):
|
||||
return resources
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class LoggingPluginBase(service_base.ServicePluginBase):
|
||||
class LoggingPluginBase(service_base.ServicePluginBase, metaclass=abc.ABCMeta):
|
||||
|
||||
path_prefix = apidef.API_PREFIX
|
||||
|
||||
|
@ -18,7 +18,6 @@ from neutron_lib.api.definitions import metering as metering_apidef
|
||||
from neutron_lib.api import extensions
|
||||
from neutron_lib.plugins import constants
|
||||
from neutron_lib.services import base as service_base
|
||||
import six
|
||||
|
||||
from neutron.api.v2 import resource_helper
|
||||
|
||||
@ -42,8 +41,8 @@ class Metering(extensions.APIExtensionDescriptor):
|
||||
constants.METERING, translate_name=True, allow_bulk=True)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class MeteringPluginBase(service_base.ServicePluginBase):
|
||||
class MeteringPluginBase(service_base.ServicePluginBase,
|
||||
metaclass=abc.ABCMeta):
|
||||
|
||||
def get_plugin_description(self):
|
||||
return constants.METERING
|
||||
|
@ -16,7 +16,6 @@ import abc
|
||||
|
||||
from neutron_lib.api.definitions import network_availability_zone as apidef
|
||||
from neutron_lib.api import extensions
|
||||
import six
|
||||
|
||||
|
||||
class Network_availability_zone(extensions.APIExtensionDescriptor):
|
||||
@ -25,8 +24,7 @@ class Network_availability_zone(extensions.APIExtensionDescriptor):
|
||||
api_definition = apidef
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class NetworkAvailabilityZonePluginBase(object):
|
||||
class NetworkAvailabilityZonePluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_network_availability_zones(self, network):
|
||||
|
@ -20,7 +20,6 @@ from neutron_lib.plugins import constants as plugin_constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services import base as service_base
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -63,8 +62,8 @@ class Network_segment_range(api_extensions.APIExtensionDescriptor):
|
||||
return NetworkSegmentRangePluginBase
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class NetworkSegmentRangePluginBase(service_base.ServicePluginBase):
|
||||
class NetworkSegmentRangePluginBase(service_base.ServicePluginBase,
|
||||
metaclass=abc.ABCMeta):
|
||||
"""REST API to manage network segment ranges.
|
||||
|
||||
All methods must be in an admin context.
|
||||
|
@ -22,7 +22,6 @@ from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.plugins import constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.services import base as service_base
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -80,8 +79,7 @@ class Qos(api_extensions.APIExtensionDescriptor):
|
||||
return resources
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class QoSPluginBase(service_base.ServicePluginBase):
|
||||
class QoSPluginBase(service_base.ServicePluginBase, metaclass=abc.ABCMeta):
|
||||
|
||||
path_prefix = apidef.API_PREFIX
|
||||
|
||||
|
@ -16,7 +16,6 @@ import abc
|
||||
|
||||
from neutron_lib.api.definitions import router_availability_zone as apidef
|
||||
from neutron_lib.api import extensions
|
||||
import six
|
||||
|
||||
|
||||
class Router_availability_zone(extensions.APIExtensionDescriptor):
|
||||
@ -25,8 +24,7 @@ class Router_availability_zone(extensions.APIExtensionDescriptor):
|
||||
api_definition = apidef
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class RouterAvailabilityZonePluginBase(object):
|
||||
class RouterAvailabilityZonePluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_router_availability_zones(self, router):
|
||||
|
@ -355,8 +355,7 @@ class Securitygroup(api_extensions.ExtensionDescriptor):
|
||||
return [stdattr_ext.Standardattrdescription.get_alias()]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SecurityGroupPluginBase(object):
|
||||
class SecurityGroupPluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_security_group(self, context, security_group):
|
||||
|
@ -21,7 +21,6 @@ from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.db import constants as db_const
|
||||
from neutron_lib.plugins import directory
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import base
|
||||
@ -149,8 +148,7 @@ class Segment(api_extensions.ExtensionDescriptor):
|
||||
stdattrseg_apidef.ALIAS]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SegmentPluginBase(object):
|
||||
class SegmentPluginBase(object, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_segment(self, context, segment):
|
||||
|
@ -22,7 +22,6 @@ from neutron_lib import exceptions
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib import rpc as n_rpc
|
||||
from neutron_lib.services import base as service_base
|
||||
import six
|
||||
import webob.exc
|
||||
|
||||
from neutron._i18n import _
|
||||
@ -226,8 +225,7 @@ class Tagging(api_extensions.ExtensionDescriptor):
|
||||
return EXTENDED_ATTRIBUTES_2_0
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class TagPluginBase(service_base.ServicePluginBase):
|
||||
class TagPluginBase(service_base.ServicePluginBase, metaclass=abc.ABCMeta):
|
||||
"""REST API to operate the Tag."""
|
||||
|
||||
def get_plugin_description(self):
|
||||
|
@ -13,14 +13,12 @@
|
||||
import abc
|
||||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from neutron.ipam import requests as ipam_req
|
||||
from neutron import manager
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Pool(object):
|
||||
class Pool(object, metaclass=abc.ABCMeta):
|
||||
"""Interface definition for an IPAM driver.
|
||||
|
||||
There should be an instance of the driver for every subnet pool.
|
||||
@ -128,8 +126,7 @@ class Pool(object):
|
||||
return True
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Subnet(object):
|
||||
class Subnet(object, metaclass=abc.ABCMeta):
|
||||
"""Interface definition for an IPAM subnet
|
||||
|
||||
A subnet would typically be associated with a network but may not be. It
|
||||
@ -167,8 +164,7 @@ class Subnet(object):
|
||||
"""
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SubnetGroup(object):
|
||||
class SubnetGroup(object, metaclass=abc.ABCMeta):
|
||||
"""Interface definition for a filtered group of IPAM Subnets
|
||||
|
||||
Allocates from a group of semantically equivalent subnets. The list of
|
||||
|
@ -17,20 +17,17 @@ from neutron_lib.api import validators
|
||||
from neutron_lib import constants
|
||||
from oslo_utils import netutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.ipam import exceptions as ipam_exc
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SubnetPool(object):
|
||||
class SubnetPool(object, metaclass=abc.ABCMeta):
|
||||
"""Represents a pool of IPs available inside an address scope."""
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SubnetRequest(object):
|
||||
class SubnetRequest(object, metaclass=abc.ABCMeta):
|
||||
"""Carries the data needed to make a subnet request
|
||||
|
||||
The data validated and carried by an instance of this class is the data
|
||||
@ -184,8 +181,7 @@ class SpecificSubnetRequest(SubnetRequest):
|
||||
return self._subnet_cidr.prefixlen
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AddressRequest(object):
|
||||
class AddressRequest(object, metaclass=abc.ABCMeta):
|
||||
"""Abstract base class for address requests"""
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@ import oslo_messaging
|
||||
from oslo_service import periodic_task
|
||||
from oslo_utils import excutils
|
||||
from osprofiler import profiler
|
||||
import six
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.common import utils
|
||||
@ -40,8 +39,7 @@ class ManagerMeta(profiler.TracedMeta, type(periodic_task.PeriodicTasks)):
|
||||
pass
|
||||
|
||||
|
||||
@six.add_metaclass(ManagerMeta)
|
||||
class Manager(periodic_task.PeriodicTasks):
|
||||
class Manager(periodic_task.PeriodicTasks, metaclass=ManagerMeta):
|
||||
__trace_args__ = {"name": "rpc"}
|
||||
|
||||
# Set RPC API version to 1.0 by default.
|
||||
@ -91,8 +89,7 @@ def validate_pre_plugin_load():
|
||||
return msg
|
||||
|
||||
|
||||
@six.add_metaclass(profiler.TracedMeta)
|
||||
class NeutronManager(object):
|
||||
class NeutronManager(object, metaclass=profiler.TracedMeta):
|
||||
"""Neutron's Manager class.
|
||||
|
||||
Neutron's Manager class is responsible for parsing a config file and
|
||||
|
@ -23,11 +23,9 @@ methods that needs to be implemented by a v2 Neutron Plug-in.
|
||||
import abc
|
||||
|
||||
from neutron_lib.services import base as base_services
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class NeutronPluginBaseV2(base_services.WorkerBase):
|
||||
class NeutronPluginBaseV2(base_services.WorkerBase, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_subnet(self, context, subnet):
|
||||
|
@ -142,10 +142,10 @@ class NeutronObjectRegistry(obj_base.VersionedObjectRegistry):
|
||||
return self
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class NeutronObject(obj_base.VersionedObject,
|
||||
obj_base.VersionedObjectDictCompat,
|
||||
obj_base.ComparableVersionedObject):
|
||||
obj_base.ComparableVersionedObject,
|
||||
metaclass=abc.ABCMeta):
|
||||
|
||||
synthetic_fields = []
|
||||
extra_filter_names = set()
|
||||
@ -398,8 +398,7 @@ class DeclarativeObject(abc.ABCMeta):
|
||||
raise o_exc.NeutronObjectValidatorException(fields=invalid_fields)
|
||||
|
||||
|
||||
@six.add_metaclass(DeclarativeObject)
|
||||
class NeutronDbObject(NeutronObject):
|
||||
class NeutronDbObject(NeutronObject, metaclass=DeclarativeObject):
|
||||
|
||||
# should be overridden for all persistent objects
|
||||
db_model = None
|
||||
|
@ -23,7 +23,6 @@ from neutron_lib.utils import helpers
|
||||
from oslo_utils import versionutils
|
||||
from oslo_versionedobjects import exception
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
import six
|
||||
|
||||
from neutron.db.qos import models as qos_db_model
|
||||
from neutron.objects import base
|
||||
@ -43,8 +42,7 @@ def get_rules(obj_cls, context, qos_policy_id):
|
||||
return all_rules
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class QosRule(base.NeutronDbObject):
|
||||
class QosRule(base.NeutronDbObject, metaclass=abc.ABCMeta):
|
||||
# Version 1.0: Initial version, only BandwidthLimitRule
|
||||
# 1.1: Added DscpMarkingRule
|
||||
# 1.2: Added QosMinimumBandwidthRule
|
||||
|
@ -17,14 +17,12 @@ import abc
|
||||
|
||||
from neutron_lib.objects import common_types
|
||||
from oslo_versionedobjects import fields as obj_fields
|
||||
from six import add_metaclass
|
||||
from sqlalchemy import and_
|
||||
|
||||
from neutron.objects import base
|
||||
|
||||
|
||||
@add_metaclass(abc.ABCMeta)
|
||||
class RBACBaseObject(base.NeutronDbObject):
|
||||
class RBACBaseObject(base.NeutronDbObject, metaclass=abc.ABCMeta):
|
||||
# Version 1.0: Initial version
|
||||
|
||||
VERSION = '1.0'
|
||||
|
@ -19,7 +19,6 @@ from neutron_lib.callbacks import events
|
||||
from neutron_lib.callbacks import registry
|
||||
from neutron_lib.callbacks import resources
|
||||
from neutron_lib import exceptions
|
||||
from six import add_metaclass
|
||||
from six import with_metaclass
|
||||
from sqlalchemy import and_
|
||||
|
||||
@ -32,9 +31,9 @@ from neutron.objects import base
|
||||
from neutron.objects.db import api as obj_db_api
|
||||
|
||||
|
||||
@add_metaclass(abc.ABCMeta)
|
||||
class RbacNeutronDbObjectMixin(rbac_db_mixin.RbacPluginMixin,
|
||||
base.NeutronDbObject):
|
||||
base.NeutronDbObject,
|
||||
metaclass=abc.ABCMeta):
|
||||
|
||||
rbac_db_cls = None
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class NetworkSegment(object):
|
||||
"""Represents a Neutron network segment"""
|
||||
@ -29,8 +27,7 @@ class NetworkSegment(object):
|
||||
self.mtu = mtu
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class CommonAgentManagerRpcCallBackBase(object):
|
||||
class CommonAgentManagerRpcCallBackBase(object, metaclass=abc.ABCMeta):
|
||||
"""Base class for managers RPC callbacks.
|
||||
|
||||
This class must be inherited by a RPC callback class that is used
|
||||
@ -81,8 +78,7 @@ class CommonAgentManagerRpcCallBackBase(object):
|
||||
return updated_devices
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class CommonAgentManagerBase(object):
|
||||
class CommonAgentManagerBase(object, metaclass=abc.ABCMeta):
|
||||
"""Base class for managers that are used with the common agent loop.
|
||||
|
||||
This class must be inherited by a manager class that is used
|
||||
|
@ -19,14 +19,12 @@ 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.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent import vlanmanager
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class L2populationRpcCallBackMixin(object):
|
||||
class L2populationRpcCallBackMixin(object, metaclass=abc.ABCMeta):
|
||||
'''General mixin class of L2-population RPC call back.
|
||||
|
||||
The following methods are called through RPC.
|
||||
@ -105,8 +103,8 @@ class L2populationRpcCallBackMixin(object):
|
||||
pass
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin):
|
||||
class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin,
|
||||
metaclass=abc.ABCMeta):
|
||||
'''Mixin class of L2-population call back for Tunnel.
|
||||
|
||||
The following methods are all used in agents as internal methods.
|
||||
|
@ -22,7 +22,6 @@ from neutron_lib import constants as const
|
||||
from neutron_lib.placement import utils as place_utils
|
||||
from neutron_lib.plugins.ml2 import api
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.db import provisioning_blocks
|
||||
@ -30,8 +29,7 @@ from neutron.db import provisioning_blocks
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AgentMechanismDriverBase(api.MechanismDriver):
|
||||
class AgentMechanismDriverBase(api.MechanismDriver, metaclass=abc.ABCMeta):
|
||||
"""Base class for drivers that attach to networks using an L2 agent.
|
||||
|
||||
The AgentMechanismDriverBase provides common code for mechanism
|
||||
@ -236,8 +234,8 @@ class AgentMechanismDriverBase(api.MechanismDriver):
|
||||
return False
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase):
|
||||
class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase,
|
||||
metaclass=abc.ABCMeta):
|
||||
"""Base class for simple drivers using an L2 agent.
|
||||
|
||||
The SimpleAgentMechanismDriverBase provides common code for
|
||||
|
@ -15,13 +15,11 @@
|
||||
import abc
|
||||
|
||||
from ovsdbapp import api
|
||||
import six
|
||||
|
||||
from neutron.common.ovn import constants as ovn_const
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class API(api.API):
|
||||
class API(api.API, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_lswitch_port(self, lport_name, lswitch_name, may_exist=True,
|
||||
@ -627,8 +625,7 @@ class API(api.API):
|
||||
"""
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SbAPI(api.API):
|
||||
class SbAPI(api.API, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def chassis_exists(self, hostname):
|
||||
|
@ -24,7 +24,6 @@ from neutron_lib.plugins import constants as plugin_constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.utils import helpers
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from neutron.common.ovn import acl as acl_utils
|
||||
from neutron.common.ovn import constants as ovn_const
|
||||
@ -41,8 +40,7 @@ SYNC_MODE_LOG = 'log'
|
||||
SYNC_MODE_REPAIR = 'repair'
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class OvnDbSynchronizer(object):
|
||||
class OvnDbSynchronizer(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, core_plugin, ovn_api, ovn_driver):
|
||||
self.ovn_driver = ovn_driver
|
||||
|
@ -30,7 +30,6 @@ from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six import moves
|
||||
from sqlalchemy import or_
|
||||
|
||||
@ -54,8 +53,7 @@ def chunks(iterable, chunk_size):
|
||||
chunk = list(itertools.islice(iterator, 0, chunk_size))
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class _TunnelTypeDriverBase(helpers.SegmentTypeDriver):
|
||||
class _TunnelTypeDriverBase(helpers.SegmentTypeDriver, metaclass=abc.ABCMeta):
|
||||
|
||||
BULK_SIZE = 100
|
||||
|
||||
@ -281,8 +279,7 @@ class _TunnelTypeDriverBase(helpers.SegmentTypeDriver):
|
||||
return ranges
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class TunnelTypeDriver(_TunnelTypeDriverBase):
|
||||
class TunnelTypeDriver(_TunnelTypeDriverBase, metaclass=abc.ABCMeta):
|
||||
"""Define stable abstract interface for ML2 type drivers.
|
||||
|
||||
tunnel type networks rely on tunnel endpoints. This class defines abstract
|
||||
@ -354,8 +351,7 @@ class TunnelTypeDriver(_TunnelTypeDriverBase):
|
||||
first())
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class ML2TunnelTypeDriver(_TunnelTypeDriverBase):
|
||||
class ML2TunnelTypeDriver(_TunnelTypeDriverBase, metaclass=abc.ABCMeta):
|
||||
"""Define stable abstract interface for ML2 type drivers.
|
||||
|
||||
tunnel type networks rely on tunnel endpoints. This class defines abstract
|
||||
|
@ -16,11 +16,9 @@
|
||||
import abc
|
||||
|
||||
from neutron_lib.db import api as db_api
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseResourceFilter(object):
|
||||
class BaseResourceFilter(object, metaclass=abc.ABCMeta):
|
||||
"""Encapsulate logic that is specific to the resource type."""
|
||||
@abc.abstractmethod
|
||||
def filter_agents(self, plugin, context, resource):
|
||||
|
@ -18,13 +18,11 @@ from operator import attrgetter
|
||||
import random
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseScheduler(object):
|
||||
class BaseScheduler(object, metaclass=abc.ABCMeta):
|
||||
"""The base scheduler (agnostic to resource type).
|
||||
Child classes of BaseScheduler must define the
|
||||
self.resource_filter to filter agents of
|
||||
|
@ -26,7 +26,6 @@ from neutron_lib.exceptions import l3 as l3_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from neutron.common import utils
|
||||
from neutron.conf.db import l3_hamode_db
|
||||
@ -38,8 +37,7 @@ LOG = logging.getLogger(__name__)
|
||||
cfg.CONF.register_opts(l3_hamode_db.L3_HA_OPTS)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class L3Scheduler(object):
|
||||
class L3Scheduler(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
self.max_ha_agents = cfg.CONF.max_l3_agents_per_router
|
||||
|
@ -17,7 +17,6 @@ import copy
|
||||
import random
|
||||
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from neutron.common.ovn import constants as ovn_const
|
||||
from neutron.common.ovn import utils
|
||||
@ -30,8 +29,7 @@ OVN_SCHEDULER_CHANCE = 'chance'
|
||||
OVN_SCHEDULER_LEAST_LOADED = 'leastloaded'
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class OVNGatewayScheduler(object):
|
||||
class OVNGatewayScheduler(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
@ -17,15 +17,13 @@ import abc
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from neutron import manager
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class ExternalDNSService(object):
|
||||
class ExternalDNSService(object, metaclass=abc.ABCMeta):
|
||||
"""Interface definition for an external dns service driver."""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -19,7 +19,6 @@ import contextlib
|
||||
from neutron_lib.agent import extension
|
||||
from neutron_lib import constants
|
||||
from oslo_concurrency import lockutils
|
||||
import six
|
||||
|
||||
from neutron.api.rpc.callbacks.consumer import registry
|
||||
from neutron.api.rpc.callbacks import events
|
||||
@ -34,8 +33,7 @@ log_cfg.register_log_driver_opts()
|
||||
LOGGING_DRIVERS_NAMESPACE = 'neutron.services.logapi.drivers'
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class LoggingDriver(object):
|
||||
class LoggingDriver(object, metaclass=abc.ABCMeta):
|
||||
"""Defines abstract interface for logging driver"""
|
||||
|
||||
# specific logging types are supported
|
||||
|
@ -14,11 +14,8 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class MeteringAbstractDriver(object):
|
||||
class MeteringAbstractDriver(object, metaclass=abc.ABCMeta):
|
||||
"""Abstract Metering driver."""
|
||||
|
||||
def __init__(self, plugin, conf):
|
||||
|
@ -215,8 +215,7 @@ class _CatchTimeoutMetaclass(abc.ABCMeta):
|
||||
# kills the whole worker, with all test cases scheduled to it. This metaclass
|
||||
# makes all test cases convert Timeout exceptions into unittest friendly
|
||||
# failure mode (self.fail).
|
||||
@six.add_metaclass(_CatchTimeoutMetaclass)
|
||||
class DietTestCase(base.BaseTestCase):
|
||||
class DietTestCase(base.BaseTestCase, metaclass=_CatchTimeoutMetaclass):
|
||||
"""Same great taste, less filling.
|
||||
|
||||
BaseTestCase is responsible for doing lots of plugin-centric setup
|
||||
|
@ -32,7 +32,6 @@ from neutron_lib import exceptions as n_exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.linux import bridge_lib
|
||||
@ -717,8 +716,7 @@ class MacvtapFixture(fixtures.Fixture):
|
||||
pass
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PortFixture(fixtures.Fixture):
|
||||
class PortFixture(fixtures.Fixture, metaclass=abc.ABCMeta):
|
||||
"""Create a port.
|
||||
|
||||
:ivar port: created port
|
||||
|
@ -18,7 +18,6 @@ import abc
|
||||
from neutron_lib.api import extensions as api_extensions
|
||||
from neutron_lib.services import base
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron import wsgi
|
||||
@ -30,8 +29,7 @@ class FoxInSocksController(wsgi.Controller):
|
||||
return "Try to say this Mr. Knox, sir..."
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class FoxInSocksPluginInterface(base.ServicePluginBase):
|
||||
class FoxInSocksPluginInterface(base.ServicePluginBase, metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def method_to_support_foxnsox_extension(self):
|
||||
|
Loading…
Reference in New Issue
Block a user