# Path: neutron_vpnaas/services/vpn/plugin.py
# LOG = logging.getLogger(__name__)
# def add_provider_configuration(type_manager, service_type):
#     def __init__(self):
#     def _flavors_plugin(self):
#     def _check_orphan_vpnservice_associations(self):
#     def _get_provider_for_flavor(self, context, flavor_id):
#     def _get_driver_for_vpnservice(self, context, vpnservice):
#     def _get_driver_for_ipsec_site_connection(self, context,
#                                               ipsec_site_connection):
#     def create_ipsec_site_connection(self, context, ipsec_site_connection):
#     def delete_ipsec_site_connection(self, context, ipsec_conn_id):
#     def update_ipsec_site_connection(
#             self, context,
#             ipsec_conn_id, ipsec_site_connection):
#     def create_vpnservice(self, context, vpnservice):
#     def update_vpnservice(self, context, vpnservice_id, vpnservice):
#     def delete_vpnservice(self, context, vpnservice_id):
# class VPNPlugin(vpn_db.VPNPluginDb):
# class VPNDriverPlugin(VPNPlugin, vpn_db.VPNPluginRpcDbMixin):
# 
# Path: neutron_vpnaas/services/vpn/service_drivers/ipsec.py
# IPSEC = 'ipsec'
# BASE_IPSEC_VERSION = '1.0'
# class IPsecVPNDriver(base_ipsec.BaseIPsecVPNDriver):
#     def __init__(self, service_plugin):
#     def create_rpc_conn(self):
# 
# Path: neutron_vpnaas/services/vpn/service_drivers/ipsec_validator.py
# class IpsecValidationFailure(nexception.BadRequest):
# class IpsecVpnValidator(driver_validator.VpnDriverValidator):
#     def _check_transform_protocol(self, context, transform_protocol):
#     def validate_ipsec_policy(self, context, ipsec_policy):
#     def validate_ipsec_site_connection(self, context, ipsec_sitecon):
# 
# Path: neutron_vpnaas/tests/base.py
# class BaseTestCase(n_base.BaseTestCase):
# class ExtensionTestCase(test_api_v2_extension.ExtensionTestCase):
# class NeutronDbPluginV2TestCase(test_db_plugin.NeutronDbPluginV2TestCase):


from unittest import mock
from neutron.db import servicetype_db as st_db
from neutron_lib import context as n_ctx
from neutron_lib.plugins import constants
from neutron_lib.plugins import directory
from oslo_utils import uuidutils
from neutron_vpnaas.services.vpn import plugin as vpn_plugin
from neutron_vpnaas.services.vpn.service_drivers import ipsec as ipsec_driver
from neutron_vpnaas.services.vpn.service_drivers import ipsec_validator
from neutron_vpnaas.tests import base
        self.__dict__.update(entries)
        super(FakeSqlQueryObject, self).__init__(**entries)


class TestValidatorSelection(base.BaseTestCase):

    def setUp(self):
        super(TestValidatorSelection, self).setUp()
        vpnaas_provider = [{
            'service_type': constants.VPN,
            'name': 'vpnaas',
            'driver': IPSEC_SERVICE_DRIVER,
            'default': True
        }]
        # override the default service provider
        self.service_providers = (
            mock.patch.object(st_db.ServiceTypeManager,
                              'get_service_providers').start())
        self.service_providers.return_value = vpnaas_provider
        mock.patch('neutron_lib.rpc.Connection').start()
        stm = st_db.ServiceTypeManager()
        stm.get_provider_names_by_resource_ids = mock.Mock(
            return_value={})
        mock.patch('neutron.db.servicetype_db.ServiceTypeManager.get_instance',
                   return_value=stm).start()
        mock.patch('neutron_vpnaas.db.vpn.vpn_db.VPNPluginDb.get_vpnservices',
                   return_value=[]).start()
        self.vpn_plugin = vpn_plugin.VPNDriverPlugin()

    def test_reference_driver_used(self):

# Path: neutron_vpnaas/services/vpn/plugin.py
# LOG = logging.getLogger(__name__)
# def add_provider_configuration(type_manager, service_type):
#     def __init__(self):
#     def _flavors_plugin(self):
#     def _check_orphan_vpnservice_associations(self):
#     def _get_provider_for_flavor(self, context, flavor_id):
#     def _get_driver_for_vpnservice(self, context, vpnservice):
#     def _get_driver_for_ipsec_site_connection(self, context,
#                                               ipsec_site_connection):
#     def create_ipsec_site_connection(self, context, ipsec_site_connection):
#     def delete_ipsec_site_connection(self, context, ipsec_conn_id):
#     def update_ipsec_site_connection(
#             self, context,
#             ipsec_conn_id, ipsec_site_connection):
#     def create_vpnservice(self, context, vpnservice):
#     def update_vpnservice(self, context, vpnservice_id, vpnservice):
#     def delete_vpnservice(self, context, vpnservice_id):
# class VPNPlugin(vpn_db.VPNPluginDb):
# class VPNDriverPlugin(VPNPlugin, vpn_db.VPNPluginRpcDbMixin):
# 
# Path: neutron_vpnaas/services/vpn/service_drivers/ipsec.py
# IPSEC = 'ipsec'
# BASE_IPSEC_VERSION = '1.0'
# class IPsecVPNDriver(base_ipsec.BaseIPsecVPNDriver):
#     def __init__(self, service_plugin):
#     def create_rpc_conn(self):
# 
# Path: neutron_vpnaas/services/vpn/service_drivers/ipsec_validator.py
# class IpsecValidationFailure(nexception.BadRequest):
# class IpsecVpnValidator(driver_validator.VpnDriverValidator):
#     def _check_transform_protocol(self, context, transform_protocol):
#     def validate_ipsec_policy(self, context, ipsec_policy):
#     def validate_ipsec_site_connection(self, context, ipsec_sitecon):
# 
# Path: neutron_vpnaas/tests/base.py
# class BaseTestCase(n_base.BaseTestCase):
# class ExtensionTestCase(test_api_v2_extension.ExtensionTestCase):
# class NeutronDbPluginV2TestCase(test_db_plugin.NeutronDbPluginV2TestCase):


# Path: neutron_vpnaas/tests/unit/services/vpn/service_drivers/test_ipsec.py
from unittest import mock
from neutron.db import servicetype_db as st_db
from neutron_lib import context as n_ctx
from neutron_lib.plugins import constants
from neutron_lib.plugins import directory
from oslo_utils import uuidutils
from neutron_vpnaas.services.vpn import plugin as vpn_plugin
from neutron_vpnaas.services.vpn.service_drivers import ipsec as ipsec_driver
from neutron_vpnaas.services.vpn.service_drivers import ipsec_validator
from neutron_vpnaas.tests import base

        self.__dict__.update(entries)
        super(FakeSqlQueryObject, self).__init__(**entries)


class TestValidatorSelection(base.BaseTestCase):

    def setUp(self):
        super(TestValidatorSelection, self).setUp()
        vpnaas_provider = [{
            'service_type': constants.VPN,
            'name': 'vpnaas',
            'driver': IPSEC_SERVICE_DRIVER,
            'default': True
        }]
        # override the default service provider
        self.service_providers = (
            mock.patch.object(st_db.ServiceTypeManager,
                              'get_service_providers').start())
        self.service_providers.return_value = vpnaas_provider
        mock.patch('neutron_lib.rpc.Connection').start()
        stm = st_db.ServiceTypeManager()
        stm.get_provider_names_by_resource_ids = mock.Mock(
            return_value={})
        mock.patch('neutron.db.servicetype_db.ServiceTypeManager.get_instance',
                   return_value=stm).start()
        mock.patch('neutron_vpnaas.db.vpn.vpn_db.VPNPluginDb.get_vpnservices',
                   return_value=[]).start()
        self.vpn_plugin = vpn_plugin.VPNDriverPlugin()

    def test_reference_driver_used(self):

        default_provider = self.vpn_plugin.default_provider