New VNFM supporting ETSI changes
[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 import os
12
13
14 OPTS = [
15     cfg.StrOpt('type',
16                default=os.environ.get('APP_MANAGER_TYPE', 'sample'),
17                choices=['sample', 'vnfm'],
18                help='the component of doctor app manager',
19                required=True),
20     cfg.StrOpt('ip',
21                default='127.0.0.1',
22                help='the ip of app manager',
23                required=True),
24     cfg.IntOpt('port',
25                default='12348',
26                help='the port of doctor app manager',
27                required=True),
28 ]
29
30
31 _app_manager_name_class_mapping = {
32     'sample': 'doctor_tests.app_manager.sample.SampleAppManager',
33     'vnfm': 'doctor_tests.app_manager.vnfm.VNFM',
34 }
35
36
37 def get_app_manager(stack, conf, log):
38     app_manager_class = (
39         _app_manager_name_class_mapping.get(conf.app_manager.type))
40     return importutils.import_object(app_manager_class, stack, conf, log)