adapt UT to have a patch merge in Neutron

This change is about to merge :
Iae98f3fe89126a76f16ed9c5230ce299a09ce8d8

Since it modifies VMware NSX UT, I have to patch UT in both
Neutron and stackforge/VMware-nsx projects

Change-Id: I16199ee8d01036c435874ce7930f7c1e37af481c
This commit is contained in:
mathieu-rohon 2015-01-19 19:14:23 +01:00
parent b80c2a8d95
commit 9d5f41ff5d
2 changed files with 11 additions and 11 deletions

View File

@ -628,10 +628,10 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
@lockutils.synchronized('vmware', 'neutron-')
def _nsx_delete_ext_gw_port(self, context, port_data):
lr_port = self._find_router_gw_port(context, port_data)
# TODO(salvatore-orlando): Handle NSX resource
# rollback when something goes not quite as expected
try:
lr_port = self._find_router_gw_port(context, port_data)
# Delete is actually never a real delete, otherwise the NSX
# logical router will stop working
router_id = port_data['device_id']
@ -651,19 +651,19 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
lr_port['uuid'],
"L3GatewayAttachment",
self.cluster.default_l3_gw_service_uuid)
except api_exc.ResourceNotFound:
raise nsx_exc.NsxPluginException(
err_msg=_("Logical router resource %s not found "
"on NSX platform") % router_id)
LOG.debug("_nsx_delete_ext_gw_port completed on external network "
"%(ext_net_id)s, attached to NSX router:%(router_id)s",
{'ext_net_id': port_data['network_id'],
'router_id': nsx_router_id})
except n_exc.NotFound:
LOG.debug("Logical router resource %s not found "
"on NSX platform : the router may have "
"already been deleted",
port_data['device_id'])
except api_exc.NsxApiException:
raise nsx_exc.NsxPluginException(
err_msg=_("Unable to update logical router"
"on NSX Platform"))
LOG.debug("_nsx_delete_ext_gw_port completed on external network "
"%(ext_net_id)s, attached to NSX router:%(router_id)s",
{'ext_net_id': port_data['network_id'],
'router_id': nsx_router_id})
def _nsx_create_l2_gw_port(self, context, port_data):
"""Create a switch port, and attach it to a L2 gateway attachment."""

View File

@ -412,7 +412,7 @@ class FakeClient:
def _lrouter_match(res_uuid):
# verify that the router exist
if parent_uuid and parent_uuid not in self._fake_lrouter_dict:
raise Exception(_("lrouter:%s not found") % parent_uuid)
raise api_exc.ResourceNotFound()
if (not parent_uuid or
res_dict[res_uuid].get('lr_uuid') == parent_uuid):
return True