Wow, an xpath expression where a predicate has an xpath expression that has another predicate - on the shell commandline! That’s quite a challenge…
Basically, not considering all the vagaries of quoting in 1) the shell and 2) XPath and 3) XML. Considering 1), what you type in the shell is not what netconf-console actually gets as an argument - you can see the latter by using ‘echo’. Your first attempt:
And that should actually be possible for an XPath engine to parse - but you’re still out of luck, because in the XML of the actual <get> RPC, the XPath filter is an attribute (select) of the <filter> parameter - so yes, it needs to be quoted! And we’re out of quote characters… netconf-console (a Python script) applies a pretty simple rule that covers most XPath expressions, but not this one: if the expression has any single quotes it uses double quotes for the attribute value, otherwise single quotes. So it ends up producing something like:
Of course routinely doing these gymnastics on the commandline isn’t really feasible - if I had a need to do that, I’d probably create a wrapper script that took the two XPath expressions as separate arguments somehow, did the needed massaging, and invoked netconf-console with the result - perhaps also generating the <get> RPC and passing that to netconf-console via the --rpc option.
Hm, you could actually use XML entities to avoid the “shell ate the internal single quotes” problem too - this should also work, and while it is actually 4 characters longer, it might be slightly easier to produce and read: