Skip to content

Commit

Permalink
Docstrings formatted according to pep257
Browse files Browse the repository at this point in the history
Bug #1020184

quantum/plugins/cisco/*

Change-Id: Ibb6a865a17de0ea4f1865972624e4c5da0e96b34
  • Loading branch information
Sergey Skripnick committed Apr 30, 2013
1 parent 58d13eb commit ee3bb94
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 280 deletions.
4 changes: 1 addition & 3 deletions quantum/plugins/cisco/common/cisco_exceptions.py
Expand Up @@ -17,9 +17,7 @@
# @author: Sumit Naiksatam, Cisco Systems, Inc.
# @author: Rohit Agarwalla, Cisco Systems, Inc.

"""
Exceptions used by the Cisco plugin
"""
"""Exceptions used by the Cisco plugin."""

from quantum.common import exceptions

Expand Down
20 changes: 13 additions & 7 deletions quantum/plugins/cisco/common/cisco_faults.py
Expand Up @@ -41,8 +41,9 @@ def __init__(self, exception):

@webob.dec.wsgify(RequestClass=wsgi.Request)
def __call__(self, req):
"""Generate a WSGI response based on the
exception passed to constructor.
"""Generate a WSGI response.
Response is generated based on the exception passed to constructor.
"""
# Replace the body with fault details.
code = self.wrapped_exc.status_int
Expand All @@ -60,7 +61,8 @@ def __call__(self, req):


class PortNotFound(webob.exc.HTTPClientError):
"""
"""PortNotFound exception.
subclass of :class:`~HTTPClientError`
This indicates that the server did not find the port specified
Expand All @@ -74,7 +76,8 @@ class PortNotFound(webob.exc.HTTPClientError):


class CredentialNotFound(webob.exc.HTTPClientError):
"""
"""CredentialNotFound exception.
subclass of :class:`~HTTPClientError`
This indicates that the server did not find the Credential specified
Expand All @@ -89,7 +92,8 @@ class CredentialNotFound(webob.exc.HTTPClientError):


class QosNotFound(webob.exc.HTTPClientError):
"""
"""QosNotFound exception.
subclass of :class:`~HTTPClientError`
This indicates that the server did not find the QoS specified
Expand All @@ -104,7 +108,8 @@ class QosNotFound(webob.exc.HTTPClientError):


class NovatenantNotFound(webob.exc.HTTPClientError):
"""
"""NovatenantNotFound exception.
subclass of :class:`~HTTPClientError`
This indicates that the server did not find the Novatenant specified
Expand All @@ -119,7 +124,8 @@ class NovatenantNotFound(webob.exc.HTTPClientError):


class RequestedStateInvalid(webob.exc.HTTPClientError):
"""
"""RequestedStateInvalid exception.
subclass of :class:`~HTTPClientError`
This indicates that the server could not update the port state to
Expand Down
6 changes: 3 additions & 3 deletions quantum/plugins/cisco/common/cisco_utils.py
Expand Up @@ -26,9 +26,9 @@


def get16ByteUUID(uuid):
"""
Return a 16 byte has of the UUID, used when smaller unique
ID is required.
"""Return first 16 bytes of UUID.
Used when smaller unique ID is required.
"""
return hashlib.md5(uuid).hexdigest()[:16]

Expand Down
7 changes: 4 additions & 3 deletions quantum/plugins/cisco/common/config.py
Expand Up @@ -88,13 +88,14 @@

class CiscoConfigOptions():
"""Cisco Configuration Options Class."""

def __init__(self):
self._create_nexus_dictionary()

def _create_nexus_dictionary(self):
"""
Create the Nexus dictionary from the cisco_plugins.ini
NEXUS_SWITCH section(s).
"""Create the Nexus dictionary.
Reads data from cisco_plugins.ini NEXUS_SWITCH section(s).
"""
for parsed_file in cfg.CONF._cparser.parsed:
for parsed_item in parsed_file.keys():
Expand Down
7 changes: 4 additions & 3 deletions quantum/plugins/cisco/db/api.py
Expand Up @@ -30,9 +30,10 @@


def configure_db(options):
"""
Establish the database, create an engine if needed, and
register the models.
"""Configure database.
Establish the database, create an engine if needed, and register the
models.
:param options: Mapping of configuration options
"""
Expand Down
8 changes: 7 additions & 1 deletion quantum/plugins/cisco/db/l2network_models.py
Expand Up @@ -24,6 +24,7 @@

class L2NetworkBase(object):
"""Base class for L2Network Models."""

__table_args__ = {'mysql_engine': 'InnoDB'}

def __setitem__(self, key, value):
Expand Down Expand Up @@ -54,7 +55,8 @@ def update(self, values):
setattr(self, k, v)

def iteritems(self):
"""Make the model object behave like a dict"
"""Make the model object behave like a dict.
Includes attributes from joins.
"""
local = dict(self)
Expand All @@ -66,6 +68,7 @@ def iteritems(self):

class VlanID(BASE, L2NetworkBase):
"""Represents a vlan_id usage."""

__tablename__ = 'vlan_ids'

vlan_id = Column(Integer, primary_key=True)
Expand All @@ -81,6 +84,7 @@ def __repr__(self):

class VlanBinding(BASE, L2NetworkBase):
"""Represents a binding of vlan_id to network_id."""

__tablename__ = 'vlan_bindings'

vlan_id = Column(Integer, primary_key=True)
Expand All @@ -101,6 +105,7 @@ def __repr__(self):

class QoS(BASE, L2NetworkBase):
"""Represents QoS for a tenant."""

__tablename__ = 'qoss'

qos_id = Column(String(255))
Expand All @@ -121,6 +126,7 @@ def __repr__(self):

class Credential(BASE, L2NetworkBase):
"""Represents credentials for a tenant."""

__tablename__ = 'credentials'

credential_id = Column(String(255))
Expand Down
4 changes: 4 additions & 0 deletions quantum/plugins/cisco/db/models.py
Expand Up @@ -30,6 +30,7 @@

class QuantumBase(object):
"""Base class for Quantum Models."""

__table_args__ = {'mysql_engine': 'InnoDB'}

def __setitem__(self, key, value):
Expand All @@ -56,6 +57,7 @@ def update(self, values):

def iteritems(self):
"""Make the model object behave like a dict.
Includes attributes from joins.
"""
local = dict(self)
Expand All @@ -67,6 +69,7 @@ def iteritems(self):

class Port(BASE, QuantumBase):
"""Represents a port on a quantum network."""

__tablename__ = 'ports'

uuid = Column(String(255), primary_key=True)
Expand All @@ -88,6 +91,7 @@ def __repr__(self):

class Network(BASE, QuantumBase):
"""Represents a quantum network."""

__tablename__ = 'networks'

uuid = Column(String(255), primary_key=True)
Expand Down
6 changes: 5 additions & 1 deletion quantum/plugins/cisco/db/network_models_v2.py
Expand Up @@ -26,6 +26,7 @@

class L2NetworkBase(object):
"""Base class for L2Network Models."""

#__table_args__ = {'mysql_engine': 'InnoDB'}

def __setitem__(self, key, value):
Expand Down Expand Up @@ -56,7 +57,8 @@ def update(self, values):
setattr(self, k, v)

def iteritems(self):
"""Make the model object behave like a dict"
"""Make the model object behave like a dict.
Includes attributes from joins.
"""
local = dict(self)
Expand Down Expand Up @@ -103,6 +105,7 @@ def __repr__(self):

class QoS(model_base.BASEV2, L2NetworkBase):
"""Represents QoS for a tenant."""

__tablename__ = 'qoss'

qos_id = Column(String(255))
Expand All @@ -123,6 +126,7 @@ def __repr__(self):

class Credential(model_base.BASEV2, L2NetworkBase):
"""Represents credentials for a tenant."""

__tablename__ = 'credentials'

credential_id = Column(String(255))
Expand Down
1 change: 1 addition & 0 deletions quantum/plugins/cisco/db/nexus_models_v2.py
Expand Up @@ -23,6 +23,7 @@

class NexusPortBinding(model_base.BASEV2, L2NetworkBase):
"""Represents a binding of VM's to nexus ports."""

__tablename__ = "nexusport_bindings"

id = Column(Integer, primary_key=True, autoincrement=True)
Expand Down
10 changes: 4 additions & 6 deletions quantum/plugins/cisco/extensions/_credential_view.py
Expand Up @@ -19,18 +19,16 @@


def get_view_builder(req):
"""get view builder."""
base_url = req.application_url
return ViewBuilder(base_url)


class ViewBuilder(object):
"""
ViewBuilder for Credential,
derived from quantum.views.networks
"""
"""ViewBuilder for Credential, derived from quantum.views.networks."""

def __init__(self, base_url):
"""
"""Initialize builder.
:param base_url: url of the root wsgi application
"""
self.base_url = base_url
Expand Down
10 changes: 4 additions & 6 deletions quantum/plugins/cisco/extensions/_qos_view.py
Expand Up @@ -19,18 +19,16 @@


def get_view_builder(req):
"""get view builder."""
base_url = req.application_url
return ViewBuilder(base_url)


class ViewBuilder(object):
"""
ViewBuilder for QoS,
derived from quantum.views.networks
"""
"""ViewBuilder for QoS, derived from quantum.views.networks."""

def __init__(self, base_url):
"""
"""Initialize builder.
:param base_url: url of the root wsgi application
"""
self.base_url = base_url
Expand Down
2 changes: 1 addition & 1 deletion quantum/plugins/cisco/extensions/credential.py
Expand Up @@ -31,7 +31,7 @@


class Credential(extensions.ExtensionDescriptor):
"""extension class Credential."""
"""Extension class Credential."""

@classmethod
def get_name(cls):
Expand Down

0 comments on commit ee3bb94

Please sign in to comment.