From: Jenkins Date: Sat, 1 Dec 2012 03:01:25 +0000 (+0000) Subject: Merge "prevent deletion of router interface if it is needed by a floating ip" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8ab907f01e99c498f287a197fcbc466686559e5b;p=openstack-build%2Fneutron-build.git Merge "prevent deletion of router interface if it is needed by a floating ip" --- 8ab907f01e99c498f287a197fcbc466686559e5b diff --cc quantum/tests/unit/test_l3_plugin.py index 787d10e3a,d588e1ff6..5f252c3cf --- a/quantum/tests/unit/test_l3_plugin.py +++ b/quantum/tests/unit/test_l3_plugin.py @@@ -1095,10 -1025,37 +1095,37 @@@ class L3NatDBTestCase(test_db_plugin.Qu def test_create_floatingip_invalid_fixed_ip_address_returns_400(self): # API-level test - no need to create all objects for l3 plugin - res = self._create_floatingip('json', utils.str_uuid(), - utils.str_uuid(), 'iamnotnanip') + res = self._create_floatingip('json', uuidutils.generate_uuid(), + uuidutils.generate_uuid(), 'iamnotnanip') self.assertEqual(res.status_int, 400) + def test_floatingip_delete_router_intf_with_subnet_id_returns_409(self): + found = False + with self.floatingip_with_assoc() as fip: + for p in self._list('ports')['ports']: + if p['device_owner'] == 'network:router_interface': + subnet_id = p['fixed_ips'][0]['subnet_id'] + router_id = p['device_id'] + self._router_interface_action( + 'remove', router_id, subnet_id, None, + expected_code=exc.HTTPConflict.code) + found = True + break + self.assertTrue(found) + + def test_floatingip_delete_router_intf_with_port_id_returns_409(self): + found = False + with self.floatingip_with_assoc() as fip: + for p in self._list('ports')['ports']: + if p['device_owner'] == 'network:router_interface': + router_id = p['device_id'] + self._router_interface_action( + 'remove', router_id, None, p['id'], + expected_code=exc.HTTPConflict.code) + found = True + break + self.assertTrue(found) + def test_list_nets_external(self): with self.network() as n1: self._set_net_external(n1['network']['id'])