I'm trying to select between IOS and IOS-XR using operational data in NSO in YANG. Here are my xpath eval results:
admin@ncs(config)# xpath eval ncs:devices/ncs:device[ncs:name='ASR1006-X']/ncs:module/name='tailf-ned-cisco-ios-xr'
false
admin@ncs(config)# xpath eval ncs:devices/ncs:device[ncs:name='DLP-NCS540']/ncs:module/name='tailf-ned-cisco-ios-xr'
true
admin@ncs(config)#
result is correct.
However, when I apply this in a service to expose the platform-name leaf and rebuild, I encounter the following error:
leaf platform-name {
tailf:info "Platform name for BFD Location";
type enumeration {
enum NCS-5500;
enum NCS540L;
}
when "/ncs:devices/ncs:device[ncs:name=current()/../device]/ncs:platform/ncs:name = 'ios-xr'";
Error message:
yang/device-provisioning.yang:208: error: the node is config, but refers to a non-config node 'name' defined at /opt/ncs/ncs-6.1.15/src/ncs/yang/tailf-ncs-devices.yang:5383
make: *** [Makefile:32: ../load-dir/device-provisioning.fxs] Error 1

Has anyone encountered this issue before? Any ideas on how to resolve it?
Thanks in advance