]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
pep8 changes for quantum-framework code pieces.
authorSomik Behera <somik@nicira.com>
Tue, 7 Jun 2011 05:48:57 +0000 (22:48 -0700)
committerSomik Behera <somik@nicira.com>
Tue, 7 Jun 2011 05:48:57 +0000 (22:48 -0700)
quantum/api/__init__.py
quantum/cli.py
quantum/manager.py
quantum/plugins/SamplePlugin.py
quantum/quantum_plugin_base.py
quantum/service.py

index 25b66f55730140495a9ee157fa5d9fe25e1231bb..bf8edeb1e0bde8e8422921f6e501acf9e1a68eae 100644 (file)
@@ -51,7 +51,7 @@ class APIRouterV01(wsgi.Router):
         mapper.resource('network', 'networks',
                         controller=networks.Controller(),
                         path_prefix=uri_prefix)
-        mapper.resource('port', 'ports', 
+        mapper.resource('port', 'ports',
                         controller=ports.Controller(),
                         parent_resource=dict(member_name='network',
                                              collection_name=\
index 78f1a6b4811719ddcdbcbec6c3cebb5b283c5aa0..dc6cf8240a2e40e48ad8f6470c9a8a8b0efa99bb 100644 (file)
@@ -36,7 +36,7 @@ def usage():
     print "detail_iface <tenant-id> <net-id> <port-id>"
     print "list_iface <tenant-id> <net-id>\n"
 
-if len(sys.argv) < 2 or len(sys.argv) > 6: 
+if len(sys.argv) < 2 or len(sys.argv) > 6:
     usage()
     exit(1)
 
@@ -89,13 +89,13 @@ elif sys.argv[1] == "plug_iface" and len(sys.argv) == 6:
 elif sys.argv[1] == "unplug_iface" and len(sys.argv) == 5:
     manager.unplug_interface(sys.argv[2], sys.argv[3], sys.argv[4])
     print "UnPlugged remote interface " \
-          "from Virtual Port:%s Virtual Network:%s" % (sys.argv[4], 
+          "from Virtual Port:%s Virtual Network:%s" % (sys.argv[4],
                                                        sys.argv[3])
 elif sys.argv[1] == "detail_iface" and len(sys.argv) == 5:
-    remote_iface = manager.get_interface_details(sys.argv[2], 
+    remote_iface = manager.get_interface_details(sys.argv[2],
                                                  sys.argv[3], sys.argv[4])
     print "Remote interface on Virtual Port:%s " \
-          "Virtual Network:%s is %s" % (sys.argv[4], 
+          "Virtual Network:%s is %s" % (sys.argv[4],
                                         sys.argv[3], remote_iface)
 elif sys.argv[1] == "list_iface" and len(sys.argv) == 4:
     iface_list = manager.get_all_attached_interfaces(sys.argv[2], sys.argv[3])
@@ -107,4 +107,3 @@ elif sys.argv[1] == "all" and len(sys.argv) == 2:
 else:
     print "invalid arguments: %s" % str(sys.argv)
     usage()
-
index 79a5139d8be39926cf7098c92972e1df41b3f55d..28daef176bbe7a14b5138029d7bfa89323eed721 100644 (file)
@@ -18,8 +18,9 @@
 
 
 """
-Quantum's Manager class is responsible for parsing a config file and instantiating the correct
-plugin that concretely implement quantum_plugin_base class
+Quantum's Manager class is responsible for parsing a config file and
+instantiating the correct plugin that concretely implement
+quantum_plugin_base class
 
 The caller should make sure that QuantumManager is a singleton.
 """
@@ -34,7 +35,7 @@ CONFIG_FILE = "plugins.ini"
 
 class QuantumManager(object):
 
-    def __init__(self,config=CONFIG_FILE):
+    def __init__(self, config=CONFIG_FILE):
         self.configuration_file = CONFIG_FILE
         plugin_location = utils.getPluginFromConfig(CONFIG_FILE)
         print "PLUGIN LOCATION:%s" % plugin_location
index 41dd3271d90700bb715527786bd1a780fba58fe4..f82397ebbbdcf4d51b3185580f8ae827969fef5b 100644 (file)
@@ -166,7 +166,7 @@ class DummyDataPlugin(object):
         are attached to the network
         """
         print("get_network_details() called\n")
-        vifs_on_net = ["/tenant1/networks/net_id/portid/vif2.0", "/tenant1/networks/10/121/vif1.1"]
+        vifs_on_net = ["/tenant1/networks/net_id/portid/vif2.0"]
         return vifs_on_net
     
     
index 8f7b558694cd2adfd5365af9975e2c0ee81b4cef..8e3f1f8e152b0ce0d8ec359a41373c67514009b5 100644 (file)
@@ -35,31 +35,34 @@ class QuantumPluginBase(object):
         Returns a dictionary containing all
         <network_uuid, network_name> for
         the specified tenant.
-        
         :returns: a list of mapping sequences with the following signature:
-                     [ {'net-id': uuid that uniquely identifies the particular quantum network,
-                        'net-name': a human-readable name associated with network referenced by net-id
+                     [ {'net-id': uuid that uniquely identifies
+                                      the particular quantum network,
+                        'net-name': a human-readable name associated
+                                      with network referenced by net-id
                        },
                        ....
-                       {'net-id': uuid that uniquely identifies the particular quantum network,
-                        'net-name': a human-readable name associated with network referenced by net-id
+                       {'net-id': uuid that uniquely identifies the
+                                       particular quantum network,
+                        'net-name': a human-readable name associated
+                                       with network referenced by net-id
                        }
-                    ]      
+                    ]
         :raises: None
         """
         pass
 
-
-
     @abstractmethod
     def create_network(self, tenant_id, net_name):
         """
         Creates a new Virtual Network, and assigns it
         a symbolic name.
-        
+
         :returns: a sequence of mappings with the following signature:
-                    {'net-id': uuid that uniquely identifies the particular quantum network,
-                     'net-name': a human-readable name associated with network referenced by net-id
+                    {'net-id': uuid that uniquely identifies the
+                                     particular quantum network,
+                     'net-name': a human-readable name associated
+                                    with network referenced by net-id
                     }
         :raises:
         """
@@ -70,9 +73,10 @@ class QuantumPluginBase(object):
         """
         Deletes the network with the specified network identifier
         belonging to the specified tenant.
-        
+
         :returns: a sequence of mappings with the following signature:
-                    {'net-id': uuid that uniquely identifies the particular quantum network
+                    {'net-id': uuid that uniquely identifies the
+                                 particular quantum network
                     }
         :raises: exception.NetworkInUse
         :raises: exception.NetworkNotFound
@@ -84,11 +88,14 @@ class QuantumPluginBase(object):
         """
         Retrieves a list of all the remote vifs that
         are attached to the network.
-        
+
         :returns: a sequence of mappings with the following signature:
-                    {'net-id': uuid that uniquely identifies the particular quantum network
-                     'net-name': a human-readable name associated with network referenced by net-id
-                     'net-ifaces': ['vif1_on_network_uuid', 'vif2_on_network_uuid',...,'vifn_uuid'] 
+                    {'net-id': uuid that uniquely identifies the
+                                particular quantum network
+                     'net-name': a human-readable name associated
+                                 with network referenced by net-id
+                     'net-ifaces': ['vif1_on_network_uuid',
+                                    'vif2_on_network_uuid',...,'vifn_uuid']
                     }
         :raises: exception.NetworkNotFound
         """
@@ -99,10 +106,13 @@ class QuantumPluginBase(object):
         """
         Updates the symbolic name belonging to a particular
         Virtual Network.
-        
-        :returns: a sequence of mappings representing the new network attributes, with the following signature:
-                    {'net-id': uuid that uniquely identifies the particular quantum network
-                     'net-name': the new human-readable name associated with network referenced by net-id
+
+        :returns: a sequence of mappings representing the new network
+                    attributes, with the following signature:
+                    {'net-id': uuid that uniquely identifies the
+                                 particular quantum network
+                     'net-name': the new human-readable name
+                                  associated with network referenced by net-id
                     }
         :raises: exception.NetworkNotFound
         """
@@ -113,14 +123,16 @@ class QuantumPluginBase(object):
         """
         Retrieves all port identifiers belonging to the
         specified Virtual Network.
-        
+
         :returns: a list of mapping sequences with the following signature:
-                     [ {'port-id': uuid representing a particular port on the specified quantum network
+                     [ {'port-id': uuid representing a particular port
+                                    on the specified quantum network
                        },
                        ....
-                       {'port-id': uuid representing a particular port on the specified quantum network
+                       {'port-id': uuid representing a particular port
+                                     on the specified quantum network
                        }
-                    ]   
+                    ]
         :raises: exception.NetworkNotFound
         """
         pass
@@ -129,9 +141,10 @@ class QuantumPluginBase(object):
     def create_port(self, tenant_id, net_id, port_state=None):
         """
         Creates a port on the specified Virtual Network.
-        
+
         :returns: a mapping sequence with the following signature:
-                    {'port-id': uuid representing the created port on specified quantum network
+                    {'port-id': uuid representing the created port
+                                   on specified quantum network
                     }
         :raises: exception.NetworkNotFound
         :raises: exception.StateInvalid
@@ -143,9 +156,10 @@ class QuantumPluginBase(object):
         """
         Updates the state of a specific port on the
         specified Virtual Network.
-        
+
         :returns: a mapping sequence with the following signature:
-                    {'port-id': uuid representing the updated port on specified quantum network
+                    {'port-id': uuid representing the
+                                 updated port on specified quantum network
                      'port-state': update port state( UP or DOWN)
                     }
         :raises: exception.StateInvalid
@@ -160,9 +174,10 @@ class QuantumPluginBase(object):
         if the port contains a remote interface attachment,
         the remote interface is first un-plugged and then the port
         is deleted.
-        
+
         :returns: a mapping sequence with the following signature:
-                    {'port-id': uuid representing the deleted port on specified quantum network
+                    {'port-id': uuid representing the deleted port
+                                 on specified quantum network
                     }
         :raises: exception.PortInUse
         :raises: exception.PortNotFound
@@ -175,11 +190,14 @@ class QuantumPluginBase(object):
         """
         This method allows the user to retrieve a remote interface
         that is attached to this particular port.
-        
+
         :returns: a mapping sequence with the following signature:
-                    {'port-id': uuid representing the port on specified quantum network
-                     'net-id': uuid representing the particular quantum network
-                     'attachment': uuid of the virtual interface bound to the port, None otherwise
+                    {'port-id': uuid representing the port on
+                                 specified quantum network
+                     'net-id': uuid representing the particular
+                                quantum network
+                     'attachment': uuid of the virtual interface
+                                   bound to the port, None otherwise
                     }
         :raises: exception.PortNotFound
         :raises: exception.NetworkNotFound
@@ -191,11 +209,12 @@ class QuantumPluginBase(object):
         """
         Attaches a remote interface to the specified port on the
         specified Virtual Network.
-        
+
         :returns: None
         :raises: exception.NetworkNotFound
         :raises: exception.PortNotFound
-        :raises: exception.AlreadyAttached (? should the network automatically unplug/replug)
+        :raises: exception.AlreadyAttached
+                    (? should the network automatically unplug/replug)
         """
         pass
 
@@ -204,14 +223,13 @@ class QuantumPluginBase(object):
         """
         Detaches a remote interface from the specified port on the
         specified Virtual Network.
-        
+
         :returns: None
         :raises: exception.NetworkNotFound
         :raises: exception.PortNotFound
         """
         pass
 
-
     @classmethod
     def __subclasshook__(cls, klass):
         """
index 193725ef3eee50d7da8299b7fd7ae571c08e4f7c..1406462b18a02f305994ab17f665b7ab750a6282 100644 (file)
@@ -88,7 +88,7 @@ class QuantumApiService(WsgiService):
         return service
 
 
-def serve_wsgi(cls, conf=None, options = None, args=None):
+def serve_wsgi(cls, conf=None, options=None, args=None):
     try:
         service = cls.create(conf, options, args)
     except Exception:
@@ -99,7 +99,7 @@ def serve_wsgi(cls, conf=None, options = None, args=None):
 
     return service
 
-    
+
 def _run_wsgi(app_name, paste_conf, paste_config_file):
     LOG.info(_('Using paste.deploy config at: %s'), paste_config_file)
     app = config.load_paste_app(paste_config_file, app_name)