ConfD User Community

How to add minimum and maximum values for a leaf node having xs:duration as the data type?

Hi Team,

We are adding a leaf in a yang file as mentioned below:
leaf duration {
tailf:info “duration”;
type xs:duration;
default P0DT30M;
}

If we want the duration to be a minimum of 20Seconds(P0DT20S) and a maximum of 1Year(P1Y)
how can we add?

Hi,

Since you can’t use a YANG “must” statement to compare between tailf-xsd-type “duration” values, you need to use a validation point and check that the value is within your boundary using some code.

Hi @cohult ,

Thanks for the reply.

Can we have validation points for the confd builtin leaf nodes.
For example:
/confdConfig/cli/idleTimeout by using tailf:link "/confdConfig/cli/idleTimeout"

Yes, you can for example place the tailf:validate statement where you have your tailf:link statement.