yangtools.git
2 years agoDo not depend on osgi.annotation 59/99659/2
Robert Varga [Tue, 8 Feb 2022 17:07:41 +0000 (18:07 +0100)]
Do not depend on osgi.annotation

We are using split-out OSGi bundles, make sure our dependencies are
correct.

Change-Id: Iddec9156698f26919c45dabe98d27e16c9480d3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not export yang.parser.rfc7950.{namespace,stmt} 58/99658/2
Robert Varga [Tue, 8 Feb 2022 15:53:00 +0000 (16:53 +0100)]
Do not export yang.parser.rfc7950.{namespace,stmt}

These packages are not used anywhere in ODL proper, do not export them
to further isolate implementation internals.

Change-Id: Ic3a224eea07a49703fff9668ecb7b35e02b78611
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove yang-parser-antlr 57/99657/3
Robert Varga [Tue, 8 Feb 2022 15:36:01 +0000 (16:36 +0100)]
Remove yang-parser-antlr

The antlr grammar is an implementation-internal detail which we broke
out to keep spotbugs happy. It turns out we can keep it happy with a
simple suppression.

Move the grammar and eliminate its artifact, making things a bit
smoother.

JIRA: YANGTOOLS-1395
Change-Id: If6ea5b3f7940423361f115e3f807c7a3ed7b1f67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove yang-xpath-antlr 56/99656/3
Robert Varga [Tue, 8 Feb 2022 15:13:49 +0000 (16:13 +0100)]
Remove yang-xpath-antlr

The antlr grammar is an implementation-internal detail which we broke
out to keep spotbugs happy. It turns out we can keep it happy with a
simple suppression.

Move the grammar and eliminate its artifact, making things a bit
smoother.

JIRA: YANGTOOLS-1395
Change-Id: I3632549f9039a28866895ffaa7ffd7d9774c06a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMigrate yang-xpath-impl to bnd-parent 55/99655/1
Robert Varga [Tue, 8 Feb 2022 15:06:21 +0000 (16:06 +0100)]
Migrate yang-xpath-impl to bnd-parent

bnd-parent is a more modern replacement for bundle-parent, use that.

Change-Id: Ib20d9a709afade8a328db20400938299f3b6db5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMigrate yang-xpath-antlr to bnd-parent 54/99654/1
Robert Varga [Tue, 8 Feb 2022 14:57:22 +0000 (15:57 +0100)]
Migrate yang-xpath-antlr to bnd-parent

bnd-parent is a more modern replacement, migrate to use it.

Change-Id: I9c2545098f23609512cef7a4c4715d56872eb1ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMigrate yang-xpath-api to bnd-parent 53/99653/1
Robert Varga [Tue, 8 Feb 2022 14:53:09 +0000 (15:53 +0100)]
Migrate yang-xpath-api to bnd-parent

Use bnd-parent instead of bundle-parent, so we end up with cleaner
integration.

Change-Id: Ic32867bf8fe9cfeca7b4fdff02d74efb1de7d6ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMigrate common/util to bnd-parent 52/99652/3
Robert Varga [Tue, 8 Feb 2022 13:38:45 +0000 (14:38 +0100)]
Migrate common/util to bnd-parent

We have a better-integrated parent, use that instead of the old felix
plugin. Also add a bit of documentation.

Change-Id: Id400abd10892fd350f3f50119f5247d09f6e5fe4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a uses/refine test 51/99651/1
Robert Varga [Tue, 8 Feb 2022 13:24:14 +0000 (14:24 +0100)]
Add a uses/refine test

Improve the test model to also check refine target.

JIRA: YANGTOOLS-1393
Change-Id: Ie9a45310112ad4fea9f2ff7ffd5d7eaf088596b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a @return 49/99649/2
Robert Varga [Tue, 8 Feb 2022 10:30:37 +0000 (11:30 +0100)]
Add a @return

javadoc does not like us not documenting @return, fix that.

Change-Id: I8704a50316d9c090f542a102073d5b58361d263d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not subclass XMLUnit 61/99561/2
Robert Varga [Thu, 3 Feb 2022 08:41:44 +0000 (09:41 +0100)]
Do not subclass XMLUnit

We just want an assert, eliminate an Eclipse warning by using XMLAssert
directly.

Change-Id: I14443c83c473ee18c25e894c51a391c3c285a375
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoHide JsonParserStream.read() 56/99556/2
Robert Varga [Wed, 2 Feb 2022 12:15:52 +0000 (13:15 +0100)]
Hide JsonParserStream.read()

This method seems to be mistakenly exposed, hide it from outside world.

Change-Id: I9bed2ee56774f918fd74468b831a10c156f8a87a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix YangTextSchemaSource error report 41/99641/2
Robert Varga [Tue, 8 Feb 2022 07:57:45 +0000 (08:57 +0100)]
Fix YangTextSchemaSource error report

Exception arguments are mismatched, fix that up.

Change-Id: Ic77d78c50ea8c98d8070d6d2ccd1d0cba996f7bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not enforce augments in unsupported nodes 75/99575/3
Robert Varga [Tue, 1 Feb 2022 12:28:53 +0000 (13:28 +0100)]
Do not enforce augments in unsupported nodes

If our parent uses node is not supported by features, we should not be
trying to enforce the augmentation dependency, as it will not be
present.

JIRA: YANGTOOLS-1393
Change-Id: I4b9cff536f4bbd33314f8befb1d70151a5f4f5de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisable uses/augment statements of unsupported paths 02/99602/2
Robert Varga [Sun, 6 Feb 2022 18:28:26 +0000 (19:28 +0100)]
Disable uses/augment statements of unsupported paths

Uses statements should propagate unsupported-by-features statements
as unsupported-to-build statements.

JIRA: YANGTOOLS-1393
Change-Id: Ie373b3f0cf7539219b68d1e7b52f6d348ff246e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix javadoc build 28/99528/1
Robert Varga [Sun, 30 Jan 2022 00:32:54 +0000 (01:32 +0100)]
Fix javadoc build

We have merge job failing on javadocs, make sure we repair that.

Change-Id: I6c0513bde22aa02ce0685e4b40d4c28ea7d777b4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump odlparent to 9.0.13 26/99526/1
Robert Varga [Sat, 29 Jan 2022 23:15:12 +0000 (00:15 +0100)]
Bump odlparent to 9.0.13

Pick up latest fixes from upstream.

Change-Id: I5f62f890e019d5b0b14b384b61344ec61a506c8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd SoftSchemaSourceCache 24/99424/2
Robert Varga [Wed, 26 Jan 2022 10:04:39 +0000 (11:04 +0100)]
Add SoftSchemaSourceCache

GuavaSchemaSourceCache has a rather ugly design, which cannot be easily
scaled. Introduce a simpler SoftSchemaSourceCache as its replacement.

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

2 years agoClean up GuavaSchemaSourceCacheTest 37/99437/1
Robert Varga [Tue, 25 Jan 2022 15:49:50 +0000 (16:49 +0100)]
Clean up GuavaSchemaSourceCacheTest

This is a rather ancient test, clean it up with try-with-resources
block plus a few other niceties.

Change-Id: I1965446d501ab5ddb57657efbd6b2e242fdad2b6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSimplify GuavaSchemaSourceCache.offer() a bit 26/99426/2
Robert Varga [Mon, 24 Jan 2022 16:35:30 +0000 (17:35 +0100)]
Simplify GuavaSchemaSourceCache.offer() a bit

We do not have to access the source id multiple times and can lower
cognitive load with an early return.

Change-Id: I418769fb17bb0f1b82107aa644c103d06b9c4a03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse representation class for casting 25/99425/1
Robert Varga [Mon, 24 Jan 2022 16:30:54 +0000 (17:30 +0100)]
Use representation class for casting

We have an unchecked cast supressed here. Use Class.cast() to get
rid of it.

Change-Id: Ie39f9d21095a438a72dc88945e54d1846becf01d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMigrate yang-common to bnd-parent 83/99383/1
Robert Varga [Wed, 19 Jan 2022 12:51:22 +0000 (13:51 +0100)]
Migrate yang-common to bnd-parent

yang-common is a simple component, migrate it to bind-plugin. Also make
sure package-info.java is correctly named.

Change-Id: I5a16bab7056ea6d6124773d1ab71ddc752e0b7a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMigrate concepts to bnd-parent 41/98141/7
Robert Varga [Tue, 26 Oct 2021 15:25:17 +0000 (17:25 +0200)]
Migrate concepts to bnd-parent

A straightforward migration to use bnd-maven-plugin.

Change-Id: Ie8bb442046b611eeec072a3e4f18eb98f955ef80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not instantiate JsonParser 56/99356/1
Robert Varga [Tue, 18 Jan 2022 11:42:49 +0000 (12:42 +0100)]
Do not instantiate JsonParser

JsonParser.parse() should not be used, but rather its equivalent static
methods should be invoked. Migrate tests to do so, fixing a few warnings
in the process.

Change-Id: I6bbfad51c584a5dc0e752bcbb1ed2ec3cdff483f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse try-with-resources in TestUtils 55/99355/1
Robert Varga [Tue, 18 Jan 2022 10:35:08 +0000 (11:35 +0100)]
Use try-with-resources in TestUtils

Eclipse is pointing out we should be managing resources properly, fix
that.

Change-Id: I34e8040bca7c5003e4830134ccc37d0cd44d2387
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate XXX to a FIXME 52/99352/1
Robert Varga [Tue, 18 Jan 2022 10:28:17 +0000 (11:28 +0100)]
Update XXX to a FIXME

Promote a simple note to a full-blown FIXME, as it seems we should be
able to convert BigDecimal more efficiently than we do today.

Change-Id: I50b84a68c961e1bd2f8c8284e3f0f196c6717900
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo no use Builder concept in RpcResultBuilder 51/99351/2
Robert Varga [Tue, 18 Jan 2022 08:55:29 +0000 (09:55 +0100)]
Do no use Builder concept in RpcResultBuilder

The concept as such will be removed in a future release, make sure we do
not use it internally.

JIRA: YANGTOOLS-1328
Change-Id: Ic9a128a9ae62b97e9346630f53fe822050a2b5b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect QNamePredicatedBuilder from Builder 50/99350/1
Robert Varga [Tue, 18 Jan 2022 08:52:20 +0000 (09:52 +0100)]
Disconnect QNamePredicatedBuilder from Builder

The Builder concept is going away, make sure we do not use it.

JIRA: YANGTOOLS-1328
Change-Id: Icdd771fe3694b3df07f2ab8edbf667714ae48155
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect yang-data-util from concepts.Builder 49/99349/1
Robert Varga [Tue, 18 Jan 2022 08:49:11 +0000 (09:49 +0100)]
Disconnect yang-data-util from concepts.Builder

The Builder concept is going away, do not use it during XPath parsing.

JIRA: YANGTOOLS-1328
Change-Id: I4f9547d38d8786f7b9b771f264f6e941c11fb089
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not use concepts.Builder in parser-rfc7950 48/99348/1
Robert Varga [Tue, 18 Jan 2022 08:08:45 +0000 (09:08 +0100)]
Do not use concepts.Builder in parser-rfc7950

The Builder concept is going away, do not use it.

JIRA: YANGTOOLS-1328
Change-Id: If58b3912e5cc6696c306b3140e4ed213d80e2def
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect rfc7952-data-util from concepts.Builder 47/99347/2
Robert Varga [Tue, 18 Jan 2022 07:28:49 +0000 (08:28 +0100)]
Disconnect rfc7952-data-util from concepts.Builder

The Builder concept is going away, do not use it in
ImmutableNormalizedMetadata.

JIRA: YANGTOOLS-1328
Change-Id: I150c64320212bac82c2c0e19b48989818c344dd1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump odlparent to 9.0.11 39/99339/3
Robert Varga [Mon, 17 Jan 2022 21:22:34 +0000 (22:22 +0100)]
Bump odlparent to 9.0.11

Pick up latest upgrades from upstream.

Change-Id: I94e66ee818a39828e0df3d541a6817c2b304720d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect yang-datae-tree-ri from concepts.Builder 46/99346/1
Robert Varga [Tue, 18 Jan 2022 07:23:48 +0000 (08:23 +0100)]
Disconnect yang-datae-tree-ri from concepts.Builder

concepts.Builder is going away, do not rely on it for our internal
classes.

JIRA: YANGTOOLS-1328
Change-Id: Idc02cfdb4b62a8d4444263b48ab30459bcd21de1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect DeclaredStatementFormatter from Builder 45/99345/1
Robert Varga [Tue, 18 Jan 2022 07:17:10 +0000 (08:17 +0100)]
Disconnect DeclaredStatementFormatter from Builder

concepts.Builder is going away, do not use it for
DeclaredStatementFormatter.Builder.

JIRA: YANGTOOLS-1328
Change-Id: Iaae40f9e0ce95390f67dadad881f5c137aefd403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect DataTreeConfiguration.Builder 38/99338/1
Robert Varga [Mon, 17 Jan 2022 19:32:42 +0000 (20:32 +0100)]
Disconnect DataTreeConfiguration.Builder

concepts.Builder is being removed, make sure we do not use it for
DataTreeConfiguration.

JIRA: YANGTOOLS-1328
Change-Id: Ifdfba8436fb8207e9fa56f20774d7265ebced818
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate (Checked)Builder for removal 25/99325/8
Robert Varga [Mon, 17 Jan 2022 15:55:29 +0000 (16:55 +0100)]
Deprecate (Checked)Builder for removal

We do not have any users in yangtools and most downstreams, deprecated
these interfaces for removal.

JIRA: YANGTOOLS-1328
Change-Id: I30cb381a398eb33c2ea8d65d9a89bb279df36ca4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect yang-model-ri from Builder 37/99337/2
Robert Varga [Mon, 17 Jan 2022 19:09:57 +0000 (20:09 +0100)]
Disconnect yang-model-ri from Builder

concepts.Builder is going away, remove its use from yang-model-ri.

JIRA: YANGTOOLS-1328
Change-Id: I42dabe2924bffc2d6c60ed70111b7d65735cbee0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect CrossSourceStatementReactor.Builder 36/99336/1
Robert Varga [Mon, 17 Jan 2022 19:04:04 +0000 (20:04 +0100)]
Disconnect CrossSourceStatementReactor.Builder

concepts.Builder is going away, do not use it in
CrossSourceStatementReactor.

JIRA: YANGTOOLS-1328
Change-Id: I45b719963df1909f61446f9b3eacd41970be30d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect StatementSupportBundle.Builder from concepts 32/99332/2
Robert Varga [Mon, 17 Jan 2022 17:10:34 +0000 (18:10 +0100)]
Disconnect StatementSupportBundle.Builder from concepts

concepts.Builder is going away, disconnect it from
StatementSupportBundle.

JIRA: YANGTOOLS-1327
Change-Id: I465b1b39b43281dbf4f1ab479036c4cb04a7c2f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect YangParserConfiguration.Builder from concepts 31/99331/2
Robert Varga [Mon, 17 Jan 2022 17:05:46 +0000 (18:05 +0100)]
Disconnect YangParserConfiguration.Builder from concepts

concepts.Builder is going away, disconnect it from yang-parser-api.

