Docstrings formatted according to pep257

Bug #1020184

quantum/plugins/hyperv/*
quantum/plugins/linuxbridge/*
quantum/plugins/nec/*
quantum/plugins/nicira/*
quantum/plugins/plumgrid/*
quantum/plugins/ryu/*
quantum/plugins/services/*

Change-Id: I3525aa57235935d90ec7b70c65ba15012ce575a3
This commit is contained in:
Sergey Skripnick 2013-04-30 13:35:37 +03:00
parent 58d13eb351
commit ad3b6064df
16 changed files with 92 additions and 95 deletions

View File

@ -89,7 +89,9 @@ class HyperVRpcCallbacks(
return entry return entry
def tunnel_sync(self, rpc_context, **kwargs): def tunnel_sync(self, rpc_context, **kwargs):
"""Dummy function for ovs agent running on Linux to """Tunnel sync.
Dummy function for ovs agent running on Linux to
work with Hyper-V plugin and agent. work with Hyper-V plugin and agent.
""" """
entry = dict() entry = dict()

View File

@ -212,9 +212,7 @@ class LinuxBridgeManager:
def ensure_bridge(self, bridge_name, interface=None, ips=None, def ensure_bridge(self, bridge_name, interface=None, ips=None,
gateway=None): gateway=None):
""" """Create a bridge unless it already exists."""
Create a bridge unless it already exists.
"""
if not self.device_exists(bridge_name): if not self.device_exists(bridge_name):
LOG.debug(_("Starting bridge %(bridge_name)s for subinterface " LOG.debug(_("Starting bridge %(bridge_name)s for subinterface "
"%(interface)s"), "%(interface)s"),
@ -271,9 +269,10 @@ class LinuxBridgeManager:
def add_tap_interface(self, network_id, physical_network, vlan_id, def add_tap_interface(self, network_id, physical_network, vlan_id,
tap_device_name): tap_device_name):
""" """Add tap interface.
If a VIF has been plugged into a network, this function will If a VIF has been plugged into a network, this function will
add the corresponding tap device to the relevant bridge add the corresponding tap device to the relevant bridge.
""" """
if not self.device_exists(tap_device_name): if not self.device_exists(tap_device_name):
LOG.debug(_("Tap device: %s does not exist on " LOG.debug(_("Tap device: %s does not exist on "

View File

@ -25,7 +25,7 @@ from quantum.plugins.nec import ofc_driver_base
class PFCDriverBase(ofc_driver_base.OFCDriverBase): class PFCDriverBase(ofc_driver_base.OFCDriverBase):
"""Base Class for PDC Drivers """Base Class for PDC Drivers.
PFCDriverBase provides methods to handle PFC resources through REST API. PFCDriverBase provides methods to handle PFC resources through REST API.
This uses ofc resource path instead of ofc resource ID. This uses ofc resource path instead of ofc resource ID.
@ -49,7 +49,7 @@ class PFCDriverBase(ofc_driver_base.OFCDriverBase):
return re.sub(r'[^0-9a-zA-Z]', '_', raw_str) return re.sub(r'[^0-9a-zA-Z]', '_', raw_str)
def _generate_pfc_id(self, id_str): def _generate_pfc_id(self, id_str):
"""Generate ID on PFC """Generate ID on PFC.
Currently, PFC ID must be less than 32. Currently, PFC ID must be less than 32.
Shorten UUID string length from 36 to 31 by follows: Shorten UUID string length from 36 to 31 by follows:
@ -67,7 +67,7 @@ class PFCDriverBase(ofc_driver_base.OFCDriverBase):
return self._generate_pfc_str(id_str)[:31] return self._generate_pfc_str(id_str)[:31]
def _generate_pfc_description(self, desc): def _generate_pfc_description(self, desc):
"""Generate Description on PFC """Generate Description on PFC.
Currently, PFC Description must be less than 128. Currently, PFC Description must be less than 128.
""" """

View File

@ -174,7 +174,7 @@ class TremaFilterDriver(object):
class TremaPortBaseDriver(TremaDriverBase, TremaFilterDriver): class TremaPortBaseDriver(TremaDriverBase, TremaFilterDriver):
"""Trema (Sliceable Switch) Driver for port base binding """Trema (Sliceable Switch) Driver for port base binding.
TremaPortBaseDriver uses port base binding. TremaPortBaseDriver uses port base binding.
Ports are identified by datapath_id, port_no and vlan_id. Ports are identified by datapath_id, port_no and vlan_id.
@ -212,7 +212,7 @@ class TremaPortBaseDriver(TremaDriverBase, TremaFilterDriver):
class TremaPortMACBaseDriver(TremaDriverBase, TremaFilterDriver): class TremaPortMACBaseDriver(TremaDriverBase, TremaFilterDriver):
"""Trema (Sliceable Switch) Driver for port-mac base binding """Trema (Sliceable Switch) Driver for port-mac base binding.
TremaPortBaseDriver uses port-mac base binding. TremaPortBaseDriver uses port-mac base binding.
Ports are identified by datapath_id, port_no, vlan_id and mac. Ports are identified by datapath_id, port_no, vlan_id and mac.
@ -268,7 +268,7 @@ class TremaPortMACBaseDriver(TremaDriverBase, TremaFilterDriver):
class TremaMACBaseDriver(TremaDriverBase): class TremaMACBaseDriver(TremaDriverBase):
"""Trema (Sliceable Switch) Driver for mac base binding """Trema (Sliceable Switch) Driver for mac base binding.
TremaPortBaseDriver uses mac base binding. TremaPortBaseDriver uses mac base binding.
Ports are identified by mac. Ports are identified by mac.

View File

@ -38,7 +38,8 @@ def _find_nvp_version_in_headers(headers):
class NVPApiHelper(client_eventlet.NvpApiClientEventlet): class NVPApiHelper(client_eventlet.NvpApiClientEventlet):
''' '''API helper class.
Helper class to do basic login, cookie management, and provide base Helper class to do basic login, cookie management, and provide base
method to send HTTP requests. method to send HTTP requests.
@ -187,14 +188,13 @@ class NVPApiHelper(client_eventlet.NvpApiClientEventlet):
class NvpApiException(Exception): class NvpApiException(Exception):
''' """Base NvpApiClient Exception.
Base NvpApiClient Exception
To correctly use this class, inherit from it and define To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd a 'message' property. That message will get printf'd
with the keyword arguments provided to the constructor. with the keyword arguments provided to the constructor.
''' """
message = _("An unknown exception occurred.") message = _("An unknown exception occurred.")
def __init__(self, **kwargs): def __init__(self, **kwargs):

View File

@ -127,7 +127,8 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
nvp_sec.NVPSecurityGroups, nvp_sec.NVPSecurityGroups,
nvp_meta.NvpMetadataAccess, nvp_meta.NvpMetadataAccess,
agentschedulers_db.AgentSchedulerDbMixin): agentschedulers_db.AgentSchedulerDbMixin):
""" """L2 Virtual network plugin.
NvpPluginV2 is a Quantum plugin that provides L2 Virtual Network NvpPluginV2 is a Quantum plugin that provides L2 Virtual Network
functionality using NVP. functionality using NVP.
""" """
@ -218,10 +219,10 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
raise raise
def _build_ip_address_list(self, context, fixed_ips, subnet_ids=None): def _build_ip_address_list(self, context, fixed_ips, subnet_ids=None):
"""Build ip_addresses data structure for logical router port """Build ip_addresses data structure for logical router port.
No need to perform validation on IPs - this has already been No need to perform validation on IPs - this has already been
done in the l3_db mixin class done in the l3_db mixin class.
""" """
ip_addresses = [] ip_addresses = []
for ip in fixed_ips: for ip in fixed_ips:
@ -624,6 +625,7 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
def _nvp_get_port_id(self, context, cluster, quantum_port): def _nvp_get_port_id(self, context, cluster, quantum_port):
"""Return the NVP port uuid for a given quantum port. """Return the NVP port uuid for a given quantum port.
First, look up the Quantum database. If not found, execute First, look up the Quantum database. If not found, execute
a query on NVP platform as the mapping might be missing because a query on NVP platform as the mapping might be missing because
the port was created before upgrading to grizzly. the port was created before upgrading to grizzly.
@ -649,10 +651,10 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
quantum_port['id']) quantum_port['id'])
def _extend_fault_map(self): def _extend_fault_map(self):
"""Extends the Quantum Fault Map """Extends the Quantum Fault Map.
Exceptions specific to the NVP Plugin are mapped to standard Exceptions specific to the NVP Plugin are mapped to standard
HTTP Exceptions HTTP Exceptions.
""" """
base.FAULT_MAP.update({nvp_exc.NvpInvalidNovaZone: base.FAULT_MAP.update({nvp_exc.NvpInvalidNovaZone:
webob.exc.HTTPBadRequest, webob.exc.HTTPBadRequest,
@ -1280,11 +1282,10 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
def delete_port(self, context, id, l3_port_check=True, def delete_port(self, context, id, l3_port_check=True,
nw_gw_port_check=True): nw_gw_port_check=True):
""" """Deletes a port on a specified Virtual Network.
Deletes a port on a specified Virtual Network,
if the port contains a remote interface attachment, If the port contains a remote interface attachment, the remote
the remote interface is first un-plugged and then the port interface is first un-plugged and then the port is deleted.
is deleted.
:returns: None :returns: None
:raises: exception.PortInUse :raises: exception.PortInUse
@ -1853,10 +1854,10 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
super(NvpPluginV2, self).disassociate_floatingips(context, port_id) super(NvpPluginV2, self).disassociate_floatingips(context, port_id)
def create_network_gateway(self, context, network_gateway): def create_network_gateway(self, context, network_gateway):
"""Create a layer-2 network gateway """Create a layer-2 network gateway.
Create the gateway service on NVP platform and corresponding data Create the gateway service on NVP platform and corresponding data
structures in Quantum datase structures in Quantum datase.
""" """
# Need to re-do authZ checks here in order to avoid creation on NVP # Need to re-do authZ checks here in order to avoid creation on NVP
gw_data = network_gateway[networkgw.RESOURCE_NAME.replace('-', '_')] gw_data = network_gateway[networkgw.RESOURCE_NAME.replace('-', '_')]
@ -1880,10 +1881,10 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
network_gateway) network_gateway)
def delete_network_gateway(self, context, id): def delete_network_gateway(self, context, id):
"""Remove a layer-2 network gateway """Remove a layer-2 network gateway.
Remove the gateway service from NVP platform and corresponding data Remove the gateway service from NVP platform and corresponding data
structures in Quantum datase structures in Quantum datase.
""" """
with context.session.begin(subtransactions=True): with context.session.begin(subtransactions=True):
try: try:
@ -1921,6 +1922,7 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
def create_security_group(self, context, security_group, default_sg=False): def create_security_group(self, context, security_group, default_sg=False):
"""Create security group. """Create security group.
If default_sg is true that means a we are creating a default security If default_sg is true that means a we are creating a default security
group and we don't need to check if one exists. group and we don't need to check if one exists.
""" """
@ -1937,7 +1939,8 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
context, security_group, default_sg) context, security_group, default_sg)
def delete_security_group(self, context, security_group_id): def delete_security_group(self, context, security_group_id):
"""Delete a security group """Delete a security group.
:param security_group_id: security group rule to remove. :param security_group_id: security group rule to remove.
""" """
with context.session.begin(subtransactions=True): with context.session.begin(subtransactions=True):
@ -1959,12 +1962,13 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
context, security_group_id) context, security_group_id)
def create_security_group_rule(self, context, security_group_rule): def create_security_group_rule(self, context, security_group_rule):
"""create a single security group rule.""" """Create a single security group rule."""
bulk_rule = {'security_group_rules': [security_group_rule]} bulk_rule = {'security_group_rules': [security_group_rule]}
return self.create_security_group_rule_bulk(context, bulk_rule)[0] return self.create_security_group_rule_bulk(context, bulk_rule)[0]
def create_security_group_rule_bulk(self, context, security_group_rule): def create_security_group_rule_bulk(self, context, security_group_rule):
"""create security group rules """Create security group rules.
:param security_group_rule: list of rules to create :param security_group_rule: list of rules to create
""" """
s = security_group_rule.get('security_group_rules') s = security_group_rule.get('security_group_rules')

View File

@ -63,8 +63,7 @@ class NVPSecurityGroups(object):
def _get_security_group_rules_nvp_format(self, context, security_group_id, def _get_security_group_rules_nvp_format(self, context, security_group_id,
with_id=False): with_id=False):
"""Query quantum db for security group rules. """Query quantum db for security group rules."""
"""
fields = ['remote_ip_prefix', 'remote_group_id', 'protocol', fields = ['remote_ip_prefix', 'remote_group_id', 'protocol',
'port_range_min', 'port_range_max', 'protocol', 'ethertype'] 'port_range_min', 'port_range_max', 'protocol', 'ethertype']
if with_id: if with_id:
@ -106,7 +105,9 @@ class NVPSecurityGroups(object):
return merged_rules return merged_rules
def _remove_security_group_with_id_and_id_field(self, rules, rule_id): def _remove_security_group_with_id_and_id_field(self, rules, rule_id):
"""This function receives all of the current rule associated with a """Remove rule by rule_id.
This function receives all of the current rule associated with a
security group and then removes the rule that matches the rule_id. In security group and then removes the rule that matches the rule_id. In
addition it removes the id field in the dict with each rule since that addition it removes the id field in the dict with each rule since that
should not be passed to nvp. should not be passed to nvp.

View File

@ -189,7 +189,9 @@ class NVPQoSDbMixin(ext_qos.QueuePluginBase):
return self._fields(res, fields) return self._fields(res, fields)
def _check_for_queue_and_create(self, context, port): def _check_for_queue_and_create(self, context, port):
"""This function determines if a port should be associated with a """Check for queue and create.
This function determines if a port should be associated with a
queue. It works by first querying NetworkQueueMapping to determine queue. It works by first querying NetworkQueueMapping to determine
if the network is associated with a queue. If so, then it queries if the network is associated with a queue. If so, then it queries
NetworkQueueMapping for all the networks that are associated with NetworkQueueMapping for all the networks that are associated with

View File

@ -36,8 +36,10 @@ DEPRECATED_ATTRIBUTES = ['metadata_dhcp_host_route',
class NVPCluster(object): class NVPCluster(object):
"""Encapsulates controller connections and the Api client for a """NVP cluster class.
NVP cluster. Accessed within the NvpPluginV2 class.
Encapsulates controller connections and the API client for a NVP cluster.
Accessed within the NvpPluginV2 class.
Controller-specific parameters, such as timeouts are stored in the Controller-specific parameters, such as timeouts are stored in the
elements of the controllers attribute, which are dicts. elements of the controllers attribute, which are dicts.

View File

@ -224,7 +224,9 @@ def do_multi_request(*args, **kwargs):
# Network functions # Network functions
# ------------------------------------------------------------------- # -------------------------------------------------------------------
def find_port_and_cluster(clusters, port_id): def find_port_and_cluster(clusters, port_id):
"""Return (url, cluster_id) of port or (None, None) if port does not exist. """Find port and cluster.
Returns (url, cluster_id) of port or (None, None) if port does not exist.
""" """
for c in clusters: for c in clusters:
query = "/ws.v1/lswitch/*/lport?uuid=%s&fields=*" % port_id query = "/ws.v1/lswitch/*/lport?uuid=%s&fields=*" % port_id
@ -549,8 +551,10 @@ def update_lrouter(cluster, lrouter_id, display_name, nexthop):
def get_all_networks(cluster, tenant_id, networks): def get_all_networks(cluster, tenant_id, networks):
"""Append the quantum network uuids we can find in the given cluster to """Get all networks.
"networks"
Append the quantum network uuids we can find in the given cluster
to "networks".
""" """
uri = "/ws.v1/lswitch?fields=*&tag=%s&tag_scope=os_tid" % tenant_id uri = "/ws.v1/lswitch?fields=*&tag=%s&tag_scope=os_tid" % tenant_id
try: try:
@ -664,8 +668,7 @@ def get_logical_port_status(cluster, switch, port):
def get_port_by_display_name(clusters, lswitch, display_name): def get_port_by_display_name(clusters, lswitch, display_name):
"""Return (url, cluster_id) of port or raises ResourceNotFound """Return (url, cluster_id) of port or raises PortNotFound."""
"""
query = ("/ws.v1/lswitch/%s/lport?display_name=%s&fields=*" % query = ("/ws.v1/lswitch/%s/lport?display_name=%s&fields=*" %
(lswitch, display_name)) (lswitch, display_name))
LOG.debug(_("Looking for port with display_name " LOG.debug(_("Looking for port with display_name "
@ -685,8 +688,10 @@ def get_port_by_display_name(clusters, lswitch, display_name):
def get_port_by_quantum_tag(cluster, lswitch_uuid, quantum_port_id): def get_port_by_quantum_tag(cluster, lswitch_uuid, quantum_port_id):
"""Return the NVP UUID of the logical port with tag q_port_id """Get port by quantum tag.
equal to quantum_port_id or None if the port is not Found.
Returns the NVP UUID of the logical port with tag q_port_id equal to
quantum_port_id or None if the port is not Found.
""" """
uri = _build_uri_path(LSWITCHPORT_RESOURCE, uri = _build_uri_path(LSWITCHPORT_RESOURCE,
parent_resource_id=lswitch_uuid, parent_resource_id=lswitch_uuid,
@ -938,10 +943,11 @@ def plug_router_port_attachment(cluster, router_id, port_id,
attachment_uuid, nvp_attachment_type, attachment_uuid, nvp_attachment_type,
attachment_vlan=None): attachment_vlan=None):
"""Attach a router port to the given attachment. """Attach a router port to the given attachment.
Current attachment types: Current attachment types:
- PatchAttachment [-> logical switch port uuid] - PatchAttachment [-> logical switch port uuid]
- L3GatewayAttachment [-> L3GatewayService uuid] - L3GatewayAttachment [-> L3GatewayService uuid]
For the latter attachment type a VLAN ID can be specified as well For the latter attachment type a VLAN ID can be specified as well.
""" """
uri = _build_uri_path(LROUTERPORT_RESOURCE, port_id, router_id, uri = _build_uri_path(LROUTERPORT_RESOURCE, port_id, router_id,
is_attachment=True) is_attachment=True)
@ -1036,6 +1042,7 @@ TENANT_ID_SCOPE = 'os_tid'
def format_exception(etype, e, execption_locals, request=None): def format_exception(etype, e, execption_locals, request=None):
"""Consistent formatting for exceptions. """Consistent formatting for exceptions.
:param etype: a string describing the exception type. :param etype: a string describing the exception type.
:param e: the exception. :param e: the exception.
:param request: the request object. :param request: the request object.

View File

@ -88,9 +88,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
'PLUMgrid Plugin has started')) 'PLUMgrid Plugin has started'))
def create_network(self, context, network): def create_network(self, context, network):
""" """Create network core Quantum API."""
Create network core Quantum API
"""
LOG.debug(_('QuantumPluginPLUMgrid Status: create_network() called')) LOG.debug(_('QuantumPluginPLUMgrid Status: create_network() called'))
@ -126,9 +124,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
return net return net
def update_network(self, context, net_id, network): def update_network(self, context, net_id, network):
""" """Update network core Quantum API."""
Update network core Quantum API
"""
LOG.debug(_("QuantumPluginPLUMgridV2.update_network() called")) LOG.debug(_("QuantumPluginPLUMgridV2.update_network() called"))
self._network_admin_state(network) self._network_admin_state(network)
@ -160,9 +156,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
return new_network return new_network
def delete_network(self, context, net_id): def delete_network(self, context, net_id):
""" """Delete network core Quantum API."""
Delete network core Quantum API
"""
LOG.debug(_("QuantumPluginPLUMgrid Status: delete_network() called")) LOG.debug(_("QuantumPluginPLUMgrid Status: delete_network() called"))
super(QuantumPluginPLUMgridV2, self).get_network(context, net_id) super(QuantumPluginPLUMgridV2, self).get_network(context, net_id)
@ -183,9 +177,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
raise plum_excep.PLUMgridException(err_message) raise plum_excep.PLUMgridException(err_message)
def create_port(self, context, port): def create_port(self, context, port):
""" """Create port core Quantum API."""
Create port core Quantum API
"""
LOG.debug(_("QuantumPluginPLUMgrid Status: create_port() called")) LOG.debug(_("QuantumPluginPLUMgrid Status: create_port() called"))
# Port operations on PLUMgrid NOS is an automatic operation from the # Port operations on PLUMgrid NOS is an automatic operation from the
@ -197,10 +189,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
port) port)
def update_port(self, context, port_id, port): def update_port(self, context, port_id, port):
""" """Update port core Quantum API."""
Update port core Quantum API
"""
LOG.debug(_("QuantumPluginPLUMgrid Status: update_port() called")) LOG.debug(_("QuantumPluginPLUMgrid Status: update_port() called"))
# Port operations on PLUMgrid NOS is an automatic operation from the # Port operations on PLUMgrid NOS is an automatic operation from the
@ -211,9 +200,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
context, port_id, port) context, port_id, port)
def delete_port(self, context, port_id): def delete_port(self, context, port_id):
""" """Delete port core Quantum API."""
Delete port core Quantum API
"""
LOG.debug(_("QuantumPluginPLUMgrid Status: delete_port() called")) LOG.debug(_("QuantumPluginPLUMgrid Status: delete_port() called"))
@ -224,9 +211,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
super(QuantumPluginPLUMgridV2, self).delete_port(context, port_id) super(QuantumPluginPLUMgridV2, self).delete_port(context, port_id)
def create_subnet(self, context, subnet): def create_subnet(self, context, subnet):
""" """Create subnet core Quantum API."""
Create subnet core Quantum API
"""
LOG.debug(_("QuantumPluginPLUMgrid Status: create_subnet() called")) LOG.debug(_("QuantumPluginPLUMgrid Status: create_subnet() called"))
@ -253,9 +238,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
return subnet return subnet
def delete_subnet(self, context, subnet_id): def delete_subnet(self, context, subnet_id):
""" """Delete subnet core Quantum API."""
Delete subnet core Quantum API
"""
LOG.debug(_("QuantumPluginPLUMgrid Status: delete_subnet() called")) LOG.debug(_("QuantumPluginPLUMgrid Status: delete_subnet() called"))
#Collecting subnet info #Collecting subnet info
@ -278,9 +261,7 @@ class QuantumPluginPLUMgridV2(db_base_plugin_v2.QuantumDbPluginV2):
return del_subnet return del_subnet
def update_subnet(self, context, subnet_id, subnet): def update_subnet(self, context, subnet_id, subnet):
""" """Update subnet core Quantum API."""
Update subnet core Quantum API
"""
LOG.debug(_("update_subnet() called")) LOG.debug(_("update_subnet() called"))
#Collecting subnet info #Collecting subnet info

View File

@ -52,8 +52,7 @@ LOG = log.getLogger(__name__)
# This is copied of nova.flags._get_my_ip() # This is copied of nova.flags._get_my_ip()
# Agent shouldn't depend on nova module # Agent shouldn't depend on nova module
def _get_my_ip(): def _get_my_ip():
""" """Return the actual ip of the local machine.
Returns the actual ip of the local machine.
This code figures out what source address would be used if some traffic This code figures out what source address would be used if some traffic
were to be sent out to some well known address on the Internet. In this were to be sent out to some well known address on the Internet. In this

View File

@ -98,8 +98,9 @@ class TunnelKey(object):
return session.query(ryu_models_v2.TunnelKeyLast).one() return session.query(ryu_models_v2.TunnelKeyLast).one()
def _find_key(self, session, last_key): def _find_key(self, session, last_key):
""" """Try to find unused tunnel key.
Try to find unused tunnel key in TunnelKey table starting
Trying to find unused tunnel key in TunnelKey table starting
from last_key + 1. from last_key + 1.
When all keys are used, raise sqlalchemy.orm.exc.NoResultFound When all keys are used, raise sqlalchemy.orm.exc.NoResultFound
""" """

View File

@ -20,8 +20,9 @@ from quantum.db import model_base
class TunnelKeyLast(model_base.BASEV2): class TunnelKeyLast(model_base.BASEV2):
"""Lastly allocated Tunnel key. The next key allocation will be started """Last allocated Tunnel key.
from this value + 1
The next key allocation will be started from this value + 1
""" """
last_key = sa.Column(sa.Integer, primary_key=True) last_key = sa.Column(sa.Integer, primary_key=True)

View File

@ -212,8 +212,7 @@ class LoadBalancerAgentApi(proxy.RpcProxy):
class LoadBalancerPlugin(loadbalancer_db.LoadBalancerPluginDb): class LoadBalancerPlugin(loadbalancer_db.LoadBalancerPluginDb):
""" """Implementation of the Quantum Loadbalancer Service Plugin.
Implementation of the Quantum Loadbalancer Service Plugin.
This class manages the workflow of LBaaS request/response. This class manages the workflow of LBaaS request/response.
Most DB related works are implemented in class Most DB related works are implemented in class
@ -222,9 +221,7 @@ class LoadBalancerPlugin(loadbalancer_db.LoadBalancerPluginDb):
supported_extension_aliases = ["lbaas"] supported_extension_aliases = ["lbaas"]
def __init__(self): def __init__(self):
""" """Do the initialization for the loadbalancer service plugin here."""
Do the initialization for the loadbalancer service plugin here.
"""
qdbapi.register_models() qdbapi.register_models()
self.callbacks = LoadBalancerCallbacks(self) self.callbacks = LoadBalancerCallbacks(self)

View File

@ -21,20 +21,21 @@ from quantum.api import extensions
class ServicePluginBase(extensions.PluginInterface): class ServicePluginBase(extensions.PluginInterface):
"""defines base interface for any Advanced Service plugin.""" """Define base interface for any Advanced Service plugin."""
__metaclass__ = abc.ABCMeta __metaclass__ = abc.ABCMeta
supported_extension_aliases = [] supported_extension_aliases = []
@abc.abstractmethod @abc.abstractmethod
def get_plugin_type(self): def get_plugin_type(self):
"""returns one of predefine service types. see """Return one of predefined service types.
quantum/plugins/common/constants.py
See quantum/plugins/common/constants.py
""" """
pass pass
@abc.abstractmethod @abc.abstractmethod
def get_plugin_name(self): def get_plugin_name(self):
"""return a symbolic name for the plugin. """Return a symbolic name for the plugin.
Each service plugin should have a symbolic name. This name Each service plugin should have a symbolic name. This name
will be used, for instance, by service definitions in service types will be used, for instance, by service definitions in service types
@ -43,5 +44,5 @@ class ServicePluginBase(extensions.PluginInterface):
@abc.abstractmethod @abc.abstractmethod
def get_plugin_description(self): def get_plugin_description(self):
"""returns string description of the plugin.""" """Return string description of the plugin."""
pass pass