mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-01-28 01:27:16 +01:00
T#10131: Fix InformParameter errors
This commit is contained in:
parent
87dec94fbc
commit
840e5bf010
3 changed files with 24 additions and 43 deletions
|
|
@ -79,8 +79,8 @@ typedef enum uci_config_paths
|
|||
{
|
||||
UCI_STANDARD_CONFIG,
|
||||
UCI_VARSTATE_CONFIG,
|
||||
UCI_ETCICWMPD_CONFIG
|
||||
}uci_config_paths;
|
||||
UCI_ETCICWMPD_CONFIG,
|
||||
} uci_config_paths;
|
||||
|
||||
enum uci_val_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#define TRANSFER_COMPL_SEC_NAME "transfer_complete"
|
||||
|
||||
static char *CWMP_EVENTS[] = {"0 BOOTSTRAP", "1 BOOT", "2 PERIODIC", "3 SCHEDULED", "5 KICKED", "6 CONNECTION REQUEST", "7 TRANSFER COMPLETE", "8 DIAGNOSTICS COMPLETE", "9 REQUEST DOWNLOAD", "10 AUTONOMOUS TRANSFER COMPLETE", "11 DU STATE CHANGE COMPLETE", "M Reboot", "M ScheduleInform", "M Download", "M ScheduleDownload", "M Upload", "M ChangeDUState", "14 HEARTBEAT", NULL};
|
||||
static char *Forced_Inform_Parmeters[] = {"Device.RootDataModelVersion", "Device.DeviceInfo.HardwareVersion", "Device.DeviceInfo.SoftwareVersion", "Device.DeviceInfo.ProvisioningCode", "Device.ManagementServer.ParameterKey", "Device.ManagementServer.ConnectionRequestURL", "Device.ManagementServer.AliasBasedAddressing"};
|
||||
static char *DUStateOperationType[] = {"Install", "Update", "Uninstall", NULL};
|
||||
static char *DUStateResultType[] = {"Success", "Failure", "Both", NULL};
|
||||
static char *DUStateFaultCode[] = {"9001", "9003", "9012", "9013", "9015", "9016", "9017", "9018","9022", "9023", "9024", "9025", "9026", "9027", "9028", "9029", "9030", "9031", "9032", NULL};
|
||||
|
|
@ -936,15 +937,11 @@ static int set_heart_beat_policy_initiation_time(char *refparam, struct dmctx *c
|
|||
|
||||
static int browseInformParameterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
|
||||
{
|
||||
struct uci_section *s = NULL, *dmmap_sect = NULL;
|
||||
struct uci_section *s = NULL;
|
||||
char *inst = NULL;
|
||||
uci_path_foreach_sections(varstate, "cwmp", "inform_parameter", s) {
|
||||
if ((dmmap_sect = get_dup_section_in_dmmap("dmmap_mgt_server", "inform_parameter", section_name(s))) == NULL) {
|
||||
dmuci_add_section_bbfdm("dmmap_mgt_server", "inform_parameter", &dmmap_sect);
|
||||
dmuci_set_value_by_section_bbfdm(dmmap_sect, "section_name", section_name(s));
|
||||
}
|
||||
inst = handle_instance(dmctx, parent_node, dmmap_sect, "informparam_instance", "informparam_alias");
|
||||
struct dmmap_dup inform_param_afgs = { .config_section = s, .dmmap_section = dmmap_sect };
|
||||
uci_foreach_sections("cwmp", "inform_parameter", s) {
|
||||
inst = handle_instance(dmctx, parent_node, s, "informparam_instance", "informparam_alias");
|
||||
struct dmmap_dup inform_param_afgs = {.config_section = s };
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&inform_param_afgs, inst) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
|
|
@ -953,18 +950,11 @@ static int browseInformParameterInst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
|
||||
static int add_inform_parameter(char *refparam, struct dmctx *ctx, void *data, char **instance)
|
||||
{
|
||||
struct uci_section *s = NULL, *dmmap_sect = NULL;
|
||||
char inf_param[32] = {0};
|
||||
struct uci_section *s = NULL;
|
||||
|
||||
snprintf(inf_param, sizeof(inf_param), "inf_param_%s", *instance);
|
||||
|
||||
dmuci_add_section_varstate("cwmp", "inform_parameter", &s);
|
||||
dmuci_rename_section_by_section(s, inf_param);
|
||||
dmuci_add_section("cwmp", "inform_parameter", &s);
|
||||
dmuci_set_value_by_section(s, "informparam_instance", *instance);
|
||||
dmuci_set_value_by_section(s, "enable", "0");
|
||||
|
||||
dmuci_add_section_bbfdm("dmmap_mgt_server", "inform_parameter", &dmmap_sect);
|
||||
dmuci_set_value_by_section(dmmap_sect, "section_name", section_name(s));
|
||||
dmuci_set_value_by_section(dmmap_sect, "informparam_instance", *instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -973,18 +963,11 @@ static int delete_inform_parameter(char *refparam, struct dmctx *ctx, void *data
|
|||
struct uci_section *s = NULL, *stmp = NULL;
|
||||
switch (del_action) {
|
||||
case DEL_INST:
|
||||
dmuci_delete_by_section(((struct dmmap_dup *)data)->dmmap_section, NULL, NULL);
|
||||
dmuci_delete_by_section(((struct dmmap_dup *)data)->config_section, NULL, NULL);
|
||||
break;
|
||||
case DEL_ALL:
|
||||
uci_path_foreach_sections_safe(varstate, "cwmp", "inform_parameter", stmp, s) {
|
||||
struct uci_section *dmmap_section = NULL;
|
||||
|
||||
get_dmmap_section_of_config_section("dmmap_mgt_server", "inform_parameter", section_name(s), &dmmap_section);
|
||||
|
||||
dmuci_delete_by_section(dmmap_section, NULL, NULL);
|
||||
|
||||
dmuci_delete_by_section_varstate(s, NULL, NULL);
|
||||
uci_foreach_sections_safe("cwmp", "inform_parameter", stmp, s) {
|
||||
dmuci_delete_by_section(s, NULL, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1017,7 +1000,7 @@ static int set_inform_parameter_enable(char *refparam, struct dmctx *ctx, void *
|
|||
static int get_inform_parameter_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct dmmap_dup *inform_param_args = (struct dmmap_dup *)data;
|
||||
dmuci_get_value_by_section_string(inform_param_args->dmmap_section, "informparam_alias", value);
|
||||
dmuci_get_value_by_section_string(inform_param_args->config_section, "informparam_alias", value);
|
||||
if ((*value)[0] == '\0')
|
||||
dmasprintf(value, "cpe-%s", instance);
|
||||
return 0;
|
||||
|
|
@ -1032,7 +1015,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->dmmap_section, "informparam_alias", value);
|
||||
dmuci_set_value_by_section_varstate(inform_param_args->config_section, "informparam_alias", value);
|
||||
cwmp_set_end_session_flag(ctx, BBF_END_SESSION_RELOAD);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1051,11 +1034,11 @@ static int set_inform_parameter_parameter_name(char *refparam, struct dmctx *ctx
|
|||
struct dmmap_dup *inform_param_args = (struct dmmap_dup *)data;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, Forced_Inform_Parmeters, NULL) == 0)
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_set_value_by_section_varstate(inform_param_args->config_section, "parameter_name", value);
|
||||
dmuci_set_value_by_section_bbfdm(inform_param_args->config_section, "parameter_name", value);
|
||||
cwmp_set_end_session_flag(ctx, BBF_END_SESSION_RELOAD);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1077,7 +1060,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_varstate(inform_param_args->config_section, "events_list", value);
|
||||
dmuci_set_value_by_section_bbfdm(inform_param_args->config_section, "events_list", value);
|
||||
cwmp_set_end_session_flag(ctx, BBF_END_SESSION_RELOAD);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
16
src/rpc.c
16
src/rpc.c
|
|
@ -351,32 +351,30 @@ static void load_inform_xml_schema(mxml_node_t **tree)
|
|||
goto end;
|
||||
|
||||
struct uci_section *s = NULL;
|
||||
cwmp_uci_foreach_sections("cwmp", "inform_parameter", UCI_VARSTATE_CONFIG, s)
|
||||
cwmp_uci_foreach_sections("cwmp", "inform_parameter", UCI_STANDARD_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);
|
||||
|
||||
if (CWMP_STRLEN(parameter_name) == 0)
|
||||
continue;
|
||||
|
||||
LIST_HEAD(parameters_list);
|
||||
char *err = cwmp_get_parameter_values(parameter_name, ¶meters_list);
|
||||
if (err || list_empty(¶meters_list))
|
||||
continue;
|
||||
|
||||
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, &(cwmp_main->session->events)))
|
||||
continue;
|
||||
|
||||
LIST_HEAD(parameters_list);
|
||||
char *err = cwmp_get_parameter_values(parameter_name, ¶meters_list);
|
||||
if (err)
|
||||
continue;
|
||||
|
||||
if (list_empty(¶meters_list))
|
||||
continue;
|
||||
|
||||
struct list_head *data_list = ¶meters_list;
|
||||
struct cwmp_dm_parameter *dm_param = NULL;
|
||||
list_for_each_entry(dm_param, data_list, list) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue