Ticket refs #5761: icwmp: Add boot inform parameters

This commit is contained in:
Omar Kallel 2021-08-12 16:31:41 +01:00
parent c328247082
commit afe793e8bc
3 changed files with 15 additions and 8 deletions

View file

@ -281,6 +281,7 @@ root@iopsys:~# cat /etc/icwmpd/forced_inform.json
root@iopsys:~#
```
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/forced_inform.json
root@iopsys:~# uci commit cwmp
@ -290,6 +291,7 @@ 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
> - Forced inform parameters appears only in BOOT or BOOTSTRAP inform message.
## icwmpd notifications
As per the cwmp notifications requirements, there is a list parameters specified in the standard that has forced notification type. Those parameters are defined internally in icwmp client. The list contains below parameters:

View file

@ -142,6 +142,7 @@ typedef struct cwmp {
struct session_status session_status;
unsigned int cwmp_id;
int cr_socket_desc;
bool is_boot;
} cwmp;
enum action {

View file

@ -160,6 +160,7 @@ static int xml_prepare_events_inform(struct session *session, mxml_node_t *tree)
int n = 0;
struct list_head *ilist;
struct event_container *event_container;
struct cwmp *cwmp = &cwmp_main;
b1 = mxmlFindElement(tree, tree, "Event", NULL, NULL, MXML_DESCEND);
if (!b1)
@ -173,6 +174,8 @@ static int xml_prepare_events_inform(struct session *session, mxml_node_t *tree)
b2 = mxmlNewElement(node, "EventCode");
if (!b2)
goto error;
if (event_container->code == EVENT_IDX_0BOOTSTRAP || event_container->code == EVENT_IDX_1BOOT)
cwmp->is_boot = true;
b2 = mxmlNewOpaque(b2, EVENT_CONST[event_container->code].CODE);
if (!b2)
goto error;
@ -299,6 +302,7 @@ int cwmp_rpc_acs_prepare_message_inform(struct cwmp *cwmp, struct session *sessi
if (!b)
goto error;
cwmp->is_boot = false;
if (xml_prepare_events_inform(session, tree))
goto error;
@ -362,15 +366,15 @@ int cwmp_rpc_acs_prepare_message_inform(struct cwmp *cwmp, struct session *sessi
if (xml_prepare_parameters_inform(&cwmp_dm_param, parameter_list, &size))
goto error;
}
for (i = 0; i < nbre_custom_inform; i++) {
char *fault = cwmp_get_single_parameter_value(custom_forced_inform_parameters[i], &cwmp_dm_param);
if (fault != NULL)
continue;
if (xml_prepare_parameters_inform(&cwmp_dm_param, parameter_list, &size))
goto error;
if (cwmp->is_boot == true) {
for (i = 0; i < nbre_custom_inform; i++) {
char *fault = cwmp_get_single_parameter_value(custom_forced_inform_parameters[i], &cwmp_dm_param);
if (fault != NULL)
continue;
if (xml_prepare_parameters_inform(&cwmp_dm_param, parameter_list, &size))
goto error;
}
}
if (snprintf(c, sizeof(c), "cwmp:ParameterValueStruct[%d]", size) == -1)
goto error;