diff --git a/README.md b/README.md index 4d767ce..07456d7 100644 --- a/README.md +++ b/README.md @@ -282,59 +282,22 @@ As per the cwmp inform requirements, cwmp client has list of parameters defined | Device.ManagementServer.ConnectionRequestURL | | Device.ManagementServer.AliasBasedAddressing | -In addition to the above defined forced inform parameters as specified in datamodel standard, icwmp gives the possibility to add other datamodel parameters as forced inform parameters, by defining them in a JSON file. -Additional inform parameters can be configured in a JSON file as below: +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: ```bash -root@iopsys:~# cat /etc/icwmpd/inform.json -{ - "forced_inform":[ - "Device.DeviceInfo.X_IOPSYS_EU_BaseMACAddress", - "Device.DeviceInfo.UpTime" - ] -} -root@iopsys:~# +root@iopsys-44d43771aff0:~# cat /var/state/cwmp + +config inform_parameter + option enable '1' + option parameter_name "Device.DeviceInfo.UpTime" + option events_list '1 BOOT,6 CONNECTION REQUEST' + +config inform_parameter + option enable '0' ``` -And then the path of the JSON file can be set in the UCI option: `cwmp.cpe.forced_inform_json` like below: - -```bash -root@iopsys:~# uci set cwmp.cpe.forced_inform_json=/etc/icwmpd/inform.json -root@iopsys:~# uci commit cwmp -root@iopsys:~# /etc/init.d/icwmpd restart -``` - -> - It is required to restart icwmp service after the changes to use the new forced inform parameters -> - This JSON file shouldn't contain duplicate parameters or parameters of the standard inform parameters specified in the datamodel -> - Forced inform parameters defined in JSON should be leaf elements - -## Boot inform parameters -In addition to the above defined forced inform parameters as specified in datamodel standard and forced inform parameters specified by the customer in a json file (defined in previous section), icwmp gives also possibility to add Boot Inform parameter by defining them in a JSON file. - -Boot inform parameters will appear in inform messages that includes '0 BOOTSTRAP' or '1 BOOT' events. - -inform parameters can be configured in a JSON file as below: - -```bash -root@iopsys:~# cat /etc/icwmpd/inform.json -{ - "boot_inform":[ - "Device.DeviceInfo.UpTime" - ] -} -root@iopsys:~# -``` -And then the path of the JSON file can be set in the UCI option: `cwmp.cpe.boot_inform_json` like below: - -```bash -root@iopsys:~# uci set cwmp.cpe.boot_inform_json=/etc/icwmpd/inform.json -root@iopsys:~# uci commit cwmp -root@iopsys:~# /etc/init.d/icwmpd restart -``` -> - It is required to restart icwmp service after the changes to use the new boot inform parameters -> - This JSON file shouldn't contain duplicate parameters or parameters of the standard inform parameters specified in the datamodel -> - Boot inform parameters defined in JSON should be leaf elements -> - Boot inform parameters appears only in BOOT or BOOTSTRAP inform message. ## Notification management `icwmpd` support below notification types, which can be configured from an ACS on the datamodel parameters diff --git a/docs/api/uci.cwmp.md b/docs/api/uci.cwmp.md index 82475e1..4473372 100644 --- a/docs/api/uci.cwmp.md +++ b/docs/api/uci.cwmp.md @@ -394,20 +394,6 @@
10
Interval in sec to check for value change notifications
- -
forced_inform_json
-
string
-
no
-
-
Define absolute path for the JSON containing additional parameters as forced inform parameter. See readme for examples.
- - -
boot_inform_json
-
string
-
no
-
-
Define absolute path for the JSON containing additional parameters as boot inform parameter. These parameters only gets added if the notify event is '0 Bootstrap' or '1 Boot'. To enable value change notification, please use custom_notify_json, See readme for examples.
-
custom_notify_json
string
diff --git a/schemas/uci/cwmp.json b/schemas/uci/cwmp.json index 39c1065..03e2b81 100644 --- a/schemas/uci/cwmp.json +++ b/schemas/uci/cwmp.json @@ -313,20 +313,6 @@ "default": "10", "description": "Interval in sec to check for value change notifications" }, - { - "name": "forced_inform_json", - "type": "string", - "required": "no", - "default": "", - "description": "Define absolute path for the JSON containing additional parameters as forced inform parameter. See readme for examples." - }, - { - "name": "boot_inform_json", - "type": "string", - "required": "no", - "default": "", - "description": "Define absolute path for the JSON containing additional parameters as boot inform parameter. These parameters only gets added if the notify event is '0 Bootstrap' or '1 Boot'. To enable value change notification, please use custom_notify_json, See readme for examples." - }, { "name": "custom_notify_json", "type": "string", diff --git a/src/common.h b/src/common.h index 81337cf..a7e6256 100644 --- a/src/common.h +++ b/src/common.h @@ -61,6 +61,13 @@ #define DM_PPP_INTERFACE_PATH "Device.PPP.Interface." #define DM_IP_INTERFACE_PATH "Device.IP.Interface." +#define foreach_elt_in_strlist(elt, str, delim) \ + char *tmpchr; \ + char buffer_str[strlen(str) + 1]; \ + strncpy(buffer_str, str, sizeof(buffer_str) - 1); \ + buffer_str[sizeof(buffer_str) - 1] = '\0'; \ + for (elt = strtok_r(buffer_str, delim, &tmpchr); elt != NULL; elt = strtok_r(NULL, delim, &tmpchr)) + extern char *commandKey; extern bool thread_end; @@ -77,8 +84,6 @@ typedef struct config { char *acs_ssl_capath; char *cpe_userid; char *cpe_passwd; - char *forced_inform_json_file; - char *boot_inform_json_file; char *custom_notify_json; char *ip; char *ipv6; @@ -159,7 +164,6 @@ typedef struct cwmp { int cwmp_period; time_t cwmp_periodic_time; bool cwmp_periodic_enable; - bool is_boot; bool custom_notify_active; } cwmp; @@ -531,8 +535,6 @@ bool icwmp_validate_string_length(char *arg, int max_length); bool icwmp_validate_boolean_value(char *arg); bool icwmp_validate_unsignedint(char *arg); bool icwmp_validate_int_in_range(char *arg, int min, int max); -void load_forced_inform_json_file(struct cwmp *cwmp); -void clean_custom_inform_parameters(); char *string_to_hex(const unsigned char *str, size_t size); int copy_file(char *source_file, char *target_file); int get_connection_interface(); diff --git a/src/config.c b/src/config.c index 08f0e38..2dc8a87 100755 --- a/src/config.c +++ b/src/config.c @@ -636,25 +636,6 @@ int get_global_config(struct config *conf) } else { return error; } - - if (uci_get_value(UCI_CPE_FORCED_INFORM_JSON, &value) == CWMP_OK) { - FREE(conf->forced_inform_json_file); - if (value != NULL) { - conf->forced_inform_json_file = strdup(value); - FREE(value); - } else { - conf->forced_inform_json_file = NULL; - } - } - if (uci_get_value(UCI_CPE_BOOT_INFORM_JSON, &value) == CWMP_OK) { - FREE(conf->boot_inform_json_file); - if (value != NULL) { - conf->boot_inform_json_file = strdup(value); - FREE(value); - } else { - conf->boot_inform_json_file = NULL; - } - } if (uci_get_value(UCI_CPE_JSON_CUSTOM_NOTIFY_FILE, &value) == CWMP_OK) { FREE(conf->custom_notify_json); if (value != NULL) { diff --git a/src/cwmp.c b/src/cwmp.c index 6dcdd05..5d12f70 100644 --- a/src/cwmp.c +++ b/src/cwmp.c @@ -597,123 +597,6 @@ static void *thread_http_cr_server_listen(void *v __attribute__((unused))) return NULL; } -void load_forced_inform_json_file(struct cwmp *cwmp) -{ - struct blob_buf bbuf; - struct blob_attr *cur; - struct blob_attr *custom_forced_inform_list = NULL; - int rem; - - if (cwmp->conf.forced_inform_json_file == NULL || !file_exists(cwmp->conf.forced_inform_json_file)) - return; - - memset(&bbuf, 0, sizeof(struct blob_buf)); - blob_buf_init(&bbuf, 0); - - if (blobmsg_add_json_from_file(&bbuf, cwmp->conf.forced_inform_json_file) == false) { - CWMP_LOG(WARNING, "The file %s is not a valid JSON file", cwmp->conf.forced_inform_json_file); - blob_buf_free(&bbuf); - return; - } - const struct blobmsg_policy p[1] = { { "forced_inform", BLOBMSG_TYPE_ARRAY } }; - struct blob_attr *tb[1] = { NULL }; - blobmsg_parse(p, 1, tb, blobmsg_data(bbuf.head), blobmsg_len(bbuf.head)); - if (tb[0] == NULL) { - CWMP_LOG(WARNING, "The JSON file %s doesn't contain a forced inform parameters list", cwmp->conf.custom_notify_json); - blob_buf_free(&bbuf); - return; - } - - custom_forced_inform_list = tb[0]; - - blobmsg_for_each_attr(cur, custom_forced_inform_list, rem) - { - char parameter_path[128]; - char *val = NULL; - snprintf(parameter_path, sizeof(parameter_path), "%s", blobmsg_get_string(cur)); - if (parameter_path[strlen(parameter_path)-1] == '.') { - CWMP_LOG(WARNING, "%s is rejected as inform parameter. Only leaf parameters are allowed.", parameter_path); - continue; - } - int fault = cwmp_get_leaf_value(parameter_path, &val); - if (fault != 0) { - CWMP_LOG(WARNING, "%s is rejected as inform parameter. Wrong parameter path.", parameter_path); - continue; - } - custom_forced_inform_parameters[nbre_custom_inform++] = strdup(parameter_path); - FREE(val); - } - blob_buf_free(&bbuf); - -} - -void load_boot_inform_json_file(struct cwmp *cwmp) -{ - struct blob_buf bbuf; - struct blob_attr *cur; - struct blob_attr *custom_boot_inform_list = NULL; - int rem; - - if (cwmp->conf.boot_inform_json_file == NULL || !file_exists(cwmp->conf.boot_inform_json_file)) - return; - - memset(&bbuf, 0, sizeof(struct blob_buf)); - blob_buf_init(&bbuf, 0); - - if (blobmsg_add_json_from_file(&bbuf, cwmp->conf.boot_inform_json_file) == false) { - CWMP_LOG(WARNING, "The file %s is not a valid JSON file", cwmp->conf.boot_inform_json_file); - blob_buf_free(&bbuf); - return; - } - - const struct blobmsg_policy p[1] = { { "boot_inform", BLOBMSG_TYPE_ARRAY } }; - struct blob_attr *tb[1] = { NULL }; - blobmsg_parse(p, 1, tb, blobmsg_data(bbuf.head), blobmsg_len(bbuf.head)); - - if (tb[0] == NULL) { - CWMP_LOG(WARNING, "The JSON file %s doesn't contain a boot inform parameters list", cwmp->conf.custom_notify_json); - blob_buf_free(&bbuf); - return; - } - - custom_boot_inform_list = tb[0]; - - blobmsg_for_each_attr(cur, custom_boot_inform_list, rem) - { - char parameter_path[128]; - char *val = NULL; - - snprintf(parameter_path, sizeof(parameter_path), "%s", blobmsg_get_string(cur)); - if (parameter_path[strlen(parameter_path)-1] == '.') { - CWMP_LOG(WARNING, "%s is rejected as inform parameter. Only leaf parameters are allowed.", parameter_path); - continue; - } - int fault = cwmp_get_leaf_value(parameter_path, &val); - if (fault != 0) { - CWMP_LOG(WARNING, "%s is rejected as inform parameter. Wrong parameter path.", parameter_path); - continue; - } - boot_inform_parameters[nbre_boot_inform++] = strdup(parameter_path); - FREE(val); - } - blob_buf_free(&bbuf); -} - -void clean_custom_inform_parameters() -{ - int i; - for (i=0; i < nbre_custom_inform; i++) { - free(custom_forced_inform_parameters[i]); - custom_forced_inform_parameters[i] = NULL; - } - nbre_custom_inform = 0; - for (i=0; i < nbre_boot_inform; i++) { - free(boot_inform_parameters[i]); - boot_inform_parameters[i] = NULL; - } - nbre_boot_inform = 0; -} - int create_cwmp_var_state_files() { /* @@ -860,8 +743,6 @@ static int cwmp_init(struct cwmp *cwmp) CWMP_LOG(DEBUG, "Successfully load icwmpd configuration"); cwmp_get_deviceid(cwmp); - load_forced_inform_json_file(cwmp); - load_boot_inform_json_file(cwmp); load_custom_notify_json(cwmp); init_list_param_notify(); get_nonce_key(); @@ -889,9 +770,7 @@ static void cwmp_free(struct cwmp *cwmp) FREE(cwmp->conf.ubus_socket); FREE(cwmp->conf.connection_request_path); FREE(cwmp->conf.default_wan_iface); - FREE(cwmp->conf.forced_inform_json_file); FREE(cwmp->conf.custom_notify_json); - FREE(cwmp->conf.boot_inform_json_file); FREE(nonce_key); clean_list_param_notify(); bkp_tree_clean(); @@ -901,7 +780,6 @@ static void cwmp_free(struct cwmp *cwmp) ubus_free(ctx); } - clean_custom_inform_parameters(); icwmp_cleanmem(); cwmp_uci_exit(); } diff --git a/src/cwmp_uci.h b/src/cwmp_uci.h index 3b84c52..3af1296 100644 --- a/src/cwmp_uci.h +++ b/src/cwmp_uci.h @@ -40,8 +40,6 @@ #define UCI_CPE_NOTIFY_PERIOD "cwmp.cpe.periodic_notify_interval" #define UCI_CPE_SCHEDULE_REBOOT "cwmp.cpe.schedule_reboot" #define UCI_CPE_DELAY_REBOOT "cwmp.cpe.delay_reboot" -#define UCI_CPE_FORCED_INFORM_JSON "cwmp.cpe.forced_inform_json" -#define UCI_CPE_BOOT_INFORM_JSON "cwmp.cpe.boot_inform_json" #define UCI_CPE_JSON_CUSTOM_NOTIFY_FILE "cwmp.cpe.custom_notify_json" #define LW_NOTIFICATION_ENABLE "cwmp.lwn.enable" #define LW_NOTIFICATION_HOSTNAME "cwmp.lwn.hostname" diff --git a/src/rpc.c b/src/rpc.c index bc1577b..d94c683 100755 --- a/src/rpc.c +++ b/src/rpc.c @@ -25,6 +25,7 @@ #include "upload.h" #include "sched_inform.h" #include "diagnostic.h" +#include "cwmp_uci.h" #define PROCESSING_DELAY (1) // In download/upload the message enqueued before sending the response, which cause the download/upload // to start just before the time. This delay is to compensate the time lapsed during the message enqueue and response @@ -56,10 +57,6 @@ struct rpc_acs_method rpc_acs_methods[] = { [RPC_ACS_INFORM] = { "Inform", cwmp_ [RPC_ACS_DU_STATE_CHANGE_COMPLETE] = { "DUStateChangeComplete", cwmp_rpc_acs_prepare_du_state_change_complete, NULL, cwmp_rpc_acs_destroy_data_du_state_change_complete, NOT_KNOWN } }; -char *custom_forced_inform_parameters[MAX_NBRE_CUSTOM_INFORM] = { 0 }; -char *boot_inform_parameters[MAX_NBRE_CUSTOM_INFORM] = { 0 }; -int nbre_custom_inform = 0; -int nbre_boot_inform = 0; char *forced_inform_parameters[] = { "Device.RootDataModelVersion", "Device.DeviceInfo.HardwareVersion", @@ -202,9 +199,33 @@ static int xml_prepare_parameters_inform(struct cwmp_dm_parameter *dm_parameter, return 0; } +bool event_in_session_event_list(char *event, struct list_head *list_evts) +{ + struct event_container *event_container; + + list_for_each_entry (event_container, list_evts, list) { + if (strcmp(event, EVENT_CONST[event_container->code].CODE) == 0) + return true; + } + return false; +} + +bool check_inform_parameter_events_list_corresponding(char *events_str_list, struct list_head *list_evts) +{ + char *evt = NULL; + if (events_str_list == NULL || strlen(events_str_list) == 0) + return true; + foreach_elt_in_strlist(evt, events_str_list, ",") { + if (event_in_session_event_list(evt, list_evts)) + return true; + } + return false; +} + static void load_inform_xml_schema(mxml_node_t **tree, struct cwmp *cwmp, struct session *session) { char declaration[1024] = {0}; + mxml_node_t *xml = NULL, *envelope = NULL; if (tree == NULL) return; @@ -262,7 +283,6 @@ static void load_inform_xml_schema(mxml_node_t **tree, struct cwmp *cwmp, struct MXML_DELETE(xml); return; } - cwmp_free_all_xml_data_list(&xml_events_list); mxml_node_t *param_list = mxmlNewElement(inform, "ParameterList"); if (param_list == NULL) { @@ -271,7 +291,6 @@ static void load_inform_xml_schema(mxml_node_t **tree, struct cwmp *cwmp, struct } mxmlElementSetAttr(param_list, "soap_enc:arrayType", "cwmp:ParameterValueStruct[0]"); - struct list_head *ilist, *jlist; struct cwmp_dm_parameter *dm_parameter; int size = 0; @@ -289,7 +308,6 @@ static void load_inform_xml_schema(mxml_node_t **tree, struct cwmp *cwmp, struct size_t inform_parameters_nbre = sizeof(forced_inform_parameters) / sizeof(forced_inform_parameters[0]); size_t i; - int j; struct cwmp_dm_parameter cwmp_dm_param = { 0 }; LIST_HEAD(list_inform); for (i = 0; i < inform_parameters_nbre; i++) { @@ -310,25 +328,27 @@ static void load_inform_xml_schema(mxml_node_t **tree, struct cwmp *cwmp, struct } } - for (j = 0; j < nbre_custom_inform; j++) { - char *fault = cwmp_get_single_parameter_value(custom_forced_inform_parameters[j], &cwmp_dm_param); + struct uci_section *s = NULL; + cwmp_uci_foreach_sections("cwmp", "inform_parameter", UCI_VARSTATE_CONFIG, s) + { + char *enable = NULL; + cwmp_uci_get_value_by_section_string(s, "enable", &enable); + if (strcasecmp(enable, "0") == 0 || strcasecmp(enable , "false") == 0) + continue; + char *parameter_name = NULL; + cwmp_uci_get_value_by_section_string(s, "parameter_name", ¶meter_name); + + char *events_str_list = NULL; + cwmp_uci_get_value_by_section_string(s, "events_list", &events_str_list); + + if (!check_inform_parameter_events_list_corresponding(events_str_list, &(session->head_event_container))) + continue; + + char *fault = cwmp_get_single_parameter_value(parameter_name, &cwmp_dm_param); if (fault != NULL) continue; if (xml_prepare_parameters_inform(&cwmp_dm_param, param_list, &size)) { MXML_DELETE(xml); - return; - } - } - - if (cwmp->is_boot == true) { - for (j = 0; j < nbre_boot_inform; j++) { - char *fault = cwmp_get_single_parameter_value(boot_inform_parameters[j], &cwmp_dm_param); - if (fault != NULL) - continue; - if (xml_prepare_parameters_inform(&cwmp_dm_param, param_list, &size)) { - MXML_DELETE(xml); - return; - } } } diff --git a/src/rpc.h b/src/rpc.h index a63e301..8add0b4 100644 --- a/src/rpc.h +++ b/src/rpc.h @@ -17,11 +17,6 @@ #include "common.h" #include "session.h" -#define MAX_NBRE_CUSTOM_INFORM 256 -extern char *custom_forced_inform_parameters[MAX_NBRE_CUSTOM_INFORM]; -extern char *boot_inform_parameters[MAX_NBRE_CUSTOM_INFORM]; -extern int nbre_custom_inform; -extern int nbre_boot_inform; extern const struct rpc_cpe_method rpc_cpe_methods[__RPC_CPE_MAX]; extern struct rpc_acs_method rpc_acs_methods[__RPC_ACS_MAX]; diff --git a/src/xml.c b/src/xml.c index 2623dd9..f3d3ff4 100644 --- a/src/xml.c +++ b/src/xml.c @@ -340,9 +340,6 @@ int build_inform_events(mxml_node_t *event, struct xml_data_struct *xml_attrs) mxml_node_t *node, *b2; char c[128]; unsigned int n = 0; - struct cwmp *cwmp = &cwmp_main; - - cwmp->is_boot = false; if (!event) return -1; @@ -357,8 +354,7 @@ int build_inform_events(mxml_node_t *event, struct xml_data_struct *xml_attrs) b2 = mxmlNewElement(node, "EventCode"); if (!b2) goto error; - if (xml_data->event_code == EVENT_IDX_0BOOTSTRAP || xml_data->event_code == EVENT_IDX_1BOOT) - cwmp->is_boot = true; + b2 = mxmlNewOpaque(b2, EVENT_CONST[xml_data->event_code].CODE); if (!b2) goto error; diff --git a/test/cmocka/icwmp_custom_inform_parameters_unit_test.c b/test/cmocka/icwmp_custom_inform_parameters_unit_test.c deleted file mode 100644 index 0d04503..0000000 --- a/test/cmocka/icwmp_custom_inform_parameters_unit_test.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * Copyright (C) 2013-2021 iopsys Software Solutions AB - * Author Omar Kallel - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "common.h" -#include "config.h" -#include "rpc.h" - -static struct cwmp cwmp_main_test = { 0 }; - -static int verify_inform_parameter_in_list(char *parameter) -{ - int i; - for (i = 0; i < nbre_custom_inform; i++) { - if (strcmp(parameter, custom_forced_inform_parameters[i]) == 0) - return 1; - } - return 0; -} - -static void clean_config(struct cwmp *cwmp_test) -{ - FREE(cwmp_test->deviceid.manufacturer); - FREE(cwmp_test->deviceid.serialnumber); - FREE(cwmp_test->deviceid.productclass); - FREE(cwmp_test->deviceid.oui); - FREE(cwmp_test->deviceid.softwareversion); - FREE(cwmp_test->conf.lw_notification_hostname); - FREE(cwmp_test->conf.ip); - FREE(cwmp_test->conf.ipv6); - FREE(cwmp_test->conf.acsurl); - FREE(cwmp_test->conf.acs_userid); - FREE(cwmp_test->conf.acs_passwd); - FREE(cwmp_test->conf.interface); - FREE(cwmp_test->conf.cpe_userid); - FREE(cwmp_test->conf.cpe_passwd); - FREE(cwmp_test->conf.ubus_socket); - FREE(cwmp_test->conf.connection_request_path); - FREE(cwmp_test->conf.default_wan_iface); - FREE(cwmp_test->conf.interface); -} - -static void cwmp_custom_inform_unit_test(void **state) -{ - struct cwmp *cwmp_test = &cwmp_main_test; - get_global_config(&(cwmp_test->conf)); - - cwmp_test->conf.forced_inform_json_file = strdup("/etc/icwmpd/forced_inform_valid.json"); - load_forced_inform_json_file(cwmp_test); - assert_int_equal(nbre_custom_inform, 2); - assert_int_equal(verify_inform_parameter_in_list("Device.DeviceInfo.X_IOPSYS_EU_BaseMACAddress"), 1); - assert_int_equal(verify_inform_parameter_in_list("Device.DeviceInfo.UpTime"), 1); - FREE(cwmp_test->conf.forced_inform_json_file); - clean_custom_inform_parameters(); - - cwmp_test->conf.forced_inform_json_file = strdup("/etc/icwmpd/forced_inform_invalid_json.json"); - load_forced_inform_json_file(cwmp_test); - assert_int_equal(nbre_custom_inform, 0); - assert_int_equal(verify_inform_parameter_in_list("Device.DeviceInfo.X_IOPSYS_EU_BaseMACAddress"), 0); - assert_int_equal(verify_inform_parameter_in_list("Device.DeviceInfo.UpTime"), 0); - FREE(cwmp_test->conf.forced_inform_json_file); - clean_custom_inform_parameters(); - - cwmp_test->conf.forced_inform_json_file = strdup("/etc/icwmpd/forced_inform_invalid_parameter.json"); - load_forced_inform_json_file(cwmp_test); - assert_int_equal(nbre_custom_inform, 1); - assert_int_equal(verify_inform_parameter_in_list("Devie.DeviceInfo.X_IOPSYS_EU_BaseMACAddress"), 0); - assert_int_equal(verify_inform_parameter_in_list("Device."), 0); - assert_int_equal(verify_inform_parameter_in_list("Device.DeviceInfo.UpTime"), 1); - FREE(cwmp_test->conf.forced_inform_json_file); - clean_custom_inform_parameters(); - - clean_config(cwmp_test); - icwmp_cleanmem(); -} - -int icwmp_custom_inform_test(void) -{ - const struct CMUnitTest tests[] = { // - cmocka_unit_test(cwmp_custom_inform_unit_test), - }; - - return cmocka_run_group_tests(tests, NULL, NULL); -} diff --git a/test/cmocka/icwmp_unit_test.c b/test/cmocka/icwmp_unit_test.c index dbc4569..dedfa99 100644 --- a/test/cmocka/icwmp_unit_test.c +++ b/test/cmocka/icwmp_unit_test.c @@ -7,7 +7,6 @@ int main() ret += icwmp_notifications_test(); ret += icwmp_cli_unit_test(); - ret += icwmp_custom_inform_test(); ret += icwmp_soap_msg_test(); ret += icwmp_uci_test(); ret += icwmp_datamodel_interface_test(); diff --git a/test/cmocka/icwmp_unit_test.h b/test/cmocka/icwmp_unit_test.h index 6a9aa19..e873ebb 100644 --- a/test/cmocka/icwmp_unit_test.h +++ b/test/cmocka/icwmp_unit_test.h @@ -2,7 +2,6 @@ #define ICWMP_UNIT_TEST int icwmp_backup_session_test(void); int icwmp_cli_unit_test(void); -int icwmp_custom_inform_test(void); int icwmp_datamodel_interface_test(void); int icwmp_download_unit_test(void); int icwmp_notifications_test(void); diff --git a/test/files/etc/icwmpd/forced_inform_invalid_json.json b/test/files/etc/icwmpd/forced_inform_invalid_json.json deleted file mode 100644 index afd1e61..0000000 --- a/test/files/etc/icwmpd/forced_inform_invalid_json.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "forced_inform": - "Device.DeviceInfo.X_IOPSYS_EU_BaseMACAddress", - "Device.DeviceInfo.UpTime" - ] -} \ No newline at end of file diff --git a/test/files/etc/icwmpd/forced_inform_invalid_parameter.json b/test/files/etc/icwmpd/forced_inform_invalid_parameter.json deleted file mode 100644 index 2f3fad6..0000000 --- a/test/files/etc/icwmpd/forced_inform_invalid_parameter.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "forced_inform":[ - "Device.", - "Devie.DeviceInfo.X_IOPSYS_EU_BaseMACAddress", - "Device.DeviceInfo.UpTime" - ] -} \ No newline at end of file diff --git a/test/files/etc/icwmpd/forced_inform_valid.json b/test/files/etc/icwmpd/forced_inform_valid.json deleted file mode 100644 index a64a4b5..0000000 --- a/test/files/etc/icwmpd/forced_inform_valid.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "forced_inform":[ - "Device.DeviceInfo.X_IOPSYS_EU_BaseMACAddress", - "Device.DeviceInfo.UpTime" - ] -} \ No newline at end of file