From 395155d338e4f87436904982d2be11eccc87fe4b Mon Sep 17 00:00:00 2001 From: grandhi_santoshkumar Date: Fri, 7 Aug 2026 15:01:32 +0000 Subject: [PATCH 1/5] RDKEMW-19406: tr69hostif migrated to thunder Reason for change: tr69hostif migrated to thunder Test Procedure: refer RDKEMW-19406 Risks: High Signed-off-by:gsanto722 --- .../STBService/Capabilities_Thunder.cpp | 2 +- .../Components_DisplayDevice_Thunder.cpp | 2 +- .../Components_VideoOutput_Thunder.cpp | 2 +- .../native-platform/thunder-mock-server.js | 126 ++++++++++++++++++ 4 files changed, 129 insertions(+), 3 deletions(-) diff --git a/src/hostif/profiles/STBService/Capabilities_Thunder.cpp b/src/hostif/profiles/STBService/Capabilities_Thunder.cpp index f1fb567c6..45e64709d 100755 --- a/src/hostif/profiles/STBService/Capabilities_Thunder.cpp +++ b/src/hostif/profiles/STBService/Capabilities_Thunder.cpp @@ -2,7 +2,7 @@ * If not stated otherwise in this file or this component's LICENSE file the * following copyright and licenses apply: * - * Copyright 2017 RDK Management + * Copyright 2026 RDK Management * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/hostif/profiles/STBService/Components_DisplayDevice_Thunder.cpp b/src/hostif/profiles/STBService/Components_DisplayDevice_Thunder.cpp index 142436aa2..081149fad 100644 --- a/src/hostif/profiles/STBService/Components_DisplayDevice_Thunder.cpp +++ b/src/hostif/profiles/STBService/Components_DisplayDevice_Thunder.cpp @@ -92,7 +92,7 @@ void hostIf_STBServiceDisplayDevice::doUpdates(const char *baseName, updateCallb int hostIf_STBServiceDisplayDevice::getStatus(HOSTIF_MsgData_t *stMsgData, bool *pChanged) { bool connected = false; - if (!invokeThunderPluginMethodAndExtractBoolField(THUNDER_DI_CONNECTED, "{}", "isconnected", connected)) + if (!invokeThunderPluginMethodAndExtractScalarBoolResult(THUNDER_DI_CONNECTED, "{}", connected)) { RDK_LOG(RDK_LOG_WARN, LOG_TR69HOSTIF, "[%s] DisplayInfo.1.connected failed, returning Absent\n", __FUNCTION__); // On failure, default to Absent diff --git a/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp b/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp index ceb6feb8a..aab9dfedf 100644 --- a/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp +++ b/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp @@ -193,7 +193,7 @@ int hostIf_STBServiceVideoOutput::getStatus(HOSTIF_MsgData_t *stMsgData, bool *p { bool isConnected = false; - if (!invokeThunderPluginMethodAndExtractBoolField(THUNDER_DI_CONNECTED, "{}", "isconnected", isConnected)) + if (!invokeThunderPluginMethodAndExtractScalarBoolResult(THUNDER_DI_CONNECTED, "{}", isConnected)) { RDK_LOG(RDK_LOG_WARN, LOG_TR69HOSTIF, "[%s] DisplayInfo.1.connected failed, returning Disabled\n", __FUNCTION__); // On failure, default to Disabled diff --git a/test/test-artifacts/native-platform/thunder-mock-server.js b/test/test-artifacts/native-platform/thunder-mock-server.js index f02f0a040..4c423485d 100644 --- a/test/test-artifacts/native-platform/thunder-mock-server.js +++ b/test/test-artifacts/native-platform/thunder-mock-server.js @@ -151,6 +151,132 @@ const mockResponses = { result: { resetTime: 1717000000 }, description: 'Last checkout reset timestamp', }, + + // ─────────────────────────────────────────────────────────────────────────── + // STBService Thunder APIs - DisplaySettings (Audio) + // ─────────────────────────────────────────────────────────────────────────── + 'org.rdk.DisplaySettings.getSupportedAudioPorts': { + result: { supportedAudioPorts: ['HDMI0', 'SPEAKER0', 'SPDIF0'] }, + description: 'List of available audio output ports', + }, + 'org.rdk.DisplaySettings.getEnableAudioPort': { + result: { enable: true }, + description: 'Audio port enabled status', + }, + 'org.rdk.DisplaySettings.getMuted': { + result: { muted: false }, + description: 'Audio mute status', + }, + 'org.rdk.DisplaySettings.getVolumeLevel': { + result: { volumeLevel: 50 }, + description: 'Current audio volume level', + }, + 'org.rdk.DisplaySettings.getAudioEncoding': { + result: { encoding: 'PCM' }, + description: 'Current audio encoding format', + }, + 'org.rdk.DisplaySettings.getSoundMode': { + result: { soundMode: 'SURROUND' }, + description: 'Current audio sound mode', + }, + 'org.rdk.DisplaySettings.getMS12AudioCompression': { + result: { compressionlevel: 0 }, + description: 'MS12 audio compression level', + }, + + // ─────────────────────────────────────────────────────────────────────────── + // STBService Thunder APIs - DisplaySettings (Video) + // ─────────────────────────────────────────────────────────────────────────── + 'org.rdk.DisplaySettings.getSupportedVideoPorts': { + result: { supportedVideoPorts: ['HDMI0'] }, + description: 'List of available video output ports', + }, + 'org.rdk.DisplaySettings.getSupportedVideoDisplays': { + result: { supportedVideoDisplays: ['HDMI0'] }, + description: 'List of available video displays (for HDMI component)', + }, + 'org.rdk.DisplaySettings.getEnableVideoPort': { + result: { enable: true }, + description: 'Video port enabled status', + }, + 'org.rdk.DisplaySettings.getCurrentResolution': { + result: { resolution: '1080p' }, + description: 'Current video resolution', + }, + 'org.rdk.DisplaySettings.getSupportedResolutions': { + result: { supportedResolutions: ['480p', '720p', '1080p', '2160p60'] }, + description: 'Supported video resolutions', + }, + 'org.rdk.DisplaySettings.getDefaultResolution': { + result: { defaultResolution: '1080p' }, + description: 'Default/preferred resolution', + }, + 'org.rdk.DisplaySettings.getDisplayAspectRatio': { + result: { aspectRatio: '16x9' }, + description: 'Display aspect ratio', + }, + 'org.rdk.DisplaySettings.readEDID': { + result: { EDID: 'AP///////wBQrDYBAAAAAAwXAQSlOSJ4CvCVoVdTnCYPUFQAAAABAQEBAQEBAQEBAQEBAQEB3iGgcFCEHzAgOCUIAClHAAAeAAAA/QAyTBFEH4AgIAkQCQAKAAAA/ABERUxMCgAgAAAAAD9BUzEzMgogICAgAAAAAEE=' }, + description: 'EDID data from connected display', + }, + + // ─────────────────────────────────────────────────────────────────────────── + // STBService Thunder APIs - DisplayInfo + // ─────────────────────────────────────────────────────────────────────────── + 'DisplayInfo.1.connected': { + result: true, + description: 'Display connection status (property-style boolean)', + }, + 'DisplayInfo.1.framerate': { + result: 'Framerate6000', + description: 'Current display framerate (property-style string: FramerateXXXX where XXXX/100 = Hz)', + }, + + // ─────────────────────────────────────────────────────────────────────────── + // STBService Thunder APIs - PowerManager + // ─────────────────────────────────────────────────────────────────────────── + 'org.rdk.PowerManager.GetPowerState': { + result: { powerState: 'ON', success: true }, + description: 'System power state', + }, + + // ─────────────────────────────────────────────────────────────────────────── + // STBService Thunder APIs - AVOutput + // ─────────────────────────────────────────────────────────────────────────── + 'org.rdk.AVOutput.getZoomMode': { + result: { zoomMode: 'Full' }, + description: 'Video zoom/aspect ratio behavior', + }, + + // ─────────────────────────────────────────────────────────────────────────── + // STBService Thunder APIs - HdcpProfile + // ─────────────────────────────────────────────────────────────────────────── + 'org.rdk.HdcpProfile.getHDCPStatus': { + result: { isConnected: true, isHDCPCompliant: true, isHDCPEnabled: true, hdcpReason: 0, success: true }, + description: 'HDCP connection and compliance status', + }, + + // ─────────────────────────────────────────────────────────────────────────── + // STBService Thunder APIs - Capabilities + // ─────────────────────────────────────────────────────────────────────────── + 'org.rdk.DisplaySettings.getSupportedVideoCodingFormats': { + result: { supportedVideoCodingFormats: ['H264', 'MPEG2', 'HEVC'] }, + description: 'Supported video codec formats', + }, + 'org.rdk.DisplaySettings.getVideoCodecInfo': { + result: { + videocodecinfo: [{ + codec: 'H.265', + profile: 'Main', + level: '5.1' + }] + }, + description: 'Detailed video codec capabilities', + }, + 'org.rdk.DisplaySettings.getSupportedSettopResolutions': { + result: { supportedSettopResolutions: ['480p', '720p', '1080p', '2160p60'] }, + description: 'Supported set-top box output resolutions', + }, }; /** From 5d2acb2d7abd3421ea5a7d81913c06ebd9ab537f Mon Sep 17 00:00:00 2001 From: grandhi_santoshkumar Date: Mon, 10 Aug 2026 07:33:12 +0000 Subject: [PATCH 2/5] fix l2 and fail API --- .../Components_VideoOutput_Thunder.cpp | 4 ++-- .../tests/tr69hostif_stbservice_thunder.py | 2 +- .../native-platform/thunder-mock-server.js | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp b/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp index aab9dfedf..e9de37e2c 100644 --- a/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp +++ b/src/hostif/profiles/STBService/Components_VideoOutput_Thunder.cpp @@ -43,7 +43,7 @@ #define THUNDER_DS_GET_CURRENT_RESOLUTION "org.rdk.DisplaySettings.getCurrentResolution" #define THUNDER_DS_GET_DISPLAY_ASPECT_RATIO "org.rdk.DisplaySettings.getDisplayAspectRatio" #define THUNDER_DS_GET_ENABLE_VIDEO_PORT "org.rdk.DisplaySettings.getEnableVideoPort" -#define THUNDER_AVO_GET_ZOOM_MODE "org.rdk.AVOutput.getZoomMode" +#define THUNDER_DS_GET_ZOOM_SETTINGS "org.rdk.DisplaySettings.getZoomSetting" #define THUNDER_HDCP_GET_STATUS "org.rdk.HdcpProfile.getHDCPStatus" #define THUNDER_DI_CONNECTED "DisplayInfo.1.connected" @@ -273,7 +273,7 @@ int hostIf_STBServiceVideoOutput::getVideoFormat(HOSTIF_MsgData_t *stMsgData, bo int hostIf_STBServiceVideoOutput::getAspectRatioBehaviour(HOSTIF_MsgData_t *stMsgData, bool *pChanged) { std::string mode; - if (!invokeThunderPluginMethodAndExtractStringField(THUNDER_AVO_GET_ZOOM_MODE, "{}", "zoomSetting", mode)) + if (!invokeThunderPluginMethodAndExtractStringField(THUNDER_DS_GET_ZOOM_SETTINGS, "{}", "zoomSetting", mode)) mode = "None"; strncpy(stMsgData->paramValue, mode.c_str(), PARAM_LEN); stMsgData->paramValue[PARAM_LEN - 1] = '\0'; diff --git a/test/functional-tests/tests/tr69hostif_stbservice_thunder.py b/test/functional-tests/tests/tr69hostif_stbservice_thunder.py index 69b8ae3d2..04b0435e5 100644 --- a/test/functional-tests/tests/tr69hostif_stbservice_thunder.py +++ b/test/functional-tests/tests/tr69hostif_stbservice_thunder.py @@ -449,7 +449,7 @@ def test_STBService_VideoOutput_Get_Status(): assert RBUS_EXCEPTION_STRING not in rstdout, \ f"rbus exception getting {param}" assert CURL_OK_MSG in grep_tr69hostiflogs(CURL_OK_MSG) - assert rstdout.strip() in ("Enabled", "Disabled"), \ + assert any(v in rstdout for v in ("Enabled", "Disabled")), \ f"Unexpected VideoOutput Status: {rstdout}" diff --git a/test/test-artifacts/native-platform/thunder-mock-server.js b/test/test-artifacts/native-platform/thunder-mock-server.js index 4c423485d..5c65bf935 100644 --- a/test/test-artifacts/native-platform/thunder-mock-server.js +++ b/test/test-artifacts/native-platform/thunder-mock-server.js @@ -236,8 +236,8 @@ const mockResponses = { // STBService Thunder APIs - PowerManager // ─────────────────────────────────────────────────────────────────────────── 'org.rdk.PowerManager.GetPowerState': { - result: { powerState: 'ON', success: true }, - description: 'System power state', + result: { currentState: 'ON', success: true }, + description: 'System power state (currentState: ON/STANDBY/LIGHT_SLEEP/DEEP_SLEEP)', }, // ─────────────────────────────────────────────────────────────────────────── @@ -265,13 +265,13 @@ const mockResponses = { }, 'org.rdk.DisplaySettings.getVideoCodecInfo': { result: { - videocodecinfo: [{ - codec: 'H.265', - profile: 'Main', - level: '5.1' - }] + numberOfEntries: 2, + entries: [ + { profile: 'Main', level: 5.1 }, + { profile: 'Main10', level: 5.1 } + ] }, - description: 'Detailed video codec capabilities', + description: 'HEVC (MPEGH-Part2) codec profile/level capabilities', }, 'org.rdk.DisplaySettings.getSupportedSettopResolutions': { result: { supportedSettopResolutions: ['480p', '720p', '1080p', '2160p60'] }, From 4ae18d32b70a6d1ffda21ba4adb0ea57a0f72729 Mon Sep 17 00:00:00 2001 From: grandhi_santoshkumar Date: Mon, 10 Aug 2026 08:35:32 +0000 Subject: [PATCH 3/5] fix L1,L2,covert --- run_l2.sh | 10 ++++++++++ .../gtest/gtest_stbservice_thunder.cpp | 6 +++--- .../tests/helper_functions.py | 19 +++++++++++++++++++ .../tests/tr69hostif_stbservice_thunder.py | 17 ++++++++++------- .../native-platform/thunder-mock-server.js | 4 ++++ 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/run_l2.sh b/run_l2.sh index ad43b8da2..fb97f88c9 100644 --- a/run_l2.sh +++ b/run_l2.sh @@ -95,8 +95,18 @@ pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/webpa_ pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/custom.json test/functional-tests/tests/tr69hostif_custom.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/dhcpv4.json test/functional-tests/tests/tr69hostif_dhcpv4.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/moca.json test/functional-tests/tests/tr69hostif_moca.py + +# Start Thunder mock server for STBService tests +node test/test-artifacts/native-platform/thunder-mock-server.js & +THUNDER_MOCK_PID=$! +sleep 2 + pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/stbservice_thunder.json test/functional-tests/tests/tr69hostif_stbservice_thunder.py +# Stop Thunder mock server +kill $THUNDER_MOCK_PID 2>/dev/null || true +wait $THUNDER_MOCK_PID 2>/dev/null || true + pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/device_info.json test/functional-tests/tests/tr69hostif_device_info.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/interfacestack.json test/functional-tests/tests/tr69hostif_interfacestack.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/opsdevicemgmt_logging.json test/functional-tests/tests/tr69hostif_opsdevicemgmt_logging.py diff --git a/src/hostif/profiles/STBService/gtest/gtest_stbservice_thunder.cpp b/src/hostif/profiles/STBService/gtest/gtest_stbservice_thunder.cpp index 33d88e6e2..ec5467f98 100644 --- a/src/hostif/profiles/STBService/gtest/gtest_stbservice_thunder.cpp +++ b/src/hostif/profiles/STBService/gtest/gtest_stbservice_thunder.cpp @@ -80,7 +80,7 @@ namespace ThunderStub { #define THUNDER_DS_GET_CURRENT_RESOLUTION "org.rdk.DisplaySettings.getCurrentResolution" #define THUNDER_DS_GET_ENABLE_VIDEO_PORT "org.rdk.DisplaySettings.getEnableVideoPort" -#define THUNDER_AVO_GET_ZOOM_MODE "org.rdk.AVOutput.getZoomMode" +#define THUNDER_DS_GET_ZOOM_SETTINGS "org.rdk.DisplaySettings.getZoomSetting" #define THUNDER_HDCP_GET_STATUS "org.rdk.HdcpProfile.getHDCPStatus" #define THUNDER_DI_FRAMERATE "DisplayInfo.1.framerate" @@ -1270,7 +1270,7 @@ TEST_F(VideoOutputThunderTest, GetVideoFormat_ThunderFailure_FallsBackToUnknown) /* getAspectRatioBehaviour: Thunder returns zoom mode */ TEST_F(VideoOutputThunderTest, GetAspectRatioBehaviour_Success) { - ThunderStub::setString(THUNDER_AVO_GET_ZOOM_MODE, true, "FULL"); + ThunderStub::setString(THUNDER_DS_GET_ZOOM_SETTINGS, true, "FULL"); HOSTIF_MsgData_t msg = makeMsg(); int rc = m_iface->handleGetMsg("AspectRatioBehaviour", &msg); @@ -1283,7 +1283,7 @@ TEST_F(VideoOutputThunderTest, GetAspectRatioBehaviour_Success) /* getAspectRatioBehaviour: Thunder failure → falls back to "None", still OK */ TEST_F(VideoOutputThunderTest, GetAspectRatioBehaviour_ThunderFailure_FallsBackToNone) { - ThunderStub::setString(THUNDER_AVO_GET_ZOOM_MODE, false, ""); + ThunderStub::setString(THUNDER_DS_GET_ZOOM_SETTINGS, false, ""); HOSTIF_MsgData_t msg = makeMsg(); int rc = m_iface->handleGetMsg("AspectRatioBehaviour", &msg); diff --git a/test/functional-tests/tests/helper_functions.py b/test/functional-tests/tests/helper_functions.py index ae4bd41f1..d2189fc8b 100644 --- a/test/functional-tests/tests/helper_functions.py +++ b/test/functional-tests/tests/helper_functions.py @@ -75,6 +75,25 @@ def clear_persistant_files(): def rbus_get_data(param: str): return subprocess.run(RBUSCLI_GET_CMD + param, shell=True, capture_output=True).stdout.decode('utf-8') +def rbus_get_value(param: str): + """Extract just the value from RBUS output. + + RBUS output format: + Parameter 1: + Name : Device.Services.STBService.1.Param + Type : string + Value : ActualValue + + Returns just 'ActualValue' string. + """ + output = rbus_get_data(param) + for line in output.split('\n'): + if 'Value :' in line or 'Value:' in line: + # Extract everything after 'Value :' or 'Value:' + return line.split(':', 1)[1].strip() + # If no Value line found, return the full output stripped + return output.strip() + def rbus_set_data(param: str, type:str, value: str): return subprocess.run(f"{RBUSCLI_SET_CMD} {param} {type} {value}", shell=True, capture_output=True).stdout.decode('utf-8') diff --git a/test/functional-tests/tests/tr69hostif_stbservice_thunder.py b/test/functional-tests/tests/tr69hostif_stbservice_thunder.py index 04b0435e5..00fb69d41 100644 --- a/test/functional-tests/tests/tr69hostif_stbservice_thunder.py +++ b/test/functional-tests/tests/tr69hostif_stbservice_thunder.py @@ -248,8 +248,9 @@ def test_STBService_DisplayDevice_Get_Status(): assert RBUS_EXCEPTION_STRING not in rstdout, \ f"rbus exception getting {param}" assert CURL_OK_MSG in grep_tr69hostiflogs(CURL_OK_MSG) - assert rstdout.strip() in ("Present", "Absent"), \ - f"Unexpected DisplayDevice Status: {rstdout}" + value = rbus_get_value(param) + assert value in ("Present", "Absent"), \ + f"Unexpected DisplayDevice Status: {value}" @pytest.mark.run(order=324) @@ -366,8 +367,9 @@ def test_STBService_AudioOutput_Get_AudioLevel(): f"rbus exception getting {param}" assert CURL_OK_MSG in grep_tr69hostiflogs(CURL_OK_MSG) # AudioLevel is a numeric volume level (0-100) - assert rstdout.strip().isdigit() or rstdout.strip().lstrip('-').isdigit(), \ - f"Expected numeric AudioLevel, got: {rstdout}" + value = rbus_get_value(param) + assert value.isdigit() or value.lstrip('-').isdigit(), \ + f"Expected numeric AudioLevel, got: {value}" @pytest.mark.run(order=332) @@ -500,7 +502,7 @@ def test_STBService_VideoOutput_Get_VideoFormat(): @pytest.mark.run(order=340) def test_STBService_VideoOutput_Get_AspectRatioBehaviour(): """ - GET VideoOutput.1.AspectRatioBehaviour – backed by AVOutput.getZoomMode; + GET VideoOutput.1.AspectRatioBehaviour – backed by DisplaySettings.getZoomSetting; falls back to "None" if Thunder fails. """ param = VIDOUT_BASE + ".AspectRatioBehaviour" @@ -604,10 +606,11 @@ def test_STBService_Capabilities_Get_HEVCProfileEntries(): f"rbus exception getting {param}" assert CURL_OK_MSG in grep_tr69hostiflogs(CURL_OK_MSG) # Value should be a positive integer + value = rbus_get_value(param) try: - assert int(rstdout.strip()) >= 1 + assert int(value) >= 1 except ValueError: - assert False, f"Expected integer, got: {rstdout}" + assert False, f"Expected integer, got: {value}" @pytest.mark.run(order=347) diff --git a/test/test-artifacts/native-platform/thunder-mock-server.js b/test/test-artifacts/native-platform/thunder-mock-server.js index 5c65bf935..fe0fa7a8c 100644 --- a/test/test-artifacts/native-platform/thunder-mock-server.js +++ b/test/test-artifacts/native-platform/thunder-mock-server.js @@ -219,6 +219,10 @@ const mockResponses = { result: { EDID: 'AP///////wBQrDYBAAAAAAwXAQSlOSJ4CvCVoVdTnCYPUFQAAAABAQEBAQEBAQEBAQEBAQEB3iGgcFCEHzAgOCUIAClHAAAeAAAA/QAyTBFEH4AgIAkQCQAKAAAA/ABERUxMCgAgAAAAAD9BUzEzMgogICAgAAAAAEE=' }, description: 'EDID data from connected display', }, + 'org.rdk.DisplaySettings.getZoomSetting': { + result: { zoomSetting: 'Full' }, + description: 'Current zoom/aspect ratio setting (Full, None, etc.)', + }, // ─────────────────────────────────────────────────────────────────────────── // STBService Thunder APIs - DisplayInfo From d63c2b5115b9f3d931065c78c05f357091ebbd72 Mon Sep 17 00:00:00 2001 From: grandhi_santoshkumar Date: Mon, 10 Aug 2026 09:58:44 +0000 Subject: [PATCH 4/5] fix thunder mock server issue --- run_l2.sh | 15 ++++- verify_thunder_mock_setup.sh | 122 +++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 2 deletions(-) create mode 100755 verify_thunder_mock_setup.sh diff --git a/run_l2.sh b/run_l2.sh index fb97f88c9..0807828d0 100644 --- a/run_l2.sh +++ b/run_l2.sh @@ -97,13 +97,24 @@ pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/dhcpv4 pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/moca.json test/functional-tests/tests/tr69hostif_moca.py # Start Thunder mock server for STBService tests -node test/test-artifacts/native-platform/thunder-mock-server.js & +echo "[L2] Starting Thunder mock server on port 9998..." +cd $top_srcdir +node test/test-artifacts/native-platform/thunder-mock-server.js > /tmp/thunder-mock-server.log 2>&1 & THUNDER_MOCK_PID=$! -sleep 2 +sleep 3 + +# Verify server is running +if kill -0 $THUNDER_MOCK_PID 2>/dev/null; then + echo "[L2] Thunder mock server started (PID: $THUNDER_MOCK_PID)" +else + echo "[L2] ERROR: Thunder mock server failed to start" + cat /tmp/thunder-mock-server.log +fi pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/stbservice_thunder.json test/functional-tests/tests/tr69hostif_stbservice_thunder.py # Stop Thunder mock server +echo "[L2] Stopping Thunder mock server..." kill $THUNDER_MOCK_PID 2>/dev/null || true wait $THUNDER_MOCK_PID 2>/dev/null || true diff --git a/verify_thunder_mock_setup.sh b/verify_thunder_mock_setup.sh new file mode 100755 index 000000000..6a6de0cd8 --- /dev/null +++ b/verify_thunder_mock_setup.sh @@ -0,0 +1,122 @@ +#!/bin/bash +############################################################################## +# Thunder Mock Server Test - Verify L2 test infrastructure is working +############################################################################## + +set -e + +cd "$(dirname "$0")" + +echo "=========================================" +echo " Thunder Mock Server Infrastructure Test" +echo "=========================================" +echo + +# 1. Check Node.js +echo "[1/6] Checking Node.js installation..." +if ! command -v node &> /dev/null; then + echo " ✗ FAIL: Node.js not found in PATH" + exit 1 +fi +NODE_VERSION=$(node --version) +echo " ✓ Node.js installed: $NODE_VERSION" +echo + +# 2. Check mock server file +echo "[2/6] Checking thunder-mock-server.js..." +MOCK_SERVER="test/test-artifacts/native-platform/thunder-mock-server.js" +if [ ! -f "$MOCK_SERVER" ]; then + echo " ✗ FAIL: Mock server file not found: $MOCK_SERVER" + exit 1 +fi +echo " ✓ Mock server file exists" +echo + +# 3. Check helper_functions.py has rbus_get_value +echo "[3/6] Checking helper_functions.py..." +HELPER_FILE="test/functional-tests/tests/helper_functions.py" +if ! grep -q "def rbus_get_value" "$HELPER_FILE"; then + echo " ✗ FAIL: rbus_get_value() function not found in $HELPER_FILE" + exit 1 +fi +echo " ✓ rbus_get_value() function exists" +echo + +# 4. Check run_l2.sh has Thunder mock server startup +echo "[4/6] Checking run_l2.sh..." +if ! grep -q "thunder-mock-server.js" "run_l2.sh"; then + echo " ✗ FAIL: Thunder mock server startup not found in run_l2.sh" + exit 1 +fi +echo " ✓ Thunder mock server startup configured" +echo + +# 5. Start mock server and test connectivity +echo "[5/6] Testing Thunder mock server connectivity..." +pkill -f thunder-mock-server || true +sleep 1 + +node "$MOCK_SERVER" > /tmp/thunder-mock-verify.log 2>&1 & +MOCK_PID=$! +sleep 3 + +if ! kill -0 $MOCK_PID 2>/dev/null; then + echo " ✗ FAIL: Mock server failed to start" + echo " Log contents:" + cat /tmp/thunder-mock-verify.log + exit 1 +fi + +# Test API call +RESPONSE=$(curl -s -H 'content-type:text/plain;' \ + --data-binary '{"jsonrpc": "2.0", "id": 1, "method": "DisplayInfo.1.connected"}' \ + http://127.0.0.1:9998/jsonrpc) + +if [[ "$RESPONSE" != *'"result":true'* ]]; then + echo " ✗ FAIL: Unexpected response from mock server" + echo " Response: $RESPONSE" + kill $MOCK_PID 2>/dev/null || true + exit 1 +fi + +echo " ✓ Mock server responding correctly" +echo " Response: $RESPONSE" + +# Cleanup +kill $MOCK_PID 2>/dev/null || true +wait $MOCK_PID 2>/dev/null || true +echo + +# 6. Check test file has correct imports +echo "[6/6] Checking tr69hostif_stbservice_thunder.py..." +TEST_FILE="test/functional-tests/tests/tr69hostif_stbservice_thunder.py" +if ! grep -q "from helper_functions import" "$TEST_FILE"; then + echo " ✗ FAIL: helper_functions import not found in $TEST_FILE" + exit 1 +fi + +# Check if any test uses rbus_get_value +if ! grep -q "rbus_get_value" "$TEST_FILE"; then + echo " ⚠ WARNING: No tests use rbus_get_value() yet" +else + echo " ✓ Tests use rbus_get_value()" +fi +echo + +echo "=========================================" +echo " ✓ ALL CHECKS PASSED" +echo "=========================================" +echo +echo "Infrastructure is ready for L2 tests." +echo +echo "To run STBService L2 tests manually:" +echo " 1. cd $PWD" +echo " 2. node test/test-artifacts/native-platform/thunder-mock-server.js &" +echo " 3. sleep 2" +echo " 4. pytest test/functional-tests/tests/tr69hostif_stbservice_thunder.py" +echo " 5. kill %1" +echo +echo "To run full L2 suite:" +echo " ./run_l2.sh" +echo + From 061b13a8dfceccce3a53e53f31b2b9165081f060 Mon Sep 17 00:00:00 2001 From: grandhi_santoshkumar Date: Mon, 10 Aug 2026 10:47:43 +0000 Subject: [PATCH 5/5] fix failed L2 issue --- run_l2.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/run_l2.sh b/run_l2.sh index 0807828d0..b3e370f36 100644 --- a/run_l2.sh +++ b/run_l2.sh @@ -96,6 +96,11 @@ pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/custom pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/dhcpv4.json test/functional-tests/tests/tr69hostif_dhcpv4.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/moca.json test/functional-tests/tests/tr69hostif_moca.py +# Clean up any stale Thunder mock server from previous runs +echo "[L2] Cleaning up stale Thunder mock servers..." +pkill -f "thunder-mock-server.js" 2>/dev/null || true +sleep 1 + # Start Thunder mock server for STBService tests echo "[L2] Starting Thunder mock server on port 9998..." cd $top_srcdir @@ -117,6 +122,9 @@ pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/stbser echo "[L2] Stopping Thunder mock server..." kill $THUNDER_MOCK_PID 2>/dev/null || true wait $THUNDER_MOCK_PID 2>/dev/null || true +# Ensure ALL Thunder mock servers are terminated (in case of zombie processes) +pkill -f "thunder-mock-server.js" 2>/dev/null || true +sleep 1 pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/device_info.json test/functional-tests/tests/tr69hostif_device_info.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/interfacestack.json test/functional-tests/tests/tr69hostif_interfacestack.py