From: Salvatore Orlando Date: Tue, 13 Aug 2013 14:08:27 +0000 (-0700) Subject: Do not call remove_router_lport in remove_router_interface X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d97b56086c0442c58b02c58afb9dd0ed32d6f748;p=openstack-build%2Fneutron-build.git Do not call remove_router_lport in remove_router_interface Bug 1211149 The call will cause a failure as the router port is already removed by _nvp_delete_router_port. This patch also add the support on the fake nvp api client to verify this kind of condition. Change-Id: Ieb5ca5c239ccc993b96dd5bad0b412211b45417e --- diff --git a/neutron/plugins/nicira/NeutronPlugin.py b/neutron/plugins/nicira/NeutronPlugin.py index c8f84e031..f3ef16b64 100644 --- a/neutron/plugins/nicira/NeutronPlugin.py +++ b/neutron/plugins/nicira/NeutronPlugin.py @@ -1848,8 +1848,6 @@ class NvpPluginV2(db_base_plugin_v2.NeutronDbPluginV2, self.cluster, router_id, "NoSourceNatRule", max_num_expected=1, min_num_expected=0, destination_ip_addresses=subnet['cidr']) - nvplib.delete_router_lport(self.cluster, - router_id, lrouter_port_id) except NvpApiClient.ResourceNotFound: raise nvp_exc.NvpPluginException( err_msg=(_("Logical router port resource %s not found " diff --git a/neutron/tests/unit/nicira/etc/fake_get_lswitch_lport.json b/neutron/tests/unit/nicira/etc/fake_get_lswitch_lport.json index fc8051793..cfa7aed46 100644 --- a/neutron/tests/unit/nicira/etc/fake_get_lswitch_lport.json +++ b/neutron/tests/unit/nicira/etc/fake_get_lswitch_lport.json @@ -7,7 +7,13 @@ "_href": "/ws.v1/lswitch/%(ls_uuid)s/lport/%(uuid)s/status", "_schema": "/ws.v1/schema/LogicalSwitchPortStatus"}, "LogicalSwitchConfig": - {"uuid": "%(ls_uuid)s"} + {"uuid": "%(ls_uuid)s"}, + "LogicalPortAttachment": + { + "type": "%(att_type)s", + %(att_info_json)s + "schema": "/ws.v1/schema/%(att_type)s" + } }, "tags": [{"scope": "q_port_id", "tag": "%(neutron_port_id)s"}, diff --git a/neutron/tests/unit/nicira/fake_nvpapiclient.py b/neutron/tests/unit/nicira/fake_nvpapiclient.py index bd2aceaff..1aa96ccf9 100644 --- a/neutron/tests/unit/nicira/fake_nvpapiclient.py +++ b/neutron/tests/unit/nicira/fake_nvpapiclient.py @@ -194,6 +194,8 @@ class FakeClient: fake_lport['neutron_port_id'] = self._get_tag(fake_lport, 'q_port_id') fake_lport['neutron_device_id'] = self._get_tag(fake_lport, 'vm_id') + fake_lport['att_type'] = "NoAttachment" + fake_lport['att_info_json'] = '' self._fake_lswitch_lport_dict[fake_lport['uuid']] = fake_lport fake_lswitch = self._fake_lswitch_dict[ls_uuid] @@ -543,6 +545,13 @@ class FakeClient: relations_2 = {} relations_2['LogicalPortAttachment'] = body_2 resource_2['_relations'] = relations_2 + resource['peer_port_uuid'] = body_2['peer_port_uuid'] + resource['att_info_json'] = ( + "\"peer_port_uuid\": \"%s\"," % + resource_2['uuid']) + resource_2['att_info_json'] = ( + "\"peer_port_uuid\": \"%s\"," % + body_2['peer_port_uuid']) elif body_2['type'] == "L3GatewayAttachment": resource['attachment_gwsvc_uuid'] = ( body_2['l3_gateway_service_uuid']) @@ -550,6 +559,10 @@ class FakeClient: elif body_2['type'] == "L2GatewayAttachment": resource['attachment_gwsvc_uuid'] = ( body_2['l2_gateway_service_uuid']) + elif body_2['type'] == "VifAttachment": + resource['vif_uuid'] = body_2['vif_uuid'] + resource['att_info_json'] = ( + "\"vif_uuid\": \"%s\"," % body_2['vif_uuid']) if not is_attachment: response = response_template % resource