diff --git a/quantum/extensions/credential.py b/quantum/extensions/credential.py index 3bcf0d7cca..e1e18c232b 100644 --- a/quantum/extensions/credential.py +++ b/quantum/extensions/credential.py @@ -16,6 +16,7 @@ # under the License. # # @author: Ying Liu, Cisco Systems, Inc. +# from webob import exc @@ -28,10 +29,8 @@ from quantum.plugins.cisco.common import cisco_faults as faults from quantum import wsgi -class Credential(object): +class Credential(extensions.ExtensionDescriptor): """extension class Credential""" - def __init__(self): - pass @classmethod def get_name(cls): diff --git a/quantum/extensions/flavor.py b/quantum/extensions/flavor.py index 7b48d462eb..ca4666ae61 100644 --- a/quantum/extensions/flavor.py +++ b/quantum/extensions/flavor.py @@ -1,6 +1,7 @@ # 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 # 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 # 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.openstack.common import log as logging + LOG = logging.getLogger(__name__) FLAVOR_NETWORK = 'flavor:network' @@ -39,7 +41,7 @@ FLAVOR_ATTRIBUTE = { } -class Flavor(object): +class Flavor(extensions.ExtensionDescriptor): @classmethod def get_name(cls): return "Flavor support for network and router" diff --git a/quantum/extensions/l3.py b/quantum/extensions/l3.py index e8958fe525..2da2882709 100644 --- a/quantum/extensions/l3.py +++ b/quantum/extensions/l3.py @@ -1,6 +1,7 @@ # 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 # 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') -class L3(object): +class L3(extensions.ExtensionDescriptor): @classmethod def get_name(cls): diff --git a/quantum/extensions/portbindings.py b/quantum/extensions/portbindings.py index 23980d32c4..6ee219b572 100644 --- a/quantum/extensions/portbindings.py +++ b/quantum/extensions/portbindings.py @@ -1,20 +1,24 @@ -# Copyright (c) 2012 OpenStack, LLC. -# -# 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. +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# 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 + # The service will return the vif type for the specific port. VIF_TYPE = 'binding:vif_type' # 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. This class is used by quantum's extension framework to make diff --git a/quantum/extensions/providernet.py b/quantum/extensions/providernet.py index c259d3be8c..1422fbad46 100644 --- a/quantum/extensions/providernet.py +++ b/quantum/extensions/providernet.py @@ -1,20 +1,24 @@ -# Copyright (c) 2012 OpenStack, LLC. -# -# 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. +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# 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 + NETWORK_TYPE = 'provider:network_type' PHYSICAL_NETWORK = 'provider:physical_network' 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. This class is used by quantum's extension framework to make diff --git a/quantum/extensions/qos.py b/quantum/extensions/qos.py index f1bd5b2b72..d31c2c7051 100644 --- a/quantum/extensions/qos.py +++ b/quantum/extensions/qos.py @@ -16,6 +16,7 @@ # under the License. # # @author: Ying Liu, Cisco Systems, Inc. +# from webob import exc @@ -28,10 +29,8 @@ from quantum.plugins.cisco.common import cisco_faults as faults from quantum import wsgi -class Qos(object): +class Qos(extensions.ExtensionDescriptor): """Qos extension file""" - def __init__(self): - pass @classmethod def get_name(cls): diff --git a/quantum/extensions/quotasv2.py b/quantum/extensions/quotasv2.py index 4782637f6d..27fe671ff7 100644 --- a/quantum/extensions/quotasv2.py +++ b/quantum/extensions/quotasv2.py @@ -26,6 +26,7 @@ from quantum.openstack.common import importutils from quantum import quota from quantum import wsgi + RESOURCE_NAME = 'quota' RESOURCE_COLLECTION = RESOURCE_NAME + "s" QUOTAS = quota.QUOTAS @@ -114,8 +115,9 @@ class QuotaSetsController(wsgi.Controller): return {self._resource_name: self._get_quotas(request, tenant_id)} -class Quotasv2(object): +class Quotasv2(extensions.ExtensionDescriptor): """Quotas management support""" + @classmethod def get_name(cls): return "Quotas for each tenant" @@ -137,6 +139,15 @@ class Quotasv2(object): def get_updated(cls): 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): if version == "2.0": return EXTENDED_ATTRIBUTES_2_0 @@ -147,12 +158,3 @@ class Quotasv2(object): if cfg.CONF.QUOTAS.quota_driver != DB_QUOTA_DRIVER: msg = _('Quota driver %s is needed.') % DB_QUOTA_DRIVER 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'})] diff --git a/quantum/extensions/securitygroup.py b/quantum/extensions/securitygroup.py index 814dc50e1c..488890abe5 100644 --- a/quantum/extensions/securitygroup.py +++ b/quantum/extensions/securitygroup.py @@ -1,18 +1,19 @@ -# Copyright (c) 2012 OpenStack, LLC. -# -# 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. +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# 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 @@ -242,7 +243,7 @@ security_group_opts = [ cfg.CONF.register_opts(security_group_opts, 'SECURITYGROUP') -class Securitygroup(object): +class Securitygroup(extensions.ExtensionDescriptor): """ Security group extension""" @classmethod diff --git a/quantum/extensions/servicetype.py b/quantum/extensions/servicetype.py index bfe07218ad..b5e4b7f133 100644 --- a/quantum/extensions/servicetype.py +++ b/quantum/extensions/servicetype.py @@ -1,4 +1,5 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 + # Copyright 2013 OpenStack LLC. # All Rights Reserved. # @@ -156,7 +157,7 @@ attributes.validators['type:service_definitions'] = _validate_service_defs attributes.validators['type:servicetype_ref'] = _validate_servicetype_ref -class Servicetype(object): +class Servicetype(extensions.ExtensionDescriptor): @classmethod def get_name(cls): @@ -183,8 +184,8 @@ class Servicetype(object): def get_resources(cls): """ Returns Extended Resource for service type management """ controller = base.create_resource( - COLLECTION_NAME, RESOURCE_NAME, + COLLECTION_NAME, + RESOURCE_NAME, servicetype_db.ServiceTypeManager.get_instance(), RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME]) - return [extensions.ResourceExtension(COLLECTION_NAME, - controller)] + return [extensions.ResourceExtension(COLLECTION_NAME, controller)] diff --git a/quantum/plugins/nec/extensions/packetfilter.py b/quantum/plugins/nec/extensions/packetfilter.py index fcce0adc50..e885535ee4 100644 --- a/quantum/plugins/nec/extensions/packetfilter.py +++ b/quantum/plugins/nec/extensions/packetfilter.py @@ -1,6 +1,7 @@ # 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 # 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 # License for the specific language governing permissions and limitations # under the License. +# # @author: Ryota MIBU +# from quantum.api import extensions from quantum.api.v2 import attributes @@ -99,10 +102,7 @@ PACKET_FILTER_ATTR_MAP = { } -class Packetfilter(object): - - def __init__(self): - pass +class Packetfilter(extensions.ExtensionDescriptor): def get_name(self): return "PacketFilters"