Index: shared/scripts/configuration/config.py =================================================================== diff -u -r8ad5f306455a57670d4ab09c409c3d2941194e46 -r8a47faf40db724c9f1360b5e5579530410ee86ca --- shared/scripts/configuration/config.py (.../config.py) (revision 8ad5f306455a57670d4ab09c409c3d2941194e46) +++ shared/scripts/configuration/config.py (.../config.py) (revision 8a47faf40db724c9f1360b5e5579530410ee86ca) @@ -9,7 +9,7 @@ # @file config.py # # @author (last) LTTS -# @date (last) 18-Jan-2022 +# @date (last) 08-July-2022 # ############################################################################ @@ -21,71 +21,4 @@ COMMON_PATH = os.environ['HOME']+"/Projects" -#create custom treatment -HIGHER_VALUE_OF_BLOOD_FLOW_RATE = 500 -LOWER_VALUE_OF_BLOOD_FLOW_RATE = 100 -STEP_VALUE_OF_BLOOD_FLOW_RATE = 25 -BUFFER_LOW_AND_HIGH_LIMITS = 30 -ARTERIAL_VALUE_0 = 0 -ARTERIAL_VALUE_NEGATIVE_300 = -300 -ARTERIAL_VALUE_NEGATIVE_20 = -20 -ARTERIAL_VALUE_NEGATIVE_270 = -270 -VENOUS_VALUE_600 = 600 -VENOUS_VALUE_20 = 20 -VENOUS_VALUE_50 = 50 -VENOUS_VALUE_570 = 570 -POSITIVE_BUFFER = 10 -NEGATIVE_BUFFER = -10 - -#dictionary consist of custom treatment values -CREATE_CUSTOM_TREATMENT = { - "Blood Flow Rate": 250, - "Dialysate Flow Rate": 400, - "Duration": 270, - "Heparin Dispensing Rate": 0.5, - "Heparin Bolus Volume": 1, - "Heparin Stop Time": 100, - "Saline Bolus Volume": 200, - "Dialysate Temperature": 37, - "Blood Pressure Measurement Interval": 40, - "Rinseback Flow Rate": 100, - "Arterial Pressure Limit Low" : -30, - "Arterial Pressure Limit High" : 0, - "Blood Pressure Measure Interval" : 40, - "Rinseback Rate" : 100, - "Venous Pressure Limit High" : 590, - "Venous Pressure Limit Low": 560 - -} - -#dictionary consist of slider values of treatment parameters -CREATE_TREATMENT_PARAMETER_RANGE = { - "Blood Flow Rate": [100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 475, 500], - "Dialysate Flow Rate": [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600], - "Duration": [60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 240, 255, 270, 285, 300, 315, 330, 345, 360, 375, 390, 405, 420, 435, 450, 465, 480], - "Heparin Dispensing Rate": [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 0], - "Heparin Bolus Volume": [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 0], - "Heparin Stop Time": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 0], - "Saline Bolus Volume": [100, 200, 300], - "Dialysate Temperature": [35.0, 35.5, 36.0, 36.5, 37.0], - "Blood Pressure Measurement Interval": [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 0], - "Rinseback Flow Rate": [50, 75, 100, 125, 150], -} - -#dictionary consist of slider minimum value, slider buffer value, width buffer of slider -CREATE_TREATMENT_SLIDER_VALUES = { - - "blood_flow_rate" : [100, 25, 46], - "dialysate_flow_rate" : [100, 50, 75], - "duration" : [60, 15, 26.6], - "heparin_dispensing_rate" : [0, 0.1, 75], - "heparin_bolus_volume" : [0, 0.1, 37], - "heparin_stop_time" : [0, 10, 15.9], - "saline_bolus" : [100, 100, 375], - "dialysate_temperature" : [35, 0.5, 187.5], - "arterial_pressure_limit_high" : [20, 10, 11.931], - "blood_pressure_measurement_interval" : [0, 5, 62], - "rinseback_flow_rate" : [50, 25, 187], -} - CLOUD_SYNC_INP__BUF_LOCATION = '/home/denali/Desktop/sd-card/cloudsync/*.buf' Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r8ad5f306455a57670d4ab09c409c3d2941194e46 -r8a47faf40db724c9f1360b5e5579530410ee86ca --- shared/scripts/configuration/utility.py (.../utility.py) (revision 8ad5f306455a57670d4ab09c409c3d2941194e46) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 8a47faf40db724c9f1360b5e5579530410ee86ca) @@ -8,18 +8,45 @@ # @file utils.py # # @author (last) LTTS -# @date (last) 15-Jan-2022 +# @date (last) 08-July-2022 # ############################################################################ - +import os import names import test import object import squish +import glob from configuration import config from builtins import int as pyInt + +CLOUD_CREDENTIALS_LOCATION = '/home/denali/Desktop/cloudsync/credentials' +CLOUD_SYNC_LOG_LOCATION = '/home/denali/Desktop/sd-card/cloudsync' + +PEM_FILES = ['1.pem', '2.pem', '3.pem' ] + + +def get_current_date_and_time(date_format='%Y/%b/%d - %H:%M:%S'): + + date = datetime.now() + return str(date.strftime(date_format)) + + +def append_cloudsync_credentials_file(): + + try: + os.makedirs(CLOUD_CREDENTIALS_LOCATION, exist_ok = True) + test.log("Directory created successfully") + for file_handler in range(len(PEM_FILES)): + path = os.path.join(CLOUD_CREDENTIALS_LOCATION, PEM_FILES[file_handler]) + with open(path, 'w') as file_reader: + pass + + except OSError as error: + test.log("Directory can not be created") + def get_extracted_file_inp_buf(): """ This function is the handler for getting file from cloudsync folder. @@ -37,3 +64,4 @@ except: test.fail("input buf file is not created during application interaction") return False + \ No newline at end of file Fisheye: Tag 8a47faf40db724c9f1360b5e5579530410ee86ca refers to a dead (removed) revision in file `tst_cloud_sync_hd_opmode/test.py'. Fisheye: No comparison available. Pass `N' to diff? Index: tst_cloud_sync_hd_opmodes/test.py =================================================================== diff -u --- tst_cloud_sync_hd_opmodes/test.py (revision 0) +++ tst_cloud_sync_hd_opmodes/test.py (revision 8a47faf40db724c9f1360b5e5579530410ee86ca) @@ -0,0 +1,133 @@ +# -*- 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_cloud_sync_hd_opmodes +# date 2022/07/08 +# author Shweta Policepatil +# +# +# +# NOTE: +# This test verifies the cloud sync - tst_cloud_sync_hd_opmode. +import os +import csv +from builtins import int as pyInt +from builtins import str as pyStr +from dialin.ui.hd_simulator import HDSimulator +from dialin.ui import utils +from configuration import utility +from configuration import config +from dialin.common.hd_defs import HDOpModes, HDOpSubModes +from dialin.utils.conversions import float_to_bytearray, integer_to_bytearray,unsigned_integer_to_bytearray + + + +hd_simulator = HDSimulator() + +expected_crc = 0 +expected_code = 1006 +expected_parameter = [] +expected_opmodes = [0, 1, 2, 3, 4, 5, 6, 7] +expected_submode = 0 +PEM_FILES = ['1.pem', '2.pem', '3.pem' ] +MESSAGE_FAULT_MODE = '1639391827,1,0,1006,2,0,0' +MESSAGE_SERVICE_MODE = '1639391827,1,0,1006,2,1,0' +MESSAGE_INIT_MODE = '1639391827,1,0,1006,2,2,0' +MESSAGE_STAND_BY_MODE = '1639391827,1,0,1006,2,3,0' +MESSAGE_TPAR_MODE = '1639391827,1,0,1006,2,4,0' +MESSAGE_PRETREATMENT_MODE = '1639391827,1,0,1006,2,5,0' +MESSAGE_PRETREATMENT_MODE = '1639391827,1,0,1006,2,6,0' +MESSAGE_POST_TREATMENT_MODE = '1639391827,1,0,1006,2,7,0' +MESSAGE_ILLEGAL_TRANSITION_MODE = '1639391827,1,0,1006,2,8,0' +expected_crc = '0' +expected_code = '1006' +expected_parameter = '2' +expected_opmodes = [0, 1, 2, 3, 4, 5, 6, 7] +expected_submode = '0' +PEM_FILES = ['1.pem', '2.pem', '3.pem' ] + +def navigate_to_hd_opmodes(): + """ + Method to navigate different hd opmodes to verify message id's logged in cloudsync """ + + test.startSection("Navigating to different hd opmodes to verify message id's") + test.log("Fault mode") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_FAUL.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) +# test.log("Service Screen") +# hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) +# utils.waitForGUI(1) +# test.log("Initial Screen") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_INIT.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) + test.log("Standby mode") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_STAN.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) + test.log("Treatment mode") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TPAR.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) + test.log("Pre- Treatment mode") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_PRET.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) + test.log("Treatment mode") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TREA.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) + test.log("Post treatment Screen") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_POST.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) + test.log("Service Screen") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) + utils.waitForGUI(1) + test.log("Illegal trasition") + hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_NLEG.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) +# utils.waitForGUI(1) +# hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.NUM_OF_MODES.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) +# + test.endSection() + +def retrive_log_data(): + + file_name = utility.get_extracted_file_inp_buf() + try: + with open(file_name,mode = 'r') as f: + contents = csv.reader(f) + try: + for reader in reversed(list(contents)): + test.log(str(reader)) + return (reader[0],reader[1],reader[2],reader[3],reader[4],reader[5],reader[6]) + except: + test.fail("application log data is corrupted") + except: + test.fail("Log file is not created or log file is not created based on standard log naming format.") + +def verify_cloud_sync_log_data(crc,code,parameter,opmode,submode): + """ + """ + test.startSection("verifying cloud sync log data ") + test.compare(crc,expected_crc) + test.compare(code,expected_code) + test.compare(parameter,expected_parameter) +# for opmode in range (len(expected_opmodes)): +# test.compare(opmode,expected_opmodes[0]) + test.compare(opmode,expected_opmodes) + test.compare(submode,expected_submode) + test.endSection() +def main(): + + utility.append_cloudsync_credentials_file() + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + + utils.waitForGUI(1.5) + navigate_to_hd_opmodes() + + epoch_time,serial_num,crc,code,parameter,opmode,submode = retrive_log_data() + verify_cloud_sync_log_data(crc,code,parameter,opmode,submode) + + utils.tstDone() + \ No newline at end of file