physical_network = alloc.physical_network
alloc.allocated = True
return (physical_network, segment_type, segment_id, "0.0.0.0")
- raise q_exc.NoNetworkAvailable()
+ raise c_exc.NoMoreNetworkSegments(
+ network_profile_name=network_profile.name)
def reserve_vxlan(db_session, network_profile):
alloc.allocated = True
return (physical_network, segment_type,
segment_id, get_multicast_ip(network_profile))
- raise q_exc.NoNetworkAvailable()
+ raise c_exc.NoMoreNetworkSegments(
+ network_profile_name=network_profile.name)
def alloc_network(db_session, network_profile_id):
with db_session.begin(subtransactions=True):
network_profile = get_network_profile(db_session,
network_profile_id)
- try:
- if network_profile.segment_type == c_const.NETWORK_TYPE_VLAN:
- return reserve_vlan(db_session, network_profile)
- else:
- return reserve_vxlan(db_session, network_profile)
- except q_exc.NoNetworkAvailable:
- raise c_exc.NoMoreNetworkSegments(
- network_profile_name=network_profile.name)
+ if network_profile.segment_type == c_const.NETWORK_TYPE_VLAN:
+ return reserve_vlan(db_session, network_profile)
+ else:
+ return reserve_vxlan(db_session, network_profile)
def reserve_specific_vlan(db_session, physical_network, vlan_id):
profile dictionary. Only these fields will be returned
:returns: network profile dictionary
"""
- try:
- profile = get_network_profile(context.session, id)
- except exc.NoResultFound:
- raise c_exc.NetworkProfileIdNotFound(profile_id=id)
+ profile = get_network_profile(context.session, id)
return self._make_network_profile_dict(profile, fields)
def get_network_profiles(self, context, filters=None, fields=None):
profile dictionary. Only these fields will be returned
:returns: policy profile dictionary
"""
- try:
- profile = get_policy_profile(context.session, id)
- except exc.NoResultFound:
- raise c_exc.PolicyProfileIdNotFound(profile_id=id)
+ profile = get_policy_profile(context.session, id)
return self._make_policy_profile_dict(profile, fields)
def get_policy_profiles(self, context, filters=None, fields=None):
def get_qos_details(self, tenant_id, qos_id):
"""Get QoS Details."""
LOG.debug(_("get_qos_details() called"))
- try:
- qos_level = cdb.get_qos(tenant_id, qos_id)
- except Exception:
- raise cexc.QosNotFound(tenant_id=tenant_id,
- qos_id=qos_id)
- return qos_level
+ return cdb.get_qos(tenant_id, qos_id)
def create_qos(self, tenant_id, qos_name, qos_desc):
"""Create a QoS level."""
def delete_qos(self, tenant_id, qos_id):
"""Delete a QoS level."""
LOG.debug(_("delete_qos() called"))
- try:
- cdb.get_qos(tenant_id, qos_id)
- except Exception:
- raise cexc.QosNotFound(tenant_id=tenant_id,
- qos_id=qos_id)
return cdb.remove_qos(tenant_id, qos_id)
def rename_qos(self, tenant_id, qos_id, new_name):
"""Rename QoS level."""
LOG.debug(_("rename_qos() called"))
- try:
- cdb.get_qos(tenant_id, qos_id)
- except Exception:
- raise cexc.QosNotFound(tenant_id=tenant_id,
- qos_id=qos_id)
- qos = cdb.update_qos(tenant_id, qos_id, new_name)
- return qos
+ return cdb.update_qos(tenant_id, qos_id, new_name)
def get_all_credentials(self):
"""Get all credentials."""
break
else:
# Raise a Neutron exception. Include a description of
- # the original ncclient exception.
+ # the original ncclient exception. No need to preserve T/B
raise cexc.NexusConfigFailed(config=config, exc=e)
def get_credential(self, nexus_ip):
self.connections[nexus_host] = man
except Exception as e:
# Raise a Neutron exception. Include a description of
- # the original ncclient exception.
+ # the original ncclient exception. No need to preserve T/B.
raise cexc.NexusConnectFailed(nexus_host=nexus_host, exc=e)
return self.connections[nexus_host]