1
# Copyright (c) 2013 OpenStack Foundation
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
# not use this file except in compliance with the License. You may obtain
6
# a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
# License for the specific language governing permissions and limitations
16
"""Exceptions used by Cisco Nexus ML2 mechanism driver."""
18
from neutron.common import exceptions
21
class CredentialNotFound(exceptions.NeutronException):
22
"""Credential with this ID cannot be found."""
23
message = _("Credential %(credential_id)s could not be found.")
26
class CredentialNameNotFound(exceptions.NeutronException):
27
"""Credential Name could not be found."""
28
message = _("Credential %(credential_name)s could not be found.")
31
class CredentialAlreadyExists(exceptions.NeutronException):
32
"""Credential name already exists."""
33
message = _("Credential %(credential_name)s already exists "
34
"for tenant %(tenant_id)s.")
37
class NexusComputeHostNotConfigured(exceptions.NeutronException):
38
"""Connection to compute host is not configured."""
39
message = _("Connection to %(host)s is not configured.")
42
class NexusConnectFailed(exceptions.NeutronException):
43
"""Failed to connect to Nexus switch."""
44
message = _("Unable to connect to Nexus %(nexus_host)s. Reason: %(exc)s.")
47
class NexusConfigFailed(exceptions.NeutronException):
48
"""Failed to configure Nexus switch."""
49
message = _("Failed to configure Nexus: %(config)s. Reason: %(exc)s.")
52
class NexusPortBindingNotFound(exceptions.NeutronException):
53
"""NexusPort Binding is not present."""
54
message = _("Nexus Port Binding (%(filters)s) is not present")
56
def __init__(self, **kwargs):
57
filters = ','.join('%s=%s' % i for i in kwargs.items())
58
super(NexusPortBindingNotFound, self).__init__(filters=filters)
61
class NexusMissingRequiredFields(exceptions.NeutronException):
62
"""Missing required fields to configure nexus switch."""
63
message = _("Missing required field(s) to configure nexus switch: "
67
class NoNexusSviSwitch(exceptions.NeutronException):
68
"""No usable nexus switch found."""
69
message = _("No usable Nexus switch found to create SVI interface.")
72
class SubnetNotSpecified(exceptions.NeutronException):
73
"""Subnet id not specified."""
74
message = _("No subnet_id specified for router gateway.")
77
class SubnetInterfacePresent(exceptions.NeutronException):
78
"""Subnet SVI interface already exists."""
79
message = _("Subnet %(subnet_id)s has an interface on %(router_id)s.")
82
class PortIdForNexusSvi(exceptions.NeutronException):
83
"""Port Id specified for Nexus SVI."""
84
message = _('Nexus hardware router gateway only uses Subnet Ids.')