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;

@cohult obsolete is not working if its defined under submolule… its only working under module. can you please help on this ?

Can you describe what you are trying to do that is not working?

Hi @cohult I think the issue is if its under augment. please help on it

multiple-n2-tnla-enabled under ** my-interface-n2.yang** is marked obsolete
and I have compiled the yang modules using --max-status deprecated
but I am able to see and set the obsolete field it via confd_cli.
Please find the attached yang models …

show table MyAMFFunction myinterfaces interfaceN2 multiple-n2-tnla-enabled

@ankitrathore. And you compiled the yang models with --max-status set to deprecated or current?

yes @cohult . i compiled the modules using --max-status deprecated

Hi @ankitrathore, I tested your use case with ConfD 8.0.11 and compiled the amp.yang and amf-interfaces.yang with --max-status deprecated. The multiple-n2-tnla-enabled leaf is removed as expected.

What ConfD version are you using?

Hi @cohult i am using confd 7.1 . is this a bug in confd 7.1? is there any workaround for it?

There were fixed to max-status support in ConfD 7.4 and 7.5, so yes, I would consider updating your 7.1 version released in 2019 to ConfD version 8.0.12 released 2024-02-22.

thanks… its working from confd 7.1.6 i think