def setUp(self):
     self.adminContext = context.get_admin_context()
     driver_cls_p = mock.patch('neutron.services.vpn.'
                               'service_drivers.ipsec.IPsecVPNDriver')
     driver_cls = driver_cls_p.start()
     self.driver = mock.Mock()
     self.driver.service_type = ipsec_driver.IPSEC
     self.driver.validator = vpn_validator.VpnReferenceValidator()
     driver_cls.return_value = self.driver
     super(TestVPNDriverPlugin, self).setUp(vpnaas_plugin=VPN_DRIVER_CLASS)
Esempio n. 2
0
    def _get_validator(self):
        """Obtain validator to use for attribute validation.

        Subclasses may override this with a different valdiator, as needed.
        Note: some UTs will directly create a VPNPluginDb object and then
        call its methods, instead of creating a VPNDriverPlugin, which
        will have a service driver associated that will provide a
        validator object. As a result, we use the reference validator here.
        """
        return vpn_validator.VpnReferenceValidator()
Esempio n. 3
0
 def setUp(self):
     super(TestIPsecDriverValidation, self).setUp()
     self.l3_plugin = mock.Mock()
     mock.patch('neutron.manager.NeutronManager.get_service_plugins',
                return_value={
                    constants.L3_ROUTER_NAT: self.l3_plugin
                }).start()
     self.core_plugin = mock.Mock()
     mock.patch('neutron.manager.NeutronManager.get_plugin',
                return_value=self.core_plugin).start()
     self.context = n_ctx.Context('some_user', 'some_tenant')
     self.validator = vpn_validator.VpnReferenceValidator()
Esempio n. 4
0
 def __init__(self, service_plugin, validator=None):
     self.service_plugin = service_plugin
     if validator is None:
         validator = vpn_validator.VpnReferenceValidator()
     self.validator = validator