yangtools.git
19 months agoImprove StatementContextBase.stream{Declared,Effective} 54/102554/2
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>
19 months agoSeal PathArgumentList 38/102038/4
Robert Varga [Wed, 10 Aug 2022 14:51:03 +0000 (16:51 +0200)]
Seal PathArgumentList

We have only two possible subclasses, make sure we use a sealed class
for that.

Change-Id: Ibb0297a660c0d61e766ee0fd8303500c44efd1dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoEnforce range constraints in DecimalStringCodec 56/102056/8
OleksandrZharov [Thu, 11 Aug 2022 10:16:49 +0000 (12:16 +0200)]
Enforce range constraints in DecimalStringCodec

Added check which will report YangInvalidValueException if the parsed
value doesn't match range constraints specified in DecimalTypeDefinition.
Added explicit test for this change.

JIRA: YANGTOOLS-1442
Change-Id: I7a00fb540ae64e8f5bdde58aa7297e0e5f91d780
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoFix DataTreeCandidateNodes handling of deleted nodes 36/102536/5
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>
19 months agoClean up TerminalDataTreeCandidateNode 34/102534/3
Robert Varga [Mon, 3 Oct 2022 08:36:24 +0000 (10:36 +0200)]
Clean up TerminalDataTreeCandidateNode

This class is supposed to be final and we should be mapping Optionals
instead of explicit isPreset/get calls.

Change-Id: Id30df72c8afe95c64dafe17a34f06eef01569535
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoCleanup DataTreeCandidatesAggregateTest 37/102537/2
Robert Varga [Mon, 3 Oct 2022 09:30:03 +0000 (11:30 +0200)]
Cleanup DataTreeCandidatesAggregateTest

Use static import for ModificationType and prefer
Optional.orElseThrow().

Change-Id: Ie977782ccad84ebaf2b6e3cc9f3667f3e9b151dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoImprove StmtContext.copyAsChild() type safety 16/102516/1
Robert Varga [Fri, 30 Sep 2022 12:58:02 +0000 (14:58 +0200)]
Improve StmtContext.copyAsChild() type safety

We should not be losing A/D/E type capture, but rather propagate it.

Change-Id: I6254a4f0ef0fea5b79815e99d1e6b03d33f679e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoUse enhanced for loop 15/102515/1
Robert Varga [Fri, 30 Sep 2022 12:56:54 +0000 (14:56 +0200)]
Use enhanced for loop

We are using simple iteration, hence we can hide the original iterator.

Change-Id: I4eb7300023581132a424d7bca99ac6541085011e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd FIXMEs to IdentifierNamespace 72/102172/2
Robert Varga [Fri, 19 Aug 2022 21:25:15 +0000 (23:25 +0200)]
Add FIXMEs to IdentifierNamespace

This namespace is using Class-based addressing, which is ugly from end
user as well as expresiveness perspective.

Change-Id: I6d5c9b09845b144bf138c248580cd0bdef6ee08e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMake ParserNamespace final 71/102171/2
Robert Varga [Fri, 19 Aug 2022 20:44:32 +0000 (22:44 +0200)]
Make ParserNamespace final

SchemaTreeNamespace does not bring much to the picture, remove it
and make ParserNamespace a final class.

JIRA: YANGTOOLS-1453
Change-Id: I7dbffb9f3ab109a418fcafb59a464aab156c710b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMove SchemaTreeNamespace.findNode() 70/102170/3
Robert Varga [Fri, 19 Aug 2022 13:15:12 +0000 (15:15 +0200)]
Move SchemaTreeNamespace.findNode()

SchemaTreeNamespace as a separate class may be going away, let's
migrate its utility method to a different place.

JIRA: YANGTOOLS-1453
Change-Id: Iabee4a009591af75aa46560d09e15b1043abeabd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove Source{ParserNamespaces,NamespaceBehaviours} 57/102157/2
Robert Varga [Thu, 18 Aug 2022 21:45:48 +0000 (23:45 +0200)]
Remove Source{ParserNamespaces,NamespaceBehaviours}

There is no point in keeping two classes, as the namespaces are wild and
dis-organized anyway.

JIRA: YANGTOOLS-1453
Change-Id: I359af4e37334354354e1f59cccda5b56ff1ab9a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoImprove ParserNamespace type safety 56/102156/2
Robert Varga [Thu, 18 Aug 2022 20:56:19 +0000 (22:56 +0200)]
Improve ParserNamespace type safety

Specify concrete argument types to prevent any shenaningans.

JIRA: YANGTOOLS-1453
Change-Id: I1d82058e92f2afe0de740df1093ea43f12cb7244
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove StatementNamespace 53/102153/3
Robert Varga [Thu, 18 Aug 2022 16:05:03 +0000 (18:05 +0200)]
Remove StatementNamespace

This is a pure type capture of keys and values, let's remove the
indirection. This also improves type safety of users, as we can cleanly
express StmtContext type (based on the ParserNamespace type).

JIRA: YANGTOOLS-1453
Change-Id: Icc626957b6b3b94c9cdd89a518be6037f4fdaaac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove ImportedNamespaceContext 52/102152/2
Robert Varga [Thu, 18 Aug 2022 15:41:25 +0000 (17:41 +0200)]
Remove ImportedNamespaceContext

This indirection is not actually useful, as it only captures generics.
Remove it to simplify our class hierarchy.

JIRA: YANGTOOLS-1453
Change-Id: I2eb4f247bb61f3547fc3a65e8a92ed7d44671e88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoEliminate StatementNamespace.TreeScoped 51/102151/2
Robert Varga [Thu, 18 Aug 2022 15:28:57 +0000 (17:28 +0200)]
Eliminate StatementNamespace.TreeScoped

This subclass is not really useful, as it just mirrors
NamespaceBehaviour.treeScoped(). Remove it to flatten the type hierarchy
a bit.

JIRA: YANGTOOLS-1453
Change-Id: I651c8682c1198c766fc6ad512bf444e9df77b365
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove ParserNamespace type captures 49/102149/6
Robert Varga [Thu, 18 Aug 2022 11:49:50 +0000 (13:49 +0200)]
Remove ParserNamespace type captures

We are overly-generifying the situation around namespaces. Just pass
objects down and stop worrying.

JIRA: YANGTOOLS-1453
Change-Id: Ieb937fcc68ee65d396f5faaa6b0f1f1a200499e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMake ParserNamespace an identifier 44/102144/12
Robert Varga [Thu, 18 Aug 2022 08:25:19 +0000 (10:25 +0200)]
Make ParserNamespace an identifier

We are using Class objects to identify namespaces. This patch makes
ParserNamespace an Identifier and uses it instead of Class to refer
to namespaces.

This has the side-effect of removing a ton of classes and turning them
into singleton objects instead.

JIRA: YANGTOOLS-1453
Change-ID: I796ecf22c2c22b512ef0db4d0d4a06b8ea69c23f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoTurn ParserNamespace into an abstract class 40/102140/18
Robert Varga [Wed, 17 Aug 2022 17:28:40 +0000 (19:28 +0200)]
Turn ParserNamespace into an abstract class

This is an effort to stop addressing namespaces through .class objects,
but rather through objects. As a first step switch to the hierarchy to
be based on an abstract class and make concrete namespaces final.

JIRA: YANGTOOLS-1453
Change-Id: Ib09406f8c4d667d45676c6cd3f01cd64434f1c0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoResolve SchemaTreeNamespace cognitive dissonance 46/102146/3
Robert Varga [Thu, 18 Aug 2022 07:44:24 +0000 (09:44 +0200)]
Resolve SchemaTreeNamespace cognitive dissonance

SchemaTreeNamespaces currently combines a ParserNamespace and a
NamespaceBehaviour. Split the two concerns so we can evolve them
further.

JIRA: YANGTOOLS-1453
Change-Id: I1624ef8795f236b2e440528bf43f10d9df2aface
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoResolve PrefixToModule cognitive dissonance 43/102143/6
Robert Varga [Wed, 17 Aug 2022 18:38:36 +0000 (20:38 +0200)]
Resolve PrefixToModule cognitive dissonance

This class serves two purposes: a namespace for reactor interactions
and XML source lookup. The second purpose is really a resolver
interface, split it out and clean up api/impl mess.

JIRA: YANGTOOLS-1452
Change-Id: I0fdfaee784a9c95bad0a64f746f0a1fe6412646e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove PrefixToModule.DEFAULT_PREFIX 42/102142/1
Robert Varga [Wed, 17 Aug 2022 18:35:32 +0000 (20:35 +0200)]
Remove PrefixToModule.DEFAULT_PREFIX

Remove this constant, as it's just getting in the way.

Change-Id: Ib19ededfbbcb9df310775a7d34d7090225cc86ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDeprecate PrefixToModule.DEFAULT_PREFIX 41/102141/1
Robert Varga [Wed, 17 Aug 2022 18:34:25 +0000 (20:34 +0200)]
Deprecate PrefixToModule.DEFAULT_PREFIX

There are no users, we are removing this constant. If it re-emerges, it
will be its proper semantic point with proper binding towards
XMLContants.

Change-Id: I9b36846dfbaa01084bb053f0f4f3625313671e8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoCleanup MutableOffsetMap a bit 37/102137/1
Robert Varga [Wed, 17 Aug 2022 15:41:57 +0000 (17:41 +0200)]
Cleanup MutableOffsetMap a bit

Use instanceof patterns and guarantee @NonNull clone().

Change-Id: I40efddbf0d248427cd9d01cd13ef26db94b0377a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd StmtContextUtils.getModuleQName() 32/102132/1
Robert Varga [Wed, 17 Aug 2022 13:39:36 +0000 (15:39 +0200)]
Add StmtContextUtils.getModuleQName()

We can make things safer by requiring a RootStmtContext, which in turn
allows us to take a slight shortcut.

Change-Id: I200ff520eeca5d3ff5a3653988257fe379e5763e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use substatements in StmtContextUtils.getRootModuleQName() 88/101488/7
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>
21 months agoRemove BelongsToModuleContext 31/102131/1
Robert Varga [Wed, 17 Aug 2022 11:32:50 +0000 (13:32 +0200)]
Remove BelongsToModuleContext

This namespace is not really useful, as it can contain really just a
single mapping (due to belongs-to cardinality). Also the key is never
used, which means BelongsToPrefixToModuleCtx can serve exactly the same
needs.

Change-Id: I08d92148f330fc0da8ff99443bdce270def3924c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse List for importedNamespace 30/102130/1
Robert Varga [Wed, 17 Aug 2022 11:15:21 +0000 (13:15 +0200)]
Use List for importedNamespace

Collection is too vague and we always implement it with a List, make
sure that is reflected in the declaration.

Change-Id: I1323e9649427ca31d9884f3a8d9c2fd221df933a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove old YangInstanceIdentifier serialization 23/102123/4
Robert Varga [Wed, 17 Aug 2022 08:13:23 +0000 (10:13 +0200)]
Remove old YangInstanceIdentifier serialization

YangInstanceIdentifier is written out through YIDv1 since version 3.0.0,
there is no point in supporting direct serialization methods anymore.
This has a nice effect of ditching reflection.

Change-Id: I50ad185df83b88495cb1fc1024170dcb4cd41ade
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove NIPv1 22/102122/3
Robert Varga [Wed, 17 Aug 2022 08:07:16 +0000 (10:07 +0200)]
Remove NIPv1

This serialization proxy has been deprecated since 4.0.0, remove it as
we should not be encountering it anymore.

Change-Id: I040e4c347662f7ca684ab910db3f6a800e996ccf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSprinkle @Serial annotations on yang-data-api 21/102121/3
Robert Varga [Wed, 17 Aug 2022 08:01:23 +0000 (10:01 +0200)]
Sprinkle @Serial annotations on yang-data-api

We are about to move forward on serialization, make sure the methods are
properly annotated.

Change-Id: I3613ab4436d4503a0117983d5e4cd3254e48b95d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal SingletonSet 44/102044/19
Robert Varga [Wed, 10 Aug 2022 21:25:14 +0000 (23:25 +0200)]
Seal SingletonSet

We cannot have an anonymous subclass and also seal it. Since we have
solved the writeout path, we can just rely on SSv1 to do the most of the
lifting and break the format.

Change-Id: I34177672db7a2f1d91731978205d20e76353aaa7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse SSv1 during writeout 19/102119/2
Robert Varga [Wed, 17 Aug 2022 07:45:08 +0000 (09:45 +0200)]
Use SSv1 during writeout

Make sure we are not dependent on SingletonSet hierarchy in
serialization writeout path.

Change-Id: I7b602f166bccc418ea27af0b887f5868fadbf9e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd SSv1 18/102118/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>
21 months agoUse instanceof pattern in SingletonSet 03/102103/1
Robert Varga [Wed, 17 Aug 2022 06:45:54 +0000 (08:45 +0200)]
Use instanceof pattern in SingletonSet

We can simplify our equals() implementation a bit, let's do that.

Change-Id: I6b0d18ca1be2762cf5709857975a58a68ace6599
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAssume serialization proxy 47/102047/13
Robert Varga [Wed, 10 Aug 2022 22:21:15 +0000 (00:21 +0200)]
Assume serialization proxy

