yangtools.git
13 months agoDisconnect DataSchemaContextNode from Identifiable 82/106082/3
Robert Varga [Sat, 20 May 2023 18:46:00 +0000 (20:46 +0200)]
Disconnect DataSchemaContextNode from Identifiable

Split out getIdentifier() into an explicit pathArgument() method, so
that we can hunt down and migrate user.

JIRA: YANGTOOLS-1463
Change-Id: Ibf823e7a783b166fefa1607b0d82dd191978d9eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoUse DataSchemaNode's QName 80/106080/3
Robert Varga [Sat, 20 May 2023 18:38:43 +0000 (20:38 +0200)]
Use DataSchemaNode's QName

Now that we always have a DataSchemaNode in DataSchemaContextNode, we
can ditch indirection through PathArgument.getType().

Change-Id: Ibdccd7168ecdf4190a39c5ce14554beeafdd0d61
JIRA: YANGTOOLS-568
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoClean up DataSchemaContextNode a bit 79/106079/3
Robert Varga [Sat, 20 May 2023 17:00:54 +0000 (19:00 +0200)]
Clean up DataSchemaContextNode a bit

Now that we do not have AugmentationContextNode, we know the
dataSchemaNode is non-null. Lock that down and also address a few other
FIXMEs.

JIRA: YANGTOOLS-568
Change-Id: Ie2fc089c971eb9a0f6830aa4657b2ff478731888
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoLock down AbstractNodeDataWithSchema 78/106078/3
Robert Varga [Sat, 20 May 2023 16:45:45 +0000 (18:45 +0200)]
Lock down AbstractNodeDataWithSchema

We are about to reign in NodeDataWithSchema. Lock down the hierarchy and
instantiation points.

Change-Id: Ia1f2b11b760293ff811ffd1657447f2d25f42dbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove NormalizedNodeSchemaUtils.findCorrespondingAugment() 77/106077/1
Robert Varga [Sat, 20 May 2023 15:02:17 +0000 (17:02 +0200)]
Remove NormalizedNodeSchemaUtils.findCorrespondingAugment()

We do not have augmentations anymore, hence we should not care about the
placement of nodes in augmentations.

JIRA: YANGTOOLS-568
Change-Id: Idd36024255d7745d09983cbc15a25f7c08e27cac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoIntroduce AnnotationName 75/106075/3
Robert Varga [Sat, 20 May 2023 12:48:55 +0000 (14:48 +0200)]
Introduce AnnotationName

We have data-facing construct names captured in yang-common, do the same
for RFC7952 annotations, introducing AnnotationName.

Change-Id: Iaedd0a8c76edf5f3927bd5d4d56723dd47a84d1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMigrate RFC references to rfc-editor.org 72/106072/2
Robert Varga [Sat, 20 May 2023 12:17:19 +0000 (14:17 +0200)]
Migrate RFC references to rfc-editor.org

Mass-migrate references to rfc-editor.org, which is the new place where
RFCs live.

Change-Id: Idd4288f3e6381dbcfaa7527de48c246ec5d55efb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoFix getDeclared() nullness warning 74/106074/2
Robert Varga [Sat, 20 May 2023 12:57:22 +0000 (14:57 +0200)]
Fix getDeclared() nullness warning

We are promising non-null, make sure we carry that annotation.

Change-Id: I48767119da236aee708f99fecf11de11a9632123
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDocument MountPointLabel 73/106073/2
Robert Varga [Sat, 20 May 2023 12:30:14 +0000 (14:30 +0200)]
Document MountPointLabel

Add a reference to the specification this class models.

Change-Id: Iae736e05c835c216d343c7e93809d186e698abf8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMove MountPointLabel to yang-common 70/106070/3
Robert Varga [Sat, 20 May 2023 10:45:50 +0000 (12:45 +0200)]
Move MountPointLabel to yang-common

We have YangDataName in yang-common, MountPointLabel is very similar.
Co-locate them for sharing.

Change-Id: I4e3747f5ee4b0dd68f3f83dbb9df58e165313383
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoYangDataName should be a WritableObject 71/106071/1
Robert Varga [Sat, 20 May 2023 10:59:59 +0000 (12:59 +0200)]
YangDataName should be a WritableObject

We want to be able to serialize these efficiently, make sure it is a
WritableIdentifier. Also improve intern() logic.

Change-Id: I5d052970e7258c8bf142d242f32b2adb6d203bc4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoFix openconfig-parser-support dependencies 69/106069/1
Robert Varga [Sat, 20 May 2023 10:32:28 +0000 (12:32 +0200)]
Fix openconfig-parser-support dependencies

We are using concepts here, fix that up.

Change-Id: Ib281ababf0aa80d6b4ac074e711ca3a32f519b4a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove unneeded dependencies 68/106068/1
Robert Varga [Sat, 20 May 2023 10:30:03 +0000 (12:30 +0200)]
Remove unneeded dependencies

We are not using concepts in model extensions. remove them.

Change-Id: I0238406683c1080fa0ef745138f896bfe91e49d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoOptimize MandatoryLeafEnforcer footprint 62/106062/6
Robert Varga [Thu, 18 May 2023 22:28:55 +0000 (00:28 +0200)]
Optimize MandatoryLeafEnforcer footprint

Instead of using internal YangInstanceIdentifiers, which have overhead,
keep simple ImmutableList<PathArgument> -- and wire to a more direct
alternative of findNode().

Change-Id: Icfdf5424a1478db0b45515f43df8406ae7527c3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoModernize YangInstanceIdentifier 63/106063/7
Robert Varga [Fri, 19 May 2023 00:32:55 +0000 (02:32 +0200)]
Modernize YangInstanceIdentifier

