yangtools.git
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>
3 years agoModernize GroupingTest a bit 45/95145/5
Robert Varga [Fri, 12 Feb 2021 19:33:59 +0000 (20:33 +0100)]
Modernize GroupingTest a bit

Migrate TestUtils.checkIsAddedByUses() to its sole caller and
reduce overall dependencies. Also improve asserts to not rely
on model.util.SchemaNodeUtils's permissive behaviour.

JIRA: YANGTOOLS-1052
Change-Id: Ib6d9d5727a416c22a1f028900204def48224f22d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix javadoc generation 49/95149/1
Robert Varga [Fri, 12 Feb 2021 20:54:52 +0000 (21:54 +0100)]
Fix javadoc generation

We also need to teach docs about tags.

Change-Id: I93d5107600d571f14034f1adf997445b630915e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDo not test SimpleSchemaContext in parser 47/95147/3
Robert Varga [Fri, 12 Feb 2021 20:25:06 +0000 (21:25 +0100)]
Do not test SimpleSchemaContext in parser

SimpleSchemaContext has its dedicated test suite, do not muck with
it.

JIRA: YANGTOOLS-1052
Change-Id: Ib0e697c4ca75198a5c9c49c16010b012e97a85e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove a RecursiveObjectLeaker reference 46/95146/2
Robert Varga [Fri, 12 Feb 2021 20:15:20 +0000 (21:15 +0100)]
Remove a RecursiveObjectLeaker reference

Since we are not using ROL, we do not need to worry about cleaning
it up in the reactor.

JIRA: YANGTOOLS-1196
Change-Id: Iaa470a32d9ff02b611e5f9a0fc86648f30f61824
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoExpand SchemaTreeAwareEffectiveStatement.findSchemaTreeNode() 42/95142/7
Robert Varga [Fri, 12 Feb 2021 16:53:47 +0000 (17:53 +0100)]
Expand SchemaTreeAwareEffectiveStatement.findSchemaTreeNode()

Default implementation lends itself towards performing the heavy
lifting required. Allows us to ditch some SchemaContextUtils
dependencies in tests.

JIRA: YANGTOOLS-1052
Change-Id: I0fda81c4bf537327f7de51888bed2269857cd8e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove Bug6961Test 44/95144/3
Robert Varga [Fri, 12 Feb 2021 18:46:24 +0000 (19:46 +0100)]
Move Bug6961Test

This is a simple test for SchemaContextUtil method, move it to
yang-model-util-ut.

JIRA: YANGTOOLS-1052
Change-Id: I904af96b2142058ffc05ecb9707e51717b7145ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaTreeInference 40/95140/7
Robert Varga [Fri, 12 Feb 2021 15:20:56 +0000 (16:20 +0100)]
Add SchemaTreeInference

SchemaTreeInference is a nice inference point, firmly rooted in
RFC7950 concepts. Also wire it to SchemaInferenceStack, which can
support it quite easily.

JIRA: YANGTOOLS-1240
Change-Id: I746e5a4c17af3e4ca17c24dc15b7cb3533b48d8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd yang.model.api.EffectiveStatementInference 39/95139/5
Robert Varga [Fri, 12 Feb 2021 12:47:50 +0000 (13:47 +0100)]
Add yang.model.api.EffectiveStatementInference

A number of users of SchemaInferenceStack would benefit from
the ability to have it transportable with yang.model.api constructs.

Add EffectiveStatementInference which serves as a generic structure
to express such a transportable construct and specialize it in
SchemaInferenceStack.Inference.

JIRA: YANGTOOLS-1237
Change-Id: I74f3435b8952b70c21864f31fccf079f5e86dd58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove EffectiveStatementStateAware implementations 37/95137/2
Robert Varga [Fri, 12 Feb 2021 10:36:12 +0000 (11:36 +0100)]
Remove EffectiveStatementStateAware implementations

These are currently causing significant CPU usage regression and
are not providing any benefit. The use of parser-specific interface
also ties the implementations to the parser -- running contrary
to our need to move them to yang-model-spi.

JIRA: YANGTOOLS-1067
Change-Id: I994c15de6c8331a54b309323f55b258a86f18b62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaInferenceStack.enterChoice() 36/95136/3
Robert Varga [Fri, 12 Feb 2021 00:16:51 +0000 (01:16 +0100)]
Add SchemaInferenceStack.enterChoice()

yang-data-impl's SchemaTracker has a use case where it needs to track
choice statements, but does not track case statements. This is quite
usual for things interacting with NormalizedNodes -- and therefore we
provide an adequate utility in SchemaInferenceStack.

JIRA: YANGTOOLS-1235
Change-Id: Ie0936f2dad16c938fa502efe250e368f6440279a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate DataTreeAwareEffectiveStatements 33/95133/3
Robert Varga [Thu, 11 Feb 2021 16:54:07 +0000 (17:54 +0100)]
Update DataTreeAwareEffectiveStatements

Choice/Case/Grouping should all support walks across data tree
namespace. Update their definition and their implementations.

This allows SchemaInferenceStack users more flexibility, as they
now can use a better mix of enter statements to suit their needs.

JIRA: YANGTOOLS-1234
Change-Id: I9162b183fa3b43af19646b9d507994c161a97c20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaInfereceStack.enterDataTree() 25/95125/7
Robert Varga [Wed, 10 Feb 2021 16:48:31 +0000 (17:48 +0100)]
Add SchemaInfereceStack.enterDataTree()

SchemaInferenceStack is a very useful tool in figuring things out
around EffectiveStatement tree. So far it supported only simple
entries along 'grouping' and 'schema tree' namespaces.

Add support for walking the 'data tree' namespace as well, which
in itself is trivial, but has major implications for the conversion
paths to both SchemaPath and SchemaNodeIdentifier.

JIRA: YANGTOOLS-1231
Change-Id: I8ea288ede962000d54cf8fac8863f8bc7bd3be7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove commented-out lines 31/95131/2
Robert Varga [Thu, 11 Feb 2021 10:08:34 +0000 (11:08 +0100)]
Remove commented-out lines

These were missed in review, remove them.

Change-Id: I0655cec42e34bf8f80d5bd3c4ee3bd13fc1cf341
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove simple EffectiveStatement implementations 02/95102/6
Robert Varga [Tue, 9 Feb 2021 21:29:20 +0000 (22:29 +0100)]
Move simple EffectiveStatement implementations

yang-model-spi is hosting various implementation base classes. As
it turns out, most the actual statement implementations end up
being really simple and independent of yang-parser-spi.

Move RFC7950 effective statement implementations from
yang-parser-rfc7950, making its structure easier to navigate.

JIRA: YANGTOOLS-1052
Change-Id: Icb371f7790de756356f7fd00c6a770f9080aca4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoEliminating the use of SchemaContextUtil 07/95107/5
miroslav.kovac [Wed, 10 Feb 2021 10:06:35 +0000 (11:06 +0100)]
Eliminating the use of SchemaContextUtil

SchemaContextUtil is not really useful, as DataNodeContainer has
more convenient lookup utilities.

JIRA: YANGTOOLS-1052
Change-Id: I87f8d2dc3964bc6fdfe2cd804d370a6fafa6de00
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove SchemaInferenceStack.enterSchemaTree() 24/95124/2
Robert Varga [Wed, 10 Feb 2021 16:40:41 +0000 (17:40 +0100)]
Improve SchemaInferenceStack.enterSchemaTree()

We can guarantee a return of SchemaTreeEffectiveStatement, make
sure we show that to the users, allowing their dispatch to be
more neatly bracketed.

JIRA: YANGTOOLS-1231
Change-Id: If805a2a612c23157422bea717f9dfada9ac0f093
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse SchemaContextUtils replacements in yang-data-codec-xml 23/95123/1
Robert Varga [Wed, 10 Feb 2021 16:27:26 +0000 (17:27 +0100)]
Use SchemaContextUtils replacements in yang-data-codec-xml

We are performing rather simple searches, use the functionality
built into DataNodeContainer. Also modernize assertions while we
are in the area.

