mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Fix setting empty parameterkey
This commit is contained in:
parent
2f9b0ea9fa
commit
601708dd0a
7 changed files with 41 additions and 10 deletions
|
|
@ -719,7 +719,7 @@ int set_uci_path_value(const char *conf_dir, char *path, char *value)
|
|||
int ret = -1;
|
||||
char str[BUF_SIZE_256] = {0};
|
||||
|
||||
if ((CWMP_STRLEN(path) == 0) || (CWMP_STRLEN(value) == 0)) {
|
||||
if ((CWMP_STRLEN(path) == 0) || (value == NULL)) {
|
||||
CWMP_LOG(ERROR, "Invalid input options");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,14 @@ static void cwmp_uci_add_tests(void **state)
|
|||
assert_int_equal(error, UCI_OK);
|
||||
assert_string_equal(value, "abc");
|
||||
|
||||
error = set_uci_path_value(NULL, "cwmp.new_acs.test", "");
|
||||
assert_int_equal(error, UCI_OK);
|
||||
|
||||
memset(value, 0, BUF_SIZE_256);
|
||||
error = get_uci_path_value(NULL, "cwmp.new_acs.test", value, BUF_SIZE_256);
|
||||
assert_int_equal(error, UCI_ERR_NOTFOUND);
|
||||
assert_string_equal(value, "");
|
||||
|
||||
error = set_uci_path_value(NULL, "cwmp.new_acs", "acs");
|
||||
assert_int_equal(error, UCI_OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ echo "Running: $TEST_NAME"
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "addObject","objectName":"Device.SSH.Server"}' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 2
|
||||
|
||||
wait_for_session_end
|
||||
|
||||
check_session "AddObject"
|
||||
obj_instance=$(print_tag_value "cwmp:AddObjectResponse" "InstanceNumber")
|
||||
status=$(print_tag_value "cwmp:AddObjectResponse" "Status")
|
||||
|
|
@ -22,7 +24,9 @@ fi
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.2"] }' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 3
|
||||
|
||||
wait_for_session_end
|
||||
|
||||
check_session "GetParameterValues"
|
||||
|
||||
echo "PASS: $TEST_NAME"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ echo "Running: $TEST_NAME"
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "deleteObject","objectName":"Device.SSH.Server.2"}' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 2
|
||||
wait_for_session_end
|
||||
check_session "DeleteObject"
|
||||
status=$(print_tag_value "cwmp:DeleteObjectResponse" "Status")
|
||||
if [ "$status" != "1" ]; then
|
||||
|
|
@ -21,7 +21,7 @@ fi
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server"] }' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 3
|
||||
wait_for_session_end
|
||||
check_session "GetParameterValues"
|
||||
if grep -q "Device.SSH.Server.2" "$icwmp_log_file"; then
|
||||
echo "Error: 'Device.SSH.Server.2' object is not really deleted" >> ./funl-test-debug.log
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ echo "Running: $TEST_NAME"
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.1.Alias"] }' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 2
|
||||
wait_for_session_end
|
||||
check_session "GetParameterValues"
|
||||
param_value=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:string\"")
|
||||
if [ "$param_value" != "cpe-1" ]; then
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ echo "Running: $TEST_NAME"
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.1.Enable"] }' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 2
|
||||
wait_for_session_end
|
||||
check_session "GetParameterValues"
|
||||
param_value_before=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:boolean\"")
|
||||
if [ "$param_value_before" != "1" ]; then
|
||||
|
|
@ -21,7 +21,7 @@ fi
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["Device.SSH.Server.1.Enable",false]]}' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 2
|
||||
wait_for_session_end
|
||||
check_session "SetParameterValues"
|
||||
get_status=$(print_tag_value "cwmp:SetParameterValuesResponse" "Status")
|
||||
if [ "$get_status" != "1" ]; then
|
||||
|
|
@ -32,7 +32,7 @@ fi
|
|||
remove_icwmp_log
|
||||
curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.1.Enable"] }' >/dev/null 2>&1
|
||||
check_ret $?
|
||||
sleep 2
|
||||
wait_for_session_end
|
||||
check_session "GetParameterValues"
|
||||
param_value_after=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:boolean\"")
|
||||
if [ "$param_value_after" != "0" ]; then
|
||||
|
|
@ -41,6 +41,6 @@ if [ "$param_value_after" != "0" ]; then
|
|||
fi
|
||||
|
||||
curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["Device.SSH.Server.1.Enable",true]]}' >/dev/null 2>&1
|
||||
sleep 2
|
||||
wait_for_session_end
|
||||
|
||||
echo "PASS: $TEST_NAME"
|
||||
|
|
|
|||
|
|
@ -72,3 +72,22 @@ function print_tag_value()
|
|||
tag_value=`grep -oPm1 "(?<=<$tag>)[^<]+" <<< "$xml_data"`
|
||||
echo $tag_value
|
||||
}
|
||||
|
||||
function wait_for_session_end()
|
||||
{
|
||||
count=5
|
||||
|
||||
while [ $count -gt 0 ];
|
||||
do
|
||||
res="$(ubus -t 1 call tr069 status)"
|
||||
ret="$?"
|
||||
if [ "${ret}" = "7" ] || [ -z "${res}" ]; then
|
||||
# ubus timeout, may be busy in session
|
||||
count=`expr $count - 1`
|
||||
sleep 1
|
||||
continue
|
||||
fi
|
||||
|
||||
break;
|
||||
done
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue