ciscoietf-netconf

"Wrong document: namespaces not specified" NETCONF error


I have a problem with NETCONF get-config operation to Nexus 7000 with OS version 7.3(1)D1(1).

Sent message has xmlns attribute in rpc tag.

<?xml version="1.0" encoding="utf-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5">
  <get-config>
    <source>
      <running/>
    </source>
  </get-config>
</rpc>

However, the result says that rpc is a bad element for missing namespaces attribute.

<?xml version="1.0" encoding="utf-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5">
  <rpc-error>
    <error-type>rpc</error-type>
    <error-tag>missing-attribute</error-tag>
    <error-severity>error</error-severity>
    <error-message>Wrong document: namespaces not specified</error-message>
    <error-info>
      <bad-element>rpc</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

In comparison, my get-config query has no problem with ASR 9000, IOS XR 6.1.4.

<?xml version="1.0" encoding="utf-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5">
  <data>
...

How can I walk around this error?


Solution

  • I could make get-config RPC work in this way. "urib" can be replaced by any other defined subtree.

    <nf:get-config
        xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0"
        xmlns="http://www.cisco.com/nxos:7.3.1.D1.1.:urib">
      <nf:source>
        <nf:running/>
      </nf:source>
    </nf:get-config>
    

    However it lead me another issue that the result is in form of CLI commands, not XML-structured. So I asked to Cisco about it as this.

    Result from NX-OS:

    <?xml version="1.0" encoding="utf-8"?>
    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
        xmlns:pfx1="http://www.cisco.com/nxos:7.3.1.D1.1.:urib"
        xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">!Command: show running-config
    !Time: Tue Jan 16 18:00:27 2018
    
    version 7.3(1)D1(1)
    hostname MASKED_FOR_ANONYMITY
    
    feature telnet
    feature ospf
    ......
    xml server max-session 6
    xml server validate all</data>
    

    Result from IOS-XR:

    <?xml version="1.0" encoding="utf-8"?>
    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
      <aaa xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-locald-admin-cfg">
        <usernames>
          <username>
    ......
    </data>