[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML Namespace usage in NETCONF



Hi,

I've been discussing this issue with Martin off-line.
I've been re-reading the prot-12 draft.
I've been writing code to implement this stuff.

The draft is a bit sloppy wrt/ namespace usage.

prot-12, pg. 11:

  3.  XML Considerations

     XML serves as the encoding format for NETCONF, allowing complex
     hierarchical data to be expressed in a text format that can be read,
     saved, and manipulated with both traditional text tools and tools
     specific to XML.

     This section discusses a small number of XML-related considerations
     pertaining to NETCONF.

  3.1.  Namespace

     All NETCONF protocol elements are defined in the following namespace:

        urn:ietf:params:xml:ns:netconf:base:1.0


Note the sentence regarding traditional tools.
(I'll bring it up later ;-)

Sec. 3.1 says that netconf XML is defined in a particular namespace,
which is the targetNamespace in the netconf XSD.

I cannot find any normative text in the document that says a manager MUST
use namespaces in NETCONF PDUs.  I know that they SHOULD use namespaces.

There is text in the subtree filter section which indicates namespace
usage is optional:

from 6.1:

     XML namespaces may be specified (via 'xmlns' declarations) within the
     filter data model.  If so, the declared namespace must first exactly
     match a namespace supported by the server.


  6.2.1.  Namespace Selection

     If namespaces are used then the filter output will only include
     elements from the specified namespace.  A namespace is considered to
     match (for filter purposes) if the content of the 'xmlns' attributes
     are the same in the filter and the underlying data model.  Note that
     namespace selection cannot be used by itself.  At least one element
     must be specified in the filter any elements to be included in the
     filter output.

    Example:

       <filter type="subtree">
         <top xmlns="http://example.com/schema/1.2/config"/>
       </filter>



This example implies another example that would not require
the top element to be in any particular namespace:

       <filter type="subtree">
         <top/>
       </filter>

There is a problem with this example.
The <get> RPC is missing:

  <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get>
       <filter type="subtree">
         <top/>
       </filter>
    </get>
  </rpc>

The problem is that the <rpc> and <get> parent elements
are defined in a target namespace, so namespaces are being used.
Any traditional XML parser that followed namespace rules will
classify the <top> node from the example above as being
requested from the netconf namespace.

Only the following PDU would actually work as intended:

  <rpc message-id="101">
    <get>
       <filter type="subtree">
         <top/>
       </filter>
    </get>
  </rpc>

This assumes of course the agent doesn't have its own
<rpc> element in another namespace (bad idea but valid XML).

Relying on the presence or absence of xmlns directives
in child nodes of <filter>, but applying normal namespaces
rules in the nodes above and below it is a hack, and a violation
of the XML Namespace Guidelines.

NETCONF needs to follow the rules for XML,
otherwise traditional tools for XML are worthless
for NETCONF.  That would kind of defeat the purpose
of using XML in the first place.

So here is the rule:

 * Either use namespaces correctly, or don't use them at all.


Andy










--
to unsubscribe send a message to netconf-request@ops.ietf.org with
the word 'unsubscribe' in a single line as the message text body.
archive: <http://ops.ietf.org/lists/netconf/>