[YANGTOOLS-1114] Reconsider DefaultEffectiveStatement definition Created: 23/Jun/20  Updated: 05/Jan/24

Status: Confirmed
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: 14.0.0

Type: Improvement Priority: High
Reporter: Robert Varga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to YANGTOOLS-1356 Introduce model.api.stmt.DataNodeIden... Resolved

 Description   

Our current definition of DefaultEffectiveStatement (and declared statement by extension) requires users to manually parse the value to correlate it to the actual value.

What we really would like to say is that both these have a bound value, which is bound the parent type – i.e. the bracket is EffectiveStatement<Object>, specialized to Uint16 for uint16 types.

Since we are required to parse the argument when a statement is defined, this needs some more thought as to the inference mechanics – i.e. before we can successfully create the statement we need to have its parent statement perform type inference to resolve the base type.



 Comments   
Comment by Robert Varga [ 27/Oct/21 ]

DataNodeIdentifier is our candidate for yang.common's representation of YANG's instance-identifier type.

Comment by Robert Varga [ 27/Oct/21 ]

RFC7950 defines four places where a 'default' statement can occur, which boil down to two distinct kinds:

  1. when used under a 'typedef', a 'leaf' or a 'leaf-list', where it binds to the value domain (i.e. boils down to one of the built-in types, perhaps restricted)
  2. when used under a 'choice', where it binds to a child case identifier, i.e. it boils down to QName along the SchemaNodeIdentifier axis

The value domain part a bit thorny where 'instance-identifier', 'leafref' and 'identityref' type are concerned, as they differ in how namespaces are bound. In both cases qualified qnames are bound at the declaration site, but then unqualified qnames are

  1. bound at the declaration site for 'typedef' default
  2. bound at the particular instantiation site for 'leaf' and 'leaf-list' default

We need to consider all of these in this design. I think we can expend some memory in making an indirection, i.e. to have a DefaultArg interface and that providing access to values. I think it is fair for parser implementation to provide QualifedBound values for leaf/leaf-list, just as is the case with XPath expressions. Users usually have the means to understand the default namespace at the instantiation site.

Comment by Robert Varga [ 27/Oct/21 ]

The other part is that we need to understand how the type system is wired before we call DefaultStatementSupport.parseArgument(), simply because we want immutable classes and in order to correctly interpret the incoming string we need to know in what domain it resides.

This implies that all statements which could potentially be holding back a default statement must be present in a previous phase – and must gate its finalization of that previous phase with inference actions, so that when that previous phase completes, 'default's parent has either a populated namespace, or can reconstruct that information on demand (for example via a vritual namespace?).

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