yangtools.git
10 days agoHide BindingReflections.getModuleInfo()
Robert Varga [Wed, 21 Jun 2023 11:45:57 +0000 (13:45 +0200)]
Hide BindingReflections.getModuleInfo()

We have a replacement in BindingRuntimeHelpers.getYangModuleInfo(). This
patch migrates users and eliminates getModuleInfo() from public view.

JIRA: MDSAL-781
Change-Id: Ifd1cdbee440e8f14c1f53b2432b3b8cf3a7fc8df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove BindingReflections.getModelRootPackageName()
Robert Varga [Wed, 21 Jun 2023 11:32:58 +0000 (13:32 +0200)]
Remove BindingReflections.getModelRootPackageName()

This method was moved to yang.binding.contract.Naming, remove it.

JIRA: MDSAL-781
Change-Id: I300363accd91908a648cb78294ffc7043f93e812
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove DataObjectReadingUtil
Robert Varga [Wed, 21 Jun 2023 11:18:17 +0000 (13:18 +0200)]
Remove DataObjectReadingUtil

This class has been deprecated for quite some time and has no users.
Remove it.

JIRA: MDSAL-801
Change-Id: I3f29ab770f696f4fa75092ddc0af93d665c004ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdd simple data listeners
Oleksandr Panasiuk [Tue, 28 Mar 2023 09:36:14 +0000 (12:36 +0300)]
Add simple data listeners

DataTreeChangeListener is a rather complex contract, where users
sometimes want to receive only the latest state or the delta of the
state.

Add DataListener, which reports the current value and
DataChangeListener, which reports changes.

JIRA: MDSAL-813
Change-Id: I7db024f76709b9d4afcc0db5cbca3f1d35218e3f
Signed-off-by: Oleksandr Panasiuk <oleksandr.panasiuk@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up mdsal-binding-runtime-spi dependencies
Robert Varga [Tue, 20 Jun 2023 22:23:01 +0000 (00:23 +0200)]
Clean up mdsal-binding-runtime-spi dependencies

We are using JDT annotations, make that explicit.

Change-Id: Ib31a9e7920fdd765a442a9ed778881b8477ac778
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix BindingRuntimeHelper.extractYangModuleInfo()
Robert Varga [Tue, 20 Jun 2023 21:39:16 +0000 (23:39 +0200)]
Fix BindingRuntimeHelper.extractYangModuleInfo()

Previous patch has broken the extraction facility in multi-classloader
environments: when we have a Class, we should be using its ClassLoader,
not TCCL, to locate its sibling.

JIRA: MDSAL-803
Change-Id: Ie3684a6defeaf51c6c98efcf48791b677b2ef2f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up dependencies
Robert Varga [Tue, 20 Jun 2023 12:42:53 +0000 (14:42 +0200)]
Clean up dependencies

We have a ton of warnings, reign some of them in.

Change-Id: I4aa0b3871f9416c09fb17fe5f9325015231ac40a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoEliminate DataObjectSerializerImplementation
Robert Varga [Tue, 20 Jun 2023 10:14:57 +0000 (12:14 +0200)]
Eliminate DataObjectSerializerImplementation

We do not need the intermediate interface and can just have
DataObjectStreamer as the main entrypoint.

Change-Id: I14b01652baf5c0c6bd86ffe3951255717b2bd831
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoHide DataObjectSerializer
Robert Varga [Tue, 20 Jun 2023 10:09:14 +0000 (12:09 +0200)]
Hide DataObjectSerializer

Promote this class to a hidden implementation detail.

Change-Id: Ibf48f98cd9b9175b8a22eca102bbeb6162ccac67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix BindingToNormalizedStreamWriter.enter()
Robert Varga [Tue, 20 Jun 2023 09:46:01 +0000 (11:46 +0200)]
Fix BindingToNormalizedStreamWriter.enter()

We have a blind cast which does not handle augmentations' children. Fix
the cast to work for augmentations as well.

JIRA: MDSAL-820
Change-Id: Ib32a65e475d5d786bcc0d353f5fe044c147e4c07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdd BindingDataObjectCodecTreeParent.getStream{Augmentation,DataObject}
Robert Varga [Tue, 20 Jun 2023 01:08:25 +0000 (03:08 +0200)]
Add BindingDataObjectCodecTreeParent.getStream{Augmentation,DataObject}

When we know we are streaming to a particular type, we can improve the
user experience by returning a friendly interface.

JIRA: MDSAL-820
Change-Id: Iadb85de866a0446934f636bb870e1df5f4c81a4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdd CommonDataObjectCodecTreeNode.stream{Augmentation,DataObject}
Robert Varga [Tue, 20 Jun 2023 01:08:25 +0000 (03:08 +0200)]
Add CommonDataObjectCodecTreeNode.stream{Augmentation,DataObject}

When we know we are streaming to a particular type, we can improve the
user experience by returning a friendly interface.

