yangtools.git
4 years agoOptimize DataNodeIterator.hasNext() 91/86891/2
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>
(cherry picked from commit 1adcabecdcab85b6ed657271758560fc5eeb917f)

4 years agoDeprecate AbstractEffectiveContainerSchemaNode 88/86888/1
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>
(cherry picked from commit cf0eac6a6dbfad52a4fdbceecf0ac41646b0d631)

4 years agoRefactor ContainerEffectiveStatementImpl 87/86887/1
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>
(cherry picked from commit bbdfd546e8f79773f2162717f607551bb79fcbda)

4 years agoDeprecate AbstractEffectiveMustConstraintAwareSimpleDataNodeContainer 86/86886/1
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>
(cherry picked from commit 6be4080cc62f637314debf0b4ccd8e7cc8f905f1)

4 years agoRefactor ListEffectiveStatementImpl 85/86885/1
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>
(cherry picked from commit fb9318d77d36a605497c3d12a5fc602a0ed2265f)

4 years agoRefactor Leaf(List)EffectiveStatementImpl 84/86884/1
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>
(cherry picked from commit 59f98cbf8ef79ecab8ee6d7c5141704142b0f40a)

4 years agoFix statement support generic arguments 83/86883/1
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>
(cherry picked from commit 7bb6ae1269659c12efc127b97cc750ed81ecaac6)

4 years agoCleanup AugmentEffectiveStatementImpl 82/86882/1
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>
(cherry picked from commit ee4fe090b11c24a74e15c186bdea074c1d4abd3d)

4 years agoRefactor KeyEffectiveStatementImpl 81/86881/1
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>
(cherry picked from commit 11d4ce226da8231118f5480ef5884b8e079ff437)

4 years agoRefactor simple effective statements 80/86880/1
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>
(cherry picked from commit 312068b3e5eca1b3c336fa029a5a81c7b6a031c0)

4 years agoGeneralize findFirstEffectiveSubstatement() 52/86852/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>
(cherry picked from commit 974385ed778393e2b28c3ef771ced6c3337c543c)

4 years agoUse parallel stream to process YANG text files 51/86851/1
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>
(cherry picked from commit fcb529766049a3ab75cd9a0de4603c0a815c5a0b)

4 years agoFix {Length,Range}Statement retaining ArrayLists 28/86828/1
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 99/86799/1
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>
(cherry picked from commit de31cd1e591ab1a83ca3fafd20220d3937463b8a)

4 years agoAdd missing test assertions 52/86652/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>
(cherry picked from commit 1b8b4019c928ff50f63f778d49f6744c7f12923d)

4 years agoSpeed up YT891 test 43/86643/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>
(cherry picked from commit d76d0664c6090138b90d3e184746d5f9af64b3ea)

4 years agoPropagate 'absolute path' invariant 42/86642/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>
(cherry picked from commit f3eb0e79d578eca88c4a19841300dfe7288bf314)

4 years agoRemove duplicate checkState() 41/86641/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>
(cherry picked from commit d3700afdd16b8f486e4d401e07649dc76aa8e1bf)

4 years agoCollapse SchemaContextUtil.typeDefinition() 40/86640/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>
(cherry picked from commit 12c1e8fdac8294e5636dd82b8b2c39a3d3a8c3f5)

4 years agoDefer path stripping 39/86639/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>
(cherry picked from commit 0236f96b973675555087801c0d786d7f19eee8f1)

4 years agoRemove useless SchemaContextUtil. qualification 38/86638/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>
(cherry picked from commit fb51bb5aaa4caaa862995a61447f91a4fe6bf08c)

4 years agoFix SchemaContextUtils.findDataSchemaNode() namespace handling 37/86637/2
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>
(cherry picked from commit 53450187df51937ffd75ff59946abdaec1bbddaf)

4 years agoAdd another alternative SchemaContextUtil.findDataSchemaNode() 36/86636/1
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>
(cherry picked from commit 0c48f313a0e06974816cf0d114a83ad1139219b4)

4 years agoClean up SchemaContextUtilTest 20/86620/1
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>
(cherry picked from commit 536a5d80bf67f2630adf7765a2ab83644efff3d4)

