Merge "Fix all extension contract classes inherit from extensions.ExtensionDescriptor"

This commit is contained in:
Jenkins 2013-01-24 11:12:04 +00:00 committed by Gerrit Code Review
commit 4b448b82f0
10 changed files with 91 additions and 78 deletions

View File

@ -16,6 +16,7 @@
# under the License. # under the License.
# #
# @author: Ying Liu, Cisco Systems, Inc. # @author: Ying Liu, Cisco Systems, Inc.
#
from webob import exc from webob import exc
@ -28,10 +29,8 @@ from quantum.plugins.cisco.common import cisco_faults as faults
from quantum import wsgi from quantum import wsgi
class Credential(object): class Credential(extensions.ExtensionDescriptor):
"""extension class Credential""" """extension class Credential"""
def __init__(self):
pass
@classmethod @classmethod
def get_name(cls): def get_name(cls):

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nachi Ueno, NTT MCL, Inc. All rights reserved. # Copyright 2012 Nachi Ueno, NTT MCL, Inc.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -13,11 +14,12 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
#
from quantum.api import extensions
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
from quantum.openstack.common import log as logging from quantum.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
FLAVOR_NETWORK = 'flavor:network' FLAVOR_NETWORK = 'flavor:network'
@ -39,7 +41,7 @@ FLAVOR_ATTRIBUTE = {
} }
class Flavor(object): class Flavor(extensions.ExtensionDescriptor):
@classmethod @classmethod
def get_name(cls): def get_name(cls):
return "Flavor support for network and router" return "Flavor support for network and router"

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nicira Networks, Inc. All rights reserved. # Copyright 2012 Nicira Networks, Inc.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -157,7 +158,7 @@ l3_quota_opts = [
cfg.CONF.register_opts(l3_quota_opts, 'QUOTAS') cfg.CONF.register_opts(l3_quota_opts, 'QUOTAS')
class L3(object): class L3(extensions.ExtensionDescriptor):
@classmethod @classmethod
def get_name(cls): def get_name(cls):

View File

@ -1,20 +1,24 @@
# Copyright (c) 2012 OpenStack, LLC. # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2012 OpenStack, LLC.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from quantum.api import extensions
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
# The service will return the vif type for the specific port. # The service will return the vif type for the specific port.
VIF_TYPE = 'binding:vif_type' VIF_TYPE = 'binding:vif_type'
# In some cases different implementations may be run on different hosts. # In some cases different implementations may be run on different hosts.
@ -57,7 +61,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
} }
class Portbindings(object): class Portbindings(extensions.ExtensionDescriptor):
"""Extension class supporting port bindings. """Extension class supporting port bindings.
This class is used by quantum's extension framework to make This class is used by quantum's extension framework to make

View File

@ -1,20 +1,24 @@
# Copyright (c) 2012 OpenStack, LLC. # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2012 OpenStack, LLC.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from quantum.api import extensions
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
NETWORK_TYPE = 'provider:network_type' NETWORK_TYPE = 'provider:network_type'
PHYSICAL_NETWORK = 'provider:physical_network' PHYSICAL_NETWORK = 'provider:physical_network'
SEGMENTATION_ID = 'provider:segmentation_id' SEGMENTATION_ID = 'provider:segmentation_id'
@ -40,7 +44,7 @@ EXTENDED_ATTRIBUTES_2_0 = {
} }
class Providernet(object): class Providernet(extensions.ExtensionDescriptor):
"""Extension class supporting provider networks. """Extension class supporting provider networks.
This class is used by quantum's extension framework to make This class is used by quantum's extension framework to make

View File

@ -16,6 +16,7 @@
# under the License. # under the License.
# #
# @author: Ying Liu, Cisco Systems, Inc. # @author: Ying Liu, Cisco Systems, Inc.
#
from webob import exc from webob import exc
@ -28,10 +29,8 @@ from quantum.plugins.cisco.common import cisco_faults as faults
from quantum import wsgi from quantum import wsgi
class Qos(object): class Qos(extensions.ExtensionDescriptor):
"""Qos extension file""" """Qos extension file"""
def __init__(self):
pass
@classmethod @classmethod
def get_name(cls): def get_name(cls):

View File

@ -26,6 +26,7 @@ from quantum.openstack.common import importutils
from quantum import quota from quantum import quota
from quantum import wsgi from quantum import wsgi
RESOURCE_NAME = 'quota' RESOURCE_NAME = 'quota'
RESOURCE_COLLECTION = RESOURCE_NAME + "s" RESOURCE_COLLECTION = RESOURCE_NAME + "s"
QUOTAS = quota.QUOTAS QUOTAS = quota.QUOTAS
@ -114,8 +115,9 @@ class QuotaSetsController(wsgi.Controller):
return {self._resource_name: self._get_quotas(request, tenant_id)} return {self._resource_name: self._get_quotas(request, tenant_id)}
class Quotasv2(object): class Quotasv2(extensions.ExtensionDescriptor):
"""Quotas management support""" """Quotas management support"""
@classmethod @classmethod
def get_name(cls): def get_name(cls):
return "Quotas for each tenant" return "Quotas for each tenant"
@ -137,6 +139,15 @@ class Quotasv2(object):
def get_updated(cls): def get_updated(cls):
return "2012-07-29T10:00:00-00:00" return "2012-07-29T10:00:00-00:00"
@classmethod
def get_resources(cls):
""" Returns Ext Resources """
controller = QuotaSetsController(QuantumManager.get_plugin())
return [extensions.ResourceExtension(
Quotasv2.get_alias(),
controller,
collection_actions={'tenant': 'GET'})]
def get_extended_resources(self, version): def get_extended_resources(self, version):
if version == "2.0": if version == "2.0":
return EXTENDED_ATTRIBUTES_2_0 return EXTENDED_ATTRIBUTES_2_0
@ -147,12 +158,3 @@ class Quotasv2(object):
if cfg.CONF.QUOTAS.quota_driver != DB_QUOTA_DRIVER: if cfg.CONF.QUOTAS.quota_driver != DB_QUOTA_DRIVER:
msg = _('Quota driver %s is needed.') % DB_QUOTA_DRIVER msg = _('Quota driver %s is needed.') % DB_QUOTA_DRIVER
raise exceptions.InvalidExtenstionEnv(reason=msg) raise exceptions.InvalidExtenstionEnv(reason=msg)
@classmethod
def get_resources(cls):
""" Returns Ext Resources """
controller = QuotaSetsController(QuantumManager.get_plugin())
return [extensions.ResourceExtension(
Quotasv2.get_alias(),
controller,
collection_actions={'tenant': 'GET'})]

View File

@ -1,18 +1,19 @@
# Copyright (c) 2012 OpenStack, LLC. # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2012 OpenStack, LLC.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from abc import abstractmethod from abc import abstractmethod
@ -242,7 +243,7 @@ security_group_opts = [
cfg.CONF.register_opts(security_group_opts, 'SECURITYGROUP') cfg.CONF.register_opts(security_group_opts, 'SECURITYGROUP')
class Securitygroup(object): class Securitygroup(extensions.ExtensionDescriptor):
""" Security group extension""" """ Security group extension"""
@classmethod @classmethod

View File

@ -1,4 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack LLC. # Copyright 2013 OpenStack LLC.
# All Rights Reserved. # All Rights Reserved.
# #
@ -156,7 +157,7 @@ attributes.validators['type:service_definitions'] = _validate_service_defs
attributes.validators['type:servicetype_ref'] = _validate_servicetype_ref attributes.validators['type:servicetype_ref'] = _validate_servicetype_ref
class Servicetype(object): class Servicetype(extensions.ExtensionDescriptor):
@classmethod @classmethod
def get_name(cls): def get_name(cls):
@ -183,8 +184,8 @@ class Servicetype(object):
def get_resources(cls): def get_resources(cls):
""" Returns Extended Resource for service type management """ """ Returns Extended Resource for service type management """
controller = base.create_resource( controller = base.create_resource(
COLLECTION_NAME, RESOURCE_NAME, COLLECTION_NAME,
RESOURCE_NAME,
servicetype_db.ServiceTypeManager.get_instance(), servicetype_db.ServiceTypeManager.get_instance(),
RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME]) RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME])
return [extensions.ResourceExtension(COLLECTION_NAME, return [extensions.ResourceExtension(COLLECTION_NAME, controller)]
controller)]

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation. All rights reserved. # Copyright 2012 NEC Corporation.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -13,7 +14,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
#
# @author: Ryota MIBU # @author: Ryota MIBU
#
from quantum.api import extensions from quantum.api import extensions
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
@ -99,10 +102,7 @@ PACKET_FILTER_ATTR_MAP = {
} }
class Packetfilter(object): class Packetfilter(extensions.ExtensionDescriptor):
def __init__(self):
pass
def get_name(self): def get_name(self):
return "PacketFilters" return "PacketFilters"