Ever since we ditched eager hashCode computation we can do much better
in terms of outside interface. Introduce of()  methods as replacements
for create() with much better flexibility.

Change-Id: Ie6a431deaca0a80b8ce1d16dad5a1b919c94f722
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove MandatoryDescendant 61/106061/1
Robert Varga [Thu, 18 May 2023 22:12:02 +0000 (00:12 +0200)]
Remove MandatoryDescendant

We no longer have to deal with augmentations: hence we just need to
keep YangInstanceIdentifiers to descendants.

JIRA: YANGTOOLS-568
Change-Id: Ica2ca74660f5e5a0367bb9f67e3a2550eed9f883
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoFix yang-data-tree-ri dependencies 60/106060/1
Robert Varga [Thu, 18 May 2023 21:59:34 +0000 (23:59 +0200)]
Fix yang-data-tree-ri dependencies

We have a few warnings, fix them up.

Change-Id: I3232911509b6c291b8ba2077b6cac3ea15fa8b93
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoClean up yang-data-codec-xml dependencies 59/106059/1
Robert Varga [Thu, 18 May 2023 21:54:54 +0000 (23:54 +0200)]
Clean up yang-data-codec-xml dependencies

Clean up most of the dependency warnings we have.

Change-Id: I2cdfbb3b67be88731aed05d9dfa1887feed16c19
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoFix yang-data-codec-gson dependencies 58/106058/1
Robert Varga [Thu, 18 May 2023 21:49:34 +0000 (23:49 +0200)]
Fix yang-data-codec-gson dependencies

We have a few warnings about used dependencies, clean them up.

Change-Id: I3f6f5c574ef60bcc5d6c18a9b7617afe5182a5b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoClean up yang-data-util dependencies 57/106057/1
Robert Varga [Thu, 18 May 2023 21:46:43 +0000 (23:46 +0200)]
Clean up yang-data-util dependencies

We use rfc8528-model-api and do not use yang-parser-api. Fix that up.

Change-Id: I7f9d2b625e4ec598df66e9cad7c9d01f3097c101
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoHide ImmutableNormalizedAnydata 56/106056/1
Robert Varga [Thu, 18 May 2023 21:27:10 +0000 (23:27 +0200)]
Hide ImmutableNormalizedAnydata

The two implementations here are extremely simple: hide them behind
(Metadata)NormalizedAnydata.of() static factory method.

Change-Id: I383b4eac35b96c75d7c0001c508a747a9456087f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMove NormalizedMetadataWriter to yang-data-api 55/106055/1
Robert Varga [Thu, 18 May 2023 21:08:08 +0000 (23:08 +0200)]
Move NormalizedMetadataWriter to yang-data-api

As noted in the FIXME, move this class along with the decorator
to yang-data-api.

JIRA: YANGTOOLS-1489
Change-Id: I8cd05221457bbfd2e1674eb5812c95f575b5e325
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMove /ImmutableNormalizedMountPoint(s) 54/106054/1
Robert Varga [Thu, 18 May 2023 21:01:16 +0000 (23:01 +0200)]
Move /ImmutableNormalizedMountPoint(s)

These are immutable implementations, move them to yang-data-impl.

Change-Id: If6930c73252f2d21b74ee8da245d5cb38e054149
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRename ImmutableNormalizedMetadataStreamWriter 53/106053/1
Robert Varga [Thu, 18 May 2023 20:55:05 +0000 (22:55 +0200)]
Rename ImmutableNormalizedMetadataStreamWriter

This is just an extension implementation. Rename it to
ImmutableMetadataExtension and move it to yang-data-impl -- pulling
ImmutableNormalizedMetadata with it.

Change-Id: Ib04fa21edf36147b06de64099cb09953ef0d35e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoNormalizedMetadata is not Identifiable 52/106052/1
Robert Varga [Thu, 18 May 2023 20:42:21 +0000 (22:42 +0200)]
NormalizedMetadata is not Identifiable

We are going for a place where the root node, and hence the top-level
NormalizedMetadata is does not have a PathArgument. Eliminate the idea
that there is a getIdentifier(), reflecting the design of
NormalizedMountpoints back.

JIRA: NETCONF-1472
Change-Id: I5bab85a933bf3bc4d63d41db081c9399d3e13894
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoAdd NormalizedYangData 46/106046/6
Robert Varga [Thu, 18 May 2023 17:12:31 +0000 (19:12 +0200)]
Add NormalizedYangData

RFC8040 yang-data extension is unlike any other piece of data we
normalize, as it has its own identifier -- which does not match
UnresolvedQName.Unqualified, but rather is captured in YangDataName.

This forms the first such piece of data, but realistically we have a
number of others -- like datastore root, RPC input, RPC output,
notification -- all of which are now overloaded to ContainerNode.

For now introduce NormalizedData as the construct above NormalizedNode,
which does not imply a PathArgument being present -- i.e. pulling
contract(), name() and body() from NormalizedNode.

Add NormalizedYangData, which has its own contract and has a single
DataContainerChild as its body.

JIRA: YANGTOOLS-1472
Change-Id: I7ba989b181ac1bdab8117053233c58f5d40a084f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoImprove type safety of AbstractImmutableDataContainerNode 50/106050/1
Robert Varga [Thu, 18 May 2023 19:49:03 +0000 (21:49 +0200)]
Improve type safety of AbstractImmutableDataContainerNode

Now that DataContainerNode's children are only keyed by NodeIdentifier,
we can improve type safety of our maps -- removing the need for a
verify.

JIRA: YANGTOOLS-1511
Change-Id: I9ea336c52f78c1ac8d73f9bee104bffc13d7d317
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDisconnect NormalizedNode from Identifiable 47/106047/4
Robert Varga [Thu, 18 May 2023 18:48:59 +0000 (20:48 +0200)]
Disconnect NormalizedNode from Identifiable

getIdentifier() is a mouthful and we will be introducing a superclass
above NormalizedNode, which will use plain Identifier. This renders
the entire Identifiable capture moot.

Introduce NormalizedNode.name(), which returns the same thing, removing
dependency on Identifiable, but still keeping getIdentifier() as a
deprecated method.

JIRA: YANGTOOLS-1472
Change-Id: I5a1f8ca5150c105775dccbf1c21ee9da6908bc10
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoYangInstanceIdentifier.PathArgument is an identifier 49/106049/1
Robert Varga [Thu, 18 May 2023 18:45:29 +0000 (20:45 +0200)]
YangInstanceIdentifier.PathArgument is an identifier

This class is Immutable and Serializable, plus overrides
hashCode()/equals()/toString() and it is used as an argument to
Identifiable in NormalizedNode.

It should properly implement concepts.Identifier, forming a proper
component of a HierarchicalIdentifier.

JIRA: YANGTOOLS-1472
Change-Id: I5481a969f44bb5d3cdd1ae1d024b40616ccc6a66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoFix yang-data-api dependencies 48/106048/1
Robert Varga [Thu, 18 May 2023 18:35:54 +0000 (20:35 +0200)]
Fix yang-data-api dependencies

We only require yang-model-spi, not yang-model-util.

Change-Id: Ifebcd5e73bbdf71e51297a51c36b98453f58fd24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDeprecate MixinNode for removal 45/106045/2
Robert Varga [Thu, 18 May 2023 17:00:15 +0000 (19:00 +0200)]
Deprecate MixinNode for removal

MixinNode has strong ties to XML encoding. Seal it to enumerate exactly
which end-user contract it matches and deprecate it for removal.

JIRA: YANGTOOLS-1512
Change-Id: Ib9f6a98ffc10aba6216134ed59e5ee35bdd94607
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoSeal OrderedNodeContainer 44/106044/1
Robert Varga [Thu, 18 May 2023 16:46:29 +0000 (18:46 +0200)]
Seal OrderedNodeContainer

OrderedNodeContainer should only be implemented with the three
specializations we already have. Previous sealing of DataContainerChild
allows us to also seal OrderedNodeContainer.

JIRA: YANGTOOLS-1511
Change-Id: Ic214f6c42dc3c57be509c528ced9dfd87a18a0d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoSeal DataContainerChild 43/106043/1
Robert Varga [Thu, 18 May 2023 16:39:23 +0000 (18:39 +0200)]
Seal DataContainerChild

Only a small set of interfaces is allowed to implement
DataContainerChild, make sure we seal the hierarchy.

JIRA: YANGTOOLS-1511
Change-Id: I188ba92ef10624970920798d91f5fa98aee6e02b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDataContainerChild is identified by NodeIdentifier 42/106042/2
Robert Varga [Thu, 18 May 2023 16:12:12 +0000 (18:12 +0200)]
DataContainerChild is identified by NodeIdentifier

With AugmentationNode/MountPointNode gone, it is clear that all
DataContainerChild interfaces are identified by NodeIdentifier. Codify
that in DataContainerChild and adjust DataContainerNode specialization
accordingly.

JIRA: YANGTOOLS-1511
Change-Id: Ide80a1e84cf7851f94fe5d71c43865922bb9d9ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoEliminate AbstractPathArgument 29/106029/2
Robert Varga [Thu, 18 May 2023 10:03:22 +0000 (12:03 +0200)]
Eliminate AbstractPathArgument

We have sealed PathArgument, which makes it obvious we can just combine
it with AbstractPathArgument. Combine the two, making the class
hierarchy more transparent.

Change-Id: Id7befcd7f11bbd7ab6f27224cc58e7b029d33063
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoClean up PotassiumNode 28/106028/2
Robert Varga [Thu, 18 May 2023 09:32:53 +0000 (11:32 +0200)]
Clean up PotassiumNode

The node constants are not accurate -- sort them with anyxml being
the highest currently-defined constant. This leaves us three more
values available.

JIRA: YANGTOOLS-568
Change-Id: I622b2bbb49ee3a6269e6183dc438283be4c935b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoImprove PotassiumPathArgument encoding 27/106027/2
Robert Varga [Thu, 18 May 2023 09:12:23 +0000 (11:12 +0200)]
Improve PotassiumPathArgument encoding

As it turns out we have only three different PathArgument types, which
means we can shift one bit towards encoding of size. This allows us to
encode up to 12 path arguments directly.

JIRA: YANGTOOLS-568
Change-Id: Ic3cd1c4e349e5f2d3c2e66a069ab5b0033c16d5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoClean up Potassium{Node,PathArgument} a bit 26/106026/2
Robert Varga [Thu, 18 May 2023 09:00:08 +0000 (11:00 +0200)]
Clean up Potassium{Node,PathArgument} a bit

Potassium does not have AugmentationIdentifier nor MountPointIdentifier.
Remove these constants and all their users. Also ensure we split the
readLegacyPathArgument implementations.

JIRA: YANGTOOLS-568
Change-Id: I8e743b248723aec77a5e01c3523a41ac8d86dcf4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoImprove Decimal64 coding 25/106025/2
Robert Varga [Thu, 18 May 2023 08:42:26 +0000 (10:42 +0200)]
Improve Decimal64 coding

We are defining the Potassium output format, make sure we do not use
Strings to encode Decimal64, just plain binary -- up to 9 bytes.

JIRA: YANGTOOLS-568
Change-Id: If0f42d0b16594fd3ed6703277d41e547ef197302
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDefine Potassium{Node,PathArgument,Value} 24/106024/2
Robert Varga [Thu, 18 May 2023 08:32:55 +0000 (10:32 +0200)]
Define Potassium{Node,PathArgument,Value}

Before we further evolve the serialization format, make sure we have
a stable reference forked from Magnesium tokens.

JIRA: YANGTOOLS-568
Change-Id: I2e1c76f13becfdb6f40c965b8a4edefac51ae2eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDefine NormalizedNodeStreamVersion.POTASSIUM 86/104486/15
Robert Varga [Thu, 18 May 2023 08:17:51 +0000 (10:17 +0200)]
Define NormalizedNodeStreamVersion.POTASSIUM

With the demise of AugmentationIdentifier we can no longer restore
previous NormalizedNode, as we just do not have the prerequisite
information.

This patch defines a new stream version, essentially the same as
Magnesium. This format will be further evolved.

JIRA: YANGTOOLS-568
Change-Id: Ibb81fb2980c156e61d9535017cc4fae65a10fbb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove Augmentation{Identifier,Node} 08/102908/26
Robert Varga [Thu, 27 Oct 2022 21:25:28 +0000 (23:25 +0200)]
Remove Augmentation{Identifier,Node}

These two are an ugly leak from binding world into yang.data.api. Purge
them with fire. The only remnants are in yang-data-codec-binfmt, which
now defines a LegacyAugmentationIdentifier utility to expose the legacy
format to end users.

JIRA: YANGTOOLS-568
Change-Id: Ib3b9182253ec7d42598b6a174a67c48191d9ed5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoEliminate AbstractMagnesiumDataOutput 23/106023/1
Robert Varga [Thu, 18 May 2023 08:03:10 +0000 (10:03 +0200)]
Eliminate AbstractMagnesiumDataOutput

We only support Magnesium output rendering the superclass moot.

JIRA: YANGTOOLS-568
Change-Id: I3b5c79bcbeb2bf5330d39c60dd4ad1de81a51629
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRename NormalizedTree to NormalizedTuple 20/106020/1
Robert Varga [Thu, 18 May 2023 06:35:25 +0000 (08:35 +0200)]
Rename NormalizedTree to NormalizedTuple

'NormalizedTree' has more implications than we would like. Also the
layout lends itself of any level of indirection, so let's just call it a
NormalizedTuple.

JIRA: YANGTOOLS-1172
Change-Id: I6680154ace0d8d56fc5bcd2368405e20792bf8dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoEliminate rfc8528-data-util 18/106018/2
Robert Varga [Wed, 17 May 2023 17:49:06 +0000 (19:49 +0200)]
Eliminate rfc8528-data-util

Move the remaining classes to yang-data-util, completing the baseline
integration.

JIRA: YANGTOOLS-1172
Change-Id: I946b41a6ff200576578cce25386646433e2e8a8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMove MountPointNormalizedNodeWriter 17/106017/2
Robert Varga [Wed, 17 May 2023 17:28:20 +0000 (19:28 +0200)]
Move MountPointNormalizedNodeWriter

Mount points are inherently integrated into NormalizedNodeWriter,
co-locate it with its baseline interface.

JIRA: YANGTOOLS-1172
Change-Id: I0c99bcde7c9ec086b9b01987b17ea4206680a5fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDocument NormalizedTree 16/106016/2
Robert Varga [Wed, 17 May 2023 17:13:52 +0000 (19:13 +0200)]
Document NormalizedTree

This interface lacks javadocs, add rudimentary documentation.

JIRA: YANGTOOLS-1172
Change-Id: Ib5fec7455ab447762263d0e7069433026987e1b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove MountPointIdentifier 15/106015/3
Robert Varga [Wed, 17 May 2023 16:17:45 +0000 (18:17 +0200)]
Remove MountPointIdentifier

Remove MountPointIdentifier as the last remnant of rfc8528-data-api.
This forces an adjustment to yang-data-codec-binfmt, which can no longer
read this PathArgument.

It also allows us to seal YangInstanceIdentifier.PathArgument, not
allowing any external implementations of it.

JIRA: YANGTOOLS-1172
Change-Id: Ibdbb5d2eb9d63f3d0e8a95065e8124ce6818a7af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agocreateTestContainer() can be static 14/106014/1
Robert Varga [Wed, 17 May 2023 16:39:38 +0000 (18:39 +0200)]
createTestContainer() can be static

This is minor note from Eclipse, fix iit.

Change-Id: Ia96b1ccf2ea6d7c605b2f1e62660521c23055f68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoEliminate MountPointNode 08/106008/5
Robert Varga [Tue, 16 May 2023 23:36:25 +0000 (01:36 +0200)]
Eliminate MountPointNode

Switch mount points from being in-line to being out-of-line just as
NormalizedMetadata is. This allows users to explicitly manage the
lifecycle -- preventing accidental leaks to NormalizedNode hierarchy.

This introduces NormalizedTree as a top-level construct, which holds
NormalizedNode, NormalizedMetadata and NormalizedMountpoints.

JIRA: YANGTOOLS-1172
Change-Id: I523afc166c5532be8db928a3b3288cac266ed3e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoReduce MountPointIdentifier proliferation 11/106011/1
Robert Varga [Wed, 17 May 2023 11:34:31 +0000 (13:34 +0200)]
Reduce MountPointIdentifier proliferation

Use MountPointLabel instead of MountPointIdentifier.

JIRA: YANGTOOLS-1172
Change-Id: I1f63053815cedb2cb781f206ff63f815ce56f478
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoSeal ImmutableNormalizedMetadata 07/106007/3
Robert Varga [Tue, 16 May 2023 23:27:12 +0000 (01:27 +0200)]
Seal ImmutableNormalizedMetadata

We have a single subclass, prevent other subclasses from barging in.
Also remove @Beta.

Change-Id: Ic4ce8883f2db4f02afc64ea04a3d8a6058d49e10
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRework ExtensibleObject interface 06/106006/6
Robert Varga [Tue, 16 May 2023 22:38:58 +0000 (00:38 +0200)]
Rework ExtensibleObject interface

Exposing a simple ClassToInstanceMap() ends up being ugly from caller
perspective. Exposing simple access/enumerator methods has much better
ergonomics.

JIRA: YANGTOOLS-1509
Change-Id: I643e48ee2dabec251357fafe98d5376dc20d09c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRename NormalizedNodeStreamWriterExtension 05/106005/6
Robert Varga [Tue, 16 May 2023 22:01:55 +0000 (00:01 +0200)]
Rename NormalizedNodeStreamWriterExtension

Centralize the extension model in NormalizedNodeStreamWriter, shortening
names of the interfaces/classes involved. This also makes extensions
much more discoverable -- and we only have two of them :)

JIRA: YANGTOOLS-1172
Change-Id: Ie30f07e4fa618b162b38ca70652930112fcdc3cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoAdd NormalizationResult 03/106003/5
Robert Varga [Tue, 16 May 2023 19:12:49 +0000 (21:12 +0200)]
Add NormalizationResult

So far we have had only two possible results: NormalizedNode and
NormalizedMetadata. RFC8528 mount points have hidden in the
NormalizedNode hierarchy -- and we want to change that.

Doing a straighforward extension would end up stepping towards
combinatoric explosion: NormalizedNodeResult and
NormalizedNodeMetadataResult are the effect of two components, one of
which is mandatory. Adding MountPoints would result in four
combinations: data, data+metadata, data+mount, data_metadata+mount.

Rather than going that route, explicitly acknowledge we have multiple
components and concentrate them in NormalizationResult, which at this
point combines NormalizedNode and NormalizedMetadata.

On the receiver side we end up havingNormalizationResultHolder, for the
lack of a more imaginative name.

JIRA: YANGTOOLS-1172
Change-Id: Ib9866fee5223a1eb450e5d40d54d4472bae9adda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoAdd MountPointContext.of(EffectiveModelContext) 01/106001/7
Robert Varga [Tue, 16 May 2023 18:34:15 +0000 (20:34 +0200)]
Add MountPointContext.of(EffectiveModelContext)

Rather than having a dedicated public class for the common case,
introduce a static of() method, which hides the implementation.

JIRA: YANGTOOLS-1172
Change-Id: Ib82d078c599f09f31de650aae0c096044c70847c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoEliminate YangLibraryConstants 99/105999/9
Robert Varga [Tue, 16 May 2023 17:28:55 +0000 (19:28 +0200)]
Eliminate YangLibraryConstants

RFC7950 implies integration with at least RFC7895, hence
ietf-yang-library constants are a fair game in YangConstants. Expand the
number of constants we keep and adjust users.

JIRA: YANGTOOLS-1172
Change-Id: Id32a8621b4bac8725239e3cb4d3046e3ddb06565
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMountPointStatement should operate on MountPointLabel 96/105996/9
Robert Varga [Tue, 16 May 2023 16:55:41 +0000 (18:55 +0200)]
MountPointStatement should operate on MountPointLabel

Having an opaque QName is not exactly friendly, make sure we operate on
MountPointLabel, so it can be directly picked up.

JIRA: YANGTOOLS-1172
Change-Id: I1713c76b9919200d18b3390f085d68d9b12e4354
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoFix checkState() string 02/106002/2
Robert Varga [Tue, 16 May 2023 18:54:54 +0000 (20:54 +0200)]
Fix checkState() string

Placeholders should be %s, not {}.

Change-Id: I1e2879be989397590cee13d3905e3f1b27302c7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoStreamWriterMountPointExtension operates on MountPointLabel 95/105995/9
Robert Varga [Tue, 16 May 2023 16:41:09 +0000 (18:41 +0200)]
StreamWriterMountPointExtension operates on MountPointLabel

Disconnect stream support from MountPointIdentifier, so that we can move
it and evolve it.

JIRA: YANGTOOLS-1172
Change-Id: I7f6a190575bf4477795c1cc079091d644f966310
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMove MountPoint{Child,Context,ContextFactory} 94/105994/6
Robert Varga [Tue, 16 May 2023 16:27:43 +0000 (18:27 +0200)]
Move MountPoint{Child,Context,ContextFactory}

This makes a step towards re-integrating mount points by explicitly
making them know in yang-data-api. Also removes the dependency on
yang-parser-api by adding a dedicated checked exception.

JIRA: YANGTOOLS-1172
Change-Id: I5c6fa5b86d76e7fe4d3e13e1a76e70eb2f1b6177
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoTrim internal whitespace 00/106000/2
Robert Varga [Tue, 16 May 2023 17:41:34 +0000 (19:41 +0200)]
Trim internal whitespace

We have an offset of 8, we can just use 4.

Change-Id: I8d4758e8c22812bdda4415deef2d92c4e78505a4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove RFC7950_YANG_LIBRARY_CAPABILITY 98/105998/3
Robert Varga [Tue, 16 May 2023 17:17:48 +0000 (19:17 +0200)]
Remove RFC7950_YANG_LIBRARY_CAPABILITY

This constant is not used anywhere, remove it.

Change-Id: I601cddd63a34c5e20687a271c3053500af4e6c04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoDeprecate YangConstants.RFC7950_YANG_LIBRARY_CAPABILITY 97/105997/3
Robert Varga [Tue, 16 May 2023 17:15:45 +0000 (19:15 +0200)]
Deprecate YangConstants.RFC7950_YANG_LIBRARY_CAPABILITY

This capability, in proper String format is hosted in the NETCONF
project, which is its proper place. Deprecate the constatnt for removal.

Change-Id: Ibfd87395354f8a88d5e4a25229a65564530d826d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoSplit out MountPointLabel 93/105993/2
Robert Varga [Tue, 16 May 2023 15:57:29 +0000 (17:57 +0200)]
Split out MountPointLabel

MountPointIdentifier is quite heavy-handed in its tie-in with
PathArgument. Introduce a much simpler MountPointLabel, and update
MountPointContext/MountPointDefinition to operate on it.

JIRA: YANGTOOLS-1172
Change-Id: I3a9067c1cb4650dc0dcddcaee53d02d0307d1f0d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoSprinkle MPIv1 with java.io.Serial 92/105992/1
Robert Varga [Tue, 16 May 2023 15:04:03 +0000 (17:04 +0200)]
Sprinkle MPIv1 with java.io.Serial

This is a serialization proxy, make sure we annotate
serialization-related fields/methods.

JIRA: YANGTOOLS-1172
Change-Id: Ie794604b8b120176ae0291c30710c278ab995ee4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoSimplify YangLibraryConstants.ContainerName 91/105991/1
Robert Varga [Tue, 16 May 2023 15:02:13 +0000 (17:02 +0200)]
Simplify YangLibraryConstants.ContainerName

Use a switch expression instead of map lookup. Also use @Nullable return
to make users simpler.

JIRA: YANGTOOLS-1172
Change-Id: I7cda0c1b1eaa528ef2614eb0e8e1803b0ccb5839
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoAdd NormalizedNodeDataInput.readLegacyIdentifier() 79/104479/15
Robert Varga [Wed, 22 Feb 2023 14:51:28 +0000 (15:51 +0100)]
Add NormalizedNodeDataInput.readLegacyIdentifier()

This is a migration method for users for readPathArgument(), which
has an indication of the fact that the identifier would have been an
AugmentationIdentifier or a MountPointIdentifier.

JIRA: YANGTOOLS-568
Change-Id: I4f6e68d5decde9d57da9f0431d87e0d8db80a0d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoSimplify MandatoryLeafEnforcer instantiation 73/105973/4
Robert Varga [Mon, 15 May 2023 21:14:45 +0000 (23:14 +0200)]
Simplify MandatoryLeafEnforcer instantiation

Use @Nullable return instead of optional, reducing some verbosity.

Change-Id: Iaa9e68a35be4006bff92db413ccf2174988d5fca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoClean up yang-maven-plugin dependencies 58/105958/1
Robert Varga [Mon, 15 May 2023 17:58:35 +0000 (19:58 +0200)]
Clean up yang-maven-plugin dependencies

We have quite a few warnings here -- make sure we clean them up.
Most notably yang-parser-impl is a scope=runtime dependency.

Change-Id: I44b5e8c8f79709c3fadffcbdfc42f665d29bb8c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoConvert plugin-generator-api to bnd-parent 57/105957/1
Robert Varga [Mon, 15 May 2023 17:49:17 +0000 (19:49 +0200)]
Convert plugin-generator-api to bnd-parent

This is a very simple component, convert it to use bnd-parent instead of
bundle-parent.

Change-Id: I53dcc7839ee84e6ce3a06ecdab6029f988e22a59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoConvert dependency checking to aether 56/105956/2
Robert Varga [Mon, 15 May 2023 16:44:12 +0000 (18:44 +0200)]
Convert dependency checking to aether

maven-3.9.1 warns when we are using the RepositorySystem. Convert type
checks and remove the mocked test. This allows us to hide the
checkClasspath() method and use injected values. Also inline
getPluginTransitiveDependencies(), as it is now a single-caller thing.

JIRA: YANGTOOLS-1505
Change-Id: I9585774047b99fac557b6b92f5d51eaacfdd0af3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove YangToSourcesMojo.remoteRepos 54/105954/1
Robert Varga [Mon, 15 May 2023 15:52:09 +0000 (17:52 +0200)]
Remove YangToSourcesMojo.remoteRepos

This is a shorthand and the only user already has project handy.

Change-Id: I1fd6e98c9b781f30a978dc194aacaaa25deec498
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoMove yang.skip property 33/105933/1
Robert Varga [Sat, 13 May 2023 18:33:20 +0000 (20:33 +0200)]
Move yang.skip property

Clean up order of user-visible properties vs. components.

Change-Id: I73f019f98a669b65b411af26681dc98390dc2c40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoRemove YangToSourcesMojo.parserMode 27/105927/1
Robert Varga [Sat, 13 May 2023 17:16:06 +0000 (19:16 +0200)]
Remove YangToSourcesMojo.parserMode

The parser mode is picked up from the code generators now, remove it.

Change-Id: I9ef0c93c7a7e78c5b1b04459b56257a173eea83a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoEnrich YangParserTestUtils with parseYang(String) 41/105541/7
matus.matok [Thu, 20 Apr 2023 10:13:56 +0000 (12:13 +0200)]
Enrich YangParserTestUtils with parseYang(String)

Added a new static method parseYang() to YangParserTestUtils which allows for
parsing a yang file directly from s string input. This allows for higher
flexibility as we do not need to deal with resource accessibility across
modules. Additionally, it is sometimes more convenient to prefer this new form
of input rather than the old one.

JIRA: YANGTOOLS-1483
Change-Id: I4865b73ba8770669a54dd5be167b2ca2d63f3585
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 months agoAdd ImmediateYangTextSchemaSource 02/105802/3
Robert Varga [Wed, 3 May 2023 01:36:25 +0000 (03:36 +0200)]
Add ImmediateYangTextSchemaSource

Add ImmediateYangTextSchemaSource, which has the backing bytes readily
available. This is open for extension, making it useable in the context
of NETCONF's CachedYangTextSchemaSource.

While we are at it, we clean up how addToStringAttributes() works,
making it optional to implement it.

JIRA: YANGTOOLS-1507
Change-Id: I8a97549993a276bb419383a0d9b3eea031866d64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoAdd explicit test for getChildArg() 45/105645/2
Robert Varga [Mon, 24 Apr 2023 11:04:00 +0000 (13:04 +0200)]
Add explicit test for getChildArg()

Make sure the method is tested to assert.

Change-Id: I3e0c3abf4b48e70fce63dd42647b4718cdcea77f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove DistinctNodeContainer.getChildByArg() 08/105608/1
Robert Varga [Sun, 23 Apr 2023 06:51:50 +0000 (08:51 +0200)]
Improve DistinctNodeContainer.getChildByArg()

Improve the reported exception to include the key that was being looked
up.

Change-Id: Ica2885543d5d2c68fd84db54c57948f468f8fa2e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoBump odlparent to 12.0.5 38/105538/1
Robert Varga [Thu, 20 Apr 2023 07:37:36 +0000 (09:37 +0200)]
Bump odlparent to 12.0.5

Pick up a regression fix and a few updates.

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

14 months agoConvert yang-common-netty to bnd-parent 14/105514/4
Robert Varga [Wed, 19 Apr 2023 15:59:06 +0000 (17:59 +0200)]
Convert yang-common-netty to bnd-parent

This is a very simple bundle, convert it with minimal effort. Also adds
a package-info.

Change-Id: I2ca24a65fbed72c534d2d2f28eca327453d3173f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoFix yang-common-netty module warnings 13/105513/4
Robert Varga [Wed, 19 Apr 2023 16:05:30 +0000 (18:05 +0200)]
Fix yang-common-netty module warnings

Explicitly require netty-common and document the module.

Change-Id: I08c4762b12be7b65ce7d0088c8e842165bfb4c9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up warnings in concepts 18/105518/1
Robert Varga [Wed, 19 Apr 2023 18:05:22 +0000 (20:05 +0200)]
Clean up warnings in concepts

Fix a javadoc typo, document module-info and require checker-qual
transitively.

Change-Id: I76bf827437ca60500d142ec999dee2782f1ffe8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoPromote FeatureSet 27/105227/14
Robert Varga [Tue, 4 Apr 2023 17:29:20 +0000 (19:29 +0200)]
Promote FeatureSet

We are using only Set.contains() to evaluate feature expressions and we
need more flexibility that that. FeatureSet already provides this
capability, but unfortunately it also implies all the Set semantics.

This patch refactors FeatureSet to be a simple class, without a tie to
Set and updates IfFeatureExpr to integrate with it.

JIRA: YANGTOOLS-1504
Change-Id: Ie719f7a3d006f2d6ed51c70604236e4105d8f8ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoBump odlparent to 12.0.4 52/105352/6
Robert Varga [Tue, 11 Apr 2023 00:26:55 +0000 (02:26 +0200)]
Bump odlparent to 12.0.4

Adopt latest updates from upstream.

Change-Id: I9dcad627cd3c0530add6ec902f5d96a90b8f45a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate users of Optional.get() 51/105351/4
Robert Varga [Sat, 8 Apr 2023 20:28:58 +0000 (22:28 +0200)]
Migrate users of Optional.get()

Optional.orElseThrow() has a more explicit name, preventing potential
confusion with Future.get() and making it clear there might be an
exception coming.

Also take the time to modernize code with local variable type inference,
instanceof patterns and similar.

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

14 months agoRemove LeafRefYangSyntaxErrorException 50/105350/2
Robert Varga [Tue, 11 Apr 2023 00:03:54 +0000 (02:03 +0200)]
Remove LeafRefYangSyntaxErrorException

This exception is not used anywhere, remove it. Also update
LeafRefContextTreeBuilder to use ArrayList.

Change-Id: I89dd0f33c6418b0ce66dd7ecbf9dd7c6c6bcc16c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoUse a Multimap for keyListeners 81/105281/2
Robert Varga [Mon, 10 Apr 2023 23:52:17 +0000 (01:52 +0200)]
Use a Multimap for keyListeners

Fix a long-standing FIXME, which improves performance when there are
listeners for distinct keys. We use ArrayDeque for potentially faster
behaviour.

Change-Id: I71ddad396469a1d3623358269f385c542a2fa941
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSimplify StmtContext generics 39/105339/2
Robert Varga [Mon, 10 Apr 2023 18:47:37 +0000 (20:47 +0200)]
Simplify StmtContext generics

We have generic signatures that hark back to when we used .class
references for namespaces. Simplify them, which makes it clear that
addContext() is just an alias to addToNs() -- and hence can be
eliminated.

Change-Id: I34637bbe913f7e23b615cfb51a7b0b69c14507db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSimplify InferredStatementContext.hasEmptySubstatements() 38/105338/1
Robert Varga [Mon, 10 Apr 2023 18:33:27 +0000 (20:33 +0200)]
Simplify InferredStatementContext.hasEmptySubstatements()

SonarCloud is pointing out a code smell around explicit 'false',
refactor to eliminate it.

Change-Id: I7d6eb0f902d72dcdf616b48f9b02994b7280358c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSprinkle @NonNull annotations 33/105333/2
Robert Varga [Sat, 8 Apr 2023 20:14:38 +0000 (22:14 +0200)]
Sprinkle @NonNull annotations

Contexts should always be non-null, improve a few places where we do not
make that explicit.

Change-Id: Ia11fb8e13f98c3e4c15bf0597b2191cb8553eac2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoUse instanceof pattern 32/105332/1
Robert Varga [Sat, 8 Apr 2023 19:56:30 +0000 (21:56 +0200)]
Use instanceof pattern

This removes an unnecessary cast.

Change-Id: I5fed4dbc753f7691b89fe059cbb4f89cf0fc3600
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoTighten canReuseCurrent() contract 31/105331/2
Robert Varga [Sat, 8 Apr 2023 19:40:26 +0000 (21:40 +0200)]
Tighten canReuseCurrent() contract

The we are passing a List down and that is what substatement semantics
are: adjust the method signature to use List instead of Collection.

Change-Id: Iefa694657b4540f73452f9d492744dac5da25d14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMove substatement ordering to yang-parser-reactor 26/105326/3
Robert Varga [Sat, 8 Apr 2023 17:49:57 +0000 (19:49 +0200)]
Move substatement ordering to yang-parser-reactor

Substatement ordering should be something reactor handles, hence move it
out to make sure StatementFactory does not have to deal with this,
making the API towards StatementFactory more consistent.

Change-Id: I9106e04c22227f054be23cf4ace492ffe416ff98
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoReuse NamespaceAccess where possible 18/105318/2
Robert Varga [Fri, 7 Apr 2023 15:20:47 +0000 (17:20 +0200)]
Reuse NamespaceAccess where possible

We have a few places where we can end up looking up NamespaceAccess for
a second time. Clean those up and also improve NamespaceAccess to expose
the underlying ParserNamespace.

Change-Id: I43e582a3c6db359d1f81819ac0445ac8b33e85bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRefactor globalOrStatementSpecific() 83/105283/1
Robert Varga [Thu, 6 Apr 2023 21:42:52 +0000 (23:42 +0200)]
Refactor globalOrStatementSpecific()

Current implementation elicits a nullness warning, which is not quite
there -- at the cost of verifyNotNull().

If we refactor checks we can actually make it more performant and
transparent. This is advanteous bacause a null parent implies current is
a GLOBAL storage -- and we therefore can just check the storage type for
STATEMENT_LOCAL.

As it turns out we can refactor the loop to make it obvious, in that we
manually check parent storage. This makes the code flow nicer and more
transparent -- there are no IDE-invisible non-null guarantees. A null
parent storage indicates GLOBAL storage, hence we can bail.

A further boon is that we can simplify the StorageType check to only
compare to STATEMENT_LOCAL and

Change-Id: I5a5b7faf312db6de7f1cebe654f18e9785f58bac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRefactor global NamespaceStorage access 82/105282/5
Robert Varga [Thu, 6 Apr 2023 20:43:45 +0000 (22:43 +0200)]
Refactor global NamespaceStorage access

There is only one way we are passing BuildGlobalContext, hence there is
no reason to indirect access through GlobalStorageAccess, as there is
only one implementation of it -- which always has the result handy.

Remove GlobalStorageAccess and introduce GlobalStorage as a
specialization of NamespaceStorage -- and pass that to
NamespaceBehaviour. This also improves coupling a bit, as there is only
a single implementation (as opposed to NamespaceStorage, which has
multiple implementations).

JIRA: YANGTOOLS-1497
Change-Id: Ica03ac855b62541ec5c52ce24044387199c75e9c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove DerivedNamespaceBehaviour 80/105280/5
Robert Varga [Thu, 6 Apr 2023 14:42:35 +0000 (16:42 +0200)]
Remove DerivedNamespaceBehaviour

DerivedNamespaceBehaviour is not used anywhere and is source of quite a
bit of head-scratching. Remove it, which allows is to solidify
NamespaceAccess to a great extent.

JIRA: YANGTOOLS-1502
Change-Id: Iba43d0f627d5df53f18e9ea4de79f0982b62d837
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoShortcut access to global NamespaceStorage 50/94650/15
Robert Varga [Thu, 6 Apr 2023 12:54:28 +0000 (14:54 +0200)]
Shortcut access to global NamespaceStorage

Most of our namespaces are stored in StorageType.GLOBAL. Accessing that
requires walking the NamespaceStorage tree completely towards its root,
which takes a lot of time.

This is highlighted by the fact that yang-parser-reactor already
performs this walk in order to find the actual behaviour, which is
stored in BuildGlobalContext -- which happens to also be the GLOBAL
NamespaceStorage object.

The result of that walk is NamespaceAccess, which is always instantiated
from a place which has immediate access to BuildGlobalContext -- either
it is BuildGlobalContext itself or it is SourceSpecificContext.

This patch introduces NamespaceBehaviour.GlobalStorageAccess, which
allows users to acquire the global NamespaceStorage and modifies
NamespaceBehaviour methods to require an instance of this interface.

NamespaceAccesss is extended to implement GlobalStorageAccess and taught
to pass itself to the backing NamespaceBehaviour.

JIRA: YANGTOOLS-1497
Change-Id: I74ac1a31176e8f3fc33875dff775965d1129391f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRefactor NamespaceBehaviourWithListeners 78/105278/4
Robert Varga [Thu, 6 Apr 2023 09:51:12 +0000 (11:51 +0200)]
Refactor NamespaceBehaviourWithListeners

There is quite a bit of confusion about what NamespaceBehaviour really
means inside yang-parser-reactor. This stems from the fact we actually
subclass NamespaceBehaviour and forward calls to a delegate in
NamespaceBehaviourWithListeners.

Refactor the class hierarchy, by renaming
NamespaceBehaviourWithListeners to NamespaceAccess, introducing explicit
access methods. These are then realized by a dedicated subclass,
BehaviourNamespaceAccess.

This provides a clear separation of concerns, also removing the need
to verify objects in ReactorStmtCtx.

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