pep8 changes for quantum-framework code pieces.

This commit is contained in:
Somik Behera 2011-06-06 22:48:57 -07:00
parent 87a984d3f3
commit 5d3d03aee9
6 changed files with 69 additions and 51 deletions

View File

@ -107,4 +107,3 @@ elif sys.argv[1] == "all" and len(sys.argv) == 2:
else:
print "invalid arguments: %s" % str(sys.argv)
usage()

View 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

View 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

View File

@ -35,22 +35,23 @@ 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):
"""
@ -58,8 +59,10 @@ class QuantumPluginBase(object):
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:
"""
@ -72,7 +75,8 @@ class QuantumPluginBase(object):
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
@ -86,9 +90,12 @@ class QuantumPluginBase(object):
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
"""
@ -100,9 +107,12 @@ 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
"""
@ -115,10 +125,12 @@ class QuantumPluginBase(object):
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
@ -131,7 +143,8 @@ class QuantumPluginBase(object):
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
@ -145,7 +158,8 @@ class QuantumPluginBase(object):
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
@ -162,7 +176,8 @@ class QuantumPluginBase(object):
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
@ -177,9 +192,12 @@ class QuantumPluginBase(object):
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
@ -195,7 +213,8 @@ class QuantumPluginBase(object):
: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
@ -211,7 +230,6 @@ class QuantumPluginBase(object):
"""
pass
@classmethod
def __subclasshook__(cls, klass):
"""

View 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: