yangtools.git
13 months agoBump versions to 8.0.11-SNAPSHOT 13/104913/1 8.0.x
Robert Varga [Thu, 16 Mar 2023 08:36:03 +0000 (09:36 +0100)]
Bump versions to 8.0.11-SNAPSHOT

This starts the next development iteration.

Change-Id: Ic1e34ce18d3e8a540989f3914fda3b329741b773
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoFix bits/instance-identifier value serdes 72/104872/3
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix bits/instance-identifier value serdes

Bits and instance-identifier values need to be recognized. Fix their
serialization and parsing and enable tests.

JIRA: YANGTOOLS-1473
Change-Id: If5b40d4642e4d8353e8dfad492166987fc3c536b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
(cherry picked from commit b0d52d88a50259a179b0f128ba9c5e39f4dd30e9)

13 months agoFix identity-ref value parsing/serialization 71/104871/6
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix identity-ref value parsing/serialization

When encountering a QName value in a leaf, a leaf-list or implied as the
value of a key, we need to properly encode it. The same is true when
parsing, where we have to consult current namespace mapping.

As a side-effect of this, we are also fixing the case of a leaf-list
entry referenced in a path argument -- which is important for all
non-String types.

JIRA: YANGTOOLS-1473
Change-Id: Id50ebd9a3c0c1378f1af8451b86c66e323757eba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
(cherry picked from commit 7c8fd1ae5a6942fb3600ab9d05185cd4293f5f51)

13 months agoFix String value parsing/serialization 70/104870/6
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix String value parsing/serialization

When encoding user-supplied values from user we need to be mindful of
their actual content: we cannot just use single quotes (') everywhere,
as the value itself can contain a single quote, in which case the
resulting string would have unbalanced quotes and nominally unparseable.

Adjust both sides of the serialization picture to account for this and
use YANG section 6.1.3 for escaping rules.

JIRA: YANGTOOLS-1473
Change-Id: I0df9beaf720a78682b6bde606a1359e7f1a09df8
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f31f6f001ec2263715ebfd5f28d214b56e9a0344)

13 months agoUpdate test suite 69/104869/6
Robert Varga [Tue, 14 Mar 2023 07:49:38 +0000 (08:49 +0100)]
Update test suite

Change I6226cc8ebe48acc03a62309efec2ab205549e0fb has a few deficiencies
in the models and test consistency. Improve the tests before we start
addressing the issues.

JIRA: YANGTOOLS-1473
Change-Id: Ie1f4e5fa99a8258abe09c005d352dd971a98c051
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3882dd90f1af909696a4e1ebad57aae1282cf956)

13 months agoImprove XmlCodecFactory a bit 10/104910/3
Robert Varga [Tue, 14 Mar 2023 12:37:00 +0000 (13:37 +0100)]
Improve XmlCodecFactory a bit

Remove an unneeded cast in test code by exposing the fact that
instanceIdentifierCodec() operates on YangInstanceIdentifier.

JIRA: YANGTOOLS-1473
Change-Id: Ib915a0b4c93674e1e266359070bb6b06da20094c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 90a498521a7ec3fd62ed91c2c0016ab334a93da2)

13 months agoTests for YangInstanceIdentifier key value serialization 09/104909/3
Robert Varga [Fri, 6 Jan 2023 14:24:24 +0000 (15:24 +0100)]
Tests for YangInstanceIdentifier key value serialization

There are a number of corner cases which we do not handle. This patch
adds @Ignored tests which hightlight basic serialization problems here.

JIRA: YANGTOOLS-1473
Change-Id: I6226cc8ebe48acc03a62309efec2ab205549e0fb
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6fca49a9a8daff89d5304c15d3e5c734dfa3da11)

13 months agoImprove JSONCodecFactory 12/104912/1
Robert Varga [Fri, 6 Jan 2023 13:38:44 +0000 (14:38 +0100)]
Improve JSONCodecFactory

Improve type safety for tests by returning a well-defined JSONCodec.

Change-Id: Id0ba808b03c3b035ad77d545dc4acdc60920188a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fa2207496b5d7097863f6c1163c15091b48bd063)
(cherry picked from commit 51b47d7499224bc8647c31d5d5960a74b6cd28d2)

13 months agoModernize AbstractStringInstanceIdentifierCodec 08/104908/1
Robert Varga [Fri, 6 Jan 2023 15:08:11 +0000 (16:08 +0100)]
Modernize AbstractStringInstanceIdentifierCodec

Use local variable type inference.

Change-Id: I0b2bb0de72ab207ed01060cf3d6c76dbf5e450bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1aa58ce7aca9f9e65e0fa3b5d9101af9945e38a5)

13 months agoCheck requested schema tree statement namespace 92/104892/2
Sangwook Ha [Fri, 27 Jan 2023 22:24:14 +0000 (14:24 -0800)]
Check requested schema tree statement namespace

When we have a reactor when two children of an InferredStatementContext
differ only in namespace, we cannot blindly service
requestSchemaTreeChild().

Check whether the namespaces match, as we can only materialize
statements that match our targetModule.

JIRA: YANGTOOLS-1480
Change-Id: I4d9c6e6361fe2d5383e6de43e3c1bb54bac4e935
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a9bdd9337094457150a89f630dedd21d70177a90)

13 months agoInline NamespaceStorageSupport.accessNamespaces() 64/104864/1
Robert Varga [Mon, 13 Mar 2023 18:26:21 +0000 (19:26 +0100)]
Inline NamespaceStorageSupport.accessNamespaces()

We have multiple callers, but all of duplicate the functionality
of getLocalNamespace(). Inline accessNamespaces() into
getLocalNamespace() and adjust users to use that instead duplicating its
code.

This removes a the need for a number of warning suppressions and makes
it clearer as to what is going on.

Change-Id: Ia210c6275b64093063eaf58a67412e94c3a29419
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 131816618ba0dd44880b58092fc062375f8d7389)
(cherry picked from commit 8e0305de53d206d852245682a3c26a5024b59fca)

13 months agoUse local variable type inference a bit more 63/104863/1
Robert Varga [Mon, 13 Mar 2023 17:00:48 +0000 (18:00 +0100)]
Use local variable type inference a bit more

Reduce verbosity by using local variable type inference.

Change-Id: I8e02d0642b6e28052332a5f5dd5e9601442af8db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0bb9d758a7d7faabbc6cca057a166c997e1b5040)
(cherry picked from commit 766c1580cd34651a658a3feb6157fd21fbc988bf)

13 months agoRemove a naked cast 62/104862/1
Robert Varga [Mon, 13 Mar 2023 17:00:07 +0000 (18:00 +0100)]
Remove a naked cast

We have a utility to perform a checked cast, use that instead to improve
defensiveness.

Change-Id: Id20c0690bc36ecd3eea0fc902c727d78450bdccd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e036e09b003ace450a0392405a56818921487e82)
(cherry picked from commit 0a963506d4f9a0a68f6dec85fcb9f286cc6a40c2)

13 months agoFix augment/deviate mechanics 50/104850/2
Sangwook Ha [Mon, 30 Jan 2023 21:50:33 +0000 (13:50 -0800)]
Fix augment/deviate mechanics

Parsing of YANG models with a deviation fails if the deviation target
node is conditionally augmented based on a feature.

The problem is we are reusing are reusing setUnsupported() for two
cases: when the feature is not supported and when the target is not
available.

Separate the second case into a separate boolean, and if the target is
available, propagate children to target as unsupported -- which makes
namespace resolution work correctly and deviate properly sees the
children as unsupported.

JIRA: YANGTOOLS-1485
Change-Id: I954185dd0067667faae8073e222f07b65907e675
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 46497a560b73b86f51936e3326881657e523185f)

13 months agoBump odlparent to 10.0.6 39/104839/1
Robert Varga [Mon, 13 Mar 2023 11:22:49 +0000 (12:22 +0100)]
Bump odlparent to 10.0.6

Pick up latest updates from upstream.

Change-Id: Ic5ea4852b0f140c4e686979c15c84ff46b1b2be8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove getLocalName() invocation 38/104838/1
Robert Varga [Mon, 6 Mar 2023 14:50:56 +0000 (15:50 +0100)]
Remove getLocalName() invocation

We can easily refer to localName field, do just that.

Change-Id: I0b51e77c1b5e2fe61b3190bc661541682dec8e4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit aa1b05c3a2ab1f1088cd895df97d844203a42a98)

13 months agoFix anyData content normalization incl no data case 53/104453/2
Ruslan Kashapov [Tue, 10 Jan 2023 08:25:30 +0000 (10:25 +0200)]
Fix anyData content normalization incl no data case

Parsing of anydata content is now performed with inference
pointing to anydata node itself as a root (parentNode),
not first child. This allows proper normalization of any
anydata content incl empty case.

List/leaf-list element parsing logic was updated to detach
schema node value check as a condition bc top level node
identifiers are not matching when anydata content is parsed.
Local name and namespace match is used instead.

JIRA: YANGTOOLS-1011
Change-Id: I09ae84c44ada198b888d901dff0425b29400fb4f
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
(cherry picked from commit 68e5e4f9d8261ef5e6fd9fcf62cd84c45b8a7739)

14 months agoOptimize ModifierImpl.AbstractPrerequisite 61/104161/2
Robert Varga [Tue, 14 Feb 2023 10:17:31 +0000 (11:17 +0100)]
Optimize ModifierImpl.AbstractPrerequisite

Object analysis shows we are recording outer class multiple times,
leading to suboptimimal object layout. Make the class hierarchy static,
with outer class recorded in explicit field, reducing
size of PhaseModificationInNamespacePath from 40-80 (48 typical) bytes
to 32-64 (40 typical) bytes. Other subclasses observe a similar
reduction.

JIRA: YANGTOOLS-1486
Change-Id: Ifc3da86a564bc54f4247996e622787a8528422b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 007dd4ccf28dd4288bafbce38a00c2b8d3ec2a68)
(cherry picked from commit a9bd1a493db611489687effeaeab9f2dc5d3af32)

14 months agoDo do not check unique in unsupported lists 83/104383/2
Sangwook Ha [Mon, 30 Jan 2023 21:50:33 +0000 (13:50 -0800)]
Do do not check unique in unsupported lists

Parsing of YANG models fails if a list conditional on a feature has a
unique statement and the feature is not supported.

Add test cases to reproduce the issue and fix
RequireEffectiveList.isApplicable() to also check for
isSupportedByFeatures().

JIRA: YANGTOOLS-1481
Change-Id: Id73f3f36fc5300e4c9fe97c32a25e58ab75078e4
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a94cb0f875a6b56360f64a6ba49d209a3dddd1ee)

14 months agoDo not access size indirect through body() 52/104152/2
Robert Varga [Tue, 24 Jan 2023 13:32:43 +0000 (14:32 +0100)]
Do not access size indirect through body()

This seems to be more efficient, but needs to be evaluated.

Change-Id: Ia8ddc618b7b98a82ad51d97c349d035793386562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 63dd7f36f6f23ce6e35cd0027ea042147fec641c)

14 months agoFix ReactorStmtCtx.calculateParentRefcount() 91/104191/2
Sangwook Ha [Wed, 4 Jan 2023 04:12:51 +0000 (20:12 -0800)]
Fix ReactorStmtCtx.calculateParentRefcount()

If we have an empty grouping, which is referenced via augment-uses to a
different module, then if that module is buildEffective()'d first, we
end up with the grouping being swept.

This turns out to be a bug in parentRef determination -- in this
particular case we observe parent being REFCOUNT_NONE and invoke it
recursively -- and since the parent is a module, it itself does not have
a parentRef. This leads to us thinking the grouping does not have a
parentRef, whereas it does.

Update calculateParentRefcount() to recognize parent.refCount == 0 as
parent holding us down.

The problem manifests itself in the test when the models are processed
in order foo.yang, bar.yang -- but not when bar.yang is processed before
foo.yang.

Unfortunately the order of processing is not predictable in
BuildGlobalContext, hence we repeat the test 4 times.

JIRA: YANGTOOLS-1474
Change-Id: Ib3d55fb92d5a6d34230722ab1cd39e8f8831b6fe
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ad55ca2b2e72f15d7963cfcb011e4f7610889fce)

14 months agoSplit calculateParentRefcount() 90/104190/1
Robert Varga [Mon, 30 Jan 2023 10:01:54 +0000 (11:01 +0100)]
Split calculateParentRefcount()

The real meat of the method operates solely on parent, so split it off
into a dedicated method.

Change-Id: I9e3b8a19d4031372669c454bcbd3fbd5ceb29e07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f1eab654288b106cf7ddb956aa37fb63d446b1b0)

