]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix all extension contract classes inherit from extensions.ExtensionDescriptor
authorZhongyue Luo <zhongyue.nah@intel.com>
Tue, 22 Jan 2013 10:52:41 +0000 (18:52 +0800)
committerZhongyue Luo <zhongyue.nah@intel.com>
Wed, 23 Jan 2013 13:43:46 +0000 (21:43 +0800)
Part of blueprint quantum-api-wadl
Fixes bug #1102927

Fixed classes to inherit from ExtensionDescriptor
Reordered methods in sync with parent

Change-Id: I40b3814a490d7da49d0ef075c3482cc104eb7a7c

quantum/extensions/credential.py
quantum/extensions/flavor.py
quantum/extensions/l3.py
quantum/extensions/portbindings.py
quantum/extensions/providernet.py
quantum/extensions/qos.py
quantum/extensions/quotasv2.py
quantum/extensions/securitygroup.py
quantum/extensions/servicetype.py
quantum/plugins/nec/extensions/packetfilter.py

index 3bcf0d7ccad041bd43b2669b403af9e33904ee8c..e1e18c232b247db285207960ac60f2baea9798f7 100644 (file)
@@ -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):
index 7b48d462eb8b9a2bab54c5a105e91563fc8871d3..ca4666ae6190407718874f081b991bd52ec06a5d 100644 (file)
@@ -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
 #    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"
index e8958fe525540c0725fbdc14a4905b67d8d4e8ff..2da2882709e4067749a2351690c87702b34bff3c 100644 (file)
@@ -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):
index 23980d32c433ef3e3aba1d43c2d1a89ba8f08bf6..6ee219b572ee1fc081b5c427b09227725df00421 100644 (file)
@@ -1,20 +1,24 @@
+# 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
+#    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
+#         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.
+#    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
index c259d3be8c881d4ea1ce0442c815ee1e658ac410..1422fbad46cf023819c2f22955ffa6239b2aa1ab 100644 (file)
@@ -1,20 +1,24 @@
+# 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
+#    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
+#         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.
+#    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
index f1bd5b2b72064af0d24511250512c61431b44e84..d31c2c7051aa049045d21582cf0fe20de3a665fd 100644 (file)
@@ -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):
index 4782637f6d2809bdcfd345fcf998ef494922eb9b..27fe671ff7b01e7dad3be9437c97d08e001eb6aa 100644 (file)
@@ -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'})]
index 952cfa95aa977ef450bbbc15ba361a94f57cfde3..ec84fb4050d0b3b510fbe52ccc9b28d1fb2582e2 100644 (file)
@@ -1,18 +1,19 @@
+# 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
+#    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
+#         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.
-
+#    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
 
@@ -240,7 +241,7 @@ security_group_opts = [
 cfg.CONF.register_opts(security_group_opts, 'SECURITYGROUP')
 
 
-class Securitygroup(object):
+class Securitygroup(extensions.ExtensionDescriptor):
     """ Security group extension"""
 
     @classmethod
index bfe07218ada6bb16e1dc3a4fae214e2736998bdc..b5e4b7f133febc8603602d2a0f260cb00f20bc03 100644 (file)
@@ -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)]
index fcce0adc5078f0f88edf3468b2a45b126721e19d..e885535ee4dad66d691b6ac64a74a9332cd59ff3 100644 (file)
@@ -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"