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 'rally_sanity': 'Rally (smoke)',
32 'rally_full': 'Rally (full)',
38 'security_scan': 'Security',
39 'multisite': 'Multisite',
44 'connection_check': 'Health (connection)',
45 'api_check': 'Health (api)',
46 'snaps_smoke': 'SNAPS',
47 'snaps_health_check': 'Health (dhcp)',
48 'gluon_vping': 'Netready',
49 'barometercollectd': 'Barometer'}
51 self.displayName = display_name_matrix[self.name]
53 self.displayName = "unknown"
61 def getConstraints(self):
62 return self.constraints
64 def getCriteria(self):
70 def setCriteria(self, criteria):
71 self.criteria = criteria
73 def setIsRunnable(self, isRunnable):
74 self.isRunnable = isRunnable
76 def checkRunnable(self, installer, scenario, config):
77 # Re-use Functest declaration
78 # Retrieve Functest configuration file functest_config.yaml
81 # print " *********************** "
83 # print " ---------------------- "
84 # print "case = " + self.name
85 # print "installer = " + installer
86 # print "scenario = " + scenario
87 # print "project = " + self.project
89 # Retrieve test constraints
90 # Retrieve test execution param
91 test_execution_context = {"installer": installer,
94 # By default we assume that all the tests are always runnable...
95 # if test_env not empty => dependencies to be checked
96 if config_test is not None and len(config_test) > 0:
97 # possible criteria = ["installer", "scenario"]
98 # consider test criteria from config file
99 # compare towards CI env through CI en variable
100 for criteria in config_test:
101 if re.search(config_test[criteria],
102 test_execution_context[criteria]) is None:
103 # print "Test "+ test + " cannot be run on the environment"
106 self.isRunnable = is_runnable
109 testcase = ("Name=" + self.name + ";Criteria=" +
110 str(self.criteria) + ";Project=" + self.project +
111 ";Constraints=" + str(self.constraints) +
112 ";IsRunnable" + str(self.isRunnable))
116 # Correspondance name of the test case / name in the DB
117 # ideally we should modify the DB to avoid such interface....
118 # '<name in the config>':'<name in the DB>'
119 # I know it is uggly...
120 test_match_matrix = {'healthcheck': 'healthcheck',
121 'vping_ssh': 'vping_ssh',
122 'vping_userdata': 'vping_userdata',
126 'tempest_smoke_serial': 'tempest_smoke_serial',
127 'tempest_full_parallel': 'tempest_full_parallel',
128 'rally_sanity': 'rally_sanity',
130 'rally_full': 'rally_full',
132 'doctor': 'doctor-notification',
133 'promise': 'promise',
134 'moon': 'moon_authentication',
135 'copper': 'copper-notification',
136 'security_scan': 'security',
137 'multisite': 'multisite',
138 'domino': 'domino-multinode',
139 'odl-sfc': 'functest-odl-sfc',
140 'onos_sfc': 'onos_sfc',
141 'parser': 'parser-basics',
142 'connection_check': 'connection_check',
143 'api_check': 'api_check',
144 'snaps_smoke': 'snaps_smoke',
145 'snaps_health_check': 'snaps_health_check',
146 'gluon_vping': 'gluon_vping',
147 'barometercollectd': 'barometercollectd'}
149 return test_match_matrix[self.name]
153 def getDisplayName(self):
154 return self.displayName