[YANGTOOLS-857] YANG parser should honor RFC7950 section 6.2.1 restrictions Created: 02/Mar/18  Updated: 19/Oct/19  Resolved: 09/Oct/19

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 2.1.12, 3.0.5, 4.0.1
Fix Version/s: 3.0.6, 2.1.13, 4.0.2

Type: Bug Priority: Medium
Reporter: Jie Han Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by YANGTOOLS-1026 Choice/Case children conflict does no... Resolved
Relates
relates to YANGTOOLS-853 Fix EffectiveStatement namespace impl... Confirmed
relates to BGPCEP-880 Fix usage of duplicate child element ... Resolved
relates to YANGTOOLS-883 YANG parser fails to detect duplicate... Resolved

 Description   

As in RFC 7950 section 6.2.1:

o All leafs, leaf-lists, lists, containers, choices, rpcs, actions,
notifications, anydatas, and anyxmls defined (directly or through
a "uses" statement) within a parent node or at the top level of
the module or its submodules share the same identifier namespace.
This namespace is scoped to the parent node or module, unless the
parent node is a case node. In that case, the namespace is scoped
to the closest ancestor node that is not a case or choice node
.

We should take into consideration the following 3 models:

module bar {
    yang-version 1.1;
    namespace bar;
    prefix bar;

    revision "2018-02-11";

    grouping foo {
      container bar {

      }
    }

    container cont {
      choice bar {
        case foo {
          uses foo;
        }
      }
    }

    augment "/cont" {
      choice foo {
        case foo {
          uses foo;
        }
      }
    }
}

module baz {
    yang-version 1.1;
    namespace baz;
    prefix baz;

    revision "2018-02-28";

    grouping foo {
      container bar {

      }
    }

    container cont {
      choice bar {
        case foo {
          uses foo;
        }
      }

      container bar {

      }
    }
}

module foo {
    yang-version 1.1;
    namespace foo;
    prefix foo;

    revision "2018-02-11";

    grouping foo {
      container bar {

      }
    }

    container cont {
      choice bar {
        case foo {
          uses foo;
        }
      }
    }

    augment "/cont/bar" {
      case foo2 {
        uses foo;
      }
    }
}



 Comments   
Comment by Jie Han [ 02/Mar/18 ]

master: https://git.opendaylight.org/gerrit/68134

Comment by Robert Varga [ 13/Jun/18 ]

This namespace is not really useful to end users, as it is a hybrid between schema tree and data tree addressing.

Notable difference from schema tree addressing: choices/cases and their data nodes are flattened to their ancestor node (as highlighted in the description).

Notable difference from data tree addressing: choices/cases contribute to the hierarchy.

 

Comment by Robert Varga [ 08/Oct/19 ]

It seems YANGTOOLS-853 implementation is missing dataTree population. Using the attached test case container's dataTreeNamespace is empty – where it should contain all leaves of choice/case statements. It correctly lists ChoiceNode in its schemaTreeNamespace. Furthermore the ChoiceNode has its dataTreeNamespace empty, too.

Comment by Robert Varga [ 08/Oct/19 ]

Ah, right, so LeafEffectiveStatement is just a SchemaTreeEffectiveStatement, not DataTreeEffectiveStatement – and thus was not attributed correctly.

Generated at Wed Feb 07 20:54:30 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.