Netconf-console --get fails with namespace in xpath

Hello,

I’m having an issue using the netconf-console tool with the --get operation. I’m attempting to include the namespace in the xpath option, but the ConfD NETCONF server returns an ‘Invalid namespace prefix’ error.

My use case is that I have two YANG modules that implement a container called ‘netconf-state’, and I want to execute the <get> operation for the ietf-netconf-monitoring /ncm:netconf-state only.

I not sure how to specify the namespace using netconf-console’s xpath filtering. Is there a way to specify the namespace with the --xpath option?

$ netconf-console --get -x '/ncm:netconf-state'
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path>
    /rpc/get
  </error-path>
    <error-message xml:lang="en">Invalid namespace prefix: ncm</error-message>
    <error-info>
      <bad-element>filter</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>
$ netconf-console --get -x '/ietf-netconf-monitoring:netconf-state'
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path>
    /rpc/get
  </error-path>
    <error-message xml:lang="en">Invalid namespace prefix: ietf-netconf-monitoring</error-message>
    <error-info>
      <bad-element>filter</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

Regards,
Matt

Something like this will work:

netconf-console --get --rpc-attribute="xmlns:ncm=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\"" -x "/ncm:netconf-state"

or

netconf-console --rpc=-<<<'<get><filter xmlns:ncm="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring" type="xpath" select="/ncm:netconf-state"/></get>'

Regards