Use ExtensionDescriptor from neutron-lib

Adopt the class rehomed in https://review.openstack.org/389825

This change impacts subprojects that use ExtensionDescriptor from
neutron core. All subprojects should switch to using the class
directly from neutron-lib.

NeutronLibImpact

Change-Id: I0da90fb9d27a0a2008b60e56ed69bc9b9ae63c3e
This commit is contained in:
Henry Gessau 2016-11-16 00:18:16 -05:00
parent aa7d30f797
commit dfe738a83f
56 changed files with 92 additions and 66 deletions

View File

@ -30,7 +30,7 @@ import webob.exc
from neutron._i18n import _, _LE, _LI, _LW
from neutron.common import exceptions
import neutron.extensions
from neutron import extensions as core_extensions
from neutron.plugins.common import constants as const
from neutron.services import provider_configuration
from neutron import wsgi
@ -85,11 +85,6 @@ class PluginInterface(object):
return True
# Temporary redirector to prevent subprojects from breaking.
# TODO(HenryG): Remove once all subprojects are patched.
ExtensionDescriptor = api_extensions.ExtensionDescriptor
class ActionExtensionController(wsgi.Controller):
def __init__(self, application):
@ -436,7 +431,7 @@ class ExtensionManager(object):
except AttributeError:
LOG.exception(_LE("Exception loading extension"))
return False
return isinstance(extension, ExtensionDescriptor)
return isinstance(extension, api_extensions.ExtensionDescriptor)
def _load_all_extensions(self):
"""Load extensions from the configured path.
@ -635,7 +630,7 @@ def get_extensions_path(service_plugins=None):
paths = collections.OrderedDict()
# Add Neutron core extensions
paths[neutron.extensions.__path__[0]] = 1
paths[core_extensions.__path__[0]] = 1
if service_plugins:
# Add Neutron *-aas extensions
for plugin in service_plugins.values():

View File

@ -15,6 +15,7 @@
import abc
from neutron_lib.api import converters
from neutron_lib.api import extensions as api_extensions
from neutron_lib import constants
from neutron_lib import exceptions as nexception
from neutron_lib.plugins import directory
@ -94,7 +95,7 @@ class AddressScopeUpdateError(nexception.BadRequest):
"%(reason)s")
class Address_scope(extensions.ExtensionDescriptor):
class Address_scope(api_extensions.ExtensionDescriptor):
"""Extension class supporting Address Scopes."""
@classmethod

View File

@ -16,6 +16,7 @@
import abc
from neutron_lib.api import converters
from neutron_lib.api import extensions as api_extensions
from neutron_lib import exceptions
from neutron_lib.plugins import directory
import six
@ -76,7 +77,7 @@ class MultipleAgentFoundByTypeHost(exceptions.Conflict):
"host=%(host)s found")
class Agent(extensions.ExtensionDescriptor):
class Agent(api_extensions.ExtensionDescriptor):
"""Agent management extension."""
@classmethod

View File

@ -13,6 +13,7 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib import constants
from neutron_lib import exceptions as nexception
@ -20,7 +21,6 @@ from oslo_config import cfg
import webob.exc
from neutron._i18n import _
from neutron.api import extensions
from neutron.conf.extensions import allowedaddresspairs as addr_pair
addr_pair.register_allowed_address_pair_opts()

View File

@ -15,6 +15,7 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions as api_extensions
from neutron_lib.plugins import directory
from neutron.api import extensions
@ -44,7 +45,7 @@ RESOURCE_ATTRIBUTE_MAP = {
}
class Auto_allocated_topology(extensions.ExtensionDescriptor):
class Auto_allocated_topology(api_extensions.ExtensionDescriptor):
@classmethod
def get_name(cls):

View File

@ -14,6 +14,7 @@
import abc
from neutron_lib.api import extensions as api_extensions
from neutron_lib.api import validators
from neutron_lib import exceptions
from neutron_lib.plugins import directory
@ -78,7 +79,7 @@ class AvailabilityZoneNotFound(exceptions.NotFound):
message = _("AvailabilityZone %(availability_zone)s could not be found.")
class Availability_zone(extensions.ExtensionDescriptor):
class Availability_zone(api_extensions.ExtensionDescriptor):
"""Availability zone extension."""
@classmethod

View File

@ -12,9 +12,9 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron.api import extensions
from neutron.api.v2 import attributes

View File

@ -15,6 +15,7 @@
import abc
from neutron_lib.api import extensions as api_extensions
from neutron_lib import constants
from neutron_lib import exceptions
from neutron_lib.plugins import directory
@ -78,7 +79,7 @@ class DhcpAgentsHostingNetworkController(wsgi.Controller):
request.context, kwargs['network_id'])
class Dhcpagentscheduler(extensions.ExtensionDescriptor):
class Dhcpagentscheduler(api_extensions.ExtensionDescriptor):
"""Extension class supporting dhcp agent scheduler.
"""

View File

@ -15,13 +15,13 @@
import re
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib import exceptions as n_exc
from oslo_config import cfg
import six
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.extensions import l3

View File

@ -15,12 +15,12 @@
import abc
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron_lib import exceptions
import six
from neutron._i18n import _
from neutron.api import extensions
DISTRIBUTED = 'distributed'
EXTENDED_ATTRIBUTES_2_0 = {

View File

@ -14,10 +14,10 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import exceptions as nexception
from neutron._i18n import _
from neutron.api import extensions
class ExternalNetworkInUse(nexception.InUse):

View File

@ -14,11 +14,11 @@
# limitations under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib import exceptions
from neutron._i18n import _
from neutron.api import extensions
# ExtraDHcpOpts Exceptions

View File

@ -14,11 +14,11 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron_lib import exceptions as nexception
from neutron._i18n import _
from neutron.api import extensions
# Extra Routes Exceptions

View File

@ -13,6 +13,7 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions as api_extensions
from neutron_lib.api import validators
from neutron_lib import exceptions as nexception
from neutron_lib.plugins import directory
@ -175,7 +176,7 @@ SUB_RESOURCE_ATTRIBUTE_MAP = {
}
class Flavors(extensions.ExtensionDescriptor):
class Flavors(api_extensions.ExtensionDescriptor):
@classmethod
def get_name(cls):

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
from neutron.api.v2 import attributes
IP_ALLOCATION = 'ip_allocation'

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
L2_ADJACENCY = 'l2_adjacency'

View File

@ -16,11 +16,11 @@
import abc
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import exceptions as nexception
import six
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper
from neutron.conf import quota

View File

@ -14,8 +14,8 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron.api import extensions
from neutron.extensions import l3

View File

@ -13,11 +13,11 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron_lib import exceptions
from neutron._i18n import _
from neutron.api import extensions
from neutron.common import constants as n_const
HA_INFO = 'ha'

View File

@ -12,9 +12,9 @@
# under the License.
#
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron.api import extensions
EXTENDED_ATTRIBUTES_2_0 = {
'routers': {

View File

@ -15,6 +15,7 @@
import abc
from neutron_lib.api import extensions as api_extensions
from neutron_lib import constants
from neutron_lib import exceptions
from neutron_lib.plugins import directory
@ -102,7 +103,7 @@ class L3AgentsHostingRouterController(wsgi.Controller):
request.context, kwargs['router_id'])
class L3agentscheduler(extensions.ExtensionDescriptor):
class L3agentscheduler(api_extensions.ExtensionDescriptor):
"""Extension class supporting l3 agent scheduler.
"""

View File

@ -15,11 +15,11 @@
import abc
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import exceptions as nexception
import six
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper
from neutron.plugins.common import constants

View File

@ -14,13 +14,13 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib import constants
from neutron_lib import exceptions as nexception
import webob.exc
from neutron._i18n import _
from neutron.api import extensions
from neutron.extensions import providernet as pnet
SEGMENTS = 'segments'

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
MTU = 'mtu'

View File

@ -14,9 +14,9 @@
import abc
from neutron_lib.api import extensions
import six
from neutron.api import extensions
from neutron.extensions import availability_zone as az_ext

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron_lib.api import extensions as api_extensions
import neutron.api.extensions as extensions
import neutron.api.v2.base as base
import neutron.services.network_ip_availability.plugin as plugin
@ -41,7 +43,7 @@ RESOURCE_ATTRIBUTE_MAP = {
}
class Network_ip_availability(extensions.ExtensionDescriptor):
class Network_ip_availability(api_extensions.ExtensionDescriptor):
"""Extension class supporting network ip availability information."""
@classmethod

View File

@ -11,13 +11,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron_lib.api import extensions as api_extensions
from neutron.api import extensions
_ALIAS = 'pagination'
class Pagination(extensions.ExtensionDescriptor):
class Pagination(api_extensions.ExtensionDescriptor):
"""Fake extension that indicates that pagination is enabled."""
extensions.register_custom_supported_check(

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron.api import extensions
# The type of vnic that this port should be attached to
VNIC_TYPE = 'binding:vnic_type'

View File

@ -13,11 +13,11 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron_lib import exceptions as nexception
from neutron._i18n import _
from neutron.api import extensions
DEFAULT_PORT_SECURITY = True

View File

@ -11,13 +11,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron_lib.api import extensions as api_extensions
from neutron.api import extensions
_ALIAS = 'project-id'
class Project_id(extensions.ExtensionDescriptor):
class Project_id(api_extensions.ExtensionDescriptor):
"""Extension that indicates that project_id is enabled.
This extension indicates that the Keystone V3 'project_id' field

View File

@ -14,12 +14,12 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib import constants
from neutron_lib import exceptions as n_exc
from neutron._i18n import _
from neutron.api import extensions
NETWORK_TYPE = 'provider:network_type'

View File

@ -18,6 +18,7 @@ import itertools
import re
from neutron_lib.api import converters
from neutron_lib.api import extensions as api_extensions
from neutron_lib.plugins import directory
import six
@ -130,7 +131,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
'validate': {'type:uuid_or_none': None}}}}
class Qos(extensions.ExtensionDescriptor):
class Qos(api_extensions.ExtensionDescriptor):
"""Quality of Service API extension."""
@classmethod

View File

@ -14,6 +14,7 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions as api_extensions
from neutron_lib import exceptions as n_exc
from neutron_lib.plugins import directory
from oslo_config import cfg
@ -126,7 +127,7 @@ class QuotaSetsController(wsgi.Controller):
return {self._resource_name: self._get_quotas(request, id)}
class Quotasv2(extensions.ExtensionDescriptor):
class Quotasv2(api_extensions.ExtensionDescriptor):
"""Quotas management support."""
@classmethod

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import extensions as api_extensions
from neutron_lib import exceptions as n_exc
from neutron_lib.plugins import directory
@ -81,7 +82,7 @@ RESOURCE_ATTRIBUTE_MAP = {
quota.register_quota_opts(quota.rbac_quota_opts)
class Rbac(extensions.ExtensionDescriptor):
class Rbac(api_extensions.ExtensionDescriptor):
"""RBAC policy support."""
@classmethod

View File

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
from neutron.db import standard_attr

View File

@ -14,9 +14,9 @@
import abc
from neutron_lib.api import extensions
import six
from neutron.api import extensions
from neutron.extensions import availability_zone as az_ext

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
SERVICE_TYPE_ID = 'service_type_id'
EXTENDED_ATTRIBUTES_2_0 = {

View File

@ -16,6 +16,7 @@
import abc
import netaddr
from neutron_lib.api import extensions as api_extensions
from neutron_lib.api import validators
from neutron_lib import constants as const
from neutron_lib import exceptions as nexception
@ -281,7 +282,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
quota.register_quota_opts(quota.security_group_quota_opts)
class Securitygroup(extensions.ExtensionDescriptor):
class Securitygroup(api_extensions.ExtensionDescriptor):
"""Security group extension."""
@classmethod

View File

@ -16,6 +16,7 @@ import abc
import six
from neutron_lib.api import converters
from neutron_lib.api import extensions as api_extensions
from neutron_lib import constants
from neutron_lib.plugins import directory
@ -88,7 +89,7 @@ RESOURCE_ATTRIBUTE_MAP = {
}
class Segment(extensions.ExtensionDescriptor):
class Segment(api_extensions.ExtensionDescriptor):
"""Extension class supporting Segments."""
@classmethod

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import extensions as api_extensions
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import base
@ -40,7 +42,7 @@ RESOURCE_ATTRIBUTE_MAP = {
}
class Servicetype(extensions.ExtensionDescriptor):
class Servicetype(api_extensions.ExtensionDescriptor):
@classmethod
def get_name(cls):

View File

@ -11,13 +11,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron_lib.api import extensions as api_extensions
from neutron.api import extensions
_ALIAS = 'sorting'
class Sorting(extensions.ExtensionDescriptor):
class Sorting(api_extensions.ExtensionDescriptor):
"""Fake extension that indicates that sorting is enabled."""
extensions.register_custom_supported_check(

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.db import standard_attr

View File

@ -10,13 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib import constants
from neutron_lib import exceptions
import webob.exc
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import attributes

View File

@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron.api import extensions
class Subnetallocation(extensions.ExtensionDescriptor):
"""Extension class supporting subnet allocation."""

View File

@ -13,6 +13,7 @@
import abc
from neutron_lib.api import extensions as api_extensions
from neutron_lib.api import validators
from neutron_lib import exceptions
from neutron_lib.plugins import directory
@ -121,7 +122,7 @@ class TagController(object):
return self.plugin.delete_tags(request.context, parent, parent_id)
class Tag(extensions.ExtensionDescriptor):
class Tag(api_extensions.ExtensionDescriptor):
"""Extension class supporting tags."""
@classmethod

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
from neutron.db import standard_attr

View File

@ -14,8 +14,8 @@
# under the License.
from neutron_lib.api.definitions import trunk
from neutron_lib.api import extensions
from neutron.api import extensions
from neutron.api.v2 import resource_helper

View File

@ -13,8 +13,7 @@
# under the License.
from neutron_lib.api.definitions import trunk_details
from neutron.api import extensions
from neutron_lib.api import extensions
# NOTE(armax): because of the API machinery, this extension must be on

View File

@ -13,6 +13,7 @@
# under the License.
from neutron_lib.api import converters
from neutron_lib.api import extensions
from neutron_lib.api import validators
from neutron_lib import constants
from neutron_lib import exceptions
@ -20,7 +21,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _, _LI
from neutron.api import extensions
LOG = logging.getLogger(__name__)

View File

@ -10,13 +10,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import extensions as api_extensions
from neutron.api import extensions
from neutron.api.v2 import base
from neutron.pecan_wsgi import controllers
from neutron.pecan_wsgi.controllers import utils as pecan_utils
class FakeSingularCollectionExtension(extensions.ExtensionDescriptor):
class FakeSingularCollectionExtension(api_extensions.ExtensionDescriptor):
COLLECTION = 'topologies'
RESOURCE = 'topology'
@ -104,7 +106,7 @@ def create_router(context, l3_plugin):
'admin_state_up': True}})
class FakeExtension(extensions.ExtensionDescriptor):
class FakeExtension(api_extensions.ExtensionDescriptor):
HYPHENATED_RESOURCE = 'meh_meh'
HYPHENATED_COLLECTION = HYPHENATED_RESOURCE + 's'

