cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
926
Views
0
Helpful
1
Replies

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

hanssons
Level 1
Level 1

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
Level 1
Level 1

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
Level 1
Level 1

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