yangtools.git
3 years agoExpose symbolic name in YangTextSchemaContextResolver 56/95856/2
Robert Varga [Tue, 20 Apr 2021 20:41:47 +0000 (22:41 +0200)]
Expose symbolic name in YangTextSchemaContextResolver

We have a perfectly reasonable symbolic name available here, make sure
we propagate it, aiding debugging.

JIRA: YANGTOOLS-1275
Change-Id: I60162a10da9356896cea5cb5abc2a233dea38c12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPropagate symbolic name through transformations 55/95855/2
Robert Varga [Tue, 20 Apr 2021 20:31:59 +0000 (22:31 +0200)]
Propagate symbolic name through transformations

Transformation to IRSchemaSource ends up losing source symbolic name,
leading to anonymous sources. Make sure we propagate any source
symbolic name.

JIRA: YANGTOOLS-1275
Change-Id: I219d4bffa66c1262683db1b6af886a052c644cde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove NormalizedNode.getNodeType() 11/95411/13
Robert Varga [Thu, 4 Mar 2021 14:50:32 +0000 (15:50 +0100)]
Remove NormalizedNode.getNodeType()

This method is a shortcut through getIdentifier().getNodeType(),
except it does not work in all circumstances. Remove it and let
users deal with augmentation specifics.

JIRA: YANGTOOLS-1074
Change-Id: If112167e2d98c59d92d6e071c510c8e3db97ca0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoOptimize SchemaOrderedNormalizedNodeWriter a bit 49/95849/3
Robert Varga [Tue, 20 Apr 2021 12:45:27 +0000 (14:45 +0200)]
Optimize SchemaOrderedNormalizedNodeWriter a bit

We have a wee bit of duplicate code here, which can be improved
and made static.

Change-Id: I357b4909f7c9b3997b4a38e9d38f01d41a94a217
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove schema-aware builders 46/95846/2
Robert Varga [Tue, 20 Apr 2021 01:17:12 +0000 (03:17 +0200)]
Remove schema-aware builders

Schema-aware builders are woefully incomplete and actually have weird
operations. Remove them to reduce confusion, as we will be replacing
them with a better alternative (at some point in future).

JIRA: YANGTOOLS-1249
Change-Id: I706a73c02d2493e486aeec0ce28cee118806fe49
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove ImmutableAugmentationNodeBuilder defensiveness 45/95845/1
Robert Varga [Mon, 19 Apr 2021 19:41:10 +0000 (21:41 +0200)]
Improve ImmutableAugmentationNodeBuilder defensiveness

The check for nested augmentations is rather ugly and will trigger
a secondary UnsupportedOperationException -- simply because we are
accessing getNodeType() even for AugmentationNodes.

Fix the thinko by performing an explicit check first, which also makes
things a wee bit faster.

Change-Id: I001c8d3b7c4a53ddb2c45d7c9157f7b1081dc992
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove resolveAugmentations() casts 44/95844/1
Robert Varga [Mon, 19 Apr 2021 19:34:45 +0000 (21:34 +0200)]
Improve resolveAugmentations() casts

Rather than performing weird casts without co-located checks, make sure
resolveAugmentations() takes an AugmentationNode, which makes it clear
that callers are always checking before dispatch.

Change-Id: I30aa7081d2097c4b2e257545798a2a3ba9c8281c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove ImmutableMapEntryNodeBuilder identifier handling 43/95843/1
Robert Varga [Mon, 19 Apr 2021 19:12:42 +0000 (21:12 +0200)]
Improve ImmutableMapEntryNodeBuilder identifier handling

We have duplicate decisions going on here, simplify them bye combining
the check-and-put operation.

Change-Id: Ib5dd56e49e3ac8248ddbded22ba0b71d227dc067
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSpeed up NormalizedNodeSchemaUtils.detectCase() 42/95842/1
Robert Varga [Mon, 19 Apr 2021 18:58:31 +0000 (20:58 +0200)]
Speed up NormalizedNodeSchemaUtils.detectCase()

We are dealing with two distinct cases here to side-step
AugmentationNode mechanics. Lift the check out of the loop, which allows
us to neatly expose a method to which callers can bind at compile time.

Change-Id: Id0a80b8e77a27905c8bf5753cfdfc3e97db84f38
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRename OrderedNodeContainer.getChild(int) 39/95839/2
Robert Varga [Mon, 19 Apr 2021 18:24:31 +0000 (20:24 +0200)]
Rename OrderedNodeContainer.getChild(int)

childAt(int) is a better name for this method, as it does not conflict
with other possible uses. Also move the FIXME related to body() type
override to the top of the class and make sure it does not contain
commented-out code.

JIRA: YANGTOOLS-1022
Change-Id: I583ede8fdd7e91748775475470b09c94b54d8cfe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPush out NormalizedNode fixmes 40/95840/2
Robert Varga [Mon, 19 Apr 2021 18:33:24 +0000 (20:33 +0200)]
Push out NormalizedNode fixmes

We do not have the runway to deal with the modeling changes required
here. Push them out to the next major release.

Change-Id: I9ed9ef3aaf2280089b90f1092836ae93e32e7a7c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix a package typo 38/95838/1
Robert Varga [Mon, 19 Apr 2021 17:24:21 +0000 (19:24 +0200)]
Fix a package typo

We have a simple typo in the name of the utility package. Fix it.

Change-Id: I2ac41870851e0bb495e1d47ef4489ba7092f7dc1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove ReactorStmtCtx.checkLocalNamespaceAllowed() 37/95837/1
Robert Varga [Mon, 19 Apr 2021 17:21:26 +0000 (19:21 +0200)]
Remove ReactorStmtCtx.checkLocalNamespaceAllowed()

This method is a rather expensive route towards a noop method in
StatementDefinitionContext. Since there is no routing, just hide the
method and note how it used to be routed and mark it for potential
removal in the next iteration.

Change-Id: I54492cd780c608e3a2c9f2ab0ff3f2d25219fa2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPush out ItemOrder FIXME 36/95836/1
Robert Varga [Mon, 19 Apr 2021 17:14:48 +0000 (19:14 +0200)]
Push out ItemOrder FIXME

We did not have enough time to evaluate ItemOrder contract, push the
FIXME out.

Change-Id: I4f2533f19cb077d741a64c67577a349dcda2e5a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup unrecognized statement wrapping 35/95835/1
Robert Varga [Mon, 19 Apr 2021 17:03:19 +0000 (19:03 +0200)]
Cleanup unrecognized statement wrapping

reactor/rfc7950 interaction around inner statements is a bit hacky
in that we end up performing two unrelated semantic checks before
dispatching.

As it turns out, though, this only a special case of a more widely
applicable pattern, where the parent statement chooses to wrap its
children in a different semantic support.

Separating this out makes the intent clear, as it ends up being an
extension trait to StatementSupport on the side of yang-parser-reactor
and has a well-understood anchor in UnrecognizedStatementSupport.

Change-Id: I3b64f58239e22affccc02921efd8cd70b411d7c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove StmtContextUtils.isUnrecognizedStatement() 34/95834/1
Robert Varga [Mon, 19 Apr 2021 16:13:46 +0000 (18:13 +0200)]
Remove StmtContextUtils.isUnrecognizedStatement()

This utility method is only used in reactor itself, rehost it to its
single caller.

Change-Id: I6b40e0fcd936cc230b1a9586d4f20c2ac47205ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRename StatementSource to StatementOrigin 33/95833/3
Robert Varga [Mon, 19 Apr 2021 14:45:36 +0000 (16:45 +0200)]
Rename StatementSource to StatementOrigin

'origin' is a less loaded word in that it does not have connotations
to 'source text' and similar.

JIRA: YANGTOOLS-1193
Change-Id: I07c611878f978e2ce30e1c3ad9422cb61744e6f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRename yangtools.concepts.Variant to Either 27/95827/3
Robert Varga [Mon, 19 Apr 2021 10:00:18 +0000 (12:00 +0200)]
Rename yangtools.concepts.Variant to Either

'either' is more well-known than our custom naming Variant. Let's
adjust the baseline naming without affecting the other parts of the API.

JIRA: YANGTOOLS-1142
Change-Id: I08005cefb4a2f9d128bd5a3a5718050d5d314182
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove NormalizedNode builders 28/95828/2
Robert Varga [Mon, 19 Apr 2021 11:09:14 +0000 (13:09 +0200)]
Move NormalizedNode builders

Builders have two API surfaces:
- acquisition of particular builders, which is implementation-specific
- actual Builder API shape, which is implementation-agnostic

Move the latter in yang-data-api, reducting overall dependencies on
yang-data-impl.

JIRA: YANGTOOLS-1273
Change-Id: I00dcffb0310afa1d5b0cbabba9983af4f6835f31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor IdentifierNamespace 05/95805/1
Robert Varga [Mon, 19 Apr 2021 08:12:07 +0000 (10:12 +0200)]
Refactor IdentifierNamespace

IdentifierNamespace.get() is not used anywhere, hence remove this
method. Furthermore this class is only used for specifying a key, hence
make sure it is an abstract class without the possibility of
instantiating.

JIRA: YANGTOOLS-1205
Change-Id: I56f22af2d4bb21caab5dd47da6dfa1b1753777cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove SchemaUtils to yang-data-util 03/95803/1
Robert Varga [Mon, 19 Apr 2021 07:40:26 +0000 (09:40 +0200)]
Move SchemaUtils to yang-data-util

yang-data-impl placement here is quite hurtful, as we have a few
downstream users. Move the class to yang-data-util, where it is more
accessible and mark it as @Beta for further evolution.

JIRA: YANGTOOLS-1248
Change-Id: If2eeeeb5b2313c3656fe348a3ce99fcf770d0f37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDo not allow nulls in NodeWithValue 42/84342/8
Robert Varga [Thu, 12 Sep 2019 15:11:39 +0000 (17:11 +0200)]
Do not allow nulls in NodeWithValue

We do not allow leaves to have a null value, hence the same
restriction should apply to NodeWithValue.

Change-Id: I4df0caf67baacf12d8b81b70dd447dff7e05a992
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 9.0.0 66/95666/7
Robert Varga [Sat, 3 Apr 2021 18:43:19 +0000 (20:43 +0200)]
Bump odlparent to 9.0.0

Adopt latest released odlparent.

Change-Id: If2e078cb4eaefe3192e79fc4be43b368411b516c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDitch Guava from ModuleDependencySortTest 58/95758/1
Robert Varga [Tue, 13 Apr 2021 09:24:18 +0000 (11:24 +0200)]
Ditch Guava from ModuleDependencySortTest

List.of()/Set.of() are adequate replacements for what we are doing here,
use them instead of Immutable{List,Set}.

Change-Id: Iebf600a8a36c0501c834f2a62d12e9b5588efbc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMore dependency updates 42/95742/2
Robert Varga [Sat, 10 Apr 2021 11:29:27 +0000 (13:29 +0200)]
More dependency updates

Dependency checking is pointing out a number of violations, this patch
fixes a few more components. Most notably odlext-parser-support needs
yang-parser-rfc7950 only with scope=test.

Change-Id: I0b8e1b6be2471e1beb625e81e8b10f2c35dff1d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup dependency declarations 41/95741/1
Robert Varga [Sat, 10 Apr 2021 10:38:28 +0000 (12:38 +0200)]
Cleanup dependency declarations

odlparent-9 is giving us the ability to enforce dependency declarations,
this fixes some of the more obvious violations reported.

Change-Id: If2ae4b84c03256ea757a0bbb2e59c036a5b043e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove AnyxmlSchemaLocationStatement 35/95735/3
Robert Varga [Fri, 9 Apr 2021 20:19:44 +0000 (22:19 +0200)]
Remove AnyxmlSchemaLocationStatement

This statement was never fully exposed to downstreams, as the
corresponding yang-ext model (in mdsal.git) was never updated with the
extension. Remove support for this extension.

JIRA: YANGTOOLS-1268
Change-Id: Ib0f493ca3f948aa9be97191df1b6a2d2146909a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCorrect Context{Instance,Reference} statements 34/95734/1
Robert Varga [Fri, 9 Apr 2021 13:20:19 +0000 (15:20 +0200)]
Correct Context{Instance,Reference} statements

context-instance and context-reference statements' argument is actually
a 'identifier-ref-arg-str' which points to a  much like the argument of
'base' in case of 'type identityref'.

Correct the argument definition and improve the definition of effective
statements to expose the referenced identity.

JIRA: YANGTOOLS-1196
Change-Id: I736df614f9d4c26e910ce78f8d6478a6735f3730
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaInferenceStack.enterSchemaTree(SchemaNodeIdentifier) 50/95550/1
Robert Varga [Wed, 24 Mar 2021 08:51:29 +0000 (09:51 +0100)]
Add SchemaInferenceStack.enterSchemaTree(SchemaNodeIdentifier)

SchemaNodeIdentifier is a well-known concept which we are integrating
with in multiple aspects. One key component is the ability to resolve
a SchemaNodeIdentifier in the context of an existing stack. While users
can do this easily themselves, it is more natural to provide this
ability out of the box.

JIRA: YANGTOOLS-1231
Change-Id: I9818f175d09fd4e6e4f610127929ee8553c3116e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCorrect AugmentIdentifier argument 40/95540/1
Robert Varga [Tue, 23 Mar 2021 10:06:56 +0000 (11:06 +0100)]
Correct AugmentIdentifier argument

augment-identifier extension requires argument matching node-identifier,
which is not a generic String, but rather UnqualifiedQName. Fix that.

JIRA: YANGTOOLS-1196
Change-Id: Ifee79fc8f9749d207ad19469493ad42b1a1c167f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate documentation. 07/95407/8
Iaroslav [Wed, 3 Mar 2021 13:33:59 +0000 (15:33 +0200)]
Update documentation.

Update development guide examples and text according to current code.

JIRA: YANGTOOLS-1263
Change-Id: Ic56431b10d0a734b607c15bf54784ee58b17c7e1
Signed-off-by: Iaroslav <iaroslav.kholiavko@pantheon.tech>
3 years agoMove AbstractEffectiveDocumentedNodeWithStatus to yang-model-spi 25/95525/1
Robert Varga [Thu, 18 Mar 2021 12:22:45 +0000 (13:22 +0100)]
Move AbstractEffectiveDocumentedNodeWithStatus to yang-model-spi

While the usage of this class is declining rapidly, it is independent
of yang-parser-spi constructs and hence can easily be hosted
in yang-model-spi instead. Move it.

JIRA: YANGTOOLS-1225
Change-Id: Ieca37d642d9fe77a187e2afc39538f0dfd0f957e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove XPathSupport 24/95524/1
Robert Varga [Thu, 18 Mar 2021 12:11:28 +0000 (13:11 +0100)]
Move XPathSupport

This is a simple utility class for remapping exceptions to parser
semantics. Rehost it into an unexported package, hiding it from users.

JIRA: YANGTOOLS-1241
Change-Id: Idf6a8e0b4160fa8845684468b0cea0b3116926f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoHide BaseImplicitStatementSupport 23/95523/1
Robert Varga [Thu, 18 Mar 2021 12:01:44 +0000 (13:01 +0100)]
Hide BaseImplicitStatementSupport

This class, along with BaseOperationContainerStatementSupport is
an internal implementation detail. Since we have moved all their
users into a single package, move them as well, hiding them in
process.

Change-Id: I6fc3a38373bb5dbe9e812db6809aa9627afae836
JIRA: YANGTOOLS-1241
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove KeyEffectiveStatement implementations 22/95522/1
Robert Varga [Thu, 18 Mar 2021 11:54:10 +0000 (12:54 +0100)]
Move KeyEffectiveStatement implementations

We have 4 different implementations, but there is no reason why
they'd need to reside in yang-parser-rfc7950. Move them to
yang-model-ri.

JIRA: YANGTOOLS-1241
Change-Id: Ibf0ac700bfb525fe4eefe28e6555cbf14a7551aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove EffectiveStatementState 19/95519/2
Robert Varga [Thu, 18 Mar 2021 08:18:01 +0000 (09:18 +0100)]
Remove EffectiveStatementState

This concept is used only by some orphan code, remove it along with
the unused complexity.

Change-Id: I496f67081360a4774d37f46ed8ee24fc99979265
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove EffectiveStatementStateAware 18/95518/1
Robert Varga [Thu, 18 Mar 2021 08:13:11 +0000 (09:13 +0100)]
Remove EffectiveStatementStateAware

This interface is not implemented anywhere, remove it.

Change-Id: I37909b06258ab207de1bc5832b6f62571396765c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd module-info for yang-data-codec-xml 16/95116/5
Robert Varga [Wed, 10 Feb 2021 14:15:45 +0000 (15:15 +0100)]
Add module-info for yang-data-codec-xml

Add a a simple module-info.java, eliminating the need to configure
maven-bundle-plugin.

JIRA: YANGTOOLS-1266
Change-Id: I0da9d85efcbaf909b62022dbbaa06210559cdb7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConvert yang-common-netty to JPMS 57/95457/1
Robert Varga [Wed, 10 Mar 2021 07:44:06 +0000 (08:44 +0100)]
Convert yang-common-netty to JPMS

This is a very simple component, convert it.

JIRA: YANGTOOLS-1265
Change-Id: Ibf95dbe1d00c9b2d629aa005388f30aa69374093
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate module-info.java 78/95278/12
Robert Varga [Mon, 22 Feb 2021 13:52:15 +0000 (14:52 +0100)]
Update module-info.java

Do not rely on transitive access to packages, spell them out. This makes
the development experience with Eclipse a bit better, as it does not end
up adding random requires.

Also hide a number of private constructs, so we do not need to re-export
imports where not needed.

JIRA: YANGTOOLS-932
Change-Id: I32431065724dee226754bfbd60ca70b839c4f49f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd missing serialVersionUUID 32/95432/1
Robert Varga [Tue, 9 Mar 2021 15:36:50 +0000 (16:36 +0100)]
Add missing serialVersionUUID

XNv1 should have a serial version, fix that.

Change-Id: Ia4cb70089312b57e1864bbfcde66c48ac4670cc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove ForwardingEffectiveStatement 31/95431/1
Robert Varga [Tue, 9 Mar 2021 15:27:33 +0000 (16:27 +0100)]
Remove ForwardingEffectiveStatement

This class is not used anywhere, remove it to simplify API.

Change-Id: I9ee0308e7e29bef2be4fbae6e55703f63d0a6d70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove 'must' statement implementations 20/95420/2
Robert Varga [Mon, 8 Mar 2021 08:13:50 +0000 (09:13 +0100)]
Move 'must' statement implementations

These are quite simple, move them out.

JIRA: YANGTOOLS-1241
Change-Id: I831799c52063c3c037eedb14a502eb2f7eeb6f67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPropagate cause in OperationFailedException 18/95418/2
Robert Varga [Sun, 7 Mar 2021 06:39:03 +0000 (07:39 +0100)]
Propagate cause in OperationFailedException

We are ignoring cause here and squash it to null, fix that.

Change-Id: I01d5144b3319485107579ddc67556e469e2154c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDataContainerNode is not generic 08/95408/3
Robert Varga [Thu, 4 Mar 2021 10:04:39 +0000 (11:04 +0100)]
DataContainerNode is not generic

DataContainerNode and its specializations are using generic type
to capture the result of getIdentifier(). This is not necessary,
as we can achieve the same effect by properly overriding
getIdentifier().

This leads to a simpler object model and better ergonomics, as
a significant number of wildcards are removed from related interfaces,
such as NormalizedNodeContainer and DistinctNodeContainer.

JIRA: YANGTOOLS-1022
Change-Id: Ibafca25dcdc20911ed5048776d1b7a6429ccf3cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove schemaNode.getPath reference 05/95405/1
miroslav.kovac [Tue, 2 Mar 2021 13:43:49 +0000 (14:43 +0100)]
Remove schemaNode.getPath reference

Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Change-Id: I8ea9b155ec61bec6be2ebaa6c3f6343779842aed

3 years agoAdd support for yang-ext extensions 97/95397/4
Robert Varga [Mon, 1 Mar 2021 15:03:56 +0000 (16:03 +0100)]
Add support for yang-ext extensions

MD-SAL is using these extension to assign an identifier to generated
augmentations. Since we stopped generating extensions which do not
have an explicit support, we need to add the supports.

JIRA: YANGTOOLS-1196
Change-Id: Ic0f02aa9e16f3b46efc755450833163b5c02c87a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix AbstractEffectiveStatementInference javadocs 81/95381/1
Robert Varga [Sun, 28 Feb 2021 11:57:41 +0000 (12:57 +0100)]
Fix AbstractEffectiveStatementInference javadocs

JDK15's javadoc is complaining about wrong documentation of
generic types, fix it.

Change-Id: Iec24b748ab634eff090f99b21c8b82349e834415
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix checkstyle 40/95340/2
Robert Varga [Wed, 24 Feb 2021 09:39:31 +0000 (10:39 +0100)]
Fix checkstyle

checkstyle-8.40 finds a few offenders, fix them up.

Change-Id: I31edb2a5f7da745d1a46e8d3518804a11edb55c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoTypeStatement takes a QName argument 63/95363/3
Robert Varga [Thu, 25 Feb 2021 18:56:29 +0000 (19:56 +0100)]
TypeStatement takes a QName argument

YANG 'type' statement has effective semantics attached to the
namespace where it is defined. These need to be captured into a
correct QName, so that users trying to infere on top of
TypeEffectiveStatement do not need to deal with interpreting
the value.

We even make it exceedingly difficult, as the statements have an
'exact replica' policy, hence the argument namespace is no way
related to parent namespace.

Change argument mapping of 'type' from String to QName. Introduce
the corresponding EffectiveStatementNamespace as well.

This changes the behavior of nested union typedefinitions, where
we would be confused as to the nested base type's namespace: since
it is a plain reference, it has to point to the YANG namespace,
not the model's.

JIRA: YANGTOOLS-1117
Change-Id: Ib44cb2796ba11de4a20d86c382d25e753c61279e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate OperationFailedException design 29/95329/2
Robert Varga [Tue, 23 Feb 2021 18:35:59 +0000 (19:35 +0100)]
Update OperationFailedException design

The constructors are a pure hell to work with. Add Collection-based
errors as well as a single-error constructor. Improve defences
against nulls while retaining reasonable behavior.

Change-Id: I80e0866170ae78edb0bcdf526465125ba956f90e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix StringStringCodec length check 33/95333/2
Robert Varga [Wed, 24 Feb 2021 08:47:30 +0000 (09:47 +0100)]
Fix StringStringCodec length check

RFC7950 specifies that string length is counted in unicode
characters. String.length() returns the length in code units of
UTF-16, which are not the same thing.

Use String.codePointCount() to get correct results for strings
containing characters from outside of Unicode BMP.

JIRA: YANGTOOLS-1224
Change-Id: I6ff9557d61449625be975eaca00ad235bf429155
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 8.1.1 25/95325/1
Robert Varga [Tue, 23 Feb 2021 15:38:31 +0000 (16:38 +0100)]
Bump odlparent to 8.1.1

Pick up latest upgrades from upstream.

Change-Id: I5cafb096b67910ec6f530aeef2b6639e2036b30b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSplit out yang-data-spi 35/95235/8
Robert Varga [Fri, 19 Feb 2021 13:15:11 +0000 (14:15 +0100)]
Split out yang-data-spi

We have some SPI contracts lurking in yang-data-api as well as
some a reusable baseline AbstractNormalizedNode in yang-data-impl.

Instantiate yang-data-spi to host these kinds of classes, allowing
a more ready reuse.

JIRA: YANGTOOLS-1257
Change-Id: I6a650d2f7df9a9e8621452cfbbe42be4d54834ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove case statement implementations 36/95236/1
Robert Varga [Fri, 19 Feb 2021 15:44:38 +0000 (16:44 +0100)]
Move case statement implementations

Case statements are rather simple, migrate them to yang-model-ri.

JIRA: YANGTOOLS-1241
Change-Id: I71e1992e51f219f20f82cd02a4c08005eb2ac72c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor SharedSchemaContextFactory 34/95234/5
Robert Varga [Fri, 19 Feb 2021 10:20:09 +0000 (11:20 +0100)]
Refactor SharedSchemaContextFactory

Update SharedSchemaContextFactory design by implementing an explicit
cache instead of attempting to use Guava. While this is a bit more
code, it solves the problem of initial thundering heard causing
concurrent EffectiveModelContext.

JIRA: YANGTOOLS-1252
Change-Id: If6e41a8611b650018a1b8961e9c945dfab1f1d88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove AbstractStatementSupport.createEmptyDeclared() 25/95225/2
Robert Varga [Thu, 18 Feb 2021 14:05:35 +0000 (15:05 +0100)]
Remove AbstractStatementSupport.createEmptyDeclared()

Checking statements at this level seems to be beneficial, but it is
not, as we end up traveling through additional API layer, which has
to redo the checking. Just remove the method and adjust users.

JIRA: YANGTOOLS-1241
Change-Id: Ic7bf001bc8cb6c4f259e951c9097864f8e423e70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCopyHistory should be an interface 19/95219/8
Robert Varga [Thu, 18 Feb 2021 00:25:14 +0000 (01:25 +0100)]
CopyHistory should be an interface

We currently use some complicated machinery to keep a low number
of CopyHistory instances. As it turns out, though, these objects
encode only 4 bits worth of information.

Turn CopyHistory into an interface and have StatementContextBase
implement it directly. This allows us to use a single byte to
realize its storage needs instead of having an explicit reference,
while also maintaining external interface.

Improvement in storage, coupled with the previous ExecutionOrder
work results in reduction of InferredStatementContext and
SubstatementContext by 0/8/8/16 bytes. We also have a 2-byte
alignment shadow in which we can store further state.

JIRA: YANGTOOLS-1255
JIRA: YANGTOOLS-1150
Change-Id: I04b8761cabc266ffc25cdeedc5a0fa1a0ffe424a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDefine ExecutionOrder 14/95214/13
Robert Varga [Wed, 17 Feb 2021 21:18:18 +0000 (22:18 +0100)]
Define ExecutionOrder

ModelProcessingPhase really amounts to an execution order, in that
the phases need to be executed serially.

Let's define a space for 127 values of ModelProcessingPhase by
defining ExecutionOrder, which is semantically the same thing (but
different).

Update StatementContextBase to store the execution order as single
byte instead of a reference. Doing so allows us to simplify some
of the verification logic, but most importantly it frees up
some space -- resulting in 3-7 bytes worth of internal space losses.

JIRA: YANGTOOLS-1254
JIRA: YANGTOOLS-1150
Change-Id: I3e5b23cae45798b4508dd9e270a4b0317613ed1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove even more statements 00/95200/8
Robert Varga [Wed, 17 Feb 2021 09:38:39 +0000 (10:38 +0100)]
Move even more statements

Move the next batch of effective statements to yang-model-ri, so
they are neatly isolated from the actual parser logic.

JIRA: YANGTOOLS-1241
Change-Id: Ib0cce9303cfbd61fbb3d606d7e5b8580fd170e54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd AbstractIdentityRefSpecificationSupport defences 21/95221/1
Robert Varga [Thu, 18 Feb 2021 00:45:17 +0000 (01:45 +0100)]
Add AbstractIdentityRefSpecificationSupport defences

We are jugling statements here, make sure we verify our expectations.

Change-Id: I26568cc52ede5b3a40f688cf53f2689fba3b11ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDo not build unknown statements twice 20/95220/1
Robert Varga [Thu, 18 Feb 2021 00:40:52 +0000 (01:40 +0100)]
Do not build unknown statements twice

SpotBugs is spotting this in an unrelated change, we should be
checking the product.

Change-Id: I822eb8667d2788b6887a0f72a4f78e294c367600
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse simple requireNonNull() 15/95215/2
Robert Varga [Wed, 17 Feb 2021 22:42:02 +0000 (23:42 +0100)]
Use simple requireNonNull()

StatementContextBase.addPhaseCompletedListener() is the heart of
inference and the checkNotNull() here is taking sourceReference().

Acquiring source reference is an indirection, which may actually
got through a forwarding chain. While we could use and if/throws,
let's just use plain requireNonNull.

JIRA: YANGTOOLS-652
Change-Id: I77d5b1dcc8b6b575d01ced0850d7081909b57964
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix InvalidRangeConstraintException serializability 12/95212/1
Robert Varga [Wed, 17 Feb 2021 17:15:49 +0000 (18:15 +0100)]
Fix InvalidRangeConstraintException serializability

Use an ImmutableRangeSet to guarantee the exception can be serialized.

Change-Id: I7455eba1df008c0456377e199b96bf91eb929f44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate {Data,Schema}TreeAwareEffectiveStatemnt 04/95204/3
Robert Varga [Wed, 17 Feb 2021 12:04:12 +0000 (13:04 +0100)]
Update {Data,Schema}TreeAwareEffectiveStatemnt

Use of wildcards here is dangerous, potentially leading to
ClassCastExceptions due to how the APIs a designed. Update them
with explicit Class references, so we end up filtering results
properly.

Change-Id: I804670a24ea0de4268605c7fcdd93e00d96bb422
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix javadoc warnings in SchemaNodeDefaults 03/95203/1
Robert Varga [Wed, 17 Feb 2021 11:24:09 +0000 (12:24 +0100)]
Fix javadoc warnings in SchemaNodeDefaults

We have a few warnings here, clean them up.

Change-Id: I53203c5f0515786543562bb44b2278ab2b9509dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoIntegrate SchemaTreeAwareEffectiveStatement with Descendant 02/95202/3
Robert Varga [Wed, 17 Feb 2021 10:42:04 +0000 (11:42 +0100)]
Integrate SchemaTreeAwareEffectiveStatement with Descendant

We already have a List-based lookup, also add a direct integration
with SchemaNodeIdentifier.Descendant. This also means SchemaTreeRoot
can be generalized to take SchemaNodeIdentifier in any form.

Change-Id: Ibebf1cf99b4a391f3432fe5791f9d99c92cc7a12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove feature/grouping/length effective statements 99/95199/3
Robert Varga [Wed, 17 Feb 2021 09:19:14 +0000 (10:19 +0100)]
Move feature/grouping/length effective statements

Move these three statements to yang-model-ri, further splitting up
yang-parser-rfc7950.

JIRA: YANGTOOLS-1241
Change-Id: I7cc3abaf836da453f05b41fb3f3d90f7711b6456
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaTreeRoot interface 01/95201/1
Robert Varga [Wed, 17 Feb 2021 10:14:48 +0000 (11:14 +0100)]
Add SchemaTreeRoot interface

It is a common requirement to find a schema tree node based on its
SchemaNodeIdentifier.Absolute. Make this easy to do with both
EffectiveModuleContext and ModuleEffectiveStatement.

Change-Id: Ie1e47954d52333c8aa88f5d09beb97d437c389b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDeprecate SchemaNodeUtils 98/95198/2
Robert Varga [Tue, 16 Feb 2021 19:09:20 +0000 (20:09 +0100)]
Deprecate SchemaNodeUtils

These utilities are bringing little to the table, remove the ones
with obvious replacements, deprecate the rest.

JIRA: YANGTOOLS-1243
Change-Id: I3186f7a76a63b2140e355f63af64000b362b3470
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove unused SchemaContextUtil 97/95197/2
Robert Varga [Tue, 16 Feb 2021 18:52:47 +0000 (19:52 +0100)]
Remove unused SchemaContextUtil

We have a fair number of utilities which are not useful with
current schema capabilities. Migrate relevant tests and remove
now-obsolete methods.

JIRA: YANGTOOLS-1243
Change-Id: I87e47f6bedbb95ff290e1c6e25712083d1f2094d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove unused SchemaUtils methods 95/95195/2
Robert Varga [Tue, 16 Feb 2021 17:48:37 +0000 (18:48 +0100)]
Remove unused SchemaUtils methods

Since we have switched most processing, we can ditch most complexity
in SchemaUtils, as we simply are not using it anywhere.

JIRA: YANGTOOLS-1248
Change-Id: Ibdb2cbdd14bc112f38e8ef701312db6224f186ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd yang.parser.rfc7950.stmt.meta 92/95192/1
Robert Varga [Tue, 16 Feb 2021 15:31:39 +0000 (16:31 +0100)]
Add yang.parser.rfc7950.stmt.meta

A number of per-statement support packages contain only a single
class. Consolidate them into a single package.

JIRA: YANGTOOLS-1241
Change-Id: I7b1e1c7cfe001efaf503260f49dd71bda762020c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUn-deprecate CopyableNode, AddedByUsesAware 91/95191/1
Robert Varga [Tue, 16 Feb 2021 15:15:34 +0000 (16:15 +0100)]
Un-deprecate CopyableNode, AddedByUsesAware

These traits seem to provide a useful inference summary, related to
DerivableSchemaNode. Un-deprecate them for now to reduce noise for
valid uses which have no alternative.

Also add FIXMEs to reconsider overall design of these interfaces,
as better semantic integration allows for more consistent use.

Change-Id: I3d238f9c6f8d74769506202777efb82277546e63
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove more statements 74/95174/8
Robert Varga [Mon, 15 Feb 2021 09:39:45 +0000 (10:39 +0100)]
Move more statements

Migrate next batch of effective statements to yang-model-ri.

As we are moving more complex items, Current.original() seems
quite inadequate. Add a helper.

JIRA: YANGTOOLS-1241
Change-Id: I5e57d76b1ac9bafb7b55c570e12140ff9efda1b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd a test for catching path excapes 75/91775/7
illia.ihushev [Thu, 30 Jul 2020 15:41:06 +0000 (18:41 +0300)]
Add a test for catching path excapes

Leafref resolution has been reworked in a previous patch, now add
a test case to ensure we are covered.

JIRA: YANGTOOLS-1127
Change-Id: I46e76966f553cb031119593d0e405a739bd27e4e
Signed-off-by: illia.ihushev <illia.ihushev@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoReimplement SchemaContextUtil.getBaseTypeForLeafRef() 99/94599/22
miroslav.kovac [Tue, 5 Jan 2021 14:00:46 +0000 (15:00 +0100)]
Reimplement SchemaContextUtil.getBaseTypeForLeafRef()

