From caa4ac86b91b698e73e09a3ba8b60add36ea4b62 Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Thu, 1 Jun 2023 08:56:39 +0000 Subject: [PATCH] Rename var sate UCI file cwmp runtime configuration present in /var/state/ directory, with uci/libuci -c option commit changes(including standard uci) to runtime path, this change to segregate the standard uci changes flow with run time config changes. --- docs/guide/annex_f.md | 4 +-- docs/guide/notification.md | 4 +-- .../udhcpc.user.d/udhcpc_icwmp_opt125.user | 16 +++++------ src/common.c | 8 +++--- src/common.h | 2 +- src/cwmp.c | 12 ++++----- src/cwmp_dm/datamodel.c | 10 +++---- src/cwmp_http.c | 4 +-- src/http.c | 4 +-- src/session.c | 10 +++---- test/cmocka/icwmp_uci_unit_test.c | 27 ++++++++++--------- .../icwmpd/custom_notification_forced.json | 4 +-- .../custom_notification_invalid_json.json | 4 +-- ...custom_notification_invalid_parameter.json | 4 +-- .../etc/icwmpd/custom_notification_valid.json | 4 +-- test/files/var/state/{cwmp => icwmp} | 0 test/script/00_verify_add_method.sh | 4 +-- test/script/01_verify_delete_method.sh | 8 +++--- test/script/02_verify_get_method.sh | 6 ++--- test/script/03_verify_set_method.sh | 11 +++++--- test/script/verify_custom_notifications.sh | 22 +++++++-------- 21 files changed, 86 insertions(+), 82 deletions(-) rename test/files/var/state/{cwmp => icwmp} (100%) diff --git a/docs/guide/annex_f.md b/docs/guide/annex_f.md index b6c8ef2..66f0943 100644 --- a/docs/guide/annex_f.md +++ b/docs/guide/annex_f.md @@ -61,6 +61,6 @@ root@iopsys-44d43771b000:~# ifstatus wan ``` ICWMPD package adds a [DHCP client hook script](https://dev.iopsys.eu/iopsys/icwmp/-/blob/devel/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user), which parses DHCP option 125 to extract gateway identity based on Enterprise ID `3561`. -This script then writes the gateway identity in `/var/state/cwmp` if CWMP is enabled in the device. +This script then writes the gateway identity in `/var/state/icwmp` if CWMP is enabled in the device. -Datamodel (libbbf) API's reads the gateway information from `/var/state/cwmp` to populate Device.GatewayInfo. object. If gateway information is not available in `/var/state/cwmp` then it reads the 'db' (Same source used for Device.DeviceInfo. object) and maps that data to populate Device.GatewayInfo. object. +Datamodel (libbbf) API's reads the gateway information from `/var/state/icwmp` to populate Device.GatewayInfo. object. If gateway information is not available in `/var/state/icwmp` then it reads the 'db' (Same source used for Device.DeviceInfo. object) and maps that data to populate Device.GatewayInfo. object. diff --git a/docs/guide/notification.md b/docs/guide/notification.md index 7568404..caa880c 100644 --- a/docs/guide/notification.md +++ b/docs/guide/notification.md @@ -18,10 +18,10 @@ As per the cwmp inform requirements, cwmp client has list of parameters defined In addition to the above defined forced inform parameters as specified in datamodel standard, TR-181 datamodel defines the multi instance object Device.ManagementServer.InformParameter.{i}. So new inform parameter can be added through the ACS by the call of the RPC method AddObject for the object Device.ManagementServer.InformParameter.{i}. and then set its parameters values. -icwmpd defines those new inform parameters in uci sections under the package /var/state/cwmp as below: +icwmpd defines those new inform parameters in uci sections under the package /var/state/icwmp as below: ```bash -root@iopsys-44d43771aff0:~# cat /var/state/cwmp +root@iopsys-44d43771aff0:~# cat /var/state/icwmp config inform_parameter option enable '1' diff --git a/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user b/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user index 45ca28c..4fb842c 100644 --- a/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user +++ b/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user @@ -119,15 +119,15 @@ if [ "${wan_intf}" == "${INTERFACE}" ]; then fi mkdir -p /var/state - touch /var/state/cwmp - sec=$(uci -q -c /var/state get cwmp.gatewayinfo) + touch /var/state/icwmp + sec=$(uci -q -c /var/state get icwmp.gatewayinfo) if [ -z "${sec}" ]; then - sec=$(uci -q -c /var/state add cwmp gatewayinfo) - uci -q -c /var/state rename cwmp."${sec}"="gatewayinfo" + sec=$(uci -q -c /var/state add icwmp gatewayinfo) + uci -q -c /var/state rename icwmp."${sec}"="gatewayinfo" fi - uci -q -c /var/state set cwmp.gatewayinfo.class="$CLASS" - uci -q -c /var/state set cwmp.gatewayinfo.oui="$OUI" - uci -q -c /var/state set cwmp.gatewayinfo.serial="$SERIAL" - uci -q -c /var/state commit cwmp + uci -q -c /var/state set icwmp.gatewayinfo.class="$CLASS" + uci -q -c /var/state set icwmp.gatewayinfo.oui="$OUI" + uci -q -c /var/state set icwmp.gatewayinfo.serial="$SERIAL" + uci -q -c /var/state commit icwmp fi diff --git a/src/common.c b/src/common.c index e9bc0a9..5939b31 100755 --- a/src/common.c +++ b/src/common.c @@ -306,8 +306,8 @@ void check_firewall_restart_state() g_firewall_restart = false; if (init == false) { // In case of timeout reset the firewall_restart flag CWMP_LOG(ERROR, "Firewall restart took longer than usual"); - cwmp_uci_set_varstate_value("cwmp", "cpe", "firewall_restart", "init"); - cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG); + cwmp_uci_set_varstate_value("icwmp", "cpe", "firewall_restart", "init"); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); } } @@ -640,8 +640,8 @@ void icwmp_restart_services() } if (g_firewall_restart) { CWMP_LOG(INFO, "Initiating Firewall restart"); - cwmp_uci_set_varstate_value("cwmp", "cpe", "firewall_restart", "in_progress"); - cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG); + cwmp_uci_set_varstate_value("icwmp", "cpe", "firewall_restart", "in_progress"); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); } icwmp_free_list_services(); } diff --git a/src/common.h b/src/common.h index dd9a601..b880781 100644 --- a/src/common.h +++ b/src/common.h @@ -64,7 +64,7 @@ #define DEFAULT_SESSION_TIMEOUT 60 #define MAX_NBRE_SERVICES 256 #define FIREWALL_CWMP "/etc/firewall.cwmp" -#define CWMP_VARSTATE_UCI_PACKAGE "/var/state/cwmp" +#define CWMP_VARSTATE_UCI_PACKAGE "/var/state/icwmp" #define DM_PPP_INTERFACE_PATH "Device\\.PPP\\.Interface\\." #define DM_IP_INTERFACE_PATH "Device\\.IP\\.Interface\\." #define DEFAULT_CR_TIMEOUT 5 /* In Seconds */ diff --git a/src/cwmp.c b/src/cwmp.c index 648f54d..493ae02 100644 --- a/src/cwmp.c +++ b/src/cwmp.c @@ -202,16 +202,16 @@ static void configure_var_state() { char *zone_name = NULL; - if (!file_exists(VARSTATE_CONFIG"/cwmp")) - creat(VARSTATE_CONFIG"/cwmp", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + if (!file_exists(VARSTATE_CONFIG"/icwmp")) + creat(VARSTATE_CONFIG"/icwmp", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - cwmp_uci_add_section_with_specific_name("cwmp", "acs", "acs", UCI_VARSTATE_CONFIG); - cwmp_uci_add_section_with_specific_name("cwmp", "cpe", "cpe", UCI_VARSTATE_CONFIG); + cwmp_uci_add_section_with_specific_name("icwmp", "acs", "acs", UCI_VARSTATE_CONFIG); + cwmp_uci_add_section_with_specific_name("icwmp", "cpe", "cpe", UCI_VARSTATE_CONFIG); get_firewall_zone_name_by_wan_iface(cwmp_main->conf.default_wan_iface, &zone_name); - cwmp_uci_set_varstate_value("cwmp", "acs", "zonename", zone_name ? zone_name : "wan"); + cwmp_uci_set_varstate_value("icwmp", "acs", "zonename", zone_name ? zone_name : "wan"); - cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); } static int cwmp_init(void) diff --git a/src/cwmp_dm/datamodel.c b/src/cwmp_dm/datamodel.c index 651158c..6a7f3ba 100644 --- a/src/cwmp_dm/datamodel.c +++ b/src/cwmp_dm/datamodel.c @@ -437,7 +437,7 @@ static void get_management_ip_port(char **listen_addr) dmuci_get_option_value_string("cwmp", "cpe", "default_wan_interface", &interface); dmuci_get_option_value_string("cwmp", "cpe", "port", &port); - dmuci_get_option_value_string_varstate("cwmp", "acs", "ip_version", &ip_version); + dmuci_get_option_value_string_varstate("icwmp", "acs", "ip_version", &ip_version); if (!DM_STRLEN(interface)) return; @@ -964,7 +964,7 @@ static int set_inform_parameter_enable(char *refparam, struct dmctx *ctx, void * return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section_varstate(inform_param_args->config_section, "enable", value); + dmuci_set_value_by_section(inform_param_args->config_section, "enable", value); return 0; } return 0; @@ -988,7 +988,7 @@ static int set_inform_parameter_alias(char *refparam, struct dmctx *ctx, void *d return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section_varstate(inform_param_args->config_section, "informparam_alias", value); + dmuci_set_value_by_section(inform_param_args->config_section, "informparam_alias", value); return 0; } return 0; @@ -1010,7 +1010,7 @@ static int set_inform_parameter_parameter_name(char *refparam, struct dmctx *ctx return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section_bbfdm(inform_param_args->config_section, "parameter_name", value); + dmuci_set_value_by_section(inform_param_args->config_section, "parameter_name", value); return 0; } return 0; @@ -1031,7 +1031,7 @@ static int set_inform_parameter_event_list(char *refparam, struct dmctx *ctx, vo return FAULT_9007; return 0; case VALUESET: - dmuci_set_value_by_section_bbfdm(inform_param_args->config_section, "events_list", value); + dmuci_set_value_by_section(inform_param_args->config_section, "events_list", value); return 0; } return 0; diff --git a/src/cwmp_http.c b/src/cwmp_http.c index 8e7dd6d..0e65e19 100644 --- a/src/cwmp_http.c +++ b/src/cwmp_http.c @@ -55,8 +55,8 @@ static void set_http_ip_resolve(long ip_resolve) { cwmp_main->net.ip_resolve = ip_resolve; - cwmp_uci_set_varstate_value("cwmp", "acs", "ip_version", (ip_resolve == CURL_IPRESOLVE_V6) ? "6" : "4"); - cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG); + cwmp_uci_set_varstate_value("icwmp", "acs", "ip_version", (ip_resolve == CURL_IPRESOLVE_V6) ? "6" : "4"); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); } int icwmp_check_http_connection(void) diff --git a/src/http.c b/src/http.c index 0d30b4c..3bd8e00 100644 --- a/src/http.c +++ b/src/http.c @@ -222,8 +222,8 @@ int icwmp_http_send_message(char *msg_out, int msg_out_len, char **msg_in) else tmp = inet_pton(AF_INET6, ip, buf); - cwmp_uci_set_varstate_value("cwmp", "acs", tmp ? "ip6" : "ip", ip_acs); - cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG); + cwmp_uci_set_varstate_value("icwmp", "acs", tmp ? "ip6" : "ip", ip_acs); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); // Trigger firewall to reload firewall.cwmp struct blob_buf b = { 0 }; diff --git a/src/session.c b/src/session.c index 87cc2ad..4033a08 100644 --- a/src/session.c +++ b/src/session.c @@ -254,10 +254,10 @@ static void set_cwmp_session_status_state(int status) { char *state = NULL; - if (!file_exists(VARSTATE_CONFIG"/cwmp")) - creat(VARSTATE_CONFIG"/cwmp", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + if (!file_exists(VARSTATE_CONFIG"/icwmp")) + creat(VARSTATE_CONFIG"/icwmp", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - cwmp_uci_add_section_with_specific_name("cwmp", "sess_status", "sess_status", UCI_VARSTATE_CONFIG); + cwmp_uci_add_section_with_specific_name("icwmp", "sess_status", "sess_status", UCI_VARSTATE_CONFIG); switch (status) { case SESSION_WAITING: @@ -274,9 +274,9 @@ static void set_cwmp_session_status_state(int status) break; } - cwmp_uci_set_varstate_value("cwmp", "sess_status", "current_status", state ? state : "N/A"); + cwmp_uci_set_varstate_value("icwmp", "sess_status", "current_status", state ? state : "N/A"); - cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); } void set_cwmp_session_status(int status, int retry_time) diff --git a/test/cmocka/icwmp_uci_unit_test.c b/test/cmocka/icwmp_uci_unit_test.c index 443c9e4..ff1d1bb 100644 --- a/test/cmocka/icwmp_uci_unit_test.c +++ b/test/cmocka/icwmp_uci_unit_test.c @@ -20,6 +20,7 @@ #include "cwmp_uci.h" #define UCI_WRONG_PATH "cwmp.wrong_section.wrong_option" +#define UCI_VAR_WRONG_PATH "icwmp.wrong_section.wrong_option" static struct uci_list *list = NULL; static int cwmp_uci_unit_tests_init(void **state) @@ -51,15 +52,15 @@ static void cwmp_uci_get_tests(void **state) assert_int_equal(error, UCI_ERR_NOTFOUND); assert_null(value); - error = uci_get_state_value(UCI_DHCP_ACS_URL, &value); + error = uci_get_state_value("icwmp.acs.dhcp_url", &value); assert_int_equal(error, UCI_OK); assert_string_equal(value, "http://192.168.103.160:8080/openacs/acs"); - error = uci_get_state_value(UCI_WRONG_PATH, &value); + error = uci_get_state_value(UCI_VAR_WRONG_PATH, &value); assert_int_equal(error, UCI_ERR_NOTFOUND); assert_null(value); - error = cwmp_uci_get_option_value_string("cwmp", "acs", "dhcp_url", UCI_VARSTATE_CONFIG, &value); + error = cwmp_uci_get_option_value_string("icwmp", "acs", "dhcp_url", UCI_VARSTATE_CONFIG, &value); assert_int_equal(error, UCI_OK); assert_string_equal(value, "http://192.168.103.160:8080/openacs/acs"); @@ -95,10 +96,10 @@ static void cwmp_uci_set_tests(void **state) assert_string_equal(value, "1"); value = NULL; - error = cwmp_uci_set_varstate_value("cwmp", "acs", "varstatopt", "varstatval"); + error = cwmp_uci_set_varstate_value("icwmp", "acs", "varstatopt", "varstatval"); assert_int_equal(error, UCI_OK); - cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG); - error = cwmp_uci_get_option_value_string("cwmp", "acs", "varstatopt", UCI_VARSTATE_CONFIG, &value); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); + error = cwmp_uci_get_option_value_string("icwmp", "acs", "varstatopt", UCI_VARSTATE_CONFIG, &value); assert_int_equal(error, UCI_OK); assert_string_equal(value, "varstatval"); value = NULL; @@ -106,7 +107,7 @@ static void cwmp_uci_set_tests(void **state) error = cwmp_uci_set_value("cwmp", "wrong_section", "wrong_option", "wrong_value"); assert_int_equal(error, UCI_ERR_NOTFOUND); cwmp_commit_package("cwmp", UCI_STANDARD_CONFIG); - error = cwmp_uci_get_option_value_string("cwmp", "wront_section", "wrong_option", UCI_VARSTATE_CONFIG, &value); + error = cwmp_uci_get_option_value_string("icwmp", "wrong_section", "wrong_option", UCI_VARSTATE_CONFIG, &value); assert_int_equal(error, UCI_ERR_NOTFOUND); assert_null(value); value = NULL; @@ -118,9 +119,9 @@ static void cwmp_uci_set_tests(void **state) assert_string_equal(value, "usertest"); value = NULL; - cwmp_uci_set_varstate_value_by_path("cwmp.acs.opt1", "varstatval1"); - cwmp_commit_package("cwmp", UCI_STANDARD_CONFIG); - error = cwmp_uci_get_option_value_string("cwmp", "acs", "opt1", UCI_VARSTATE_CONFIG, &value); + cwmp_uci_set_varstate_value_by_path("icwmp.acs.opt1", "varstatval1"); + cwmp_commit_package("icwmp", UCI_VARSTATE_CONFIG); + error = cwmp_uci_get_option_value_string("icwmp", "acs", "opt1", UCI_VARSTATE_CONFIG, &value); assert_int_equal(error, UCI_OK); assert_string_equal(value, "varstatval1"); value = NULL; @@ -128,14 +129,14 @@ static void cwmp_uci_set_tests(void **state) error = cwmp_uci_set_value_by_path("cwmp.wront_section.wrong_option", "wrong_value"); assert_int_equal(error, UCI_ERR_NOTFOUND); cwmp_commit_package("cwmp", UCI_STANDARD_CONFIG); - error = cwmp_uci_get_option_value_string("cwmp", "wront_section", "wrong_option", UCI_VARSTATE_CONFIG, &value); + error = cwmp_uci_get_option_value_string("icwmp", "wront_section", "wrong_option", UCI_VARSTATE_CONFIG, &value); assert_int_equal(error, UCI_ERR_NOTFOUND); assert_null(value); - error = cwmp_uci_set_varstate_value_by_path("cwmp.wront_section.wrong_option", "wrong_value"); + error = cwmp_uci_set_varstate_value_by_path("icwmp.wront_section.wrong_option", "wrong_value"); assert_int_equal(error, UCI_ERR_NOTFOUND); cwmp_commit_package("cwmp", UCI_STANDARD_CONFIG); - error = cwmp_uci_get_option_value_string("cwmp", "wront_section", "wrong_option", UCI_VARSTATE_CONFIG, &value); + error = cwmp_uci_get_option_value_string("icwmp", "wront_section", "wrong_option", UCI_VARSTATE_CONFIG, &value); assert_int_equal(error, UCI_ERR_NOTFOUND); assert_null(value); diff --git a/test/files/etc/icwmpd/custom_notification_forced.json b/test/files/etc/icwmpd/custom_notification_forced.json index 6b2b3d9..1ca1bb9 100644 --- a/test/files/etc/icwmpd/custom_notification_forced.json +++ b/test/files/etc/icwmpd/custom_notification_forced.json @@ -1,7 +1,7 @@ { "custom_notification": [ { - "parameter": "Device.Users.", + "parameter": "Device.SSH.", "notify_type": "2" }, { @@ -9,4 +9,4 @@ "notify_type": "1" } ] -} \ No newline at end of file +} diff --git a/test/files/etc/icwmpd/custom_notification_invalid_json.json b/test/files/etc/icwmpd/custom_notification_invalid_json.json index 19749d5..6bb7a4d 100644 --- a/test/files/etc/icwmpd/custom_notification_invalid_json.json +++ b/test/files/etc/icwmpd/custom_notification_invalid_json.json @@ -1,7 +1,7 @@ { "custom_notification": { - "parameter": "Device.Users.", + "parameter": "Device.SSH.", "notify_type": "2" }, { @@ -9,4 +9,4 @@ "notify_type": "1" } ] -} \ No newline at end of file +} diff --git a/test/files/etc/icwmpd/custom_notification_invalid_parameter.json b/test/files/etc/icwmpd/custom_notification_invalid_parameter.json index 839d516..f0fb18c 100644 --- a/test/files/etc/icwmpd/custom_notification_invalid_parameter.json +++ b/test/files/etc/icwmpd/custom_notification_invalid_parameter.json @@ -1,7 +1,7 @@ { "custom_notification": [ { - "parameter": "Device.Users.", + "parameter": "Device.SSH.", "notify_type": "2" }, { @@ -9,4 +9,4 @@ "notify_type": "1" } ] -} \ No newline at end of file +} diff --git a/test/files/etc/icwmpd/custom_notification_valid.json b/test/files/etc/icwmpd/custom_notification_valid.json index 51d0acc..c1c8498 100644 --- a/test/files/etc/icwmpd/custom_notification_valid.json +++ b/test/files/etc/icwmpd/custom_notification_valid.json @@ -1,7 +1,7 @@ { "custom_notification": [ { - "parameter": "Device.Users.", + "parameter": "Device.SSH.", "notify_type": "2" }, { @@ -9,4 +9,4 @@ "notify_type": "1" } ] -} \ No newline at end of file +} diff --git a/test/files/var/state/cwmp b/test/files/var/state/icwmp similarity index 100% rename from test/files/var/state/cwmp rename to test/files/var/state/icwmp diff --git a/test/script/00_verify_add_method.sh b/test/script/00_verify_add_method.sh index 43992be..220b0b0 100755 --- a/test/script/00_verify_add_method.sh +++ b/test/script/00_verify_add_method.sh @@ -8,7 +8,7 @@ TEST_NAME="ADD RPC Method" echo "Running: $TEST_NAME" remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "addObject","objectName":"Device.Users.User"}' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "addObject","objectName":"Device.SSH.Server"}' >/dev/null 2>&1 check_ret $? sleep 2 check_session "AddObject" @@ -20,7 +20,7 @@ if [ "$obj_instance" != "2" -o $status != "0" ]; then fi remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.Users.User.2"] }' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.2"] }' >/dev/null 2>&1 check_ret $? sleep 2 check_session "GetParameterValues" diff --git a/test/script/01_verify_delete_method.sh b/test/script/01_verify_delete_method.sh index 7e531b7..b5349b8 100755 --- a/test/script/01_verify_delete_method.sh +++ b/test/script/01_verify_delete_method.sh @@ -8,7 +8,7 @@ TEST_NAME="DELETE RPC Method" echo "Running: $TEST_NAME" remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "deleteObject","objectName":"Device.Users.User.2"}' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "deleteObject","objectName":"Device.SSH.Server.2"}' >/dev/null 2>&1 check_ret $? sleep 2 check_session "DeleteObject" @@ -19,12 +19,12 @@ if [ "$status" != "1" ]; then fi remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.Users.User"] }' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server"] }' >/dev/null 2>&1 check_ret $? sleep 2 check_session "GetParameterValues" -if grep -q "Device.Users.User.2" "$icwmp_log_file"; then - echo "Error: 'Device.Users.User.2' object is not really deleted" >> ./funl-test-debug.log +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 exit 1 fi diff --git a/test/script/02_verify_get_method.sh b/test/script/02_verify_get_method.sh index 01a0dac..b92d01b 100755 --- a/test/script/02_verify_get_method.sh +++ b/test/script/02_verify_get_method.sh @@ -8,13 +8,13 @@ TEST_NAME="GET RPC Method" echo "Running: $TEST_NAME" remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.Users.User.1.Username"] }' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.1.Alias"] }' >/dev/null 2>&1 check_ret $? sleep 2 check_session "GetParameterValues" param_value=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:string\"") -if [ "$param_value" != "user" ]; then - echo "Error: Default value of 'Device.Users.User.1.Username' is wrong, current_value($param_value) expected_value(user)" >> ./funl-test-debug.log +if [ "$param_value" != "cpe-1" ]; then + echo "Error: Default value of 'Device.SSH.Server.1.Alias' is wrong, current_value($param_value) expected_value(cpe-1)" >> ./funl-test-debug.log exit 1 fi diff --git a/test/script/03_verify_set_method.sh b/test/script/03_verify_set_method.sh index cb081c6..fdb8503 100755 --- a/test/script/03_verify_set_method.sh +++ b/test/script/03_verify_set_method.sh @@ -8,18 +8,18 @@ TEST_NAME="SET RPC Method" echo "Running: $TEST_NAME" remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.Users.User.1.Enable"] }' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.1.Enable"] }' >/dev/null 2>&1 check_ret $? sleep 2 check_session "GetParameterValues" param_value_before=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:boolean\"") if [ "$param_value_before" != "1" ]; then - echo "Error: Default value of 'Device.Users.User.1.Enable' is wrong, current_value($param_value_before) expected_value(1)" >> ./funl-test-debug.log + echo "Error: Default value of 'Device.SSH.Server.1.Enable' 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": [["Device.Users.User.1.Enable",false]]}' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["Device.SSH.Server.1.Enable",false]]}' >/dev/null 2>&1 check_ret $? sleep 2 check_session "SetParameterValues" @@ -30,7 +30,7 @@ if [ "$get_status" != "1" ]; then fi remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.Users.User.1.Enable"] }' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.SSH.Server.1.Enable"] }' >/dev/null 2>&1 check_ret $? sleep 2 check_session "GetParameterValues" @@ -40,4 +40,7 @@ if [ "$param_value_after" != "0" ]; then exit 1 fi +curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["Device.SSH.Server.1.Enable",true]]}' >/dev/null 2>&1 +sleep 2 + echo "PASS: $TEST_NAME" diff --git a/test/script/verify_custom_notifications.sh b/test/script/verify_custom_notifications.sh index 60b8c7b..ef0c4e0 100755 --- a/test/script/verify_custom_notifications.sh +++ b/test/script/verify_custom_notifications.sh @@ -27,9 +27,9 @@ supervisorctl stop icwmpd check_valgrind_xml -notif1=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].active | grep "Device.Users."` -if [[ $notif1 != *"Device.Users."* ]]; then - echo "FAIL: active notifications list doesn't contain Device.Users. parameter" +notif1=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].active | grep "Device.SSH."` +if [[ $notif1 != *"Device.SSH."* ]]; then + echo "FAIL: active notifications list doesn't contain Device.SSH. parameter" exit 1 fi notif2=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].passive | grep "Device.WiFi.SSID.1.SSID"` @@ -61,8 +61,8 @@ supervisorctl stop icwmpd check_valgrind_xml notif1=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].active | grep "Device.Users."` -if [[ $notif1 == *"Device.Users."* ]]; then - echo "FAIL: the json file is invalid, the active notifcation list shouldn't contain Device.Users. parameter" +if [[ $notif1 == *"Device.SSH."* ]]; then + echo "FAIL: the json file is invalid, the active notifcation list shouldn't contain Device.SSH. parameter" exit 1 fi notif2=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].passive | grep "Device.WiFi.SSID.1.SSID"` @@ -98,9 +98,9 @@ supervisorctl stop icwmpd check_valgrind_xml -notif1=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].active | grep "Device.Users."` -if [[ $notif1 != *"Device.Users."* ]]; then - echo "FAIL: active notifications list doesn't contain Device.Users. parameter" +notif1=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].active | grep "Device.SSH."` +if [[ $notif1 != *"Device.SSH."* ]]; then + echo "FAIL: active notifications list doesn't contain Device.SSH. parameter" exit 1 fi notif2=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].passive | grep "Device.DeviceInfo.ProvisioningCode"` @@ -136,9 +136,9 @@ supervisorctl stop icwmpd check_valgrind_xml -notif1=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].active | grep "Device.Users."` -if [[ $notif1 != *"Device.Users."* ]]; then - echo "FAIL: active notifications list doesn't contain Device.Users. parameter" +notif1=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].active | grep "Device.SSH."` +if [[ $notif1 != *"Device.SSH."* ]]; then + echo "FAIL: active notifications list doesn't contain Device.SSH. parameter" exit 1 fi notif2=`uci -c /etc/icwmpd get cwmp_notifications.@notifications[0].passive | grep "Device.WiFi.SSID.1.SD"`