15 months agoRemove unused dependency 67/103967/1
Robert Varga [Wed, 27 Apr 2022 19:22:24 +0000 (21:22 +0200)]
Remove unused dependency

yang-xpath-impl does not use concepts, remove the declaration.

Change-Id: I313cb8c5ff183f4c457e1973078e6857ff132889
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 13dbb9f3822644f0efce4dac225e9bb49fe3b9cf)

15 months agoAllow unqualified node-identifiers in instance-identifier 58/103958/5
Ruslan Kashapov [Mon, 24 Oct 2022 13:04:41 +0000 (16:04 +0300)]
Allow unqualified node-identifiers in instance-identifier

node-identifier has an optional prefix, make sure we reflect this in our
class design.

JIRA: YANGTOOLS-1361
Change-Id: I928eabf5d2508d9be1390f7662998829cb06af81
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 173787948ff24c4098602e351fb097a55a4ffd85)

15 months agoCorrect instance-identifier escaping 57/103957/4
Robert Varga [Tue, 3 Jan 2023 15:39:04 +0000 (16:39 +0100)]
Correct instance-identifier escaping

Dealing with single-quoted and double-quoted strings in
instance-identifier differs quite a bit. In order to deal with these
strings, we need to differentiate them in lexer, for which we create
separate modes.

This forces us to explicitly define lexer lokens and only match raw
strings in their mode -- ensuring there are no surprises.

JIRA: YANGTOOLS-1458
Change-Id: I3f58c10f068da1128d8a7c1c5bed3917bfea0c78
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 45e8951a576c6bf2cb2bd0290167619b8be2fc5a)

15 months agoForce instanceIdentifier to consume all input 56/103956/1
Robert Varga [Tue, 3 Jan 2023 19:25:10 +0000 (20:25 +0100)]
Force instanceIdentifier to consume all input

We need ANTLR to completely process the input string, hence force an EOF
token in instanceIdentifier.

JIRA: YANGTOOLS-1361
Change-Id: I80f1b326a47857e4e8f36c568901d19f771cef96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9eda34f44f1fc1027c357ad02923484e16b6ac0c)

15 months agoFix InstanceIdentifierParser's lexer 55/103955/1
Robert Varga [Tue, 3 Jan 2023 19:21:08 +0000 (20:21 +0100)]
Fix InstanceIdentifierParser's lexer

We have a day-0 bug here: we are using xpathLexer instead of
instanceIdentifierLexer.

JIRA: YANGTOOLS-1361
Change-Id: Ic4c074577c8a6fce9fbc22ef5da8e54b5df75faa
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8175666c67304af22cda102db8a183784b659799)

15 months agoGuarantee LocationPath.Absolute from implementation 54/103954/1
Robert Varga [Tue, 3 Jan 2023 18:14:52 +0000 (19:14 +0100)]
Guarantee LocationPath.Absolute from implementation

This makes it more type-safe to operate on tests etc.

Change-Id: Ib325c31092519e0644f02608cbca55e3dbca81b6
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 53407d16787eeef7e59dab3199cfa16447d653a0)

15 months agoDo not suppress 'uses' node effects 37/103737/1
Sangwook Ha [Sun, 4 Dec 2022 06:00:47 +0000 (22:00 -0800)]
Do not suppress 'uses' node effects

Parser tries to process an 'augment' statement with 'if-feature' and
fails when the feature is not supported and the 'augment' statement
targets a node defined with a nested grouping and dependent on the
feature.

Add a test case (4th one) to reproduce the issue. The other test cases
show that there is no parsing issue if the augmentation target node is
defined with a single grouping or feature is supported.

The problem here is not AugmentStatementSupport, but rather
UsesStatementSupport, which fails to propagate children when if-feature
is in effect -- hence those children never make it to the schema tree,
and hence fail to be looked up.

Use 'uses' statement's if-feature to mark any children as unsupporte,
hence they are reflected in namespaces, but they will not be built.

JIRA: YANGTOOLS-1471
Change-Id: Ibd86530388a99ed3c8ade7bf9af109c6a0cfb80a
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4ad4e83aa9150c6c32af1e04fc879e844edae5cd)
(cherry picked from commit 3d3cd8719491b8bdbdcfc18b66e390cc46d01abd)

15 months agoModernize UsesStatementSupport a bit 36/103736/1
Robert Varga [Wed, 21 Dec 2022 20:31:00 +0000 (21:31 +0100)]
Modernize UsesStatementSupport a bit

Use Java 11 trivial features to clean up logic.

Change-Id: Id4f5d68726acafe7ecdf3e7739719d0619925fca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8ec4aaf5743b34a74e58907a18ebcebbfd585d60)
(cherry picked from commit fef7b7364c5bf46d3736d7a86bc5ff7f51c7b536)

15 months agoFix unique statement argument propagation 35/103735/1
Sangwook Ha [Sat, 3 Dec 2022 23:19:45 +0000 (15:19 -0800)]
Fix unique statement argument propagation

Augmentation to the list with a unique statement from a module different
from the one where the list is defined causes SourceException which
complains that the argument node of the unique statement does not exist.

This turns out to have already been flagged with a FIXME -- this
behaviour has been there since forever.

The correct behaviour is to use a StatementPolicy.copyDeclared() and
adjust QNames in the argument's Descendants.

JIRA: YANGTOOLS-1470
Change-Id: Ib2cd23d50cd881d2ae94dbc0b271b5d481c9f55c
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit 7e849648fed0d0a195f83d43d1a7d015478ad1eb)

16 months agoBump versions to 8.0.10-SNAPSHOT 34/103434/1
Robert Varga [Sun, 27 Nov 2022 13:13:08 +0000 (14:13 +0100)]
Bump versions to 8.0.10-SNAPSHOT

This starts the next development iteration.

Change-Id: I964c7bb55bc1f18957464b07be6df0cb8cfe68c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoBump odlparent to 10.0.5 04/103404/1
Robert Varga [Fri, 25 Nov 2022 17:30:18 +0000 (18:30 +0100)]
Bump odlparent to 10.0.5

Adopt latest fixes from upstream.

Change-Id: Ica7e256665e47f591ed77d5977f07b6ba03e0912
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoFix isSupportedToBuildEffective() propagation 54/103354/2
Robert Varga [Tue, 22 Nov 2022 17:47:49 +0000 (18:47 +0100)]
Fix isSupportedToBuildEffective() propagation

InferredStatementContext has bad interaction with ImplictStmtCtx -- the
latter fizzles when it is not supported by features. This leads to a
failure to build effective context, as the prototype cannot be built and
therefore an attempt to reuse it fails.

Adjust InferredStatementContext to check if its prototype can be built
and carry over that fact when it is not.

JIRA: YANGTOOLS-1465
Change-Id: Iad05b0c6a06b6d9f837b70ced0da8cdc8ed3ed97
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e31531765d8ae6e3bc36f3de4ae4e14e06568e83)

16 months agoFix yang-xpath-impl package import 56/103256/1
Robert Varga [Tue, 22 Nov 2022 12:06:18 +0000 (13:06 +0100)]
Fix yang-xpath-impl package import

The dependency on javax.inject should be optional, make sure that is the
case.

JIRA: YANGTOOLS-1467
Change-Id: Ic005d463e65bd8596fe586bb64272e966a6d1693
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 94f35afbda71f4a07a44ef0cee54923bd8f7e5ec)

17 months agoFix NPE when parsing deviation from submodule 84/103284/1
Ruslan Kashapov [Tue, 15 Nov 2022 15:41:31 +0000 (17:41 +0200)]
Fix NPE when parsing deviation from submodule

If the deviation statement is used in a submodule, we need to lookup up
the corresponding module, otherwise we will not find the correct
namespace.

JIRA: YANGTOOLS-1448
Change-Id: Iaf2e1d6526a9f268a6c0a3835e1bfdfafa05fffe
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 274de5b85ab4626c0ba6f79c38e8dd2e5b0eddcb)
(cherry picked from commit 049a6ac5bbc8d535a15bcad8c6fc879e2c533881)

17 months agoEnable deviation substatement validation 82/103282/1
Robert Varga [Wed, 16 Nov 2022 19:47:04 +0000 (20:47 +0100)]
Enable deviation substatement validation

Make sure we call super, as that circles back to our validator.

Change-Id: I41dcaa3a48b98cb09a348349a56263a4936ea5bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b6ebfe2a7cebefe8755e6c40c88267adf65fb2ee)
(cherry picked from commit 9e67acedcda87140581b36133efd006aaa55aed7)

17 months agoReproduce YANGTOOLS-1445 79/103279/1
Sangwook Ha [Tue, 12 Jul 2022 22:26:01 +0000 (15:26 -0700)]
Reproduce YANGTOOLS-1445

Building effective model fails when unique statement is used in a
grouping used by another grouping.

Add a test case (the third one) to reproduce the issue. There is no
issue when the unique statement is used in a single grouping like the
first two test cases.

JIRA: YANGTOOLS-1445
Change-Id: Idadfb6e8fc0bf724f0ff770d9fe986692e4b30eb
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit 4bfd28bd20bcdb401b8a612ffbd6eadf8ca4b904)

17 months agoCatch duplicate instantiation of statements 78/103278/1
Robert Varga [Tue, 15 Nov 2022 22:30:15 +0000 (23:30 +0100)]
Catch duplicate instantiation of statements

The problem here is that during tryToReusePrototype() we are copying
child statements, which in turn are triggering onStatementAdded(). For
unique statements this incurs a SchemaTreeNamespace requirement on the
target leaf -- which is satisified via requestSchemaTreeChild() and
recorded in substatements (as partial materialization) and it is also
recorded in the schema tree namespace. When this happens, though,
effectiveCopy() does not notice the statement has already been copied
and copies it again, and thus ends up colliding in the schema tree
namespace -- pointing to the same statement as the source of the
problem.

Update effectiveCopy() to re-examing substatements to see if they
reflect partial materialization and pick copied statement from there.

JIRA: YANGTOOLS-1445
Change-Id: Ic184f872bf21e3e3c112b4fb5960fbe44262c77e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a14125cf6968d126396fc19849b63c29e4f865f6)

17 months agoBump versions to 8.0.9-SNAPSHOT 19/102919/1
Robert Varga [Fri, 28 Oct 2022 13:13:17 +0000 (15:13 +0200)]
Bump versions to 8.0.9-SNAPSHOT

This starts the next development iteration.

Change-Id: I96586041f3face54ad9c60542508e3b4dab2304c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump odlparent to 10.0.4 50/102850/1
Robert Varga [Mon, 24 Oct 2022 14:49:18 +0000 (16:49 +0200)]
Bump odlparent to 10.0.4

This adopts latest updates.

Change-Id: I8e7f2e5e44647bb4f69438bf608ceb4ad227b506
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoReduce code duplication in InferredStatementContext 56/102656/1
Robert Varga [Tue, 4 Oct 2022 13:15:11 +0000 (15:15 +0200)]
Reduce code duplication in InferredStatementContext

We are treating declared/effective copies the same way -- isolate
duplicated code into utility methods.

Change-Id: I1faa7348fb7185a60abeec75c041aa0466998b00
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e0a8b628efee26ec871f3ba6df65049fd7bc7311)
(cherry picked from commit 41e765bb5128e374ced9f193feb6adb2e0dbc954)

18 months agoImprove StatementContextBase.stream{Declared,Effective} 55/102655/1
Robert Varga [Tue, 4 Oct 2022 13:08:07 +0000 (15:08 +0200)]
Improve StatementContextBase.stream{Declared,Effective}

We have an implementation invariant of returning ReactorStmtCtx,
make sure we expose it, removing the need for unchecked casts.

Change-Id: I7b4ab5c1032d719520bcdf046045bd6638aea13a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a964a780e67e0f094f275a35c20a9079cb902a47)
(cherry picked from commit ab263aa272315113adaa6f01f2cba2ecc28f473f)

18 months agoFix yang-data extension definition 54/102654/2
Peter Suna [Thu, 26 May 2022 09:58:49 +0000 (11:58 +0200)]
Fix yang-data extension definition

The definition on ietf-restconf's yang-data is being rather exploited in
the wild, with a license to contain choices and anydata. These are
essentially allowed by other tooling, hence we need to also relax our
requirements.

This implies we cannot really expose the container directly, but rather
have to implement DataNodeContainer instead -- with the implied API
breakage. This is fine due to @Beta-level contract of all interfaces
involved.

Since we are breaking semantics here, also ditch the notion that the
yang-data argument can be parsed into a QName and instead reuse the
schema tree child's QName as the value required by SchemaNode contract.

JIRA: YANGTOOLS-1443
Change-Id: I3f78f71ea2980bf84f409d1ec89979e9e7b200ae
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6dec3b24ef9055b777e7ea09b2006a1f867da827)
(cherry picked from commit 1f2a1155b4ea207bdea255b794beb0b4d0ba4971)

18 months agoFix DataTreeCandidateNodes handling of deleted nodes 39/102539/1
Robert Varga [Mon, 3 Oct 2022 08:42:11 +0000 (10:42 +0200)]
Fix DataTreeCandidateNodes handling of deleted nodes

Recursive candidate should be used only for DistinctNodeContainer,
not all NormalizedNodeContainers. Fix the check so that we do not hit a
ClassCastException.

JIRA: YANGTOOLS-1455
Change-Id: I6a89f8e59a7f8d8b36c5c5d2990290f66f79f529
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a3bdb0fbc05db361f7c105469ffd73b1e35390be)

19 months agoBump versions to 8.0.8-SNAPSHOT 74/102174/1
Robert Varga [Fri, 19 Aug 2022 22:33:50 +0000 (00:33 +0200)]
Bump versions to 8.0.8-SNAPSHOT

This starts the next development iteration.

Change-Id: I5c6660a3be6e7695354a9a3df44a80d5ed1c8f4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoDo not use substatements in StmtContextUtils.getRootModuleQName() 34/102134/1
Sangwook Ha [Tue, 7 Jun 2022 21:12:36 +0000 (14:12 -0700)]
Do not use substatements in StmtContextUtils.getRootModuleQName()

Building effective model fails when a grouping in a submodule
is augmented from another submodule or the unique statement points
to a leaf in a grouping from another submodule.

Add test cases to reproduce the issues, which points to us accessing
substatements of submodules after all references have been resolved.

Since we already rely on SOURCE_LINKAGE being complete in this method
(e.g. ModuleCtxToModuleQName being populated), switch from using
statement enumeration to also using the BelongsToPrefixToModuleCtx
namespace, which resolved during that same phase.

JIRA: YANGTOOLS-1436
Change-Id: I71eb1122bf7c3820043a3197249a3b2fba6e9e8c
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 30f4e375338124bbb66d2bf1e1c65d0968fd1f0e)

20 months agoAdd SSv1 27/102127/2
Robert Varga [Wed, 17 Aug 2022 07:42:35 +0000 (09:42 +0200)]
Add SSv1

Add a serialization proxy for SingletonSet, so that we have explicit
control over the format.

Change-Id: Iedf53fe200215fbe1236464677e42b7d27d0caf5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3e086972fad7b1d81b8a9d3e4ed0f84f2e8822fe)

20 months agoFixup IOMv1 17/102117/1
Robert Varga [Tue, 16 Aug 2022 21:50:36 +0000 (23:50 +0200)]
Fixup IOMv1

We are missing serialVersionUID, fix that up.

Change-Id: I21b8f7146a52f8c6c004df30acf386086a452d8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8165d1ca88da1ba03aa13e25aa69326fad7cf1d8)

20 months agoAdd IOMv1 proxy 16/102116/1
Robert Varga [Wed, 10 Aug 2022 22:14:27 +0000 (00:14 +0200)]
Add IOMv1 proxy

ImmutableOffsetMap is using ugly reflection, which we are ditching. Add
the serialization proxy for compatibility.

Change-Id: I8687eee174462f62cdba927eb7c6d7386f7009ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1c1146b3a6a4dffa1d5b2e679ab82755456d123e)

20 months agoBump odlparent to 10.0.3 01/102001/1
Robert Varga [Sun, 7 Aug 2022 21:31:52 +0000 (23:31 +0200)]
Bump odlparent to 10.0.3

Pick up latest upgrades from upstream.

Change-Id: Ibbfc5f597678309a5e565f1d13fbd7324392afbc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoAdd test for statement prerequisites and materialization 17/101917/2
Peter Suna [Fri, 29 Jul 2022 14:21:19 +0000 (16:21 +0200)]
Add test for statement prerequisites and materialization

Add test to Building SchemaContext when augmenting submodel container
with unique leafs inside list.

JIRA: YANGTOOLS-1434
Change-Id: I8e1984bc00ca94f72a264d20925ab55721cb0ccc
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoUpdate yang-maven-plugin requirements 77/101577/1
Robert Varga [Mon, 13 Jun 2022 10:56:31 +0000 (12:56 +0200)]
Update yang-maven-plugin requirements

We require maven-3.8, make sure we update our dependencies.

Change-Id: I0b20df4f138377b1ff2ef9382a0e366c8fbbfa79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7717f9aefbaa5e5eb2d58525e88ee632a924b78a)

22 months agoBump versions to 8.0.7-SNAPSHOT 92/101292/1
Robert Varga [Wed, 25 May 2022 14:27:04 +0000 (16:27 +0200)]
Bump versions to 8.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: I7398af7da22e491567933f774f3700be66ad9b4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 months agoNormalize Decimal64 to fraction-digits 88/101288/2
Robert Varga [Mon, 23 May 2022 18:19:57 +0000 (20:19 +0200)]
Normalize Decimal64 to fraction-digits

When parsing a Decimal64, we need to scale it to fraction-digits
to ensure the input matches the expected range.

JIRA: YANGTOOLS-1437
Change-Id: I535eab4a20d30a742e94c3a6342e113cb569d0bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 415dfd816cdbefe5088ee62046f372690ab89aa7)

22 months agoAdd Decimal64.scaleTo() 87/101287/2
Robert Varga [Wed, 25 May 2022 08:27:47 +0000 (10:27 +0200)]
Add Decimal64.scaleTo()

Decimal64.valueOf(String) results in variable-scale results, based on
the input string. This is sub-optimal when we want to compare values
of particular type -- those should be governed by fraction-digits and
hence, for example "2.00" and "2.0" should be normalized to the same
scale.

Introduce Decimal64.scaleTo(), which can be used to adjust the scale
of an existing Decimal64.

JIRA: YANGTOOLS-1440
Change-Id: Icbc215dff6d8146996c5be1040751fd1e14b6cfe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c6624c7716ea59e4df3cb7bf90d172e81a544be5)

22 months agoAdd AbstractConstraint.toString() 86/101286/1
Robert Varga [Wed, 25 May 2022 09:18:08 +0000 (11:18 +0200)]
Add AbstractConstraint.toString()

Resolved constraints do not have a nice toString() method, making
debugging harder than it needs to be. Add a toString() method which
exposes allowed ranges, which is usually what we need to know.

Change-Id: Ib3a8caa67a765cb29db0b2b28509f07a4c1058ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a44ecea920d25ff2ebe030ede7347a871f689462)

22 months agoUse diamond notation for ClassValue subclass 85/101285/1
Robert Varga [Wed, 25 May 2022 08:39:29 +0000 (10:39 +0200)]
Use diamond notation for ClassValue subclass

Our Java version can now infer the type, remove redundant specifier.

Change-Id: I7829922ae645e4acc53986bd369753de0987736c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 062f71a50e4ac6ff83f8f6078f54ae7056ebe688)

22 months agoUse Long.{MIN,MAX}_VALUE instead of open-coded value 84/101284/1
Robert Varga [Tue, 24 May 2022 19:18:18 +0000 (21:18 +0200)]
Use Long.{MIN,MAX}_VALUE instead of open-coded value

Java is giving us convenient constants, use them.

Change-Id: Ic62d89a60618fad1555a9651a65846f229218f0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit eec7d0dd680ac6773090703d5ff7ec2588cc8123)

22 months agoImprove Decimal64 scale check 83/101283/1
Robert Varga [Tue, 24 May 2022 17:42:05 +0000 (19:42 +0200)]
Improve Decimal64 scale check

Add a proper message to the IllegalArgumentException reported.

Change-Id: Ie183dd9461540fb668de87b5f6b68a35d9bc5f07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d239965ba7cbdff1fe76d5def8d775abd40e2cc5)

22 months agoFix Decimal64.toString() 74/101274/1
Robert Varga [Tue, 24 May 2022 12:21:26 +0000 (14:21 +0200)]
Fix Decimal64.toString()

intPart() does not carry the sign when the leading part is zero, hence
we need to adjust for that.

JIRA: YANGTOOLS-1438
Change-Id: I5049650b0997e6543455542d48b3f2dcdd02bc4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 59b48fd2b49f11a6381fa0e1cacb20e447a23924)

23 months agoUpdate javadoc links 53/101253/1
Robert Varga [Thu, 19 May 2022 18:28:50 +0000 (20:28 +0200)]
Update javadoc links

We have some out-dated links, update them.

Change-Id: I18b539d31ff3f4385c9996f553a180c64275def5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9d01534dd1e53d665429af4375cafd58c8dbbfc1)

23 months agoFix statement prerequisites and materialization 57/101157/1
Robert Varga [Tue, 17 May 2022 10:57:32 +0000 (12:57 +0200)]
Fix statement prerequisites and materialization

We are firing onStatementAdded() when copying statements, which means
that:
a) a new inference requirement may be created during inferred
   statemenent materialization
b) the inference requirement may be immediately available in effective
   model

In order to deal with this, ModifierImpl has to always go through a
bootstrap, so that it prerequisites only trigger once an action is
registered.

Furthermore InferredStatementContext needs always instantiate the map
for partial instantiations so as to deal with namespace-driven
instantiations happening while full instantiation is going on.

JIRA: YANGTOOLS-1434
Change-Id: I86dae587c1fe5804cd983c194903e1975f257408
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a257eeb5333f6719db8afed7258fa0ce3dbdc0ae)

23 months agoReturn ReactorStmtCtx from ensureCompletedPhase() 90/101190/1
Robert Varga [Tue, 17 May 2022 18:44:15 +0000 (20:44 +0200)]
Return ReactorStmtCtx from ensureCompletedPhase()

We end up casting things around the verification done by
ensureCompletedPhase(). Just return the verified statement, which allows
us to tighten the signature of buffer collections.

Change-Id: Id812948f0229b112d9da64ed8d09e916daa62cd9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ec5d670bb05546d4b7f941ade28765115b6e8533)

23 months agoIntegrate cast into verifyStatement() 89/101189/1
Robert Varga [Tue, 17 May 2022 18:39:38 +0000 (20:39 +0200)]
Integrate cast into verifyStatement()

We end up casting the statement in most cases, integrate it into
verifyStatement().

Change-Id: Ia0365c4e731e864431eeebdf95773b3da7a31774
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 34e08e56d4c5edf1fffbd1d67f07bdcbe2e7492f)

23 months agoShortcut statement completion 88/101188/1
Robert Varga [Tue, 17 May 2022 18:33:49 +0000 (20:33 +0200)]
Shortcut statement completion

We know we have a ReactorStmtCtx, there is no need to verify it again.

Change-Id: I15e9a4badf43f9d7004142cef0e583fa3a884140
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 68228ffdae8f6528dddae59bc80e77df679680f1)

23 months agoBump versions to 8.0.6-SNAPSHOT 59/101059/1
Robert Varga [Wed, 11 May 2022 09:12:38 +0000 (11:12 +0200)]
Bump versions to 8.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I1b49631c32ff580a02f4cc9f2a6621d25159f185
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoFix nested augmentations 57/101057/1
Robert Varga [Tue, 10 May 2022 06:01:21 +0000 (08:01 +0200)]
Fix nested augmentations

When we are entering an augmentation, we need to look at the effective
instantiation. For DataNodeContainers that means using
EffectiveAugmentationSchema to get the correct filter, for choices we do
not have a utility, so just retain the same parent.

JIRA: YANGTOOLS-1433
Change-Id: I0aa36499a5bcf6088be5b49b79d202f8985f5eca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d79a5579918d5110599bdcc225c927c0225a177f)

23 months agoReformulate YangInstanceIdentifierWriterTest 54/101054/2
Robert Varga [Tue, 10 May 2022 16:32:48 +0000 (18:32 +0200)]
Reformulate YangInstanceIdentifierWriterTest

We have SchemaNode mocking going on here, which we really do not need --
just define the corresponding models and use YANG parser to create the
underlying schema.

JIRA: YANGTOOLS-1433
Change-Id: I861df0d4170737e4ecac0f64b6016d5f259332af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3f0eb0fab6a771c8b849504e1dbb0f929c8cac23)

23 months agoFix pom.xml format 53/101053/1
Robert Varga [Tue, 10 May 2022 16:27:39 +0000 (18:27 +0200)]
Fix pom.xml format

We should have four spaces here.

Change-Id: Ie9a7adeb7add53825ae5409f72e67b12ac5e9c7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d3abb24e25ef457e2ae065cf10453d5c27c6277c)

