Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter in netconf - one specific entry #100

Closed
shiraez opened this issue Dec 5, 2019 · 2 comments
Closed

filter in netconf - one specific entry #100

shiraez opened this issue Dec 5, 2019 · 2 comments
Labels

Comments

@shiraez
Copy link

shiraez commented Dec 5, 2019

my db:

<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
   <interface>
      <name>interface-1</name>
      <type>ianaift:starLan</type>
      <enabled>true</enabled>
   </interface>
   <interface>
      <name>interface-2</name>
      <type>ianaift:starLan</type>
      <enabled>true</enabled>
   </interface>
</interfaces>

I try to filter the data with the procedure -(like the example in the link)

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get-config><source><running/></source><filter type="subtree"><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>interface-1</name></interface></interfaces></filter></get-config></rpc>]]>]]>

The reply was --

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>interface-1</name><type>ianaift:starLan</type><enabled>true</enabled></interface><interface><name>interface-2</name><type>ianaift:starLan</type><enabled>true</enabled></interface></interfaces></data></rpc-reply>

I expect to the reply

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>interface-1</name><type>ianaift:starLan</type><enabled>true</enabled></interface></interfaces></data></rpc-reply>

I did something wrong?

@olofhagsand olofhagsand added the bug label Dec 7, 2019
@olofhagsand
Copy link
Member

olofhagsand commented Dec 7, 2019

Yes, I recommend the use of filter type xpath capability (rfc 6241 sec 8.9). In this example, for example the following would work:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get-config><source><candidate/></source><filter type="xpath" select="/if:interfaces/if:interface[if:name='1']" xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"/></get-config></rpc>]]>]]>

That said, subtrees should also work, therefore I file this as a bug.

@olofhagsand
Copy link
Member

Should be fixed, but is slower than XPATH and does not support namespaces currently.
Please verify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants