def test_parse_multi_service_provider_opt(self):
     cfg.CONF.set_override('service_provider', [
         constants.LOADBALANCER + ':lbaas:driver_path',
         constants.LOADBALANCER + ':name1:path1',
         constants.LOADBALANCER + ':name2:path2:default'
     ], 'service_providers')
     expected = {
         'service_type': constants.LOADBALANCER,
         'name': 'lbaas',
         'driver': 'driver_path',
         'default': False
     }
     res = provconf.parse_service_provider_opt()
     self.assertEqual(len(res), 3)
     self.assertEqual(res, [
         expected, {
             'service_type': constants.LOADBALANCER,
             'name': 'name1',
             'driver': 'path1',
             'default': False
         }, {
             'service_type': constants.LOADBALANCER,
             'name': 'name2',
             'driver': 'path2',
             'default': True
         }
     ])
Exemple #2
0
 def test_parse_single_default_service_provider_opt(self):
     cfg.CONF.set_override(
         "service_provider", [constants.LOADBALANCER + ":lbaas:driver_path:default"], "service_providers"
     )
     expected = {"service_type": constants.LOADBALANCER, "name": "lbaas", "driver": "driver_path", "default": True}
     res = provconf.parse_service_provider_opt()
     self.assertEqual(len(res), 1)
     self.assertEqual(res, [expected])
    def test_get_service_providers(self):
        cfg.CONF.set_override(
            "service_provider",
            [constants.LOADBALANCER + ":lbaas:driver_path", constants.DUMMY + ":dummy:dummy_dr"],
            "service_providers",
        )
        ctx = context.get_admin_context()
        provconf.parse_service_provider_opt()
        self.manager._load_conf()
        res = self.manager.get_service_providers(ctx)
        self.assertEqual(len(res), 2)

        res = self.manager.get_service_providers(ctx, filters=dict(service_type=[constants.DUMMY]))
        self.assertEqual(len(res), 1)

        res = self.manager.get_service_providers(ctx, filters=dict(service_type=[constants.LOADBALANCER]))
        self.assertEqual(len(res), 1)
    def test_get_service_providers(self):
        cfg.CONF.set_override('service_provider', [
            constants.LOADBALANCER + ':lbaas:driver_path',
            constants.DUMMY + ':dummy:dummy_dr'
        ], 'service_providers')
        ctx = context.get_admin_context()
        provconf.parse_service_provider_opt()
        self.manager._load_conf()
        res = self.manager.get_service_providers(ctx)
        self.assertEqual(len(res), 2)

        res = self.manager.get_service_providers(
            ctx, filters=dict(service_type=[constants.DUMMY]))
        self.assertEqual(len(res), 1)

        res = self.manager.get_service_providers(
            ctx, filters=dict(service_type=[constants.LOADBALANCER]))
        self.assertEqual(len(res), 1)
Exemple #5
0
 def test_parse_multi_service_provider_opt(self):
     self._set_override([
         constants.LOADBALANCER + ':lbaas:driver_path',
         constants.LOADBALANCER + ':name1:path1',
         constants.LOADBALANCER + ':name2:path2:default'
     ])
     res = provconf.parse_service_provider_opt()
     # This parsing crosses repos if additional projects are installed,
     # so check that at least what we expect is there; there may be more.
     self.assertTrue(len(res) >= 3)
 def test_parse_multi_service_provider_opt(self):
     self._set_override([constants.LOADBALANCER +
                         ':lbaas:driver_path',
                         constants.LOADBALANCER + ':name1:path1',
                         constants.LOADBALANCER +
                         ':name2:path2:default'])
     res = provconf.parse_service_provider_opt()
     # This parsing crosses repos if additional projects are installed,
     # so check that at least what we expect is there; there may be more.
     self.assertTrue(len(res) >= 3)