View File

@ -15,11 +15,13 @@
import abc
from neutron_lib.api import extensions as api_extensions
from neutron.api import extensions
from neutron import wsgi
class StubExtension(extensions.ExtensionDescriptor):
class StubExtension(api_extensions.ExtensionDescriptor):
def __init__(self, alias="stub_extension", optional=None):
self.alias = alias

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
EXTENDED_ATTRIBUTE = 'extended_attribute'
EXTENDED_ATTRIBUTES_2_0 = {

View File

@ -15,6 +15,7 @@
import abc
from neutron_lib.api import extensions as api_extensions
from neutron_lib.plugins import directory
from neutron.api import extensions
@ -39,7 +40,7 @@ RESOURCE_ATTRIBUTE_MAP = {
}
class Extensionattribute(extensions.ExtensionDescriptor):
class Extensionattribute(api_extensions.ExtensionDescriptor):
@classmethod
def get_name(cls):

View File

@ -15,6 +15,7 @@
import abc
from neutron_lib.api import extensions as api_extensions
from oslo_serialization import jsonutils
import six
@ -36,7 +37,7 @@ class FoxInSocksPluginInterface(extensions.PluginInterface):
pass
class Foxinsocks(extensions.ExtensionDescriptor):
class Foxinsocks(api_extensions.ExtensionDescriptor):
def __init__(self):
pass

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron.api import extensions
from neutron_lib.api import extensions
EXTENDED_ATTRIBUTES_2_0 = {

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import extensions
from neutron_lib import constants
from neutron._i18n import _
from neutron.api import extensions
EXTENDED_ATTRIBUTES_2_0 = {