Merge "Add host specific VM list to inspector design guide line"
[doctor.git] / doctor_tests / inspector / __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 import os
10
11 from oslo_config import cfg
12 from oslo_utils import importutils
13
14
15 OPTS = [
16     cfg.StrOpt('type',
17                default=os.environ.get('INSPECTOR_TYPE', 'sample'),
18                choices=['sample', 'congress', 'vitrage'],
19                help='the component of doctor inspector',
20                required=True),
21     cfg.StrOpt('ip',
22                default='127.0.0.1',
23                help='the host ip of inspector',
24                required=False),
25     cfg.StrOpt('port',
26                default='12345',
27                help='the port of default for inspector',
28                required=False),
29 ]
30
31
32 _inspector_name_class_mapping = {
33     'sample': 'doctor_tests.inspector.sample.SampleInspector',
34     'congress': 'doctor_tests.inspector.congress.CongressInspector',
35 }
36
37
38 def get_inspector(conf, log):
39     inspector_class = _inspector_name_class_mapping[conf.inspector.type]
40     return importutils.import_object(inspector_class, conf, log)