From: Jenkins Date: Sun, 15 Sep 2013 23:10:26 +0000 (+0000) Subject: Merge "Add router ownership check on vpnservice creation" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=289524bd78be7ea28caa156896c0b1289c72ae2b;p=openstack-build%2Fneutron-build.git Merge "Add router ownership check on vpnservice creation" --- 289524bd78be7ea28caa156896c0b1289c72ae2b diff --cc neutron/tests/unit/db/vpn/test_db_vpnaas.py index f4f4b525b,3e33c2cc6..9296e9b94 --- a/neutron/tests/unit/db/vpn/test_db_vpnaas.py +++ b/neutron/tests/unit/db/vpn/test_db_vpnaas.py @@@ -768,17 -786,37 +786,46 @@@ class TestVpnaas(VPNPluginDbTestCase) vpnservice['vpnservice'].items() if k in expected), expected) - return vpnservice + + def test_create_vpnservice_with_invalid_router(self): + """Test case to create a vpnservice with invalid router""" + with self.network( + set_context=True, + tenant_id='tenant_a') as network: + with self.subnet(network=network, + cidr='10.2.0.0/24') as subnet: + with self.router( + set_context=True, tenant_id='tenant_a') as router: + router_id = router['router']['id'] + subnet_id = subnet['subnet']['id'] + self._create_vpnservice( + self.fmt, 'fake', + True, router_id, subnet_id, + expected_res_status=webob.exc.HTTPNotFound.code, + set_context=True, tenant_id='tenant_b') + + def test_create_vpnservice_with_nonconnected_subnet(self): + """Test case to create a vpnservice with nonconnected subnet.""" + with self.network() as network: + with self.subnet(network=network, + cidr='10.2.0.0/24') as subnet: + with self.router() as router: + router_id = router['router']['id'] + subnet_id = subnet['subnet']['id'] + self._create_vpnservice( + self.fmt, 'fake', + True, router_id, subnet_id, + expected_res_status=webob.exc.HTTPBadRequest.code) + def test_delete_router_in_use_by_vpnservice(self): + """Test delete router in use by vpn service.""" + with self.subnet(cidr='10.2.0.0/24') as subnet: + with self.router() as router: + with self.vpnservice(subnet=subnet, + router=router): + self._delete('routers', router['router']['id'], + expected_code=webob.exc.HTTPConflict.code) + def _set_active(self, model, resource_id): service_plugin = manager.NeutronManager.get_service_plugins()[ constants.VPN]