cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
336
Views
0
Helpful
1
Replies
hanssons
Beginner

MUST expression failed in NSO with "or" statement in yang

Hi all,

I'm new to yang and trying to define a MUST statement with or. However, when performing package reload, error message

'must' expression "contains(current(),'0400' or '0401')" failed. Can you use or as described in RFC6020? If yes, then please let me know if the must statement is wrongly defined.

Please see below.

list gwan-devices {
   key device-name;
   leaf device-name {
      must "contains(current(),'0400' or '0401')";

      type leafref {
       path "/ncs:devices/ncs:device/ncs:name";
      }
    }

etc

Thank you for your help

1 ACCEPTED SOLUTION

Accepted Solutions
hanssons
Beginner

I tried following configuration and that worked:

list gwan-devices {
    key device-name;
    leaf device-name {
       type leafref {
           path "/ncs:devices/ncs:device/ncs:name";
       }
       must "contains(current(),'0400') or
       contains(current(),'0401') or
       contains(current(),'2101')";
     }

etc etc

View solution in original post

1 REPLY 1
hanssons
Beginner

I tried following configuration and that worked:

list gwan-devices {
    key device-name;
    leaf device-name {
       type leafref {
           path "/ncs:devices/ncs:device/ncs:name";
       }
       must "contains(current(),'0400') or
       contains(current(),'0401') or
       contains(current(),'2101')";
     }

etc etc

View solution in original post