23 months agoBump versions to 8.0.5-SNAPSHOT 19/101019/1
Robert Varga [Mon, 9 May 2022 19:48:03 +0000 (21:48 +0200)]
Bump versions to 8.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: Icee82c65daf3fcba48d6db2560a92958f4b9258a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoDeprecate findSemanticVersion() 15/101015/1
Robert Varga [Wed, 4 May 2022 10:07:44 +0000 (12:07 +0200)]
Deprecate findSemanticVersion()

Semantic versions are deprecated pending a fresh sstart, so we do not
need findSemanticVersion().

Change-Id: I9d05d81c072472225285ecca48e51aa3e7efa309
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f25cb98d9eaf4cae7c6a0d357d6cde60f5a8d9d5)

23 months agoDeprecate BasicCodeGenerator's SEMVER_LATEST mode 14/101014/1
Robert Varga [Wed, 4 May 2022 09:41:35 +0000 (11:41 +0200)]
Deprecate BasicCodeGenerator's SEMVER_LATEST mode

The entire class is deprecated, but make sure we mark SEMVER_LATEST
import resolution mode as deprecated for removal.

Change-Id: Ia088bf319435966acdb70ab93c56f2082d114c76
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 891481a9e0a38715e65098622eb673a79a423ad1)

23 months agoFix OpenConfigConstants 13/101013/1
Robert Varga [Mon, 9 May 2022 08:39:19 +0000 (10:39 +0200)]
Fix OpenConfigConstants

The name of the module is not correct, it should be
openconfig-extensions.

Change-Id: If38676aa836e283349f60d9c630f60f4dba85116
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 508abdacda12a78c292ef5ced6808d874ac9ee5e)

23 months agoFixup yang-parser-api module a bit 75/100975/1
Robert Varga [Thu, 5 May 2022 00:01:05 +0000 (02:01 +0200)]
Fixup yang-parser-api module a bit

Do not rely on concepts being pulled in, require them explicitly.

Change-Id: Ia0add6933624a650910064459075d7f5b171e55f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7af45a8d0497ffa96d8f7348c8fcda5390706300)

23 months agoDeprecate getSemanticVersion() for removal 70/100970/1
Robert Varga [Tue, 3 May 2022 21:51:59 +0000 (23:51 +0200)]
Deprecate getSemanticVersion() for removal

NETMOD WG has a versioning proposal which will supersede OpenConfig,
deprecate API elements which are tied to OpenConfig versioning.

Change-Id: I2bbe1a8e6be78ecc5e911a367b0893515beaa836
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c0d06277f302d4febde802d92008434f53fb6216)

23 months agoFix if-feature propagation for implicit case statements 53/100953/1
Peter Suna [Tue, 3 May 2022 12:33:42 +0000 (14:33 +0200)]
Fix if-feature propagation for implicit case statements

Implicit statements created during parse must not be propagated
if their child statement is not supported by features or otherwise
unavailable.

This really can only happen when we are creating an implicit declaration
on the parser side, as in other code paths the substatement is already
completely defined.

JIRA: YANGTOOLS-1431
Change-Id: I5797f09c795587c91f10c7f92a6a8c9fd2480213
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit bc84355a85cafb4d8257a0e397c1efb2409aaf2e)

23 months agoFix failure source not being reported 50/100950/1
Robert Varga [Tue, 3 May 2022 17:27:59 +0000 (19:27 +0200)]
Fix failure source not being reported

When the parser fails with a well-known exception, extract the
SourceIdentifier of the failed YANG source.

JIRA: YANGTOOLS-1428
Change-Id: Ib40b01a977131ce1d244be5bd4e67c39e04ab626
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6dd19d2f87b3391b95d8087a3ff025c5414fd4e9)

23 months agoPrint out available augmentations 08/100608/1
Robert Varga [Tue, 3 May 2022 14:43:32 +0000 (16:43 +0200)]
Print out available augmentations

We seem to be facing a weird failure to look up augmentations, make
sure we report what is available.

Change-Id: Ifd9d27175bc90abfbba1a5e60935dc41cb01fc16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit dc3e4b5e8be164fd0c5332828c7d7a629f388a46)

23 months agoBump odlparent to 10.0.2 19/100919/1
Robert Varga [Mon, 2 May 2022 15:17:31 +0000 (17:17 +0200)]
Bump odlparent to 10.0.2

Pick up fixed-up jre.properties.

Change-Id: I870e88a432001f156f8b2c9a40fc44aabcadc011
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoBump odlparent to 10.0.1 02/100502/5
Robert Varga [Sat, 9 Apr 2022 19:17:56 +0000 (21:17 +0200)]
Bump odlparent to 10.0.1

Pick up latest upgrades from upstream. This requires fixing up JPMS
module references, as metainf-services added (finally) an
Automatic-Module-Name declaration.

Change-Id: I914ec18ad583e347b7a2707cefbca37d9307741c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoFix the short option for 'no-warning-for-unkeyed-lists' 95/100595/1
Sangwook Ha [Fri, 22 Apr 2022 16:13:03 +0000 (09:13 -0700)]
Fix the short option for 'no-warning-for-unkeyed-lists'

Dash "-" is not allowed in the short option string. Replace it
with 'K', a single character option consistent with others.

Having two options to control warnings on the unkeyed list,
although mutually exclusive, makes the default behavior unclear
when neither option is used.

Simplify the options by removing 'warning-for-unkeyed-lists'
while preserving the original default behavior of warning against
unkeyed lists when neither option is used.

JIRA: YANGTOOLS-1429
Change-Id: I6c37892ae7e39864420a0e6c15dd2fc1cf0ba952
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit db8732c024c02cadb7814149fe23fab85533944b)

2 years agoRemove odl-yangtools-exp-data-xpath-(api) 89/100589/1
Robert Varga [Thu, 14 Apr 2022 07:24:04 +0000 (09:24 +0200)]
Remove odl-yangtools-exp-data-xpath-(api)

These features are no longer built, remove references to them.

Change-Id: I6132390698fe65b5de98f224785dbc2c883e23b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9d515287c089fc2ed582d852d7f8afe3fccf53a8)

2 years agoBump versions to 8.0.4-SNAPSHOT 71/100571/1
Robert Varga [Thu, 14 Apr 2022 06:23:03 +0000 (08:23 +0200)]
Bump versions to 8.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I171cbb7a6d0acdc49d8cfbeaa1ce9b5e90e019ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a knob to control warnings about unkeyed lists 03/100003/9
Samuel Schneider [Tue, 8 Mar 2022 12:56:24 +0000 (13:56 +0100)]
Add a knob to control warnings about unkeyed lists