JIRA: YANGTOOLS-1327
Change-Id: I96c7a07f4589927fd4cee799a4a1ec8791d97d62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect SchemaContextFactoryConfiguration.Builder 30/99330/2
Robert Varga [Mon, 17 Jan 2022 17:00:50 +0000 (18:00 +0100)]
Disconnect SchemaContextFactoryConfiguration.Builder

concepts.Builder is going away, make sure we do not use it for
SchemaContextFactoryConfiguration.

JIRA: YANGTOOLS-1327
Change-Id: I3f0a671362d4a3ef80c4082687507865481309b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDisconnect NormalizedNodeBuilder from Builder 29/99329/1
Robert Varga [Mon, 17 Jan 2022 16:28:15 +0000 (17:28 +0100)]
Disconnect NormalizedNodeBuilder from Builder

concepts.Builder is going away, disconnect it from
NormalizedNodeBuilder.

Change-Id: I2e4f07a81695f23bc9833708af5905efc8acb5aa
JIRA: YANGTOOLS-1327
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDecouple YangInstanceIdentifierBuilder from Builder 28/99328/1
Robert Varga [Mon, 17 Jan 2022 16:23:04 +0000 (17:23 +0100)]
Decouple YangInstanceIdentifierBuilder from Builder

concepts.Builder is going away, make sure we decouple it.

JIRA: YANGTOOLS-1327
Change-Id: I7a6e47df5f7a2900574aa8f4ff011429f21dd719
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDecouple HashCodeBuilder from Builder 27/99327/1
Robert Varga [Mon, 17 Jan 2022 16:09:58 +0000 (17:09 +0100)]
Decouple HashCodeBuilder from Builder

We are deprecating Builder concept and HashCodeBuilder does not really
like having to inflate to java.lang.Integer. Ditch the indirection.

JIRA: YANGTOOLS-1327
Change-Id: Ia19d9d97064cb099c25f11dac6aa7c08e983effd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove redundant type arguments 26/99326/1
Robert Varga [Mon, 17 Jan 2022 16:05:57 +0000 (17:05 +0100)]
Remove redundant type arguments

We have Java 11, hence we can use diamond notation for anonymous
subclasses.

Change-Id: I2c30624fde5a9896f98a63d57d6d50b26e009f3f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate (Checked)Builder 21/99321/1
Robert Varga [Mon, 17 Jan 2022 13:28:39 +0000 (14:28 +0100)]
Deprecate (Checked)Builder

These interfaces are rather overarching, causing callers of build()
method to be opaque. Deprecate them so downstreams can gradually migrate
away.

JIRA: YANGTOOLS-1327
Change-Id: I204252c9175c4eeb7b960f4d073c32eaca834316
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove overridden ImmmutableNodes.fromInstanceId() 50/99250/2
Robert Varga [Mon, 10 Jan 2022 12:43:51 +0000 (13:43 +0100)]
Remove overridden ImmmutableNodes.fromInstanceId()

These methods are geared towards NETCONF filter creation, which is being
solved in a different way -- as these do not work form leaves anyway.
Remove the methods to reduce confusion.

JIRA: YANGTOOLS-1390
Change-Id: I52ebe9be906e516ef23447f77e80c56dcf86a8d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate ImmutableNodes.fromInstanceId() with deepestElement 49/99249/2
Robert Varga [Mon, 10 Jan 2022 12:25:59 +0000 (13:25 +0100)]
Deprecate ImmutableNodes.fromInstanceId() with deepestElement

The two methods allowing an override of the deepest element have only a
single user, which is broken by their semantics. Deprecate them for
removal, so that we flush out anyone else still relying on them.

JIRA: YANGTOOLS-1389
Change-Id: I52e8bdebc5488d095645a7bfb45a5c9cf400ecb0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate SemVer import mode 24/98024/6
Robert Varga [Thu, 21 Oct 2021 08:48:35 +0000 (10:48 +0200)]
Deprecate SemVer import mode

Semantic version imports are not used by anyone and have a rather
convoluted implementation. Deprecate them along with their supporting
elements.

JIRA: YANGTOOLS-1354
Change-Id: I6b41c3407d51833cb13445517e896be39b371ac8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump odlparent to 9.0.10 27/99227/1
Robert Varga [Sun, 9 Jan 2022 17:04:52 +0000 (18:04 +0100)]
Bump odlparent to 9.0.10

Pick up latest upgrades from upstream.

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

2 years agoFix a nullness warning 90/99190/2
Robert Varga [Wed, 5 Jan 2022 10:11:55 +0000 (11:11 +0100)]
Fix a nullness warning

We are guaranteeing a non-null return, so that takeSnapshot() API
contract is kept.

Change-Id: If8082b8a959afea615fc16d330b5174af83abb25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoValidate unique statement references 17/99017/15
Robert Varga [Wed, 15 Dec 2021 17:24:37 +0000 (18:24 +0100)]
Validate unique statement references

Unique statement's argument needs to be validated against the effective
model, so that we discover when we have mismatches in arguments.

JIRA: YANGTOOLS-1385
Change-Id: I4e41563b40dae6a186d8763d9711ce0c54afdbc3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not mask single exceptions 85/99185/3
Robert Varga [Mon, 3 Jan 2022 12:54:16 +0000 (13:54 +0100)]
Do not mask single exceptions

If we end up with a single exception, do not wrap it in
InferenceException, as we want to correctly identify whether it is a
problem with the source or inference.

Change-Id: I9963ec5067145b5886a2bf20cba4bd8104794afe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoPopulate ietf-restconf operations container 89/97689/35
Robert Varga [Thu, 30 Sep 2021 17:30:07 +0000 (19:30 +0200)]
Populate ietf-restconf operations container

The 'operations' container defined in ietf-restconf module has magic
semantics: it needs to have an empty leaf for every RPC that is
available in the EffectiveModelContext.

WWe are hard-pressed here to make things work with our parser
infrastructure, as we currently do not have hooks to do this kind of
schema-tree specific magic. Luckily there is also a YANG extension in
that same model, so we hijack that to hook onto to the container
inference and modify it just in time and make the magic happen.

JIRA: YANGTOOLS-1338
Change-Id: I9cf774a148f0e764940b9725f717fa0c60ef1bf9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove an unneeded yang-data-spi dependency 88/99188/1
Robert Varga [Tue, 4 Jan 2022 13:09:35 +0000 (14:09 +0100)]
Remove an unneeded yang-data-spi dependency

We do not need util artifact, do not depend on it.

Change-Id: I59c73fc3e96db44fd227802b4cc6b8a02acfa1ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse NamespaceStmtCtx 68/99168/1
Robert Varga [Sat, 25 Dec 2021 16:26:46 +0000 (17:26 +0100)]
Use NamespaceStmtCtx

We do not need full access here, just namespaces, reflect that.

Change-Id: I6d3f32ddc6911d6b1ecf6110068b4b7a9ee15fc8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove empty lines 67/99167/1
Robert Varga [Sat, 25 Dec 2021 16:26:08 +0000 (17:26 +0100)]
Remove empty lines

We have a few stray empty lines, remove them.

Change-Id: Ia10fa98cec1b92f1953333e6858c189234223e1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoReturn @NonNull collections in StmtContext 66/99166/1
Robert Varga [Sat, 25 Dec 2021 16:12:12 +0000 (17:12 +0100)]
Return @NonNull collections in StmtContext

We are always returning non-null contexts, make sure we reflect that
in the return type. This fixes about 20 false positive warnings.

Change-Id: I99d42e94832f379e95001f8e3f263380c50dbb9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a @NonNull annotation 65/99165/1
Robert Varga [Sat, 25 Dec 2021 15:56:36 +0000 (16:56 +0100)]
Add a @NonNull annotation

Prerequisites are always resolving to a non-null value, make sure
we express that, eliminating a number of warnings.

Change-Id: I8c90e0ea2489988416de3cbeafcd30cfefc9228a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd SchemaNodeIdentifier-based constructor 31/99131/1
Robert Varga [Wed, 22 Dec 2021 07:25:29 +0000 (08:25 +0100)]
Add SchemaNodeIdentifier-based constructor

We are deprecating SchemaPath, provide a proper constructor allowing
downstreams to use it instead of the SchemaPath-driven one.

Change-Id: If06f415d4e6dcd9b18875f78b463f47a62b00a75
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCorrect and/or/div/mod in path expressions 17/99117/4
Robert Varga [Sun, 19 Dec 2021 09:35:17 +0000 (10:35 +0100)]
Correct and/or/div/mod in path expressions

The grammar is creating implicit lexer tokens for and/or/div/mod, which
take precedence overt NCName. Make sure we define these tokens
explicitly and allow them to be an alternative wherever NCName is
valid.

JIRA: YANGTOOLS-1387
Change-Id: I4f4f26fe0f8bc27614b769b465a76696a49ad7c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump odlparent to 9.0.9 12/99112/1
Robert Varga [Sun, 19 Dec 2021 07:52:54 +0000 (08:52 +0100)]
Bump odlparent to 9.0.9

Pick up latest fixes from upstream.

Change-Id: I628ef26430cd5d189cac0c52b19fc4152d8d6589
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSimple cleanups 55/99055/2
Robert Varga [Thu, 16 Dec 2021 16:31:24 +0000 (17:31 +0100)]
Simple cleanups

Clean up a few things which got past code review.

Change-Id: Ia11d912eb10535b30daad0ce03e8198de899b4ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoTrigger onStatementAdded() for replicas 15/99015/8
Robert Varga [Wed, 15 Dec 2021 17:22:27 +0000 (18:22 +0100)]
Trigger onStatementAdded() for replicas

When a statement is introduced through StmtContext.replicaAsChildOf(),
the corresponding statement support should be notified of this fact, so
it can properly do its thing. This makes it consistent with
Mutable.childCopyOf().

JIRA: YANGTOOLS-1386
Change-Id: Ic947ea5fc822a29ff915d47db1cc591a2a18fd44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeviations should get disabled if target is unsupported 56/99056/2
Robert Varga [Fri, 17 Dec 2021 07:16:25 +0000 (08:16 +0100)]
Deviations should get disabled if target is unsupported

Deviate's InferenceAction should pay attention to unavailable target
nodes, so we disable the deviation.

JIRA: YANGTOOLS-1370
Change-Id: Id0d8c3a64f91060cb21e807402742341ea98f492
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAugments should get disabled if target is unsupported 60/98660/6
Robert Varga [Wed, 24 Nov 2021 10:43:31 +0000 (11:43 +0100)]
Augments should get disabled if target is unsupported

AugmentInferenceAction should pay attention to unavailable target
nodes, so we disable the augmentation.

JIRA: YANGTOOLS-1370
Change-Id: Ib1f0bde83a90e4bb45a7c4fa1fc62af205f4ea6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRequire mutatesEffectiveCtxPath() implementation 16/99016/1
Robert Varga [Wed, 15 Dec 2021 17:23:47 +0000 (18:23 +0100)]
Require mutatesEffectiveCtxPath() implementation

This method was retrofitted in previous releases, now make it mandatory
to implement.

Change-Id: I5b8e30609987d43ce49554c3344516722ef41da1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove YangModelDependencyInfo.forResource() 11/99011/7
Robert Varga [Wed, 15 Dec 2021 11:17:50 +0000 (12:17 +0100)]
Remove YangModelDependencyInfo.forResource()

This method has been deprecated and users have been migrated. Remove it.

Change-Id: I7583fc89c85aa4af12c18b3cc9504e5aecf833d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove DeclaredStatement.statementOrigin() 05/99005/9
Robert Varga [Wed, 15 Dec 2021 06:58:58 +0000 (07:58 +0100)]
Remove DeclaredStatement.statementOrigin()

DeclaredStatements are always declared and thus statementOrigin() should
only be exposed from EffectiveStatements.

JIRA: YANGTOOLS-1384
Change-Id: I7b02b782dd25c5328d6c724d3ec08d54c9d9bfbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove CommonStmtCtx.origin() 06/99006/8
Robert Varga [Wed, 15 Dec 2021 07:32:12 +0000 (08:32 +0100)]
Remove CommonStmtCtx.origin()

This method should not be used anymore, remove it.

Change-Id: I729ef640e8fca1c4133be7397ad5b78dfb391d7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoPrune StmtContext migration methods 09/99009/6
Robert Varga [Wed, 15 Dec 2021 11:13:10 +0000 (12:13 +0100)]
Prune StmtContext migration methods

We have a number of migration methods for splitting StmtContext up.
These are no longer used, hence remove them.

Change-Id: Ie8871525567264e672156b149cbd3d1dde170ac5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove StmtContextUtils.findFirstSubstatement() 10/99010/5
Robert Varga [Wed, 15 Dec 2021 11:15:53 +0000 (12:15 +0100)]
Remove StmtContextUtils.findFirstSubstatement()

This utility method has an integrated replacement, remove it.

Change-Id: I117bd331c6381e27830796c3a6f86ad9f1acbd4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoExpand perf optimization TODO 13/99013/3
Robert Varga [Wed, 15 Dec 2021 12:49:00 +0000 (13:49 +0100)]
Expand perf optimization TODO

Add a few more details on ideas how we can speed up things involving
statement reuse.

Change-Id: Ida38b61a70bae7c240c251c96bdfddcad5413169
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate methods throwing UOE 12/99012/2
Robert Varga [Wed, 15 Dec 2021 12:28:18 +0000 (13:28 +0100)]
Deprecate methods throwing UOE

Let's warn on any attempt to directly access an unsupported method.

Change-Id: Ibe3fd24a0c0dd32c1d05a4e265f280f4be5b7911
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRework undeclared statement definition 55/98955/16
Robert Varga [Mon, 13 Dec 2021 01:29:52 +0000 (02:29 +0100)]
Rework undeclared statement definition

Statements which are created without a corresponding declaration should
not have a DeclaredStatement footprint. Unfortunately our
createEffective() expect a DeclaredStatement to be present.

This patch adds another, explicit, avenue to create an
EffectiveStatement without having its DeclaredStatement (and
rawArgument).

We then use this facility to provide our usual
Undeclared*EffectiveStatements.

JIRA: YANGTOOLS-1372
Change-Id: I6fb5874d720cbf3a139890824c33fddde7196946
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFilter implicitly-created declared substatements 63/98963/14
Robert Varga [Tue, 14 Dec 2021 01:48:08 +0000 (02:48 +0100)]
Filter implicitly-created declared substatements

When we create an implicit parent statement in createDeclaredChild()
we need to exclude that statement from the statements we pass to
createDeclared(). Otherwise the statement would be an 'undeclared'
declared statement, which our downstreams are still working with.

JIRA: YANGTOOLS-1383
Change-Id: I81141b1db5653fa4a0e3457e13c868dd25596905
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not expose StmtContext to StatementFactory 03/99003/4
Robert Varga [Wed, 15 Dec 2021 04:44:10 +0000 (05:44 +0100)]
Do not expose StmtContext to StatementFactory

We should not be exposing complete inherence state, only the bare
minimum for implementations.

Change-Id: I3c182e35d51067e3563339da7127c9b6ecc4c590
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoLock down AbstractResumedStatement.substatements access 02/99002/1
Robert Varga [Wed, 15 Dec 2021 04:23:41 +0000 (05:23 +0100)]
Lock down AbstractResumedStatement.substatements access

We are indirecly using mutableDeclaredSubstatements(), and that method
is not final. It is not overridden anywhere, either. So let us make that
strong assumption by making the method final and accessing substatements
directly for their Stream.

JIRA: YANGTOOLS-1383
Change-Id: I51c025c3195fdb9ca61f5dee394707f72defb854
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoExpose Iterator from effectiveChildrenToComplete() 01/99001/1
Robert Varga [Wed, 15 Dec 2021 04:16:11 +0000 (05:16 +0100)]
Expose Iterator from effectiveChildrenToComplete()

We are only ever iterating here, lower the contract exposed through
here.

Change-Id: Ief041380c5341956e2cf91491bbc05d1c4f08ca7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRefactor StatementFactory.createDeclared() 00/99000/1
Robert Varga [Wed, 15 Dec 2021 03:59:22 +0000 (04:59 +0100)]
Refactor StatementFactory.createDeclared()

Declared statements need to be built from a different source than
StmtContext.declaredStatements(), as those are following a different
structure.

Rather than creating more confusion in StmtContext, feed a
Stream<DeclaredStatement<?>>. Also drop a FIXME for a follow-up patch
to reduce StmtContext proliferation.

JIRA: YANGTOOLS-1383
Change-Id: I94bccc35423cce29ed9a52814827eb561e62e071
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoHide AbstractResumedStatement.walkChildren() 99/98999/2
Robert Varga [Wed, 15 Dec 2021 02:46:40 +0000 (03:46 +0100)]
Hide AbstractResumedStatement.walkChildren()

We have slight (2-line) duplication due to how gadgets are exposed
to StatementContextWriter.

Introduce AbstractResumedStatement.declarationFinished(), which
performs the combination of walking children and calling endDeclared().

This allows us to completely hide endDeclared() and simplify the code a
bit -- including renaming endDeclared() to finishDeclaration().

Change-Id: I5cbc7aa98aa90b2cf92ef603e4b3b0ed34e1dc4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove StatementContextWriter.exitStatement() 98/98998/2
Robert Varga [Wed, 15 Dec 2021 02:32:16 +0000 (03:32 +0100)]
Move StatementContextWriter.exitStatement()

The logic for entering a declared statement lives in
AbstractResumedStatement, along with the logic to create implicit
parents (i.e. implicit case statements). Also move the code to exit
the declared statement there, so we have all three bits in one place.

Since we have better context for dealing with this, also reshape the
logic, which allows us to move StatementContextBase.endDeclared().

JIRA: YANGTOOLS-1383
Change-Id: Id461464587b997f26624271f9bdf6aa9967f80a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix a nullness warning 97/98997/1
Robert Varga [Wed, 15 Dec 2021 02:03:32 +0000 (03:03 +0100)]
Fix a nullness warning

getPhase() is required to be non-null, which we are assuring, but do not
have annotated. Add annotation and move the method, as it is a simple
getter.

Change-Id: I71ba333713f8ae25fad0230b5137f025d86faa24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove implicit parent skip code 95/98995/1
Robert Varga [Tue, 14 Dec 2021 21:41:44 +0000 (22:41 +0100)]
Move implicit parent skip code

We have an implicit contract between AbstractResumedStatement and
StatementContextWriter during lookup. Since the structure is defined
in AbstractResumedStatement, we should keep the logic together.

Also fix a slight wart, where we would over-allocate implicit parent's
StatementMap.

JIRA: YANGTOOLS-1383
Change-Id: I167e13015d4fb8d348db140702af89ae005e1077
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate StatementMap javadocs 93/98993/1
Robert Varga [Tue, 14 Dec 2021 21:23:20 +0000 (22:23 +0100)]
Update StatementMap javadocs

We have two undocumented methods, add javadocs.

Change-Id: I5aff94d5e2826bdc1718a725fec23403feab34d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup StatementMap a bit 62/98962/1
Robert Varga [Tue, 14 Dec 2021 00:46:59 +0000 (01:46 +0100)]
Cleanup StatementMap a bit

empty() return a non-null instance and we do not need this. qualifier.

Change-Id: Id68f55c795aaf6ff14a4d3b4920667da1b103743
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd default statementOrigin() implementations 61/98961/2
Robert Varga [Tue, 14 Dec 2021 00:21:03 +0000 (01:21 +0100)]
Add default statementOrigin() implementations

The design of {Model,Declared,Effective}Statement interfaces harks back
to Java 7 days. Refresh it with Java 8's default interface methods,
properly binding them to DeclaredStatement and
EffectiveStatement.getDeclared() methods.

JIRA: YANGTOOLS-1384
Change-Id: I8823b08eb0484fa48024a594081f536ac4b41542
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoHide StatementContextBase 54/98954/2
Robert Varga [Mon, 13 Dec 2021 00:38:15 +0000 (01:38 +0100)]
Hide StatementContextBase

We have an ugly dependency on StatementContextBase in statement
implementations. These should not care about implementation details,
and in fact they do not, as most of the methods involved are already
present in StmtContext.Mutable.