JIRA: YANGTOOLS-1052
Change-Id: Id3a9a49b80946db4d03f13ecf6fe19e46660e479
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup MultipleRevImportBug6875Test 22/95122/1
Robert Varga [Wed, 10 Feb 2021 16:12:17 +0000 (17:12 +0100)]
Cleanup MultipleRevImportBug6875Test

Do not use SchemaContextUtils for simple lookups and also update
assertions.

JIRA: YANGTOOLS-1052
Change-Id: I236664815b322510852c2c2721b15525d18e4065
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up SchemaContextFactoryDeviationsTest 21/95121/1
Robert Varga [Wed, 10 Feb 2021 16:02:37 +0000 (17:02 +0100)]
Clean up SchemaContextFactoryDeviationsTest

We are being overly verbose here and use SchemaContextUtil for
functionality readily available. Clean up the test, removing yet
another user of SchemaContextUtil.

JIRA: YANGTOOLS-1052
Change-Id: I4145e3d715cd1a2f524a892c178719f178d96e07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up Bug3874ExtensionTest 20/95120/1
Robert Varga [Wed, 10 Feb 2021 15:49:45 +0000 (16:49 +0100)]
Clean up Bug3874ExtensionTest

We are using SchemaContextUtil for no good reason, migrate away
and cleanup assertions.

JIRA: YANGTOOLS-1052
Change-Id: Ib2d56d5155d66a974cc92415a18627bdde3518d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove Bug5437Test to yang-model-util-ut 19/95119/1
Robert Varga [Wed, 10 Feb 2021 15:44:09 +0000 (16:44 +0100)]
Move Bug5437Test to yang-model-util-ut

This is pure UT for yang-model-util, rehost it and rename it to
new parlance -- YT588Test.

JIRA: YANGTOOLS-1052
Change-Id: I517ea393005d6ba16d5bcf6c4fc9ffe95b6a7e20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up yang-parser-rfc7950 tests 17/95117/3
miroslav.kovac [Wed, 10 Feb 2021 12:05:56 +0000 (13:05 +0100)]
Clean up yang-parser-rfc7950 tests

Refactor using newer asserts and concepts, eliminating the use
of SchemaContextUtil.

JIRA: YANGTOOLS-1052
Change-Id: I6918a95fd4d1aec964cd5f80796305e73654345a
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
3 years agoDo not use SchemaNode.getPath() in XmlParserStream 15/95115/3
Robert Varga [Wed, 10 Feb 2021 13:56:19 +0000 (14:56 +0100)]
Do not use SchemaNode.getPath() in XmlParserStream

We are using getPath() only for diagnostic purposes. Log/append
only parentSchema instead.

JIRA: YANGTOOLS-1228
Change-Id: I304424ad419dee4d3ff2167eeece325cfd5745fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix missing location in error reports 14/95114/3
Robert Varga [Wed, 10 Feb 2021 13:51:13 +0000 (14:51 +0100)]
Fix missing location in error reports

There are two places where we fail to propagate location:
- one is a pure omission
- one is a case of bad format
Fix both sites, improving our error reporting.

Change-Id: I65b52c69a6d6d7bb0fd8a9bc3956a2dab51d81c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove SchemaUtils.findParentSchemaNodesOnPath() 13/95113/2
Robert Varga [Wed, 10 Feb 2021 13:03:07 +0000 (14:03 +0100)]
Remove SchemaUtils.findParentSchemaNodesOnPath()

These methods are not used anywhere except tests, remove them now.

JIRA: YANGTOOLS-1230
Change-Id: I3ca3d7bd7bf1e6f27fea634ee138d3f1769e5666
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse SchemaInferenceStack in SchemaOrderedNormalizedNodeWriter 12/95112/2
Robert Varga [Wed, 10 Feb 2021 12:53:43 +0000 (13:53 +0100)]
Use SchemaInferenceStack in SchemaOrderedNormalizedNodeWriter

SchemaOrderedNormalizedNodeWriter's use of SchemaUtils is rather
straightforward, let's migrate it to SchemaInferenceStack.

JIRA: YANGTOOLS-1230
Change-Id: I9b17d0f9f737df7127a48d7cd60dae0a2b2b594f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConvert SchemaTracker to use SchemaInferenceStack 11/95111/4
Robert Varga [Wed, 10 Feb 2021 10:43:47 +0000 (11:43 +0100)]
Convert SchemaTracker to use SchemaInferenceStack

SchemaTracker's users always expect an instantiated path, for which
SchemaInferenceStack is much more efficient than SchemaNodeUtils.

JIRA: YANGTOOLS-1230
Change-Id: I24edb3595b5dab936790d4f5d77ecdcded1a1b1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaInferenceStack utility factory methods 08/95108/1
Robert Varga [Wed, 10 Feb 2021 10:07:39 +0000 (11:07 +0100)]
Add SchemaInferenceStack utility factory methods

A number of users of yang.model.api use some form of addressing,
this is related either to SchemaNodeIdentifier or SchemaPath. These
users can benefit from SchemaInferenceStack -- but would have to
duplicate code to correctly initialize it.

Add two factory methods to create a new SchemaInferenceStack.

JIRA: YANGTOOLS-1086
Change-Id: I3006e5d74d239eb6bc96e148521148c579fb5811
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRevert "Add support for rebinding type definitions" 04/95104/1
Robert Varga [Wed, 10 Feb 2021 07:09:56 +0000 (08:09 +0100)]
Revert "Add support for rebinding type definitions"

This reverts commit ad603ee9df18aee0e58d83ae207846c8b9bd0d58, as
the rules for how copying needs to work are not clear and this
facility is not used.

JIRA: YANGTOOLS-1213
Change-Id: Ibbcc2a1ca40ceaaf0baaf58b07b275a359fad8bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove model.spi.type.CompatUtils 03/95103/2
Robert Varga [Wed, 10 Feb 2021 07:06:57 +0000 (08:06 +0100)]
Remove model.spi.type.CompatUtils

Minute differences between how TypeDefinitions work are interesting
only for MD-SAL's binding. Remove CompatUtils and let MD-SAL do its
own thing.

JIRA: YANGTOOLS-1216
Change-Id: I9d956f53e877a5e2306f831142467f30db296233
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove ContactStatement implementations 01/95101/1
Robert Varga [Tue, 9 Feb 2021 21:44:05 +0000 (22:44 +0100)]
Move ContactStatement implementations

These have been missed in the previous mass migration, correct
that mistake.

JIRA: YANGTOOLS-1052
Change-Id: Ibb36b7373b2db198eea2fcb2c791523ec6eadaa2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove declared statements to their own package 00/95100/1
Robert Varga [Tue, 9 Feb 2021 20:56:52 +0000 (21:56 +0100)]
Move declared statements to their own package

Add model.spi.stmt.impl.decl, which is an unexported package, and
host declared statement implementations.

JIRA: YANGTOOLS-1052
Change-Id: Ia8894ff9c81cc28db81ff1caa015237d35f4d1fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove model.util.RegexUtils 91/95091/4
Robert Varga [Tue, 9 Feb 2021 13:33:30 +0000 (14:33 +0100)]
Move model.util.RegexUtils

These utilities are used only by PatternStatementSupport, move them
there to reduce yang-parser-rfc7950 dependencies.

JIRA: YANGTOOLS-1052
Change-Id: I3a039c4d96b296e8fd3f71c248221ff9b815997e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove yang-data-jaxen 95/95095/2
Robert Varga [Tue, 9 Feb 2021 17:14:12 +0000 (18:14 +0100)]
Remove yang-data-jaxen

This has been a prototype, whose API and performance characteristics
that are not acceptable. Remove it and we will start from scratch
around yang-xpath-api.

JIRA: YANGTOOLS-1227
Change-Id: I5c2a7f427d165a390eff4291eefc3130f9841997
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup more tests 93/95093/2
Robert Varga [Tue, 9 Feb 2021 15:36:22 +0000 (16:36 +0100)]
Cleanup more tests

Bug6876Test, Bug6884Test and Bug6335Test are very simple,
modernize them, eliminating dependencies on SchemaContextUtil.

JIRA: YANGTOOLS-1052
Change-Id: If16de321a712996728df0236795d1d62ee6edd8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoModernize Bug6869Test, Bug6880Test 92/95092/2
Robert Varga [Tue, 9 Feb 2021 14:25:39 +0000 (15:25 +0100)]
Modernize Bug6869Test, Bug6880Test

Refactor using newer asserts and concepts, eliminating the use
of SchemaContextUtil.

JIRA: YANGTOOLS-1052
Change-Id: I34a66ae98cb64e499c844d11d9edb27a1552e08c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove an unneeded yang-model-util dependency 90/95090/2
Robert Varga [Tue, 9 Feb 2021 13:06:31 +0000 (14:06 +0100)]
Remove an unneeded yang-model-util dependency

yang-model-export only requires yang-model-api, nothing else.

JIRA: YANGTOOLS-1052
Change-Id: Id4b983c9882e8bc98b0cc1995f1b0523e22f0156
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove AbstractPathExpression to yang-model-spi 89/95089/2
Robert Varga [Tue, 9 Feb 2021 13:04:09 +0000 (14:04 +0100)]
Move AbstractPathExpression to yang-model-spi

A very simplistic base class for implementations. It should not
live in yang-model-util.

JIRA: YANGTOOLS-1052
Change-Id: I8794b64d8ad3572c898c8b944354c99d8ba63aa3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove BaseConstraints 88/95088/3
Robert Varga [Tue, 9 Feb 2021 12:13:17 +0000 (13:13 +0100)]
Remove BaseConstraints

This utility is not used anywhere, remove it.

JIRA: YANGTOOLS-1052
Change-Id: Idfd4ece09d329f5bc14e12f9b192fe765206e824
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove more implementation classes to yang-model-spi 87/95087/4
Robert Varga [Tue, 9 Feb 2021 11:47:21 +0000 (12:47 +0100)]
Move more implementation classes to yang-model-spi

AbstractSchemaContext as well as AbstractEffectiveModelContextProvider
are really baseline implementation classes, move them.

JIRA: YANGTOOLS-1052
Change-Id: I2e68cd53fff00c2ee322a6045bf029b46921c2a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFinish declared statement migration 85/95085/2
Robert Varga [Tue, 9 Feb 2021 01:05:59 +0000 (02:05 +0100)]
Finish declared statement migration

This is final step of getting declared statements out of
yang-parser-rfc7950.

JIRA: YANGTOOLS-1226
Change-Id: Id6212df2def83a856b55d8199e133bf8839bde5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote more declared statements to yang-parser-spi 84/95084/1
Robert Varga [Tue, 9 Feb 2021 00:25:24 +0000 (01:25 +0100)]
Promote more declared statements to yang-parser-spi

Declared statements are extremely simplistic, move their RFC7950
implementations to yang-model-spi. This is the second batch of
conversion, with more to follow.

JIRA: YANGTOOLS-1226
Change-Id: I9ca7a8af5c4a98fc1a6afc09e5b8b65434f9f1c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote declared statements to yang-parser-spi 83/95083/2
Robert Varga [Mon, 8 Feb 2021 21:24:05 +0000 (22:24 +0100)]
Promote declared statements to yang-parser-spi

Declared statements are extremely simplistic, move their RFC7950
implementations to yang-model-spi. This is the first batch of
conversion, with more to follow.

JIRA: YANGTOOLS-1226
Change-Id: I49b7840cfa6395496db3475853230c527bd252ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote AbstractDeclaredEffectiveStatement 82/95082/2
Robert Varga [Mon, 8 Feb 2021 20:54:10 +0000 (21:54 +0100)]
Promote AbstractDeclaredEffectiveStatement

This is a useful implementation base class. Make it more widely
available in yang-model-spi. This also allows us to hide
AbstractEffectiveStatement, as it should never be subclassed
directly.

JIRA: YANGTOOLS-1225
Change-Id: I68103d63ea1b73dfadf2f1eb98cfeba022053260
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSplit out AbstractDataNodeContainer 81/95081/1
Robert Varga [Mon, 8 Feb 2021 20:42:04 +0000 (21:42 +0100)]
Split out AbstractDataNodeContainer

This class is an outlier as it is really only subclassed once and
relies on Mixins. Let's split it out first and deal with it later.
Its use of Mixins certainly makes is special enough to make it a
non-nested class.

JIRA: YANGTOOLS-1225
Change-Id: I6badd7a19ad6bd7c66a36043420e2e20d0c5ff25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote AbstractUndeclaredEffectiveStatement 80/95080/2
Robert Varga [Mon, 8 Feb 2021 20:29:27 +0000 (21:29 +0100)]
Promote AbstractUndeclaredEffectiveStatement

This is a useful implementation base class. Make it more widely
available in yang-model-spi.

JIRA: YANGTOOLS-1225
Change-Id: Ib450286a5fe8c90bbbaf26247feb3093982ba39a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUnrecognizedEffectiStatement is declared 79/95079/1
Robert Varga [Mon, 8 Feb 2021 20:23:56 +0000 (21:23 +0100)]
UnrecognizedEffectiStatement is declared

While we never instantiate this statement, it is clearly always
declared, hence use a better superclass.

JIRA: YANGTOOLS-1225
Change-Id: I4679066d809874b28082b29f61856bd3687c42cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote AbstractEffectiveStatement to model-spi 78/95078/1
Robert Varga [Mon, 8 Feb 2021 20:19:06 +0000 (21:19 +0100)]
Promote AbstractEffectiveStatement to model-spi

This is a useful common implementation class, make it more widely
accessible.

JIRA: YANGTOOLS-1225
Change-Id: Ie2f7ccdf787dc1b7c0283c11ddbbfd910bac5da1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove yang.parser.spi.meta.AbstractDeclaredStatement 77/95077/1
Robert Varga [Mon, 8 Feb 2021 20:03:00 +0000 (21:03 +0100)]
Remove yang.parser.spi.meta.AbstractDeclaredStatement

A lower-footprint competitor was promoted to yang-model-spi, rendering
this class useless. Remove it to make yang-parser-spi split up simpler
and prevent potential confusion.

JIRA: YANGTOOLS-1150
Change-Id: If67ac9e5b378583ab1446f62e0b0028e86b499d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote AbstractDeclaredStatement to model-spi 76/95076/1
Robert Varga [Mon, 8 Feb 2021 20:01:15 +0000 (21:01 +0100)]
Promote AbstractDeclaredStatement to model-spi

This is a useful common implementation class, make it more widely
accessible.

JIRA: YANGTOOLS-1225
Change-Id: I7b92dcd1608c57b7b63ba8036a2db5c4a82d9859
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote AbstractModelStatement to model-spi 75/95075/1
Robert Varga [Mon, 8 Feb 2021 19:53:03 +0000 (20:53 +0100)]
Promote AbstractModelStatement to model-spi

This is a useful common implementation class, make it more widely
accessible.

JIRA: YANGTOOLS-1225
Change-Id: I4f04df2063545e7f20fa0d4a0795c4bf5d2a2ebd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoModernize MoreRevisionsTest 74/95074/1
Robert Varga [Mon, 8 Feb 2021 19:34:12 +0000 (20:34 +0100)]
Modernize MoreRevisionsTest

Refactor using newer asserts and concepts, eliminating the use
of SchemaContextUtil.

JIRA: YANGTOOLS-1052
Change-Id: Ia446b596a0cdec4b6e466a395184aa7ecbfb6443
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoModernize Bug6870Test 72/95072/2
Robert Varga [Mon, 8 Feb 2021 19:19:05 +0000 (20:19 +0100)]
Modernize Bug6870Test

Perform a long-overdue cleanup, improving assertions and eliminating
the need for SchemaContextUtil.

JIRA: YANGTOOLS-1052
Change-Id: I24e8bfe62509e12a4158a99c673ff182bd5c2240
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSeed yang-model-spi with model.util.type 70/95070/2
Robert Varga [Mon, 8 Feb 2021 16:26:15 +0000 (17:26 +0100)]
Seed yang-model-spi with model.util.type

Move TypeDefinition implementation into a newly-created artifact,
yang-model-spi. This is the second step if untangling the
parser-rfc7950/model-util dependency conundrum.

JIRA: YANGTOOLS-1052
Change-Id: I3282d730ae2517efb8edc3f46bdc39d135677790
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove yang.model.util.BaseTypes 71/95071/3
Robert Varga [Mon, 8 Feb 2021 17:06:40 +0000 (18:06 +0100)]
Remove yang.model.util.BaseTypes

The only thing used from this class are the QName constants. Disperse
them among their respective TypeDefinition specialications, eliminating
the need for a centralized place. This is the first step in resolving
model-util/parser-rfc7950 dependency conundrum.

JIRA: YANGTOOLS-1052
Change-Id: Ib69814bb872ccd327e577e1efe83e9510288c025
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate xpath-api/model-util module-info.java 67/95067/1
Robert Varga [Mon, 8 Feb 2021 13:32:02 +0000 (14:32 +0100)]
Update xpath-api/model-util module-info.java

We are using spotbugs, make sure we depend on them.

Change-Id: Icf82f74e83ae2406c125ad4df9b28020d3ce999b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoShort-circuit statement reuse 35/94735/17
Robert Varga [Tue, 26 Jan 2021 20:52:13 +0000 (21:52 +0100)]
Short-circuit statement reuse

When all substatements end up being context-independent and we do
not have an incoming reference, we can effieciently side-step creation
of replicas.

JIRA: YANGTOOLS-1223
Change-Id: Ic50e21e793d16d35170ce95561ec4e3f68cc6ef1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd XMLNamespace 64/95064/7
Robert Varga [Sun, 7 Feb 2021 17:56:28 +0000 (18:56 +0100)]
Add XMLNamespace

java.net.URI is a rather bad fit our purposes. We really need a
simplistic String container, without the need to have it parsed out
into a complex structure.

Introduce XMLNamespace and mass-migrate all users of URI.

JIRA: YANGTOOLS-1141
Change-Id: I87d9fa85f078aa0fa0d29d1e1b118094d51cfc5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd derived statement cache 18/94918/24
Robert Varga [Mon, 1 Feb 2021 07:29:49 +0000 (08:29 +0100)]
Add derived statement cache

A single ReactorStmtCtx may have multiple derived
InferredStatementContexts from it, each resulting in a statement
which is different from the statement produced by the original,
while also being the same among themselves.

This happens actually quite often, since typical schema tree
participants record their copy history as well as well as
effectiveConfig, which is different between defining grouping
and instantiation place.

This mechanics is driven via individual implementation opt-ins,
with SchemaTree being the most significant user.

JIRA: YANGTOOLS-1214
Change-Id: Ie3163e5a7fa8c5cfdfb670102deca7cb22b0d935
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoIntern contact/organization/reference arguments 62/95062/3
Robert Varga [Sun, 7 Feb 2021 15:16:28 +0000 (16:16 +0100)]
Intern contact/organization/reference arguments

These tend to repeat with multiple models, make sure we deduplicate
them if possible.

JIRA: YANGTOOLS-652
Change-Id: Ieed8acb9fa12e4302e44b9fc32ed1f96bedab57b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove an unneede throws 61/95061/1
Robert Varga [Sun, 7 Feb 2021 15:03:37 +0000 (16:03 +0100)]
Remove an unneede throws

We are not throwing ExecutionException, let's not mention it.

Change-Id: I12c334396d6fbd8819d2dca6e7082aabb81a4e3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDo not instantiate transient replicas 60/95060/3
Robert Varga [Sun, 7 Feb 2021 12:23:26 +0000 (13:23 +0100)]
Do not instantiate transient replicas

Refactor ReactorStmtCtx.haveRef() into an accurate noRefs(), taking
parents into account. If we do not have such a reference, use a new
substatement sentinel instead of a full list.

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