mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
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.
This commit is contained in:
parent
286f85c39c
commit
caa4ac86b9
21 changed files with 86 additions and 82 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
12
src/cwmp.c
12
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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"custom_notification": [
|
||||
{
|
||||
"parameter": "Device.Users.",
|
||||
"parameter": "Device.SSH.",
|
||||
"notify_type": "2"
|
||||
},
|
||||
{
|
||||
|
|
@ -9,4 +9,4 @@
|
|||
"notify_type": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"custom_notification":
|
||||
{
|
||||
"parameter": "Device.Users.",
|
||||
"parameter": "Device.SSH.",
|
||||
"notify_type": "2"
|
||||
},
|
||||
{
|
||||
|
|
@ -9,4 +9,4 @@
|
|||
"notify_type": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"custom_notification": [
|
||||
{
|
||||
"parameter": "Device.Users.",
|
||||
"parameter": "Device.SSH.",
|
||||
"notify_type": "2"
|
||||
},
|
||||
{
|
||||
|
|
@ -9,4 +9,4 @@
|
|||
"notify_type": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"custom_notification": [
|
||||
{
|
||||
"parameter": "Device.Users.",
|
||||
"parameter": "Device.SSH.",
|
||||
"notify_type": "2"
|
||||
},
|
||||
{
|
||||
|
|
@ -9,4 +9,4 @@
|
|||
"notify_type": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue