ConfD User Community

Deprecating a Yang config

Is there a way to deprecate a config – throw a warning when used… Any old deployments need to load it.
new deployments – it should not show.

From the confdc(1) man page:

--max-status current | deprecated | obsolete
           Only include definitions with status greater than or equal to the given status.
           For example, to compile a module without support for all obsolete definitions,
           give --max-status deprecated.

           To include support for some deprecated or obsolete nodes, but not all, a deviation
           module is needed which removes support for the unwanted nodes.

Details in the YANG RFC:
https://tools.ietf.org/html/rfc7950#section-7.21.2

From the same confdc man page regarding deviations:

--deviation DeviationFile
           Indicates that deviations from the module in DeviationFile should be present 
           in the fxs file.

Remember to point to the DeviationFile using the --deviation flag, but also that the deviation file itself must be compiled and loaded. Details in the YANG RFC:
https://tools.ietf.org/html/rfc7950#section-7.20.3

Regarding warnings, I suggest you use a validation point to generate warnings.
See confd_lib_dp(3) man page “CONFD_VALIDATION_WARN” under “confd_register_valpoint_cb” and the ConfD examples:

$CONFD_DIR/examples.confd/validate/c_dependency/more_a_than_b.c:        return CONFD_VALIDATION_WARN;
$CONFD_DIR/examples.confd/validate/c/more_a_than_b.c:            return CONFD_VALIDATION_WARN;
$CONFD_DIR/examples.confd/cli/climods/more_a_than_b.c:            return CONFD_VALIDATION_WARN;
$CONFD_DIR/examples.confd/webui/extended/validation.c:    return CONFD_VALIDATION_WARN;
$CONFD_DIR/examples.confd/linuxcfg/linuxcfg.c:    return CONFD_VALIDATION_WARN;