Robert Varga [Tue, 21 Feb 2023 14:44:38 +0000 (15:44 +0100)]
Clean up NormalizedNodeSchemaUtils
Use instanceof pattern to simplify casts. Also simplify
findCorrespondingAugment(), making the logic more obvious.
Change-Id: I7f134d333aa2543169acdf30a5e4e116bb7ca22e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 21 Feb 2023 14:46:58 +0000 (15:46 +0100)]
Use instanceof patterns in DataSchemaContextNode
Reduce the number of casts by using an instanceof pattern.
Change-Id: Ia9f4a26143d5d19b339bae2d74af0c7572d99e2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 21 Feb 2023 10:52:10 +0000 (11:52 +0100)]
Clean up AnydataNormalizeContentTest
Use assertInstanceOf() instead of assertTrue().
Change-Id: Ic6df353abe64aaa2cde801f02309f87fd0e7ce88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Ruslan Kashapov [Tue, 10 Jan 2023 08:25:30 +0000 (10:25 +0200)]
Fix anyData content normalization incl no data case
Parsing of anydata content is now performed with inference
pointing to anydata node itself as a root (parentNode),
not first child. This allows proper normalization of any
anydata content incl empty case.
List/leaf-list element parsing logic was updated to detach
schema node value check as a condition bc top level node
identifiers are not matching when anydata content is parsed.
Local name and namespace match is used instead.
JIRA: YANGTOOLS-1011
Change-Id: I09ae84c44ada198b888d901dff0425b29400fb4f
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Robert Varga [Fri, 17 Feb 2023 20:13:24 +0000 (21:13 +0100)]
Improve TreeNode and Version documentation
These two constructs are tighly related to well-known MVCC mechanics.
Update their documentation to provide links to Wikipedia explaining
their function.
Change-Id: I112c23cdcaa3aa07f93e78f86d5eb188e21cf73e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Nov 2022 17:33:39 +0000 (18:33 +0100)]
Remove XmlParserStream exceptions
SAXException and URISyntaxException cannot be thrown, remove them from
XmlParserStream.parse() signature.
Change-Id: I83c721540b48ed9052f43807f004aa578f54a9f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 17 Feb 2023 11:07:26 +0000 (12:07 +0100)]
Bump versions to 11.0.0-SNAPSHOT
This starts the next major development iteration.
Change-Id: I734762d8c161ea178bd9e1b20d4fc44afea484cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 17 Feb 2023 10:38:56 +0000 (11:38 +0100)]
Bump versions to 10.0.5-SNAPSHOT
This starts the next development iteration.
Change-Id: I6ca0c5e292d6c838e3b8acc747cad742d9a5bf03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 16 Feb 2023 14:56:19 +0000 (15:56 +0100)]
Bump odlaprent to 12.0.3
Pick up latest fixes from upstream.
Change-Id: I476ff57f69d3eb85e4e7e311abc0729da5a9187d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 Feb 2023 10:17:31 +0000 (11:17 +0100)]
Optimize ModifierImpl.AbstractPrerequisite
Object analysis shows we are recording outer class multiple times,
leading to suboptimimal object layout. Make the class hierarchy static,
with outer class recorded in explicit field, reducing
size of PhaseModificationInNamespacePath from 40-80 (48 typical) bytes
to 32-64 (40 typical) bytes. Other subclasses observe a similar
reduction.
JIRA: YANGTOOLS-1486
Change-Id: Ifc3da86a564bc54f4247996e622787a8528422b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 Feb 2023 09:45:28 +0000 (10:45 +0100)]
Use a switch expression to get validator
We are looking at an enumeration, hence we can use switch expression
exhaustiveness to eliminate an ISE.
Change-Id: Iebfd1b7f8d5ea19a5c7508c5f1a4f3d69074ab84
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Sangwook Ha [Mon, 30 Jan 2023 21:50:33 +0000 (13:50 -0800)]
Do do not check unique in unsupported lists
Parsing of YANG models fails if a list conditional on a feature has a
unique statement and the feature is not supported.
Add test cases to reproduce the issue and fix
RequireEffectiveList.isApplicable() to also check for
isSupportedByFeatures().
JIRA: YANGTOOLS-1481
Change-Id: Id73f3f36fc5300e4c9fe97c32a25e58ab75078e4
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 30 Jan 2023 16:04:17 +0000 (17:04 +0100)]
Bump versions to 10.0.4-SNAPSHOT
This starts the next development iteration.
Change-Id: Ie46ad8d7800cb4a8edf112b059b8672f616d5368
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 26 Jan 2023 23:16:22 +0000 (00:16 +0100)]
Simplify GeneratorTask(Factory)
We have abstract classes with only one concretization, squash them
together for simplicity.
Change-Id: I6f4f091feaa9c1ef6bf74c5613055e33fa44ab7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Jan 2023 13:32:43 +0000 (14:32 +0100)]
Do not access size indirect through body()
This seems to be more efficient, but needs to be evaluated.
Change-Id: Ia8ddc618b7b98a82ad51d97c349d035793386562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Sangwook Ha [Wed, 4 Jan 2023 04:12:51 +0000 (20:12 -0800)]
Fix ReactorStmtCtx.calculateParentRefcount()
If we have an empty grouping, which is referenced via augment-uses to a
different module, then if that module is buildEffective()'d first, we
end up with the grouping being swept.
This turns out to be a bug in parentRef determination -- in this
particular case we observe parent being REFCOUNT_NONE and invoke it
recursively -- and since the parent is a module, it itself does not have
a parentRef. This leads to us thinking the grouping does not have a
parentRef, whereas it does.
Update calculateParentRefcount() to recognize parent.refCount == 0 as
parent holding us down.
The problem manifests itself in the test when the models are processed
in order foo.yang, bar.yang -- but not when bar.yang is processed before
foo.yang.
Unfortunately the order of processing is not predictable in
BuildGlobalContext, hence we repeat the test 4 times.
JIRA: YANGTOOLS-1474
Change-Id: Ib3d55fb92d5a6d34230722ab1cd39e8f8831b6fe
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 30 Jan 2023 10:01:54 +0000 (11:01 +0100)]
Split calculateParentRefcount()
The real meat of the method operates solely on parent, so split it off
into a dedicated method.
Change-Id: I9e3b8a19d4031372669c454bcbd3fbd5ceb29e07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Jan 2023 19:11:38 +0000 (20:11 +0100)]
Modernize yang-data-impl
Use instanceof patterns and local variable type inference where
practicable.
Change-Id: I09b47ca59d6da7dee576e3e1457f37665f3ec4e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Jan 2023 04:07:52 +0000 (05:07 +0100)]
Document {Config,Status}EffectiveStatement as exceptional
These two statements have a counter-intuitive lifecycle dictated
by scalability concerns. While we could go the other way and instantiate
effective views, the information conveyed is not consulted often and
lends itself to extenal caching. Document the object model behaviour of
these two statements, providing explanation and hints to end users.
JIRA: YANGTOOLS-1271
JIRA: YANGTOOLS-1272
Change-Id: I20ac9e3aae0d0cbae37c5671649cde7347016dd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Jan 2023 12:43:22 +0000 (13:43 +0100)]
Bump odlparent to 12.0.2
Pick up latest upgrades from upstream.
Change-Id: Ic09484706d065d2ed43c86f67c5f2015c12f6eab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Jan 2023 14:24:24 +0000 (15:24 +0100)]
Tests for YangInstanceIdentifier key value serialization
There are a number of corner cases which we do not handle. This patch
adds @Ignored tests which hightlight basic serialization problems here.
JIRA: YANGTOOLS-1473
Change-Id: I6226cc8ebe48acc03a62309efec2ab205549e0fb
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 23 Jan 2023 08:46:00 +0000 (09:46 +0100)]
Add YangDataName
This adds yang.common.YangDataName, as the common identifier for
ietf-restconf:yang-data templates.
JIRA: YANGTOOLS-1477
Change-Id: Ie384e341ea84a6e1ca45b3f416d66aa1cd5ac79f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 17 Jan 2023 13:22:16 +0000 (14:22 +0100)]
Improve verify() calls
Rather than using plain generic verifyNotNull(), provide some context
to improve diagnostics when verification actually fails.
Change-Id: I211f7c81cf7d369af521953cd747bed06a89c360
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Jan 2023 13:38:44 +0000 (14:38 +0100)]
Improve JSONCodecFactory
Improve type safety for tests by returning a well-defined JSONCodec.
Change-Id: Id0ba808b03c3b035ad77d545dc4acdc60920188a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Jan 2023 15:08:11 +0000 (16:08 +0100)]
Modernize AbstractStringInstanceIdentifierCodec
Use instanceof patterns and local variable type inference.
Change-Id: I0b2bb0de72ab207ed01060cf3d6c76dbf5e450bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Ruslan Kashapov [Mon, 24 Oct 2022 13:04:41 +0000 (16:04 +0300)]
Allow unqualified node-identifiers in instance-identifier
node-identifier has an optional prefix, make sure we reflect this in our
class design.
JIRA: YANGTOOLS-1361
Change-Id: I928eabf5d2508d9be1390f7662998829cb06af81
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jan 2023 15:39:04 +0000 (16:39 +0100)]
Correct instance-identifier escaping
Dealing with single-quoted and double-quoted strings in
instance-identifier differs quite a bit. In order to deal with these
strings, we need to differentiate them in lexer, for which we create
separate modes.
This forces us to explicitly define lexer lokens and only match raw
strings in their mode -- ensuring there are no surprises.
JIRA: YANGTOOLS-1458
Change-Id: I3f58c10f068da1128d8a7c1c5bed3917bfea0c78
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jan 2023 19:25:10 +0000 (20:25 +0100)]
Force instanceIdentifier to consume all input
We need ANTLR to completely process the input string, hence force an EOF
token in instanceIdentifier.
JIRA: YANGTOOLS-1361
Change-Id: I80f1b326a47857e4e8f36c568901d19f771cef96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jan 2023 19:21:08 +0000 (20:21 +0100)]
Fix InstanceIdentifierParser's lexer
We have a day-0 bug here: we are using xpathLexer instead of
instanceIdentifierLexer.
JIRA: YANGTOOLS-1361
Change-Id: Ic4c074577c8a6fce9fbc22ef5da8e54b5df75faa
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jan 2023 18:14:52 +0000 (19:14 +0100)]
Guarantee LocationPath.Absolute from implementation
This makes it more type-safe to operate on tests etc.
Change-Id: Ib325c31092519e0644f02608cbca55e3dbca81b6
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jan 2023 17:27:31 +0000 (18:27 +0100)]
Modernize XPathParserTest
Use variable type inference and simplify test w.r.t. use in JUnit 5.
Ditches use of Hamcrest as well.
Change-Id: I209480067e4c22ac903086ce05e50d72a7517c73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jan 2023 15:53:48 +0000 (16:53 +0100)]
Modernize ParseTreeUtils
Use instanceof patterns, local variable type inference and
String.formatted().
Change-Id: I759bb20d8f73100d0b555cf50cdd8f8405334388
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jan 2023 15:33:19 +0000 (16:33 +0100)]
Modernize InstanceIdentifierParser
Use switch expressions, instanceof pattern and local variable type
inference.
Change-Id: I609a17afc5915ae340b8ee0bc9fe7a2f74fa8ac1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 21 Dec 2022 18:52:52 +0000 (19:52 +0100)]
Port yang-parser-rfc7950 to JUnit 5
This is an openrewrite-based migration, augmented with conversion to
assertThrows()/assertInstanceOf().
We also migrate tests to use AbstractYangTest assertions where
applicable, further reducing clutter.
Change-Id: I3960ebaa19a8647ee3e470f6007ff7713bd71c2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 21 Dec 2022 23:00:56 +0000 (00:00 +0100)]
Improve Descendant check
Rather than asserting Absolute, use an explicit if with instanceof
expression to guard list additions. Also retain declaration order
by not going through an intermediate HashSet.
Change-Id: I0292aa8f927a101de83979da808cf84032bfb021
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Sangwook Ha [Sun, 4 Dec 2022 06:00:47 +0000 (22:00 -0800)]
Do not suppress 'uses' node effects
Parser tries to process an 'augment' statement with 'if-feature' and
fails when the feature is not supported and the 'augment' statement
targets a node defined with a nested grouping and dependent on the
feature.
Add a test case (4th one) to reproduce the issue. The other test cases
show that there is no parsing issue if the augmentation target node is
defined with a single grouping or feature is supported.
The problem here is not AugmentStatementSupport, but rather
UsesStatementSupport, which fails to propagate children when if-feature
is in effect -- hence those children never make it to the schema tree,
and hence fail to be looked up.
Use 'uses' statement's if-feature to mark any children as unsupporte,
hence they are reflected in namespaces, but they will not be built.
JIRA: YANGTOOLS-1471
Change-Id: Ibd86530388a99ed3c8ade7bf9af109c6a0cfb80a
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Sangwook Ha [Sat, 3 Dec 2022 23:19:45 +0000 (15:19 -0800)]
Fix unique statement argument propagation
Augmentation to the list with a unique statement from a module different
from the one where the list is defined causes SourceException which
complains that the argument node of the unique statement does not exist.
This turns out to have already been flagged with a FIXME -- this
behaviour has been there since forever.
The correct behaviour is to use a StatementPolicy.copyDeclared() and
adjust QNames in the argument's Descendants.
JIRA: YANGTOOLS-1470
Change-Id: Ib2cd23d50cd881d2ae94dbc0b271b5d481c9f55c
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Robert Varga [Wed, 21 Dec 2022 21:00:13 +0000 (22:00 +0100)]
Clean up IfFeatureResolution test a bit
Test setup here is rather verbose, simplify it.
Change-Id: I3ca4cd9e0c419416ecaab63b5647a54043e43152
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 21 Dec 2022 20:31:00 +0000 (21:31 +0100)]
Modernize UsesStatementSupport a bit
Use Java 11/Java 17 trivial features to clean up logic.
Change-Id: Id4f5d68726acafe7ecdf3e7739719d0619925fca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 13 Dec 2022 12:06:50 +0000 (13:06 +0100)]
Migrate yang-model-export to JUnit5
This is a simplistic conversion, also modernizing Java constructs used.
Change-Id: Iaa10e3caec078ed3145bcc1dd9f4e0d8f8c30206
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 4 Dec 2022 14:30:37 +0000 (15:30 +0100)]
Bump versions to 10.0.3-SNAPSHOT
This starts the next development iteration.
Change-Id: I567e9bb30ce9ccb56164cdbf555735be6eace4f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
MarioDoman [Thu, 30 Jun 2022 10:43:35 +0000 (12:43 +0200)]
Add pipeline for staging jobs
This adds a bare-bones stage pipeline, which can build and deploy the
project.
Change-Id: I6f4b31d26b2e2b51d36c758e8e72b487e43c92fd
Signed-off-by: MarioDoman <mario.doman@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Mario Doman [Tue, 29 Nov 2022 13:47:42 +0000 (14:47 +0100)]
build validator from maven or get it from args
Change-Id: I1b89d41d67cf6941621420272975ccaf72f9b031
Signed-off-by: Mario Doman <mario.doman@pantheon.tech>
Mario Doman [Mon, 28 Nov 2022 10:44:04 +0000 (11:44 +0100)]
speed up CSIT testing with updated yang path option
Change-Id: I62f7b9ffbefac1b7adb12e85158b90fbe2d44126
Signed-off-by: Mario Doman <mario.doman@pantheon.tech>
Robert Varga [Mon, 21 Nov 2022 21:39:55 +0000 (22:39 +0100)]
Add sized Builders methods
Added sized Builders methods and converted calls on
schema.builder.impl.{Class}Builder.create method to calls on respective
Builders static method. This will allow us to decouple the
implementations going forward.
JIRA: YANGTOOLS-1462
Change-Id: I0466d39ae1ff51b3ec0e75be45147ab2ff4e7b37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: matusmatok <matus.matok@pantheon.tech>
Robert Varga [Sat, 3 Dec 2022 19:38:15 +0000 (20:38 +0100)]
Use an instanceof pattern
We can reduce casting here.
Change-Id: I1f06c042df0589f8cea9e06d2c91bc6f386bc89d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 3 Dec 2022 12:02:01 +0000 (13:02 +0100)]
Do not ignore passed-in path
The path needs to be forwarded, this was missed during review.
JIRA: YANGTOOLS-1469
Change-Id: I654c9812d2b5b580cf98e2644538d7871ccee782
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
65cf593e8d7b2c4c146496cecd1a0ffee211df3c)
Robert Varga [Sat, 26 Nov 2022 10:08:50 +0000 (11:08 +0100)]
Remove MojoFailureException declaration
We are not throwing this exception, remove its declaration.
Change-Id: I5d42eaa6aa43312931a3332e9d552c991f9211f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 26 Nov 2022 10:07:50 +0000 (11:07 +0100)]
Fix another mergeable if statement
Sonar is point out nested ifs, fix that.
Change-Id: I7081c59b9a5d617e34b9c52c267e8910ff6f08d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 26 Nov 2022 10:05:31 +0000 (11:05 +0100)]
Merge instanceof and qname check
Pattern matching allows these to be merged, as pointed out by Sonar.
Change-Id: Ie321b5539c974dcd8929272eda122f16c83c25bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 26 Nov 2022 10:03:44 +0000 (11:03 +0100)]
Clean up ServiceLoaderState
Sonar is suggesting private constructs, add them.
Change-Id: Ia4d818ae2a1e478dbdd8977b607f150b79dd285d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 26 Nov 2022 10:01:56 +0000 (11:01 +0100)]
Clean up CompactTokenFactory.create()
Sonar is pointing out mergeable if statements, let's do that.
Change-Id: I6f4ca5b8da3a406f693ff246a9eb1f2bd73af33c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 26 Nov 2022 09:57:03 +0000 (10:57 +0100)]
Clean up ModuleNodeImpl
Use Objects.hash() and simplify equals() methods, fixing a Sonar
warning.
Change-Id: Iff3415bcf12f9df6bf4b36585e8bd96908876518
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 26 Nov 2022 09:53:23 +0000 (10:53 +0100)]
Merge if statements
Sonar is reporting this violation, fix it.
Change-Id: Iae2ae38e84fd89962bb2ec2eeddab2228e33c11f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 25 Nov 2022 09:32:44 +0000 (10:32 +0100)]
Bump versions to 10.0.2-SNAPSHOT
This starts the next development iteration.
Change-Id: I5a0f6863eae49cd07d6ba4a4578460381aadcea1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 25 Nov 2022 09:29:42 +0000 (10:29 +0100)]
Bump odlparent to 12.0.1
Pick up latest updates from upstream.
Change-Id: I3de141be79358d5565533abd0b86420474b03562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 25 Nov 2022 03:16:59 +0000 (04:16 +0100)]
Validate namespace sooner
Pass the read string directly to XMLNamespace.of() before we read the
revision.
Change-Id: I67f2a7f258d340bba107b0233501061dd8af352b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 25 Nov 2022 03:08:37 +0000 (04:08 +0100)]
Trim QNameModule.compare()
Use assign-and-check to save a bit of bytecode.
Change-Id: Ie7bbad84938c824bd7bd427a94e11980538e6efc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Mario Doman [Mon, 21 Nov 2022 08:15:07 +0000 (09:15 +0100)]
Convert csit to run in local environment
This ditches the creation of VMs and updates execution to run
in local execution environment.
Change-Id: Iab2b191d2b4616e80cb009ea3beff79add5fac24
Signed-off-by: Mario Doman <mario.doman@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 22 Nov 2022 17:47:49 +0000 (18:47 +0100)]
Fix isSupportedToBuildEffective() propagation
InferredStatementContext has bad interaction with ImplictStmtCtx -- the
latter fizzles when it is not supported by features. This leads to a
failure to build effective context, as the prototype cannot be built and
therefore an attempt to reuse it fails.
Adjust InferredStatementContext to check if its prototype can be built
and carry over that fact when it is not.
JIRA: YANGTOOLS-1465
Change-Id: Iad05b0c6a06b6d9f837b70ced0da8cdc8ed3ed97
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 22 Nov 2022 12:06:18 +0000 (13:06 +0100)]
Fix yang-xpath-impl package import
The dependency on javax.inject should be optional, make sure that is the
case.
JIRA: YANGTOOLS-1467
Change-Id: Ic005d463e65bd8596fe586bb64272e966a6d1693
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 Nov 2022 16:57:08 +0000 (17:57 +0100)]
Use instanceof patterns in AbstractEffectiveModule
We can reduce the number of explicit casts and make the code a bit
denser now that we have Java 17.
Change-Id: I3d1775676eb4a0a08873b1a452f40d72e27a10a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 Nov 2022 17:05:35 +0000 (18:05 +0100)]
Add ModuleEffectiveStatement.namespace()
A module has to have exactly one namespace statement, expose it
from ModuleEffectiveStatement.
JIRA: YANGTOOLS-1466
Change-Id: I958cb5fca392029dd236d52e54527ab211ab8199
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 Nov 2022 17:02:00 +0000 (18:02 +0100)]
Add SubmoduleEffectiveStatement.belongsTo()
A submodule has to have exactly one belongs-to statement, expose it
from SubmoduleEffectiveStatement.
JIRA: YANGTOOLS-1466
Change-Id: Ic95bdca3f57384f14e05524b365825c3ed3dccf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 Nov 2022 16:41:09 +0000 (17:41 +0100)]
Add prefix() methods
A number of statements are required to have a prefix substatement,
expose utility methods to access these substatements directly.
JIRA: YANGTOOLS-1466
Change-Id: Ibc9846ad3e3489755eddbcc02be62c128c0f78e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 Nov 2022 15:58:35 +0000 (16:58 +0100)]
Add input()/output() utility methods
RpcDefinition and ActionDefinition provide direct access to their,
always present, input and output substatements. Expose equivalent
functionality from {Action,Rpc}EffectiveStatement.
JIRA: YANGTOOLS-1466
Change-Id: I836bc03f6215eec98c66502619c51bf361cc77b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Ruslan Kashapov [Tue, 15 Nov 2022 15:41:31 +0000 (17:41 +0200)]
Fix NPE when parsing deviation from submodule
If the deviation statement is used in a submodule, we need to lookup up
the corresponding module, otherwise we will not find the correct
namespace.
JIRA: YANGTOOLS-1448
Change-Id: Iaf2e1d6526a9f268a6c0a3835e1bfdfafa05fffe
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 16 Nov 2022 19:47:04 +0000 (20:47 +0100)]
Enable deviation substatement validation
Make sure we call super, as that circles back to our validator.
Change-Id: I41dcaa3a48b98cb09a348349a56263a4936ea5bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Sangwook Ha [Tue, 12 Jul 2022 22:26:01 +0000 (15:26 -0700)]
Reproduce YANGTOOLS-1445
Building effective model fails when unique statement is used in a
grouping used by another grouping.
Add a test case (the third one) to reproduce the issue. There is no
issue when the unique statement is used in a single grouping like the
first two test cases.
JIRA: YANGTOOLS-1445
Change-Id: Idadfb6e8fc0bf724f0ff770d9fe986692e4b30eb
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Robert Varga [Tue, 15 Nov 2022 22:30:15 +0000 (23:30 +0100)]
Catch duplicate instantiation of statements
The problem here is that during tryToReusePrototype() we are copying
child statements, which in turn are triggering onStatementAdded(). For
unique statements this incurs a SchemaTreeNamespace requirement on the
target leaf -- which is satisified via requestSchemaTreeChild() and
recorded in substatements (as partial materialization) and it is also
recorded in the schema tree namespace. When this happens, though,
effectiveCopy() does not notice the statement has already been copied
and copies it again, and thus ends up colliding in the schema tree
namespace -- pointing to the same statement as the source of the
problem.
Update effectiveCopy() to re-examing substatements to see if they
reflect partial materialization and pick copied statement from there.
JIRA: YANGTOOLS-1445
Change-Id: Ic184f872bf21e3e3c112b4fb5960fbe44262c77e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 10 Nov 2022 16:27:52 +0000 (17:27 +0100)]
Allow path to be null
Downstreams need to perform dispatch to use either create() without
the path -- which is a bit hostile for utilities. Allow path to be
optional, improving usability a bit.
Change-Id: I46e4c4b5d2aa9218df6cb729f7a68cbd503cc4c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
MarioDoman [Thu, 27 Oct 2022 13:23:13 +0000 (15:23 +0200)]
Initial CSIT code drop
This drops in the system test from integration/distribution,
so that it can be maintained with the corresponding codebase.
Change-Id: I5c05deb5e6e33d436b1af7362ccddfcd6f3a1566
Signed-off-by: MarioDoman <mario.doman@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 20:44:02 +0000 (21:44 +0100)]
Add SourceIdentifier(String,Revision)
This is a convenience constructor which is useful when mapping
raw literals to a concrete namespace revision. Also improve
documentation a bit.
Change-Id: I955c2bdbf4d573da4ef87aec8b0f9faaecc6cb5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 18:37:10 +0000 (19:37 +0100)]
Use VarHandle for LeafRefPath.legacyPath
Using a VarHandle we can use relaxed ordering and improve behaviour
under races.
Change-Id: Ia7a6d0dff43c3e0534099949931dc91eba209eaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 18:20:57 +0000 (19:20 +0100)]
Reduce synchronization for child strategy access
We now have a VarHandle here, so we can use getAcquire()/setRelease()
for more relaxed happens-before ordering.
Change-Id: I46e1936cc68ba1ec6205135124e69dfc2d578ca0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 18:18:39 +0000 (19:18 +0100)]
Use VarHandles in DataNodeContainerModificationStrategy
Using a VarHandle allows us to use compareAndExchange(), which
eliminates the need for a volatile read when we fail to update.
Change-Id: Ie7922c5f116801f0b442c30f3ca14d2360abc845
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 18:15:00 +0000 (19:15 +0100)]
Use instanceof pattern
Reduce the need to cast by using an instanceof pattern.
Change-Id: Iea1cef0d13e20786abe34d90f05e3118f31c6206
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 18:12:45 +0000 (19:12 +0100)]
Modernize DataNodeContainerModificationStrategy
Use:
- local variable type inference
- fluent builder to simplify Immutable construction
- DataNodeContainer.dataChildByName() to remove Optional
Change-Id: Ic6f31ef98f98edcd3608bac11dc3a6170f659a5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 18:00:29 +0000 (19:00 +0100)]
Use VarHandle in AbstractCursorAware
VarHandle.compareAndExchange() gives us visibility to witness value,
hence we can eliminate all volatile reads.
Change-Id: Ie88e09960a3a0fd46bd2853759c1afdd3b96b38c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 17:05:46 +0000 (18:05 +0100)]
Use VarHandle for AbstractCursor.closed
With VarHandles we do not get raw types and can use a plain boolean
to keep the closed state.
Change-Id: I959b0f33fb861af5b21aeef3525719e878e3156d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 17:01:16 +0000 (18:01 +0100)]
DurationWithTime is a simple record
This is a pure value holder, use a record for it.
Change-Id: I3f6743cfbbe74bd7b83acb0b9d8bfb0265f03540
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 16:56:53 +0000 (17:56 +0100)]
Use VarHandles for sum/count tracking
Switch from AtomicLongFieldUpdater, which does not give us much, but
makes the class more uniform.
Change-Id: I3ef63910f57a123172906f9814e5aa689c029721
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 16:36:54 +0000 (17:36 +0100)]
Use VarHandles to update shortest/longest duration
Rather than using ARFU's compareAndSet() and volatile reads, take
advantage of VarHandle's getAcquire() and compareAndExchangeRelease().
This makes things less ordered and more performant in face of races.
Also split out the update logic to aid inlining.
Change-Id: If60016b03c738240d7bdc041c32d5d908b3f002c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 16:02:13 +0000 (17:02 +0100)]
Improve largestQueueSize tracking
VarHandles expose a better API to updating variable than
AtomicIntegerFieldUpdater.
This patch takes advantage of Java 9 memory model to take this variable
out of global volatile happens-before tracking where updates are
concerned. User access still uses a volatile read.
Change-Id: Iba667d501aaebb6cae7e56692bae9e1d840c6807
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Nov 2022 16:00:19 +0000 (17:00 +0100)]
Target FIXME to next major release
The return value here should have been changed eons ago, target it for
next release.
Change-Id: Ic9e9ec663fefc19513b61e389b8f3948d7aa4fda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 Nov 2022 22:15:29 +0000 (23:15 +0100)]
ForeignDataNode is identified by NormalizedNode
Both specializations are using NodeIdentifier, make sure we centralize
that definition.
Change-Id: Ie3eed54476098f583916e4ed37fdfe17ff10eeef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 7 Nov 2022 13:32:08 +0000 (14:32 +0100)]
Clean up ExceptionMapper
Use Class.isInstance() and Class.cast() instead of unchecked casts. Also
restructure ExecutionException mapping.
Change-Id: I21b61cd99a715746c865d12b378b1874b925519b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 3 Nov 2022 00:21:40 +0000 (01:21 +0100)]
Remove most direct references to builder implementations
We want to hide individual builders, this patch removes most references
outside of core implementation.
Change-Id: I198efa13a0b5700ce066d8d5fbf41a98614f3c40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 Nov 2022 18:25:20 +0000 (19:25 +0100)]
Reuse the a NodeIdentifier for SchemaContext.NAME
We have an unused constant for this, use it instead of creating one over
and over again.
Change-Id: I5dfc6fddf8eef6c4ed45c1d7926fe09ba4174c35
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 3 Nov 2022 00:59:01 +0000 (01:59 +0100)]
Migrate yang-data-tree-ri to use Builders
Migrate production code to use Builders instead of referencing
individual builders.
Change-Id: I842e8ff71b0dd95fb2fad5f281dfd136d3b85c32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 3 Nov 2022 00:56:38 +0000 (01:56 +0100)]
Use Builders in yang-data-tree-ri tests
We want to hide individual implementations, make sure tests are not
referencing them.
Change-Id: Id6f45b5b2469d949bb4e1aba840a57e2a273483a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Nov 2022 17:35:32 +0000 (18:35 +0100)]
Remove unused logger
DurationStatisticsTracker is not using logging, remove the logger.
Change-Id: I8211d54dbea1dbe9a5c2eeef74ea12a4cc6f067b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Nov 2022 16:57:25 +0000 (17:57 +0100)]
Bump versions to 10.0.1-SNAPSHOT
This starts the next development iteration.
Change-Id: I120b76ff75c67d5ce80709dcf5a2d210633ee29f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Nov 2022 15:02:42 +0000 (16:02 +0100)]
Promote yang-xpath-api to stable
Most of the constructs here are deemed stable, those that are not can be
evolved as per SemVer.
Change-Id: Ife3030039b1c2dcba1c7261533aca779ca33a811
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Nov 2022 16:31:59 +0000 (17:31 +0100)]
Remove UnresolvedQName.(qualified,unqualified)
These static factory methods have been superseded, remove them.
Change-Id: I2036a619cbc288a38a66390d4983faba060e6732
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Nov 2022 16:30:50 +0000 (17:30 +0100)]
Use java.io.Serial in yang-common
This is a way of documenting serialization intent, make sure we use it
where appropriate.
Change-Id: I7bcfa898f2f9c21be27dbf99b0d689b19e137871
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Nov 2022 16:20:34 +0000 (17:20 +0100)]
Fix maven dependency declarations
Dependencies should be scope=provided, fix that.
Change-Id: I5c3569991c7a77482714ea1c4fdee022d42ab5cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 17 Oct 2022 08:47:37 +0000 (10:47 +0200)]
Split out YangIRSchemaSource
This is a counterpart to YangTextSchemaSource, publish it to
yang-repo-api. This allows is to be consumed without a direct dependency
on YANG parser.
JIRA: YANGTOOLS-1460
Change-Id: Ia7a9d938b8ed94f9b46cd5a22cb86472160dfd98
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 16 Oct 2022 23:35:51 +0000 (01:35 +0200)]
Split out yang-ir
We are using a generalized parse tree-based intermediate representation
of YANG files. Publish the object layout from parser so it can be
separately accessed.
JIRA: YANGTOOLS-1460
Change-Id: I965c5cf64b12e849ff4d76db5a8b2c79b1a8856c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Manoj Chokka [Tue, 20 Jul 2021 12:38:00 +0000 (12:38 +0000)]
Fix anyxml-to-JSON translation duplication error
JSONNormalizedNodeStreamWriter generates duplicates when array elements
are not listed consecutively and interleaved with other sibling nodes.
Make sure to check if there is any previously processed sibling node
with the same node name instead of checking just the previous one.
Also, Add a couple of test cases to cover this issue.
JIRA: YANGTOOLS-1302
Change-Id: I4d64c8b8a45009e7667af621c96c34824fb7b48b
Signed-off-by: Manoj Chokka <cmanoj8@gmail.com>
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>