05-07-2018 10:08 AM - edited 03-01-2019 04:09 AM
I have the following xpath expression in yang. I keep on getting syntax error when compiling:
list device-if {
key "device-name";
leaf device-name {
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
}
leaf interface {
type string;
must "not (/ncs:services/vlan:vlan[vlan-id != current()../../vlan-id]/device-if[device-name = current()../device-name][interface = current()])" {
error-message "this interface is in use";
}
}
}
Syntax error upon compilation:
/root/./ncs4.6-install//bin/ncsc `ls vlan-ann.yang > /dev/null 2>&1 && echo "-a vlan-ann.yang"` \
-c -o ../load-dir/vlan.fxs yang/vlan.yang
yang/vlan.yang:39: error: XPath error: XPath syntax error
make: *** [../load-dir/vlan.fxs] Error 1
Solved! Go to Solution.
05-07-2018 10:16 AM
Hi!
I think the error is this part: .../[vlan-id != current()../../vlan-id]/...
I think you may need current()/../../vlanid
Please note the extra slash after current().
05-07-2018 10:16 AM
Hi!
I think the error is this part: .../[vlan-id != current()../../vlan-id]/...
I think you may need current()/../../vlanid
Please note the extra slash after current().
05-07-2018 11:20 AM
thank you! that fixed it.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide