From 64286600390a4414eb00d61b6a6a769ed315d335 Mon Sep 17 00:00:00 2001 From: mtirum011 Date: Thu, 8 Jan 2026 08:47:55 +0000 Subject: [PATCH] RDKEMW-12201 Bring RDKEMW-12167 to Develop --- run_l2.sh | 6 +- run_l2_reboot_trigger.sh | 5 -- .../features/rfc_factory_reset.feature | 45 +++++++++++ .../tests/test_rfc_factory_reset.py | 75 +++++++++++++++++++ .../tests/test_rfc_trigger_reboot.py | 2 - .../mockxconf/xconf-rfc-response.json | 2 +- 6 files changed, 123 insertions(+), 12 deletions(-) create mode 100644 test/functional-tests/features/rfc_factory_reset.feature create mode 100644 test/functional-tests/tests/test_rfc_factory_reset.py diff --git a/run_l2.sh b/run_l2.sh index d2d24633..96a9484b 100644 --- a/run_l2.sh +++ b/run_l2.sh @@ -52,11 +52,9 @@ pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_xc pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_valid_accountid.json test/functional-tests/tests/test_rfc_valid_accountid.py -pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_trigger_reboot_unknown_accountid.json test/functional-tests/tests/test_rfc_trigger_reboot.py - -cat /opt/logs/rfcscript.txt.1 +pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_factory_reset.json test/functional-tests/tests/test_rfc_factory_reset.py -cat /opt/logs/rfcscript.txt.0 +pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_trigger_reboot_unknown_accountid.json test/functional-tests/tests/test_rfc_trigger_reboot.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_feature_enable.json test/functional-tests/tests/test_rfc_feature_enable.py diff --git a/run_l2_reboot_trigger.sh b/run_l2_reboot_trigger.sh index e56c08cf..b79aa819 100644 --- a/run_l2_reboot_trigger.sh +++ b/run_l2_reboot_trigger.sh @@ -27,8 +27,3 @@ rm -rf /opt/rfc.properties # Run L2 Test cases pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rfc_unknown_accountid.json test/functional-tests/tests/test_rfc_unknown_accountid.py -cat /opt/logs/rfcscript.txt.1 - -cat /opt/logs/rfcscript.txt.0 - - diff --git a/test/functional-tests/features/rfc_factory_reset.feature b/test/functional-tests/features/rfc_factory_reset.feature new file mode 100644 index 00000000..4dce2792 --- /dev/null +++ b/test/functional-tests/features/rfc_factory_reset.feature @@ -0,0 +1,45 @@ +#################################################################################### +# If not stated otherwise in this file or this component's Licenses file the +# following copyright and licenses apply: +# +# Copyright 2024 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#################################################################################### + +Feature: RFC Manager Configuration Management + + Scenario: Validate RFC manager rejects empty parameter values from Xconf + Given the mockxconf server is running + When a RFC curl request is made to "https://mockxconf:50053/featureControl/getSettings?" with: + | method | GET | + | query | estbMacAddress=01%3A23%3A45%3A67%3A89%3Aab&firmwareVersion=T2_Container_0.0.0&env=prod&model=L2CNTR&manufacturer=&controllerId=2504&channelMapId=2345&VodId=15660&partnerId=global&osClass=&accountId=Unknown&Experience=X1&version=2 | + Then the mockxconf server should have received a request to ""https://mockxconf:50053/featureControl/getSettings?" + And the request method should be "GET" + And the response from the xconf server and the PartnerProductName value should be empty + | PartnerProductName | "" | + And the RFC manager should reject the configuration + And a message "EMPTY value for Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerProductName is rejected" should be logged + + Scenario: Successfully retrieve PartnerName value and verify via tr181 + Given the mockxconf server is running + When a RFC curl request is made to "https://mockxconf:50053/featureControl/getSettings?" with: + | method | GET | + | query | estbMacAddress=01%3A23%3A45%3A67%3A89%3Aab&firmwareVersion=T2_Container_0.0.0&env=prod&model=L2CNTR&manufacturer=&controllerId=2504&channelMapId=2345&VodId=15660&partnerId=global&osClass=&accountId=Unknown&Experience=X1&version=2 | + Then the mockxconf server should have received a request to ""https://mockxconf:50053/featureControl/getSettings?" + And the request method should be "GET" + And the response from the xconf server and the PartnerName value should be TestPartner + | PartnerName | TestPartner | + When I run "tr181 -d -g Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerName" + Then the output should be "TestPartner" + diff --git a/test/functional-tests/tests/test_rfc_factory_reset.py b/test/functional-tests/tests/test_rfc_factory_reset.py new file mode 100644 index 00000000..9ae13303 --- /dev/null +++ b/test/functional-tests/tests/test_rfc_factory_reset.py @@ -0,0 +1,75 @@ +#################################################################################### +# If not stated otherwise in this file or this component's Licenses file the +# following copyright and licenses apply: +# +# Copyright 2024 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#################################################################################### + +import os +from rfc_test_helper import * + + +def test_rfcmanager_rejects_empty_value(): + """ + Test the communication between RFC Manager and XCONF. + + This function checks the creation of the TR181 INI file, + verifies the firmware version update, and checks the key-value pair in the TR181 INI file. + """ + if os.path.exists(TR181_INI_FILE): + os.remove(TR181_INI_FILE) + + if os.path.exists(RFC_OLD_FW_FILE): + rename_file(RFC_OLD_FW_FILE, RFC_OLD_FW_FILE + "_bak") + + try: + rfc_run_binary() + XCONF_RESP_MSG_STATUS = f"EMPTY value for Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerProductName is rejected" + + assert grep_log_file(RFC_LOG_FILE, XCONF_RESP_MSG_STATUS), f"Expected '{XCONF_RESP_MSG_STATUS}' in log file." + except Exception as e: + print(f"Exception during Validate the XConf request and response: {e}") + assert False, f"Exception during Validate the XConf request and response: {e}" + +def test_set_empty_value(): + command_to_check = 'tr181 -d -s -t string -v "" Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerName' + result = run_shell_command(command_to_check) + assert "Set operation success" in result, '"Set operation success" not found in the output' + + +def test_rfc_partnername_value(): + """ + Test the communication between RFC Manager and XCONF. + + This function checks the creation of the TR181 INI file, + verifies the firmware version update, and checks the key-value pair in the TR181 INI file. + """ + if os.path.exists(TR181_INI_FILE): + os.remove(TR181_INI_FILE) + + if os.path.exists(RFC_OLD_FW_FILE): + rename_file(RFC_OLD_FW_FILE, RFC_OLD_FW_FILE + "_bak") + + try: + rfc_run_binary() + except Exception as e: + print(f"Exception during Validate the XConf request and response: {e}") + assert False, f"Exception during Validate the XConf request and response: {e}" + +def test_xconf_partnername_value(): + command_to_check = "tr181 -d -g Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerName" + result = run_shell_command(command_to_check) + assert "TestPartner" in result, '"TestPartner" not found in the output' + diff --git a/test/functional-tests/tests/test_rfc_trigger_reboot.py b/test/functional-tests/tests/test_rfc_trigger_reboot.py index 75d7953e..56e74b0f 100644 --- a/test/functional-tests/tests/test_rfc_trigger_reboot.py +++ b/test/functional-tests/tests/test_rfc_trigger_reboot.py @@ -36,14 +36,12 @@ def test_xconf_request_response(): try: rfc_run_binary() RFC_PARAM = f"Checking Config Value changed for tr181 param" - EMPTY_VALUE = f"EMPTY value for Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID is rejected" XCONF_RESP_ACTID_UNKNOWN_MSG = f"RFC: Checking AccountId received from Xconf is Unknown" XCONF_RESP_ACTID_VALID_MSG = f"AccountId is Valid 3064488088886635972, Updating the device Database" XCONF_RESP_CMP_MSG = f"RFC: Comparing Xconfvalue='3064488088886635972' with Unknown" assert grep_log_file(RFC_LOG_FILE, RFC_PARAM), f"Expected '{RFC_PARAM}' in log file." - assert grep_log_file(RFC_LOG_FILE, EMPTY_VALUE), f"Expected '{EMPTY_VALUE}' in log file." assert grep_log_file(RFC_LOG_FILE, XCONF_RESP_ACTID_UNKNOWN_MSG), f"Expected '{XCONF_RESP_ACTID_UNKNOWN_MSG}' in log file." assert grep_log_file(RFC_LOG_FILE, XCONF_RESP_ACTID_VALID_MSG), f"Expected '{XCONF_RESP_ACTID_VALID_MSG}' in log file." assert grep_log_file(RFC_LOG_FILE, XCONF_RESP_CMP_MSG), f"Expected '{XCONF_RESP_CMP_MSG}' in log file." diff --git a/test/test-artifacts/mockxconf/xconf-rfc-response.json b/test/test-artifacts/mockxconf/xconf-rfc-response.json index f82fedea..45e57671 100644 --- a/test/test-artifacts/mockxconf/xconf-rfc-response.json +++ b/test/test-artifacts/mockxconf/xconf-rfc-response.json @@ -1 +1 @@ -{"featureControl":{"configset-id":"090909","configset-label":"default","features":[{"name":"LSA","effectiveImmediate":"false","enable":"true","configData":{"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.OsClass":"default"},"featureInstance":"OsClass"},{"name":"AccountId","enable":true,"effectiveImmediate":true,"configData":{"tr181.Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID":"3064488088886635972"},"featureInstance":"AccountId"}]}} +{"featureControl":{"configset-id":"090909","configset-label":"default","features":[{"name":"LSA","effectiveImmediate":"false","enable":"true","configData":{"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.OsClass":"default"},"featureInstance":"OsClass"},{"name":"AccountId","enable":true,"effectiveImmediate":true,"configData":{"tr181.Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID":"3064488088886635972"},"featureInstance":"AccountId"},{"name":"PartnerProductName","enable":true,"effectiveImmediate":true,"configData":{"tr181.Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerProductName":""},"featureInstance":"PartnerProductName"},{"name":"PartnerName","enable":true,"effectiveImmediate":true,"configData":{"tr181.Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerName":"TestPartner"},"featureInstance":"PartnerName"}]}}