mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-01-27 17:17:17 +01:00
Retry GPN and GPV calls twice on failure to ensure path validity
This commit is contained in:
parent
d2041138fc
commit
80f8f26836
3 changed files with 39 additions and 6 deletions
17
src/rpc.c
17
src/rpc.c
|
|
@ -882,6 +882,23 @@ int cwmp_handle_rpc_cpe_get_parameter_names(struct rpc *rpc)
|
|||
}
|
||||
|
||||
char *err = cwmp_get_parameter_names(parameter_name ? parameter_name : "", next_level, ¶meters_list, &err_msg);
|
||||
if (err) {
|
||||
// If an error occurs, try up to two more times to ensure the path is invalid
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CWMP_LOG(ERROR, "Failed to get parameter name for '%s', error: %s. Retrying in 1 second...", parameter_name ? parameter_name : "", err);
|
||||
|
||||
// Wait for 1 second before retrying
|
||||
sleep(1);
|
||||
|
||||
// Retry to get the parameter name
|
||||
err = cwmp_get_parameter_names(parameter_name ? parameter_name : "", next_level, ¶meters_list, &err_msg);
|
||||
|
||||
// If the operation is successful, exit the loop
|
||||
if (err == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (err) {
|
||||
fault_code = cwmp_get_fault_code_by_string(err);
|
||||
FREE(parameter_name);
|
||||
|
|
|
|||
20
src/xml.c
20
src/xml.c
|
|
@ -613,9 +613,25 @@ int build_parameter_structure(mxml_node_t *param_list, struct xml_data_struct *x
|
|||
if (xml_attrs->parameter_name == NULL)
|
||||
return CWMP_OK;
|
||||
|
||||
if (xml_attrs->rpc_enum == SOAP_PARAM_STRUCT)
|
||||
if (xml_attrs->rpc_enum == SOAP_PARAM_STRUCT) {
|
||||
err = cwmp_get_parameter_values(*(xml_attrs->parameter_name), ¶meters_list);
|
||||
else if (xml_attrs->rpc_enum == SOAP_GPA_STRUCT)
|
||||
if (err) {
|
||||
// If an error occurs, try up to two more times to ensure the path is invalid
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CWMP_LOG(ERROR, "Failed to get parameter value for '%s', error: %s. Retrying in 1 second...", *(xml_attrs->parameter_name), err);
|
||||
|
||||
// Wait for 1 second before retrying
|
||||
sleep(1);
|
||||
|
||||
// Retry to get the parameter value
|
||||
err = cwmp_get_parameter_values(*(xml_attrs->parameter_name), ¶meters_list);
|
||||
|
||||
// If the operation is successful, exit the loop
|
||||
if (err == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (xml_attrs->rpc_enum == SOAP_GPA_STRUCT)
|
||||
err = cwmp_get_parameter_attributes(*(xml_attrs->parameter_name), ¶meters_list);
|
||||
else
|
||||
return FAULT_CPE_INTERNAL_ERROR;
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ if [[ $res != *"9009"* ]]; then
|
|||
fi
|
||||
|
||||
log "ADD METHOD: Correct Path"
|
||||
res=$(./icwmpd -c add Device.DHCPv4.Relay.Forwarding. 2>&1)
|
||||
if [[ $res != *"Device.DHCPv4.Relay.Forwarding."* ]]; then
|
||||
res=$(./icwmpd -c add Device.X_IOPSYS_EU_Dropbear. 2>&1)
|
||||
if [[ $res != *"Device.X_IOPSYS_EU_Dropbear."* ]]; then
|
||||
log "Error: Add Method with correct path doesn't work correctly"
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -129,8 +129,8 @@ if [[ $res != *"Deleted ${del_path}"* ]]; then
|
|||
fi
|
||||
|
||||
log "DELETE METHOD: Correct Path && all instance"
|
||||
res=$(./icwmpd -c del Device.DHCPv4.Relay.Forwarding. 2>&1)
|
||||
if [[ $res != *"Deleted Device.DHCPv4.Relay.Forwarding."* ]]; then
|
||||
res=$(./icwmpd -c del Device.X_IOPSYS_EU_Dropbear. 2>&1)
|
||||
if [[ $res != *"Deleted Device.X_IOPSYS_EU_Dropbear."* ]]; then
|
||||
log "Error: Delete Method with correct path && all instances doesn't work correctly"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue