netopeer2
netopeer2 copied to clipboard
XPath filtering issue
Hi!
I've noticed recently that netopeer2 handles XPaths differently than netopeer1.
For example, the following get:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<get>
<filter type="xpath" select="/t:basics/." xmlns:t="urn:com:test"/>
</get>
</rpc>
Will result in:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message- id="17">
<data>
<basics xmlns="urn:com:test">
<subbasics>
<complex_number xmlns="urn:com:test2">
<real_part>2.0</real_part>
<imaginary_part>-5.0</imaginary_part>
</complex_number>
</subbasics>
</basics>
</data>
</rpc-reply>
Meanwhile using libyang1 it returned with:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message- id="16">
<data/>
</rpc-reply>
Similar issue with using "/t:basics/*"
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<get>
<filter type="xpath" select="/t:basics/*" xmlns:t="urn:com:test"/>
</get>
</rpc>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message- id="19">
<data>
<basics xmlns="urn:com:test">
<subbasics>
<complex_number xmlns="urn:com:test2">
<real_part>2.0</real_part>
<imaginary_part>-5.0</imaginary_part>
</complex_number>
</subbasics>
</basics>
</data>
</rpc-reply>
Shouldn't these XPaths only return the children, not the whole subtree, according to the standard?
I'm using the latest devel version of libyang, sysrepo, libnetconf2, netopeer2.
I've also attached the schemas and example config. xpath_issue.tar.gz
Thanks!
Shouldn't these XPaths only return the children, not the whole subtree, according to the standard?
Just look at the standard, the last paragraph.