This is the primary entry point to resolution of TypeDefinitions
and generally inferring along the data tree. We already have
required utilities in SchemaInferenceStack.

Introduce SchemaInferenceStack.resolvePathExpression(), which
serves the serves the same purpose, but results in a stack
manipulation.

This completely removes the need to perform any string-based
operations, or dedicated SchemaNode lookups or anything of that
kind -- removing a lot of legacy crud.

JIRA: YANGTOOLS-1127
JIRA: YANGTOOLS-1229
Change-Id: I64e4f4ef2062ab2a0d143a520a53e8972cf54b26
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMaintain SchemaInferenceStack in XmlParserStream 80/95180/6
Robert Varga [Mon, 15 Feb 2021 17:13:32 +0000 (18:13 +0100)]
Maintain SchemaInferenceStack in XmlParserStream

We are about to migrate leafref resolution, maintaining a
SchemaInferenceStack will help with that. This also fixes a weird
normalization edge case around mountpoints.

JIRA: YANGTOOLS-1229
Change-Id: If20975d9ddc9d03e4232200916c94f27e9a443f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDataSchemaContextTree should expose EffectiveModelContext 83/95183/3
Robert Varga [Mon, 15 Feb 2021 21:19:46 +0000 (22:19 +0100)]
DataSchemaContextTree should expose EffectiveModelContext

There is no point hiding the context stored underneath, expose it
to users, so they may better integrate.

Change-Id: I269943567208539c2b2fcdf90067f6b08490a689
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix data/schema tree reuse 81/95181/1
Robert Varga [Mon, 15 Feb 2021 20:35:32 +0000 (21:35 +0100)]
Fix data/schema tree reuse

A simple thinko: we should just clear the flag, not ever
reset it back.

JIRA: YANGTOOLS-1234
Change-Id: I1ecbe4f754788a1a8781ac525e955876e7a8a142
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRename NormalizedNodeInferenceStack 76/95176/5
Robert Varga [Mon, 15 Feb 2021 15:33:14 +0000 (16:33 +0100)]
Rename NormalizedNodeInferenceStack

This name is not accurate, as the inputs are not really inference,
but are driven by NormalizedNodeStreamWriter.
NormalizedNodeStreamWriterStack is a tad more accurate, preventing
confusion.

JIRA: YANGTOOLS-1247
Change-Id: I4a498526fa34c7df261978b23ef7b4d4c8d49d93
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaInferenceStack.Inference.ofDataTreePath() 78/95178/2
Robert Varga [Mon, 15 Feb 2021 18:15:48 +0000 (19:15 +0100)]
Add SchemaInferenceStack.Inference.ofDataTreePath()

SchemaInferenceStack.ofDataTreePath() is very useful for testing
yang-data contracts -- and it is then coupled with .toInference().

Inference.ofDataTreePath() does the same thing, providing a more
ergonomic use.

JIRA: YANGTOOLS-1231
Change-Id: Id9512630b282ed9a3c091325d5e3164ee9a7b15f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove EffectiveStatementMixins to yang-model-spi 73/95173/2
Robert Varga [Sun, 14 Feb 2021 22:54:38 +0000 (23:54 +0100)]
Move EffectiveStatementMixins to yang-model-spi

EffectiveStatementMixins form the basis for a number of statements
which need to interoperate with SchemaNode world. Move the mixins
in yang-model-spi, so that their users may land yang-model-ri.

JIRA: YANGTOOLS-1241
Change-Id: Id4fab5cd41a127fa2902da01e675b010e220f995
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDo not reference spi.meta.CopyHistory in effective statements 72/95172/1
Robert Varga [Sun, 14 Feb 2021 22:47:47 +0000 (23:47 +0100)]
Do not reference spi.meta.CopyHistory in effective statements

CopyHistory is a yang-parser-spi construct, it should not be referenced
in effective statement implementations.

JIRA: YANGTOOLS-1241
Change-Id: Icba87583620e1f82e3268984179b75a3d627a3e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSplit out yang-model-ri 70/95170/5
Robert Varga [Sun, 14 Feb 2021 20:43:47 +0000 (21:43 +0100)]
Split out yang-model-ri

We really mean to expose default implementations from a dedicated
artifact, so that -spi is not burdened with actual implementation.

JIRA: YANGTOOLS-1226
Change-Id: I8caeb2dd4bfdb969e26d858e40533a2f5f0c9862
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote SchemaTracker to NormalizedNodeInferenceStack 69/95169/1
Robert Varga [Sun, 14 Feb 2021 19:34:23 +0000 (20:34 +0100)]
Promote SchemaTracker to NormalizedNodeInferenceStack

SchemaTracker represents a well-defined construct rooted in the
relationship of NormalizedNode hierarchy (as represented by
NormalizedNodeStreamWriter) with yang.model.api model of YANG.

JIRA: YANGTOOLS-1247
Change-Id: I5babc74cb10145284693691896687943cd5276c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaInferenceStack.ofDataTreePath() 68/95168/1
Robert Varga [Sun, 14 Feb 2021 17:31:52 +0000 (18:31 +0100)]
Add SchemaInferenceStack.ofDataTreePath()

This method is useful at least for testing. Also fix a copy&paste
mistake -- a failure is in the 'data tree', not 'schema tree'.

JIRA: YANGTOOLS-1231
Change-Id: Ied1c25700744f8c6a616efc172808af96f4615fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaTracker.toSchemaInferenceStack() 67/95167/1
Robert Varga [Sun, 14 Feb 2021 15:43:40 +0000 (16:43 +0100)]
Add SchemaTracker.toSchemaInferenceStack()

Since we are maintaining an internal stack, we can provide it to
users for purposes of further inference.

