From: Jenkins Date: Mon, 31 Mar 2014 08:43:23 +0000 (+0000) Subject: Merge "Delete subnet fails if assoc port has IPs from another subnet" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a107775caa8b67e0cf06a11381a16e5b83300dcb;p=openstack-build%2Fneutron-build.git Merge "Delete subnet fails if assoc port has IPs from another subnet" --- a107775caa8b67e0cf06a11381a16e5b83300dcb diff --cc neutron/tests/unit/test_db_plugin.py index cb7bb311a,11680269e..436928020 --- a/neutron/tests/unit/test_db_plugin.py +++ b/neutron/tests/unit/test_db_plugin.py @@@ -2489,9 -2427,25 +2489,25 @@@ class TestSubnetsV2(NeutronDbPluginV2Te res = req.get_response(self.api) data = self.deserialize(self.fmt, res) self.assertEqual(res.status_int, webob.exc.HTTPConflict.code) - msg = str(q_exc.SubnetInUse(subnet_id=id)) + msg = str(n_exc.SubnetInUse(subnet_id=id)) self.assertEqual(data['NeutronError']['message'], msg) + def test_delete_subnet_with_other_subnet_on_network_still_in_use(self): + with self.network() as network: + with contextlib.nested( + self.subnet(network=network), + self.subnet(network=network, cidr='10.0.1.0/24', + do_delete=False)) as (subnet1, subnet2): + subnet1_id = subnet1['subnet']['id'] + subnet2_id = subnet2['subnet']['id'] + with self.port( + subnet=subnet1, + fixed_ips=[{'subnet_id': subnet1_id}]): + req = self.new_delete_request('subnets', subnet2_id) + res = req.get_response(self.api) + self.assertEqual(res.status_int, + webob.exc.HTTPNoContent.code) + def test_delete_network(self): gateway_ip = '10.0.0.1' cidr = '10.0.0.0/24'