JIRA: MDSAL-820
Change-Id: I89d8dbed493919a72db7195213c5cf688b9ecb5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRehost BindingReflections.loadModuleInfos()
Oleksandr Panasiuk [Tue, 14 Mar 2023 16:06:33 +0000 (18:06 +0200)]
Rehost BindingReflections.loadModuleInfos()

Use ServiceLoader to locate all module infos instead. This reduces the
proliferation of BindingReflections just a tiny bit.

JIRA: MDSAL-803
Change-Id: I5d76f6c8eddc1d689ebd8fcbe9cbf23350b465cf
Signed-off-by: Oleksandr Panasiuk <oleksandr.panasiuk@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoPromote AbstractBindingLazyContainerNode
Robert Varga [Wed, 14 Jun 2023 19:41:09 +0000 (21:41 +0200)]
Promote AbstractBindingLazyContainerNode

This is a well-proven class, drop the @Beta annotation and clean in up a
bit.

Change-Id: I7d6bd3e4717dd969695c58fe52e71d38911a4a24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove unused dependency
Robert Varga [Wed, 14 Jun 2023 13:33:57 +0000 (15:33 +0200)]
Remove unused dependency

mdsal-binding-spec-util is not used by mdsal-binding-generator, remove
the dependency.

Change-Id: I3ac0264bc32f52ab311c1e1c951293bc49b7a789
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoIntroduce AbstractBaseTemplate
Robert Varga [Sun, 28 May 2023 20:24:49 +0000 (22:24 +0200)]
Introduce AbstractBaseTemplate

Pull down some of the more obvious methods from BaseTemplate to an
abstract class. This improves things by introducing static methods
and having them in Java.

JIRA: MDSAL-562
Change-Id: I1b04477695c7a966e7a829e67d0340c8a551d7f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoHide DataContainerCodecContext.getType()
Robert Varga [Thu, 15 Jun 2023 14:08:37 +0000 (16:08 +0200)]
Hide DataContainerCodecContext.getType()

This method is used only internally, hide it from public view.

Change-Id: Id1700333937155fb5eff6cecca630fcff7c6bced
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoConvert mdsal-binding-runtime-osgi to a JPMS module
Robert Varga [Fri, 16 Jun 2023 09:57:12 +0000 (11:57 +0200)]
Convert mdsal-binding-runtime-osgi to a JPMS module

Ditch Automatic-Module-Name and instead provide a proper module.

JIRA: MDSAL-619
Change-Id: I940072ba15c14a73b918f41c11c80a85e31aa872
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up mdsal-binding-model-api dependencies
Robert Varga [Thu, 15 Jun 2023 13:09:49 +0000 (15:09 +0200)]
Clean up mdsal-binding-model-api dependencies

We are not using yang-common here, fix that up.

Change-Id: I7ebc0e7983710bb870a90d0c6697baf8822d0034
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoExport org.opendaylight.mdsal.binding.dom.codec.impl
Robert Varga [Thu, 15 Jun 2023 08:49:19 +0000 (10:49 +0200)]
Export org.opendaylight.mdsal.binding.dom.codec.impl

As a stop-gap measure, expose the entire top-level artifact. This will
be tied down in later patches.

JIRA: MDSAL-828
Change-Id: I5fb61aa595ee2b66e99f3833cfc6935d8d529ffb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump xtend to 2.31.0
Robert Varga [Wed, 14 Jun 2023 20:53:49 +0000 (22:53 +0200)]
Bump xtend to 2.31.0

https://www.eclipse.org/xtend/releasenotes.html#/releasenotes/2023/05/29/version-2-31-0

Change-Id: Icbb185327e80d55d0b8306ed786ccc2be6f1ef6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRefactor streamChild() methods
Robert Varga [Wed, 14 Jun 2023 22:05:02 +0000 (00:05 +0200)]
Refactor streamChild() methods

We have a tad confusing naming, where the individual methods are
related. Unify naming.

Change-Id: Iba8c725f611308da65761fce9a4249642963901a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up addYangPathArgument()
Robert Varga [Wed, 14 Jun 2023 20:38:45 +0000 (22:38 +0200)]
Clean up addYangPathArgument()

The nullability is confused here. Make sure we separate the two
invocation paths, so that we check builder for non-null as few times as
practicable.

Change-Id: Iceafa279fb3b69ffdaa54d4250ecf370edaa2622
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRename AugmentatioNodeContext
Robert Varga [Wed, 14 Jun 2023 19:54:08 +0000 (21:54 +0200)]
Rename AugmentatioNodeContext

The 'Node' word does not really tell us much. Rename to
AugmentationCodecContext.

JIRA: MDSAL-828
Change-Id: Ib2e0487cfda365570bf01e9bcd474a59c8bc42d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix code generation with leafrefs pointing to optional members
Robert Varga [Tue, 13 Jun 2023 14:57:25 +0000 (16:57 +0200)]
Fix code generation with leafrefs pointing to optional members

When we have a typedef which points to a location disabled by
if-feature, we need to accept this fact -- but do not allow that typedef
to be referenced.

JIRA: MDSAL-829
Change-Id: Ibde28faa2f96904dc16fcc6f5a922edc6bcffebb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoGuard against null augmentations
Robert Varga [Tue, 13 Jun 2023 14:17:59 +0000 (16:17 +0200)]
Guard against null augmentations

Do not populate the augmentations map with null values.

JIRA: MDSAL-820
Change-Id: I3258337f1c9dd782b840e9ebad4e154428afc53b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove an unnecessary cast
Robert Varga [Tue, 13 Jun 2023 14:10:38 +0000 (16:10 +0200)]
Remove an unnecessary cast

We know the getDomPathArgument() always returns NodeIdentifier, there is
no need to cast it.

Change-Id: Ic525f0938e692251a8bff0c80dd90e40966d926f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRename ChoiceNodeCodecContext
Robert Varga [Tue, 13 Jun 2023 13:25:40 +0000 (15:25 +0200)]
Rename ChoiceNodeCodecContext

ChoiceCodecContext is a better and shorter name, as the 'Node' part does
not really make any sense.

JIRA: MDSAL-828
Change-Id: Ied868e2cecda87ccdd69dae9f6688c7d70cac924
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRename SchemaRootCodecContext
Robert Varga [Tue, 13 Jun 2023 13:23:40 +0000 (15:23 +0200)]
Rename SchemaRootCodecContext

SchemaRoot is too long a name, shorten in to RootCodecContext.

JIRA: MDSAL-828
Change-Id: I01a7d87e20ec4c073624a2cf1367ab2c369cb574
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoHide CodecOpaqueObject constructor
Robert Varga [Tue, 13 Jun 2023 12:43:41 +0000 (14:43 +0200)]
Hide CodecOpaqueObject constructor

We no longer use Javassist, hence we can just make the constructor
protected.

Change-Id: I760fc93f613c3593e72373b12c904cd6d149d525
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove AbstractOpaque{Data,Object}.equals()
Robert Varga [Tue, 13 Jun 2023 12:40:39 +0000 (14:40 +0200)]
Improve AbstractOpaque{Data,Object}.equals()

Use instanceof pattern to simplify equals() method.

Change-Id: I04f8262428b0a6a1ef8d35c21793c51306b9ed81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRename NodeCodecContext
Robert Varga [Tue, 13 Jun 2023 12:09:34 +0000 (14:09 +0200)]
Rename NodeCodecContext

This name is awefully long and the 'Node' part does not convey any
meaning. Rename it to CodecContext.

JIRA: MDSAL-828
Change-Id: I31e93a49d79f31e3d43bc803639393c8e9e6c8d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSeal NodeCodecContext hierarchy
Robert Varga [Tue, 13 Jun 2023 11:53:05 +0000 (13:53 +0200)]
Seal NodeCodecContext hierarchy

We are about split out some of the contexts to public places. Before we
do that, though, make sure the hierarchy is sealed, so we do not get
accidental subclasses.

JIRA: MDSAL-828
Change-Id: Iaa1f0954eb1e571b08dbe8760157a996c1905143
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSplit out CodecContextFactory
Robert Varga [Tue, 13 Jun 2023 11:31:35 +0000 (13:31 +0200)]
Split out CodecContextFactory

The coupling of CodecContextFactory to NodeCodecContext prevents proper
splitting the individual concerns. Promote CodecContextFactory to a
top-level class.

JIRA: MDSAL-828
Change-Id: Ic3cc54380e7db76e92c116103b84af209625e97b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSeal IdentifiableItemCodec
Robert Varga [Tue, 13 Jun 2023 10:48:19 +0000 (12:48 +0200)]
Seal IdentifiableItemCodec

We have only two concrete subclasses, make sure the JVM knows that.

Change-Id: Ic9121d08ce6ca6140918bac001132ba68681b32e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdjust to YangTextSchemaSource being a CharSource
Robert Varga [Tue, 13 Jun 2023 10:18:39 +0000 (12:18 +0200)]
Adjust to YangTextSchemaSource being a CharSource

YANGTOOLS-1508 changed the interface here, adjust to it by using
delegateForCharSource() instead.

Change-Id: I20327d4ff7b8f023f18755104ef9b9b581fd24c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRename CaseNodeCodecContext.Prototype
Robert Varga [Mon, 5 Jun 2023 08:05:39 +0000 (10:05 +0200)]
Rename CaseNodeCodecContext.Prototype

Split this class out into CaseCodecPrototype top-level class.

Change-Id: I9b94a07f5b78bdec684d17ed0831e67a06cf0c0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSplit out CaseNodeCodecContext.Prototype
Robert Varga [Sun, 4 Jun 2023 22:47:14 +0000 (00:47 +0200)]
Split out CaseNodeCodecContext.Prototype

Add an explicit subclass of DataObjectCodecProtype to serve case nodes.

Change-Id: I77a752be75673d1ffa768c5d76c422f082e03880
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSplit out NotificationCodecContext.Prototype
Robert Varga [Sun, 4 Jun 2023 21:47:46 +0000 (23:47 +0200)]
Split out NotificationCodecContext.Prototype

Notifications require a special context, split them out and guard
against re-instantiation.

Change-Id: I7eede21b2aeab92c02ae451a4c5e341361563bca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSplit out SchemaRootCodecContext.Prototype
Robert Varga [Sun, 4 Jun 2023 21:13:49 +0000 (23:13 +0200)]
Split out SchemaRootCodecContext.Prototype

This prototype is rather special, split it out, making the dependency
graph a tad simpler.

Change-Id: I8da7e556fdb73f729b054bfb28dbcaa57e577aeb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSplit out DataContainerCodecPrototype subclasses
Robert Varga [Sun, 4 Jun 2023 20:57:06 +0000 (22:57 +0200)]
Split out DataContainerCodecPrototype subclasses

We are going to ditch the Regular specialization in favor of providing
proper specializations. Take the first step and promote the two
specializations to top-level classes.

Change-Id: I0d350c0f1b0c1e364cd4330a39a51ec01e9c9dbd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse instanceof patterns in KeyedListNodeCodecContext
Robert Varga [Sun, 4 Jun 2023 20:15:11 +0000 (22:15 +0200)]
Use instanceof patterns in KeyedListNodeCodecContext

Reduce explicit casts by using instanceof expressions.

Change-Id: I04c15c70b0c9b23680aeb07892cc11c1b167b07f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse instanceof patterns in CodecDataObject
Robert Varga [Sun, 4 Jun 2023 20:13:50 +0000 (22:13 +0200)]
Use instanceof patterns in CodecDataObject

Throw explicit VerifyExceptions instead of verify(... instanceof ...),
so we make it obvious what is going on.

Change-Id: I2fef6be328eb99b2f7c5e6082ad637be0374a17f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSharpen CodecDataObject.data
Robert Varga [Sun, 4 Jun 2023 19:51:49 +0000 (21:51 +0200)]
Sharpen CodecDataObject.data

Since we do not have AugmentationNodes, we now know that all
DistinctNodeContainers backing CodecDataObject are DataContainerNodes.
Sharpen the contract, which gets rid of some ugliness around generic
arguments.

Change-Id: I097e6fda0ca312fc808f2ac2d4e0bbc6ac679315
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoModernize dom-codec-api a bit
Robert Varga [Sun, 4 Jun 2023 19:11:18 +0000 (21:11 +0200)]
Modernize dom-codec-api a bit

With AugmentationNode out of the picture, we know that
DataContainerChild nodes are identified by NodeIdentifier. Codify that
instead of working with plain PathArguments.

Change-Id: I50501e16ac33d3d4e49768b6ff8275603820fb3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoModernize ChoiceNodeCodecContext
Robert Varga [Sun, 4 Jun 2023 18:59:58 +0000 (20:59 +0200)]
Modernize ChoiceNodeCodecContext

We know that Choice's components can only be addressable by
NodeIdentifier, make sure we reflect in the byYangCaseChild Map.
Also use local variable type inference and a text block.

Change-Id: I7ac024b5791247685ecf05e9f77040919eec1219
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump odlparent to 13.0.0
Robert Varga [Tue, 30 May 2023 20:01:55 +0000 (22:01 +0200)]
Bump odlparent to 13.0.0

Align the version with the version used by yangtools-11. Also fixes up
dependencies to pull in optional annotations.

Change-Id: Ia2ef118df94d7ca6c87de28834e1977d3fc41a13
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove BindingNormalizedNodeSerializer API
Robert Varga [Sun, 28 May 2023 15:26:11 +0000 (17:26 +0200)]
Improve BindingNormalizedNodeSerializer API

Allow users to specifically ask for an explicit dataobject or
augmentation serialization.

JIRA: MDSAL-820
Change-Id: Ic929620d2c23c8ac1ab7eb7a5f2f46d627833a73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up BindingAugmentationCodecTreeNode
Robert Varga [Sun, 28 May 2023 14:03:06 +0000 (16:03 +0200)]
Clean up BindingAugmentationCodecTreeNode

We have two unused methods here, remove them.

JIRA: MDSAL-820
Change-Id: Ib1f1fc145f2a5d38cce40f1e1ddee6058d0860e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove BindingCodecTree interface
Robert Varga [Sun, 28 May 2023 13:50:41 +0000 (15:50 +0200)]
Improve BindingCodecTree interface

We have users which know statically that they are dealing with a plain
DataObject or an Augmentation. Add methods to help them to get the right
codec.

JIRA: MDSAL-820
Change-Id: Idf0209c9dc705cf8359688a0eef2dd2e9fa00df2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove binding.spec.util package
Šimon Ukuš [Mon, 23 Jan 2023 06:51:17 +0000 (07:51 +0100)]
Remove binding.spec.util package

Deprecated DataObjectReadingUtil is not being used by anyone.

JIRA: MDSAL-801
Change-Id: I33d68733820c200155c99f0d0f703daff450e411
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
10 days agoMigrate users of NormalizedNode.getIdentifier()
Robert Varga [Sun, 28 May 2023 13:08:37 +0000 (15:08 +0200)]
Migrate users of NormalizedNode.getIdentifier()

We have a replacement, NormalizedNode.name(), use that instead.

Change-Id: Iebcca6dde477b7e5c8dd74dc577e68abbee07662
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMigrate callers of IncorrectNestingException.create()
Robert Varga [Sun, 28 May 2023 13:03:34 +0000 (15:03 +0200)]
Migrate callers of IncorrectNestingException.create()

The static factory method is quite useless, migrate aware from it.

Change-Id: I386d8d13585b8a1627460615e8c84772fe9e21a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMigrate users of YangInstanceIdentifier.{create,empty}()
Robert Varga [Sun, 28 May 2023 12:54:27 +0000 (14:54 +0200)]
Migrate users of YangInstanceIdentifier.{create,empty}()

We have of() methods to replace these, migrate users.

Change-Id: I041a20ee6dd0bbb56ee765ecf2788517bd6318d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdopt yangtools-11.0.0-SNAPSHOT
Robert Varga [Sat, 25 Feb 2023 10:50:36 +0000 (11:50 +0100)]
Adopt yangtools-11.0.0-SNAPSHOT

yangtools is finalizing its bits, which have reprecussions on MD-SAL
APIs. Synchronize with current snapshot so we can start addressing those
bits.

Change-Id: I7d331e28ace9c8b512f960f4452da1fa8d178d05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
10 days agoUpdate binding-dom adaptation to remove AugmentationNode
Robert Varga [Mon, 22 May 2023 12:04:24 +0000 (14:04 +0200)]
Update binding-dom adaptation to remove AugmentationNode

AugmentationIdentifier and AugmentationNode are being removed from
yang-data-api.

This patch adapts mdsal-binding-dom-codec to reflect the
fact Augmentation no longer has one-to-one equivalent. This means that
users need to check whether the code tree node refers to an Augmentation
or to a regular DataObject.

One particular sore point is that toNormalized() can no longer return a
plain Entry of NormalizedNode, as Augmentations do not have a backing.
To solve this, we introduce NormalizedResult with two specializations,
NodeResult and AugmentationResult.

In order to deal with DTCL changes, we also memoize
dataBefore/dataAfter, as it guides LazyAugmentationModification's
correct identification whether the a node has appeared, was modified, or
disappeared.

JIRA: MDSAL-820
Change-Id: I0360fd8f74ddb6df82ba64f7a87f6d92ce855162
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump upstreams
Robert Varga [Fri, 26 May 2023 21:02:38 +0000 (23:02 +0200)]
Bump upstreams

Adopt:
- odlparent-12.0.6
- yangtools-10.0.7

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

10 days agoImprove BindingCodecTree.getSubtreeCodec()
Robert Varga [Fri, 26 May 2023 21:51:09 +0000 (23:51 +0200)]
Improve BindingCodecTree.getSubtreeCodec()

The only implementation we have returns non-null and throws exceptions.
Promote that behaviour to how the method is meant to operate.

Change-Id: I836ee8adb20d23b7b9938dbdeb827aa7a5443bc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove BindingCodecContext.getCodecContextNode()
Robert Varga [Fri, 26 May 2023 21:45:56 +0000 (23:45 +0200)]
Improve BindingCodecContext.getCodecContextNode()

This method always returns @NonNull, document that. Also improve the IAE
thrown on mismatched input and eliminate
SchemaRootCodecContext.create().

Change-Id: Icbd36df64fb5027698a80bd0ba0984b9f55777d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDitch use of LinkedList in BindingCodecContext
Robert Varga [Thu, 25 May 2023 15:12:33 +0000 (17:12 +0200)]
Ditch use of LinkedList in BindingCodecContext

LinkedList is a rather ugly thing performance-wise, use an ArrayList
instead.

Change-Id: I6f40a24bc7b22dc07ea6c809a44a796f1cdb9b54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoModernize BindingCodecContext
Robert Varga [Thu, 25 May 2023 13:11:33 +0000 (15:11 +0200)]
Modernize BindingCodecContext

Use local variable type inference and instanceof patterns to make things
a tad clearer.

Change-Id: I4b0e2634a08edb2f73e4586356d380063520fc48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdd CodecDataObjectAnalysis
Robert Varga [Mon, 22 May 2023 22:14:55 +0000 (00:14 +0200)]
Add CodecDataObjectAnalysis

We will be separating out DataObjectCodecContext into two classes, and
the new one will need to be able to create proxies.

Separate out all the analytics and indexing into a separate DTO, which
can be constructed externally, so the new classes can construct them
separately.

This also necessitates splitting out bindingChildArg() into a separate
class -- but we still want to migrate that to RuntimTypes at some point.

JIRA: MDSAL-820
Change-Id: I970b8f92443a9faf57c1786239e2f552f7ff938d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up DataContainerCodecContext exception handling
Robert Varga [Mon, 22 May 2023 23:13:00 +0000 (01:13 +0200)]
Clean up DataContainerCodecContext exception handling

We are getting confused between immediate throws and returns. The
exception factory methods should be returning the exception and not
throwing it.

Fix this up and add a SpotBugs annotation so that throws are guarded.
Also mark IncorrectNestingException for evolution. Final improvement
that we now have a completely-static factory method.

Change-Id: I5262c0dbb31d6935f258909828aac5331c70801b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove DataContainerCodecPrototype safety
Robert Varga [Mon, 22 May 2023 17:52:12 +0000 (19:52 +0200)]
Improve DataContainerCodecPrototype safety

Before making any changes to the codec, make sure the prototype enforces
invariants, so things like nulls do not sneak in.

JIRA: MDSAL-820
Change-Id: I6c15f686bfde20b5f4516d9ad0b0f40007d689c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up NonCachingCodec
Robert Varga [Mon, 22 May 2023 16:49:15 +0000 (18:49 +0200)]
Clean up NonCachingCodec

Use requireNonNull() and make the codec final, as it is only used as-is.

Change-Id: I59c25c4bcf795e193ac7af764cee9fa868c8435f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoisSubstitutionFor() should be final
Robert Varga [Mon, 22 May 2023 16:09:18 +0000 (18:09 +0200)]
isSubstitutionFor() should be final

Having a static final method guards against potential overlaps, which is
exactly what we want.

Change-Id: I557b80251f5472e57c0ba86853e30d498c515d8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove BindingDataObjectCodecTreeNode.writeAsNormalizedNode()
Robert Varga [Mon, 22 May 2023 12:12:10 +0000 (14:12 +0200)]
Remove BindingDataObjectCodecTreeNode.writeAsNormalizedNode()

This is a leak of implementation internals, not used anywhere but inside
the implementation.

JIRA: MDSAL-820
Change-Id: I3869dd490eb94f218ea86ff7b164ac05f2f5a9e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMove addYangPathArgument()
Robert Varga [Fri, 21 Apr 2023 00:04:11 +0000 (02:04 +0200)]
Move addYangPathArgument()

This method is only used for DataContainerCodecContext, there is just no
reason to pollute NodeCodecContext with this method. Reduces coupling
towards YangInstanceIdentifier.PathArgument a tiny bit.

Change-Id: Iecbb7c11f28a49282d6224229890f63eab33b311
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdd Automatic-Module-Name declarations
Samuel Schneider [Tue, 25 Apr 2023 14:48:47 +0000 (16:48 +0200)]
Add Automatic-Module-Name declarations

Update all packaged models to include Automatic-Module-Name
with correct JPMS module naming.

JIRA: MDSAL-752
Change-Id: I7a8ee5081d97aed0a72570698c4ec729ab57a717
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix runtime type search
Robert Varga [Tue, 2 May 2023 11:19:54 +0000 (13:19 +0200)]
Fix runtime type search

When searching for children, we should be cognizant of the fact that we
might be looking at an inherited contract -- such as 'output' of an
'action' inherited through 'uses'. Extend the runtime search algorithm
to also look at previous() axis.

JIRA: MDSAL-824
Change-Id: Ic2f57b266825c6121f7bd6156a86112abff4b67a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdd tests for BindingObjects with List and LeafLists
Peter Suna [Tue, 25 Apr 2023 14:03:31 +0000 (16:03 +0200)]
Add tests for BindingObjects with List and LeafLists

These tests cover scenarios for ordered and unordered lists and leaf-lists,
including nested lists within containers.The tests also verify the correct
behavior of user, system-ordered and un-keyed lists.

Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Change-Id: Id9e85133fe767a22953970e96f9eb6b26a1bd068

10 days agoDo not depend on binding-spec-util
Robert Varga [Mon, 24 Apr 2023 17:59:34 +0000 (19:59 +0200)]
Do not depend on binding-spec-util

With BindingNaming rehosted, mdsal-binding-java-api-generator has no
business with mdsal-binding-spec-util.

Change-Id: I009ca8eb4d8914480fc32e673c4d1044711b3042
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse an instanceof pattern
Robert Varga [Thu, 20 Apr 2023 23:51:16 +0000 (01:51 +0200)]
Use an instanceof pattern

We have a simple check-and-cast, fold them into a instanceof pattern.

Change-Id: I60bb94091b739ced1f886f9c0c29d9b8f86ce49c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoCachingNormalizedNodeSerializer should not be instantiated
Robert Varga [Thu, 20 Apr 2023 23:35:12 +0000 (01:35 +0200)]
CachingNormalizedNodeSerializer should not be instantiated

We only use this class to act as a delegate towards the rest of the
infrastructure. Remove its constructor.

Change-Id: I245fe5204dc3872703c19df320a77789d5a4c6bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoExpand BindingObject documentation
Robert Varga [Thu, 20 Apr 2023 23:29:57 +0000 (01:29 +0200)]
Expand BindingObject documentation

Enumerate the constructs we are representing.

Change-Id: Ifca6959868dd67080ca46f598cdc8d430c677138
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove BindingContract documentation
Robert Varga [Thu, 20 Apr 2023 22:43:03 +0000 (00:43 +0200)]
Improve BindingContract documentation

