from neutron.plugins.common import constants as plugin_const
from neutron.plugins.nicira.api_client import exception as api_exc
from neutron.plugins.nicira.common import config # noqa
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
from neutron.plugins.nicira.common import nsx_utils
from neutron.plugins.nicira.common import securitygroups as sg_utils
from neutron.plugins.nicira.common import sync
port_data.get('mac_address'))
LOG.debug(_("Created NVP router port:%s"), lrouter_port['uuid'])
except api_exc.NsxApiException:
- LOG.exception(_("Unable to create port on NVP logical router %s"),
+ LOG.exception(_("Unable to create port on NSX logical router %s"),
nsx_router_id)
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=_("Unable to create logical router port for neutron "
"port id %(port_id)s on router %(nsx_router_id)s") %
{'port_id': port_data.get('id'),
"Neutron %(q_port_id)s"),
{'r_port_id': nsx_router_port_id,
'q_port_id': port_data.get('id')})
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=(_("Unable to plug attachment in router port "
"%(r_port_id)s for neutron port id %(q_port_id)s "
"on router %(router_id)s") %
err_desc = _("An exception occurred while selecting logical "
"switch for the port")
LOG.exception(err_desc)
- raise nvp_exc.NvpPluginException(err_msg=err_desc)
+ raise nsx_exc.NsxPluginException(err_msg=err_desc)
def _nvp_create_port_helper(self, session, ls_uuid, port_data,
do_port_security=True):
"""Driver for creating a switch port to be connected to a router."""
# No router ports on external networks!
if self._network_is_external(context, port_data['network_id']):
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=(_("It is not allowed to create router interface "
"ports on external networks as '%s'") %
port_data['network_id']))
lr_port = routerlib.find_router_gw_port(context, self.cluster,
nsx_router_id)
if not lr_port:
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=(_("The gateway port for the NSX router %s "
"was not found on the backend")
% nsx_router_id))
self.cluster.default_l3_gw_service_uuid)
except api_exc.ResourceNotFound:
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=_("Logical router resource %s not found "
"on NVP platform") % router_id)
except api_exc.NsxApiException:
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=_("Unable to update logical router"
"on NVP Platform"))
LOG.debug(_("_nvp_delete_ext_gw_port completed on external network "
Exceptions specific to the NVP Plugin are mapped to standard
HTTP Exceptions.
"""
- base.FAULT_MAP.update({nvp_exc.NvpInvalidNovaZone:
+ base.FAULT_MAP.update({nsx_exc.InvalidNovaZone:
webob.exc.HTTPBadRequest,
- nvp_exc.NvpNoMorePortsException:
+ nsx_exc.NoMorePortsException:
webob.exc.HTTPBadRequest,
- nvp_exc.MaintenanceInProgress:
+ nsx_exc.MaintenanceInProgress:
webob.exc.HTTPServiceUnavailable})
def _validate_provider_create(self, context, network):
else:
LOG.error(_("Maximum number of logical ports reached for "
"logical network %s"), network.id)
- raise nvp_exc.NvpNoMorePortsException(network=network.id)
+ raise nsx_exc.NoMorePortsException(network=network.id)
def _convert_to_nvp_transport_zones(self, cluster, network=None,
bindings=None):
self.cluster, router['id'],
tenant_id, router['name'], nexthop,
distributed=attr.is_attr_set(distributed) and distributed)
- except nvp_exc.NvpInvalidVersion:
+ except nsx_exc.InvalidVersion:
msg = _("Cannot create a distributed router with the NVP "
"platform currently in execution. Please, try "
"without specifying the 'distributed' attribute.")
except api_exc.NsxApiException:
err_msg = _("Unable to create logical router on NVP Platform")
LOG.exception(err_msg)
- raise nvp_exc.NvpPluginException(err_msg=err_msg)
+ raise nsx_exc.NsxPluginException(err_msg=err_msg)
# Create the port here - and update it later if we have gw_info
try:
self.cluster, context, lrouter['uuid'], {'fake_ext_gw': True},
"L3GatewayAttachment",
self.cluster.default_l3_gw_service_uuid)
- except nvp_exc.NvpPluginException:
+ except nsx_exc.NsxPluginException:
LOG.exception(_("Unable to create L3GW port on logical router "
"%(router_uuid)s. Verify Default Layer-3 Gateway "
"service %(def_l3_gw_svc)s id is correct"),
# Try and remove logical router from NVP
routerlib.delete_lrouter(self.cluster, lrouter['uuid'])
# Return user a 500 with an apter message
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=(_("Unable to create router %s on NSX backend") %
router['id']))
lrouter['status'] = plugin_const.ACTIVE
with context.session.begin(subtransactions=True):
router_db = self._get_router(context, router_id)
router_db['status'] = constants.NET_STATUS_ERROR
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=_("Logical router %s not found "
"on NVP Platform") % router_id)
except api_exc.NsxApiException:
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=_("Unable to update logical router on NVP Platform"))
- except nvp_exc.NvpInvalidVersion:
+ except nsx_exc.InvalidVersion:
msg = _("Request cannot contain 'routes' with the NVP "
"platform currently in execution. Please, try "
"without specifying the static routes.")
LOG.warning(_("Logical router '%s' not found "
"on NVP Platform"), router_id)
except api_exc.NsxApiException:
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=(_("Unable to delete logical router '%s' "
"on NVP Platform") % nsx_router_id))
# Remove the NSX mapping first in order to ensure a mapping to
max_num_expected=1, min_num_expected=0,
destination_ip_addresses=subnet['cidr'])
except api_exc.ResourceNotFound:
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=(_("Logical router resource %s not found "
"on NVP platform") % router_id))
except api_exc.NsxApiException:
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
err_msg=(_("Unable to update logical router"
"on NVP Platform")))
return info
"on the NVP platform for floating ip:%s"),
floating_ip_address)
raise
- except nvp_exc.NvpNatRuleMismatch:
+ except nsx_exc.NatRuleMismatch:
# Do not surface to the user
LOG.warning(_("An incorrect number of matching NAT rules "
"was found on the NVP platform"))
{'floating_ip': floating_ip,
'internal_ip': internal_ip})
msg = _("Failed to update NAT rules for floatingip update")
- raise nvp_exc.NvpPluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
floatingip_db.update({'fixed_ip_address': internal_ip,
'fixed_port_id': port_id,
self.cluster, tenant_id, gw_data['name'], devices)
nsx_uuid = nsx_res.get('uuid')
except api_exc.Conflict:
- raise nvp_exc.NvpL2GatewayAlreadyInUse(gateway=gw_data['name'])
+ raise nsx_exc.L2GatewayAlreadyInUse(gateway=gw_data['name'])
except api_exc.NsxApiException:
err_msg = _("Unable to create l2_gw_service for: %s") % gw_data
LOG.exception(err_msg)
- raise nvp_exc.NvpPluginException(err_msg=err_msg)
+ raise nsx_exc.NsxPluginException(err_msg=err_msg)
gw_data['id'] = nsx_uuid
return super(NvpPluginV2, self).create_network_gateway(context,
network_gateway)
return super(NvpPluginV2, self).connect_network(
context, network_gateway_id, network_mapping_info)
except api_exc.Conflict:
- raise nvp_exc.NvpL2GatewayAlreadyInUse(gateway=network_gateway_id)
+ raise nsx_exc.L2GatewayAlreadyInUse(gateway=network_gateway_id)
def disconnect_network(self, context, network_gateway_id,
network_mapping_info):
"%(sec_group_id)s"),
{'sec_profile_id': nsx_sec_profile_id,
'sec_group_id': security_group_id})
- raise nvp_exc.NvpPluginException(
+ raise nsx_exc.NsxPluginException(
_("Unable to remove security group %s from backend"),
security_group['id'])
return super(NvpPluginV2, self).delete_security_group(
from neutron.plugins.common import constants as service_constants
from neutron.plugins.nicira.api_client import exception as api_exc
from neutron.plugins.nicira.common import config # noqa
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
from neutron.plugins.nicira.common import utils
from neutron.plugins.nicira.dbexts import servicerouter as sr_db
from neutron.plugins.nicira.dbexts import vcns_db
context, firewall_db.Firewall, router_id=router_id):
msg = _("A firewall is already associated with the router")
LOG.error(msg)
- raise nvp_exc.NvpServiceOverQuota(
+ raise nsx_exc.ServiceOverQuota(
overs='firewall', err_msg=msg)
fw = super(NvpAdvancedPlugin, self).create_firewall(context, firewall)
{'model': model,
'id': id})
LOG.error(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
else:
res.status = status
except sa_exc.NoResultFound:
{'model': model,
'id': id})
LOG.exception(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
if obj:
obj['status'] = status
if not self._is_advanced_service_router(context, router_id):
msg = _("router_id: %s is not an advanced router!") % router_id
LOG.error(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
#Check whether the vip port is an external port
subnet_id = vip['vip']['subnet_id']
if not ext_net.external:
msg = (_("Network '%s' is not a valid external "
"network") % network_id)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
v = super(NvpAdvancedPlugin, self).create_vip(context, vip)
#Get edge_id for the resource
msg = _("Vcns right now can only support "
"one monitor per pool")
LOG.error(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
#Check whether the pool is already associated with the vip
if not pool.get('vip_id'):
res = super(NvpAdvancedPlugin,
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2012 Nicira Networks, Inc
+# Copyright 2012 VMware, Inc
+#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# License for the specific language governing permissions and limitations
# under the License.
-"""NVP Plugin exceptions"""
-
-from neutron.common import exceptions as q_exc
+from neutron.common import exceptions as n_exc
-class NvpPluginException(q_exc.NeutronException):
- message = _("An unexpected error occurred in the NVP Plugin:%(err_msg)s")
+class NsxPluginException(n_exc.NeutronException):
+ message = _("An unexpected error occurred in the NSX Plugin: %(err_msg)s")
-class NvpInvalidVersion(NvpPluginException):
+class InvalidVersion(NsxPluginException):
message = _("Unable to fulfill request with version %(version)s.")
-class NvpInvalidConnection(NvpPluginException):
- message = _("Invalid NVP connection parameters: %(conn_params)s")
+class InvalidConnection(NsxPluginException):
+ message = _("Invalid NSX connection parameters: %(conn_params)s")
-class NvpInvalidClusterConfiguration(NvpPluginException):
+class InvalidClusterConfiguration(NsxPluginException):
message = _("Invalid cluster values: %(invalid_attrs)s. Please ensure "
"that these values are specified in the [DEFAULT] "
- "section of the nvp plugin ini file.")
+ "section of the NSX plugin ini file.")
-class NvpInvalidNovaZone(NvpPluginException):
+class InvalidNovaZone(NsxPluginException):
message = _("Unable to find cluster config entry "
"for nova zone: %(nova_zone)s")
-class NvpNoMorePortsException(NvpPluginException):
+class NoMorePortsException(NsxPluginException):
message = _("Unable to create port on network %(network)s. "
"Maximum number of ports reached")
-class NvpNatRuleMismatch(NvpPluginException):
+class NatRuleMismatch(NsxPluginException):
message = _("While retrieving NAT rules, %(actual_rules)s were found "
"whereas rules in the (%(min_rules)s,%(max_rules)s) interval "
"were expected")
-class NvpInvalidAttachmentType(NvpPluginException):
- message = _("Invalid NVP attachment type '%(attachment_type)s'")
+class InvalidAttachmentType(NsxPluginException):
+ message = _("Invalid NSX attachment type '%(attachment_type)s'")
-class MaintenanceInProgress(NvpPluginException):
+class MaintenanceInProgress(NsxPluginException):
message = _("The networking backend is currently in maintenance mode and "
"therefore unable to accept requests which modify its state. "
"Please try later.")
-class NvpServicePluginException(q_exc.NeutronException):
- """NVP Service Plugin exceptions."""
- message = _("An unexpected error happened "
- "in the NVP Service Plugin: %(err_msg)s")
-
-
-class NvpL2GatewayAlreadyInUse(q_exc.Conflict):
+class L2GatewayAlreadyInUse(n_exc.Conflict):
message = _("Gateway Service %(gateway)s is already in use")
-class NvpServiceOverQuota(q_exc.Conflict):
+class ServiceOverQuota(n_exc.Conflict):
message = _("Quota exceeded for Vcns resource: %(overs)s: %(err_msg)s")
-class NvpVcnsDriverException(NvpServicePluginException):
- message = _("Error happened in NVP VCNS Driver: %(err_msg)s")
+class VcnsDriverException(NsxPluginException):
+ message = _("Error happened in NSX VCNS Driver: %(err_msg)s")
-class ServiceClusterUnavailable(NvpPluginException):
+class ServiceClusterUnavailable(NsxPluginException):
message = _("Service cluster: '%(cluster_id)s' is unavailable. Please, "
- "check NVP setup and/or configuration")
+ "check NSX setup and/or configuration")
-class PortConfigurationError(NvpPluginException):
+class PortConfigurationError(NsxPluginException):
message = _("An error occurred while connecting LSN %(lsn_id)s "
"and network %(net_id)s via port %(port_id)s")
self.port_id = kwargs.get('port_id')
-class LsnNotFound(q_exc.NotFound):
+class LsnNotFound(n_exc.NotFound):
message = _('Unable to find LSN for %(entity)s %(entity_id)s')
-class LsnPortNotFound(q_exc.NotFound):
+class LsnPortNotFound(n_exc.NotFound):
message = (_('Unable to find port for LSN %(lsn_id)s '
'and %(entity)s %(entity_id)s'))
-class LsnMigrationConflict(q_exc.Conflict):
+class LsnMigrationConflict(n_exc.Conflict):
message = _("Unable to migrate network '%(net_id)s' to LSN: %(reason)s")
-class LsnConfigurationConflict(NvpPluginException):
+class LsnConfigurationConflict(NsxPluginException):
message = _("Configuration conflict on Logical Service Node %(lsn_id)s")
from neutron.openstack.common import loopingcall
from neutron.openstack.common import timeutils
from neutron.plugins.nicira.api_client import exception as api_exc
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
from neutron.plugins.nicira.common import nsx_utils
from neutron.plugins.nicira.nsxlib import router as routerlib
from neutron.plugins.nicira.nsxlib import switch as switchlib
{'req_delay': self._req_delay,
'sync_interval': self._sync_interval})
LOG.error(err_msg)
- raise nvp_exc.NvpPluginException(err_msg=err_msg)
+ raise nsx_exc.NsxPluginException(err_msg=err_msg)
# Backoff time in case of failures while fetching sync data
self._sync_backoff = 1
# Store the looping call in an instance variable to allow unit tests
from sqlalchemy.orm import exc
from neutron.openstack.common import log as logging
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
from neutron.plugins.nicira.dbexts import vcns_models
from neutron.plugins.nicira.vshield.common import (
exceptions as vcns_exc)
if not (session.query(vcns_models.VcnsEdgeFirewallRuleBinding).
filter_by(rule_id=id).delete()):
msg = _("Rule Resource binding with id:%s not found!") % id
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
def get_vcns_edge_firewallrule_binding(session, id, edge_id):
filter_by(edge_id=edge_id, rule_vseid=rule_vseid).one())
except exc.NoResultFound:
msg = _("Rule Resource binding not found!")
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
def cleanup_vcns_edge_firewallrule_binding(session, edge_id):
if not qry.filter_by(vip_id=id).delete():
msg = _("VIP Resource binding with id:%s not found!") % id
LOG.exception(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
def add_vcns_edge_pool_binding(session, map_info):
"pool_vseid:%(pool_vseid)s not found!") %
{'edge_id': edge_id, 'pool_vseid': pool_vseid})
LOG.exception(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
return binding
if not qry.filter_by(pool_id=id, edge_id=edge_id).delete():
msg = _("Pool Resource binding with id:%s not found!") % id
LOG.exception(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
def add_vcns_edge_monitor_binding(session, map_info):
if not qry.filter_by(monitor_id=id, edge_id=edge_id).delete():
msg = _("Monitor Resource binding with id:%s not found!") % id
LOG.exception(msg)
- raise nvp_exc.NvpServicePluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
return lsn_api.lsn_for_network_create(self.cluster, network_id)
except api_exc.NsxApiException:
err_msg = _('Unable to create LSN for network %s') % network_id
- raise p_exc.NvpPluginException(err_msg=err_msg)
+ raise p_exc.NsxPluginException(err_msg=err_msg)
def lsn_delete(self, context, lsn_id):
"""Delete a LSN given its id."""
raise p_exc.LsnNotFound(entity='', entity_id=lsn_id)
except api_exc.NsxApiException:
err_msg = _('Unable to create port for LSN %s') % lsn_id
- raise p_exc.NvpPluginException(err_msg=err_msg)
+ raise p_exc.NsxPluginException(err_msg=err_msg)
def lsn_port_delete(self, context, lsn_id, lsn_port_id):
"""Delete a LSN port from the Logical Service Node."""
self.cluster, network_id, port_id)['uuid']
lsn_id = self.lsn_get(context, network_id)
lsn_port_id = self.lsn_port_create(context, lsn_id, port_data)
- except (n_exc.NotFound, p_exc.NvpPluginException):
+ except (n_exc.NotFound, p_exc.NsxPluginException):
raise p_exc.PortConfigurationError(
net_id=network_id, lsn_id=lsn_id, port_id=port_id)
else:
const.METADATA_PORT_ID, const.METADATA_PORT_NAME,
const.METADATA_DEVICE_ID, True)['uuid']
lsn_port_id = self.lsn_port_create(self.cluster, lsn_id, data)
- except (n_exc.NotFound, p_exc.NvpPluginException,
+ except (n_exc.NotFound, p_exc.NsxPluginException,
api_exc.NsxApiException):
raise p_exc.PortConfigurationError(
net_id=network_id, lsn_id=lsn_id, port_id=lswitch_port_id)
'Node %(lsn_id)s and port %(lsn_port_id)s')
% {'lsn_id': lsn_id, 'lsn_port_id': lsn_port_id})
LOG.error(err_msg)
- raise p_exc.NvpPluginException(err_msg=err_msg)
+ raise p_exc.NsxPluginException(err_msg=err_msg)
def lsn_metadata_configure(self, context, subnet_id, is_enabled):
"""Configure metadata service for the specified subnet."""
err_msg = (_('Unable to configure metadata '
'for subnet %s') % subnet_id)
LOG.error(err_msg)
- raise p_exc.NvpPluginException(err_msg=err_msg)
+ raise p_exc.NsxPluginException(err_msg=err_msg)
if is_enabled:
try:
# test that the lsn port exists
except db_exc.DBError:
err_msg = _('Unable to save LSN for network %s') % network_id
LOG.exception(err_msg)
- raise p_exc.NvpPluginException(err_msg=err_msg)
+ raise p_exc.NsxPluginException(err_msg=err_msg)
def lsn_create(self, context, network_id):
lsn_id = super(PersistentLsnManager,
self).lsn_create(context, network_id)
try:
self.lsn_save(context, network_id, lsn_id)
- except p_exc.NvpPluginException:
+ except p_exc.NsxPluginException:
super(PersistentLsnManager, self).lsn_delete(context, lsn_id)
raise
return lsn_id
except db_exc.DBError:
err_msg = _('Unable to save LSN port for subnet %s') % subnet_id
LOG.exception(err_msg)
- raise p_exc.NvpPluginException(err_msg=err_msg)
+ raise p_exc.NsxPluginException(err_msg=err_msg)
def lsn_port_create(self, context, lsn_id, subnet_info):
lsn_port_id = super(PersistentLsnManager,
try:
self.lsn_port_save(context, lsn_port_id, subnet_info['subnet_id'],
subnet_info['mac_address'], lsn_id)
- except p_exc.NvpPluginException:
+ except p_exc.NsxPluginException:
super(PersistentLsnManager, self).lsn_port_delete(
context, lsn_id, lsn_port_id)
raise
if not lsn_api.service_cluster_exists(cluster, cluster_id):
raise p_exc.ServiceClusterUnavailable(cluster_id=cluster_id)
else:
- raise p_exc.NvpInvalidVersion(version=ver)
+ raise p_exc.InvalidVersion(version=ver)
def handle_network_dhcp_access(plugin, context, network, action):
try:
plugin.lsn_manager.lsn_metadata_configure(
context, subnet_id, is_enabled)
- except p_exc.NvpPluginException:
+ except p_exc.NsxPluginException:
if is_enabled:
l3_db.L3_NAT_db_mixin.remove_router_interface(
plugin, context, router_id, interface)
from neutron.openstack.common import log as logging
from neutron.plugins.nicira.api_client import exception as api_exc
from neutron.plugins.nicira.common import config
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
LOG = logging.getLogger(__name__)
"created or destroyed"), router_id)
# TODO(salvatore-orlando): A better exception handling in the
# NSX plugin would allow us to improve error handling here
- except (ntn_exc.NeutronException, nvp_exc.NvpPluginException,
+ except (ntn_exc.NeutronException, nsx_exc.NsxPluginException,
api_exc.NsxApiException):
# Any exception here should be regarded as non-fatal
LOG.exception(_("An error occurred while operating on the "
{'subnet_id': meta_sub['id']})
greenthread.sleep(0) # yield
except (ntn_exc.NeutronException,
- nvp_exc.NvpPluginException,
+ nsx_exc.NsxPluginException,
api_exc.NsxApiException):
# It is not necessary to explicitly delete the subnet
# as it will be removed with the network
# Remove network (this will remove the subnet too)
plugin.delete_network(context, meta_net_id)
greenthread.sleep(0) # yield
- except (ntn_exc.NeutronException, nvp_exc.NvpPluginException,
+ except (ntn_exc.NeutronException, nsx_exc.NsxPluginException,
api_exc.NsxApiException):
# must re-add the router interface
plugin.add_router_interface(context, router_id,
else:
error = _("Invalid agent_mode: %s") % cfg.CONF.NSX.agent_mode
LOG.error(error)
- raise nsx_exc.NvpPluginException(err_msg=error)
+ raise nsx_exc.NsxPluginException(err_msg=error)
self.handle_network_dhcp_access_delegate = (
mod.handle_network_dhcp_access
)
try:
error = None
nsx_svc.check_services_requirements(self.cluster)
- except nsx_exc.NvpInvalidVersion:
+ except nsx_exc.InvalidVersion:
error = _("Unable to run Neutron with config option '%s', as NSX "
"does not support it") % cfg.CONF.NSX.agent_mode
except nsx_exc.ServiceClusterUnavailable:
"'%s'") % cfg.CONF.NSX.agent_mode
if error:
LOG.exception(error)
- raise nsx_exc.NvpPluginException(err_msg=error)
+ raise nsx_exc.NsxPluginException(err_msg=error)
def get_lsn(self, context, network_id, fields=None):
report = self.migration_manager.report(context, network_id)
# If everything went according to plan these two lists should be empty
if self._required_attributes:
- raise exceptions.NvpInvalidClusterConfiguration(
+ raise exceptions.InvalidClusterConfiguration(
invalid_attrs=self._required_attributes)
if self._important_attributes:
LOG.info(_("The following cluster attributes were "
:param display_name: Descriptive name of this gateway service
:param devices: List of transport node uuids (and network
interfaces on them) to use for the network gateway service
- :raise NvpApiException: if there is a problem while communicating
+ :raise NsxApiException: if there is a problem while communicating
with the NSX controller
"""
# NOTE(salvatore-orlando): This is a little confusing, but device_id in
from neutron.common import exceptions as exception
from neutron.openstack.common import log
from neutron.plugins.nicira.api_client import exception as api_exc
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
from neutron.plugins.nicira.common import utils
from neutron.plugins.nicira.nvplib import _build_uri_path
from neutron.plugins.nicira.nvplib import do_request
"already exists with another port") %
{'lsn': lsn_id, 'port': lswitch_port_id})
LOG.exception(msg)
- raise nvp_exc.LsnConfigurationConflict(lsn_id=lsn_id)
+ raise nsx_exc.LsnConfigurationConflict(lsn_id=lsn_id)
def _lsn_configure_action(
from neutron.openstack.common import jsonutils
from neutron.openstack.common import log
from neutron.plugins.nicira.api_client import exception as api_exc
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
from neutron.plugins.nicira.common import utils
from neutron.plugins.nicira.nsxlib.switch import get_port
from neutron.plugins.nicira.nsxlib.versioning import DEFAULT_VERSION
if attachment_vlan:
attach_obj['vlan_id'] = attachment_vlan
else:
- raise nvp_exc.NvpInvalidAttachmentType(
+ raise nsx_exc.InvalidAttachmentType(
attachment_type=nsx_attachment_type)
return do_request(
HTTP_PUT, uri, jsonutils.dumps(attach_obj), cluster=cluster)
to_delete_ids.append(r['uuid'])
if not (len(to_delete_ids) in
range(min_num_expected, max_num_expected + 1)):
- raise nvp_exc.NvpNatRuleMismatch(actual_rules=len(to_delete_ids),
- min_rules=min_num_expected,
- max_rules=max_num_expected)
+ raise nsx_exc.NatRuleMismatch(actual_rules=len(to_delete_ids),
+ min_rules=min_num_expected,
+ max_rules=max_num_expected)
for rule_id in to_delete_ids:
delete_router_nat_rule(cluster, router_id, rule_id)
msg = (_("Router Port %(lport_id)s not found on router "
"%(lrouter_id)s") % data)
LOG.exception(msg)
- raise nvp_exc.NvpPluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
except api_exc.NsxApiException as e:
msg = _("An exception occurred while updating IP addresses on a "
"router logical port:%s") % str(e)
LOG.exception(msg)
- raise nvp_exc.NvpPluginException(err_msg=msg)
+ raise nsx_exc.NsxPluginException(err_msg=msg)
ROUTER_FUNC_DICT = {
if kwargs.get('distributed', None):
v = cluster.api_client.get_version()
if (v.major, v.minor) < (3, 1):
- raise nvp_exc.NvpInvalidVersion(version=v)
+ raise nsx_exc.InvalidVersion(version=v)
return v
if kwargs.get('routes', None):
v = cluster.api_client.get_version()
if (v.major, v.minor) < (3, 2):
- raise nvp_exc.NvpInvalidVersion(version=v)
+ raise nsx_exc.InvalidVersion(version=v)
return v
from neutron.common import exceptions as exception
from neutron.openstack.common import log
from neutron.plugins.nicira.api_client import exception as api_exc
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
from neutron.plugins.nicira.common import utils
from neutron.plugins.nicira.nvplib import _build_uri_path
from neutron.plugins.nicira.nvplib import do_request
except Exception:
err_msg = _("Unable to get ports")
LOG.exception(err_msg)
- raise nvp_exc.NvpPluginException(err_msg=err_msg)
+ raise nsx_exc.NsxPluginException(err_msg=err_msg)
return nsx_lports
from neutron.common import exceptions as exception
from neutron.openstack.common import log
from neutron.plugins.nicira.api_client import exception as api_exc
-from neutron.plugins.nicira.common import exceptions as nvp_exc
+from neutron.plugins.nicira.common import exceptions as nsx_exc
LOG = log.getLogger(__name__)
except api_exc.ResourceNotFound:
raise exception.NotFound()
except api_exc.ReadOnlyMode:
- raise nvp_exc.MaintenanceInProgress()
+ raise nsx_exc.MaintenanceInProgress()
'foo_nexthop', routes={'foo_destination': 'foo_address'})
def test_version_dependent_update_lrouter_old_versions(self):
- self.assertRaises(nsx_exc.NvpInvalidVersion,
+ self.assertRaises(nsx_exc.InvalidVersion,
self._test_version_dependent_update_lrouter,
"2.9")
- self.assertRaises(nsx_exc.NvpInvalidVersion,
+ self.assertRaises(nsx_exc.InvalidVersion,
self._test_version_dependent_update_lrouter,
"3.0")
- self.assertRaises(nsx_exc.NvpInvalidVersion,
+ self.assertRaises(nsx_exc.InvalidVersion,
self._test_version_dependent_update_lrouter,
"3.1")
def test_update_lrouter_port_ips_nonexistent_router_raises(self):
self.assertRaises(
- nsx_exc.NvpPluginException, routerlib.update_lrouter_port_ips,
+ nsx_exc.NsxPluginException, routerlib.update_lrouter_port_ips,
self.fake_cluster, 'boo-router', 'boo-port', [], [])
def test_update_lrouter_port_ips_nsx_exception_raises(self):
with mock.patch.object(routerlib, 'do_request', new=raise_nsx_exc):
self.assertRaises(
- nsx_exc.NvpPluginException, routerlib.update_lrouter_port_ips,
+ nsx_exc.NsxPluginException, routerlib.update_lrouter_port_ips,
self.fake_cluster, lrouter['uuid'],
lrouter_port['uuid'], [], [])
lrouter_port = routerlib.create_router_lport(
self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'], '00:11:22:33:44:55')
- self.assertRaises(nsx_exc.NvpInvalidAttachmentType,
+ self.assertRaises(nsx_exc.InvalidAttachmentType,
routerlib.plug_router_port_attachment,
self.fake_cluster, lrouter['uuid'],
lrouter_port['uuid'], 'gw_att', 'BadType')
rules = routerlib.query_nat_rules(self.fake_cluster, lrouter['uuid'])
self.assertEqual(len(rules), 3)
self.assertRaises(
- nsx_exc.NvpNatRuleMismatch,
+ nsx_exc.NatRuleMismatch,
routerlib.delete_nat_rules_by_match,
self.fake_cluster, lrouter['uuid'],
'SomeWeirdType', 1, 1)
def test_lsn_create_raise_api_error(self):
self.mock_lsn_api.lsn_for_network_create.side_effect = NsxApiException
- self.assertRaises(p_exc.NvpPluginException,
+ self.assertRaises(p_exc.NsxPluginException,
self.manager.lsn_create,
mock.ANY, self.net_id)
self.mock_lsn_api.lsn_for_network_create.assert_called_once_with(
def test_lsn_port_create_api_exception(self):
self._test_lsn_port_create_with_exc(NsxApiException,
- p_exc.NvpPluginException)
+ p_exc.NsxPluginException)
def test_lsn_port_delete(self):
self.manager.lsn_port_delete(mock.ANY, mock.ANY, mock.ANY)
p_exc.LsnNotFound(entity='lsn', entity_id=self.lsn_id))
self.manager.plugin.get_subnet.return_value = (
{'network_id': self.net_id})
- self.assertRaises(p_exc.NvpPluginException,
+ self.assertRaises(p_exc.NsxPluginException,
self.manager.lsn_metadata_configure,
mock.ANY, self.sub_id, True)
def test_lsn_create_failure(self):
with mock.patch.object(
self.manager, 'lsn_save',
- side_effect=p_exc.NvpPluginException(err_msg='')):
- self.assertRaises(p_exc.NvpPluginException,
+ side_effect=p_exc.NsxPluginException(err_msg='')):
+ self.assertRaises(p_exc.NsxPluginException,
self.manager.lsn_create,
self.context, self.net_id)
self.assertTrue(self.mock_lsn_api.lsn_delete.call_count)
subnet = {'subnet_id': self.sub_id, 'mac_address': self.mac}
with mock.patch.object(
self.manager, 'lsn_port_save',
- side_effect=p_exc.NvpPluginException(err_msg='')):
- self.assertRaises(p_exc.NvpPluginException,
+ side_effect=p_exc.NsxPluginException(err_msg='')):
+ self.assertRaises(p_exc.NsxPluginException,
self.manager.lsn_port_create,
self.context, self.net_id, subnet)
self.assertTrue(self.mock_lsn_api.lsn_port_delete.call_count)
if raise_exc:
with mock.patch.object(nsx.l3_db.L3_NAT_db_mixin,
'remove_router_interface') as d:
- mock_func.side_effect = p_exc.NvpPluginException(err_msg='')
- self.assertRaises(p_exc.NvpPluginException,
+ mock_func.side_effect = p_exc.NsxPluginException(err_msg='')
+ self.assertRaises(p_exc.NsxPluginException,
nsx.handle_router_metadata_access,
self.plugin, mock.ANY, 'foo_router_id',
interface)
def test_create_cluster_missing_required_attribute_raises(self):
opts = self.cluster_opts.copy()
opts.pop('default_tz_uuid')
- self.assertRaises(exceptions.NvpInvalidClusterConfiguration,
+ self.assertRaises(exceptions.InvalidClusterConfiguration,
nsx_cluster.NSXCluster, **opts)
with mock.patch.object(client.NsxApiClient,
'get_version',
return_value=version.Version("3.2")):
- self.assertRaises(exceptions.NvpPluginException, NeutronManager)
+ self.assertRaises(exceptions.NsxPluginException, NeutronManager)
def test_agentless_extensions_unmet_deps_fail(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
with mock.patch.object(lsnlib,
'service_cluster_exists',
return_value=False):
- self.assertRaises(exceptions.NvpPluginException,
+ self.assertRaises(exceptions.NsxPluginException,
NeutronManager)
def test_agent_extensions(self):