ConfD User Community

Filter not working without nc namsepsace in confd7.2.2

Hi All

Above xml gives below error
confd[22438]: netconf id=79 filter (in namespace []) cannot occur here as a child to get (in namespace ‘urn:ietf:params:xml:ns:netconf:base:1.0’).

Same rpc works with nc name space in filter tag.

  <nc:get>
    <nc:filter>
      <inventory xmlns="http://johndoe.com/ns/yang/john-invmgr-oper"/>
    </nc:filter>
  </nc:get>
</nc:rpc>```

Is it mandatory to add nc namespace to the filter in confd ?

NOTE : adding xml is causing formatting issues . preview not showing xml properly

Why not simplify a bit and skip using a prefix?

<rpc message-id="urn:uuid:b3789fdf-7e27-44d6-883d-eb8c2e58cd45" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get>
    <filter>
      <inventory xmlns="http://johndoe.com/ns/yang/john-doe-invmgr-oper"/>
    </filter>
  </get>
</rpc>

BTW, put ``` around your XML to display it properly.

So, @cohult’s reply clearly shows that the answer is “no”:-), but just to elaborate a bit: standard XML rules apply, i.e. the namespace must be defined for each element, either explicitly with a prefix defined in an xmlns:<prefix>="..." attribute, or implicitly using the default namespace defined in an xmlns="..." attribute. And the <filter> element is defined in the urn:ietf:params:xml:ns:netconf:base:1.0 namespace, see e.g. the ietf-netconf@2011-06-01.yang module defined in https://tools.ietf.org/html/rfc6241#appendix-C .

In case you have “gotten away” with your incorrect XML in earlier ConfD versions, ConfD did indeed use to be overly “permissive” regarding the namespaces in XML, accepting not just a missing but even an incorrect namespace in some cases. This resulted in failures to parse some valid XML (where the namespace was really necessary in order to distinguish elements with the same “local-name”), so had to be tightened up - from ConfD-7.1 CHANGES:

Non-backwards compatible corrections:
...
  - confd: XML validation did not strictly apply the namespace declarations.
    E.g. the NETCONF server would treat <filter> as a parameter to
    <get-config> and <config> as a parameter to <edit-config> even if the
    "xmlns" attribute for the <filter> and <config> nodes specified a
    different namespace. This has been fixed.