fix package path and move files under doctor_tests
[doctor.git] / doctor_tests / monitor / __init__.py
1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 from oslo_config import cfg
10 from oslo_utils import importutils
11
12 OPTS = [
13     cfg.StrOpt('type',
14                default='sample',
15                choices=['sample', 'collectd'],
16                help='the type of doctor monitor component',
17                required=True),
18 ]
19
20
21 _monitor_name_class_mapping = {
22     'sample': 'doctor_tests.monitor.sample.SampleMonitor',
23     'collectd': 'doctor_tests.monitor.collectd.CollectdMonitor'
24 }
25
26 def get_monitor(conf, inspector_url, log):
27     monitor_class = _monitor_name_class_mapping.get(conf.monitor.type)
28     return importutils.import_object(monitor_class, conf,
29                                      inspector_url, log)