yangtools.git
14 months agoEncapsulate GeneratorTask 94/104794/2
Robert Varga [Tue, 7 Mar 2023 21:33:13 +0000 (22:33 +0100)]
Encapsulate GeneratorTask

The distinction between GeneratorTask and GeneratorTaskFactory is very
moot. Simplify the interface to YangToSourcesProcessor, which enables us
to merge the two classes.

JIRA: YANGTOOLS-745
Change-Id: I672b3f0bc420baccfd8d7601c7420fd1b6bebcab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove ParserConfigAware 93/104793/1
Robert Varga [Tue, 7 Mar 2023 21:26:31 +0000 (22:26 +0100)]
Remove ParserConfigAware

This is a useless indirection, of which one implementation is completely
unused. Remove it, paving the way for further simplification.

JIRA: YANGTOOLS-745
Change-Id: Ie6084a2ef1afee68d9f8f4cc5bec9a9b8a356d8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoEncapsulate project directory access 92/104792/3
Robert Varga [Tue, 7 Mar 2023 20:47:37 +0000 (21:47 +0100)]
Encapsulate project directory access

The access fact that a GeneratorTask has accessed a particular project
directory needs to be mediated. Add ProjectFileAccess to act as an
intermediary, so that the fact we generate files and Project
modifications can be disconnected.

JIRA: YANGTOOLS-745
Change-Id: Ib550a9c30936444a0077b6f08a3f1e85184173a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoDo not use optional in createReactor() 91/104791/1
Robert Varga [Tue, 7 Mar 2023 18:29:45 +0000 (19:29 +0100)]
Do not use optional in createReactor()

We only ever return non-empty, codify that fact.

JIRA: YANGTOOLS-745
Change-Id: I25c2d791f024a44bcf0417379dfb30951393ef32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoDo not pass BuildContext to GeneratorTask 90/104790/1
Robert Varga [Tue, 7 Mar 2023 18:21:20 +0000 (19:21 +0100)]
Do not pass BuildContext to GeneratorTask

We have previously decomposed OutputStream creation and refresh
notification. Now move the refresh notification processing to
YangToSourcesProcessor.

This improves the plugin in that:
- WriteTask is simpler (and smaller in some runtimes)
- BuildContext interactions are more localized
- BuildContext executes on the initial thread, improving its
  confinement

JIRA: YANGTOOLS-745
Change-Id: Ia192dbe5134349a78f2290bbf7a9b7ff9d236746
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoInline generateSources() 89/104789/1
Robert Varga [Tue, 7 Mar 2023 18:07:36 +0000 (19:07 +0100)]
Inline generateSources()

This method has direct interactions with output collection. We are set
to change that integration and this inlining has the added benefit of
removing one intermediate collection.

JIRA: YANGTOOLS-745
Change-Id: Ice993375011fd31a3ec80771b0a3d056b921cb68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoObsolete Sodium SR1 streams 51/102951/8
Robert Varga [Fri, 28 Oct 2022 23:03:27 +0000 (01:03 +0200)]
Obsolete Sodium SR1 streams

We nominally support reading Sodium SR1 streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Iec194a9f411f926996175781eeeb770a5f6884a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoObsolete Neon SR2 streams 50/102950/7
Robert Varga [Fri, 28 Oct 2022 22:44:28 +0000 (00:44 +0200)]
Obsolete Neon SR2 streams

We nominally support reading Neon SR2 streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Ia4655366357ce68f9dd18492f77c1f297658d26d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoObsolete Lithium streams 49/102949/4
Robert Varga [Fri, 28 Oct 2022 22:33:55 +0000 (00:33 +0200)]
Obsolete Lithium streams

We nominally support reading Lithium streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Ibb820b5ee19ccb188dd1d0603eefe5133e1ff403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoAdd AbstractQName.unbind() 08/104208/4
Robert Varga [Tue, 31 Jan 2023 22:43:44 +0000 (23:43 +0100)]
Add AbstractQName.unbind()

Acquiring a simple, namespace-free UnresolvedQName.Unqualified is
usefule in a few contexts, where we for convenience now require
AbstractQName (and document we only use its localName).

Introduce AbstractQName.unbind(), which returns an Unqualified object,
so that these users can be more expressive and can use direct equals
comparisons.

Change-Id: I1a485e05d2bb13c2012fc017a6b30795a8891a80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMove QNameAwareData{Input,Output} 78/104778/1
Robert Varga [Mon, 6 Mar 2023 14:55:42 +0000 (15:55 +0100)]
Move QNameAwareData{Input,Output}

Having these interfaces in QName makes it harder to interact with QName,
as they end up being completed into context where we have static
methods.

Change-Id: I8bf3e5bf8f414fcbee60b7120f7ccb7a9acedc33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove getLocalName() invocation 77/104777/1
Robert Varga [Mon, 6 Mar 2023 14:50:56 +0000 (15:50 +0100)]
Remove getLocalName() invocation

We can easily refer to localName field, do just that.

Change-Id: I0b51e77c1b5e2fe61b3190bc661541682dec8e4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoUpdate YangData(Effective)Statement definition 20/104720/6
Robert Varga [Thu, 2 Mar 2023 13:02:05 +0000 (14:02 +0100)]
Update YangData(Effective)Statement definition

Using a raw String is not nice for end users, who want to corelate
this statement to other constructs. Change the argument definition
to YangDataName.

JIRA: YANGTOOLS-1479
Change-Id: I0b7788d9c6c9736ddac466c9c63a3cc05b6c92f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove SchemaInferenceStack javadocs 74/104774/3
Robert Varga [Mon, 6 Mar 2023 14:06:04 +0000 (15:06 +0100)]
Improve SchemaInferenceStack javadocs

Use {@code blocks} to highlight null/true/false. Also fix a tiny typo.

Change-Id: I531de055f437c0633bc7353c6d023a797f386323
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoIntegrate rfc7952-data-util into yang-data-util 67/104667/2
Robert Varga [Wed, 1 Mar 2023 15:24:44 +0000 (16:24 +0100)]
Integrate rfc7952-data-util into yang-data-util

Metadata is very much part of what YANG models, there is no need to keep
it in a separate package. This also allows for better integration.

JIRA: YANGTOOLS-1489
Change-Id: Ie3440b85621e905bec7bd24573ce7950ce35f790
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate yang-maven-plugin to JUnit5 40/104640/1
Robert Varga [Wed, 1 Mar 2023 09:33:12 +0000 (10:33 +0100)]
Migrate yang-maven-plugin to JUnit5

A straightforward rewrite + customized cleanups.

Change-Id: Ibc92482edfa6f598f5d4ad446ffa9dd1cd2a03ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRename UtilTest 36/104636/1
Robert Varga [Tue, 28 Feb 2023 23:48:19 +0000 (00:48 +0100)]
Rename UtilTest

Leftovers are only testing ContextHolder, rename the test to reflect
that.

Change-Id: Ia8c55bde02ece03e5b37c0c1e684061d07511e14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRehost checkClasspath() 35/104635/2
Robert Varga [Tue, 28 Feb 2023 23:41:39 +0000 (00:41 +0100)]
Rehost checkClasspath()

This is a single-use utility method, move it to its sole user.

Change-Id: Icb5aec7e488b479bcad0c8e046d61cb4c5ec9ed1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up getPluginTransitiveDependencies() 34/104634/2
Robert Varga [Tue, 28 Feb 2023 23:32:19 +0000 (00:32 +0100)]
Clean up getPluginTransitiveDependencies()

Allocate the return map inside the method, reducing the number of
arguments and actually returining it.

Change-Id: I482251d2abd353ece9386040acfe614bce70d582
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMove Util.getClassPath() 33/104633/1
Robert Varga [Tue, 28 Feb 2023 23:27:39 +0000 (00:27 +0100)]
Move Util.getClassPath()

Rehost this utility method to its sole caller.

Change-Id: I51826631db782a5e85c37f6b776caa93e97a485f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up yang-maven-util Util 32/104632/1
Robert Varga [Tue, 28 Feb 2023 23:21:39 +0000 (00:21 +0100)]
Clean up yang-maven-util Util

Use variable type inference and perform general clean up.

Change-Id: I415d4c91347c7b43eaf3afe6893408241a3504eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoFixup listFiles() 31/104631/1
Robert Varga [Tue, 28 Feb 2023 21:10:27 +0000 (22:10 +0100)]
Fixup listFiles()

Use ImmutableList for return to make interactions clear.

Change-Id: I8e3955b99913b5286541d78e926584e9b004aa23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoCapture input files in YangToSourcesState 27/104627/6
Robert Varga [Tue, 28 Feb 2023 17:06:44 +0000 (18:06 +0100)]
Capture input files in YangToSourcesState

We need to hash the files we use for input into the
EffectiveModelContext, so we can compare them when we next run.

This patch does not completely deal with the dependencies, as they are a
tad more complicated.

JIRA: YANGTOOLS-1165
Change-Id: Id2d3154d564918e2ee37d4de71f336863afc7da1
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove generateSources() a bit 30/104630/1
Robert Varga [Tue, 28 Feb 2023 18:51:16 +0000 (19:51 +0100)]
Improve generateSources() a bit

Use local variable type inference to directly bind to ArrayList.

Change-Id: I832bbb2904ec85b24f233848aae756e9be46fe5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoDo not instantiate allFiles 29/104629/1
Robert Varga [Tue, 28 Feb 2023 18:07:09 +0000 (19:07 +0100)]
Do not instantiate allFiles

We are just performing a simple check -- we can do that via
concatenating two streams instead.

Change-Id: I28ae2c6854bfc40007d6dc6c80a83ead99718965
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up ScannedDependency 28/104628/1
Robert Varga [Tue, 28 Feb 2023 17:34:37 +0000 (18:34 +0100)]
Clean up ScannedDependency

Promise ImmutableList and use ImmutableSet internally, streamlining some
of the operations.

Change-Id: Iabcaef402a4cad284171a4acbcd99e4d48432a14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up YangProvider a bit 26/104626/1
Robert Varga [Tue, 28 Feb 2023 16:38:48 +0000 (17:38 +0100)]
Clean up YangProvider a bit

Use pre-sized builder and do not store the file name, as we are using it
exactly once.

Change-Id: I602b2b0b5db27c3a80096bc65055bc39d19c257c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoAdd file-based StateStorage 25/104625/4
Robert Varga [Tue, 28 Feb 2023 15:18:35 +0000 (16:18 +0100)]
Add file-based StateStorage

For plain maven builds, backed by DefaultBuildContext, we need to deal
with the fact the context does absolutely nothing. Add a file-based
storage engine.

Since we are persiting YangToSourcesState, also guard it with a magic
integer to allow for compatibility.

JIRA: YANGTOOLS-1491
Change-Id: I2763fbddf5a485ec4220e89c5fdc97f2a11f208f
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoAdd StateStorage 24/104624/3
Robert Varga [Tue, 28 Feb 2023 15:16:15 +0000 (16:16 +0100)]
Add StateStorage

The task of storing and restoring YangToSourceState can be filled
by multiple means. Add StateStorage interface and a simple
implementation based on BuildContext.

JIRA: YANGTOOLS-745
Change-Id: I2bc53ade834b140a429be9d7dcc9e6aba078d66f
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove a warning suppression 22/104622/1
Robert Varga [Tue, 28 Feb 2023 13:29:00 +0000 (14:29 +0100)]
Remove a warning suppression

We can use FileGeneratorException as the precise exception, keeping
checkstyle happy.

Change-Id: Iaa8218d1e4c669384c3682c7bd0e7000ef7389f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoFix a raw type suppression 21/104621/1
Robert Varga [Tue, 28 Feb 2023 13:26:25 +0000 (14:26 +0100)]
Fix a raw type suppression

