From 625b70e3da7b1ec163607cc7354404904eacf36e Mon Sep 17 00:00:00 2001 From: Emanuele Di Pascale Date: Fri, 9 Nov 2018 16:13:12 +0100 Subject: lib: add NB phase-specific error codes As suggested by Renato, add error codes that are specific to the various phases of a northbound callback. These can be used by the daemons when logging an error. The reasoning is that validation errors typically mean that there is an inconsistency in the configuration, a prepare error means that we are running out of resources, and abort/apply errors are bugs that need to be reported to the devs. Signed-off-by: Emanuele Di Pascale --- lib/lib_errors.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'lib/lib_errors.c') diff --git a/lib/lib_errors.c b/lib/lib_errors.c index b1ed7d2f6b..7e428f135c 100644 --- a/lib/lib_errors.c +++ b/lib/lib_errors.c @@ -105,10 +105,16 @@ static struct log_ref ferr_lib_warn[] = { .suggestion = "Check if the installed FRR YANG modules are in sync with the FRR binaries", }, { - .code = EC_LIB_NB_CB_CONFIG, - .title = "A northbound configuration callback has failed", - .description = "The northbound subsystem has detected that a callback used to process a configuration change has returned an error", - .suggestion = "The log message should contain further details on the specific error that occurred; investigate the reported error.", + .code = EC_LIB_NB_CB_CONFIG_VALIDATE, + .title = "A northbound configuration callback has failed in the VALIDATE phase", + .description = "A callback used to process a configuration change has returned a validation error", + .suggestion = "The provided configuration is invalid. Fix any inconsistency and try again.", + }, + { + .code = EC_LIB_NB_CB_CONFIG_PREPARE, + .title = "A northbound configuration callback has failed in the PREPARE phase", + .description = "A callback used to process a configuration change has returned a resource allocation error", + .suggestion = "The system might be running out of resources. Check the log for more details.", }, { .code = EC_LIB_NB_CB_STATE, @@ -326,6 +332,18 @@ static struct log_ref ferr_lib_err[] = { .description = "The northbound subsystem has detected that the libsysrepo library returned an error", .suggestion = "Open an Issue with all relevant log files and restart FRR" }, + { + .code = EC_LIB_NB_CB_CONFIG_ABORT, + .title = "A northbound configuration callback has failed in the ABORT phase", + .description = "A callback used to process a configuration change has returned an error while trying to abort a change", + .suggestion = "Gather log data and open an Issue.", + }, + { + .code = EC_LIB_NB_CB_CONFIG_APPLY, + .title = "A northbound configuration callback has failed in the APPLY phase", + .description = "A callback used to process a configuration change has returned an error while applying the changes", + .suggestion = "Gather log data and open an Issue.", + }, { .code = END_FERR, } -- cgit v1.2.3