Warnings about unkeyed lists with config true are now can now be
enabled (default) or disabled as needed. Also upgrades commons-cli
version to 1.5.0:

https://commons.apache.org/proper/commons-cli/changes-report.html#a1.5.0

JIRA: YANGTOOLS-1397
Change-Id: I8d576b18098421f16a83eb3c31d8c3a80966c4cb
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump argparse4j to 0.9.0 21/100521/2
Robert Varga [Sun, 10 Apr 2022 18:26:20 +0000 (20:26 +0200)]
Bump argparse4j to 0.9.0

https://github.com/argparse4j/argparse4j/releases/tag/argparse4j-0.7.0
https://github.com/argparse4j/argparse4j/releases/tag/argparse4j-0.8.0
https://github.com/argparse4j/argparse4j/releases/tag/argparse4j-0.8.1
https://github.com/argparse4j/argparse4j/releases/tag/argparse4j-0.9.0

Change-Id: I8effcb21fb5cdfaeb63a6c3a20deabaa2ecb54d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd DefaultSchemaTreeInference.unsafeOf() 14/100414/14
Samuel Schneider [Tue, 5 Apr 2022 11:23:48 +0000 (13:23 +0200)]
Add DefaultSchemaTreeInference.unsafeOf()

SchemaInferenceStack is routinely converted to DefaultSchemaTreeInference
as well as reconstructed from it. This process currently involves
a complete schema tree walk in both directions.

Introduce DefaultSchemaTreeInference.unsafeOf() which nominally trusts
the provided argument, so that we use it as is. The method can be
instructed to verify the provided argument by setting a system property.

On the SchemaInferenceStack side, trust the documented well-formedness
of DefaultSchemaTreeInference.

JIRA: YANGTOOLS-1414
Change-Id: Ifa2f0418c561795595d8dae70f6b0c61a33d8f43
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate DataNodeAggregator for removal 18/100518/1
Robert Varga [Sun, 10 Apr 2022 15:33:52 +0000 (17:33 +0200)]
Deprecate DataNodeAggregator for removal

This class is not used anywhere, deprecate it for removal.

Change-Id: I451dfae18b5511437f960c747a73720698ae29c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not use Byte for test values 10/100510/1
Robert Varga [Sat, 9 Apr 2022 22:21:00 +0000 (00:21 +0200)]
Do not use Byte for test values

We have a number of JDK warnings, make sure we use a dedicated class
for testing.

Change-Id: Ie5e4e68bb8e59c309be729ef0c627e6ac1e408d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove unneeded public keyword 01/100501/1
Robert Varga [Sat, 9 Apr 2022 20:00:22 +0000 (22:00 +0200)]
Remove unneeded public keyword

Upgraded checkstyle is detecting this omission.

Change-Id: Id531602d14557c85c0a57163a4632fa2f7028e97
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFurther cleanup of tests 98/100398/1
Robert Varga [Tue, 5 Apr 2022 01:36:34 +0000 (03:36 +0200)]
Further cleanup of tests

Convert more tests to use AbstractYangTest's assertions.

Change-Id: Ib6efc701ba59d3c5323b8e69cfb51a2d22700e53
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFurther testing cleanup 97/100397/1
Robert Varga [Mon, 4 Apr 2022 23:24:32 +0000 (01:24 +0200)]
Further testing cleanup

Remove more StmtTestUtils duplication.

Change-Id: Icd8798d8f89c6fdd3a526347e0b2a182189c1110
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSimplify createFeaturesSet() 96/100396/1
Robert Varga [Mon, 4 Apr 2022 22:55:39 +0000 (00:55 +0200)]
Simplify createFeaturesSet()

We can express this method in terms of a Stream transformation, saving
us an intermediate HashSet.

Change-Id: I26649e4d9d43bf288053dc76c1324db1d7cf9e1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove unused parseYangSources() methods 95/100395/1
Robert Varga [Mon, 4 Apr 2022 22:52:08 +0000 (00:52 +0200)]
Remove unused parseYangSources() methods

There are no callers of these methods, remove them.

Change-Id: I8642954e15ee7ff1fe27a5df88839ac8dba239fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove StmtTestUtils.findModules() 94/100394/1
Robert Varga [Mon, 4 Apr 2022 22:48:24 +0000 (00:48 +0200)]
Remove StmtTestUtils.findModules()

SchemaContext provide findModules(String), which serves the same
purpose, remove the utility method.

Change-Id: I5f2b7cae56f8d1af404117580d1ecced160e0f7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate unicode blocks for Java 11 89/100389/3
Robert Varga [Mon, 4 Apr 2022 21:31:29 +0000 (23:31 +0200)]
Update unicode blocks for Java 11

Java 11 supports Unicode 11, bringing in a number of blocks we have
previously not covered.

JIRA: YANGTOOLS-1419
Change-Id: I15aa6aac9d905840f6387691301fe6ab651c694d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdjust message parsing to account for JDK-8230338 88/100388/2
Robert Varga [Mon, 4 Apr 2022 20:48:14 +0000 (22:48 +0200)]
Adjust message parsing to account for JDK-8230338

JDK14 changed the error reporting string, which makes our algorithm
fail. Make sure we account for it.

JIRA: YANGTOOLS-1418
Change-Id: Iea9866c6f98508851f0d558d7e2422740e91ef87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSimplify Bug4079Test 87/100387/1
Robert Varga [Mon, 4 Apr 2022 20:03:35 +0000 (22:03 +0200)]
Simplify Bug4079Test

We have a metric ton of duplication here, add a internal utility assert
and clean up the test.

Change-Id: Idedd591b97bafbc172b23ee566b44633a69b0cae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCheck null returns from NamespaceContext 69/100369/1
Robert Varga [Sun, 3 Apr 2022 20:21:49 +0000 (22:21 +0200)]
Check null returns from NamespaceContext

If we have a prefix that is not bould in the NamespaceContext, its
getNamespaceURI() will return null. checkArgument() such return to
provide better diagnostic than the implied NPE from XMLNamespace.

Change-Id: Ia49a9dbdf5dd4a3b8608f1e63dd0390130312897
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix assertion import 64/100364/1
Robert Varga [Sat, 2 Apr 2022 12:13:54 +0000 (14:13 +0200)]
Fix assertion import

Let's not use jupieter.api just yet here.

Change-Id: I4645f4c476f9d2cc544a39b0b1ad5ce6c93873fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>