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

Improve mapping of YANG extensions

    XMLWordPrintable

Details

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

    Description

      Our current handling of statements within a YANG extension performs encapsulation into UnknownNodes – this is done in the middle of SourceSpecificContext.createDeclaredChild().

      As the associated FIXME indicates, the way this is done is inefficient, as we end up creating a new ModelDefinedStatementDefinition and a corresponding UnknownStatementImpl.Definition for each such instance.

      In order to fix this we have to change the way we look up StatementDefinitionContext when creating a ContextBuilder. Instead of going directly to BuildGlobalContext, we should consult current StatementContextBase.definition(), which should return a StatementDefinitionContext for the requested child:

       

      public StatementDefinitionContext getChildStatementDefinition(QName, SchemaSourceReference) {
        final StatementSupport<?, ?, ?> childSupport = support.getChildSupport(qname);
        SourceException.throwIfNull(childSupport, sourceReference, "Unsupported statement %s", qname);
      ... (consult & populate cache) ...
       }
      

       

      There really need to be two implementations:

      • one on top of BuildGlobalContext, which will contain intertwined globally-defined statements, reusing BuildGlobalContext.definitions as a cache,
      • one for use with extensions, where the cache is bound to an instance of ModelDefinedStatementSupport.

      This may mean we need to update what StatementDefinitionContext.substatementBuilder() does...

      Attachments

        Issue Links

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

          Activity

            People

              pkajsa Peter Kajsa
              rovarga Robert Varga
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: