From ed473475dede47010bc21b759651d7b0d0d019bb Mon Sep 17 00:00:00 2001 From: Vismal S Kumar Date: Fri, 21 Nov 2025 22:12:22 +0530 Subject: [PATCH 1/3] RDKTV-39100 : [SECVULN] migrate configuration files from /opt to /opt/secure (#318) RDKTV-39100 : [SECVULN] migrate configuration files from /opt to /opt/secure Reason for change: Move /opt/parodus_cfg.json to /opt/secure/parodus_cfg.json to avoid security vulnerability Test Procedure: For crud requests, parodus should use /opt/secure/parodus_cfg.json path. Risks: Medium Priority: P1 Signed off by:Vismal S Kumar --- src/hostif/parodusClient/startParodus/startParodus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hostif/parodusClient/startParodus/startParodus.cpp b/src/hostif/parodusClient/startParodus/startParodus.cpp index 1ef133c08..cf9c43498 100644 --- a/src/hostif/parodusClient/startParodus/startParodus.cpp +++ b/src/hostif/parodusClient/startParodus/startParodus.cpp @@ -38,7 +38,7 @@ #define WEBPA_CFG_FILE "/etc/webpa_cfg.json" #define WEBPA_CFG_OVERIDE_FILE "/opt/webpa_cfg.json" -#define CRUD_CONFIG_FILE "/opt/parodus_cfg.json" +#define CRUD_CONFIG_FILE "/opt/secure/parodus_cfg.json" #define SSL_CERT_FILE "/etc/ssl/certs/ca-certificates.crt" #define JWT_KEY "/etc/ssl/certs/webpa-rs256.pem" #define RECORD_JWT_PAYLOAD_FILE "/tmp/xmidt-jwt-payload.json" From 36c98aed633f7c1218dc378d0870de091a34f90a Mon Sep 17 00:00:00 2001 From: nhanasi Date: Mon, 24 Nov 2025 12:50:06 -0500 Subject: [PATCH 2/3] RDKEMW-10639: Convert memcapture tool as RDM downloadable package (#320) Reason for Change: Set the default value of Memcapture to False Co-authored-by: nhanas001c --- .../parodusClient/waldb/data-model/data-model-generic.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml b/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml index ab8b6d14b..d1739893c 100755 --- a/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml +++ b/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml @@ -4060,7 +4060,8 @@ - + + From dcbabf9a74a8967ac01e1b267d501da92d0db2e7 Mon Sep 17 00:00:00 2001 From: Vismal S Kumar Date: Thu, 27 Nov 2025 01:59:47 +0530 Subject: [PATCH 3/3] RDK-59250-RDKE-tr69hostif-100% L2 coverage (#319) * Update test_bootup_sequence.py Enhanced the bootup sequence * Update test_handlers_communications.py * Update tr69hostif_deviceip.py * Refactor WebPA tests with updated payloads and order Updated test order and modified payload URLs in multiple test functions for consistency and to use mock URLs. * Refactor WebPA firmware download URL test Refactor test_WebPA_Get_FWDL_URL_Handler to remove duplicate assertions and streamline the process. * Fix indentation for test_WebPA_Get_FWDL_URL_Handler * Update run_l2.sh * Implement test for RFC defaults file existence Add test for RFC defaults file creation and validation * Update test order in test_handlers_communications.py * Update test execution order for device tests * Update test order for WebPA handlers --------- Co-authored-by: nhanasi --- run_l2.sh | 6 +- .../tr69hostif_bootup_sequence.feature | 108 +++++++++++ ...tr69hostif_handlers_communications.feature | 8 + .../tests/helper_functions.py | 4 +- .../tests/profile_helper_functions.py | 4 +- .../tests/test_bootup_sequence.py | 174 ++++++++++++++++-- .../tests/test_handlers_communications.py | 95 +++++++--- .../tests/tr69hostif_deviceip.py | 10 +- .../tests/tr69hostif_webpa.py | 149 +++++++++++---- 9 files changed, 466 insertions(+), 92 deletions(-) diff --git a/run_l2.sh b/run_l2.sh index 10cd51fb3..b9610cc2a 100644 --- a/run_l2.sh +++ b/run_l2.sh @@ -36,13 +36,13 @@ sed -i '/ModelName/ {n; n; a\ dos2unix /etc/data-model-stb.xml - echo "RDK_PROFILE=STB" > /etc/device.properties +echo "RDK_PROFILE=STB" > /etc/device.properties echo "VERSION=99.99.15.07" >> /version.txt echo "Proto|http" >> /opt/fwdnldstatus.txt echo "Status|Download In Progress" >> /opt/fwdnldstatus.txt -echo "DnldFile|ELTE11MWR_E037.000.00.8.1s22_DEV.bin" >> /opt/fwdnldstatus.txt -echo "DnldURL|https://dac15cdlserver.ae.ccp.xcal.tv/Images" >> /opt/fwdnldstatus.txt +echo "DnldFile|TESTIMAGE_DEV.bin" >> /opt/fwdnldstatus.txt +echo "DnldURL|https://mockserver.tv/Images" >> /opt/fwdnldstatus.txt echo "FwUpdateState|Download complete" >> /opt/fwdnldstatus.txt cp ./src/integrationtest/conf/mgrlist.conf /etc/ diff --git a/test/functional-tests/features/tr69hostif_bootup_sequence.feature b/test/functional-tests/features/tr69hostif_bootup_sequence.feature index fe7b2dc83..b3b9b3de1 100644 --- a/test/functional-tests/features/tr69hostif_bootup_sequence.feature +++ b/test/functional-tests/features/tr69hostif_bootup_sequence.feature @@ -25,3 +25,111 @@ Feature: tr69hostif runs as daemon to collect data Then the tr69hostif should be running as a daemon And when the tr69hostif is initialized successfully Then the tr69hostif validation is done for all instance + + Scenario: json handler thread initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "SERVER: Started server successfully." message + + Scenario: http server thread initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "SERVER: Started server successfully." message + + Scenario: thread creation + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should not log the "pthread_create() failed" message + + Scenario: parodus initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "Initiating Connection with PARODUS success.." message + + Scenario: rbus initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should not log the "[rbusdml] Failed to initialized, rbus_checkStatus() returned with status" message + And should not log the "consumer: rbus_open failed" message + And should log the "[rbusdml]Successfully get the complete parameter list" message + And should log the "rbus_regDataElements registered successfully" message + + Scenario: hostif initialize config manager status + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should not log the "Failed to hostIf_initalize_ConfigManger()" message + + Scenario: Successful PwrContInterface thread initialization + When a new thread is requested with valid configuration + Then the system initializes the thread + And should log the "created getPwrContInterface thread.." message + And marks the thread as ready for execution + + Scenario: Successful ethernet thread initialization + When a new thread is requested with valid configuration Then the system initializes the thread + And should log the "checkForUpdates] Got lock.." message + And marks the thread as ready for execution + + Scenario: Data model merge + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "Entering data model merge process" message + And should log the "Merged XML files successfully into /tmp/data-model.xml" message + And should log the "Successfully merged Data Model" message + + Scenario: Data model initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "Successfully initialize Data Model" message + + Scenario: Bootstrap configuration + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "Bootstrap Properties File" message + And should log the "/opt/secure/RFC/bootstrap.ini" message + + Scenario: device manager initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "Device manager Initialized success" message + And should log the "break loop" message + + Scenario: webpa process requests + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "Starting WEBPA Parodus Connections" message + + Scenario: PowerController initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "start PowerController_Init()" message + And should log the "completed PowerController_Init()" message + And should log the "Got the powercontroller interface" message + + Scenario: power mode initialization + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And should log the "Registering power mode change callback" message + And should log the "Registered power mode change callback" message + + + Scenario: rfc_defaults_ini file + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And the /tmp/rfcdefaults.ini file should exist + + diff --git a/test/functional-tests/features/tr69hostif_handlers_communications.feature b/test/functional-tests/features/tr69hostif_handlers_communications.feature index 082fcc725..7b39efcc4 100644 --- a/test/functional-tests/features/tr69hostif_handlers_communications.feature +++ b/test/functional-tests/features/tr69hostif_handlers_communications.feature @@ -30,3 +30,11 @@ Feature: tr69hostif runs as daemon to collect data Then the tr69hostif validation is done for RFC get/set handlers Then the tr69hostif validation is done for Non RFC get/set handlers Then the tr69hostif validation is done for Bootstrap get/set handlers + + Scenario: bootstrap files exist + Given When the tr69hostif binary is invoked + Then the tr69hostif should be running as a daemon + And when the tr69hostif is initialized successfully + And the /opt/secure/RFC/bootstrap.ini file should exist + And the /opt/secure/RFC/bootstrap.journal file should exist + diff --git a/test/functional-tests/tests/helper_functions.py b/test/functional-tests/tests/helper_functions.py index d807194ca..c66a1a6ac 100644 --- a/test/functional-tests/tests/helper_functions.py +++ b/test/functional-tests/tests/helper_functions.py @@ -83,7 +83,7 @@ def get_process_uptime(pid): def get_pid(name: str): return subprocess.run(f"pidof {name}", shell=True, capture_output=True).stdout.decode('utf-8').strip() -def clear_T2logs(): +def clear_tr69hostiflogs(): subprocess.run(f"echo '' > {LOG_FILE}", shell=True) def grep_log_file(search: str, log_file: str): @@ -97,7 +97,7 @@ def remove_T2bootup_flag(): except: pass -def grep_T2logs(search: str): +def grep_tr69hostiflogs(search: str): search_result = "" search_pattern = re.compile(re.escape(search), re.IGNORECASE) try: diff --git a/test/functional-tests/tests/profile_helper_functions.py b/test/functional-tests/tests/profile_helper_functions.py index f0b1116df..76bf43b1b 100644 --- a/test/functional-tests/tests/profile_helper_functions.py +++ b/test/functional-tests/tests/profile_helper_functions.py @@ -30,8 +30,8 @@ print("Execute L2 Test suit for tr69hostif ") print("Clearing T2 logs") - clear_T2logs() + clear_tr69hostiflogs() print("Messages after clearing") - response = grep_T2logs(GREP_STRING) + response = grep_tr69hostiflogs(GREP_STRING) print(response) diff --git a/test/functional-tests/tests/test_bootup_sequence.py b/test/functional-tests/tests/test_bootup_sequence.py index faf632be2..b389c6447 100644 --- a/test/functional-tests/tests/test_bootup_sequence.py +++ b/test/functional-tests/tests/test_bootup_sequence.py @@ -59,27 +59,27 @@ def is_process_active(): def test_check_tr69_json_handler(): is_process_active() JSON_SUCCESS_MSG = "SERVER: Started server successfully." - assert JSON_SUCCESS_MSG in grep_T2logs(JSON_SUCCESS_MSG) + assert JSON_SUCCESS_MSG in grep_tr69hostiflogs(JSON_SUCCESS_MSG) @pytest.mark.run(order=2) def test_check_http_server_status(): start_time = time.time(); is_process_active() HTTP_SUCCESS_MSG = "SERVER: Started server successfully." - assert HTTP_SUCCESS_MSG in grep_T2logs(HTTP_SUCCESS_MSG) + assert HTTP_SUCCESS_MSG in grep_tr69hostiflogs(HTTP_SUCCESS_MSG) print("--- %s seconds ---" % (time.time() - start_time)) @pytest.mark.run(order=3) def test_check_paradous_status(): is_process_active() PD_SUCCESS_MSG = "Initiating Connection with PARODUS success.." - assert PD_SUCCESS_MSG in grep_T2logs(PD_SUCCESS_MSG) + assert PD_SUCCESS_MSG in grep_tr69hostiflogs(PD_SUCCESS_MSG) @pytest.mark.run(order=4) def test_check_shutdown_thread_status(): is_process_active() SHUTDOWN_ERROR_MSG = "pthread_create() failed" - assert SHUTDOWN_ERROR_MSG not in grep_T2logs(SHUTDOWN_ERROR_MSG) + assert SHUTDOWN_ERROR_MSG not in grep_tr69hostiflogs(SHUTDOWN_ERROR_MSG) #Verify Initialization are success @pytest.mark.run(order=5) @@ -89,20 +89,172 @@ def test_init_rbus_dml_provider_status(): RBUS2_ERROR_MSG = "consumer: rbus_open failed" RBUS3_SUCCESS_MSG = "[rbusdml]Successfully get the complete parameter list" RBUS4_SUCCESS_MSG = "rbus_regDataElements registered successfully" - assert RBUS1_ERROR_MSG not in grep_T2logs(RBUS1_ERROR_MSG) - assert RBUS2_ERROR_MSG not in grep_T2logs(RBUS2_ERROR_MSG) - assert RBUS3_SUCCESS_MSG in grep_T2logs(RBUS3_SUCCESS_MSG) - assert RBUS4_SUCCESS_MSG in grep_T2logs(RBUS4_SUCCESS_MSG) + assert RBUS1_ERROR_MSG not in grep_tr69hostiflogs(RBUS1_ERROR_MSG) + assert RBUS2_ERROR_MSG not in grep_tr69hostiflogs(RBUS2_ERROR_MSG) + assert RBUS3_SUCCESS_MSG in grep_tr69hostiflogs(RBUS3_SUCCESS_MSG) + assert RBUS4_SUCCESS_MSG in grep_tr69hostiflogs(RBUS4_SUCCESS_MSG) @pytest.mark.run(order=6) def test_hostIf_initalize_ConfigManger_status(): is_process_active() CONFIG_ERROR_MSG = "Failed to hostIf_initalize_ConfigManger()" - assert CONFIG_ERROR_MSG not in grep_T2logs(CONFIG_ERROR_MSG) + assert CONFIG_ERROR_MSG not in grep_tr69hostiflogs(CONFIG_ERROR_MSG) @pytest.mark.run(order=7) +def test_iarm_initialization(): + """Verify IARM bus initialization""" + is_process_active() + IARM_INIT_MSG = "Success 'IARM_Bus_Init(tr69HostIfMgr)'" + THREAD_MSG = "created getPwrContInterface thread.." + + assert IARM_INIT_MSG in grep_tr69hostiflogs("IARM_Bus_Init"), "IARM initialization failed" + assert THREAD_MSG in grep_tr69hostiflogs("getPwrContInterface thread"), "getPwrContInterface thread creation failed" + + +@pytest.mark.run(order=8) +def test_power_controller_thread(): + """Verify getPwrContInterface thread is created""" + is_process_active() + THREAD_MSG = "created getPwrContInterface thread.." + assert THREAD_MSG in grep_tr69hostiflogs(THREAD_MSG), "getPwrContInterface thread creation failed" + +@pytest.mark.run(order=9) +def test_data_model_merge_process(): + """Verify data model merge workflow""" + is_process_active() + MERGE_START_MSG = "Entering data model merge process" + MERGE_SUCCESS_MSG = "Merged XML files successfully into /tmp/data-model.xml" + MERGE_COMPLETE_MSG = "Successfully merged Data Model" + + logs = grep_tr69hostiflogs("merge") + + assert MERGE_START_MSG in logs, "Data model merge process did not start" + assert MERGE_SUCCESS_MSG in logs, "XML merge failed" + assert MERGE_COMPLETE_MSG in logs, "Data model merge did not complete successfully" + + profile_log = grep_tr69hostiflogs("Merging XML files for profile:") + assert profile_log, "Profile information not found in merge logs" + print(f"\nProfile merge info: {profile_log}") + +@pytest.mark.run(order=10) def test_loadDataModel_status(): is_process_active() - DM_SUCCESS_MSG = "Successfully initialize Data Model" - assert DM_SUCCESS_MSG in grep_T2logs(DM_SUCCESS_MSG) + DM_SUCCESS_MSG = "Successfully initialize Data Model" + assert DM_SUCCESS_MSG in grep_tr69hostiflogs(DM_SUCCESS_MSG) + + +@pytest.mark.run(order=11) +def test_ethernet_client_thread(): + """Verify Ethernet client thread starts""" + is_process_active() + ETH_THREAD_MSG = "checkForUpdates] Got lock.." + assert ETH_THREAD_MSG in grep_tr69hostiflogs(ETH_THREAD_MSG), "Ethernet client thread did not start" + +@pytest.mark.run(order=12) +def test_bootstrap_configuration(): + """Verify bootstrap configuration is loaded""" + is_process_active() + BOOTSTRAP_MSG = "Bootstrap Properties File" + BOOTSTRAP_PATH = "/opt/secure/RFC/bootstrap.ini" + + logs = grep_tr69hostiflogs(BOOTSTRAP_MSG) + assert logs, "Bootstrap configuration not loaded" + assert BOOTSTRAP_PATH in logs, f"Bootstrap file path {BOOTSTRAP_PATH} not found" + +@pytest.mark.run(order=13) +def test_device_manager_initialization(): + """Verify device manager (dsClient) initialization""" + is_process_active() + DS_INIT_MSG = "Device manager Initialized success" + DS_BREAK_LOOP_MSG = "break loop" + + logs = grep_tr69hostiflogs("Device manager") + assert DS_INIT_MSG in logs, "Device manager initialization failed" + assert DS_BREAK_LOOP_MSG in logs, "Device manager initialization loop did not break properly" + + +@pytest.mark.run(order=14) +def test_webpa_ready_status(): + """Verify WebPA is ready to process requests""" + is_process_active() + WEBPA_START_MSG = "Starting WEBPA Parodus Connections" + PARODUS_START_MSG = "Starting WEBPA Parodus Connections" + + logs = grep_tr69hostiflogs("parodus") + + assert PARODUS_START_MSG in logs, "Parodus did not start correctly" + assert WEBPA_START_MSG in logs, "WebPA did not start correctly" + + +@pytest.mark.run(order=15) +def test_power_controller_initialization(): + """Verify PowerController initialization completes""" + is_process_active() + PC_START_MSG = "start PowerController_Init()" + PC_COMPLETE_MSG = "completed PowerController_Init()" + PC_INTERFACE_MSG = "Got the powercontroller interface" + + + logs = grep_tr69hostiflogs("PowerController") + + assert PC_START_MSG in logs, "PowerController initialization did not start" + assert PC_COMPLETE_MSG in logs, "PowerController initialization did not complete" + assert PC_INTERFACE_MSG in logs, "PowerController interface not acquired" + +@pytest.mark.run(order=16) +def test_power_mode_initialization(): + """Verify power mode initialization completes""" + is_process_active() + PC_REGISTERING_MSG = "Registering power mode change callback" + PC_CALLBACK_MSG = "Registered power mode change callback" + + logs = grep_tr69hostiflogs("power") + + assert PC_REGISTERING_MSG in logs, "Power mode change callback registration not started" + assert PC_CALLBACK_MSG in logs, "Power mode change callback not registered" + + +@pytest.mark.run(order=17) +def test_no_critical_errors(): + """Verify no critical errors during bootup""" + is_process_active() + + # Check for common critical errors + CRITICAL_ERRORS = [ + "pthread_create() failed", + "Failed to hostIf_initalize_ConfigManger()", + "[rbusdml] Failed to initialized", + "consumer: rbus_open failed", + "FATAL", + "CRITICAL" + ] + + logs = grep_tr69hostiflogs("tr69hostif") + + for error_msg in CRITICAL_ERRORS: + assert error_msg not in logs, f"Critical error found: {error_msg}" + + print("\nNo critical errors found during bootup sequence") + +@pytest.mark.run(order=18) +def test_rfcdefaults_ini_created(): + + RFC_DEFAULTS_FILE = "/tmp/rfcdefaults.ini" + RFC_PARAM_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Airplay.Enable" + RFC_PARAM_LINE ="Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Airplay.Enable=false" + EXPECTED_VALUE = "false" + RFC_STORE_LOG_MSG = "Calling getValue in New RFC Store I/O" + # Check if file exists + import os + assert os.path.exists(RFC_DEFAULTS_FILE), f"File {RFC_DEFAULTS_FILE} does not exist" + + with open(RFC_DEFAULTS_FILE, 'r') as f: + file_content = f.read() + assert RFC_PARAM_LINE in file_content, f"Expected parameter '{RFC_PARAM_NAME}' not found in {RFC_DEFAULTS_FILE}" + + #Get the parameter value from that file + param_value = rbus_get_data(RFC_PARAM_NAME) + #Check logs + assert RFC_STORE_LOG_MSG in grep_tr69hostiflogs(RFC_STORE_LOG_MSG), \ + f"RFC Store I/O log message not found in logs" diff --git a/test/functional-tests/tests/test_handlers_communications.py b/test/functional-tests/tests/test_handlers_communications.py index 8daffce8f..c8438ca4a 100644 --- a/test/functional-tests/tests/test_handlers_communications.py +++ b/test/functional-tests/tests/test_handlers_communications.py @@ -24,9 +24,9 @@ from helper_functions import * -@pytest.mark.run(order=8) +@pytest.mark.run(order=19) def test_DeviceInfo_Set_Get_Handler(): - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Telemetry.Version" VERSION_MSG = "2.2.1" rbus_set_data(DATA_ELEMENT_NAME, "string", VERSION_MSG) @@ -35,29 +35,30 @@ def test_DeviceInfo_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert VERSION_MSG in rstdout -@pytest.mark.run(order=9) +@pytest.mark.run(order=20) def test_DeviceTime_Set_Get_Handler(): - #clear_T2logs() - + #clear_tr69hostiflogs() + DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.DHCPv6Client.Enable" SERVER_ELEMENT_NAME = "Device.Time.NTPServer1" - + STATE_MSG = "true" SERVER_IP = "3.236.252.118" - + rbus_set_data(DATA_ELEMENT_NAME, "boolean", STATE_MSG) rstdout = rbus_get_data(DATA_ELEMENT_NAME) assert RBUS_EXCEPTION_STRING not in rstdout assert STATE_MSG in rstdout - + rbus_set_data(SERVER_ELEMENT_NAME, "string", SERVER_IP) rstdout = rbus_get_data(SERVER_ELEMENT_NAME) assert RBUS_EXCEPTION_STRING not in rstdout assert SERVER_IP in rstdout -@pytest.mark.run(order=10) + +@pytest.mark.run(order=21) def test_RFC_Set_Get_Handler(): - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.HdmiCecSink.CECVersion" VERSION_MSG = "1.4" rbus_set_data(DATA_ELEMENT_NAME, "string", VERSION_MSG) @@ -66,7 +67,7 @@ def test_RFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert VERSION_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable" STATE_MSG = "true" rbus_set_data(DATA_ELEMENT_NAME, "boolean", STATE_MSG) @@ -75,7 +76,7 @@ def test_RFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert STATE_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.TopSpeed" SPEED_LIMIT_MSG = "1280000" rbus_set_data(DATA_ELEMENT_NAME, "int", SPEED_LIMIT_MSG) @@ -83,8 +84,7 @@ def test_RFC_Set_Get_Handler(): rstdout = rbus_get_data(DATA_ELEMENT_NAME) assert RBUS_EXCEPTION_STRING not in rstdout assert SPEED_LIMIT_MSG in rstdout - - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.eMMCFirmware.Version" VERSION_MSG = "08140310" rbus_set_data(DATA_ELEMENT_NAME, "string", VERSION_MSG) @@ -93,7 +93,7 @@ def test_RFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert VERSION_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.IncrementalCDL.Enable" CDL_STATE_MSG = "true" rbus_set_data(DATA_ELEMENT_NAME, "boolean", CDL_STATE_MSG) @@ -102,9 +102,9 @@ def test_RFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert CDL_STATE_MSG in rstdout -@pytest.mark.run(order=11) +@pytest.mark.run(order=22) def test_NonRFC_Set_Get_Handler(): - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_IPRemoteSupport.Enable" IPRS_STATE_MSG = "false" rbus_set_data(DATA_ELEMENT_NAME, "boolean", IPRS_STATE_MSG) @@ -113,7 +113,7 @@ def test_NonRFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert IPRS_STATE_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.ForwardSSH.Enable" SSH_STATE_MSG = "false" rbus_set_data(DATA_ELEMENT_NAME, "boolean", SSH_STATE_MSG) @@ -122,7 +122,7 @@ def test_NonRFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert SSH_STATE_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadDeferReboot" FWDLRBT_STATE_MSG = "false" rbus_set_data(DATA_ELEMENT_NAME, "boolean", FWDLRBT_STATE_MSG) @@ -131,7 +131,7 @@ def test_NonRFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert FWDLRBT_STATE_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.RPC.FirmwareDownloadCompletedNotification" FWDLNOTIF_STATE_MSG = "false" rbus_set_data(DATA_ELEMENT_NAME, "boolean", FWDLNOTIF_STATE_MSG) @@ -140,40 +140,75 @@ def test_NonRFC_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert FWDLNOTIF_STATE_MSG in rstdout -@pytest.mark.run(order=12) +@pytest.mark.run(order=23) def test_Bootstrap_Set_Get_Handler(): - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerProductName" - PRODUCT_NAME_MSG = "Xfinity" + PRODUCT_NAME_MSG = "TestProduct123" rbus_set_data(DATA_ELEMENT_NAME, "string", PRODUCT_NAME_MSG) # Force reload config fetch from xconf rstdout = rbus_get_data(DATA_ELEMENT_NAME) assert RBUS_EXCEPTION_STRING not in rstdout assert PRODUCT_NAME_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.NetflixESNprefix" - ESN_PREFIX_MSG = "CMCSTX" + ESN_PREFIX_MSG = "TESTESN" rbus_set_data(DATA_ELEMENT_NAME, "string", ESN_PREFIX_MSG) # Force reload config fetch from xconf rstdout = rbus_get_data(DATA_ELEMENT_NAME) assert RBUS_EXCEPTION_STRING not in rstdout assert ESN_PREFIX_MSG in rstdout - - #clear_T2logs() + + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerName" - PARTNER_NAME_MSG = "Comcast" + PARTNER_NAME_MSG = "Test" rbus_set_data(DATA_ELEMENT_NAME, "string", PARTNER_NAME_MSG) # Force reload config fetch from xconf rstdout = rbus_get_data(DATA_ELEMENT_NAME) assert RBUS_EXCEPTION_STRING not in rstdout assert PARTNER_NAME_MSG in rstdout - #clear_T2logs() + #clear_tr69hostiflogs() DATA_ELEMENT_NAME ="Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.SsrUrl" - SSR_URL_MSG = "https://ssr.ccp.xcal.tv" + SSR_URL_MSG = "https://ssr.test.tv" rbus_set_data(DATA_ELEMENT_NAME, "string", SSR_URL_MSG) # Force reload config fetch from xconf rstdout = rbus_get_data(DATA_ELEMENT_NAME) assert RBUS_EXCEPTION_STRING not in rstdout assert SSR_URL_MSG in rstdout + +@pytest.mark.run(order=24) +def test_Bootstrap_File_Creation(): + import os + + sleep(5) + + # Verify bootstrap files exist + assert os.path.exists("/opt/secure/RFC/bootstrap.ini"), \ + "bootstrap.ini file was not created" + assert os.path.exists("/opt/secure/RFC/bootstrap.journal"), \ + "bootstrap.journal file was not created" + + # Test that bootstrap parameters can be set via RBUS + TEST_PARAM = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerProductName" + TEST_VALUE = "TestProduct123" + + # Set using standard L2 pattern + rbus_set_data(TEST_PARAM, "string", TEST_VALUE) + + result = rbus_get_data(TEST_PARAM) + assert RBUS_EXCEPTION_STRING not in result, \ + f"RBUS error occurred: {result}" + assert TEST_VALUE in result, \ + f"Expected value '{TEST_VALUE}' not found in result: {result}" + sleep(2) + + # Verify the parameter was written to bootstrap.ini + with open("/opt/secure/RFC/bootstrap.ini", "r") as f: + content = f.read() + assert TEST_VALUE in content, \ + f"Bootstrap parameter not found in file. Content:\n{content}" + + + diff --git a/test/functional-tests/tests/tr69hostif_deviceip.py b/test/functional-tests/tests/tr69hostif_deviceip.py index 97bb570d3..a39cba16c 100644 --- a/test/functional-tests/tests/tr69hostif_deviceip.py +++ b/test/functional-tests/tests/tr69hostif_deviceip.py @@ -24,7 +24,7 @@ from helper_functions import * -@pytest.mark.run(order=13) +@pytest.mark.run(order=25) def test_DeviceDefault_Set_Get_Handler(): #clear_T2logs() DATA_ELEMENT_NAME = "Device.DeviceInfo.SoftwareVersion" @@ -61,7 +61,7 @@ def test_DeviceDefault_Set_Get_Handler(): -@pytest.mark.run(order=14) +@pytest.mark.run(order=26) def test_DeviceIP_Set_Get_Handler(): #clear_T2logs() DATA_ELEMENT_NAME = "Device.IP.Interface.1.IPv6Prefix.1.Autonomous" @@ -151,7 +151,7 @@ def test_DeviceIP_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert PREF_LTF_STATUS_MSG in rstdout -@pytest.mark.run(order=15) +@pytest.mark.run(order=27) def test_DeviceServices_Set_Get_Handler(): #clear_T2logs() DATA_ELEMENT_NAME = "Device.Services.STBServiceNumberOfEntries" @@ -161,7 +161,7 @@ def test_DeviceServices_Set_Get_Handler(): assert RBUS_EXCEPTION_STRING not in rstdout assert STB_ENTRY_COUNT_MSG in rstdout -@pytest.mark.run(order=16) +@pytest.mark.run(order=28) def test_ReverseSSH_Set_Get_Handler(): #clear_T2logs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.ReverseSSH.xOpsReverseSshStatus" @@ -180,7 +180,7 @@ def test_ReverseSSH_Set_Get_Handler(): #clear_T2logs() DATA_ELEMENT_NAME = "Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.ReverseSSH.xOpsReverseSshArgs" - SSH_ARGS_MSG = "host=skyfoxtel.xcal.tv;hostIp=skyfoxtel.xcal.tv;stunnelport=2009;idletimeout=300;revsshport=3008;sshport=2221;user=webpa_user01;" + SSH_ARGS_MSG = "host=mockserver.tv;hostIp=mockserver.xmock.tv;stunnelport=2009;idletimeout=300;revsshport=3008;sshport=2221;user=webpa_user01;" rstdout = rbus_set_data(DATA_ELEMENT_NAME, "string", SSH_ARGS_MSG) # Force reload config fetch from xconf assert RBUS_SUCCESS_STRING in rstdout diff --git a/test/functional-tests/tests/tr69hostif_webpa.py b/test/functional-tests/tests/tr69hostif_webpa.py index 914ca85b0..ff84e968d 100644 --- a/test/functional-tests/tests/tr69hostif_webpa.py +++ b/test/functional-tests/tests/tr69hostif_webpa.py @@ -24,10 +24,10 @@ from helper_functions import * -@pytest.mark.run(order=17) -def test_WebPA_Set_XCONF_URL_Handler(): - print("Starting parodus mock process") - payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Control.XconfUrl","dataType":0,"value":"https://rdkautotool.ccp.xcal.tv/featureControl/getSettings"}]}' +@pytest.mark.run(order=29) +def test_WebPA_Set_XCONF_URL_Handler(): + print("Starting parodus mock process") + payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Control.XconfUrl","dataType":0,"value":"https://mockurl/featurecontrol/getSettings"}]}' command = ["/usr/local/bin/parodus", payload] result = subprocess.run(command, capture_output=True, text=True) @@ -39,7 +39,7 @@ def test_WebPA_Set_XCONF_URL_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) -@pytest.mark.run(order=18) +@pytest.mark.run(order=30) def test_WebPA_Get_XCONF_URL_Handler(): print("Starting parodus mock process") payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Control.XconfUrl"]}' @@ -54,10 +54,10 @@ def test_WebPA_Get_XCONF_URL_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) - XCONF_URL_STATUS_MSG = '"value":"https://rdkautotool.ccp.xcal.tv/featureControl/getSettings"' + XCONF_URL_STATUS_MSG = '"value":"https://mockurl/featurecontrol/getSettings"' assert XCONF_URL_STATUS_MSG in grep_paroduslogs(XCONF_URL_STATUS_MSG) -@pytest.mark.run(order=19) +@pytest.mark.run(order=31) def test_WebPA_Set_FWUPDATE_Handler(): print("Starting parodus mock process") payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.FWUpdate.AutoExcluded.Enable","dataType":3,"value":"false"}]}' @@ -72,7 +72,7 @@ def test_WebPA_Set_FWUPDATE_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) -@pytest.mark.run(order=20) +@pytest.mark.run(order=32) def test_WebPA_Get_FWUPDATE_Handler(): print("Starting parodus mock process") payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.FWUpdate.AutoExcluded.Enable"]}' @@ -90,10 +90,10 @@ def test_WebPA_Get_FWUPDATE_Handler(): FWUPDATE_STATUS_MSG = '"value":"false"' assert FWUPDATE_STATUS_MSG in grep_paroduslogs(FWUPDATE_STATUS_MSG) -@pytest.mark.run(order=21) +@pytest.mark.run(order=33) def test_WebPA_Set_LOGURL_Handler(): print("Starting parodus mock process") - payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.LogUpload.LogServerUrl","dataType":0,"value":"logs.xcal.tv"}]}' + payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.LogUpload.LogServerUrl","dataType":0,"value":"logs.mock.tv"}]}' command = ["/usr/local/bin/parodus", payload] result = subprocess.run(command, capture_output=True, text=True) @@ -105,7 +105,9 @@ def test_WebPA_Set_LOGURL_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) -@pytest.mark.run(order=22) + + +@pytest.mark.run(order=34) def test_WebPA_Get_LOGURL_Handler(): print("Starting parodus mock process") payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.LogUpload.LogServerUrl"]}' @@ -120,10 +122,11 @@ def test_WebPA_Get_LOGURL_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) - LOGURL_MSG = '"value":"logs.xcal.tv"' + LOGURL_MSG = '"value":"logs.mock.tv"' assert LOGURL_MSG in grep_paroduslogs(LOGURL_MSG) -@pytest.mark.run(order=23) + +@pytest.mark.run(order=35) def test_WebPA_Get_SPEED_Handler(): print("Starting parodus mock process") payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.LowSpeed"]}' @@ -141,7 +144,8 @@ def test_WebPA_Get_SPEED_Handler(): SPEED_STATUS_MSG = '"value":"12800"' assert SPEED_STATUS_MSG in grep_paroduslogs(SPEED_STATUS_MSG) -@pytest.mark.run(order=24) + +@pytest.mark.run(order=36) def test_WebPA_Get_FW_PROTOCOL_Handler(): print("Starting parodus mock process") payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadProtocol"]}' @@ -159,7 +163,8 @@ def test_WebPA_Get_FW_PROTOCOL_Handler(): FWDL_PROTOCOL_MSG = '"value":"http"' assert FWDL_PROTOCOL_MSG in grep_paroduslogs(FWDL_PROTOCOL_MSG) -@pytest.mark.run(order=25) + +@pytest.mark.run(order=37) def test_WebPA_Get_FWDL_STATUS_Handler(): print("Starting parodus mock process") payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadStatus"]}' @@ -174,13 +179,34 @@ def test_WebPA_Get_FWDL_STATUS_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) - FWDL_STATUS_MSG = '"value":"Download In Progress"' - assert FWDL_STATUS_MSG in grep_paroduslogs(FWDL_STATUS_MSG) - -@pytest.mark.run(order=26) -def test_WebPA_Get_FWDL_URL_Handler(): + logs = grep_paroduslogs('Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadStatus') + assert 'Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadStatus' in logs, \ + f"FirmwareDownloadStatus parameter not found in response" + + +@pytest.mark.run(order=38) +def test_WebPA_Get_FWDL_URL_Handler(): + print("Starting parodus mock process") + payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadURL"]}' + command = ["/usr/local/bin/parodus", payload] + + result = subprocess.run(command, capture_output=True, text=True) + assert result.returncode == 0, f"Command failed with error: {result.stderr}" + + STATUS_CODE_MSG = '"statusCode":200' + assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) + + SUCCESS_STATUS_MSG = '"message":"Success"' + assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) + + FWDL_URL_MSG = '"value":"https://mockserver.tv/Images"' + assert FWDL_URL_MSG in grep_paroduslogs(FWDL_URL_MSG) + + +@pytest.mark.run(order=39) +def test_WebPA_Get_FWDL_Handler(): print("Starting parodus mock process") - payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadURL"]}' + payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareToDownload"]}' command = ["/usr/local/bin/parodus", payload] result = subprocess.run(command, capture_output=True, text=True) @@ -192,13 +218,14 @@ def test_WebPA_Get_FWDL_URL_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) - FWDL_URL_MSG = '"value":"https://dac15cdlserver.ae.ccp.xcal.tv/Images"' - assert FWDL_URL_MSG in grep_paroduslogs(FWDL_URL_MSG) + FWDL_MSG = '"value":"TESTIMAGE_DEV.bin"' + assert FWDL_MSG in grep_paroduslogs(FWDL_MSG) -@pytest.mark.run(order=27) -def test_WebPA_Get_FWDL_Handler(): + +@pytest.mark.run(order=40) +def test_WebPA_Get_FWUPDATE_STATUS_Handler(): print("Starting parodus mock process") - payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareToDownload"]}' + payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareUpdateState"]}' command = ["/usr/local/bin/parodus", payload] result = subprocess.run(command, capture_output=True, text=True) @@ -210,13 +237,41 @@ def test_WebPA_Get_FWDL_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) - FWDL_MSG = '"value":"ELTE11MWR_E037.000.00.8.1s22_DEV.bin"' - assert FWDL_MSG in grep_paroduslogs(FWDL_MSG) + logs = grep_paroduslogs('FirmwareUpdateState') + assert ('"value":"Download complete"' in logs or '"value":"Download Complete"' in logs), \ + f"Expected firmware update state not found. Got: {logs}" -@pytest.mark.run(order=28) -def test_WebPA_Get_FWUPDATE_STATUS_Handler(): - print("Starting parodus mock process") - payload ='{"command":"GET","names":["Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareUpdateState"]}' +@pytest.mark.run(order=41) +def test_WebPA_Get_WILDCARD_STATUS_Handler(): + print("Starting parodus mock process") + payload ='{"command":"GET","names":["Device.DeviceInfo."]}' + command = ["/usr/local/bin/parodus", payload] + + result = subprocess.run(command, capture_output=True, text=True) + assert result.returncode == 0, f"Command failed with error: {result.stderr}" + + STATUS_CODE_MSG = '"statusCode":200' + assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) + + SUCCESS_STATUS_MSG = '"message":"Success"' + assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) + +@pytest.mark.run(order=42) +def test_WebPA_Set_FirmwareDownloadProtocol_For_Upgrade(): + print("Starting parodus mock process - Set firmware download protocol") + payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadProtocol","dataType":0,"value":"http"}]}' + command = ["/usr/local/bin/parodus", payload] + result = subprocess.run(command, capture_output=True, text=True) + assert result.returncode == 0, f"Command failed with error: {result.stderr}" + STATUS_CODE_MSG = '"statusCode":200' + assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) + SUCCESS_STATUS_MSG = '"message":"Success"' + assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) + +@pytest.mark.run(order=43) +def test_WebPA_Set_FirmwareDownloadURL_For_Upgrade(): + print("Starting parodus mock process - Set firmware download URL") + payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadURL","dataType":0,"value":"https://mockserver.tv/Images"}]}' command = ["/usr/local/bin/parodus", payload] result = subprocess.run(command, capture_output=True, text=True) @@ -228,13 +283,10 @@ def test_WebPA_Get_FWUPDATE_STATUS_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) - FWUPDATE_STATUS_MSG = '"value":"Download complete"' - assert FWUPDATE_STATUS_MSG in grep_paroduslogs(FWUPDATE_STATUS_MSG) - -@pytest.mark.run(order=29) -def test_WebPA_Get_WILDCARD_STATUS_Handler(): - print("Starting parodus mock process") - payload ='{"command":"GET","names":["Device.DeviceInfo."]}' +@pytest.mark.run(order=44) +def test_WebPA_Set_FirmwareToDownload_For_Upgrade(): + print("Starting parodus mock process - Set firmware to download") + payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareToDownload","dataType":0,"value":" TESTIMAGE_DEV.bin"}]}' command = ["/usr/local/bin/parodus", payload] result = subprocess.run(command, capture_output=True, text=True) @@ -246,4 +298,23 @@ def test_WebPA_Get_WILDCARD_STATUS_Handler(): SUCCESS_STATUS_MSG = '"message":"Success"' assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) +@pytest.mark.run(order=45) +def test_WebPA_Set_FirmwareDownloadNow_Trigger(): + print("Starting parodus mock process - Image Upgrade via RDK portal") + payload = '{"command":"SET","parameters":[{"name":"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadNow","dataType":3,"value":"true"}]}' + command = ["/usr/local/bin/parodus", payload] + + result = subprocess.run(command, capture_output=True, text=True) + assert result.returncode == 0, f"Command failed with error: {result.stderr}" + + STATUS_CODE_MSG = '"statusCode":200' + assert STATUS_CODE_MSG in grep_paroduslogs(STATUS_CODE_MSG) + + SUCCESS_STATUS_MSG = '"message":"Success"' + assert SUCCESS_STATUS_MSG in grep_paroduslogs(SUCCESS_STATUS_MSG) + # Verify script was triggered in logs + sleep(3) + SCRIPT_TRIGGER_MSG = "Triggered Download" + assert SCRIPT_TRIGGER_MSG in grep_tr69hostiflogs(SCRIPT_TRIGGER_MSG) +