Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions run_l2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions run_l2_reboot_trigger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


45 changes: 45 additions & 0 deletions test/functional-tests/features/rfc_factory_reset.feature
Original file line number Diff line number Diff line change
@@ -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");

Check failure on line 7 in test/functional-tests/features/rfc_factory_reset.feature

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'test/functional-tests/features/rfc_factory_reset.feature' (Match: tink-crypto/tink/1.0.0, 11 lines, url: https://github.com/tink-crypto/tink/archive/refs/tags/v1.0.0.tar.gz, file: kokoro/macos_external/presubmit.sh)

Check failure on line 7 in test/functional-tests/features/rfc_factory_reset.feature

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'test/functional-tests/features/rfc_factory_reset.feature' (Match: tink-crypto/tink/1.0.0, 11 lines, url: https://github.com/tink-crypto/tink/archive/refs/tags/v1.0.0.tar.gz, file: kokoro/macos_external/presubmit.sh)
# 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"

75 changes: 75 additions & 0 deletions test/functional-tests/tests/test_rfc_factory_reset.py
Original file line number Diff line number Diff line change
@@ -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");

Check failure on line 7 in test/functional-tests/tests/test_rfc_factory_reset.py

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'test/functional-tests/tests/test_rfc_factory_reset.py' (Match: tink-crypto/tink/1.0.0, 11 lines, url: https://github.com/tink-crypto/tink/archive/refs/tags/v1.0.0.tar.gz, file: kokoro/macos_external/presubmit.sh)

Check failure on line 7 in test/functional-tests/tests/test_rfc_factory_reset.py

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'test/functional-tests/tests/test_rfc_factory_reset.py' (Match: tink-crypto/tink/1.0.0, 11 lines, url: https://github.com/tink-crypto/tink/archive/refs/tags/v1.0.0.tar.gz, file: kokoro/macos_external/presubmit.sh)
# 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'

2 changes: 0 additions & 2 deletions test/functional-tests/tests/test_rfc_trigger_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion test/test-artifacts/mockxconf/xconf-rfc-response.json
Original file line number Diff line number Diff line change
@@ -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"}]}}
Loading