Enumerate the use allowed interfaces and explain how they relate to
BindingContract. This interface is sufficiently disconnect from
BindingObject, which has other implications.

Change-Id: I0f93781dbabb540596fc5ac37dfd1bdb509732e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove ChoiceIn documentation
Robert Varga [Thu, 20 Apr 2023 22:19:59 +0000 (00:19 +0200)]
Improve ChoiceIn documentation

We have a few typos and the javadoc contains HTML entities. Clean this
up.

Change-Id: Ia09a63d2f55e41c748eceadc3a4d471325ee714e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up BindingToNormalizedStreamWriter
Robert Varga [Thu, 20 Apr 2023 21:21:54 +0000 (23:21 +0200)]
Clean up BindingToNormalizedStreamWriter

Clarify field name: the rootNodeSchema is really a
DataContainerCodecContext the context corresponding to the root object,
hence it should be called rootSchema.

We have multiple calls to current(), which end talking to the Deque,
which is not necessary. We can just access it once, which makes type
checking more obvious.

Finally ditch checkArgument() calls and prefer instanceof patterns,
which makes the type checks more obvious (to the compiler at least).

Change-Id: I472f0f3eec1f83c1755c91c6cbd0b24b77ae9d9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove BindingToNormalizedStreamWriter.create()
Robert Varga [Thu, 20 Apr 2023 20:30:12 +0000 (22:30 +0200)]
Remove BindingToNormalizedStreamWriter.create()

We have a lot of indirection going on for little real benefit. Reduce
the tangle by replacing calls to create() with plain constructor and
inlining callers.

Change-Id: Ibaac2f17d1c275e42ad281767ba8a50c6318c649
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up CachingNormalizedNodeSerializer
Robert Varga [Thu, 20 Apr 2023 20:52:54 +0000 (22:52 +0200)]
Clean up CachingNormalizedNodeSerializer

Simplify the class by eliminating unneeded methods and lining
invariants. This makes things a tad clearer and eliminates a caller of
DataContainerCodecContext.createWriter().

Change-Id: Ie1ed39ac20477ff21ce51707c1631db1ec7acf65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse instanceof pattern in AbstractBindingNormalizedNodeCacheHolder
Robert Varga [Thu, 20 Apr 2023 18:34:03 +0000 (20:34 +0200)]
Use instanceof pattern in AbstractBindingNormalizedNodeCacheHolder

Reduce casting and flatten unneeded if/else blocks with returns. Also
mark a FIXME to use a switch expression once we them with pattern
matching.

Change-Id: I45045e3b6e5957486f60887c0c4d074b8924077f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoPropagate supported features from ModuleInfoSnapshotResolver
Robert Varga [Thu, 20 Apr 2023 11:57:05 +0000 (13:57 +0200)]
Propagate supported features from ModuleInfoSnapshotResolver

ModuleInfoSnapshotResolver should follow the same pattern as Builder to
allow users to add supported features -- except it talks to a different
backing entity.

JIRA: MDSAL-789
Change-Id: I901e188e33e2508e5c20d135fe57399bc3c81f68
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoHide extractYangModuleInfo()
Robert Varga [Thu, 20 Apr 2023 12:46:11 +0000 (14:46 +0200)]
Hide extractYangModuleInfo()

This method is only used internally, hide it from the rest of the
package.

Change-Id: I77c47e5cff17d0602740823f68c53ff4a813d385
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoPropagate supported features from ModuleInfoSnapshotBuilder
matus.matok [Thu, 6 Apr 2023 12:27:49 +0000 (14:27 +0200)]
Propagate supported features from ModuleInfoSnapshotBuilder

Allow a FeatureSet to be created from a collected
Module/Set<YangFeature> mapping, allowing each reported module to be
registered in ModuleInfoSnapshotBuilder. These are then transformed
into a FeatureSet and passed down to parser.

JIRA: MDSAL-789
Change-Id: I7837fb1debf2ebff3382422b232f047ec05316c1
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump upstreams
Robert Varga [Thu, 20 Apr 2023 11:25:05 +0000 (13:25 +0200)]
Bump upstreams

Adopt:
- odlparent-12.0.5
- yangtools-10.0.6

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

10 days agoCorrect BindingTypes.yangFeature() javadoc
Robert Varga [Tue, 11 Apr 2023 23:39:42 +0000 (01:39 +0200)]
Correct BindingTypes.yangFeature() javadoc

We are referencing 'notification', betraying our copy&paste source. Fix
that up.

Change-Id: I683d0964fe654ff4b1e9b327594f548fdef300d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump upstreams
Robert Varga [Tue, 11 Apr 2023 16:05:19 +0000 (18:05 +0200)]
Bump upstreams

Adopt:
- odlparent-12.0.4
- yangtools-10.0.5

Change-Id: If70cc51bda56c6129d359f6b548554ea41e6f696
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoTag serialVersionUID with @Serial
Robert Varga [Tue, 11 Apr 2023 16:16:07 +0000 (18:16 +0200)]
Tag serialVersionUID with @Serial

