Merge "Add test-scheduler dir to verity"
[bottlenecks.git] / testing-scheduler / server / src / step / test_step.py
1 ##############################################################################\r
2 # Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others.\r
3 #\r
4 # All rights reserved. This program and the accompanying materials\r
5 # are made available under the terms of the Apache License, Version 2.0\r
6 # which accompanies this distribution, and is available at\r
7 # http://www.apache.org/licenses/LICENSE-2.0\r
8 ##############################################################################\r
9 \r
10 import os\r
11 \r
12 \r
13 class TestStep(object):\r
14     def __init__(self, type, id, name, service, action, args, context):\r
15         self._type = type\r
16         self._id = id\r
17         self._name = name\r
18         self._serviceName = service['name']\r
19         self._serviceInterface = service['interface']\r
20         self._action = action\r
21         self._args = args\r
22         self._context = context\r
23 \r
24     def getId(self):\r
25         return self._id\r
26 \r
27     def getName(self):\r
28         return self._name\r
29 \r
30     def getServiceName(self):\r
31         return self._serviceName\r
32 \r
33     def getCallFunction(self):\r
34         return self._callType\r
35 \r
36     def getArgs(self):\r
37         return self._args\r
38 \r
39     def action(self):\r
40         f = getattr(self, self._action)\r
41         f()\r
42 \r
43     def _argsParse(self):\r
44         pass\r
45 \r
46     def _getCurrentDir(self):\r
47         return os.path.dirname(__file__)\r
48 \r
49     def __str__(self):\r
50         return str(self.__dict__)\r
51 \r
52 \r
53 if __name__ == "__main__":\r
54     args = {'command': 'start'}\r
55     stepObj = TestStep('test_cpu', 'ansible', 'REST', **args)\r
56     print stepObj\r