90db4802d7
Implement API/driver interface for configuring vShield Edge Appliance. Currently implemented functions: - Deploy an Edge - Destroy an Edge - Configuring interfaces - Configuring SNAT/DNAT rules - Configuring default gateway and static routes - Query Edge status - Task-based asynchronous model - Allow old routes/nat config to be skipped if new updates are coming Implements: blueprint vcns-driver Change-Id: I881bde907f4c90de4c919d008b76b8c2a2d0e1fd
65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
#
|
|
# Copyright 2013 VMware, Inc
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
# @author: linb, VMware
|
|
|
|
from neutron.common import exceptions
|
|
|
|
|
|
class VcnsException(exceptions.NeutronException):
|
|
pass
|
|
|
|
|
|
class VcnsGeneralException(VcnsException):
|
|
def __init__(self, message):
|
|
self.message = message
|
|
super(VcnsGeneralException, self).__init__()
|
|
|
|
|
|
class VcnsApiException(VcnsException):
|
|
message = _("An unknown exception %(status)s occurred: %(response)s.")
|
|
|
|
def __init__(self, **kwargs):
|
|
super(VcnsApiException, self).__init__(**kwargs)
|
|
|
|
self.status = kwargs.get('status')
|
|
self.header = kwargs.get('header')
|
|
self.response = kwargs.get('response')
|
|
|
|
|
|
class ResourceRedirect(VcnsApiException):
|
|
message = _("Resource %(uri)s has been redirected")
|
|
|
|
|
|
class RequestBad(VcnsApiException):
|
|
message = _("Request %(uri)s is Bad, response %(response)s")
|
|
|
|
|
|
class Forbidden(VcnsApiException):
|
|
message = _("Forbidden: %(uri)s")
|
|
|
|
|
|
class ResourceNotFound(VcnsApiException):
|
|
message = _("Resource %(uri)s not found")
|
|
|
|
|
|
class MediaTypeUnsupport(VcnsApiException):
|
|
message = _("Media Type %(uri)s is not supported")
|
|
|
|
|
|
class ServiceUnavailable(VcnsApiException):
|
|
message = _("Service on available: %(uri)s")
|