-
Notifications
You must be signed in to change notification settings - Fork 0
/
AliyunQuery.py
67 lines (53 loc) · 1.67 KB
/
AliyunQuery.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/python
######################################################################################
# FILENAME: AliyunQuery.py
#
# DESCRIPTION: AliyunQuery queries the Aliyun ECS instance data
#
########################################################################################
# Pre-requisite(s): This script requires
#
########################################################################################
import abc
from TestBase import TestBase
import os
import CommonConfig
import logging
import Log
import getInstanceData
import utility
import doParallel
import csv
class AliyunQuery(TestBase):
"""
Class inheriting from TestBase executes Aliyun Query for ECS instances
"""
def __init__(self):
self.HTTP_SUCCESS = 200
self._params = {"RegionId": CommonConfig.hosts[0][0], "InstanceId": CommonConfig.hosts[0][1]}
def setup(self):
"""
Set up the test scenario
"""
logging.debug('Inside setup()...')
if os.path.exists(CommonConfig.summary_file['AliyunQuery']+'.csv'):
os.remove(CommonConfig.summary_file['AliyunQuery']+'.csv')
return True
def run(self):
"""
Run the the test scenario
"""
logging.debug('Inside run()...')
params = {}
return doParallel.doParallel(1,getInstanceData.getInstanceData,[(self._params, 'ecs', 'GET')])
def analyze(self, results):
"""
Analyze the results
"""
if results[0][2] == self.HTTP_SUCCESS:
return 'PASS'
def cleanup(self):
"""
Clean up after the test finishes
"""
logging.debug('Inside cleanup()...')