We can operate on a simple wildcard, just to that.

Change-Id: I6eb1dadefad849b18cf84285ebf86920805cda66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up YangToSourcesMojo 20/104620/1
Robert Varga [Tue, 28 Feb 2023 13:05:29 +0000 (14:05 +0100)]
Clean up YangToSourcesMojo

We have a weird combination of injected and instantiated processors
here, which really serves only for a very bad UT. Since we are testing
YangToSourcesMojo through integration tests, we can forgo all of this.

This leads to a more straightforward execution, as now the Mojo acts
only as a thin interface towards maven. All the logic is contained in
Processor.

Change-Id: Ia64e69ed6a44e3052f43dcc978e066b080928e73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoFix yang.skip implementation 19/104619/1
Robert Varga [Tue, 28 Feb 2023 12:43:23 +0000 (13:43 +0100)]
Fix yang.skip implementation

The documentation implies yang.skip disables execution completely, which
is in-line with other Maven plugins' skip function. Fix the
implementation to completely forgo execution.

Change-Id: I1cd58a73dd2c9e1f6f5c42a27de149079bb9175b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoTrack META-INF/ files in state 20/103220/25
Ruslan Kashapov [Tue, 8 Nov 2022 09:39:35 +0000 (11:39 +0200)]
Track META-INF/ files in state

Yang resources copied into META-INF folder now taken into
account as plugin output the same way as generated files.

JIRA: YANGTOOLS-1166
Change-Id: I815c1fc69c1220ce86efd319725470f11533c72b
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
15 months agoCapture effective configuration 11/104611/1
Robert Varga [Sun, 26 Feb 2023 19:53:53 +0000 (20:53 +0100)]
Capture effective configuration

We are filling in missing and ignoring unreferenced configurations,
make sure we capture the effective configuration.

JIRA: YANGTOOLS-1490
Change-Id: I24c14cecb4c19b9948b03d4b7ced485bd14b4e70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCapture FileGeneratorArg configuration 10/104610/1
Robert Varga [Sun, 26 Feb 2023 18:57:07 +0000 (19:57 +0100)]
Capture FileGeneratorArg configuration

Generator configuration constituates a part of parsisted state, make
sure we take it into account.

JIRA: YANGTOOLS-1490
Change-Id: Idaf53af87a1922e9f3ee93712f2c069f21ac8f67
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDiscover the common prefix in a FileStateSet 09/104609/3
Robert Varga [Sun, 26 Feb 2023 17:55:35 +0000 (18:55 +0100)]
Discover the common prefix in a FileStateSet

Address a TODO that potentially improves persisted file size. This
makes FileState not a WritableObject, as the serialization format
requires further information.

JIRA: YANGTOOLS-1166
Change-Id: I35f7044186ac1e862a41e4f4a903fba2417cbb23
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSeparate out FileStateSet 88/104588/2
Robert Varga [Sun, 26 Feb 2023 17:31:56 +0000 (18:31 +0100)]
Separate out FileStateSet

YangToSourcesState is mucking with maps, where this functionality will
be shared with another set of files. Split the functionality out to a
separate construct.

JIRA: YANGTOOLS-1166
Change-Id: I20c824eb5d1d9eabeaaf67ae3945f8da016d985c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSplit a misleading comment 87/104587/1
Robert Varga [Sun, 26 Feb 2023 14:56:15 +0000 (15:56 +0100)]
Split a misleading comment

We scan files in two steps, but the comment indicates we do that
in one go. Correct that.

Change-Id: I9e3c77006773486ad06cd923edba18652f86f010
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCollect output file state 80/104180/10
Robert Varga [Thu, 26 Jan 2023 18:36:57 +0000 (19:36 +0100)]
Collect output file state

We need to capture the state of files we are emitting. Plug into
GeneratorTask and generate the file name and has as part of file
writeout.

JIRA: YANGTOOLS-1166
Change-Id: I9e0422e5d1bb7be218ca3dbc9e7611395554a3e1
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up copying warning 83/104583/1
Robert Varga [Fri, 24 Feb 2023 19:46:24 +0000 (20:46 +0100)]
Clean up copying warning

Use try-with-resources to eliminate a warning.

Change-Id: I2cdde13ac39185574d51e925fca52629abdf15e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix a warning 82/104582/1
Robert Varga [Fri, 24 Feb 2023 19:44:09 +0000 (20:44 +0100)]
Fix a warning

Use try-with-resources to manage autocloseable state.

Change-Id: Idd23af7c47e065cf1f45fa496f5f065e50b54693
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate testutils to JUnit5 74/104574/1
Robert Varga [Thu, 23 Feb 2023 19:38:10 +0000 (20:38 +0100)]
Migrate testutils to JUnit5

This is mostly an automated conversion. Also moves tests into the same
package as the tested code.

Change-Id: I70c03c40dfef2aa466aa2c6ca723ccd8a502a9eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate mockito-configuration to JUnit5 72/104572/1
Robert Varga [Thu, 23 Feb 2023 19:22:33 +0000 (20:22 +0100)]
Migrate mockito-configuration to JUnit5

Automated (and augmented) rewrite of code.

Change-Id: I83c07b2e51a9c006d2e3fb54b11b6d4eb81cf403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoThrow InvalidNormalizedNodeStreamException on bad entry 77/104477/1
Robert Varga [Wed, 22 Feb 2023 14:41:47 +0000 (15:41 +0100)]
Throw InvalidNormalizedNodeStreamException on bad entry

Remove a source of nulls in Lithium-based inputs, allowing us to
properly annotate returns.

Change-Id: Ifc84ce42f9f35ce4c050f87076b0d346b8dbf79d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up AbstractMagnesiumDataInput 76/104476/1
Robert Varga [Wed, 22 Feb 2023 14:47:10 +0000 (15:47 +0100)]
Clean up AbstractMagnesiumDataInput

Use switch expression for dispatch and annotate @NonNull returns.

Change-Id: I263cd4be713a58b528576c8df4f3520585e16951
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoIntegrate rfc7952-data-api into yang-data-api 47/104447/2
Robert Varga [Sun, 19 Feb 2023 10:54:47 +0000 (11:54 +0100)]
Integrate rfc7952-data-api into yang-data-api

Having a separate component is not really useful and we do want to
provide a unified model for data/metadata and mountpoints. This takes
the first step of integrating the API-level interfaces.

JIRA: YANGTOOLS-1489
Change-Id: I49952adf3ae2a26f09ac3a34e8406ca96d8c23f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove deprecated DataSchemaContextNode elements 61/104461/3
Robert Varga [Tue, 21 Feb 2023 15:42:17 +0000 (16:42 +0100)]
Remove deprecated DataSchemaContextNode elements

The protected constructor, theoretically allowing this class to be
extended has been deprecated for a few releases, as are two static
factory methods. Remove them to allow us to further consider the
hierarchy of this class.

JIRA: YANGTOOLS-1413
Change-Id: I5010aa90ed426bac65d3023e2c64e9e356991e3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove duplicate findCorrespondingAugment() 60/104460/2
Robert Varga [Tue, 21 Feb 2023 14:53:48 +0000 (15:53 +0100)]
Remove duplicate findCorrespondingAugment()

We already have a version of this method in a public place, reuse it
from there.

Change-Id: I5ec6d4004a41d7813ae345730eff154ce3304d45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUse instanceof patterns in CompositeNodeDataWithSchema 59/104459/2
Robert Varga [Tue, 21 Feb 2023 14:50:16 +0000 (15:50 +0100)]
Use instanceof patterns in CompositeNodeDataWithSchema

Reduce the number of explicit casts.

Change-Id: Idd89ac1e59eb479b6b7ed837ff2a665b49b183f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUse instanceof pattern in DataContainerContextNode 58/104458/2
Robert Varga [Tue, 21 Feb 2023 14:47:57 +0000 (15:47 +0100)]
Use instanceof pattern in DataContainerContextNode

Check-and-assign to eliminate a cast.

Change-Id: I4385e7f7499e64dbb90822c1dff5d1995b182dd5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoClean up NormalizedNodeSchemaUtils 57/104457/2
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>
15 months agoUse instanceof patterns in DataSchemaContextNode 56/104456/2
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>
15 months agoClean up AnydataNormalizeContentTest 55/104455/1
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>
15 months agoFix anyData content normalization incl no data case 44/83244/22
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>
15 months agoImprove TreeNode and Version documentation 46/104446/1
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>
15 months agoRemove XmlParserStream exceptions 02/103002/5
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>
15 months agoBump versions to 11.0.0-SNAPSHOT 36/104436/1
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>
15 months agoBump versions to 10.0.5-SNAPSHOT 34/104434/1
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>
15 months agoBump odlaprent to 12.0.3 31/104431/1
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>
15 months agoOptimize ModifierImpl.AbstractPrerequisite 86/104386/4
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>
15 months agoUse a switch expression to get validator 85/104385/1
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>
15 months agoDo do not check unique in unsupported lists 98/104198/5
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>
15 months agoBump versions to 10.0.4-SNAPSHOT 92/104192/1
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>
15 months agoSimplify GeneratorTask(Factory) 81/104181/4
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>
15 months agoDo not access size indirect through body() 09/104109/3
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>
15 months agoFix ReactorStmtCtx.calculateParentRefcount() 18/103918/6
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>
15 months agoSplit calculateParentRefcount() 87/104187/1
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>
15 months agoModernize yang-data-impl 15/104115/2
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>
16 months agoDocument {Config,Status}EffectiveStatement as exceptional 31/104131/2
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>
16 months agoBump odlparent to 12.0.2 41/104141/1
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>
16 months agoTests for YangInstanceIdentifier key value serialization 39/103939/16
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>
16 months agoAdd YangDataName 94/104094/3
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>
16 months agoImprove verify() calls 62/104062/1
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>
16 months agoImprove JSONCodecFactory 38/103938/4
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>
16 months agoModernize AbstractStringInstanceIdentifierCodec 40/103940/3
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>
16 months agoAllow unqualified node-identifiers in instance-identifier 49/98249/25
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>
16 months agoCorrect instance-identifier escaping 10/103910/7
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>
16 months agoForce instanceIdentifier to consume all input 15/103915/2
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>
16 months agoFix InstanceIdentifierParser's lexer 14/103914/2
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>
16 months agoGuarantee LocationPath.Absolute from implementation 13/103913/1
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>
16 months agoModernize XPathParserTest 12/103912/1
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>
16 months agoModernize ParseTreeUtils 09/103909/1
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>
16 months agoModernize InstanceIdentifierParser 07/103907/1
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>
16 months agoPort yang-parser-rfc7950 to JUnit 5 29/103729/31
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>
17 months agoImprove Descendant check 28/103728/5
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>
17 months agoDo not suppress 'uses' node effects 55/103555/9
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>
17 months agoFix unique statement argument propagation 54/103554/6
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>
17 months agoClean up IfFeatureResolution test a bit 27/103727/1
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>
17 months agoModernize UsesStatementSupport a bit 26/103726/1
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>
17 months agoMigrate yang-model-export to JUnit5 62/103662/1
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>
17 months agoBump versions to 10.0.3-SNAPSHOT 67/103567/1
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>
17 months agoAdd pipeline for staging jobs 87/102087/25
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>
17 months agobuild validator from maven or get it from args 71/103471/2
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>
17 months agospeed up CSIT testing with updated yang path option 40/103440/2
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>
17 months agoAdd sized Builders methods 15/103315/5
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>
17 months agoUse an instanceof pattern 51/103551/2
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>
17 months agoDo not ignore passed-in path 43/103543/1
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)

18 months agoRemove MojoFailureException declaration 18/103418/1
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>
18 months agoFix another mergeable if statement 17/103417/1
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>