icwmp/test/script/03_verify_set_method.sh
Vivek Kumar Dutta 29ec93d024
Fix ci pipeline
2026-01-05 14:56:27 +05:30

47 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
source ./test/script/common.sh
source ./gitlab-ci/shared.sh
TEST_NAME="SET RPC Method"
PARAM="Device.Schedules.Schedule.1.Enable"
echo "Running: $TEST_NAME"
remove_icwmp_log
curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["'${PARAM}'"] }' >/dev/null 2>&1
check_ret $?
wait_for_session_end
check_session "GetParameterValues"
param_value_before=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:boolean\"")
if [ "$param_value_before" != "0" ]; then
echo "Error: Default value of [${PARAM}] is wrong, current_value($param_value_before) expected_value(1)" >> ./funl-test-debug.log
exit 1
fi
remove_icwmp_log
curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["'${PARAM}'",true]]}' >/dev/null 2>&1
check_ret $?
wait_for_session_end
check_session "SetParameterValues"
get_status=$(print_tag_value "cwmp:SetParameterValuesResponse" "Status")
if [ "$get_status" != "0" ]; then
echo "Error: Set Value doesn't work correctly" >> ./funl-test-debug.log
exit 1
fi
remove_icwmp_log
curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["'${PARAM}'"] }' >/dev/null 2>&1
check_ret $?
wait_for_session_end
check_session "GetParameterValues"
param_value_after=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:boolean\"")
if [ "$param_value_after" != "1" ]; then
echo "Error: the value of [${PARAM}] is wrong, current_value($param_value_after) expected_value(0)" >> ./funl-test-debug.log
exit 1
fi
curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["'${PARAM}'",false]]}' >/dev/null 2>&1
wait_for_session_end
echo "PASS: $TEST_NAME"