0

I want to set restriction to my yang leaf I tried something like this

 leaf remind-me-before {
     tailf:info "Remind me before value";
         type uint16 {
              range "30, 25, 10, 5, 7";
         }    
     }
  }

but it throws an error saying error: bad argument value "30, 25, 10, 5, 7", should be of type range-arg

Can someone say how to achieve this?

Lohit raj
  • 23
  • 5

1 Answers1

1

Please use the syntax as below -

leaf remind-me-before {
     tailf:info "Remind me before value";
         type uint16 {
              range "30 | 25 | 10 | 5 | 7"; >>> separated by '|'
         }    
     }
  }
Jeyashree
  • 26
  • 3
  • Thanks, @jeyashree it works with ascending order, otherwise, it throws ```error: the range value 75 is not larger than 90```. But, for my knowledge, what is this representation? is it just acting as a delimiter or something else? – Lohit raj Jul 07 '21 at 06:54
  • Or is it a general way of representing range not just in yang? Where can I refer to this syntax? – Lohit raj Jul 07 '21 at 07:01
  • @Lohit - General syntax of range-arg = range-part *(optsep "|" optsep range-part) . You can read more about it from RFC - https://datatracker.ietf.org/doc/html/rfc6020#section-12 – Jeyashree Jul 07 '21 at 10:31