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_ims': 'OpenIMS (OpenBaton)',
54 'opera_ims': 'vIMS (Open-O)',
55 'vyos_vrouter': 'vyos',
56 'barometercollectd': 'Barometer',
57 'odl_netvirt': 'Netvirt',
58 'security_scan': 'Security'}
60 self.displayName = display_name_matrix[self.name]
62 self.displayName = "unknown"
70 def getConstraints(self):
71 return self.constraints
73 def getCriteria(self):
79 def setCriteria(self, criteria):
80 self.criteria = criteria
82 def setIsRunnable(self, isRunnable):
83 self.isRunnable = isRunnable
85 def checkRunnable(self, installer, scenario, config):
86 # Re-use Functest declaration
87 # Retrieve Functest configuration file functest_config.yaml
90 # print " *********************** "
92 # print " ---------------------- "
93 # print "case = " + self.name
94 # print "installer = " + installer
95 # print "scenario = " + scenario
96 # print "project = " + self.project
98 # Retrieve test constraints
99 # Retrieve test execution param
100 test_execution_context = {"installer": installer,
101 "scenario": scenario}
103 # By default we assume that all the tests are always runnable...
104 # if test_env not empty => dependencies to be checked
105 if config_test is not None and len(config_test) > 0:
106 # possible criteria = ["installer", "scenario"]
107 # consider test criteria from config file
108 # compare towards CI env through CI en variable
109 for criteria in config_test:
110 if re.search(config_test[criteria],
111 test_execution_context[criteria]) is None:
112 # print "Test "+ test + " cannot be run on the environment"
115 self.isRunnable = is_runnable
118 testcase = ("Name=" + self.name + ";Criteria=" +
119 str(self.criteria) + ";Project=" + self.project +
120 ";Constraints=" + str(self.constraints) +
121 ";IsRunnable" + str(self.isRunnable))
124 def getDisplayName(self):
125 return self.displayName