ConfD User Community

Defining a leaf that takes value at certain increments


#1

Hi Experts, I need to define a yang leaf with range 100M-1000M, which is easy. But user can only configure it in steps of 100. Means, we should reject if user configures it as 123M but should accept if user configures as 800.
How can I do these calculations in the must statement? OR do I have to do it in the backend only, but this seem to be generic requirement.


#2

Hi,
See tailf:step in the tail_yang_extenstions(5) man page. Example from the man page:

type int32 {
  range '-2 .. 9' {
    tailf:step 3;
  }
}

has the value space { -2, 1, 4, 7 }

Works on range of integer and decimal types