cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1577
Views
4
Helpful
2
Replies

Xpath expression error

kerim mohammed
Level 3
Level 3

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

1 Accepted Solution

Accepted Solutions

frjansso
Cisco Employee
Cisco Employee

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().

View solution in original post

2 Replies 2

frjansso
Cisco Employee
Cisco Employee

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().

thank you! that fixed it.

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?