Ditch reflexive access in favor of the (smaller) serialization proxy.
Since we have introduced writeReplace() before, we can now assume fields
are not touched. Ditches troublesome reflection.

Change-Id: I837fe0379c77542f2de2ea54d6e563d491f1a8db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse serialization proxy for ImmutableOffsetMap 46/102046/11
Robert Varga [Wed, 10 Aug 2022 22:15:54 +0000 (00:15 +0200)]
Use serialization proxy for ImmutableOffsetMap

This patch switches to using an Externalizable proxy, allowing us to
properly inject fields.

Change-Id: I2a556713f2ab47a3ea1fabff7a5e45da02494c81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoFixup IOMv1 01/102101/2
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>
21 months agoAdd IOMv1 proxy 45/102045/8
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>
21 months agoRemove unneeded @NonNull 00/102100/1
Robert Varga [Tue, 16 Aug 2022 19:53:05 +0000 (21:53 +0200)]
Remove unneeded @NonNull

The contract is specified by super, no need for these.

Change-Id: I93638a90eace123c1a4c7ea33d93a1f2d1de067a

21 months agoUse instanceof patterns in MutableOffsetMap 48/102048/4
Robert Varga [Wed, 10 Aug 2022 22:42:19 +0000 (00:42 +0200)]
Use instanceof patterns in MutableOffsetMap

We can simplify the code a bit through patterns.

Change-Id: I9fecdeebfa308485bbb57081ced484d4426aa6ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal util classes 43/102043/2
Robert Varga [Wed, 10 Aug 2022 20:21:28 +0000 (22:21 +0200)]
Seal util classes

Most of our utility classes can be safely sealed, make sure we do that.

Change-Id: Iea937912d2a586f13963141727f29f97b004958c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse @Serial in util 42/102042/2
Robert Varga [Wed, 10 Aug 2022 19:59:37 +0000 (21:59 +0200)]
Use @Serial in util

This improves code safety quite a bit and allows us to perform a
long-needed audit.

Change-Id: I04161cfe8e6a367e1ae0d53a2628fbf72035ecde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse instanceof patterns 41/102041/1
Robert Varga [Wed, 10 Aug 2022 20:04:26 +0000 (22:04 +0200)]
Use instanceof patterns

We can simplify the code a bit by using pattern matching.

Change-Id: I08d9239f056ec46d4fe796ea07cc889e0298f003
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove model.api.SchemaPath 51/97351/10
Robert Varga [Sat, 28 Aug 2021 01:41:27 +0000 (03:41 +0200)]
Remove model.api.SchemaPath

SchemaPath is of no further use to us. Purge it with fire.

JIRA: YANGTOOLS-1236
Change-Id: Ib66523e2393f526d64c111684f7bb308fdb6512c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in SchemaInferenceStack 10/102010/4
Robert Varga [Mon, 8 Aug 2022 09:05:59 +0000 (11:05 +0200)]
Do not use SchemaPath in SchemaInferenceStack

We have alternative ways of instantiation, do not reference SchemaPath.

Change-Id: I1c36c8d167d1c374399cb0f1ee29d7778a852f3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in LeafRefContext 36/102036/2
Robert Varga [Wed, 10 Aug 2022 14:24:58 +0000 (16:24 +0200)]
Do not use SchemaPath in LeafRefContext

Use a simple immutable list instead of SchemaPath.

JIRA: YANGTOOLS-1236
Change-Id: I430671a1ac078718e03af3417f01470567c5e744
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse instanceof pattern 35/102035/2
Robert Varga [Wed, 10 Aug 2022 13:20:23 +0000 (15:20 +0200)]
Use instanceof pattern

We can simplify things a bit by removing unneeded casts.

Change-Id: I553f14e70e5f1d6caa497b5fa4644367303fecf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not iterate over SchemaPath 34/102034/1
Robert Varga [Wed, 10 Aug 2022 12:33:17 +0000 (14:33 +0200)]
Do not iterate over SchemaPath

We are exposing a List here, so we can things a tad more efficiently.

Change-Id: I310b626f5b8e7b94ca0cfade03833a0774931dab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse instanceof patterns 33/102033/1
Robert Varga [Wed, 10 Aug 2022 11:10:28 +0000 (13:10 +0200)]
Use instanceof patterns

Modernize this a bit to remove unneeded casts.

Change-Id: I2ebe44acd6c056f089198ccab9109b1a5ac9447e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoClean up RangeRestrictedTypeBuilder a bit 32/102032/1
Robert Varga [Wed, 10 Aug 2022 10:42:39 +0000 (12:42 +0200)]
Clean up RangeRestrictedTypeBuilder a bit

Use local variable type inference.

Change-Id: Ieac651d4ad84c9813f6cbf446e0f76eda783007c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoNormalize Decimal64 scale in range constraints 65/101765/27
OleksandrZharov [Thu, 7 Jul 2022 11:08:47 +0000 (13:08 +0200)]
Normalize Decimal64 scale in range constraints

Modified logic of DecimalTypeBuilder to ensure proper scale
of fraction-digits. Updated test in order to ensure that range
constraints are correct.

JIRA: YANGTOOLS-1441
Change-Id: I01ac7c7d940119f76867b15a3aaff50b3cd983e0
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove support for reading/writing SchemaPaths 11/102011/4
Robert Varga [Mon, 8 Aug 2022 09:18:27 +0000 (11:18 +0200)]
Remove support for reading/writing SchemaPaths

SchemaPaths are no longer used anywhere downstream, remove support for
their IO.

JIRA: YANGTOOLS-1244
Change-Id: I8992ff3e789b8e9a007678b7a72b793db638db6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in NormalizedNodeStreamWriterStack 09/102009/4
Robert Varga [Mon, 8 Aug 2022 08:58:39 +0000 (10:58 +0200)]
Do not use SchemaPath in NormalizedNodeStreamWriterStack

We have alternative ways of instantiation, do not reference SchemaPath.

JIRA: YANGTOOLS-1244
Change-Id: I9621d1f2a1f5fe2fc01035a9916a9f9ba394434d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not reference SchemaPath in yang-data-impl 08/102008/4
Robert Varga [Mon, 8 Aug 2022 09:08:47 +0000 (11:08 +0200)]
Do not reference SchemaPath in yang-data-impl

We have alternative instantiation methods fro
SchemaOrderedNormalizedNodeWriter. Do not reference SchemaPath.

JIRA: YANGTOOLS-1244
Change-Id: Ieab738b98f5ebea8e9c7388f35a4ff3a998b197d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in yang-data-codec-xml 07/102007/4
Robert Varga [Mon, 8 Aug 2022 08:52:33 +0000 (10:52 +0200)]
Do not use SchemaPath in yang-data-codec-xml

The methods using SchemaPath have been deprecated for removal, now
remove them.

JIRA: YANGTOOLS-1244
Change-Id: Ibc54bbf4a90fe9e327d42ba261c5a67abbbb8f11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in yang-data-codec-gson 05/102005/5
Robert Varga [Mon, 8 Aug 2022 08:39:00 +0000 (10:39 +0200)]
Do not use SchemaPath in yang-data-codec-gson

SchemaPath is going away, do not reference in GSON-based codec.

JIRA: YANGTOOLS-1244
Change-Id: I1da70a13abda2196e2f453316efd2a9d181d73c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove DeviateKind.getArgument() 27/102027/2
Robert Varga [Tue, 9 Aug 2022 19:52:00 +0000 (21:52 +0200)]
Remove DeviateKind.getArgument()

This method has been deprecated and there are no users: remove it.

Change-Id: I50e1152035aef7e2d8ad9f370480deb9a7aa5c56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoBump versions to 10.0.0-SNAPSHOT 26/102026/1
Robert Varga [Tue, 9 Aug 2022 19:49:28 +0000 (21:49 +0200)]
Bump versions to 10.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: I7bd72f517b4f90205359c15a0334d9ee881873b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove use of DeviateKind.getKeyword() 25/102025/1
Robert Varga [Tue, 9 Aug 2022 19:46:30 +0000 (21:46 +0200)]
Remove use of DeviateKind.getKeyword()

Update javadoc and use argument() instead.

Change-Id: Id5af2a39bb253d610fc30ebe5264d3537e04886c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse concrete implementation for base decimal constraints 24/102024/1
Robert Varga [Tue, 9 Aug 2022 17:39:21 +0000 (19:39 +0200)]
Use concrete implementation for base decimal constraints

There are package-internal constants, make sure we advertize the fact
they are resolved.

Change-Id: Iaf5d8419385955531b8f627ec8a9f7d3432ab7ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal SchemaNodeIdentifier 20/102020/3
Robert Varga [Tue, 9 Aug 2022 16:49:39 +0000 (18:49 +0200)]
Seal SchemaNodeIdentifier

We do not allow SchemaNodeIdentifier to be subclassed outside of its
package, make sure the compiler understands that as well.

Change-Id: Ia61cebfa30bc77b8055d3b7c4e01fef73b7b067f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal ValueRange 19/102019/1
Robert Varga [Tue, 9 Aug 2022 16:30:38 +0000 (18:30 +0200)]
Seal ValueRange

We really want to make sure we only use the two provided instantiations,
make sure to seal the base class.

Change-Id: I8bd1530fbe5874f37e3998fd528ee0cd48d54373
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoGuarantee @NonNull return from ValueRange 18/102018/1
Robert Varga [Tue, 9 Aug 2022 16:30:04 +0000 (18:30 +0200)]
Guarantee @NonNull return from ValueRange

We always return a non-null, make sure we express that.

Change-Id: I737065b6f87e6891f4b43d500443a5bb12cffdfc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse instanceof pattern match in ValueRange 17/102017/1
Robert Varga [Tue, 9 Aug 2022 16:28:59 +0000 (18:28 +0200)]
Use instanceof pattern match in ValueRange

This simplifies the equality contract a bit.

Change-Id: Ie59c58e70e8c7de2b1898f58c99c84694073f86a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd support for RFC8819 "module-tag" extension 42/100542/31
ivan.martiniak [Fri, 6 May 2022 10:30:39 +0000 (12:30 +0200)]
Add support for RFC8819 "module-tag" extension

Schema context successfully recognizes ModuleTagEffectiveStatementImpl
object, raw representation in the yang file: tags:module-tag "ietf:tag";
Module-tag extension is fully supported.

JIRA: YANGTOOLS-1315
Change-Id: I5ce2ce7ae57febf80c71de68bc37422e5a5431f7
Signed-off-by: Ivan Martiniak <ivan.martiniak@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDeprecate XMLStreamNormalizedNodeStreamWriter.create() 04/102004/3
Robert Varga [Mon, 8 Aug 2022 08:43:49 +0000 (10:43 +0200)]
Deprecate XMLStreamNormalizedNodeStreamWriter.create()

SchemaPath is going away, let's make sure users are guided towards
alternative methods.

JIRA: YANGTOOLS-1451
Change-Id: Id49381cfd0d0b46f623b223c4f23127c14d26134
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMark deprecated methods for removal 03/102003/2
Robert Varga [Mon, 8 Aug 2022 08:38:13 +0000 (10:38 +0200)]
Mark deprecated methods for removal

We have a number of methods deprecated, but not marked for removal.
Update them along with the release where they were deprecated.

Change-Id: I20d56689d1c0349dc8f41b823d293576f40b5bb7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove a SchemaPath reference 06/102006/1
Robert Varga [Mon, 8 Aug 2022 08:54:29 +0000 (10:54 +0200)]
Remove a SchemaPath reference

We have a replacement construct, which accurately captures statement
hierarchy. Use that in javadocs instead of SchemaPath.

Change-Id: I1a5e02a5515a000826c458adee378a451c39f9c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoConvert yang-data-codec-gson to JPMS 00/102000/8
Robert Varga [Sun, 7 Aug 2022 19:33:14 +0000 (21:33 +0200)]
Convert yang-data-codec-gson to JPMS

This is an automatic module, jump the ship and become a full module.

JIRA: YANGTOOLS-1449
Change-Id: Ib1847be1e684e3a694f110d8a3d6b0166d52259c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoClean up JSONNormalizedNodeStreamWriter 02/102002/1
Robert Varga [Sun, 7 Aug 2022 19:31:05 +0000 (21:31 +0200)]
Clean up JSONNormalizedNodeStreamWriter

This was missed in review, fix it up.

Change-Id: Ibad2e8f1a9e156bacce83eba3cde7cfd690e65bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDeprecate JSONNormalizedNodeStreamWriter.create*Writer() 99/101999/7
Robert Varga [Sun, 7 Aug 2022 19:31:05 +0000 (21:31 +0200)]
Deprecate JSONNormalizedNodeStreamWriter.create*Writer()

Deprecate methods that use SchemaPath for identification. Introduce
replacatement methods where appropriate.

JIRA: YANGTOOLS-1450
Change-Id: I7418873de01094aed75670cbfea18d221224814d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoIntegrate JSONCodecFactory specializations 96/101996/7
Robert Varga [Sun, 7 Aug 2022 18:33:31 +0000 (20:33 +0200)]
Integrate JSONCodecFactory specializations

There is no point in keeping simple subclasses separate, move them
to be nest-mates and tighen them up. This also integrates
JSONInstanceIdentifierCodec, as it provides some brevity.

Change-Id: Iaea1cb529603976324516516a7f172b33f68e127
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal JSONCodecFactory 95/101995/6
Robert Varga [Sun, 7 Aug 2022 18:28:10 +0000 (20:28 +0200)]
Seal JSONCodecFactory

The factory can only be instantiated from within the package due to
package-private constructor. It is therefore safe to seal.

Change-Id: Ia03e553b6ee9a3080aad6112278cea45cab99da7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoCleanup Bug5446Test 98/101998/2
Robert Varga [Sun, 7 Aug 2022 19:18:33 +0000 (21:18 +0200)]
Cleanup Bug5446Test

Change-Id: I2ec91057ccdd9b84bf04c8abcf48ed30119719d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoFix a null warning 97/101997/2
Robert Varga [Sun, 7 Aug 2022 18:59:02 +0000 (20:59 +0200)]
Fix a null warning

Bug4501Test should require the node to be present before accessing
its body.

Change-Id: Iec99007f73aae3735a1baba94f1944abaed20c34
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoBump odlparent to 11.0.1 96/101796/3
Robert Varga [Mon, 11 Jul 2022 11:05:34 +0000 (13:05 +0200)]
Bump odlparent to 11.0.1

Pick up latest upgrades from upstream.

Change-Id: Ib23e45796564d846e7b72c9648f3fc9f185be0c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd test for statement prerequisites and materialization 26/101926/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>
21 months agoImprove Decimal64.toString() implementation 35/101635/22
OleksandrZharov [Tue, 28 Jun 2022 14:56:08 +0000 (16:56 +0200)]
Improve Decimal64.toString() implementation

Change implementation of Decimal64.toString() method to:
pad unscaled value to scale + 1 size string, insert '.',
and remove trailing zeros.

JIRA: YANGTOOLS-1439
Change-Id: Ifb21ce4cdcf17d91da669c8f2c5e73de6a3edf22
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoBump versions to 9.0.1-SNAPSHOT 11/101611/1
Robert Varga [Mon, 20 Jun 2022 12:20:38 +0000 (14:20 +0200)]
Bump versions to 9.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I293b34b52d8bf923dcb4af234b55207d0d8b4bf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCrossSourceStatementReactor.BuildAction should be final 10/101610/2
Robert Varga [Mon, 20 Jun 2022 12:11:59 +0000 (14:11 +0200)]
CrossSourceStatementReactor.BuildAction should be final

We do not want this class to be subclassed, make sure it is final.

Change-Id: I3f0e39b13a4f5b09fc454e27acd41a5229cf7a1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoAdd YangLibModule et al. 99/100999/16
Robert Varga [Thu, 5 May 2022 00:21:56 +0000 (02:21 +0200)]
Add YangLibModule et al.

Introduce ietf-yang-library equivalents and a resolver that trusts
them by default. This routes the information we need to the reactor.

JIRA: YANGTOOLS-837
Change-Id: Iab12347ea065f7d6351b0943ff3416fdb23eb0e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse AssertionError 09/101609/1
Robert Varga [Mon, 20 Jun 2022 11:39:07 +0000 (13:39 +0200)]
Use AssertionError

We have an accidental use of opentest4j, make sure we use plain
AssertionError.

Change-Id: I06e0b184fdc9d129d70ba927e8f6d0d9f4001ceb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUpdate yang-maven-plugin requirements 73/101573/2
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>
23 months agoMove (Abstract)IllegalArgumentCodec to yang.data.api.codec 61/100561/2
Robert Varga [Tue, 12 Apr 2022 11:18:46 +0000 (13:18 +0200)]
Move (Abstract)IllegalArgumentCodec to yang.data.api.codec

The only users of this construct live in yang-data-{api,util,impl}. Move
the contract there and un-deprecate it.

JIRA: YANGTOOLS-1332
Change-Id: Ie19b09e108a4bac8946c080da563fdb9ccdaae6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse assertInstanceOf 42/101542/1
Robert Varga [Thu, 9 Jun 2022 10:04:13 +0000 (12:04 +0200)]
Use assertInstanceOf

No need to use Hamcrest, as we have a JUnit5 version of this assertion.

Change-Id: Ibe915ea3d74bff941237d33ad33d002180958590
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-data-api to JUnit5 66/101466/1
Robert Varga [Mon, 6 Jun 2022 11:36:46 +0000 (13:36 +0200)]
Migrate yang-data-api to JUnit5

We have a few tests here, migrate them over.

Change-Id: I56dd6bbeda75a9225644aacb242ecc46a88878f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoFreeze odlparent at 11.0.0 65/101465/1
Robert Varga [Mon, 6 Jun 2022 11:07:46 +0000 (13:07 +0200)]
Freeze odlparent at 11.0.0

There is a release out there, use that instead of snapshots.

Change-Id: I411b2a7b0e850be56382be2f881211a5a74d18d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-common-netty to JUnit5 70/101370/2
Robert Varga [Mon, 30 May 2022 16:57:56 +0000 (18:57 +0200)]
Migrate yang-common-netty to JUnit5

We have only two tests, migrate them over.

Change-Id: I3a4bd9153cdae01e685b6cea02340611d500cb7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-xpath-impl to JUnit5 69/101369/2
Robert Varga [Mon, 30 May 2022 16:52:49 +0000 (18:52 +0200)]
Migrate yang-xpath-impl to JUnit5

We have only a single test, migrate it.

Change-Id: I046473eb56ff3f6869c96d169aab74bd605bbe9b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-repo-fs to JUnit5 66/101366/1
Robert Varga [Mon, 30 May 2022 16:38:09 +0000 (18:38 +0200)]
Migrate yang-repo-fs to JUnit5

These are simple tests, migrate them.

Change-Id: Ied27283b229ae27f8d5bef6b8af0554b5ade1bc9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoRemove YangTextSnippetIterator.Quoting 31/101331/10
Robert Varga [Sun, 29 May 2022 18:52:07 +0000 (20:52 +0200)]
Remove YangTextSnippetIterator.Quoting

Eliminate internal enum and inline the dispatch, eliminating the need
for a default case.

Change-Id: I1b728b5b1652bde5f044a9a4e57b30d53f27bfc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoModernize yang-parser-reactor 41/101341/4
Robert Varga [Sun, 29 May 2022 20:41:52 +0000 (22:41 +0200)]
Modernize yang-parser-reactor

Use switch expressions and pattern match on instanceof to improve code
density.

Change-Id: Ia49f28782258986393e8932403a8468210b84856
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse arrow cases in YT1193Test 40/101340/4
Robert Varga [Sun, 29 May 2022 20:40:33 +0000 (22:40 +0200)]
Use arrow cases in YT1193Test

Drop a few lines with a more expressive construct.

Change-Id: I3c68804d0ac8655c195c1c6b2fe95e057593b744
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse switch expression in yang-parser-impl 39/101339/4
Robert Varga [Sun, 29 May 2022 20:39:38 +0000 (22:39 +0200)]
Use switch expression in yang-parser-impl

A switch is more expressive, use it for initialization of reference
factory.

Change-Id: Ic2b9d2dd890c02f2189c632c8e1909cf62326c0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse switch expression in rfc6241 support 38/101338/4
Robert Varga [Sun, 29 May 2022 20:38:18 +0000 (22:38 +0200)]
Use switch expression in rfc6241 support

An expression is more dense.

Change-Id: I44f814369d9d0ce50de65117c109cfbbc65acda9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse switch expressions 37/101337/4
Robert Varga [Sun, 29 May 2022 20:00:45 +0000 (22:00 +0200)]
Use switch expressions

AbstractModifiedNodeBasedCandidateNode can prune default cases if we use
switch expressions.

Change-Id: I2a8dc3ce0b5cf875a5f09e3f0b242b712d806b7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse arrow case in ValueNodeModificationStrategy 36/101336/3
Robert Varga [Sun, 29 May 2022 19:54:06 +0000 (21:54 +0200)]
Use arrow case in ValueNodeModificationStrategy

Reduce verbosity by using non-fall-through arrow cases, improving
code density.

Change-Id: I0d5674a27f8c449b814ea37c0a5d94cae23336f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoModernize SchemaAwareApplyOperation 35/101335/3
Robert Varga [Sun, 29 May 2022 19:51:06 +0000 (21:51 +0200)]
Modernize SchemaAwareApplyOperation

Use instanceof pattern matching and modernize switch statement use,
by use of arrow cases and switch expressions.

Change-Id: Ieed9342918a627bb80968d4fd3ecab27203f6a1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoModernize switch use in ModifiedNode 34/101334/3
Robert Varga [Sun, 29 May 2022 19:45:34 +0000 (21:45 +0200)]
Modernize switch use in ModifiedNode

Use arrow cases and switch expressions to improve clarity.

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