yangtools.git
4 years agoCleanup NamespaceStorageSupport/StmtContext API conflict 77/87177/1
Robert Varga [Mon, 27 Jan 2020 17:58:58 +0000 (18:58 +0100)]
Cleanup NamespaceStorageSupport/StmtContext API conflict

StmtContext has a few methods that are logically implemented by
NamespaceStorageSupport. Since NamespaceStorageSupport does not
implements StmtContext (nor should it), these methods happen to
work as they overlap with StmtContextBase's mixin -- and they
cannot be simply found by looking for implementations.

Resolve the naming conflict in the most logical way, thus improving
quality of life for everyone :)

Change-Id: I0186a94699c5945b7140bf57ba9e5900e49019d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse ImmutableMap for single namespaces 61/87161/3
Robert Varga [Mon, 27 Jan 2020 11:31:15 +0000 (12:31 +0100)]
Use ImmutableMap for single namespaces

It is extremely common for statement contexts to have exactly one
namespace (i.e. ChildSchemaNodeNamespace). Tracking that in a HashMap
is not very memory-efficient (nor performance-efficient), as we will
end up allocating all the HashMap internals.

Separate out the single-namespace case and use an ImmutableMap singleton
to hold the namespace -- which saves ~65MiB in a reference test case
accounding for ~6% of scratch memory used (~3% total used).

JIRA: YANGTOOLS-652
Change-Id: Ie2b1faeb4c966c20be0818d3b54aa7c8367f0c58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReuse OrderedByEffectiveStatement instances 50/87150/2
Robert Varga [Sun, 26 Jan 2020 19:18:37 +0000 (20:18 +0100)]
Reuse OrderedByEffectiveStatement instances

This is a low-cardinality statement for which we are already reusing
declared instances. This extends that support to cover effective
instances based on the shared declared instances.

Also ditch the use of EnumMap -- while it works, we only have two
values, which is easily taken care of by a switch statement.

JIRA: YANGTOOLS-1065
Change-Id: I43f135c9dec443b1b46b5517fa98f2c08af3d877
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoIntroduce AbstractModelStatement 49/87149/2
Robert Varga [Sun, 26 Jan 2020 18:08:32 +0000 (19:08 +0100)]
Introduce AbstractModelStatement

Since we now have abstract classes for both declared and effective
worlds, it is useful tie the implementations together, so that it
both share vtable where ModelStatement methods are concerned.

Also unify substatement list handling between the two implementations,
sharing the utility methods to do so.

JIRA: YANGTOOLS-1065
Change-Id: I52849b2afa6a20478a980ba0992dbcc338941dd9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd default effectiveSubstatements() implementation 48/87148/1
Robert Varga [Sun, 26 Jan 2020 17:32:13 +0000 (18:32 +0100)]
Add default effectiveSubstatements() implementation

AbstractEffectiveStatement subclasses can benefit from a common
implementation, reducing code duplication. This organization
mirrors the layout of AbstractDeclaredStatement.

JIRA: YANGTOOLS-1065
Change-Id: I869958ad8a154df0d6f66c91108631ef54aad2b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize simple declared statements 47/87147/3
Robert Varga [Sun, 26 Jan 2020 13:05:42 +0000 (14:05 +0100)]
Optimize simple declared statements

Our declared statements weigh in at 32/56 bytes each, which is
a bit wasteful for what they are doing -- and it all boils down to
class hierarchy.

Introduce AbstractDeclaredStatement, which provides structural
base to implement them with minimal footprint. Initial conversion
includes simple statements, which can be implemented in 16/24 bytes.

OrderedBy statement also takes advantage of low cardinality of its
argument to further eliminate footprint in regular YANG use.

JIRA: YANGTOOLS-1065
Change-Id: I6ea57a7260d3e33108c6c77c1ce120937181796f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd InferredStatementContext 13/87113/21
Robert Varga [Sat, 25 Jan 2020 13:24:53 +0000 (14:24 +0100)]
Add InferredStatementContext

SubstatementContext implies definition in source, which adds state
which is not necessary. Introduce a separate class to hold statement
contexts which are created during inference.

In order to prevent code duplication, StmtContext methods whose
implementation is relevant only in RootStatementContext are refactored
to dispatch to specialized implementations, making them final in
the process. This also happens to improve inference speed, as lookups
like getBehaviourRegistry() used to iterate over parent axis to root,
now they are taking a direct shortcut to root (which may be 'this').

Since InferredStatementContext derives a number of methods from
its prototype (such as raw argument, etc.), these details are taken
out of StatementContextBase and moved to AbstractResumedStatement.

InferredStatementContext is about 10% smaller than an equivalent
SubstatementContext, leading to smaller inference memory footprint.

JIRA: YANGTOOLS-784
Change-Id: I62eea1dc92756536444676e8765fedd73375933e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExtract AbstractResumedStatement 40/87140/6
Robert Varga [Sat, 25 Jan 2020 11:43:44 +0000 (12:43 +0100)]
Extract AbstractResumedStatement

Separate out data structures related to statement source traversal
into a dedicated class.

This lowers the footprint required to implement StatementContextBase,
as well as lowering clutter around which functionality is related
to which part.

JIRA: YANGTOOLS-652
Change-Id: I811c6fcf3bfba83421609af13dfed8fe445184b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpand reactor documentation a bit 39/87139/5
Robert Varga [Sat, 25 Jan 2020 11:33:22 +0000 (12:33 +0100)]
Expand reactor documentation a bit

The reactor can use every sliver of documentation it can get, provide
at least a few words.

Change-Id: I2ccfa558f2ba4bfa63505308f6e4131e8634ab4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize isConfiguration()/isIgnoringConfig() interplay 38/87138/2
Robert Varga [Sat, 25 Jan 2020 10:29:21 +0000 (11:29 +0100)]
Optimize isConfiguration()/isIgnoringConfig() interplay

Now that we have coalesced these two states into a flag field,
their interplay is more apparent -- isIgnoringConfig() is always
checked before isConfiguration() and if it is set, it also implies
isConfiguration() is also set.

Using flags allows us to express this implication by simply setting
the right bits. This results in fewer flag operations performed and
a more direct dispatch between methods.

isConfiguration() is also improved to access parent.isConfiguration()
only when necessary, improving performance when a config substatement
is present.

JIRA: YANGTOOLS-652
Change-Id: Ifb18ee16e33e93de4300cc80e4ba67a9ae40bbde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize SubstatementContext size 30/87130/6
Robert Varga [Fri, 24 Jan 2020 14:11:01 +0000 (15:11 +0100)]
Optimize SubstatementContext size

Class layout of SubstatementContext contains a set of flags in
StatementContextBase and SubstatementContext, both of which end up
being padded -- wasting 2-10 bytes in the padding alone.

Moving configuration/ignoreConfig/ignoreIfFeature to
StatementContextBase and allocating them as individual bits allows
us to eliminate internal losses in most cases, resulting in net
savings of 8 bytes per instance in the common case (64bit VM), i.e.
4.5-8.3%.

JIRA: YANGTOOLS-652
Change-Id: Ic63f75e9e8c1c25445bc7904c08a5691d1470b67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove removeStatementsFromEffectiveSubstatements() 31/87131/2
Robert Varga [Fri, 24 Jan 2020 14:21:44 +0000 (15:21 +0100)]
Remove removeStatementsFromEffectiveSubstatements()

This StatementContextBase method has been deprecated and is unused,
remove it.

Change-Id: I71345b881b0ad04b46d134ebd8e3a2d63fdd2de5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate StmtContext javadoc 26/87126/1
Robert Varga [Fri, 24 Jan 2020 08:55:40 +0000 (09:55 +0100)]
Migrate StmtContext javadoc

Move documentation blocks from StatementContextBase to method
definitions in StmtContext.

Change-Id: I569ae4a99ef0e90b72dcb341ccbf30cf010e76a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake StatementContextBase.childCopyOf() final 12/87112/2
Robert Varga [Thu, 23 Jan 2020 16:52:13 +0000 (17:52 +0100)]
Make StatementContextBase.childCopyOf() final

We have a single implementation, let's make sure it stays that
way before we move to implementation.

Change-Id: I3d461ffef37289dc01fb2f13bd88617d73327eb9
JIRA: YANGTOOLS-784
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove usage of ExpectedException 11/87111/2
Robert Varga [Thu, 23 Jan 2020 16:50:22 +0000 (17:50 +0100)]
Remove usage of ExpectedException

New JUnit provides an explicit assertThrows(), which supersedes
the old ExpectedException pattern. Migrate our tests to the new way
of doing things.

Change-Id: Idac4862fc8e20e4a27b2ac766c4d1770208195a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove common code 10/87110/2
Robert Varga [Thu, 23 Jan 2020 16:36:18 +0000 (17:36 +0100)]
Move common code

We have a single line which is duplicated, move it to common code.

Change-Id: I738168386ea0efb7c7bab11e23aa219e076b564b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove childCopyOf() generic arguments 09/87109/2
Robert Varga [Thu, 23 Jan 2020 15:28:46 +0000 (16:28 +0100)]
Remove childCopyOf() generic arguments

The need for generics would come from the sole implementation,
which can deal with type safety issue separately -- simplifying
the common definition.

Change-Id: I7680bb00b74cd456b10fc28c6f96820b503fee99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTurn util into a JPMS module 21/83921/16
Robert Varga [Thu, 22 Aug 2019 18:23:17 +0000 (20:23 +0200)]
Turn util into a JPMS module

This creates an explicit module-info.java, making the policy explicit.

Change-Id: I07d0d8d31e1f0673dd338cb97901e976127cd190
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove LoggingThreadUncaughtExceptionHandler 07/87107/1
Robert Varga [Thu, 23 Jan 2020 13:00:12 +0000 (14:00 +0100)]
Remove LoggingThreadUncaughtExceptionHandler

This class is not used anywhere, remove it.

Change-Id: Ifff05b73490226ef29d191fa46859dd324b03c3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate Queue stats collection 06/87106/1
Robert Varga [Thu, 23 Jan 2020 12:56:03 +0000 (13:56 +0100)]
Migrate Queue stats collection

The statistics used to be a public contract, now we expose it
through package-protected streamTasks().

Change-Id: Ie8afc8b0cb97ead00450b57bac500e4010300125
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse CompletableFuture.failedFuture() in CheckedValue 03/87103/1
Robert Varga [Thu, 23 Jan 2020 12:53:01 +0000 (13:53 +0100)]
Use CompletableFuture.failedFuture() in CheckedValue

Java 9 improves usability here, allowing us to trim some code.

Change-Id: I7b723b86bd8ab18ecf4bb81caa41cbe0642c4056
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate concepts tests to use assertThrows() 02/87102/1
Robert Varga [Thu, 23 Jan 2020 12:46:39 +0000 (13:46 +0100)]
Migrate concepts tests to use assertThrows()

Rather than using Test(expected=) use a dedicated test, which
pinpoints exactly which call should throw the exception.

Change-Id: I7ff2af221e3260b04ce9a31b7562f6e516af5fdc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove hashCode()/equals() from SchemaNode implementations 78/87078/8
Robert Varga [Wed, 22 Jan 2020 12:11:22 +0000 (13:11 +0100)]
Remove hashCode()/equals() from SchemaNode implementations

Most SchemaNode comparisons end up operating on a statement's
SchemaPath, pretending they are equal based on path.

This is not accurate when comparing nodes between SchemaContexts,
as their definition can vary wildly and they cannot be considered
'equal'.

Inter-SchemaContext comparison is all about compatibility and as such
cannot be in terms of equals() contract -- such a compatibility check
is both irreflexive and asymmetric unless the two nodes are completely
compatible.

With the above out of the picture, the definition of comparison
really boils down to a glorified identity check, as SchemaPath is
supposed to be unique for a node.

This patch removes most hashCode()/equals() methods, defaulting to
identity. Notable leftovers are Mandatory/Config statements and
TypeDefinitions (which are DocumentedNodes, but the point is pretty
much the same).

JIRA: YANGTOOLS-761
Change-Id: I8162b2b121f611bc128fbbcea3cef7921f25eb72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAbstractEffectiveModule should retain statement order 85/87085/3
Robert Varga [Wed, 22 Jan 2020 16:14:26 +0000 (17:14 +0100)]
AbstractEffectiveModule should retain statement order

AbstractEffectiveModule is using HashSet for its temporary storage,
which makes statement order dependent on hashCode() rather than
declaration order.

Make sure we use LinkedHashSet, thus not losing the order.

Change-Id: Ie46c28c051f861c1aabc34f7aa5e4293f7d38cea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd OrderedByStatement.Ordering 99/86599/7
Robert Varga [Sat, 28 Dec 2019 10:22:28 +0000 (11:22 +0100)]
Add OrderedByStatement.Ordering

This adds a utility enum to express parsed argument value, allowing
us to remove some string duplication.

JIRA: YANGTOOLS-1058
Change-Id: I147f51fbeb9140d6cd43a80d205218a73d827a21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate assertThat() import 80/87080/3
Robert Varga [Wed, 22 Jan 2020 13:36:50 +0000 (14:36 +0100)]
Migrate assertThat() import

Assert.assertThat() is deprecated, use its replacement method.

Change-Id: Ifa05d39a24e661854f84535afc4cbbdbe0ad90b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not tolerate duplicate identities 79/87079/1
Robert Varga [Wed, 22 Jan 2020 13:25:15 +0000 (14:25 +0100)]
Do not tolerate duplicate identities

We have a unit test asserting identity definition squashing -- which
really is papering over the parser accepting the identities.

As per RFC7950, identity declarations must be unique, and we should
report them through normal SourceException.

JIRA: YANGTOOLS-1075
Change-Id: I98ce8615bcdb502cb79caa23fc9c3a127f850ea9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate non-lazy leaf tracking 69/87069/1
Robert Varga [Tue, 21 Jan 2020 15:54:05 +0000 (16:54 +0100)]
Deprecate non-lazy leaf tracking

org.opendaylight.yangtools.yang.data.impl.schema.nodes.lazy-leaves
property allows to select non-default behavior of retaining Leaf
node instances in their parent containers.

This behavior is going away, make sure we warn users about this
change.

Change-Id: Ia99bd315edd101838e55bc11ce6d8781fd46ac52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd nullness annotations 39/87039/1
Robert Varga [Sun, 19 Jan 2020 11:08:23 +0000 (12:08 +0100)]
Add nullness annotations

Not promising proper nullness leads to warnings downstream, do the
right thing and say when we promise non-nulls.

Change-Id: Ib34d57b45905d6164456ef0605ce6cca65f9de4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor yang-model-api child traversal return types 77/86877/21
Robert Varga [Tue, 14 Jan 2020 11:35:51 +0000 (12:35 +0100)]
Refactor yang-model-api child traversal return types

Rather than using List<X>/Set<X> we use Collection<? extends X>.
We really want to say 'iterable', but Collection is close enough
and it's slightly more useful.

This allows us to use more efficient facades when coming from
EffectiveStatement world, i.e. filters can use Collections2.filter()
to evaluate substatements lazily.

We also codify proper covariance, which strenghtens the read-only
nature of the returned type.

JIRA: YANGTOOLS-1068
Change-Id: I80be306916dff0575fb4b6824951827e540e482e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 6.0.4 69/86969/2
Robert Varga [Thu, 16 Jan 2020 11:23:47 +0000 (12:23 +0100)]
Bump odlparent to 6.0.4

This adopts odlparent-6.0.4, along with the fix to SFT.

Change-Id: I782fa42ff906314dbe1e030cf806d6fb536fffb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove resetAugmenting() methods 97/86597/2
Robert Varga [Sat, 28 Dec 2019 10:00:36 +0000 (11:00 +0100)]
Remove resetAugmenting() methods

These have been deprecated for some time and have no effect
whatsoever. Remove them.

Change-Id: Idca888e4a9de0fa2efda654f0f503b896a2d563c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove AbstractPathArgument.hashCodeImpl() 46/82346/7
Robert Varga [Thu, 30 May 2019 22:23:04 +0000 (00:23 +0200)]
Improve AbstractPathArgument.hashCodeImpl()

Current computation of hashCode() introduces needless computation,
just for the sake of the computation.

This patch changes the hashCode() algorithm and removes increment:

    QName.hashCode() + 31

which has no real value to how hashCodeImpl() operates. While
we're in the area, we propagate useless invariants.

Change-Id: Ib18518013774673603268ad747883d67b5d2bbf3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 5.0.0-SNAPSHOT 21/86921/1
Robert Varga [Wed, 15 Jan 2020 11:07:12 +0000 (12:07 +0100)]
Bump versions to 5.0.0-SNAPSHOT

This starts the next major release.

Change-Id: I5373319b383d06b13b627ad918aa6a99b13dcb2e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.6-SNAPSHOT 15/86915/1
Robert Varga [Wed, 15 Jan 2020 00:11:24 +0000 (01:11 +0100)]
Bump versions to 4.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I92005a8389ba8e42a5d96617c7a928164204c00e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCheck if we are operating in a grouping before issuing a warning 97/86897/2
Robert Varga [Tue, 14 Jan 2020 16:30:09 +0000 (17:30 +0100)]
Check if we are operating in a grouping before issuing a warning

If we are examining a list in a grouping, we should not be issuing
a warning, as we do not know where that grouping is going to be
instantiated.

Once we determine that a warning may be appropriate, walk statement
contexts upwards, searching for a grouping -- if we find one, just
bail out without any warning.

JIRA: YANGTOOLS-957
Change-Id: If54b05cc444f19f56c6f8b4f931d85b0b270b4ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate DataNodeIterator 79/86879/1
Robert Varga [Tue, 14 Jan 2020 14:56:18 +0000 (15:56 +0100)]
Deprecate DataNodeIterator

This class is used in two places only, where each of the places
only needs specific type of nodes. Expose utility methods for
those two cases and a general tranverser method from SchemaNodeUtils
and deprecate DataNodeIterator.

Change-Id: I4fdc47e16fe2ea7e6f042bb80fe869657ee93fac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize DataNodeIterator.hasNext() 78/86878/1
Robert Varga [Tue, 14 Jan 2020 14:18:42 +0000 (15:18 +0100)]
Optimize DataNodeIterator.hasNext()

This does not quite make sense, but can be optimized to only quickly
look at the collection.

Change-Id: Iabc8414ff712126699f54c02f5aaf9506c4f3f6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate AbstractEffectiveContainerSchemaNode 64/86864/14
Robert Varga [Mon, 13 Jan 2020 15:02:40 +0000 (16:02 +0100)]
Deprecate AbstractEffectiveContainerSchemaNode

With ContainerEffectiveStatementImpl refactored, this class does not
have a direct user and can thus be folded into
AbstractEffectiveOperationContainerSchemaNode.

Deprecate it for removal, so that it does not accidentally pick up
any new users.

JIRA: YANGTOOLS-1065
Change-Id: Ie078b2de0161798a7580e125b19955cebeb1d525
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor ContainerEffectiveStatementImpl 61/86861/17
Robert Varga [Mon, 13 Jan 2020 12:42:04 +0000 (13:42 +0100)]
Refactor ContainerEffectiveStatementImpl

The story here is very similar to ListEffectiveStatementImpl,
with the additional simplifications that containers are pretty
much same.

Size reduction from this refactor ends up being typical 104 bytes
to 40 bytes typical, eliminating a bunch of static collections
in the process.

JIRA: YANGTOOLS-1065
Change-Id: I1050c4e8f82f60274c78e810fc31896daccba389
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate AbstractEffectiveMustConstraintAwareSimpleDataNodeContainer 62/86862/15
Robert Varga [Mon, 13 Jan 2020 12:46:44 +0000 (13:46 +0100)]
Deprecate AbstractEffectiveMustConstraintAwareSimpleDataNodeContainer

With ListEffectiveStatementImpl gone, this class does not have a direct
user and can thus be folded into AbstractEffectiveContainerSchemaNode.

Deprecate it for removal, so that it does not accidentally pick up
any new users.

JIRA: YANGTOOLS-1065
Change-Id: I70b4f11941d248f44dbb8fc146bf5564193b368d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor ListEffectiveStatementImpl 57/86857/18
Robert Varga [Sun, 12 Jan 2020 18:12:09 +0000 (19:12 +0100)]
Refactor ListEffectiveStatementImpl

ListEffectiveStatement implementation is immensely big -- it takes
anywhere between 112 and 224 bytes (120 typical), most of which are
really only indices on substatements, which we can construct on demand.

Applying mixin + layout classes here allows us to drop the size of
these statements to 40/48 bytes typical, with 88 bytes worst case.

The effect on retained memory is ~12% memory foot print reduction,
driven by both reduction of number of ImmutableSets and reduced object
size.

JIRA: YANGTOOLS-1065
Change-Id: Iebcf16b500a874dff94bb21b6f9f59bf056fea51
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor Leaf(List)EffectiveStatementImpl 15/86815/24
Robert Varga [Wed, 8 Jan 2020 23:22:32 +0000 (00:22 +0100)]
Refactor Leaf(List)EffectiveStatementImpl

Leaf(List)EffectiveStatementImpl costs 88 bytes each instance in common
Linux deployment. This turns out to be unnecessary, as be can easily
drop the size to 32/40 (48 worst) bytes by splitting out well-known
constants. This can represent as much as 10% savings on retained heap.

Since the two statements are sharing mapping towards SchemaNode world,
we introduce EffectiveStatementMixins -- utility bridge interfaces,
which are implementing aspects of DocumentedNode and its subclasses
in terms of EffectiveStatement and some mixed-in state.

JIRA: YANGTOOLS-1065
Change-Id: Icdafc4a196d86d2a493a44523bc81b1024854acb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix statement support generic arguments 70/86870/2
Robert Varga [Mon, 13 Jan 2020 22:32:44 +0000 (23:32 +0100)]
Fix statement support generic arguments

StatementSupport implementations should be specifying exact effective
statement, so that EffectiveStatement is correctly tied into the support.

This leads to less generic arguments, making the code easier to read
and more predictable in results.

Change-Id: I24c611035731124315778f834e1a6d6f6a779e0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup AugmentEffectiveStatementImpl 68/86868/3
Robert Varga [Mon, 13 Jan 2020 21:08:54 +0000 (22:08 +0100)]
Cleanup AugmentEffectiveStatementImpl

NamespaceRevisionAware is derived from a QName, hence we can store
the namespace/revision as a QNameModule, saving us a field.

JIRA: YANGTOOLS-1065
Change-Id: I5026ba79fe28686b6d8d05390db558f2b30845b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor KeyEffectiveStatementImpl 43/86843/10
Robert Varga [Thu, 9 Jan 2020 17:04:07 +0000 (18:04 +0100)]
Refactor KeyEffectiveStatementImpl

KeyEffectiveStatementImpl costs 32 bytes each instance in common
Linux deployment. This turns out to be unnecessary, as be can easily
drop the size to 16/24 bytes, based on whether the key is referenced
in the same module as it is defined.

The method we do this by is to provide 4 distinct implementations,
based on 2x2 matrix of locality w.r.t declared statement (same module
means we can can reuse declared argument) and number of substatements
-- "key" with a substatement is exceedingly unlikely, hence we can
usually not store substatements.

JIRA: YANGTOOLS-1065
Change-Id: Id1235131a8568236870521cb988e730a233ea96c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor simple effective statements 14/86814/14
Robert Varga [Wed, 8 Jan 2020 20:21:16 +0000 (21:21 +0100)]
Refactor simple effective statements

Currently DescriptionEffectiveStatementImpl takes 32 bytes in typical
Linux environment, which is not much, but for well-documented models this
can amount to 8% of the cost of a SchemaContext.

The primary cause is of course is inlining of groupings, but even if that
is fixed we will end up with at least one instance for each description,
so sizing here is important.

We can get rid of this cost by decomposing the implementation by known
DescriptionEffectiveStatement invariants, so that we end up with using
16 (typical) or 24 bytes in the same environment. Worst case size is
reduced to 24 (typical) or 32 bytes (from 48). The overall benefit is
expected to be around 4% SchemaContext size.

Apply the same refactor to reference, contact, belongs-to, ordered-by,
default, error-app-tag, error-message, prefix, presence, reference, units.

JIRA: YANGTOOLS-1065
Change-Id: Ic8da0c38cd89ae10c66ebb70719cf582cb0f627b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGeneralize findFirstEffectiveSubstatement() 48/86848/1
Robert Varga [Fri, 10 Jan 2020 22:43:20 +0000 (23:43 +0100)]
Generalize findFirstEffectiveSubstatement()

There is no point in restricting what instances we can seach for,
make sure we can work with any class.

Change-Id: Ia8834fd5a7550295b861d3494b5a343d760d3e86
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse parallel stream to process YANG text files 97/86797/3
Robert Varga [Tue, 7 Jan 2020 23:21:49 +0000 (00:21 +0100)]
Use parallel stream to process YANG text files

When we are examining local YANG files, we are also performing
first step of parsing to determine what the module/revision is
without relying on the file name. This process can take quite
some time if the models are large and/or there are many of them.

Since each file is independent at this stage, use a parallel
stream (and hence common FJ pool) to perform this task in multiple
threads before moving on to processing.

JIRA: YANGTOOLS-1062
Change-Id: I31cee2aa7f313052565ba723cf4c52566821a625
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix {Length,Range}Statement retaining ArrayLists 27/86827/2
Robert Varga [Thu, 9 Jan 2020 15:06:16 +0000 (16:06 +0100)]
Fix {Length,Range}Statement retaining ArrayLists

We want the statement argument to be immutable, make sure this
is so, incidentally reducing footprint, too.

Change-Id: I5e3353ad885ab3cc9eef910d2d4bff1db9eabcf0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRelease YangParser from ProcessorModuleReactor 96/86796/2
Robert Varga [Tue, 7 Jan 2020 22:23:12 +0000 (23:23 +0100)]
Release YangParser from ProcessorModuleReactor

Once we have built the SchemaContext, we should not be retaining
the YangParser instance, as it contains a reference to
BuildGlobalContext, which in turn holds all the scratch data
used during SchemaContext assembly.

Throw all of that away as soon as we have a SchemaContext.

JIRA: YANGTOOLS-1061
Change-Id: Idbc4ab91861e3e7581daa3cebceb0fa49823a028
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCorrect ByteBufUtils javadoc 96/86696/1
Robert Varga [Sat, 4 Jan 2020 12:00:47 +0000 (13:00 +0100)]
Correct ByteBufUtils javadoc

We have some copy&paste references to Byte, which should actually
point to other types. This patch fixes those.

Change-Id: I51661b2519d64a586447e42bd05f5ba8b5d67b5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCompact YT891Test 51/86651/2
Robert Varga [Mon, 30 Dec 2019 21:49:25 +0000 (22:49 +0100)]
Compact YT891Test

This removes duplicate builder chain in favor of passing variant
value to a helper method.

Change-Id: If24612f5d559a9556a7152dbbdd1ab28199e4ad2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove YANGTOOLS-821 test 47/86647/3
Robert Varga [Mon, 30 Dec 2019 21:12:28 +0000 (22:12 +0100)]
Move YANGTOOLS-821 test

As the test does not rely on anything XML, move it to yang-data-impl,
where the tested implementation actually lives.

Change-Id: I6f2cd22aa39dc48d175e537ff7754bfb11d37296
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoYangtools821Test does not need XML 46/86646/3
Robert Varga [Mon, 30 Dec 2019 20:39:24 +0000 (21:39 +0100)]
Yangtools821Test does not need XML

This migrates the test to not use XML parsing for simple data
structures and defines them statically.

Change-Id: Iba508e3024c6f7e0820f8914f7e0f2a0c35cebee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReuse SchemaContext in Yangtools821Test 45/86645/3
Robert Varga [Mon, 30 Dec 2019 20:20:56 +0000 (21:20 +0100)]
Reuse SchemaContext in Yangtools821Test

There is no point in re-creating schemacontext, just initialize
it in @BeforeClass.

Change-Id: Ic08596eac6b47415e3511c41d962a494daed4f93
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove YANGTOOLS-892 test 44/86644/3
Robert Varga [Mon, 30 Dec 2019 20:17:49 +0000 (21:17 +0100)]
Move YANGTOOLS-892 test

As the test does not rely on anything XML, move it to yang-data-impl,
where the tested implementation actually lives.

Change-Id: I9d77734bc05e5c4b1033da5f32f9bc80f50bd827
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd missing test assertions 48/86648/1
Robert Varga [Mon, 30 Dec 2019 21:24:03 +0000 (22:24 +0100)]
Add missing test assertions

While the test has shown the exception no longer occurs, it should
also make assertions. Add that.

JIRA: YANGTOOLS-1060
Change-Id: Id3f864f769c3ac845fe5ed3501fba24502206202
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoYangtools892Test does not need XML 34/86634/5
Robert Varga [Mon, 30 Dec 2019 16:09:28 +0000 (17:09 +0100)]
Yangtools892Test does not need XML

This migrates the test to not use XML parsing for simple data
structures and defines them statically.

Change-Id: I1c4f71035d1949395cc6780a74a49133a1b28b98
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove QName resolution 29/86629/2
Robert Varga [Mon, 30 Dec 2019 13:44:49 +0000 (14:44 +0100)]
Improve QName resolution

AbstractQName, as exposed from QNameStep is sufficient for us to
execute the step. Take advantage of this, simplifying and speeding
up namespace binding.

Change-Id: I1a5f58a5008ee077fb6496a59d4bbb0c132ca6ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove YANGTOOLS-891 test 33/86633/2
Robert Varga [Mon, 30 Dec 2019 15:55:21 +0000 (16:55 +0100)]
Move YANGTOOLS-891 test

As the test does not rely on anything XML, move it to yang-data-impl,
where the tested implementation actually lives.

Change-Id: Ifdcc561f9fffb4b93e03a8e7538261046fd338d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoYangtools891Test does not need XML 32/86632/2
Robert Varga [Mon, 30 Dec 2019 15:18:44 +0000 (16:18 +0100)]
Yangtools891Test does not need XML

This migrates the test to not use XML parsing for simple data
structures and defines them statically.

Change-Id: Iaf97f4853349b74efb21d1600bd72c4ea35c325a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up YT891 test 31/86631/2
Robert Varga [Mon, 30 Dec 2019 14:59:06 +0000 (15:59 +0100)]
Speed up YT891 test

Rather than parsing SchemaContext multiple times, just use @BeforeClass
to initialize it once.

Change-Id: I4c9e5c30a2767bab35133557121e0ff1710e688c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPropagate 'absolute path' invariant 26/86626/2
Robert Varga [Mon, 30 Dec 2019 11:56:23 +0000 (12:56 +0100)]
Propagate 'absolute path' invariant

Since we are checking whether an expression is absolute or not,
we can hook onto our internal methods, improving performance a bit
and reducing reliance on PathExpressionImpl.

Change-Id: I1e73f9f5ac2652b57517bdfc1631ba49e98396f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove duplicate checkState() 25/86625/2
Robert Varga [Mon, 30 Dec 2019 11:54:00 +0000 (12:54 +0100)]
Remove duplicate checkState()

The only caller already checks for the path being absolute, there
is no need to check twice.

Change-Id: I24a038ccfe73b47ceaa13e65f3ea3b74c1a3176f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCollapse SchemaContextUtil.typeDefinition() 24/86624/2
Robert Varga [Mon, 30 Dec 2019 11:36:34 +0000 (12:36 +0100)]
Collapse SchemaContextUtil.typeDefinition()

We have TypedDataSchemaNode to hold the leaf/leaf-list trait of
having a type. This allows us to ditch some code duplication.

Change-Id: I959ff6a8f997e557736a081f89df6c16b69e1270
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDefer path stripping 23/86623/2
Robert Varga [Mon, 30 Dec 2019 11:29:31 +0000 (12:29 +0100)]
Defer path stripping

If we are passed a relative path, we end up first stripping it
and then realizing it's relative. Invert the order, making absolute
proper invariant.

Change-Id: Ic272ac83a9df9d2343b1cd8c5f71debdcdc0faad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove useless SchemaContextUtil. qualification 22/86622/2
Robert Varga [Mon, 30 Dec 2019 11:27:39 +0000 (12:27 +0100)]
Remove useless SchemaContextUtil. qualification

This trims a few lines, making navigation easier.

Change-Id: I42bef346e774d9bd1173092bdefcd68e400b9a5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix SchemaContextUtils.findDataSchemaNode() namespace handling 11/86611/16
Robert Varga [Sun, 29 Dec 2019 08:11:29 +0000 (09:11 +0100)]
Fix SchemaContextUtils.findDataSchemaNode() namespace handling

If we encounter a qualified identifier in a path define in a submodule
which uses a prefix defined in the submodule only (without a matching
import in the main module), we would end up not being able to resolve
the prefix.

Ever since we integrated YANGTOOLS-969, this is not necessary, as the
parser resolves all qualified identifiers, as per PathExpression API
contract.

Take advantage of this fact, reducing the amount of re-parsing we do
for historic reasons, completely removing the need to resolve prefixes.

JIRA: YANGTOOLS-1060
Change-Id: Id761d103f1070738624cd0ef1865270e4b884be2
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd another alternative SchemaContextUtil.findDataSchemaNode() 21/86621/6
Robert Varga [Mon, 30 Dec 2019 08:11:16 +0000 (09:11 +0100)]
Add another alternative SchemaContextUtil.findDataSchemaNode()

We have a number of call sites which are using the XPath variant
of SchemaContextUtil.findDataSchemaNode() in context where the
complexity is not warranted.

Introduce utility methods to migrate those callers to a simplified
version which takes resolved QNames (but does not use SchemaPath),
reducing proliferation of PathExpressionImpl.

JIRA: YANGTOOLS-1060
Change-Id: Id645563733af448f42ecdc62b26205c1a97a2216
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoClean up SchemaContextUtilTest 16/86616/2
Robert Varga [Sun, 29 Dec 2019 13:09:03 +0000 (14:09 +0100)]
Clean up SchemaContextUtilTest

There is no need to parse YANG files multiple times, just use
@BeforeClass to resolve invariants.

JIRA: YANGTOOLS-1052
Change-Id: Id290aec957b5f70bcdaa7e020799783b02b23c28
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove SchemaContextUtilTest 15/86615/3
Robert Varga [Sun, 29 Dec 2019 12:45:46 +0000 (13:45 +0100)]
Move SchemaContextUtilTest

We now have the proper place to hold this unit test, move it to
yang-model-util. Also split out tests which rely on pure mocking
so that they run in yang-model-util instead.

JIRA: YANGTOOLS-1052
Change-Id: Ic736621c7ec2f55ee45d608866f7a581a6d60ef6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoClean up openconfig-version test resources 14/86614/1
Robert Varga [Sun, 29 Dec 2019 12:28:39 +0000 (13:28 +0100)]
Clean up openconfig-version test resources

This moves the test resources so they are not scattered across
two directory hierarchies.

Change-Id: I202f415b8f7366047a691f80c1899b6d2875a4a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove useless UnsupportedOperationException throws 12/86612/2
Robert Varga [Sun, 29 Dec 2019 09:28:13 +0000 (10:28 +0100)]
Remove useless UnsupportedOperationException throws

Utility methods have a private constructor, there is no need to
explicitly guard against instantiation.

Change-Id: I93562128b61f051510245de5fe78226508f571b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse findTargetNode() in findDataSchemaNode() 10/86610/2
Robert Varga [Sun, 29 Dec 2019 08:47:18 +0000 (09:47 +0100)]
Use findTargetNode() in findDataSchemaNode()

This removes a bit of duplication by sharing the code path with
relative resolver.

Change-Id: Icb619aca8d87ade490066fd8c6abe0d2a96dec96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate PathExpressionImpl for removal 09/86609/1
Robert Varga [Sun, 29 Dec 2019 08:07:59 +0000 (09:07 +0100)]
Deprecate PathExpressionImpl for removal

This transitional class is deprecated, mark it for removal, too.

Change-Id: I8241fd17780f1a9bd5940d2e3dfc52888f301a29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd RFC8341 NACM module identity 32/80732/4
Robert Varga [Fri, 8 Mar 2019 05:01:07 +0000 (06:01 +0100)]
Add RFC8341 NACM module identity

This adds revisions of RFC8341 without actually binding to them.

Change-Id: Icaae9347c5f4e3f02f976d629a4f760eca6dd464
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.5-SNAPSHOT 02/86602/1
Robert Varga [Sat, 28 Dec 2019 17:47:11 +0000 (18:47 +0100)]
Bump versions to 4.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I1b3713dde4fb051e2486190f7dc2e37bd04cbc98
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoIssue an info message when a config=true list does not have keys 98/86598/1
Robert Varga [Sat, 28 Dec 2019 10:09:37 +0000 (11:09 +0100)]
Issue an info message when a config=true list does not have keys

RFC7950 section 7.8.2 places an explicit requirement that lists
representing configuration (i.e. config=true) must define at least
one key.

This restriction does make sense in contexts like NETCONF, but is
generally not needed in OpenDaylight. Since it hurts model
interoperability, add a message pointing this violation out.

JIRA: YANGTOOLS-957
Change-Id: If29078e51aa1ec55fa070f263755f15147ad835f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate resetAugmenting() for removal 96/86596/1
Robert Varga [Sat, 28 Dec 2019 09:59:19 +0000 (10:59 +0100)]
Deprecate resetAugmenting() for removal

These methods were forgotten in the 4.0.0 transition, mark them
as deprecated-for-removal. A follow-up patch will remove them in
the 5.0.0 time frame.

Change-Id: I1920129e01cef2bf8ee8679d579679dd986d0ed5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd yang-common JMPS javadoc 85/86585/1
Robert Varga [Thu, 26 Dec 2019 21:38:19 +0000 (22:38 +0100)]
Add yang-common JMPS javadoc

This adds Module-level documentation, at least its bare bones.

Change-Id: I08c98f111063d3dffb1f2812aab69a20de289ea5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit out RFC7950 ANTLR grammars 80/86580/3
Robert Varga [Thu, 26 Dec 2019 12:51:40 +0000 (13:51 +0100)]
Split out RFC7950 ANTLR grammars

ANTLR-generated code does not pass SpotBugs validation, leaving a
lot of code uncovered by SpotBugs enforcement. This patch splits
the grammars into a separate artifact, allowing the rest of the
parser to be cleaned up.

JIRA: YANGTOOLS-1057
Change-Id: If65bf28e1add5085cb43a2fc2ad71cafc4cd6adb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate yang-xpath-antlr a bit 79/86579/2
Robert Varga [Thu, 26 Dec 2019 13:04:31 +0000 (14:04 +0100)]
Update yang-xpath-antlr a bit

This adds the description of the package held in this artifact, adding
a warning about API stability.

Also turn the artifact into a proper JPMS module, as it does not really
depend on anything.

JIRA: YANGTOOLS-1055
Change-Id: Id5a2fef1fa9ef0e56f1ab6994c5a90f06f0ab4f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSuppress UPM_UNCALLED_PRIVATE_METHOD 82/86582/2
Robert Varga [Thu, 26 Dec 2019 13:24:11 +0000 (14:24 +0100)]
Suppress UPM_UNCALLED_PRIVATE_METHOD

This is a SpotBugs deficiency, suppress warnings generated from it.

JIRA: YANGTOOLS-1056
Change-Id: I5d440de6ce98207c72727273eedf26d3c0626f86
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRework LeafRefValidation 66/86566/17
Robert Varga [Wed, 25 Dec 2019 11:12:54 +0000 (12:12 +0100)]
Rework LeafRefValidation

This reworks LeafRefValidation in terms of interpreting XPathExpression
via exposed parsed steps. This allows us to eliminate a chunk of parsing
code, speeding the initialization process up.

QNamePredicateImpl/AbstractQNameWithPredicate are losing their Serializable
trait, as it is not really useful and tickles SpotBugs unnecessarily.

JIRA: YANGTOOLS-1051
Change-Id: I502f54052ca8bb10e6595f41ba7aca6cef9550ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoIntroduce yang-xpath-antlr 77/86577/4
Robert Varga [Wed, 25 Dec 2019 22:52:59 +0000 (23:52 +0100)]
Introduce yang-xpath-antlr

This splits out ANTLR-generated parser code into a separate
artifact, so that it does not interfere with our regular
hand-written code.

Also fixup the two issues reported by spotbugs and flip
the switch on enforcement.