JIRA: YANGTOOLS-1233
Change-Id: I12fc5db117e9915965d155ddf4065234669bb97e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd AbstractCodecFactory.LeafrefResolver 66/95166/4
Robert Varga [Sun, 14 Feb 2021 13:38:42 +0000 (14:38 +0100)]
Add AbstractCodecFactory.LeafrefResolver

The context provided by SchemaNode is rather not nice, as it implies
access through SchemaNode.getPath(). The only use case for it is
leafref resolution -- hence encapsulate it, so that users can do their
own thing if need be.

JIRA: YANGTOOLS-1232
Change-Id: I385dceac4796e138130df32a5dad578e9ceceed1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate javax.inject dependencies 65/95165/1
Robert Varga [Sun, 14 Feb 2021 13:37:21 +0000 (14:37 +0100)]
Migrate javax.inject dependencies

Remove use of groupId=java.inject, as it brings about a very ugly
artifact.

Change-Id: I66a4213c2e7984931f187e464f77c5083d229a7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor AbstractEffectiveStatementInference 64/95164/2
Robert Varga [Sun, 14 Feb 2021 12:59:10 +0000 (13:59 +0100)]
Refactor AbstractEffectiveStatementInference

SchemaInferenceStack.Inference is incuring reordered copying just
because it is forced by AbstractEffectiveStatementInference. Add
a level of indirection so that Inference can do its own thing for
substatement list.

JIRA: YANGTOOLS-1240
Change-Id: I1f1b9f81f1cf32240c0eb26d5338e6f2f11fc74a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMaintain SchemaInferenceStack in SchemaTracker 32/95132/15
Robert Varga [Thu, 11 Feb 2021 12:53:42 +0000 (13:53 +0100)]
Maintain SchemaInferenceStack in SchemaTracker

SchemaTracker is performing schema lookups around NormalizedNode
streaming structure as seen by codecs. It interacts with
yang-model-util indirectly with SchemaContextUtil, with is not
entirely nice.

Update its design to integrate with SchemaInferenceStack, where
it can get most of the lookups it needs in a neat package.

JIRA: YANGTOOLS-1233
Change-Id: Ic074b99cc0413729a1755bbe458bf0f5297b5164
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoExpose EffectiveStatementInference from NormalizedAnyData 50/95150/5
Robert Varga [Fri, 12 Feb 2021 21:53:58 +0000 (22:53 +0100)]
Expose EffectiveStatementInference from NormalizedAnyData

Rather than exposing a simple DataSchemaNode, make sure we expose
an inference, which allows context to be re-created without relying
on SchemaNode.getPath().

JIRA: YANGTOOLS-1245
Change-Id: I471191e608c3a63ed88ea8c781859a90acbb2303
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove more simple statements 59/95159/2
Robert Varga [Sat, 13 Feb 2021 12:37:03 +0000 (13:37 +0100)]
Move more simple statements

This is big code movement, making most effective statement
implementations available outside of yang-parser-rfc7950.

JIRA: YANGTOOL-1241
Change-Id: Ica9f785552d78c9f89f10ef9172df7bf5d4f79db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSplit out yang-repo-{api,spi} 58/95158/7
Robert Varga [Sat, 13 Feb 2021 02:42:04 +0000 (03:42 +0100)]
Split out yang-repo-{api,spi}

yang.model.repo.{api,spi} are somewhat different from normal
yang.model.{api,spi}, split them out. This allows for a more
fine-grained accessess to APIs.

JIRA: YANGTOOLS-1143
Change-Id: Idbf7dc5156e1263e83c10e166abc493754b45072
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFold yang-model-util-ut 52/95152/5
Robert Varga [Fri, 12 Feb 2021 23:37:58 +0000 (00:37 +0100)]
Fold yang-model-util-ut

Now that yang-model-util can depend on yang-parser-rfc7950 for
testing, there is no point in keeping a separate test artifact.
Move all files from yang-model-util-ut into yang-model-util.

JIRA: YANGTOOLS-1052
Change-Id: Iac40aee178af24abbb2115ccf302e3550fbfee8c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove SimpleSchemaContext 57/95157/1
Robert Varga [Sat, 13 Feb 2021 02:23:04 +0000 (03:23 +0100)]
Move SimpleSchemaContext

SimpleSchemaContext is a pure implementation class, move it to
yang.model.spi along with ModuleDependencySort.

This allows yang-parser-reactor to depend on yang-model-spi only,
removing a significant dependency knot.

JIRA: YANGTOOLS-1052
Change-Id: Id03789a6abd56c81db0d788e19743cc82d6747a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSplit out yang-repo-fs 54/95154/3
Robert Varga [Sat, 13 Feb 2021 01:14:51 +0000 (02:14 +0100)]
Split out yang-repo-fs

The only remaining piece in yang-model-util is
FilesystemSchemaSourceCache, split it out into its own component.

JIRA: YANGTOOLS-1143
Change-Id: Id5091765a7b380816b88107d51141a677808801a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote InMemorySchemaSourceCache to model.repo.spi 53/95153/1
Robert Varga [Sat, 13 Feb 2021 00:35:08 +0000 (01:35 +0100)]
Promote InMemorySchemaSourceCache to model.repo.spi

This is a very simplistic Guava-based cache. Promote it to repo.spi,
so it can be used more easily.

JIRA: YANGTOOLS-1052
Change-Id: I5199af95b1d8be89360ac18e2e4c083b44acfb4a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove model.repo.util classes to model.repo.spi 51/95151/2
Robert Varga [Fri, 12 Feb 2021 23:29:04 +0000 (00:29 +0100)]
Move model.repo.util classes to model.repo.spi

Most of the classes are simple implementation helpers, move them
to model.repo.spi, so that implementations can share them more
freely. This eliminates yang-parser-rfc7950's dependency on
yang-model-util.

JIRA: YANGTOOLS-1052
Change-Id: Ide2dee1e04c08fee0146c4e347dbee900dd59570
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>