4 years agoMove SchemaContextUtilTest 19/86619/1
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>
(cherry picked from commit 0ba26f769c753bad2e9eabea5ae04a1ffc22305b)

4 years agoClean up openconfig-version test resources 18/86618/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>
(cherry picked from commit c005231c76c371a4b144993aa90a63d90587925b)

4 years agoRemove useless UnsupportedOperationException throws 17/86617/1
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>
(cherry picked from commit f429749a59a10820b1bad0e9c3502ceac2ec1d07)

4 years agoUse findTargetNode() in findDataSchemaNode() 13/86613/1
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>
(cherry picked from commit 57a7f87c3115454aba47299d797da48a1227c9b2)

4 years agoIssue an info message when a config=true list does not have keys 00/86600/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>
(cherry picked from commit e9061a5ad89661154190aa7703b1de95a5fb528e)

4 years agoFix PathExpressionParser predicate path handling 73/86573/1
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>
(cherry picked from commit 90457a20b9d0f6a7652563781d04c19002d29a4e)

4 years agoFix InterningLeafSetNodeBuilder check 67/86567/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 61/86561/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>
(cherry picked from commit 2e7e6dc6ee82447a286e4df18415de4bff6c2b4e)

4 years agoCorrect deref() leafref handling 59/86559/2
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>
(cherry picked from commit 2ef2f65082021eab8213c4a9e0d71a2cc42a6962)

4 years agoAllow Errata 5617 expressions in leafref 58/86558/1
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>
(cherry picked from commit 2788395b6edecb26c9c2e59b2ab94275e8276987)

4 years agoForce path expression parsing consume all data 47/86547/1
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>
(cherry picked from commit 8dc8c85e43be7c78a8aa4081d970e924b9757b3f)

4 years agoMark yang-maven-plugin as thread-safe 17/86417/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>
(cherry picked from commit b8a6ab55af0f9894736bfbf0d4c0bae7dda4f249)

4 years agoFix JDK11 compilation 57/86357/2
Robert Varga [Wed, 11 Dec 2019 20:34:09 +0000 (21:34 +0100)]
Fix JDK11 compilation

This fixes up a javac inference problem, which is completely fine
as we can drop down to java.lang.Object, which we'll be casting
anyway.

Change-Id: I5ce990970607a917d20130a0ecf71a107b3cc0ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 3.0.8-SNAPSHOT 56/86356/1
Robert Varga [Wed, 11 Dec 2019 17:52:11 +0000 (18:52 +0100)]
Bump versions to 3.0.8-SNAPSHOT

This starts the next development iteration.

Change-Id: I800560d1a06de2b0b45ee0af6a3685732a613e3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 5.0.4 55/86355/1
Robert Varga [Wed, 11 Dec 2019 17:51:16 +0000 (18:51 +0100)]
Bump odlparent to 5.0.4

This picks up the latest fixes.

Change-Id: Iecf40d92d46d68b746b02e2817aabd2de28a3b2c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove intermediate checking maps 19/86019/1
Robert Varga [Tue, 26 Nov 2019 16:57:27 +0000 (17:57 +0100)]
Remove intermediate checking maps

We are enforcing schema tree validity, which is a superset of
the intermediate checks being done in these constructors. Remove
these maps.

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

4 years agoEliminate childNodes map 18/86018/1
Robert Varga [Mon, 25 Nov 2019 15:06:50 +0000 (16:06 +0100)]
Eliminate childNodes map

Both AbstractEffectiveDocumentedDataNodeContainer and
AbstractEffectiveModule are subclasses of
AbstractSchemaEffectiveDocumentedNode, which contains schema tree
index.

As all DataSchemaNodes have to strictly be a subset of the schema
tree, we can ditch the dedicated index and simply perform a lookup
on the schema tree followed by a check for DataSchemaNode.

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

4 years agoCentralize must contraint definitions 17/86017/1
Robert Varga [Mon, 25 Nov 2019 14:11:16 +0000 (15:11 +0100)]
Centralize must contraint definitions

A number of statemnts can contain must expressions, which we are
tracking separately in each class. This adds common superclasses
to hold the common definition, reducing the amount of duplication.

JIRA: YANGTOOLS-1040
Change-Id: Id5733b62838f484350094456452c7a1d0039f3f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0d63e62a11945ade7371bb4667cf65409336f54c)

4 years agoCentralize unknownNodes 16/86016/1
Robert Varga [Mon, 25 Nov 2019 12:54:17 +0000 (13:54 +0100)]
Centralize unknownNodes

We have a number of statements which collect unknown nodes, which
are specified by DocumentedNode. Centralize them as close as possible
in the utility class hierarchy.

JIRA: YANGTOOLS-1040
Change-Id: I337fb684b557269926e641d86d6afd609b2dce57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 805ce8dc5e98b90427de0cc49fad70d7054635a6)

4 years agoRefactor AbstractEffectiveModule 15/86015/1
Robert Varga [Tue, 26 Nov 2019 11:27:57 +0000 (12:27 +0100)]
Refactor AbstractEffectiveModule

AbstractEffectiveModule has a number of special cases in its
constructor, effectively adding behavior based on expected subclass.

Furthermore its layout does not correctly propagate declared/effective
substatements towards superclass, leading to partially-populated
data/schema tree namespaces.

This patch moves the special handling bits to subclasses, making
AbstractEffectiveModule properly agnostic of whether it is used as
a ModuleEffectiveStatement or SubmoduleEffectiveStatement.

For the mechanics of including submodule effective statements into
the main module we introduce ModuleStmtContext, which performs the
semantic addition, thus all StmtContexts are properly visible as if
they were declared in the main module.

JIRA: YANGTOOLS-1042
Change-Id: Ice9609c2db82981ec9156d076f8a02bc637181b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 32b112dc64848d9c1cf0ea227109ca9a1265e2e7)

4 years agoFix XPath binary expressions 03/86003/1
Robert Varga [Tue, 26 Nov 2019 23:54:43 +0000 (00:54 +0100)]
Fix XPath binary expressions

AntlrXPathParser.parseRelationalExpr() is consuming acquiring
the operator twice, which leads to iterator state mismatch:

Caused by: java.util.NoSuchElementException
    at java.util.ArrayList$Itr.next (ArrayList.java:999)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser.nextOperator (AntlrXPathParser.java:640)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser.parseRelationalExpr (AntlrXPathParser.java:561)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser.parseRelational (AntlrXPathParser.java:431)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser.parseEquality (AntlrXPathParser.java:310)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser.parseAnd (AntlrXPathParser.java:299)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser.parseExpr (AntlrXPathParser.java:281)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser.parseExpr (AntlrXPathParser.java:261)
    at org.opendaylight.yangtools.yang.xpath.impl.AntlrXPathParser$Qualified.parseExpression (AntlrXPathParser.java:151)

Fix this by properly reusing operator we have already acquired.

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

4 years agoSquash self-steps when parsing expression 02/86002/1
Robert Varga [Wed, 27 Nov 2019 00:17:33 +0000 (01:17 +0100)]
Squash self-steps when parsing expression

There is no point to repeat self-reference steps, make sure we
skip them when creating a location path. This results in slightly
smaller expressions as well as more obvious comparisons.

JIRA: YANGTOOLS-1045
Change-Id: If681dce2a6bc7155965fed91c47f19f2c541805a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 63b3f4804b408d86a27a6dbe80c21ea7cca921b0)

4 years agoDetect duplicate groupings in operation definitions 90/85990/2
Robert Varga [Tue, 26 Nov 2019 17:13:47 +0000 (18:13 +0100)]
Detect duplicate groupings in operation definitions

It seems we have been missing a namespace check here, fix that.

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

4 years agoSpeed up confict detection 89/85989/2
Robert Varga [Tue, 26 Nov 2019 17:01:15 +0000 (18:01 +0100)]
Speed up confict detection

Instead of using Set.contains() before issuing an Set.add() and
ignoring its value, we just add the statement and check the return
value -- if it returns false, we know we have detected a conflict.

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

4 years agoRework EffectiveStatementBase statement order restoration 88/85988/2
Robert Varga [Tue, 26 Nov 2019 10:03:27 +0000 (11:03 +0100)]
Rework EffectiveStatementBase statement order restoration

Rather than relying on mutation of effective substatements when we
are building an effective statements (and thus requiring StmtContext
to be StatementContextBase), use simple filtering to implement
statement ordering.

This limits the scope of mutable state, explains what is going
on and allows use of different StmtContext implementations.

JIRA: YANGTOOLS-1042
Change-Id: I84a2517ef0ce666fbc2f2c6faa3b0d0a43eef6eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 75276bc6d944ff002de8149108d60603349d49c6)

4 years agoRemove Collection2.filter() from EffectieStatementBase 69/85969/1
Robert Varga [Tue, 26 Nov 2019 08:30:26 +0000 (09:30 +0100)]
Remove Collection2.filter() from EffectieStatementBase

We use the filtered collection only to iterate in a for loop, hence
it is more efficient to move the filter into the loop itself,
eliminating an intermediate collection.

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

4 years agoAdd AbstractEffectiveDocumentedNodeWithoutStatus 68/85968/1
Robert Varga [Mon, 25 Nov 2019 12:07:44 +0000 (13:07 +0100)]
Add AbstractEffectiveDocumentedNodeWithoutStatus

We have a number of statements which are specified to be DocumentedNode,
but not DocumentedNode.WithStatus. These are handled by subclassing
DeclaredEffectiveStatementBase and repeated logic looking up description
and reference.

Introduce AbstractEffectiveDocumentedNodeWithoutStatus, which acts as
a plain DocumentedNode implementation without also implying WithStatus
and retrofits this class to all users.

JIRA: YANGTOOLS-1040
Change-Id: Ied1794c4fbd8ca27a4add1d2245fdfb10d8104cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 96d12ee2688b296760c29597d44140a34ca762cf)

4 years agoResync javadoc links 81/85881/1
Robert Varga [Wed, 20 Nov 2019 08:01:55 +0000 (09:01 +0100)]
Resync javadoc links

This re-synchronizes links to upstreams to match odlparent.

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

4 years agoSeparate out {Identity,Equality}QueuedNotificationManager 35/85735/2
Robert Varga [Fri, 16 Aug 2019 16:00:47 +0000 (18:00 +0200)]
Separate out {Identity,Equality}QueuedNotificationManager

There are use cases where we would like to use QNM on equality, i.e.
we do not realy have a listener instance, but rather a key to somewhere
else. That other place operates on equality, which makes it incompatible
with the current semantics.

This splits out the baseline queueing logic in from NotificationManager
interface, so that it can be reused to implement different execution
concepts.

QueuedNotificationManager is realized on top of it, so that the baseline
interface is implemented in AbstractQueuedNotificationManager and then
specialized to different lookups.

JIRA: YANGTOOLS-1038
Change-Id: I1123d21664a20ff380ccb7db7096801915491f6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 807d0868fa0e9b81332ea12d8fe19f81f88efc08)

4 years agoDeprecate LoggingThreadUncaughtExceptionHandler for removal 98/85598/1
Robert Varga [Mon, 4 Nov 2019 10:46:40 +0000 (11:46 +0100)]
Deprecate LoggingThreadUncaughtExceptionHandler for removal

This class creates leaks SLF4J API as an API dependency, which is
rather wrong. Deprecate it for removal.

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

4 years agoNormalize predicate order in ImmutableNodes.fromInstanceId() 95/85595/1
Robert Varga [Tue, 5 Nov 2019 13:04:56 +0000 (14:04 +0100)]
Normalize predicate order in ImmutableNodes.fromInstanceId()

The only user of this method is NETCONF, which requires predicates
to be ordered in the order of key definition, as per XML encoding
rules.

Make sure we re-create NodeIdentifierWithPredicates in the schema
definition order if the provided order does not already match it.

JIRA: YANGTOOLS-1037
Change-Id: I57c389eeecb9680062be8b56c834eb569e7d3d3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4f869bbe2f963d9168eb659bc1761bfd174e6ab3)

4 years agoExpose underlying schema from DataContainerNormalizationOperation 91/85591/1
Robert Varga [Tue, 5 Nov 2019 12:19:21 +0000 (13:19 +0100)]
Expose underlying schema from DataContainerNormalizationOperation

For the purposes for normalizing data child order we will need to
access the underlying schema in a type-safe manner -- this adds
the mechanics to do so.

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

4 years agoRename ListItemNormalization 89/85589/1
Robert Varga [Tue, 5 Nov 2019 12:06:28 +0000 (13:06 +0100)]
Rename ListItemNormalization

This is a confusing name, as it should match the NormalizedNode-speak,
i.e. MapEntry* and UnkeyedListEntry*. This fixes up the names, so it is
clear what node a particular class refers to.

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

5 years agoAdd static ArgumentUtils XPath integration 47/85447/2
Robert Varga [Tue, 29 Oct 2019 21:44:25 +0000 (22:44 +0100)]
Add static ArgumentUtils XPath integration

YANG parser needs to interpret when/must expressions so that they
can be used by downstreams in their effective view.

We add static binding of rfc7950.stmt to an implementation of
YangXPathParserFactory. This makes it clear we do not need to
actually store URIs to make things useful, hence we deprecate
URIStringToImportPrefix namespace.

JIRA: YANGTOOLS-966
Change-Id: Iaf771ad5e0bcdd058fe537ed67d5c9e4e6556e81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 74ce3034bd665b107918ca25693760d6aa629ef9)

5 years agoAdd YangXPathExpression.getYangVersion() 46/85446/1
Robert Varga [Wed, 30 Oct 2019 20:21:10 +0000 (21:21 +0100)]
Add YangXPathExpression.getYangVersion()

Retrofit awareness of features contained in a particular expression,
so that runtime can properly evaluate them.

Also update parser to intercept RuntimeExceptions and turn them into
checked XPathExpressionExceptions.

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

5 years agoExpose minimum YANG version for YangFunction 34/85434/1
Robert Varga [Wed, 30 Oct 2019 13:44:56 +0000 (14:44 +0100)]
Expose minimum YANG version for YangFunction

Not all YangFunctions are available when we are operating in RFC6020
mode. This patch exposes the minimum YANG version from YangFunction,
so it can be checked at runtime.

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

5 years agoReinstate "Check for nested augmentations" 61/85361/1
Robert Varga [Tue, 22 Oct 2019 20:20:00 +0000 (22:20 +0200)]
Reinstate "Check for nested augmentations"

This reverts commit 02fa7531709e3c4599bc9ec23dc605a21a711bc1, effectively
re-applying 759e69d85991edb987a760165adb83fa3f2ab67b.

We also add the mechanics needed to walk the copy history backwards, as
needed to understand the copy process.

JIRA: YANGTOOLS-956
Change-Id: I96b3afb30fdcd326ef9b780ff02ccc7f1c94e07e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 801a53da5a59219883bb1141d2e8191c11b65f47)

5 years agoAdd lenient JsonParserStream 46/85346/1
serngawy [Tue, 15 Oct 2019 20:00:59 +0000 (16:00 -0400)]
Add lenient JsonParserStream

It is beneficial to have the JSON parser ignore unknown constructs,
so that all other data gets parsed successfully.

This patch adds JsonParserStream.createLenient() to return such
parsers.

JIRA: YANGTOOLS-1034
Change-Id: I5ec9dbbf6dc52270bf83d7c4ed6c4d16181f74a7
Signed-off-by: serngawy <m.elserngawy@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 50ba8458e9b8eb48cd47ecf8d0a0f6fb1d83d812)

5 years agoAdd OperationAsContainer @NonNull annotations 89/85289/1
Robert Varga [Sat, 19 Oct 2019 07:05:46 +0000 (09:05 +0200)]
Add OperationAsContainer @NonNull annotations

This makes working with the class easier a bit.

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

5 years agoBump versions to 3.0.7-SNAPSHOT 30/85230/1
Robert Varga [Sat, 19 Oct 2019 07:52:48 +0000 (09:52 +0200)]
Bump versions to 3.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: Ib1e4da0d9ab30bd0d64887990b276df815750e72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump odlparent to 5.0.3 24/85224/1
Robert Varga [Sat, 19 Oct 2019 06:32:05 +0000 (08:32 +0200)]
Bump odlparent to 5.0.3

This picks up latest updates.

Change-Id: I7c52bc99029342c2381635952a0f7be02a64a813
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix foldable trigraphs 23/85223/1
Robert Varga [Fri, 18 Oct 2019 08:22:27 +0000 (10:22 +0200)]
Fix foldable trigraphs

Sonar correctly points out the expression can be simplified, this
patch does exactly that.

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

5 years agoCleanup code smells reported by sonar 22/85222/1
Robert Varga [Fri, 18 Oct 2019 08:02:28 +0000 (10:02 +0200)]
Cleanup code smells reported by sonar

We are duplicating code here, so introduce a check-and-cast method
and use that from the 5 callsites.

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

5 years agoDisable slf4j SSL link 21/85221/1
Robert Varga [Fri, 11 Oct 2019 12:01:15 +0000 (14:01 +0200)]
Disable slf4j SSL link

slf4j does not provide apidocs over TLS, link HTTP site instead.

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

5 years agoFix Decimal64.equals() 34/85034/1
Robert Varga [Thu, 10 Oct 2019 10:29:23 +0000 (12:29 +0200)]
Fix Decimal64.equals()

There is a typo here, which would end up not comparing objects
properly.

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

5 years agoLeafEffectiveStatement should be a DataTreeEffectiveStatement 07/85007/1
Robert Varga [Tue, 8 Oct 2019 11:21:14 +0000 (13:21 +0200)]
LeafEffectiveStatement should be a DataTreeEffectiveStatement

This is a conflicting model, which should understand it has conflicting
children.

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

5 years agoCleanup yang-data-impl antlr configuration 99/84999/1
Robert Varga [Tue, 8 Oct 2019 19:31:44 +0000 (21:31 +0200)]
Cleanup yang-data-impl antlr configuration

This fixes up a long-standing issue with how antlr is configured,
fixing javadoc plugin interaction in the process.

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

5 years agoCleanup yang-xpath-impl antlr configuration 98/84998/1
Robert Varga [Tue, 8 Oct 2019 19:28:16 +0000 (21:28 +0200)]
Cleanup yang-xpath-impl antlr configuration

This fixes up a long-standing issue with how antlr is configured,
fixing javadoc plugin interaction in the process.

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

5 years agoCleanup yang-parser-rfc7950 antlr configuration 97/84997/1
Robert Varga [Tue, 8 Oct 2019 17:08:15 +0000 (19:08 +0200)]
Cleanup yang-parser-rfc7950 antlr configuration

This fixes up a long-standing issue with how antlr is configured,
fixing javadoc plugin interaction in the process.

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

5 years agoRemove jacoco/surefire configration 96/84996/1
Robert Varga [Tue, 8 Oct 2019 15:33:03 +0000 (17:33 +0200)]
Remove jacoco/surefire configration

This configuration does not seem to serve any purpose, remove it.

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

5 years agoClose JSON root context when the writer is closed 81/84981/1
Robert Varga [Mon, 7 Oct 2019 15:19:34 +0000 (17:19 +0200)]
Close JSON root context when the writer is closed

We should be closing the root context when we are closed, not when
a its child is closed -- otherwise it would be impossible to write
multiple children of the root context.

Since we are in the area, also centralize some QName/ContainerNode
creation.

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

5 years agoRepresent large number types as strings 65/84965/2
Mario Abraham [Fri, 27 Sep 2019 09:00:08 +0000 (11:00 +0200)]
Represent large number types as strings

A value of the int64, uint64 and decimal64 type is
represented as a JSON string related to rfc 7951.

Issue-ID: YANGTOOLS-1027
Change-Id: Ic6aea0a0f97e042ed40d2e0be323557750401621
Signed-off-by: Mario Abraham <mario.abraham@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit af02c59d72a4f6af9361ea2842c35e634f6454e4)

5 years agoSpecialize JSONInstanceIdentifierCodec 64/84964/1
Robert Varga [Sat, 5 Oct 2019 11:16:57 +0000 (13:16 +0200)]
Specialize JSONInstanceIdentifierCodec

We do not want to force RFC7951 to instantiate the old lhotka-02
codec if we are not using it. Make JSONInstanceIdentifierCodec
an abstract class and specialize it as
Lhotka02JSONInstanceIdentifierCodec, so we have two distinct
concrete classes.

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

5 years agoShortcut Collections.sort() 63/84963/1
Robert Varga [Mon, 7 Oct 2019 09:12:01 +0000 (11:12 +0200)]
Shortcut Collections.sort()

We have a concrete List implementation, hence we can use List.sort()
directly.

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

5 years agoAdd odl-guava dependency 76/84776/1
Robert Varga [Fri, 27 Sep 2019 09:45:56 +0000 (11:45 +0200)]
Add odl-guava dependency

odl-yangtools-util is pulling in guava, is should depend on
odl-guava to get it.

Change-Id: I7514cf9fe69fa14e042c95bbcc93e4882ac1ae0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTake advantage of ValueNode in NormalizedNodes 90/84490/1
Robert Varga [Sun, 15 Sep 2019 22:10:56 +0000 (00:10 +0200)]
Take advantage of ValueNode in NormalizedNodes

We can perform a single instanceof check instead of two to check
for LeafNode and LeafSetEntryNode. Also cleanup checks to remove
superfluous type arguments.

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

5 years agoCleanup requireNonNull() use in NormalizedNodes 89/84489/1
Robert Varga [Sun, 15 Sep 2019 22:07:49 +0000 (00:07 +0200)]
Cleanup requireNonNull() use in NormalizedNodes

Take advantage of the non-null return to save a tiny bit of bytecode.

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

5 years agoAdd missing @Override 86/84486/1
Robert Varga [Sun, 15 Sep 2019 22:02:02 +0000 (00:02 +0200)]
Add missing @Override

LoggingNormalizedNodeStreamWriter.domSourceValue() is missing
an annotation for some reason. Fix that.

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

5 years agoBump version to 3.0.6-SNAPSHOT 57/84357/1
Robert Varga [Fri, 13 Sep 2019 04:45:17 +0000 (06:45 +0200)]
Bump version to 3.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I011ffc0ec1186161d81a440c507f2319066d0b47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump odlparent to 5.0.2 19/83919/7
Robert Varga [Thu, 22 Aug 2019 15:13:01 +0000 (17:13 +0200)]
Bump odlparent to 5.0.2

This bumps odlparent references to pick latest fixes.

Change-Id: I2eeae6371f6c97ea5fb2333d7a3daccf8c248685
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate TypeDefinitionAwareCodec 47/84347/2
Robert Varga [Fri, 23 Aug 2019 19:30:14 +0000 (21:30 +0200)]
Update TypeDefinitionAwareCodec

Note that the factory can return null, annotate as such and document
that @Nullable should be eliminated.

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

5 years agoAdd NodeIdentifierWithPredicates.containsKey() 46/84346/2
Robert Varga [Thu, 12 Sep 2019 15:16:05 +0000 (17:16 +0200)]
Add NodeIdentifierWithPredicates.containsKey()

This is a useful check, which can be performed via getValue()
and checking for null return, but implementations can perform
it a wee bit more quickly.

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

5 years agoMigrate Class.newInstance() user 45/84345/2
Robert Varga [Thu, 5 Sep 2019 09:35:19 +0000 (11:35 +0200)]
Migrate Class.newInstance() user

Class.newInstance() is deprecated since Java 9, migrate to explicit
constructor invocation.

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

5 years agoOptimize immutable lookups 35/84135/2
Robert Varga [Mon, 2 Sep 2019 15:25:37 +0000 (17:25 +0200)]
Optimize immutable lookups

We have a number of private Set/Map/Lists which we are using for
lookups. These typically are backed by Immutable implementations,
hence we can propagate the type knowledge to improve bytecode
generation and make JIT's life easier.

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

5 years agoRemove references to YangInstanceIdentifier.EMPTY 62/84062/3
Robert Varga [Wed, 28 Aug 2019 20:40:14 +0000 (22:40 +0200)]
Remove references to YangInstanceIdentifier.EMPTY

The constant is going away, update javadocs to reflect that.

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

5 years agoDeprecate YangInstanceIdentifier.EMPTY 61/84061/3
Robert Varga [Wed, 28 Aug 2019 18:21:39 +0000 (20:21 +0200)]
Deprecate YangInstanceIdentifier.EMPTY

This runtime constant forces instantiation of a subclass, leading
to a SpotBugs warning. A static accessor works just as well --
hence YangInstanceIdentifier.empty()

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

5 years agoOptimize ImmutableNodes.leafNode() 16/84016/1
Robert Varga [Tue, 27 Aug 2019 14:13:19 +0000 (16:13 +0200)]
Optimize ImmutableNodes.leafNode()

This eliminates instantiation of a temporary builder and shortcuts
to creating the leaf node directly.

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

5 years agoAdd utility PotentialSchemaSource constructor 92/83992/1
Robert Varga [Mon, 26 Aug 2019 12:32:46 +0000 (14:32 +0200)]
Add utility PotentialSchemaSource constructor

It is useful for users to use pre-defined acquisition costs, this
adds a utility so users do not have to call Costs.getValue().

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

5 years agoFix a theoretical IM_BAD_CHECK_FOR_ODD 07/83907/2
Robert Varga [Thu, 22 Aug 2019 13:02:53 +0000 (15:02 +0200)]
Fix a theoretical IM_BAD_CHECK_FOR_ODD

While the size of a collection cannot be negative, this keeps
SpotBugs happy about the check.

Change-Id: Ic84a9f147b9d933efc66766617f6271fcf1eddc1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRely on framework to unregister XPathParserFactory 06/83906/2
Robert Varga [Thu, 22 Aug 2019 12:57:38 +0000 (14:57 +0200)]
Rely on framework to unregister XPathParserFactory

This simplifies the code a bit while also squashing two SpotBug
violations.

Change-Id: Ie3f146568510a949e3c7d332c95c59b90f17c7b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix checkstyle 90/83890/1
Robert Varga [Thu, 22 Aug 2019 10:41:27 +0000 (12:41 +0200)]
Fix checkstyle

This fixes issues found by checkstyle.

Change-Id: Iecab9171c2d4d63cf564139c714a4552d069636b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoExpand MapAdaptor javadoc 93/83793/1
Robert Varga [Tue, 20 Aug 2019 12:17:21 +0000 (14:17 +0200)]
Expand MapAdaptor javadoc

This fixes a few warnings around javadoc completes of MapAdaptor.

Change-Id: I6bb7b6354530b4ad47a07b4b0358c720b80b4230
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoGeneralize ForwardingIdentityObject 20/83720/1
Robert Varga [Fri, 16 Aug 2019 17:01:18 +0000 (19:01 +0200)]
Generalize ForwardingIdentityObject

Wrapping objects in identity comparison is useful, and there
seems to be no readily-avaible utility. This introduces an
extension to ForwardingObject and a simple utility class to
implement its construct.

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

5 years agoFix schema-ref traversal 75/83675/4
Anna Bencurova [Thu, 15 Aug 2019 12:17:34 +0000 (14:17 +0200)]
Fix schema-ref traversal

When traversing schema-mount definitions, we need to account for
schema-ref being a choice and hence its children are not directly
reachable.

JIRA: YANGTOOLS-1015
Change-Id: Iaa9ddbf33c172c433cb323166e5b1bcea5eea649
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove javadoc plugin version override 91/83391/3
Robert Varga [Mon, 5 Aug 2019 09:25:58 +0000 (11:25 +0200)]
Remove javadoc plugin version override

odlparent is using a newer plugin, remove the unneeded override.

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

5 years agoApply modernization 16/83416/2
Robert Varga [Tue, 6 Aug 2019 08:39:43 +0000 (10:39 +0200)]
Apply modernization

This fixes up use of old constructs pointed out by maven modernizer
plugin.

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