Java 14+ allows tagging serialization-related constructs. While we do
not do anything fancy, make sure we tak serialVersionUID.

JIRA: MDSAL-821
Change-Id: I1b660df8fb5e7599d9d8b6658d8955251cc49870
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMigrate Optional.get() callers
Robert Varga [Tue, 11 Apr 2023 11:37:46 +0000 (13:37 +0200)]
Migrate Optional.get() callers

Use Optional.orElseThrow() instanced.

Change-Id: I6ffee0b3e92ddca92a659d0f67d0fda128c02258
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRename InstanceIdentifierBuilder
Robert Varga [Fri, 24 Mar 2023 10:02:30 +0000 (11:02 +0100)]
Rename InstanceIdentifierBuilder

Turn the intermediate interface into a sealed abstract class, which
lowers verbosity significantly. We now have three builder classes, only
two of which are exposed.

JIRA: MDSAL-798
Change-Id: I45e23643e196d9d06112053d60b2e2fbf1544311
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoIntroduce InstanceIdentifier.KeyedBuilder
matus.matok [Thu, 23 Feb 2023 12:34:42 +0000 (13:34 +0100)]
Introduce InstanceIdentifier.KeyedBuilder

When we are dealing with the last idem being an identifiable, we should
expose that by producing KeyedInstanceIdentifier.

Introduced KeyedBuilder and switch to this interface whenever the last
item is an IdentifiableItem -- guaranteeing KeyedInstanceIdentifier
return from build() method.

JIRA: MDSAL-798
Change-Id: I404df6aa1f3c79f259ea705adedd58a9d466cb78
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up InstanceIdentifierTest
Robert Varga [Wed, 22 Mar 2023 13:32:47 +0000 (14:32 +0100)]
Clean up InstanceIdentifierTest

Add missing spaces and remove unneeded trailing comments.

Change-Id: I44c0db8aa27b145148fc86c3fb43b0d78769ce51
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove InstanceIdentifierBuilderImpl.equals()
Robert Varga [Wed, 22 Mar 2023 10:31:57 +0000 (11:31 +0100)]
Improve InstanceIdentifierBuilderImpl.equals()

Use an instanceof pattern and perform direct comparison on hashcodes.

Change-Id: I345e68b9c29fe32ee68d12808f02446c4636388e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove InstanceIdentifierBuilderImpl safety
Robert Varga [Wed, 22 Mar 2023 09:41:05 +0000 (10:41 +0100)]
Improve InstanceIdentifierBuilderImpl safety

Add a constructor which explicitly takes (Identifiable)Item, removing the
need to use type arguments and hiding the intermediate empty constructor
as well as the methods to add items.

Change-Id: Ib45485b0ab3b10ab0666b4ad6797dc710cd00130
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSimplify AbstractPathArgument.equals()
Robert Varga [Wed, 22 Mar 2023 09:31:38 +0000 (10:31 +0100)]
Simplify AbstractPathArgument.equals()

Use instanceof pattern to simplify the equals method.

Change-Id: I31eb8b095a701a43ece60008bc1b797a9ef6ebac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove internal callers of isWildcarded()
Robert Varga [Wed, 22 Mar 2023 09:22:12 +0000 (10:22 +0100)]
Remove internal callers of isWildcarded()

We have two internal callers who can just refer to the field, fix them
up.

Change-Id: Ia634c2f65b809dd719746bd85061feee14f44ec9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoCorrect InstanceIdentifier.trustedCreate()
Robert Varga [Tue, 21 Mar 2023 15:24:31 +0000 (16:24 +0100)]
Correct InstanceIdentifier.trustedCreate()

The check for wildcard is not correct: we should just consider the last
item when deciding to create a KeyedInstanceIdentifier. Add an explicit
test and fix the checks.

JIRA: MDSAL-818
Change-Id: Ic6fedca7e182eaf0d983e3e39b49dd75d01f8ae8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRehost BindingMapping in yang.binding.contract.Naming
Šimon Ukuš [Wed, 22 Feb 2023 12:06:39 +0000 (13:06 +0100)]
Rehost BindingMapping in yang.binding.contract.Naming

Preparation stage for further changes requested by MDSAL-804,
where all the constants and utility methods are moved to
yang.binding.contract.Naming.
Includes moving from BindingMappingTest to NamingTest.

JIRA: MDSAL-804
Change-Id: I8c34f4c4eef40f9c040a0eaeadd49fdfed6dca13
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump xtend to 2.30.0
Robert Varga [Wed, 1 Mar 2023 23:10:30 +0000 (00:10 +0100)]
Bump xtend to 2.30.0

https://www.eclipse.org/xtend/releasenotes.html#/releasenotes/2023/02/27/version-2-30-0

Change-Id: If861cb4f3148a2d7d40ec8bc47ea3f8f8cc21feb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump versions to 12.0.0-SNAPSHOT
Robert Varga [Tue, 28 Feb 2023 10:22:33 +0000 (11:22 +0100)]
Bump versions to 12.0.0-SNAPSHOT

This starts the next major development iteration.

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