Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r84c1284ecff1f30169d50afb688be18934eb8506 -r7883bcc9c71da71d09d48d8998a99a9b8ad0640a --- shared/scripts/configuration/utility.py (.../utility.py) (revision 84c1284ecff1f30169d50afb688be18934eb8506) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 7883bcc9c71da71d09d48d8998a99a9b8ad0640a) @@ -634,12 +634,12 @@ if check_ack_bak: continue else: - return message_to_return + return message_to_return, ack_bak_message elif lines_from_last >= MAX_LINE: if message_to_return is not None: return message_to_return, ack_bak_message test.fail("handler unable to find message text from log file.") - return + return message_to_return, ack_bak_message else: if config.ACK_BAK_STATUS in line: ack_bak_message = line @@ -791,33 +791,29 @@ """ This method Rename the original folder name to dummy name. """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename+"_1": - if os.path.exists(path+filename+"_1"): - shutil.rmtree(path+filename+"_1") - test.log(str(filename+" name changed to "+files)) - if files == filename: - if os.path.exists(path+filename): - utils.waitForGUI(1) - os.rename(path+filename,path+filename+"_1") - test.log(str(files+" name changed to "+filename+"_1")) + newFileName = filename + "_1" + oldFileName = filename + if os.path.exists(path+oldFileName): + os.rename(path+oldFileName, path+newFileName) + test.log(str(oldFileName+" name changed to "+newFileName)) + else: + test.log(str(oldFileName+" failed to rename to "+newFileName)) def rename_old_name(path,filename): """ This method Rename the dummy name to original folder name . """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename: - if os.path.exists(path+filename): - shutil.rmtree(path+filename) - test.log(str(files+"_1 name changed to "+filename)) - utils.waitForGUI(5) - if files != filename: - if (files == filename+"_1"): - os.rename(path+files,path+filename) - test.log(str(files+" name changed to "+filename)) + newFileName = filename + oldFileName = filename + "_1" + if os.path.exists(path+newFileName): + # During running of AUT, the application re-creates the folder (eg: application/resources/settings) + # need to delete before renaming + shutil.rmtree(path+newFileName) + if os.path.exists(path+oldFileName): + os.rename(path+oldFileName, path+newFileName) + test.log(str(oldFileName+" name changed to "+newFileName)) + else: + test.log(str(oldFileName+" failed to rename to "+newFileName)) def vitals_interval_obj(interval): names.o_time_interval_obj["text"] = interval @@ -1123,37 +1119,57 @@ utils.waitForGUI(0.2) flag = False title_found_status = False + list_title_found_status = False alarm_info_dict = {} with open(config.ALARM_MAPPING_CSV_FILE_LOCATION, 'r') as csv_file: csv_messages = list(csv.reader(csv_file)) with open(config.ALARMS_CONF_LOCATION, 'r') as conf_file: alarm_id = 1 for row in list(csv.reader(conf_file)): + print(f'ROW : {row}') try: - if flag is True and title_found_status is True: + # IF BOTH THE TITLE AND LISTTITLE ATTRIB ARE PARSED, GET THE MESSAGE + if flag is True and list_title_found_status is True: alarm_message = ",".join(row).split('= ') temp_message = " ".join(alarm_message[1::]) if '\\n' in temp_message: temp_message = '\n'.join(temp_message.split('\\n')) + print(f'TEMP title : {temp_message}') alarm_info_dict[alarm_id]['message'] = temp_message flag = False + list_title_found_status = False title_found_status = False if alarm_info_dict[alarm_id]['message'] == '' and alarm_id != config.NUM_OF_ALARM_ID: alarm_info_dict[alarm_id]['message'] = f'{csv_messages[alarm_id][-1].strip()[::]}' alarm_id += 1 - if flag is True: + # GET THE TITLE ATTRIBUTE + if flag is True and title_found_status is False: alarm_title = ",".join(row).split('= ') if alarm_title[0].split()[0] == 'Title': title_found_status = True temp_alarm_title = " ".join(alarm_title[1::]) - print(f'TEMP: {temp_alarm_title}') + print(f'TEMP title : {temp_alarm_title}') if '\\n' in temp_alarm_title: - print(f'HERE {alarm_id}') + print(f'HERE title {alarm_id}') temp_alarm_title = '\n'.join(temp_alarm_title.split('\\n')) - print(f'HERE {alarm_id}***{temp_alarm_title}') + print(f'HERE title {alarm_id}***{temp_alarm_title}') alarm_info_dict[alarm_id]['title'] = temp_alarm_title if alarm_info_dict[alarm_id]['title'] == '': alarm_info_dict[alarm_id]['title'] = 'Alarm' + # GET THE LISTTITLE ATTRIBUTE + if flag is True and title_found_status is True: + alarm_title = ",".join(row).split('= ') + if alarm_title[0].split()[0] == 'ListTitle': + list_title_found_status = True + temp_alarm_title = " ".join(alarm_title[1::]) + print(f'TEMP listTitle: {temp_alarm_title}') + if '\\n' in temp_alarm_title: + print(f'HERE listTitle {alarm_id}') + temp_alarm_title = '\n'.join(temp_alarm_title.split('\\n')) + print(f'HERE listTitle {alarm_id}***{temp_alarm_title}') + alarm_info_dict[alarm_id]['listTitle'] = temp_alarm_title + if alarm_info_dict[alarm_id]['listTitle'] == '': + alarm_info_dict[alarm_id]['listTitle'] = 'Alarm' if len(row) == 0: continue else: