1

Can I use arithmetic operations in a must stament in a YANG file? example:

 container interface {
     leaf ifNumber{
       type uint32;
     }
     must "ifNumber" % 8 = 0 {
         error-message "Must be multiple of 8";
     }

 }
Vasi Marin
  • 453
  • 1
  • 3
  • 9

1 Answers1

2

Yes it is possible. Can you the mod keyword. See link: https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-AdditiveExpr Section: 3.5 Numbers

 container interface {
     leaf ifNumber{
       type uint32;
     }
     must "number(ifNumber) mod 8 = 0" {
         error-message "Must be multiple of 8";
     }

 }
Vasi Marin
  • 453
  • 1
  • 3
  • 9