-
Notifications
You must be signed in to change notification settings - Fork 0
/
testsuite.py
89 lines (77 loc) · 3.13 KB
/
testsuite.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/python
import argparse
import yaml
import os.path
from testcases.SameSubnetDiffComputePing import SameSubnetDiffComputePing
from testcases.CheckFlowsOnDelete import CheckFlowsOnDelete
from testcases.CheckFlowsOnComputeOnDelete import CheckFlowsOnComputeOnDelete
from testcases.CheckFlowsOnDeleteOneInst import CheckFlowsOnDeleteOneInst
from testcases.VdpAssoc import VdpAssoc
from testcases.VdpDeassoc import VdpDeassoc
from testcases.CheckVdpKeepAlive import CheckVdpKeepAlive
from testcases.DiffSubnetSameComputePing import DiffSubnetSameComputePing
from testcases.DiffSubnetDiffComputePing import DiffSubnetDiffComputePing
from testcases.SameSubnetSameComputePing import SameSubnetSameComputePing
from testcases.RestartEnablerServer import RestartEnablerServer
from testcases.RestartEnablerAgentController import RestartEnablerAgentController
from testcases.RestartLldpadController import RestartLldpadController
from testcases.VerifyDCNM import VerifyDCNM
from testcases.GenericPingSameSubnetDiffCompute import GenericPingSameSubnetDiffCompute
from testcases.GenericPingDiffSubnetDiffCompute import GenericPingDiffSubnetDiffCompute
from constants import resultConstants
TEST_CASE_MAP = {
"1": GenericPingSameSubnetDiffCompute,
"2": SameSubnetSameComputePing,
"3": DiffSubnetSameComputePing,
"4": GenericPingDiffSubnetDiffCompute,
"5": CheckFlowsOnDelete,
"6": CheckFlowsOnDeleteOneInst,
"7": CheckFlowsOnComputeOnDelete,
"8": VdpAssoc,
"9": VdpDeassoc,
"10": VerifyDCNM,
"11": RestartEnablerServer,
"12": RestartEnablerAgentController,
"13": RestartLldpadController,
"14": CheckVdpKeepAlive
}
def main():
try:
parser = argparse.ArgumentParser(
description='This is OpenStack TestSuite')
parser.add_argument(
'-f',
'--testbed_file',
help='Provide the testbed file',
required=True)
parser.add_argument(
'--tests',
help='Provide comma-separated list of test cases to run (e.g 1,2)',
required=True)
args = parser.parse_args()
with open(args.testbed_file) as file_handle:
config_dict = yaml.safe_load(file_handle)
requestedTests = args.tests.split(',')
testCasesToRun = []
for test in requestedTests:
if str(test) in TEST_CASE_MAP:
testCasesToRun.append(TEST_CASE_MAP[str(test)](config_dict))
else:
print "Invalid test case request: " + str(test)
print "TestCases requested by User: ", requestedTests
result_list = []
# Run all the tests
for testCase in testCasesToRun:
print "Running test case: ", testCase
result = testCase.runTest()
if result == resultConstants.RESULT_ABORT:
result_list.append(result)
raise Exception("Aborting testsuite")
else:
result_list.append(result)
print "Results are:", result_list
except Exception as e:
print "Exception created", e
print "Results are:", result_list
if __name__ == "__main__":
main()