How to make a Netconf xml request which can fetch all rows in a list

I have defined a list for operational data :slight_smile:

Blockquote
list listener-state {
key “listener-name”;
config false;
description
“common statistics for given listener (i.e sent messages)”;
tailf:info
“common statistics for given listener (i.e sent messages)”;
uses listener-state-info;

}

I try to send a Netconf xml request to fetch all the rows in this list.
Assume there are two rows in the table, one row with key : “first”, and the other row with key : “second”. If I want to fetch these two rows :slight_smile: , xml request will be something like

first second

But in this case, I have to know the key values.
Is there any approach I can send a xml request which fetch all rows in the list but no need to know keys ?
I know there is a way to get all key values then send xml request with all key values in
…. But this will need two requests in order to fetch all rows in list.

You do not have to provide keys when you do subtree filtering in your NETCONF message - the get part of the message would look something like

<nc:get xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <nc:filter type="subtree">
    <listener-state xmlns="http://your.name.space"/>
  </nc:filter>
</nc:get>

See also the NETCONF RFC, subtree filter examples.

I try what you recommended and it works! Thank you very much.

For the xml rpc like you posted, any idea what the key path will looks like ?
E.g., I can only figure out the key path with the key value like
/listener-state[listener-name=‘first’]/listener-name

Thanks!

Not sure what you mean by the term “key path”. What you wrote looks like an instance identifier or a XPath expression; if you want an instance identifier, it needs to look exactly like this, if it is an XPath, you can simply omit the predicate (the [...] part). ConfD NETCONF agent supports full XPath filtering, so you can use

 <nc:filter type="xpath" select="/listener-state/listener-name"/>

The term keypath is used for something little bit different in the context of ConfD APIs; and as with instance identifiers, you need to provide key values there. See more details on keypaths in ConfD documentation, chapter CDB.

Ok, thanks. Yeah, Xpath is what I need.