Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-402

XXX.getQName() should return namespace of module to which XXX belongs

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 2624
    • High

    Description

      According to documentation method QName.getQname() should contain namespace which:
      "XMLNamespace - the namespace assigned to the YANG module which defined element, type, procedure or notification."

      Problematic yang source:
      module network-topology-pcep {
      namespace "urn:opendaylight:params:xml:ns:yang:topology:pcep";
      prefix "pn";

      import network-topology

      { prefix nt; revision-date 2013-10-21; }

      grouping lsp-id {
      leaf node

      { type nt:node-ref; mandatory true; }

      }

      grouping add-lsp-args

      { uses lsp-id; }

      rpc add-lsp {
      input

      { uses add-lsp-args; }

      }
      }

      In this case >>leaf node<< is defined in network-topology-pcep therefore when on LeafSchemaNode for node is called getQName() then "urn:opendaylight:params:xml:ns:yang:topology:pcep" which is correct.

      When getQName() is called from type (LeafSchemaNode.getType().getQName()) then QName with namespace "urn:opendaylight:params:xml:ns:yang:topology:pcep" is also returned. I would expect namespace of network-topology (referenced via nt).

      This expected behaviour works for example in this module:
      module leafref-module {
      namespace "leafref:module";

      prefix "lfrfmo";

      import referenced-leafref-module

      {prefix refleafref; revision-date 2014-12-16;}

      revision 2013-11-18 {
      }

      container cont {
      leaf lf4

      { type refleafref:leafreftype; }

      }

      }

      If LeafSchemaNode.getType().getQName() (LeafSchemaNode represent lf4) is called then namespace of augment-leafref-module is returned.

      The diference between these modules is that in first case is leaf wrapped in two grouping and in second it is direct child of container.

      What is correct behavior? Is it bug?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pkajsa Peter Kajsa
            jgloncak Jozef Gloncak
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: