]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Do not call remove_router_lport in remove_router_interface
authorSalvatore Orlando <salv.orlando@gmail.com>
Tue, 13 Aug 2013 14:08:27 +0000 (07:08 -0700)
committerSalvatore Orlando <salv.orlando@gmail.com>
Tue, 13 Aug 2013 14:34:35 +0000 (07:34 -0700)
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

neutron/plugins/nicira/NeutronPlugin.py
neutron/tests/unit/nicira/etc/fake_get_lswitch_lport.json
neutron/tests/unit/nicira/fake_nvpapiclient.py

index c8f84e031c7a3375428ffe44e68e19a19e5d6a7c..f3ef16b64ff813f0aa7d18947a2fea84f9f7d355 100644 (file)
@@ -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 "
index fc80517932b403ca11c66b5621985e44e7652dfd..cfa7aed463be619e2b7d62d3feb9230866445661 100644 (file)
@@ -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"},
index bd2aceaffe27be6a4e1222958e4671e6d6ee8e9e..1aa96ccf9f44d03eb276917f16a728e2a8a2c927 100644 (file)
@@ -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