cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
203
Views
0
Helpful
0
Replies
Cisco Employee

Deref in a when statement

I have the following yang model:

    leaf device {

      tailf:info "Name of the Device to configure";

       type leafref {

       path "/ncs:devices/ncs:device/ncs:name";

      }

    }

    leaf test {

      type leafref {

      path "deref(../device)/../ncs:device-type/ncs:cli/ncs:ned-id";

      }

    }

    container device-model {

     when "deref(../device)/../ncs:device-type/ncs:cli/ncs:ned-id = 'cisco-ios'";

     tailf:info "Model of the device"; 

       choice device-model {

         leaf Catalyst-3560x {

           type empty;

         }

        leaf Catalyst-4510 {

          type empty;

        }

     }

//   must "deref(../device)/../ncs:device-type/ncs:cli/ncs:ned-id = 'cisco-ios'" {

//     tailf:dependency "/ncs:devices/ncs:device/ncs:device-type/ncs:cli/ncs:ned-id";

//   }

   }


Using NSO version 4.6 with the CLI, when I set data in the model, selecting a device with a ned-id = 'cisco-nx' the test leaf correctly returns only the value cisco-nx.  However, I also incorrectly, or at least not the behaviour I am looking for, see the device-model container.  How do I use a deref in a when statement, or must statement(with the correct tailf:dependency) so that I either don't see the device-model container when selecting a non cisco-ios device, or at least throw the correct error on a must.  Neither seems to work the way I have defined it above


Is this possible?


Thanks,

Johan