Merge "Add test-scheduler dir to verity"
[bottlenecks.git] / test-scheduler / server / src / step / test_step.py
1 ##############################################################################
2 # Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD 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
10 import os
11
12
13 class TestStep(object):
14     def __init__(self, type, id, name, service, action, args, context):
15         self._type = type
16         self._id = id
17         self._name = name
18         self._serviceName = service['name']
19         self._serviceInterface = service['interface']
20         self._action = action
21         self._args = args
22         self._context = context
23
24     def getId(self):
25         return self._id
26
27     def getName(self):
28         return self._name
29
30     def getServiceName(self):
31         return self._serviceName
32
33     def getCallFunction(self):
34         return self._callType
35
36     def getArgs(self):
37         return self._args
38
39     def action(self):
40         f = getattr(self, self._action)
41         f()
42
43     def _argsParse(self):
44         pass
45
46     def _getCurrentDir(self):
47         return os.path.dirname(__file__)
48
49     def __str__(self):
50         return str(self.__dict__)
51
52
53 if __name__ == "__main__":
54     args = {'command': 'start'}
55     stepObj = TestStep('test_cpu', 'ansible', 'REST', **args)
56     print stepObj