Merge "Load transformer plugins from conf file"
This commit is contained in:
commit
ee49396255
@ -32,7 +32,7 @@ class Processor(processor.ProcessorBase):
|
||||
|
||||
def __init__(self, cfg, initialization_status, e_graph=None):
|
||||
self.cfg = cfg
|
||||
self.transformer_manager = TransformerManager()
|
||||
self.transformer_manager = TransformerManager(self.cfg)
|
||||
self.state_manager = StateManager(self.cfg)
|
||||
self._initialize_events_actions()
|
||||
self.initialization_status = initialization_status
|
||||
|
@ -16,53 +16,25 @@
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.exception import VitrageTransformerError
|
||||
from vitrage.synchronizer.plugins.nagios.transformer import NagiosTransformer
|
||||
from vitrage.synchronizer.plugins.nova.host.transformer import HostTransformer
|
||||
from vitrage.synchronizer.plugins.nova.instance.transformer import \
|
||||
InstanceTransformer
|
||||
from vitrage.synchronizer.plugins.nova.zone.transformer import ZoneTransformer
|
||||
from vitrage.synchronizer.plugins.static_physical.transformer import \
|
||||
StaticPhysicalTransformer
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TransformerManager(object):
|
||||
|
||||
def __init__(self):
|
||||
self.transformers = self._register_transformer_classes()
|
||||
def __init__(self, conf):
|
||||
self.transformers = self.register_transformer_classes(conf)
|
||||
|
||||
@staticmethod
|
||||
def _register_transformer_classes():
|
||||
def register_transformer_classes(conf):
|
||||
|
||||
transformers = {}
|
||||
|
||||
transformers[EntityType.NOVA_INSTANCE] = importutils.import_object(
|
||||
"%s.%s" % (InstanceTransformer.__module__,
|
||||
InstanceTransformer.__name__),
|
||||
transformers)
|
||||
|
||||
transformers[EntityType.NOVA_HOST] = importutils.import_object(
|
||||
"%s.%s" % (HostTransformer.__module__, HostTransformer.__name__),
|
||||
transformers)
|
||||
|
||||
transformers[EntityType.NOVA_ZONE] = importutils.import_object(
|
||||
"%s.%s" % (ZoneTransformer.__module__, ZoneTransformer.__name__),
|
||||
transformers)
|
||||
|
||||
transformers[EntityType.SWITCH] = importutils.import_object(
|
||||
"%s.%s" % (StaticPhysicalTransformer.__module__,
|
||||
StaticPhysicalTransformer.__name__),
|
||||
transformers)
|
||||
|
||||
transformers[EntityType.NAGIOS] = importutils.import_object(
|
||||
"%s.%s" % (NagiosTransformer.__module__,
|
||||
NagiosTransformer.__name__),
|
||||
transformers)
|
||||
|
||||
for plugin in conf.synchronizer_plugins.plugin_type:
|
||||
transformers[plugin] = importutils.import_object(
|
||||
conf.synchronizer_plugins[plugin]['transformer'],
|
||||
transformers)
|
||||
return transformers
|
||||
|
||||
def get_transformer(self, key):
|
||||
|
@ -14,25 +14,109 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
# Register options for the service
|
||||
OPTS = [
|
||||
cfg.StrOpt('static_plugins_dir',
|
||||
default='/etc/vitrage/static_plugins',
|
||||
help='A path for the static plugins for the synchronizer'
|
||||
),
|
||||
cfg.StrOpt('nagios_user',
|
||||
help='Nagios user'
|
||||
),
|
||||
cfg.StrOpt('nagios_password',
|
||||
help='Nagios password'
|
||||
),
|
||||
cfg.StrOpt('nagios_url',
|
||||
help='Nagios url for querying the data. Example: '
|
||||
' http://<ip>/monitoring/nagios/cgi-bin/status.cgi'
|
||||
),
|
||||
cfg.StrOpt('nagios_config_file',
|
||||
default='/etc/vitrage/nagios_conf.yaml',
|
||||
help='Nagios configuration file'
|
||||
),
|
||||
|
||||
cfg.ListOpt('plugin_type',
|
||||
default=['nagios',
|
||||
'nova.host',
|
||||
'nova.instance',
|
||||
'nova.zone',
|
||||
'switch'],
|
||||
help='Names of supported plugins'),
|
||||
|
||||
cfg.DictOpt('nagios',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nagios.synchronizer'
|
||||
'.NagiosSynchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins'
|
||||
'.nagios.transformer.NagiosTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'config_file': '/etc/vitrage/nagios_conf.yaml'},
|
||||
help='synchronizer:synchronizer path,\n'
|
||||
'transformer:transformer path,\n'
|
||||
'user:Nagios user,\n'
|
||||
'password:Nagios password,\n'
|
||||
'url:Nagios url for querying the data. Example: '
|
||||
'http://<ip>/monitoring/nagios/cgi-bin/status.cgi\n'
|
||||
'config_file:Nagios configuration file'
|
||||
),
|
||||
|
||||
cfg.DictOpt('nova.host',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.host.synchronizer'
|
||||
'.HostSynchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins'
|
||||
'.nova.host.transformer.HostTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},
|
||||
help='synchronizer:synchronizer path,\n'
|
||||
'transformer:transformer path,\n'
|
||||
'user:nova.host user,\n'
|
||||
'password:nova.host password,\n'
|
||||
'url:nova authentication url for querying the data'
|
||||
'version: nova version\n'
|
||||
'project: nova project'),
|
||||
|
||||
cfg.DictOpt('nova.instance',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.instance'
|
||||
'.synchronizer.InstanceSynchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins'
|
||||
'.nova.instance.transformer.InstanceTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},
|
||||
help='synchronizer:synchronizer path,\n'
|
||||
'transformer:transformer path,\n'
|
||||
'user:nova.instance user,\n'
|
||||
'password:nova.instance password,\n'
|
||||
'url:nova authentication url for querying the data'
|
||||
'version: nova version\n'
|
||||
'project: nova project'),
|
||||
|
||||
cfg.DictOpt('nova.zone',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.zone.synchronizer'
|
||||
'.ZoneSynchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins'
|
||||
'.nova.zone.transformer.ZoneTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},
|
||||
help='synchronizer:synchronizer path,\n'
|
||||
'transformer:transformer path,\n'
|
||||
'user:nova.zone user,\n'
|
||||
'password:nova.zone password,\n'
|
||||
'url:nova authentication url for querying the data'
|
||||
'version: nova version\n'
|
||||
'project: nova project'),
|
||||
|
||||
cfg.DictOpt('switch',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.static_physical'
|
||||
'.synchronizer.StaticPhysicalSynchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins.static_physical.'
|
||||
'transformer.StaticPhysicalTransformer',
|
||||
'dir': '/etc/vitrage/static_plugins'},
|
||||
help='synchronizer:synchronizer path,\n'
|
||||
'transformer:transformer path,\n'
|
||||
'dir: A path for the static plugins for the '
|
||||
'synchronizer'),
|
||||
]
|
||||
|
@ -11,10 +11,11 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from oslo_log import log
|
||||
import re
|
||||
import traceback
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from vitrage.common import file_utils
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -28,7 +29,8 @@ NAME = 'name'
|
||||
class NagiosConfig(object):
|
||||
def __init__(self, conf):
|
||||
try:
|
||||
nagios_config_file = conf.synchronizer_plugins.nagios_config_file
|
||||
nagios_config_file = conf.synchronizer_plugins\
|
||||
.nagios['config_file']
|
||||
nagios_config = file_utils.load_yaml_file(nagios_config_file)
|
||||
nagios = nagios_config[NAGIOS] # nagios root in the yaml file
|
||||
|
||||
|
@ -65,9 +65,9 @@ class NagiosSynchronizer(SynchronizerBase):
|
||||
NagiosSynchronizer._filter_get_changes)
|
||||
|
||||
def _get_services_from_nagios(self):
|
||||
nagios_user = self.conf.synchronizer_plugins.nagios_user
|
||||
nagios_password = self.conf.synchronizer_plugins.nagios_password
|
||||
nagios_url = self.conf.synchronizer_plugins.nagios_url
|
||||
nagios_user = self.conf.synchronizer_plugins.nagios['user']
|
||||
nagios_password = self.conf.synchronizer_plugins.nagios['password']
|
||||
nagios_url = self.conf.synchronizer_plugins.nagios['url']
|
||||
|
||||
if not nagios_user:
|
||||
return []
|
||||
|
@ -43,12 +43,12 @@ class StaticPhysicalSynchronizer(SynchronizerBase):
|
||||
def _get_all_entities(self):
|
||||
static_entities = []
|
||||
|
||||
if os.path.isdir(self.cfg.synchronizer_plugins.static_plugins_dir):
|
||||
if os.path.isdir(self.cfg.synchronizer_plugins.switch['dir']):
|
||||
files = file_utils.load_files(
|
||||
self.cfg.synchronizer_plugins.static_plugins_dir, '.yaml')
|
||||
self.cfg.synchronizer_plugins.switch['dir'], '.yaml')
|
||||
|
||||
for file in files:
|
||||
full_path = self.cfg.synchronizer_plugins.static_plugins_dir \
|
||||
full_path = self.cfg.synchronizer_plugins.switch['dir'] \
|
||||
+ '/' + file
|
||||
static_entities += self._get_entities_from_file(file,
|
||||
full_path)
|
||||
@ -71,10 +71,10 @@ class StaticPhysicalSynchronizer(SynchronizerBase):
|
||||
|
||||
entities_updates = []
|
||||
files = file_utils.load_files(
|
||||
self.cfg.synchronizer_plugins.static_plugins_dir, '.yaml')
|
||||
self.cfg.synchronizer_plugins.switch['dir'], '.yaml')
|
||||
|
||||
for file in files:
|
||||
full_path = self.cfg.synchronizer_plugins.static_plugins_dir +\
|
||||
full_path = self.cfg.synchronizer_plugins.switch['dir'] +\
|
||||
'/' + file
|
||||
config = file_utils.load_yaml_file(full_path)
|
||||
if config:
|
||||
|
@ -49,6 +49,8 @@ class TestConsistencyFunctional(TestEntityGraphFunctionalBase):
|
||||
self.conf = cfg.ConfigOpts()
|
||||
self.conf.register_opts(self.CONSISTENCY_OPTS, group='consistency')
|
||||
self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph')
|
||||
self.conf.register_opts(self.PLUGINS_OPTS,
|
||||
group='synchronizer_plugins')
|
||||
self.processor = Processor(self.conf, self.initialization_status)
|
||||
self.consistency_enforcer = ConsistencyEnforcer(
|
||||
self.conf, self.processor.entity_graph, self.initialization_status)
|
||||
|
@ -32,6 +32,8 @@ class TestProcessorFunctional(TestEntityGraphFunctionalBase):
|
||||
super(TestProcessorFunctional, self).setUp()
|
||||
self.conf = cfg.ConfigOpts()
|
||||
self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph')
|
||||
self.conf.register_opts(self.PLUGINS_OPTS,
|
||||
group='synchronizer_plugins')
|
||||
|
||||
def test_create_entity_graph(self):
|
||||
processor = self._create_processor_with_graph(self.conf)
|
||||
|
@ -32,6 +32,8 @@ class TestStateManagerFunctional(TestEntityGraphFunctionalBase):
|
||||
super(TestStateManagerFunctional, self).setUp()
|
||||
self.conf = cfg.ConfigOpts()
|
||||
self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph')
|
||||
self.conf.register_opts(self.PLUGINS_OPTS,
|
||||
group='synchronizer_plugins')
|
||||
|
||||
def test_state_on_update(self):
|
||||
# setup
|
||||
|
@ -32,7 +32,77 @@ class TestEntityGraphUnitBase(base.BaseTest):
|
||||
cfg.StrOpt('states_plugins_dir',
|
||||
default=utils.get_resources_dir() + '/states_plugins'),
|
||||
]
|
||||
PLUGINS_OPTS = [
|
||||
|
||||
cfg.ListOpt('plugin_type',
|
||||
default=['nagios',
|
||||
'nova.host',
|
||||
'nova.instance',
|
||||
'nova.zone',
|
||||
'switch'],
|
||||
help='Names of supported synchronizer plugins'),
|
||||
|
||||
cfg.DictOpt('nagios',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nagios.synchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins'
|
||||
'.nagios.transformer.NagiosTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'config_file': '/etc/vitrage/nagios_conf.yaml'},),
|
||||
|
||||
cfg.DictOpt('nova.host',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.host'
|
||||
'.synchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins.nova'
|
||||
'.host.transformer.HostTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},),
|
||||
|
||||
cfg.DictOpt('nova.instance',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.instance'
|
||||
'.synchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins'
|
||||
'.nova.instance.transformer.InstanceTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},),
|
||||
|
||||
cfg.DictOpt('nova.zone',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.zone'
|
||||
'.synchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins.nova'
|
||||
'.zone.transformer.ZoneTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},),
|
||||
|
||||
cfg.DictOpt('switch',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.static_physical'
|
||||
'.synchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins.static_physical.'
|
||||
'transformer.StaticPhysicalTransformer',
|
||||
'dir': '/etc/vitrage/static_plugins'},),
|
||||
]
|
||||
NUM_NODES = 1
|
||||
NUM_ZONES = 2
|
||||
NUM_HOSTS = 4
|
||||
|
@ -12,17 +12,22 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.entity_graph import transformer_manager
|
||||
from vitrage.graph import driver as graph
|
||||
from vitrage.tests import base
|
||||
from vitrage.tests.unit.entity_graph.base import TestEntityGraphUnitBase
|
||||
|
||||
|
||||
class TestBaseProcessor(base.BaseTest):
|
||||
class TestBaseProcessor(TestEntityGraphUnitBase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBaseProcessor, self).setUp()
|
||||
self.transform = transformer_manager.TransformerManager()
|
||||
self.conf = cfg.ConfigOpts()
|
||||
self.conf.register_opts(self.PLUGINS_OPTS,
|
||||
group='synchronizer_plugins')
|
||||
self.transform = transformer_manager.TransformerManager(self.conf)
|
||||
|
||||
@staticmethod
|
||||
def _update_vertex_to_graph(entity_graph, category, type, id,
|
||||
|
@ -43,6 +43,8 @@ class TestProcessor(TestEntityGraphUnitBase):
|
||||
super(TestProcessor, self).setUp()
|
||||
self.conf = cfg.ConfigOpts()
|
||||
self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph')
|
||||
self.conf.register_opts(self.PLUGINS_OPTS,
|
||||
group='synchronizer_plugins')
|
||||
|
||||
# TODO(Alexey): un skip this test when instance transformer update is ready
|
||||
@unittest.skip('Not ready yet')
|
||||
|
@ -25,12 +25,19 @@ LOG = logging.getLogger(__name__)
|
||||
class TestNagiosConfig(base.BaseTest):
|
||||
|
||||
OPTS = [
|
||||
cfg.StrOpt('nagios_config_file',
|
||||
default=utils.get_resources_dir() +
|
||||
'/nagios/nagios_conf.yaml',
|
||||
help='Nagios configuation file'
|
||||
),
|
||||
]
|
||||
cfg.DictOpt('nagios',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nagios.synchronizer'
|
||||
'.NagiosSynchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins'
|
||||
'.nagios.transformer.NagiosTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'config_file': utils.get_resources_dir() +
|
||||
'/nagios/nagios_conf.yaml'},)
|
||||
]
|
||||
|
||||
# the mappings match the ones in nagios_conf.yaml
|
||||
MAPPING_1 = NagiosHostMapping('compute-1', 'nova.host', 'compute-1')
|
||||
|
@ -28,11 +28,18 @@ LOG = logging.getLogger(__name__)
|
||||
class NagiosSynchronizerTest(NagiosBaseTest):
|
||||
|
||||
OPTS = [
|
||||
cfg.StrOpt('nagios_config_file',
|
||||
default=utils.get_resources_dir() +
|
||||
'/nagios/nagios_conf.yaml',
|
||||
help='Nagios configuation file'
|
||||
),
|
||||
cfg.DictOpt('nagios',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nagios.synchronizer'
|
||||
'.NagiosSynchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins'
|
||||
'.nagios.transformer.NagiosTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'config_file': utils.get_resources_dir() +
|
||||
'/nagios/nagios_conf.yaml'},)
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
@ -34,16 +34,28 @@ LOG = logging.getLogger(__name__)
|
||||
class TestStaticPhysicalSynchronizer(base.BaseTest):
|
||||
|
||||
OPTS = [
|
||||
cfg.StrOpt('static_plugins_dir',
|
||||
default=utils.get_resources_dir() + '/static_plugins',
|
||||
),
|
||||
cfg.DictOpt('switch',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.static_physical'
|
||||
'.synchronizer.StaticPhysicalSynchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins.static_physical.'
|
||||
'transformer.StaticPhysicalTransformer',
|
||||
'dir': utils.get_resources_dir() + '/static_plugins'},)
|
||||
]
|
||||
|
||||
CHANGES_OPTS = [
|
||||
cfg.StrOpt('static_plugins_dir',
|
||||
default=utils.get_resources_dir() + '/static_plugins/'
|
||||
'changes_plugins',
|
||||
),
|
||||
cfg.DictOpt('switch',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.static_physical'
|
||||
'.synchronizer.StaticPhysicalSynchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins.static_physical.'
|
||||
'transformer.StaticPhysicalTransformer',
|
||||
'dir': utils.get_resources_dir() + '/static_plugins/'
|
||||
'changes_plugins'},)
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
@ -56,11 +68,11 @@ class TestStaticPhysicalSynchronizer(base.BaseTest):
|
||||
def test_static_plugins_loader(self):
|
||||
# Setup
|
||||
total_static_plugins = \
|
||||
os.listdir(self.conf.synchronizer_plugins.static_plugins_dir)
|
||||
os.listdir(self.conf.synchronizer_plugins.switch['dir'])
|
||||
|
||||
# Action
|
||||
static_configs = file_utils.load_yaml_files(
|
||||
self.conf.synchronizer_plugins.static_plugins_dir)
|
||||
self.conf.synchronizer_plugins.switch['dir'])
|
||||
|
||||
# Test assertions
|
||||
# -1 is because there are 2 files and a folder in static_plugins_dir
|
||||
|
@ -12,7 +12,21 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.entity_graph.transformer_manager import TransformerManager
|
||||
from vitrage.synchronizer.plugins.nagios.transformer import \
|
||||
NagiosTransformer
|
||||
from vitrage.synchronizer.plugins.nova.host.transformer import \
|
||||
HostTransformer
|
||||
from vitrage.synchronizer.plugins.nova.instance.transformer import \
|
||||
InstanceTransformer
|
||||
from vitrage.synchronizer.plugins.nova.zone.transformer import \
|
||||
ZoneTransformer
|
||||
from vitrage.synchronizer.plugins.static_physical.transformer import \
|
||||
StaticPhysicalTransformer
|
||||
from vitrage.tests import base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -20,6 +34,100 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class TransformerManagerTest(base.BaseTest):
|
||||
|
||||
def test_register_transformer_classes(self):
|
||||
# manager = TransformerManager()
|
||||
pass
|
||||
OPTS = [
|
||||
|
||||
cfg.ListOpt('plugin_type',
|
||||
default=['nagios',
|
||||
'nova.host',
|
||||
'nova.instance',
|
||||
'nova.zone',
|
||||
'switch'],
|
||||
help='Names of supported synchronizer plugins'),
|
||||
|
||||
cfg.DictOpt('nagios',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nagios.synchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins'
|
||||
'.nagios.transformer.NagiosTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'config_file': '/etc/vitrage/nagios_conf.yaml'},),
|
||||
|
||||
cfg.DictOpt('nova.host',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.host'
|
||||
'.synchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins.nova'
|
||||
'.host.transformer.HostTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},),
|
||||
|
||||
cfg.DictOpt('nova.instance',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.instance'
|
||||
'.synchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins'
|
||||
'.nova.instance.transformer.InstanceTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},),
|
||||
|
||||
cfg.DictOpt('nova.zone',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.nova.zone'
|
||||
'.synchronizer',
|
||||
'transformer': 'vitrage.synchronizer.plugins.nova'
|
||||
'.zone.transformer.ZoneTransformer',
|
||||
'user': '',
|
||||
'password': '',
|
||||
'url': '',
|
||||
'version': '2.0',
|
||||
'project': 'admin'},),
|
||||
|
||||
cfg.DictOpt('switch',
|
||||
default={
|
||||
'synchronizer':
|
||||
'vitrage.synchronizer.plugins.static_physical'
|
||||
'.synchronizer',
|
||||
'transformer':
|
||||
'vitrage.synchronizer.plugins.static_physical.'
|
||||
'transformer.StaticPhysicalTransformer',
|
||||
'dir': '/etc/vitrage/static_plugins'},),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.conf = cfg.ConfigOpts()
|
||||
cls.conf.register_opts(cls.OPTS, group='synchronizer_plugins')
|
||||
cls.manager = TransformerManager(cls.conf)
|
||||
|
||||
def test_transformer_registration_nagios(self):
|
||||
self.assertIsInstance(self.manager.get_transformer
|
||||
(EntityType.NAGIOS), NagiosTransformer)
|
||||
|
||||
def test_transformer_registration_nova_host(self):
|
||||
self.assertIsInstance(self.manager.get_transformer
|
||||
(EntityType.NOVA_HOST), HostTransformer)
|
||||
|
||||
def test_transformer_registration_nova_instance(self):
|
||||
self.assertIsInstance(self.manager.get_transformer
|
||||
(EntityType.NOVA_INSTANCE), InstanceTransformer)
|
||||
|
||||
def test_transformer_registration_nova_zone(self):
|
||||
self.assertIsInstance(self.manager.get_transformer
|
||||
(EntityType.NOVA_ZONE), ZoneTransformer)
|
||||
|
||||
def test_transformer_registration_switch(self):
|
||||
self.assertIsInstance(self.manager.get_transformer
|
||||
(EntityType.SWITCH), StaticPhysicalTransformer)
|
||||
|
Loading…
x
Reference in New Issue
Block a user