3 # This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
12 class TestCase(object):
14 def __init__(self, name, project, constraints,
15 criteria=-1, isRunnable=True, tier=-1):
17 self.project = project
18 self.constraints = constraints
19 self.criteria = criteria
20 self.isRunnable = isRunnable
22 display_name_matrix = {'healthcheck': 'healthcheck',
23 'vping_ssh': 'vPing (ssh)',
24 'vping_userdata': 'vPing (userdata)',
28 'tempest_smoke_serial': 'Tempest (smoke)',
29 'tempest_full_parallel': 'Tempest (full)',
30 'tempest_defcore': 'Tempest (Defcore)',
31 'refstack_defcore': 'Refstack',
32 'rally_sanity': 'Rally (smoke)',
34 'rally_full': 'Rally (full)',
36 'doctor-notification': 'Doctor',
40 'security_scan': 'Security',
41 'multisite': 'Multisite',
42 'domino-multinode': 'Domino',
43 'functest-odl-sfc': 'SFC',
45 'parser-basics': 'Parser',
46 'connection_check': 'Health (connection)',
47 'api_check': 'Health (api)',
48 'snaps_smoke': 'SNAPS',
49 'snaps_health_check': 'Health (dhcp)',
50 'gluon_vping': 'Netready',
52 'cloudify_ims': 'vIMS (Cloudify)',
53 'orchestra_openims': 'OpenIMS (OpenBaton)',
54 'orchestra_clearwaterims': 'vIMS (OpenBaton)',
55 'opera_ims': 'vIMS (Open-O)',
56 'vyos_vrouter': 'vyos (Cloudify)',
57 'barometercollectd': 'Barometer',
58 'odl_netvirt': 'Netvirt',
59 'security_scan': 'Security'}
61 self.displayName = display_name_matrix[self.name]
63 self.displayName = "unknown"
71 def getConstraints(self):
72 return self.constraints
74 def getCriteria(self):
80 def setCriteria(self, criteria):
81 self.criteria = criteria
83 def setIsRunnable(self, isRunnable):
84 self.isRunnable = isRunnable
86 def checkRunnable(self, installer, scenario, config):
87 # Re-use Functest declaration
88 # Retrieve Functest configuration file functest_config.yaml
91 # print " *********************** "
93 # print " ---------------------- "
94 # print "case = " + self.name
95 # print "installer = " + installer
96 # print "scenario = " + scenario
97 # print "project = " + self.project
99 # Retrieve test constraints
100 # Retrieve test execution param
101 test_execution_context = {"installer": installer,
102 "scenario": scenario}
104 # By default we assume that all the tests are always runnable...
105 # if test_env not empty => dependencies to be checked
106 if config_test is not None and len(config_test) > 0:
107 # possible criteria = ["installer", "scenario"]
108 # consider test criteria from config file
109 # compare towards CI env through CI en variable
110 for criteria in config_test:
111 if re.search(config_test[criteria],
112 test_execution_context[criteria]) is None:
113 # print "Test "+ test + " cannot be run on the environment"
116 self.isRunnable = is_runnable
119 testcase = ("Name=" + self.name + ";Criteria=" +
120 str(self.criteria) + ";Project=" + self.project +
121 ";Constraints=" + str(self.constraints) +
122 ";IsRunnable" + str(self.isRunnable))
125 def getDisplayName(self):
126 return self.displayName