'create_subnet',
'delete_subnet', 'update_subnet',
'get_subnet', 'get_subnets', ]
- _master = True
CISCO_FAULT_MAP = {
+ cexc.CredentialAlreadyExists: wexc.HTTPBadRequest,
+ cexc.CredentialNameNotFound: wexc.HTTPNotFound,
+ cexc.CredentialNotFound: wexc.HTTPNotFound,
cexc.NetworkSegmentIDNotFound: wexc.HTTPNotFound,
- cexc.NoMoreNics: wexc.HTTPBadRequest,
cexc.NetworkVlanBindingAlreadyExists: wexc.HTTPBadRequest,
- cexc.VlanIDNotFound: wexc.HTTPNotFound,
- cexc.VlanIDNotAvailable: wexc.HTTPNotFound,
- cexc.QosNotFound: wexc.HTTPNotFound,
- cexc.QosNameAlreadyExists: wexc.HTTPBadRequest,
- cexc.CredentialNotFound: wexc.HTTPNotFound,
- cexc.CredentialNameNotFound: wexc.HTTPNotFound,
- cexc.CredentialAlreadyExists: wexc.HTTPBadRequest,
cexc.NexusComputeHostNotConfigured: wexc.HTTPNotFound,
- cexc.NexusConnectFailed: wexc.HTTPServiceUnavailable,
cexc.NexusConfigFailed: wexc.HTTPBadRequest,
+ cexc.NexusConnectFailed: wexc.HTTPServiceUnavailable,
cexc.NexusPortBindingNotFound: wexc.HTTPNotFound,
+ cexc.NoMoreNics: wexc.HTTPBadRequest,
+ cexc.PortIdForNexusSvi: wexc.HTTPBadRequest,
cexc.PortVnicBindingAlreadyExists: wexc.HTTPBadRequest,
- cexc.PortVnicNotFound: wexc.HTTPNotFound}
+ cexc.PortVnicNotFound: wexc.HTTPNotFound,
+ cexc.QosNameAlreadyExists: wexc.HTTPBadRequest,
+ cexc.QosNotFound: wexc.HTTPNotFound,
+ cexc.SubnetNotSpecified: wexc.HTTPBadRequest,
+ cexc.VlanIDNotAvailable: wexc.HTTPNotFound,
+ cexc.VlanIDNotFound: wexc.HTTPNotFound,
+ }
def __init__(self):
"""Load the model class."""
vlan_created == vlan_creation_expected and
add_appears == add_keyword_expected)
- def _is_vlan_unconfigured(self, vlan_deletion_expected=True):
- vlan_deleted = self._is_in_last_nexus_cfg(
+ def _is_vlan_unconfigured(self, vlan_deletion_expected=True,
+ vlan_untrunk_expected=True):
+ vlan_deleted = self._is_in_nexus_cfg(
['no', 'vlan', 'vlan-id-create-delete'])
- return (self._is_in_nexus_cfg(['allowed', 'vlan', 'remove']) and
- vlan_deleted == vlan_deletion_expected)
+ vlan_untrunked = self._is_in_nexus_cfg(['allowed', 'vlan', 'remove'])
+ return (vlan_deleted == vlan_deletion_expected and
+ vlan_untrunked == vlan_untrunk_expected)
+ def _assertExpectedHTTP(self, status, exc):
+ """Confirm that an HTTP status corresponds to an expected exception.
+
+ Confirm that an HTTP status which has been returned for an
+ neutron API request matches the HTTP status corresponding
+ to an expected exception.
+
+ :param status: HTTP status
+ :param exc: Expected exception
+
+ """
+ if exc in base.FAULT_MAP:
+ expected_http = base.FAULT_MAP[exc].code
+ else:
+ expected_http = wexc.HTTPInternalServerError.code
+ self.assertEqual(status, expected_http)
+
class TestCiscoBasicGet(CiscoNetworkPluginV2TestCase,
test_db_plugin.TestBasicGet):