Expose the rest of the required methods and hide the base class. This
has a nice side effect of removing a significant number of unsafe casts.

JIRA: YANGTOOLS-1382
Change-Id: Id44e39dbedcc72089aa276f54ddffee4c60bca4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDelay modifiers during their processing 52/98952/1
Robert Varga [Sun, 12 Dec 2021 20:11:51 +0000 (21:11 +0100)]
Delay modifiers during their processing

When we are invoking actions, we are also iterating over them, hence
we have to stop modifiers being added -- otherwise we'll get a CME.
Add the minimal machinery to make this work.

JIRA: YANGTOOLS-1381
Change-Id: I44c04d7bdafe9fddb0bddd01e5cbb4912d356723
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoExpose addEffectiveSubstatement() 51/98951/6
Robert Varga [Sun, 12 Dec 2021 15:33:50 +0000 (16:33 +0100)]
Expose addEffectiveSubstatement()

We have partial support for creating effective statements, in the
reactor, but it was not properly structured for all the use cases we
need.

Expose the methods in StmtContext.Mutable and readjust them to allow to
expose statement-agnostic arguments.

JIRA: YANGTOOLS-1372
Change-Id: I1e8806e1c809da2cec82cb92f763002ede78cfdd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate CopyableNode 45/98945/4
Robert Varga [Sun, 12 Dec 2021 06:50:13 +0000 (07:50 +0100)]
Deprecate CopyableNode

// FIXME: add jira issue

Change-Id: Idbd09e698add7e5ae84ab0116591fae7691eb121
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDeprecate AddedByUsesAware for removal 44/98944/5
Robert Varga [Sun, 12 Dec 2021 06:47:41 +0000 (07:47 +0100)]
Deprecate AddedByUsesAware for removal

Strenghten deprecation to indicate removal in the next major release.

Change-Id: I5dd08db5ac5ef0cc02284f2ea725913e6430617a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCache CopyType.values() 47/98947/1
Robert Varga [Sun, 12 Dec 2021 08:46:45 +0000 (09:46 +0100)]
Cache CopyType.values()

We are on critical path accessing values, which end up being cloned
by the implementation. Let's amortize that by remembering the array.

Change-Id: I7f74085dc329f39b0a59bdaa4fab7e32ed57ddff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove TreeNodeFactory 43/98943/4
Robert Varga [Sun, 12 Dec 2021 01:19:39 +0000 (02:19 +0100)]
Remove TreeNodeFactory

There is no point in having a single-method utility class, just move
the method to TreeNode instead.

Change-Id: I0a97e9ac8d6e8a938567f581a872ea9653ad57b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMake (Mutable)TreeNode a class 42/98942/4
Robert Varga [Sun, 12 Dec 2021 01:14:38 +0000 (02:14 +0100)]
Make (Mutable)TreeNode a class

A pure interface leads to us having AbstractTreeNode, which is
superfluous. Turn interfaces into abstract classes instead.

Change-Id: Icbf2daf28abb1c7b390006f61989d63d10329ecc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoEliminate yang.data.spi.tree 41/98941/4
Robert Varga [Sun, 12 Dec 2021 01:03:17 +0000 (02:03 +0100)]
Eliminate yang.data.spi.tree

We have tests lurking in the wrong artifact (should be yang-data-api)
and the production code is really implementation detail of
yang-data-tree-ri.

JIRA: YANGTOOLS-1242
Change-Id: I039d10858f86ab07305d9e92841310bbcfdb2863
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSplit out yang-data-tree-impl 38/98938/8
Robert Varga [Fri, 10 Dec 2021 12:50:58 +0000 (13:50 +0100)]
Split out yang-data-tree-impl

InMemoryDataTree forms a rather large part of yang-data-impl and is
used only for data store implementations. Split it out into its own
component.

JIRA: YANGTOOLS-1242
Change-Id: I0747224e9d8552f03f346b59c9bf8de580e75c48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSplit out yang-data-tree-{api,spi} 36/98936/4
Robert Varga [Fri, 10 Dec 2021 09:07:26 +0000 (10:07 +0100)]
Split out yang-data-tree-{api,spi}

In order to split out InMemoryDataTree, we need to first split out
its API components. This patch introduces yang-data-tree-{api,spi},
which hold the basic components defining the API and implementation
helper bits.

JIRA: YANGTOOLS-1242
Change-Id: Ida5383ed6c8820d539f72f8cd5192ccb4a93548a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove StoreTreeNodes.getChild() 37/98937/2
Robert Varga [Fri, 10 Dec 2021 12:34:43 +0000 (13:34 +0100)]
Remove StoreTreeNodes.getChild()

This method is not used anywhere, remove it.

JIRA: YANGTOOLS-1242
Change-Id: Idd5eb7b4ddea5094d87bd0a934ed78c718bc20b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImplement ModelStatement.toString() 26/98926/4
Robert Varga [Wed, 8 Dec 2021 11:20:26 +0000 (12:20 +0100)]
Implement ModelStatement.toString()

Make sure we codify hashCode()/equals()/toString() methods in
AbstractModelStatement -- fixing a major usability issue with our
objects and improving consistency.

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