def check_router_in_use(self, context, router_id): vpnservices = self.get_vpnservices( context, filters={'router_id': [router_id]}) if vpnservices: raise vpnaas.RouterInUseByVPNService( router_id=router_id, vpnservice_id=vpnservices[0]['id'])
def test__validate_router_migration_fail_with_vpnservice(self): '''Test to check router migration fail with vpn.''' router_db, mock_firewall, mock_vpnaas = ( self._router_migration_with_services_setup( test_side_effect_vpn=(vpnaas.RouterInUseByVPNService( router_id='fake_id', vpnservice_id='fake_vpnaas_id')), no_vpn=False, no_fw=True)) mock_vpnaas.assert_called_once_with(self.ctx, router_db)