3 # jose.lausuch@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
12 import tier_handler as th
16 def __init__(self, ci_installer, ci_scenario, testcases_file):
17 self.ci_installer = ci_installer
18 self.ci_scenario = ci_scenario
19 self.testcases_file = testcases_file
20 self.dic_tier_array = None
21 self.tier_objects = []
22 self.testcases_yaml = None
25 def read_test_yaml(self):
26 with open(self.testcases_file) as f:
27 self.testcases_yaml = yaml.safe_load(f)
29 self.dic_tier_array = []
30 for tier in self.testcases_yaml.get("tiers"):
31 self.dic_tier_array.append(tier)
33 def generate_tiers(self):
34 if self.dic_tier_array is None:
37 del self.tier_objects[:]
38 for dic_tier in self.dic_tier_array:
39 tier = th.Tier(name=dic_tier['name'],
40 order=dic_tier['order'],
42 description=dic_tier['description'])
44 for dic_testcase in dic_tier['testcases']:
45 installer = dic_testcase['dependencies']['installer']
46 scenario = dic_testcase['dependencies']['scenario']
47 dep = th.Dependency(installer, scenario)
49 testcase = th.TestCase(name=dic_testcase['name'],
51 description=dic_testcase['description'])
52 if testcase.is_compatible(self.ci_installer, self.ci_scenario):
53 tier.add_test(testcase)
55 self.tier_objects.append(tier)
59 for i in range(0, len(self.tier_objects)):
60 output += str(self.tier_objects[i]) + "\n"