clean code and fix some comments.
This commit is contained in:
@@ -109,27 +109,6 @@ class QosNotFound(NotFound):
|
||||
message = _("QoS %(_id)s could not be found")
|
||||
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class PortprofileInUse(ExtensionException):
|
||||
message = _("Unable to complete operation on Portprofile %(net_id)s. " \
|
||||
"There is one or more attachments plugged into its ports.")
|
||||
|
||||
|
||||
class PortInUse(ExtensionException):
|
||||
message = _("Unable to complete operation on port %(port_id)s " \
|
||||
"for Portprofile %(net_id)s. The attachment '%(att_id)s" \
|
||||
"is plugged into the logical port.")
|
||||
|
||||
class AlreadyAttached(ExtensionException):
|
||||
message = _("Unable to plug the attachment %(att_id)s into port " \
|
||||
"%(port_id)s for Portprofile %(net_id)s. The attachment is " \
|
||||
"already plugged into port %(att_port_id)s")
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class Duplicate(Error):
|
||||
"""Duplication Error"""
|
||||
pass
|
||||
|
||||
@@ -49,7 +49,8 @@ class Fault(webob.exc.HTTPException):
|
||||
|
||||
@webob.dec.wsgify(RequestClass=wsgi.Request)
|
||||
def __call__(self, req):
|
||||
"""Generate a WSGI response based on the exception passed to ctor."""
|
||||
"""Generate a WSGI response based on the
|
||||
exception passed to constructor."""
|
||||
# Replace the body with fault details.
|
||||
code = self.wrapped_exc.status_int
|
||||
fault_name = self._fault_names.get(code, "quantumServiceFault")
|
||||
|
||||
@@ -23,7 +23,6 @@ import logging
|
||||
from webob import exc
|
||||
from extensions import _credential_view as credential_view
|
||||
from quantum.plugins.cisco.common import cisco_exceptions as exception
|
||||
#from extensions import _exceptions as exception
|
||||
from extensions import _faults as faults
|
||||
|
||||
from quantum.api import api_common as common
|
||||
@@ -60,7 +59,7 @@ class Credential(object):
|
||||
|
||||
@classmethod
|
||||
def get_updated(cls):
|
||||
""" Returns Ext Resource Name """
|
||||
""" Returns Ext Resource Update Time """
|
||||
return "2011-07-25T13:25:27-06:00"
|
||||
|
||||
@classmethod
|
||||
@@ -97,7 +96,6 @@ class CredentialController(common.QuantumController):
|
||||
def __init__(self, plugin):
|
||||
self._resource_name = 'credential'
|
||||
self._plugin = plugin
|
||||
#super(CredentialController, self).__init__(plugin)
|
||||
|
||||
def index(self, request, tenant_id):
|
||||
""" Returns a list of credential ids """
|
||||
@@ -126,7 +124,6 @@ class CredentialController(common.QuantumController):
|
||||
|
||||
def create(self, request, tenant_id):
|
||||
""" Creates a new credential for a given tenant """
|
||||
#look for credential name in request
|
||||
try:
|
||||
req_params = \
|
||||
self._parse_request_params(request,
|
||||
@@ -168,4 +165,4 @@ class CredentialController(common.QuantumController):
|
||||
return exc.HTTPAccepted()
|
||||
except exception.CredentialNotFound as exp:
|
||||
return faults.Fault(faults.CredentialNotFound(exp))
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ from webob import exc
|
||||
|
||||
from extensions import _novatenant_view as novatenant_view
|
||||
from quantum.common import exceptions as qexception
|
||||
#from extensions import _exceptions as exception
|
||||
from extensions import _faults as faults
|
||||
|
||||
from quantum.api import api_common as common
|
||||
@@ -42,27 +41,27 @@ class Novatenant(object):
|
||||
|
||||
@classmethod
|
||||
def get_alias(cls):
|
||||
""" Returns Ext Resource Name """
|
||||
""" Returns Ext Resource alias"""
|
||||
return "Cisco Nova Tenant"
|
||||
|
||||
@classmethod
|
||||
def get_description(cls):
|
||||
""" Returns Ext Resource Name """
|
||||
""" Returns Ext Resource Description """
|
||||
return "novatenant resource is used by nova side to invoke quantum api"
|
||||
|
||||
@classmethod
|
||||
def get_namespace(cls):
|
||||
""" Returns Ext Resource Name """
|
||||
""" Returns Ext Resource Namespace """
|
||||
return "http://docs.ciscocloud.com/api/ext/novatenant/v1.0"
|
||||
|
||||
@classmethod
|
||||
def get_updated(cls):
|
||||
""" Returns Ext Resource Name """
|
||||
""" Returns Ext Resource Updated Time """
|
||||
return "2011-08-09T13:25:27-06:00"
|
||||
|
||||
@classmethod
|
||||
def get_resources(cls):
|
||||
""" Returns Ext Resource Name """
|
||||
""" Returns Ext Resource """
|
||||
parent_resource = dict(member_name="tenant",
|
||||
collection_name="extensions/csco/tenants")
|
||||
member_actions = {'get_host': "PUT",
|
||||
@@ -144,7 +143,6 @@ class NovatenantsController(common.QuantumController):
|
||||
builder = novatenant_view.get_view_builder(request)
|
||||
result = builder.build_host(host)
|
||||
return result
|
||||
#return exc.HTTPAccepted()
|
||||
except qexception.PortNotFound as exp:
|
||||
return faults.Fault(faults.PortNotFound(exp))
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ from webob import exc
|
||||
from extensions import _pprofiles as pprofiles_view
|
||||
from quantum.plugins.cisco.common import cisco_exceptions as exception
|
||||
from quantum.common import exceptions as qexception
|
||||
#from extensions import _exceptions as exception
|
||||
from extensions import _faults as faults
|
||||
|
||||
from quantum.api import api_common as common
|
||||
@@ -59,7 +58,7 @@ class Portprofile(object):
|
||||
|
||||
@classmethod
|
||||
def get_updated(cls):
|
||||
""" Returns Ext Resource Updateed time """
|
||||
""" Returns Ext Resource Updated time """
|
||||
return "2011-07-23T13:25:27-06:00"
|
||||
|
||||
@classmethod
|
||||
@@ -130,7 +129,6 @@ class PortprofilesController(common.QuantumController):
|
||||
return dict(portprofiles=result)
|
||||
except exception.PortProfileNotFound as exp:
|
||||
return faults.Fault(faults.PortprofileNotFound(exp))
|
||||
#return faults.Fault(exp)
|
||||
|
||||
def create(self, request, tenant_id):
|
||||
""" Creates a new portprofile for a given tenant """
|
||||
@@ -188,7 +186,6 @@ class PortprofilesController(common.QuantumController):
|
||||
except exc.HTTPError as exp:
|
||||
return faults.Fault(exp)
|
||||
net_id = req_params['network-id'].strip()
|
||||
#print "*****net id "+net_id
|
||||
port_id = req_params['port-id'].strip()
|
||||
try:
|
||||
self._plugin.associate_portprofile(tenant_id,
|
||||
|
||||
Reference in New Issue
Block a user