JIRA: YANGTOOLS-1055
Change-Id: Ida1c152af8d5e2e235831f1d7b3e272820b085ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRework incoming candidate check 76/86576/2
Robert Varga [Wed, 25 Dec 2019 22:21:33 +0000 (23:21 +0100)]
Rework incoming candidate check

SpotBugs does not like the checkArgument()-based check, rework
it in terms of an explicit if(), so that SpotBugs is happy.

Change-Id: Ic0cb1554a80cdc1971e650c9d23180faf969b8d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix ValueWithQName.getQName() name 75/86575/2
Robert Varga [Wed, 25 Dec 2019 22:17:11 +0000 (23:17 +0100)]
Fix ValueWithQName.getQName() name

This adds a SpotBugs suppression and adds the correct name for the
method.

Change-Id: Ibe985a63c21693bc9efdcb4cb98513ebf4c01b7c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoInline INCORRECT_LEXICAL_REPRESENTATION 74/86574/1
Robert Varga [Wed, 25 Dec 2019 22:11:21 +0000 (23:11 +0100)]
Inline INCORRECT_LEXICAL_REPRESENTATION

This inlines the string used from a single place, eliminating
the need for String.format() and thus fixing a SpotBugs
VA_FORMAT_STRING_USES_NEWLINE issue.

Change-Id: I0746b4b28cce4ff991a632ab38ad8499e5f9aadf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRework QNameStep API integration 70/86570/4
Robert Varga [Wed, 25 Dec 2019 18:49:37 +0000 (19:49 +0100)]
Rework QNameStep API integration

What we really want here is to take advantage of the fact we have
AbstractQName. It allows us to simplify our XPath model in terms
of class differences.

JIRA: YANGTOOLS-1054
Change-Id: Icfb8f82ae5dbcc0888bf7fd734b4eb23bc277933
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix PathExpressionParser predicate path handling 71/86571/2
Robert Varga [Wed, 25 Dec 2019 20:58:24 +0000 (21:58 +0100)]
Fix PathExpressionParser predicate path handling

Handling of a predicate was wrong in that the right-handside
involving a current() call did not correctly predicates.

This turns out to be a simple typo in two places, fix it and add
an explicit test.

JIRA: YANGTOOLS-1053
Change-Id: I54bac10cdd508503ad896edd628ffa436173ca6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd spotbugs/811 suppression 65/86565/1
Robert Varga [Wed, 25 Dec 2019 11:24:25 +0000 (12:24 +0100)]
Add spotbugs/811 suppression

JDK11 incurs a spotbugs warning which is not correct, supress it.

Change-Id: Ib4262bfd0aa3728fe7eb94eb970e4b59035cc0b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix InterningLeafSetNodeBuilder check 64/86564/1
Robert Varga [Wed, 25 Dec 2019 11:23:09 +0000 (12:23 +0100)]
Fix InterningLeafSetNodeBuilder check

The instanceof check is wrong, as pointed out by SpotBugs, as we
want to check for LeafListSchemaNode not LeafSetNode.

Change-Id: If538beca159c100621d5661dc8dced5c1051dfe9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTrim deref() argument 60/86560/1
Robert Varga [Tue, 24 Dec 2019 21:55:41 +0000 (22:55 +0100)]
Trim deref() argument

When we are evaluating a deref() call we need to make sure we
strip the string completely, otherwise we would arrive at incorrect
path.

JIRA: YANGTOOLS-1050
Change-Id: I36b45677243bcb8ccbf91f8813f082dbddee2a6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCorrect deref() leafref handling 49/86549/8
Robert Varga [Mon, 23 Dec 2019 19:06:56 +0000 (20:06 +0100)]
Correct deref() leafref handling

deref() invocation requires the target node to actually be examined,
derefenced and any subsequent path evaluated on top of it.

We correct the implementation to account for correct derefence and
add a UT for a confusing test case. This is implemented using
YangParserTestUtils in a separate internal artifact, hence future
test cases are easy to implement.

JIRA: YANGTOOLS-1050
Change-Id: I0777da339577f93ecc2786f5beab40b29554fe0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAllow Errata 5617 expressions in leafref 90/82690/20
Robert Varga [Mon, 24 Jun 2019 16:01:16 +0000 (18:01 +0200)]
Allow Errata 5617 expressions in leafref

This updates PathExpression interface to allow expressing
leafref paths which start with a deref(...) function call,
as proposed by https://www.rfc-editor.org/errata/eid5617.

This unfortunately necessitates breaking the API contract of this
interface, as the original object model could not express these.

JIRA: YANGTOOLS-968
Change-Id: I3a193d338de5a82b95d2dd6cc5200e77032e67d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
4 years agoForce path expression parsing consume all data 45/86545/3
Robert Varga [Sun, 22 Dec 2019 10:20:29 +0000 (11:20 +0100)]
Force path expression parsing consume all data

We really need to make sure we do not end up ignoring part of the
expression just because our rules are not exhaustive. This adds
the appropriate test and fix in grammar.

JIRA: YANGTOOLS-1049
Change-Id: I85278f0cd109897459be1db029fafbc95e203201
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMark yang-maven-plugin as thread-safe 14/86414/1
Robert Varga [Fri, 13 Dec 2019 08:16:25 +0000 (09:16 +0100)]
Mark yang-maven-plugin as thread-safe

The plugin can be executed in multiple projects concurrently,
mark it as such.

Change-Id: I600e733299a7db87dc8040bef89c97ecf9f5f568
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix a method reference 13/86413/1
Robert Varga [Fri, 13 Dec 2019 08:15:36 +0000 (09:15 +0100)]
Fix a method reference

This was missed during upgrade to EffectiveModelContext, fix that.

Change-Id: I9dcb2b97d9648a527b156811568e9bf650a8165a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.4-SNAPSHOT 31/86331/3
Robert Varga [Tue, 10 Dec 2019 17:14:48 +0000 (18:14 +0100)]
Bump versions to 4.0.4-SNAPSHOT

This starts the next development iteration.

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