# -*- coding: utf-8 -*- ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_inhandled_message_log # date 2022/04/09 # author # # NOTE: # This test verifies the unhandled logs for the messages provided import os from dialin.ui.hd_simulator import HDSimulator #from dialin.dg import DGSimulator from dialin.ui import utils from configuration import utility from configuration import config import builtins from dialin.common.msg_ids import MsgIds from dialin.common import msg_defs hd_simulator = HDSimulator() def verify_log(msg_id,msg = None, param = None): utils.waitForGUI(0.2) ack = False if not msg_id in msg_defs.ACK_NOT_REQUIRED: ack = True message_extracted = utility.get_current_log_details(message_ack = ack, message_text = msg) test.log(str(message_extracted)) if ack == True: test.verify(config.ACK_REQ_STATUS in message_extracted, "ack request is verified") test.verify(config.ACK_BAK_STATUS in message_extracted, "ack back is verified") message_id_hex = builtins.hex(builtins.int(msg_id)) message_id_str = builtins.str(message_id_hex) test.verify(message_id_str in message_extracted, "message ID is verified") if param != None: test.verify(param in message_extracted, "parameters are verified") UNHANDLED_MESSAGE_1 = "\n[0x7234]\nHDDDDDDDDD\nU32=Audio Volume\nF32=Audio Current HG\n" #['F32=Audio Current LG'], ['F32=Backup Audio Current'], ['U32=Safety Shutdown']] #UNHANDLED_MESSAGE_2 = def navigate_unhandled_message(): location = '/home/denali/Projects/application/resources/settings/Messages/Unhandled.conf' with open(location, "a") as filereader: filereader.write(UNHANDLED_MESSAGE_1) snooze(5) def main(): startApplication("denaliSquish") navigate_unhandled_message() ''' cd "$HOME"/opt/spacelabs/Monitor/MCISIM/LaunchScrptFiles snooze(5) shell_script (compling application) log v/s dic #0x7D00 alarm._send_alarm_volume_broadcast() verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_INFORMATION.value, msg = '~HD_Alarm_Information', param = [5,1,1,1,'?']) ''' #0x0A00 hd_simulator.cmd_send_hd_general_response(message_id = 29236, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_RTC_EPOCH.value, msg = '~HD_RTC_Epoch_Data', param = [1]) ''' #0x2100 hd_simulator.cmd_send_hd_general_response(message_id = 33, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_DG_SWITCH_RESERVOIR_CMD.value, msg = '~DG_Switch_Res_Cmd', param = [1]) #0x0080 hd_simulator.cmd_send_hd_general_response(message_id = 640, accepted = 1, reason = 1) #verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_INFORMATION.value, msg = '~HD_Alarm_Information', param = [5,1,1,1,'?']) """ hd_simulator.cmd_send_hd_general_response(message_id = 10, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_INFORMATION.value, msg = '~HD_Alarm_Information', param = [5,1,1,1,'?']) hd_simulator.cmd_send_hd_general_response(message_id = 33, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_INFORMATION.value, msg = '~HD_Alarm_Information', param = [5,1,1,1,'?']) hd_simulator.cmd_send_hd_general_response(message_id = 33, accepted = 1, reason = 1) verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_INFORMATION.value, msg = '~HD_Alarm_Information', param = [5,1,1,1,'?']) #reservoirs.cmd_switch_reservoirs(reservoir = 1) snooze(5) #valves = HDValves(can_interface=messenger, logger=logger) #rtc.cmd_set_rtc_time_and_date(second = 25, minute = 30, hour = 2, day = 5, month = 5, year = 2015) ''' snooze(5)