From bcb30fcc6675473a08c0e97eaec5fd8f15e0fb72 Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Sat, 13 Oct 2012 18:00:20 +0800 Subject: [PATCH] add test for create subnet with default gateway and conflict allocation pool Create subnet with default gateway and conflict allocation pool should return status code 409: $ quantum subnet-create net1 --allocation-pool start=10.0.0.1,end=10.0.0.5 \ 10.0.0.0/24 Found overlapping allocation pools:{u'start': u'10.0.0.1', u'end': u'10.0.0.5'} 10.0.0.1 for subnet 10.0.0.0/24. Change-Id: I8608314ad7899a752eea239dbe224e25c00a375b --- quantum/tests/unit/test_db_plugin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/quantum/tests/unit/test_db_plugin.py b/quantum/tests/unit/test_db_plugin.py index 8c9377387..3d2704977 100644 --- a/quantum/tests/unit/test_db_plugin.py +++ b/quantum/tests/unit/test_db_plugin.py @@ -2037,6 +2037,16 @@ class TestSubnetsV2(QuantumDbPluginV2TestCase): enable_dhcp = False self._test_create_subnet(enable_dhcp=enable_dhcp) + def test_create_subnet_default_gw_conflict_allocation_pool_returns_409( + self): + cidr = '10.0.0.0/24' + allocation_pools = [{'start': '10.0.0.1', + 'end': '10.0.0.5'}] + with self.assertRaises(webob.exc.HTTPClientError) as ctx_manager: + self._test_create_subnet(cidr=cidr, + allocation_pools=allocation_pools) + self.assertEquals(ctx_manager.exception.code, 409) + def test_create_subnet_gateway_in_allocation_pool_returns_409(self): gateway_ip = '10.0.0.50' cidr = '10.0.0.0/24' -- 2.45.2