Must remainder check

is there a way to ensure the leaf below is not only in the specified range, but is evenly divisible by 50?

Something like:

leaf center-frequency {
            type uint32 {
                range "71000 .. 999000";
            }
            units KHz;
            default 75250;
            must "modulo(current(), 50) = 0";
}

I’m trying to enforce a step size.

Hello

try:

must ". mod 50 = 0";

Example:

xubuntu-dev(config)# center-frequency 71111
xubuntu-dev(config)# commit
Aborted: 'center-frequency' (value "71111"): the 'must' expression ". mod 50 = 0" failed
xubuntu-dev(config)# center-frequency 71150
xubuntu-dev(config)# commit
Commit complete.

edit: all the various functions etc. are described in the XPATH referenced resource of RFC7950 that defines possible contents of the must statement…

I read in the manual I can validation code to reject the data, accept it, or accept it with a warning, how do I do that? I’d like to warn the user that their step size is wrong, but I don’t want to reject the config if they insist.

That is done using the validation callback return value CONFD_VALIDATION_WARN.

Try grepping for that constant in ConfD example set - it is shown e.g. in examples.confd/validate/c/more_a_than_b.c.