717d6587ad56e87aa34f10eef338c70760407697
[doctor.git] / doctor_tests / app_manager / __init__.py
1 ##############################################################################
2 # Copyright (c) 2018 Nokia 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 app manager',
18                required=True),
19     cfg.StrOpt('ip',
20                default='127.0.0.1',
21                help='the ip of app manager',
22                required=True),
23     cfg.IntOpt('port',
24                default='12348',
25                help='the port of doctor app manager',
26                required=True),
27 ]
28
29
30 _app_manager_name_class_mapping = {
31     'sample': 'doctor_tests.app_manager.sample.SampleAppManager'
32 }
33
34
35 def get_app_manager(stack, conf, log):
36     app_manager_class = (
37         _app_manager_name_class_mapping.get(conf.app_manager.type))
38     return importutils.import_object(app_manager_class, stack, conf, log)