Question about attribute match expressions
Hi!
I'm trying attribute match expressions, like mentioned in RFC6241.
When I try something similar, I get the following error from netopeer though:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<get>
<filter type="subtree">
<t:c1 xmlns:t="urn:example:test">
<t:l1 t:v1="A"/>
</t:c1>
</filter>
</get>
</rpc>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-
id="9">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-message xml:lang="en">Cannot filter based on unknown attributes.</error-message>
</rpc-error>
</rpc-reply>
Is it possible to use attribute match expressions the way mentioned in the RFC, or am I doing something wrong?
I use the latest devel libyang, sysrepo, netopeer2 versions. I attached the YANG file for reference.
Thanks!
Please try it now, it may work. This was not implemented because of very limited use but in this simple form was not a problem to add.
I tried it with the latest sysrepo, but still no data returned. Server print said:
LY: Parsing opaque list node "l1" with missing/invalid keys.
What data were you expecting to be returned? I just tried to fix generating the proper XPath filter but sysrepo does not support storing custom metadata (for now at least) so it makes no sense using such filters.
If I understand the RFC correctly, in case the config looks like this:
<c1 xmlns="urn:example:test">
<l1>
<name>A</name>
<v1>id3</v1>
<v2>test1</v2>
</l1>
<l1>
<name>B</name>
<v1>id2</v1>
<v2>test2</v2>
</l1>
<l1>
<name>C</name>
<v1>id3</v1>
<v2>test3</v2>
</l1>
</c1>
And I do a get like this:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<get>
<filter type="subtree">
<t:c1 xmlns:t="urn:example:test">
<t:l1 t:name="A"/>
</t:c1>
</filter>
</get>
</rpc>
It should return the same as:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="">
<get>
<filter type="subtree">
<t:c1 xmlns:t="urn:example:test">
<t:l1>
<t:name>A</t:name>
</t:l1>
</t:c1>
</filter>
</get>
</rpc>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="10">
<data>
<c1 xmlns="urn:example:test">
<l1>
<name>A</name>
<v1>id3</v1>
<v2>test1</v2>
</l1>
</c1>
</data>
</rpc-reply>
I understand it's not a very useful case, but I saw the RFC mention it, and I thought I'd ask, if netopeer2 supports it.
You misunderstood the specs, read them again. The attribute filter is not just another way of writing a subtree filter. You are actually filtering the data based on an attribute (metadata) and its value in them. And since this is not officially supported and specified nor supported by sysrepo, it has no use for now.
Thanks for making it clear!