netconf-console supports XPath filtering - anything you can do with a subtree filter you can do with a XPath filter, plus a lot more. That of course assumes your NETCONF server supports :xpath capability - ConfD does that by default.
To use that you write something like netconf-console --get-config -x /top/users, see section 15.9 of the ConfD manual. If you insist on using subtree filtering with netconf-console, you probably need to write the rpc yourself.
Hi Martain,
Thanks very much for the response.
Suppose I have writen the rpc, how could I use netconf-console to filter get-config with subtree netconf-console --port=830 --db running --get-config
The rpc is: <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <get-config> <source> <running/> </source> <filter type="subtree"> <container xmlns="urn:ietf:params:xml:ns:yang:example"> <array/> </container> </filter> </get-config> </rpc>
Thanks for any suggestions.
Unfortunately netconf-console doesn’t have a manual page, but you can learn everything about it with netconf-console -h (or --help), which says among many other things:
--rpc=RPC Takes a filename (or '-' for standard input) as
argument. The contents of the file is a single NETCONF
rpc operation (w/o the surrounding <rpc>).
I.e. you can put your rpc, minus the leading <rpc ...> and trailing </rpc>, in a file and then run
netconf-console --port=830 --rpc=<filename>`
(The --db running --get-config part is redundant since it’s specified in the rpc.)