Exemple #7
0
 def test_parse_single_default_service_provider_opt(self):
     self._set_override([constants.LOADBALANCER +
                        ':lbaas:driver_path:default'])
     expected = {'service_type': constants.LOADBALANCER,
                 'name': 'lbaas',
                 'driver': 'driver_path',
                 'default': True}
     res = provconf.parse_service_provider_opt()
     self.assertEqual(1, len(res))
     self.assertEqual([expected], res)
 def test_parse_single_service_provider_opt(self):
     self._set_override([constants.FIREWALL + ':fwaas:driver_path'])
     expected = {
         'service_type': constants.FIREWALL,
         'name': 'fwaas',
         'driver': 'driver_path',
         'default': False
     }
     res = provconf.parse_service_provider_opt()
     self.assertEqual(1, len(res))
     self.assertEqual([expected], res)
Exemple #9
0
 def test_parse_single_default_service_provider_opt(self):
     cfg.CONF.set_override('service_provider',
                           [constants.LOADBALANCER +
                            ':lbaas:driver_path:default'],
                           'service_providers')
     expected = {'service_type': constants.LOADBALANCER,
                 'name': 'lbaas',
                 'driver': 'driver_path',
                 'default': True}
     res = provconf.parse_service_provider_opt()
     self.assertEqual(len(res), 1)
     self.assertEqual(res, [expected])
 def test_parse_single_default_service_provider_opt(self):
     cfg.CONF.set_override('service_provider',
                           [constants.LOADBALANCER +
                            ':lbaas:driver_path:default'],
                           'service_providers')
     expected = {'service_type': constants.LOADBALANCER,
                 'name': 'lbaas',
                 'driver': 'driver_path',
                 'default': True}
     res = provconf.parse_service_provider_opt()
     self.assertEqual(len(res), 1)
     self.assertEqual(res, [expected])
Exemple #11
0
 def test_parse_multi_service_provider_opt(self):
     cfg.CONF.set_override(
         "service_provider",
         [
             constants.LOADBALANCER + ":lbaas:driver_path",
             constants.LOADBALANCER + ":name1:path1",
             constants.LOADBALANCER + ":name2:path2:default",
         ],
         "service_providers",
     )
     expected = {"service_type": constants.LOADBALANCER, "name": "lbaas", "driver": "driver_path", "default": False}
     res = provconf.parse_service_provider_opt()
     self.assertEqual(len(res), 3)
     self.assertEqual(
         res,
         [
             expected,
             {"service_type": constants.LOADBALANCER, "name": "name1", "driver": "path1", "default": False},
             {"service_type": constants.LOADBALANCER, "name": "name2", "driver": "path2", "default": True},
         ],
     )
 def test_parse_multi_service_provider_opt(self):
     cfg.CONF.set_override('service_provider',
                           [constants.LOADBALANCER +
                            ':lbaas:driver_path',
                            constants.LOADBALANCER + ':name1:path1',
                            constants.LOADBALANCER +
                            ':name2:path2:default'],
                           'service_providers')
     expected = {'service_type': constants.LOADBALANCER,
                 'name': 'lbaas',
                 'driver': 'driver_path',
                 'default': False}
     res = provconf.parse_service_provider_opt()
     self.assertEqual(len(res), 3)
     self.assertEqual(res, [expected,
                            {'service_type': constants.LOADBALANCER,
                             'name': 'name1',
                             'driver': 'path1',
                             'default': False},
                            {'service_type': constants.LOADBALANCER,
                             'name': 'name2',
                             'driver': 'path2',
                             'default': True}])
Exemple #13
0
 def _load_conf(self):
     self.conf = pconf.ProviderConfiguration(
         pconf.parse_service_provider_opt())
 def test_parse_single_default_service_provider_opt(self):
     self._set_override([constants.LOADBALANCER + ":lbaas:driver_path:default"])
     expected = {"service_type": constants.LOADBALANCER, "name": "lbaas", "driver": "driver_path", "default": True}
     res = provconf.parse_service_provider_opt()
     self.assertEqual(1, len(res))
     self.assertEqual([expected], res)
Exemple #15
0
 def _load_conf(self):
     self.conf = pconf.ProviderConfiguration(
         pconf.parse_service_provider_opt())