Add maintenance test code
[doctor.git] / doctor_tests / admin_tool / __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 admin_tool',
18                required=True),
19     cfg.StrOpt('ip',
20                default='127.0.0.1',
21                help='the ip of admin_tool',
22                required=True),
23     cfg.IntOpt('port',
24                default='12347',
25                help='the port of doctor admin_tool',
26                required=True),
27 ]
28
29
30 _admin_tool_name_class_mapping = {
31     'sample': 'doctor_tests.admin_tool.sample.SampleAdminTool'
32 }
33
34
35 def get_admin_tool(trasport_url, conf, log):
36     admin_tool_class = _admin_tool_name_class_mapping.get(conf.admin_tool.type)
37     return importutils.import_object(admin_tool_class, trasport_url, conf, log)