Add parallel execution and shortcut notification to inspector design guideline
[doctor.git] / tests / consumer / __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
13 OPTS = [
14     cfg.StrOpt('type',
15                default='sample',
16                choices=['sample'],
17                help='the component of doctor consumer',
18                required=True),
19     cfg.StrOpt('ip',
20                default='127.0.0.1',
21                help='the ip of consumer',
22                required=True),
23     cfg.IntOpt('port',
24                default='12346',
25                help='the port of doctor consumer',
26                required=True),
27 ]
28
29
30 _consumer_name_class_mapping = {
31     'sample': 'consumer.sample.SampleConsumer'
32 }
33
34
35 def get_consumer(conf, log):
36     consumer_class = _consumer_name_class_mapping.get(conf.consumer.type)
37     return importutils.import_object(consumer_class, conf, log)