manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 3 | r""" |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 4 | Use robot framework API to extract test result data from output.xml generated |
| 5 | by robot tests. For more information on the Robot Framework API, see |
| 6 | http://robot-framework.readthedocs.io/en/3.0/autodoc/robot.result.html |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 7 | """ |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 8 | |
Gunnar Mills | 096cd56 | 2018-03-26 10:19:12 -0500 | [diff] [blame] | 9 | import sys |
| 10 | import os |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 11 | import getopt |
| 12 | import csv |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 13 | import robot.errors |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 14 | import re |
Steven Sombar | 3e82e3b | 2019-03-21 10:33:52 -0500 | [diff] [blame] | 15 | import stat |
George Keishing | 937fe3c | 2019-10-29 11:20:34 -0500 | [diff] [blame] | 16 | import datetime |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 17 | from robot.api import ExecutionResult |
| 18 | from robot.result.visitor import ResultVisitor |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 19 | from xml.etree import ElementTree |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 20 | |
| 21 | # Remove the python library path to restore with local project path later. |
| 22 | save_path_0 = sys.path[0] |
| 23 | del sys.path[0] |
George Keishing | c2a6f09 | 2019-02-20 12:26:54 -0600 | [diff] [blame] | 24 | sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib")) |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 25 | |
| 26 | from gen_arg import * |
| 27 | from gen_print import * |
| 28 | from gen_valid import * |
| 29 | |
| 30 | # Restore sys.path[0]. |
| 31 | sys.path.insert(0, save_path_0) |
| 32 | |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 33 | |
| 34 | this_program = sys.argv[0] |
| 35 | info = " For more information: " + this_program + ' -h' |
| 36 | if len(sys.argv) == 1: |
| 37 | print (info) |
| 38 | sys.exit(1) |
| 39 | |
| 40 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 41 | parser = argparse.ArgumentParser( |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 42 | usage=info, |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 43 | description="%(prog)s uses a robot framework API to extract test result\ |
| 44 | data from output.xml generated by robot tests. For more information on the\ |
| 45 | Robot Framework API, see\ |
George Keishing | 11b7af9 | 2018-06-11 10:39:01 -0500 | [diff] [blame] | 46 | http://robot-framework.readthedocs.io/en/3.0/autodoc/robot.result.html", |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 47 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 48 | prefix_chars='-+') |
| 49 | |
| 50 | parser.add_argument( |
| 51 | '--source', |
| 52 | '-s', |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 53 | help='The output.xml robot test result file path. This parameter is \ |
| 54 | required.') |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 55 | |
| 56 | parser.add_argument( |
| 57 | '--dest', |
| 58 | '-d', |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 59 | help='The directory path where the generated .csv files will go. This \ |
| 60 | parameter is required.') |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 61 | |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 62 | parser.add_argument( |
| 63 | '--version_id', |
| 64 | help='Driver version of openbmc firmware which was used during test,\ |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 65 | e.g. "v2.1-215-g6e7eacb". This parameter is required.') |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 66 | |
| 67 | parser.add_argument( |
| 68 | '--platform', |
George Keishing | 19533d5 | 2018-04-09 03:08:03 -0500 | [diff] [blame] | 69 | help='OpenBMC platform which was used during test,\ |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 70 | e.g. "Witherspoon". This parameter is required.') |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 71 | |
George Keishing | 19533d5 | 2018-04-09 03:08:03 -0500 | [diff] [blame] | 72 | parser.add_argument( |
| 73 | '--level', |
| 74 | help='OpenBMC release level which was used during test,\ |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 75 | e.g. "Master", "OBMC920". This parameter is required.') |
| 76 | |
| 77 | parser.add_argument( |
| 78 | '--test_phase', |
| 79 | help='Name of testing phase, e.g. "DVT", "SVT", etc.\ |
| 80 | This parameter is optional.', |
| 81 | default="FVT") |
| 82 | |
| 83 | parser.add_argument( |
Vijay | e3a9837 | 2019-10-30 02:04:22 -0500 | [diff] [blame] | 84 | '--subsystem', |
| 85 | help='Name of the subsystem, e.g. "OPENBMC" etc.\ |
| 86 | This parameter is optional.', |
| 87 | default="OPENBMC") |
| 88 | |
| 89 | parser.add_argument( |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 90 | '--processor', |
| 91 | help='Name of processor, e.g. "P9". This parameter is optional.', |
| 92 | default="OPENPOWER") |
| 93 | |
George Keishing | 19533d5 | 2018-04-09 03:08:03 -0500 | [diff] [blame] | 94 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 95 | # Populate stock_list with options we want. |
| 96 | stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)] |
| 97 | |
| 98 | |
| 99 | def exit_function(signal_number=0, |
| 100 | frame=None): |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 101 | r""" |
| 102 | Execute whenever the program ends normally or with the signals that we |
| 103 | catch (i.e. TERM, INT). |
| 104 | """ |
| 105 | |
| 106 | dprint_executing() |
| 107 | |
| 108 | dprint_var(signal_number) |
| 109 | |
| 110 | qprint_pgm_footer() |
| 111 | |
| 112 | |
| 113 | def signal_handler(signal_number, |
| 114 | frame): |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 115 | r""" |
| 116 | Handle signals. Without a function to catch a SIGTERM or SIGINT, the |
| 117 | program would terminate immediately with return code 143 and without |
| 118 | calling the exit_function. |
| 119 | """ |
| 120 | |
| 121 | # Our convention is to set up exit_function with atexit.register() so |
| 122 | # there is no need to explicitly call exit_function from here. |
| 123 | |
| 124 | dprint_executing() |
| 125 | |
| 126 | # Calling exit prevents us from returning to the code that was running |
| 127 | # when the signal was received. |
| 128 | exit(0) |
| 129 | |
| 130 | |
| 131 | def validate_parms(): |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 132 | r""" |
| 133 | Validate program parameters, etc. Return True or False (i.e. pass/fail) |
| 134 | accordingly. |
| 135 | """ |
| 136 | |
| 137 | if not valid_file_path(source): |
| 138 | return False |
| 139 | |
| 140 | if not valid_dir_path(dest): |
| 141 | return False |
| 142 | |
| 143 | gen_post_validation(exit_function, signal_handler) |
| 144 | |
| 145 | return True |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 146 | |
| 147 | |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 148 | def parse_output_xml(xml_file_path, csv_dir_path, version_id, platform, level, |
| 149 | test_phase, processor): |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 150 | r""" |
| 151 | Parse the robot-generated output.xml file and extract various test |
| 152 | output data. Put the extracted information into a csv file in the "dest" |
| 153 | folder. |
| 154 | |
| 155 | Description of argument(s): |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 156 | xml_file_path The path to a Robot-generated output.xml |
| 157 | file. |
| 158 | csv_dir_path The path to the directory that is to |
| 159 | contain the .csv files generated by |
| 160 | this function. |
| 161 | version_id Version of the openbmc firmware |
| 162 | (e.g. "v2.1-215-g6e7eacb"). |
| 163 | platform Platform of the openbmc system. |
| 164 | level Release level of the OpenBMC system |
George Keishing | 360db63 | 2018-09-06 12:01:28 -0500 | [diff] [blame] | 165 | (e.g. "Master"). |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 166 | """ |
| 167 | |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 168 | result = ExecutionResult(xml_file_path) |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 169 | result.configure(stat_config={'suite_stat_level': 2, |
| 170 | 'tag_stat_combine': 'tagANDanother'}) |
| 171 | |
| 172 | stats = result.statistics |
George Keishing | f8a9ebe | 2018-08-06 12:49:11 -0500 | [diff] [blame] | 173 | print("--------------------------------------") |
| 174 | total_tc = stats.total.critical.passed + stats.total.critical.failed |
| 175 | print("Total Test Count:\t %d" % total_tc) |
| 176 | print("Total Test Failed:\t %d" % stats.total.critical.failed) |
| 177 | print("Total Test Passed:\t %d" % stats.total.critical.passed) |
| 178 | print("Test Start Time:\t %s" % result.suite.starttime) |
| 179 | print("Test End Time:\t\t %s" % result.suite.endtime) |
| 180 | print("--------------------------------------") |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 181 | |
| 182 | # Use ResultVisitor object and save off the test data info |
| 183 | class TestResult(ResultVisitor): |
| 184 | def __init__(self): |
| 185 | self.testData = [] |
| 186 | |
| 187 | def visit_test(self, test): |
| 188 | self.testData += [test] |
| 189 | |
| 190 | collectDataObj = TestResult() |
| 191 | result.visit(collectDataObj) |
| 192 | |
| 193 | # Write the result statistics attributes to CSV file |
| 194 | l_csvlist = [] |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 195 | |
| 196 | # Default Test data |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 197 | l_test_type = test_phase |
George Keishing | 19533d5 | 2018-04-09 03:08:03 -0500 | [diff] [blame] | 198 | |
George Keishing | 360db63 | 2018-09-06 12:01:28 -0500 | [diff] [blame] | 199 | l_pse_rel = 'Master' |
George Keishing | 19533d5 | 2018-04-09 03:08:03 -0500 | [diff] [blame] | 200 | if level: |
| 201 | l_pse_rel = level |
| 202 | |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 203 | l_env = 'HW' |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 204 | l_proc = processor |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 205 | l_platform_type = "" |
| 206 | l_func_area = "" |
| 207 | |
Gunnar Mills | 096cd56 | 2018-03-26 10:19:12 -0500 | [diff] [blame] | 208 | # System data from XML meta data |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 209 | # l_system_info = get_system_details(xml_file_path) |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 210 | |
| 211 | # First let us try to collect information from keyboard input |
| 212 | # If keyboard input cannot give both information, then find from xml file. |
| 213 | if version_id and platform: |
| 214 | l_driver = version_id |
| 215 | l_platform_type = platform |
George Keishing | f8a9ebe | 2018-08-06 12:49:11 -0500 | [diff] [blame] | 216 | print("BMC Version_id:%s" % version_id) |
| 217 | print("BMC Platform:%s" % platform) |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 218 | else: |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 219 | # System data from XML meta data |
| 220 | l_system_info = get_system_details(xml_file_path) |
| 221 | l_driver = l_system_info[0] |
| 222 | l_platform_type = l_system_info[1] |
| 223 | |
| 224 | # Driver version id and platform are mandatorily required for CSV file |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 225 | # generation. If any one is not avaulable, exit CSV file generation |
| 226 | # process. |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 227 | if l_driver and l_platform_type: |
George Keishing | f8a9ebe | 2018-08-06 12:49:11 -0500 | [diff] [blame] | 228 | print("Driver and system info set.") |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 229 | else: |
George Keishing | f8a9ebe | 2018-08-06 12:49:11 -0500 | [diff] [blame] | 230 | print("Both driver and system info need to be set.\ |
| 231 | CSV file is not generated.") |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 232 | sys.exit() |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 233 | |
| 234 | # Default header |
| 235 | l_header = ['test_start', 'test_end', 'subsys', 'test_type', |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 236 | 'test_result', 'test_name', 'pse_rel', 'driver', |
| 237 | 'env', 'proc', 'platform_type', 'test_func_area'] |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 238 | |
| 239 | l_csvlist.append(l_header) |
| 240 | |
| 241 | # Generate CSV file onto the path with current time stamp |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 242 | l_base_dir = csv_dir_path |
George Keishing | 937fe3c | 2019-10-29 11:20:34 -0500 | [diff] [blame] | 243 | l_timestamp = datetime.datetime.utcnow().strftime("%Y-%m-%d-%H-%M-%S") |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 244 | # Example: 2017-02-20-08-47-22_Witherspoon.csv |
| 245 | l_csvfile = l_base_dir + l_timestamp + "_" + l_platform_type + ".csv" |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 246 | |
George Keishing | f8a9ebe | 2018-08-06 12:49:11 -0500 | [diff] [blame] | 247 | print("Writing data into csv file:%s" % l_csvfile) |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 248 | |
| 249 | for testcase in collectDataObj.testData: |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 250 | # Functional Area: Suite Name |
| 251 | # Test Name: Test Case Name |
| 252 | l_func_area = str(testcase.parent).split(' ', 1)[1] |
| 253 | l_test_name = str(testcase) |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 254 | |
| 255 | # Test Result pass=0 fail=1 |
| 256 | if testcase.status == 'PASS': |
| 257 | l_test_result = 0 |
| 258 | else: |
| 259 | l_test_result = 1 |
| 260 | |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 261 | # Format datetime from robot output.xml to "%Y-%m-%d-%H-%M-%S" |
| 262 | l_stime = xml_to_csv_time(testcase.starttime) |
| 263 | l_etime = xml_to_csv_time(testcase.endtime) |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 264 | # Data Sequence: test_start,test_end,subsys,test_type, |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 265 | # test_result,test_name,pse_rel,driver, |
George Keishing | 360db63 | 2018-09-06 12:01:28 -0500 | [diff] [blame] | 266 | # env,proc,platform_type,test_func_area, |
Vijay | e3a9837 | 2019-10-30 02:04:22 -0500 | [diff] [blame] | 267 | l_data = [l_stime, l_etime, subsystem, l_test_type, l_test_result, |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 268 | l_test_name, l_pse_rel, l_driver, l_env, l_proc, |
| 269 | l_platform_type, l_func_area] |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 270 | l_csvlist.append(l_data) |
| 271 | |
George Keishing | a96e27c | 2016-12-04 23:05:04 -0600 | [diff] [blame] | 272 | # Open the file and write to the CSV file |
| 273 | l_file = open(l_csvfile, "w") |
| 274 | l_writer = csv.writer(l_file, lineterminator='\n') |
| 275 | l_writer.writerows(l_csvlist) |
| 276 | l_file.close() |
Steven Sombar | 3e82e3b | 2019-03-21 10:33:52 -0500 | [diff] [blame] | 277 | # Set file permissions 666. |
| 278 | perm = stat.S_IRUSR + stat.S_IWUSR + stat.S_IRGRP + stat.S_IWGRP + stat.S_IROTH + stat.S_IWOTH |
| 279 | os.chmod(l_csvfile, perm) |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 280 | |
| 281 | |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 282 | def xml_to_csv_time(xml_datetime): |
| 283 | r""" |
| 284 | Convert the time from %Y%m%d %H:%M:%S.%f format to %Y-%m-%d-%H-%M-%S format |
| 285 | and return it. |
| 286 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 287 | Description of argument(s): |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 288 | datetime The date in the following format: %Y%m%d |
| 289 | %H:%M:%S.%f (This is the format |
| 290 | typically found in an XML file.) |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 291 | |
| 292 | The date returned will be in the following format: %Y-%m-%d-%H-%M-%S |
| 293 | """ |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 294 | |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 295 | # 20170206 05:05:19.342 |
George Keishing | 937fe3c | 2019-10-29 11:20:34 -0500 | [diff] [blame] | 296 | l_str = datetime.datetime.strptime(xml_datetime, "%Y%m%d %H:%M:%S.%f") |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 297 | # 2017-02-06-05-05-19 |
| 298 | l_str = l_str.strftime("%Y-%m-%d-%H-%M-%S") |
| 299 | return str(l_str) |
| 300 | |
| 301 | |
| 302 | def get_system_details(xml_file_path): |
| 303 | r""" |
| 304 | Get the system data from output.xml generated by robot and return it. |
Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 305 | The list returned will be in the following order: [driver,platform] |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 306 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 307 | Description of argument(s): |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 308 | xml_file_path The relative or absolute path to the |
| 309 | output.xml file. |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 310 | """ |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 311 | |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 312 | bmc_version_id = "" |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 313 | bmc_platform = "" |
| 314 | with open(xml_file_path, 'rt') as output: |
| 315 | tree = ElementTree.parse(output) |
| 316 | |
| 317 | for node in tree.iter('msg'): |
| 318 | # /etc/os-release output is logged in the XML as msg |
George Keishing | 360db63 | 2018-09-06 12:01:28 -0500 | [diff] [blame] | 319 | # Example: ${output} = VERSION_ID="v1.99.2-71-gbc49f79" |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 320 | if '${output} = VERSION_ID=' in node.text: |
George Keishing | 360db63 | 2018-09-06 12:01:28 -0500 | [diff] [blame] | 321 | # Get BMC version (e.g. v1.99.1-96-g2a46570) |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 322 | bmc_version_id = str(node.text.split("VERSION_ID=")[1])[1:-1] |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 323 | |
| 324 | # Platform is logged in the XML as msg. |
| 325 | # Example: ${bmc_model} = Witherspoon BMC |
| 326 | if '${bmc_model} = ' in node.text: |
| 327 | bmc_platform = node.text.split(" = ")[1] |
| 328 | |
manasarm | e4f79c9 | 2018-02-22 13:02:46 +0530 | [diff] [blame] | 329 | print_vars(bmc_version_id, bmc_platform) |
| 330 | return [str(bmc_version_id), str(bmc_platform)] |
George Keishing | 74777bd | 2017-02-07 01:43:38 -0600 | [diff] [blame] | 331 | |
| 332 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 333 | def main(): |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 334 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 335 | if not gen_get_options(parser, stock_list): |
| 336 | return False |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 337 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 338 | if not validate_parms(): |
| 339 | return False |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 340 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 341 | qprint_pgm_header() |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 342 | |
Steven Sombar | a5e32f2 | 2019-03-01 13:33:15 -0600 | [diff] [blame] | 343 | parse_output_xml(source, dest, version_id, platform, level, |
| 344 | test_phase, processor) |
George Keishing | 9fbdf79 | 2016-10-18 06:16:09 -0500 | [diff] [blame] | 345 | |
manasarm | 5dedfaf | 2018-02-07 14:54:54 +0530 | [diff] [blame] | 346 | return True |
| 347 | |
| 348 | |
| 349 | # Main |
| 350 | |
| 351 | if not main(): |
| 352 | exit(1) |