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)',
40 'security_scan': 'Security',
41 'multisite': 'Multisite',
46 'connection_check': 'Health (connection)',
47 'api_check': 'Health (api)',
48 'snaps_smoke': 'SNAPS',
49 'snaps_health_check': 'Health (dhcp)',
50 'netready': 'Netready',
52 'cloudify_ims': 'vIMS (Cloudify)',
53 'orchestra_ims': 'OpenIMS (OpenBaton)',
54 'opera_ims': 'vIMS (Open-O)',
55 'vyos_vrouter': 'vyos',
56 'barometer': 'Barometer'}
58 self.displayName = display_name_matrix[self.name]
60 self.displayName = "unknown"
68 def getConstraints(self):
69 return self.constraints
71 def getCriteria(self):
77 def setCriteria(self, criteria):
78 self.criteria = criteria
80 def setIsRunnable(self, isRunnable):
81 self.isRunnable = isRunnable
83 def checkRunnable(self, installer, scenario, config):
84 # Re-use Functest declaration
85 # Retrieve Functest configuration file functest_config.yaml
88 # print " *********************** "
90 # print " ---------------------- "
91 # print "case = " + self.name
92 # print "installer = " + installer
93 # print "scenario = " + scenario
94 # print "project = " + self.project
96 # Retrieve test constraints
97 # Retrieve test execution param
98 test_execution_context = {"installer": installer,
101 # By default we assume that all the tests are always runnable...
102 # if test_env not empty => dependencies to be checked
103 if config_test is not None and len(config_test) > 0:
104 # possible criteria = ["installer", "scenario"]
105 # consider test criteria from config file
106 # compare towards CI env through CI en variable
107 for criteria in config_test:
108 if re.search(config_test[criteria],
109 test_execution_context[criteria]) is None:
110 # print "Test "+ test + " cannot be run on the environment"
113 self.isRunnable = is_runnable
116 testcase = ("Name=" + self.name + ";Criteria=" +
117 str(self.criteria) + ";Project=" + self.project +
118 ";Constraints=" + str(self.constraints) +
119 ";IsRunnable" + str(self.isRunnable))
123 # Correspondance name of the test case / name in the DB
124 # ideally we should modify the DB to avoid such interface....
125 # '<name in the config>':'<name in the DB>'
126 # I know it is uggly...
127 test_match_matrix = {'healthcheck': 'healthcheck',
128 'vping_ssh': 'vping_ssh',
129 'vping_userdata': 'vping_userdata',
133 'tempest_smoke_serial': 'tempest_smoke_serial',
134 'tempest_full_parallel': 'tempest_full_parallel',
135 'tempest_defcore': 'tempest_defcore',
136 'refstack_defcore': 'refstack_defcore',
137 'rally_sanity': 'rally_sanity',
139 'rally_full': 'rally_full',
141 'doctor': 'doctor-notification',
142 'promise': 'promise',
143 'moon': 'moon_authentication',
144 'copper': 'copper-notification',
145 'security_scan': 'security',
146 'multisite': 'multisite',
147 'domino': 'domino-multinode',
148 'odl-sfc': 'functest-odl-sfc',
149 'onos_sfc': 'onos_sfc',
150 'parser': 'parser-basics',
151 'connection_check': 'connection_check',
152 'api_check': 'api_check',
153 'snaps_smoke': 'snaps_smoke',
154 'snaps_health_check': 'snaps_health_check',
155 'netready': 'gluon_vping',
157 'cloudify_ims': 'cloudify_ims',
158 'orchestra_ims': 'orchestra_ims',
159 'opera_ims': 'opera_ims',
160 'vyos_vrouter': 'vyos_vrouter',
161 'barometer': 'barometercollectd'}
163 return test_match_matrix[self.name]
167 def getDisplayName(self):
168 return self.displayName