yangtools.git
10 days agoRemove superfluouse @NonNull
Robert Varga [Tue, 12 Mar 2024 17:09:11 +0000 (18:09 +0100)]
Remove superfluouse @NonNull

We have @NonNullByDefault, hence we do not need an explicit @NonNull.

Change-Id: I6b546d685d7ffb27577e377987fafd97ee7c3d64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDo not generate prime when not needed
Robert Varga [Fri, 23 Feb 2024 22:30:47 +0000 (23:30 +0100)]
Do not generate prime when not needed

In case we do not have any properties we end up emitting a local
variable which we'll never use -- generating a compiler warning.

Improve InterfaceTemplate to check for this condition and emit the
prime only if there are actually at least one property.

Change-Id: I3341ca075e8c7c0b671a76f226b7bdb99cb12465
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoAdd yang.binding.contract documentation
Robert Varga [Mon, 22 Jan 2024 22:12:27 +0000 (23:12 +0100)]
Add yang.binding.contract documentation

Document the contents of the contract package.

Change-Id: I02cdf674fa591decc85339f8049ba281c4cd62a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump versions to 13.0.1-SNAPSHOT
Robert Varga [Sat, 20 Jan 2024 16:32:22 +0000 (17:32 +0100)]
Bump versions to 13.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia471501c5f24994491208d9776fd4e74e581f156
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRelease mdsal
jenkins-releng [Sat, 20 Jan 2024 13:12:42 +0000 (13:12 +0000)]
Release mdsal

10 days agoClean up constant reference
Robert Varga [Fri, 19 Jan 2024 13:12:27 +0000 (14:12 +0100)]
Clean up constant reference

We have two methods with the same name, make sure we use the right
constant when referencing it.

JIRA: MDSAL-852
Change-Id: I7628d2c997e3c62895984d6d85672c65ff9f0ce7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c112f99b13a8b337563a27761159f7f4bb9dbd94)
(cherry picked from commit edac194e791de33fd9f4a3338855113139ff9ad0)

10 days agoUse Locale.ROOT for toUpperCase
Robert Varga [Thu, 18 Jan 2024 16:41:27 +0000 (17:41 +0100)]
Use Locale.ROOT for toUpperCase

We can just assert this is the root locale, not a some particular
language.

Change-Id: Ibce067abf252162740a9c6ed88a3beff99f455b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoExclude generated services from SpotBugs
Robert Varga [Thu, 18 Jan 2024 15:12:38 +0000 (16:12 +0100)]
Exclude generated services from SpotBugs

We have additional package root we want to exclude, update the list.

JIRA: MDSAL-836
Change-Id: If5e0e15b09570a4e8ff5e9e35d058e3bee018c2c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix ModuleInfoSnapshotResolver
Robert Varga [Thu, 18 Jan 2024 14:52:06 +0000 (15:52 +0100)]
Fix ModuleInfoSnapshotResolver

Previous update missed the ModuleInfoSnapshotResolver update, leading to
broker OSGi functionality.

Update both callsites to directly derive root package name from the
advertized namespace.

JIRA: MDSAL-836
Change-Id: I520824b59018afd2d7afdf06173889f90fd70449
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump yangtools to 13.0.1
Robert Varga [Thu, 18 Jan 2024 10:42:04 +0000 (11:42 +0100)]
Bump yangtools to 13.0.1

Adopt fixes from upstream that are needed downstream.

Change-Id: I5b31163fff4ab9c1206167f57815014e24010817
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoOverride Rpc/Action invoke method
Robert Varga [Thu, 18 Jan 2024 06:56:56 +0000 (07:56 +0100)]
Override Rpc/Action invoke method

Add a plain @Override method for Rpc/Action's invoke method, so that it
is manifested in the generated type.

JIRA: MDSAL-852
Change-Id: I7db7c9036bdb3051ae48a903b66df933fb338fae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoChanged $Yang* generation package and name
Oleksandr Panasiuk [Tue, 5 Sep 2023 08:04:23 +0000 (11:04 +0300)]
Changed $Yang* generation package and name

The naming of these classes is rather unfortunate, as it starts with $
due to the requirement not to conflict with other generated classes. So
they were renemed to avoid dollar sign usage.
Also the root package for theese classes was changed from
org.opendaylight.yang.gen.v1 to org.opendaylight.yang.svc.v1.
A lot of test classes are touched in this patch but no logic were
changed there, its just providing a new path for YangModuleInfoImpl.

JIRA: MDSAL-836
Change-Id: If9e43d21063c2fc48d8adbf0ccfc2406fe760054
Signed-off-by: Oleksandr Panasiuk <oleksandr.panasiuk@pantheon.tech>
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up AugmentationCodecContext
Robert Varga [Mon, 15 Jan 2024 16:02:59 +0000 (17:02 +0100)]
Clean up AugmentationCodecContext

Use A for Augmentation<?>, there is just no need to mix in DataObject.

JIRA: MDSAL-815
Change-Id: I8fc122a85e83878e7cda62420163ca0ed010299e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoCovert yang-binding to bnd-parent
Robert Varga [Sun, 14 Jan 2024 15:32:18 +0000 (16:32 +0100)]
Covert yang-binding to bnd-parent

There are just a few exported packages, switch to bnd-parent.

Change-Id: Iaabeff023f27d25739f08f31560f339df2ee6dde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up dependencies a bit
Robert Varga [Sun, 14 Jan 2024 14:44:48 +0000 (15:44 +0100)]
Clean up dependencies a bit

Eliminate yet another set of warnings.

Change-Id: I16f659072a1c794c28daac43ccb37ffca9c327bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMigrate users of Builders/ImmutableNodes
Robert Varga [Sun, 14 Jan 2024 10:15:30 +0000 (11:15 +0100)]
Migrate users of Builders/ImmutableNodes

Update references to use data.spi.node.ImmutableNodes.

Change-Id: Ide361652366ef8dc5ade34bb513219ce7cf448f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoHide CodecContext methods
Robert Varga [Fri, 12 Jan 2024 11:24:34 +0000 (12:24 +0100)]
Hide CodecContext methods

There is no point having these protected, just make them
package-private.

While we are here, also centralize implementations, as otherwise we have
duplicates.

JIRA: MDSAL-815
Change-Id: I7d708c5d508f49fb8c3224463d8c36fd9cf5e021
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSilence maven-javadoc-plugin
Robert Varga [Sat, 13 Jan 2024 22:12:46 +0000 (23:12 +0100)]
Silence maven-javadoc-plugin

Sprinkle lint suppressions for missing javadocs, cleaning up build
output and focusing on real issues.

Change-Id: I022b6a2f86ab5e21ff74a19a85c3802664b5c7de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoPromote dom-parent to bundle-parent
Robert Varga [Sat, 13 Jan 2024 17:01:39 +0000 (18:01 +0100)]
Promote dom-parent to bundle-parent

This parent is used all over place. It really is MD-SAL's
'bundle-parent', so let's promote and rename it.

While we are at it, also switch its parent to yangtools' bundle-parent
and define correct SCM.

Change-Id: Idf72a16eb6ceb1c2816d79d28470efd7665b02ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMake AugmentationCodecPrototype generic
Robert Varga [Thu, 11 Jan 2024 23:35:38 +0000 (00:35 +0100)]
Make AugmentationCodecPrototype generic

Augmentations should capture their target type, which eliminates the
need for quite a few casts.

JIRA: MDSAL-815
Change-Id: I3d9c8326ac2bb24135c66ecfe240ed95cea98318
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDeprecate BindingCodecTreeNode.getSchema()
Robert Varga [Fri, 12 Jan 2024 20:07:11 +0000 (21:07 +0100)]
Deprecate BindingCodecTreeNode.getSchema()

The BindingCodecTreeNode hierarchy should be expressive enough so that
users do not need the underlying schema. Deprecate getSchema() for
removal.

Change-Id: I58c18075ce78b11db2a922f5de4d4859c256bd35
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRefactor PathArgument to DataObjectStep
Robert Varga [Tue, 9 Jan 2024 20:14:59 +0000 (21:14 +0100)]
Refactor PathArgument to DataObjectStep

InstanceIdentifier.PathArgument is the basic modeling construct for
expressing a path composed of DataObject type references.

Extract it to a top-level construct, DataObjectStep, which has tree
specializations. AbstractPathArgument is kept around for serialization
complatibility.

This has the nice property of capturing the three possible addressing
states, so we can discern them when we see them.

Furthermore there is now only YangInstanceIdentifier.PathArgument, which
makes for cleaner method signatures and imports.

JIRA: MDSAL-815
Change-Id: I22706ccaecae4b70e8afe2644fc74057953c32b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoReparent ChoiceCodecContext
Robert Varga [Thu, 11 Jan 2024 22:37:43 +0000 (23:37 +0100)]
Reparent ChoiceCodecContext

Choice as itself does not map to a DataObject, but rather to a ChoiceIn
-- it is the individual cases that also map to DataObject.

In this patch we reparent ChoiceCodecContext to be a subclass of
DataContainerCodecContext, which allows us to ditch the idea that a
there is a InstanceIdentifier.PathArgument corresponding to this
context.

A nice bonus is that we end up with exactly one serialization method,
which is delegating to the individual case.

Another nice thing is we have a natural place to host the case lookup
logic -- which fits squarely with
ChoiceCodecContext.bindingPathArgumentChild() contract.

JIRA: MDSAL-815
Change-Id: I12a80c849f6405e0e5723afc3f31704a2ad604a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRetain protype in DataContainerCodecContext
Robert Varga [Thu, 11 Jan 2024 18:42:26 +0000 (19:42 +0100)]
Retain protype in DataContainerCodecContext

Acknowledge that DataContainerCodecContext is always instantiated from a
prototype and retain it in the base class.

This ends up centralizing things enough to eliminate an ugly cast we are
using in AugmentationCodecContext.

JIRA: MDSAL-815
Change-Id: Ib604918c2d9e180fece0583331fc2486797cf546
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoLoosen BindingDataContainerCodecTreeNode.getBindingClass()
Robert Varga [Thu, 11 Jan 2024 17:56:57 +0000 (18:56 +0100)]
Loosen BindingDataContainerCodecTreeNode.getBindingClass()

Do not require BindingObject, as we stream navigation encounters
ChoiceIn interface, which is not a BindingObject -- it defers to its
constituent children to provide the BindingObject contract through their
DataObject inheritence.

JIRA: MDSAL-815
Change-Id: I76d1c2405138da2f6985216aef2dfa4580cea724
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSeparate out DataContainerPrototype
Robert Varga [Thu, 11 Jan 2024 15:38:56 +0000 (16:38 +0100)]
Separate out DataContainerPrototype

We have CommonDataObjectCodecPrototype defining strict prerequisites
while providing awefully little in terms of API worth.

Split out DataContainerPrototype, which exposes a typed javaClass() and
the corresponding runtimeType().

JIRA: MDSAL-815
Change-Id: Icaca2603e3b946764ff9d4157ab04be95bd4dde2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoHide CodecContextSupplier
Robert Varga [Thu, 11 Jan 2024 12:05:53 +0000 (13:05 +0100)]
Hide CodecContextSupplier

Refactoring InstanceIdentifier.Item flushes out a problem with the class
hierarchy of ChoiceNodeContextPrototype.

Start off by refactoring CodecContextSupplier, introducing
LazyCodecContextSupplier base class.

JIRA: MDSAL-815
Change-Id: I79fe079d9fc4b0adf166c1a8b2561fb03a2f071f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRefactor DOMYangTextSourceProvider
Robert Varga [Sat, 6 Jan 2024 03:48:25 +0000 (04:48 +0100)]
Refactor DOMYangTextSourceProvider

This should really be a proper extension with its own API. While we are
at it.

mdsal-binding-runtime-api is made synchronous, as there is just no need
to use futures.

Change-Id: I3711662242df8d912c2536a3d73d4f86beea2c33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump yangtools to 13.0.0
Robert Varga [Mon, 11 Dec 2023 10:19:04 +0000 (11:19 +0100)]
Bump yangtools to 13.0.0

This adopts yangtools-13.0.0 and updates the various integration
surfaces.

Change-Id: Ie9e2ed6fec32bdb7cd98803552a4500a5b44f127
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDo not use mockito-subclass
Robert Varga [Fri, 29 Dec 2023 11:12:31 +0000 (12:12 +0100)]
Do not use mockito-subclass

Upgraded Mockito seems to cope well with the tests now, remove the
workaround.

Change-Id: I4130a2fff5a62e73d56b69354287b13a8caba615
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoEliminate CodecDataObjectAnalysis
Robert Varga [Mon, 10 Jul 2023 14:29:15 +0000 (16:29 +0200)]
Eliminate CodecDataObjectAnalysis

We really do not want to have a ton of specializations -- at the end of
the day we just need to properly specialize generation and constructor
access.

While this introduces a bit of code duplication, it also attaches more
properly the individual types to their implementations and the contracts
therein.

JIRA: MDSAL-805
Change-Id: I88b9222835817d2f52469c219844b2f05485dbc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoCapture collection type class
Robert Varga [Wed, 27 Dec 2023 00:13:01 +0000 (01:13 +0100)]
Capture collection type class

Improve CodeHelpers safety by not losing Class type.

Change-Id: I585afdbda3328b018764627631dff7c8df372c01
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSkip SpotBugs for generated code
Robert Varga [Tue, 26 Dec 2023 20:50:19 +0000 (21:50 +0100)]
Skip SpotBugs for generated code

SpotBugs-4.8.3 allows us to explicitly exclude classes from analysis,
take advantage of this facility to suppress Spotbugs on all classes
generated from YANG models.

Change-Id: I81a09e7ba7a1bac9ad1884b36f0bd98a7a3ecde3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump upstreams
Robert Varga [Tue, 26 Dec 2023 20:17:38 +0000 (21:17 +0100)]
Bump upstreams

Adopt:
- odlparent-13.0.10
- yangtools-11.0.5

Also sprinkle @SuppressFBWarnings as needed.

Change-Id: I1649b1e2289f0a6ea2d8919f340dcc8e0b0579f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDo not pull in spotbugs-annotations into binding-parent
Robert Varga [Tue, 26 Dec 2023 20:21:55 +0000 (21:21 +0100)]
Do not pull in spotbugs-annotations into binding-parent

Binding constructs no longer emit @SuppressFBWarnings, hence there is no
point in pulling in this dependency.

Change-Id: If0cdc88df2b2d585fb3bf2defb07d928325466a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDo not leak SpotBugs from yang-binding
Robert Varga [Tue, 26 Dec 2023 23:52:34 +0000 (00:52 +0100)]
Do not leak SpotBugs from yang-binding

We do not want to pollute user-visible classes with @SuppressFBWarnings,
as that is a purely-internal thing.

Isolate the single method requiring suppression into its own
package-private class.

Change-Id: I200ef79c512063f531f1dd18ed0148439c850563
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse constructor injection for OSGi codec services
Robert Varga [Tue, 26 Dec 2023 23:12:58 +0000 (00:12 +0100)]
Use constructor injection for OSGi codec services

We can easily use constructor injection, which eliminates the need for
an explicit field.

Change-Id: I292169b1dd98dd0341a2b5067495bbc79a1c41e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMove binding.model.api documentation
Robert Varga [Tue, 19 Dec 2023 12:49:28 +0000 (13:49 +0100)]
Move binding.model.api documentation

Package documentation resides in the wrong file, move it.

Change-Id: I77d1c5f3b411df7ebb855ccaeb6c7c8d9d1184cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoReuse found Set
Robert Varga [Tue, 19 Dec 2023 10:10:14 +0000 (11:10 +0100)]
Reuse found Set

We are just transferring entries here, so let's reuse the single object
and clear() after each pass.

JIRA: MDSAL-669
Change-Id: Ie41ba63087c8ad0fdc5a581a7d7c4c8dc77f8677
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove duplicate documentation
Robert Varga [Tue, 19 Dec 2023 10:09:22 +0000 (11:09 +0100)]
Remove duplicate documentation

We have directUsers() described, rename the field and drop superfluous
documentation.

JIRA: MDSAL-669
Change-Id: I3824704f9aa6b15c88a1f0118cdac034b939bb80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRetain grouping/uses instantiation vectors
Samuel Schneider [Fri, 3 Mar 2023 07:42:50 +0000 (08:42 +0100)]
Retain grouping/uses instantiation vectors

We need the ability fo find all instantiations of a grouping for
closed-world analysis of BindingRuntimeTypes.

This analysis is need to determine, for example:
- possible types of 'type leafref's pointing outside a grouping,
  to determine which Binding/DOM codecs are applicable
- YANG/Binding overload mapping, i.e. whether a 'container'
  defined in a grouping is instantiated only once or multiple
  types, to use a strongly-bound CodecDataObject it the former case

This patch exposes a GroupingRuntimeType.instantiations(), which exposes
exactly this information.

DefaultGroupingRuntimeType stores this information in the form of
a set of vectors, each pointing either to another grouping or to a
concrete instantiation.

GeneratorReactor collects this information sufficiently early so that it
can be also used to perform partial closed-world analysis during
compile-time.

JIRA: MDSAL-669
Change-Id: I2e21a6b93ce30d9bd1022be5747d44663b6198fc
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDo not fish for RpcInput/RpcOutput runtime types
Robert Varga [Sun, 17 Dec 2023 01:37:23 +0000 (02:37 +0100)]
Do not fish for RpcInput/RpcOutput runtime types

BindingRuntimeTypes provides all known types by their JavaTypeName. This
means we do not have to play games and just look the
{Input,Output}RuntimeType directly.

JIRA: MDSAL-781
Change-Id: If82275714a57f1dc173eae43d4407c0400cfc0e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse bindingChild() to locate notifications
Robert Varga [Sun, 17 Dec 2023 01:46:40 +0000 (02:46 +0100)]
Use bindingChild() to locate notifications

BindingRuntimeTypes provides an interface to directly find
NotificationRuntimeType based on its name. Use it instead of dancing
around with reflection.

JIRA: MDSAL-781
Change-Id: I3ba1a06d8dc07700bd86a3288116989a1a445138
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse @Nullable in AbstractExplicitGenerator.runtimeType()
Robert Varga [Sat, 16 Dec 2023 20:41:36 +0000 (21:41 +0100)]
Use @Nullable in AbstractExplicitGenerator.runtimeType()

Rather than using Optional, split the two user groups to those who check
for null and who assume non-null.

The former continue to call runtimeType() and latter defer to
getRuntimeType().

Change-Id: I0818d806204007127a956f7598267735c90faca9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoImprove isOriginalDefinition()
Robert Varga [Sun, 17 Dec 2023 12:33:39 +0000 (13:33 +0100)]
Improve isOriginalDefinition()

We have an already-casted AddedByUsesAware, use that for the next
instanceof check.

Change-Id: I2e9a172c02fbc3e97d8c90e477cecaf8fa9504f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove BindingRuntimeTypes.findRpc{Input,Output}
Robert Varga [Sat, 16 Dec 2023 20:56:43 +0000 (21:56 +0100)]
Remove BindingRuntimeTypes.findRpc{Input,Output}

These methods are no longer used, remove them along with the indexing
support. This indes {Input,Output,Rpc}Generator.

Change-Id: I90820f5e925fd7e72dbe68572e5c671ef277da29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoChange BindingRuntimeTypes.findIdentity()
Robert Varga [Sat, 16 Dec 2023 22:43:15 +0000 (23:43 +0100)]
Change BindingRuntimeTypes.findIdentity()

Rename the method to identityChild(), returning a @Nullable instead of
an Optional. Add the appropriate documentation.

Change-Id: I9c95c61d015595f876371cfc5e1e521a1b4b3cbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse schemaTreeChild() to lookup input/output
Robert Varga [Sat, 16 Dec 2023 20:55:17 +0000 (21:55 +0100)]
Use schemaTreeChild() to lookup input/output

We have proper RpcRuntimeType, hence we can follow along the schema tree
axis to obtain the runtime types for RPC input/output.

Change-Id: Iea34601edc340b788fc3ee4e17c5da7e245734b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoModernize ListGenerator
Robert Varga [Sat, 16 Dec 2023 20:28:26 +0000 (21:28 +0100)]
Modernize ListGenerator

Use local variable type inference. Also use local variables for keyGen
checking so as to eliminate false warnings.

Change-Id: Ic85f57228e42cfbc6cfe1f4a2dbd16b2798934b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDrop @Beta from mdsal.binding.generator.impl.rt
Robert Varga [Sat, 16 Dec 2023 15:58:00 +0000 (16:58 +0100)]
Drop @Beta from mdsal.binding.generator.impl.rt

This package is not exposed to outside world, there is no point in
having @Beta annotations here. Also make
Default{Input,Output}RuntimeType final.

Change-Id: I1506b99651bcc079c1d1d295e60d8a351f78a4a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up AbstractCompositeRuntimeType
Robert Varga [Sat, 16 Dec 2023 13:59:55 +0000 (14:59 +0100)]
Clean up AbstractCompositeRuntimeType

SpotBugs is no longer complaining about the Comparator, hence we can
completely remove the dependency of spotbugs-annotations.

While we are here, also clean up the Arrays.binarySearch() assumption we
make, so we tolerate if the key is reported as the first argument.

Change-Id: I97b9683b64e49617ca529826e37392face70739a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix wrong annotation use
Robert Varga [Sat, 16 Dec 2023 14:12:38 +0000 (15:12 +0100)]
Fix wrong annotation use

Use JDT annotation instead of SpotBugs, reducing our exposure.

Change-Id: I1fc1e13c5ae476a456a1ffd4db7182f118985945
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse instanceof pattern in AbstractCompositeRuntimeType
Robert Varga [Sat, 16 Dec 2023 13:45:01 +0000 (14:45 +0100)]
Use instanceof pattern in AbstractCompositeRuntimeType

Rather than a plain verify() and explicit cast, use an instanceof
pattern and an explicit throw.

Change-Id: I4583a650dd0ed875cbc2420ec60907c99a122876
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse instanceof pattern DefaultChoiceRuntimeType
Robert Varga [Sat, 16 Dec 2023 13:35:00 +0000 (14:35 +0100)]
Use instanceof pattern DefaultChoiceRuntimeType

Remove an explicit cast in favor of an instanceof pattern.

Change-Id: Iffe0425ba48a43396667354d4d7b22f882301445
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUnify GeneratedType verification
Robert Varga [Sat, 16 Dec 2023 12:58:17 +0000 (13:58 +0100)]
Unify GeneratedType verification

We have number of places where we do verify a Type is a GeneratedType.

Introduce AbstractExplicitGenerator.verifyGeneratedType() to reduce
duplication and explicit casts.

Change-Id: Idcdc2344d59befa2c39d74893348de6627b6c39d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoModernize GeneratorReactor
Robert Varga [Sat, 16 Dec 2023 12:16:31 +0000 (13:16 +0100)]
Modernize GeneratorReactor

Use local variable type inference and instanceof patterns.

Change-Id: I2f9222d0e6535bfaf7655ef6afccbb2ef431ddd4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUse Module.asEffectiveStatement()
Robert Varga [Sat, 16 Dec 2023 12:07:30 +0000 (13:07 +0100)]
Use Module.asEffectiveStatement()

Eliminate a verifyication by cleanly translating Module to
ModuleEffectiveStatement.

Change-Id: I65a08a388e54132457ac8d99d981cbd332d0c009
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoReduce ObjectRegistration use
Robert Varga [Sat, 9 Dec 2023 17:06:03 +0000 (18:06 +0100)]
Reduce ObjectRegistration use

We have a few more services which are exposing ObjectRegistration from
APIs for no particularly good reason.

Switch them to use Registration instead, which allows us to reduce
adaptation in some cases.

JIRA: MDSAL-843
Change-Id: I9c88288cd4d57b9fb2fc780d9017fbb3eb5dbd94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump Xtend to 2.33.0
Robert Varga [Wed, 6 Dec 2023 18:28:21 +0000 (19:28 +0100)]
Bump Xtend to 2.33.0

https://eclipse.dev/Xtext/releasenotes.html#/releasenotes/2023/11/21/version-2-33-0

Change-Id: I926f2981d05af6f3cc7da5825377312dfe574c83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove Naming.NOTIFICATION_LISTENER_SUFFIX
Robert Varga [Wed, 6 Dec 2023 16:17:30 +0000 (17:17 +0100)]
Remove Naming.NOTIFICATION_LISTENER_SUFFIX

This constant was used only by aggregate NotificationListeners, remove
it.

JIRA: MDSAL-497
Change-Id: I2be5a92934e5bccb7816ee2d95acc8044e7066a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove Naming.RPC_SERVICE_SUFFIX
Robert Varga [Wed, 6 Dec 2023 16:15:36 +0000 (17:15 +0100)]
Remove Naming.RPC_SERVICE_SUFFIX

This constant was only used for ynag.binding.RpcService implementations,
remove it.

JIRA: MDSAL-772
Change-Id: I0b222743c8466e55cdfedd9974046dcfaaf37673
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove SuppressFBWarnings from InstanceIdentifier
Robert Varga [Fri, 24 Nov 2023 15:00:17 +0000 (16:00 +0100)]
Remove SuppressFBWarnings from InstanceIdentifier

Define readObject()/writeObject() methods that enforce Serializable
Proxy pattern, which in turn silences SpotBugs.

Change-Id: Ic7c5f523adc5e0df7e9a2767f93fcadd3bc77c8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMove StatementNamespace to yang.binding.contract
Robert Varga [Tue, 14 Nov 2023 14:17:12 +0000 (15:17 +0100)]
Move StatementNamespace to yang.binding.contract

This enumeration forms a part of the binding naming contract, move it to
yang-binding.

Change-Id: I8fe170d5791ff36c5c1728b0ea7112b178e3d808
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove support for composite NotificationListener
Robert Varga [Tue, 14 Nov 2023 11:53:58 +0000 (12:53 +0100)]
Remove support for composite NotificationListener

We have a much more flexible mechanism for dealing with notifications
via the Notification interface, which is a proper FunctionalInterface.

Remove support for aggregated moduled-level FooListener interfaces.

JIRA: MDSAL-497
Change-Id: I7dd82c477de6ca836cce84354c016d5ebd21022d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove yang.binding.RpcService
Robert Varga [Thu, 26 Oct 2023 22:35:19 +0000 (00:35 +0200)]
Remove yang.binding.RpcService

RpcService is a base marker for generated interfaces representing
the collection of 'rpc' statements in a module.

This interface and its uses have been deprecated, as their design
assumptions are based on Java 7, that is do not consider lambdas.

Since we have yang.binding.Rpc and related interfaces to cleanly
represent RPCs in lambda-cognizant world, remove RpcService and all its
related codegen/runtime support.

JIRA: MDSAL-772
Change-Id: I41b3c6513869a43b6373ad588336ebed2dc873d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump versions to 13.0.0-SNAPSHOT
Robert Varga [Mon, 13 Nov 2023 15:47:23 +0000 (16:47 +0100)]
Bump versions to 13.0.0-SNAPSHOT

This starts the next major development version.

Change-Id: I4f549a7b19adea7ab284fea0278db79468ef20c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump versions to 12.0.4-SNAPSHOT
Robert Varga [Mon, 30 Oct 2023 21:21:28 +0000 (22:21 +0100)]
Bump versions to 12.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I22fefd3c8ae76998cd879391b322adeb61a0c9b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump upstreams
Robert Varga [Mon, 30 Oct 2023 16:12:11 +0000 (17:12 +0100)]
Bump upstreams

Adopt:
- odlparent-13.0.7
- yangtools-11.0.4

Change-Id: Iaa314dfdca3513a67d9a1b8cb895554172071441
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump upstreams
Robert Varga [Sun, 1 Oct 2023 23:29:00 +0000 (01:29 +0200)]
Bump upstreams

Adopt:
- odlparent-13.0.5
- yangtools-11.0.3

Change-Id: Ic5ae3e0bfa2359087ad4c8818794746489ab2e20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump versions to 12.0.3-SNAPSHOT
Robert Varga [Sun, 17 Sep 2023 11:53:18 +0000 (13:53 +0200)]
Bump versions to 12.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: Id25ee91d56adadb4dda0b0dbb57555a5f0a31b7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRelease mdsal
jenkins-releng [Sun, 17 Sep 2023 09:11:11 +0000 (09:11 +0000)]
Release mdsal

10 days agoBump yangtools to 11.0.2
Robert Varga [Sat, 16 Sep 2023 11:10:35 +0000 (13:10 +0200)]
Bump yangtools to 11.0.2

Pick up fixes and improvements from upstream.

Change-Id: I25d4724ac546438db4470925bb73e30c7f9cccea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump versions to 12.0.2-SNAPSHOT
Robert Varga [Wed, 30 Aug 2023 19:26:19 +0000 (21:26 +0200)]
Bump versions to 12.0.2-SNAPSHOT

This starts the next developement iteration.

Change-Id: I1cab2e06404eb6de3fb589fb07ba34f1695f98b4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRelease mdsal
jenkins-releng [Wed, 30 Aug 2023 14:41:47 +0000 (14:41 +0000)]
Release mdsal

10 days agoBump upstreams
Robert Varga [Wed, 30 Aug 2023 12:07:25 +0000 (14:07 +0200)]
Bump upstreams

Adopt:
- odlparent-13.0.4
- yangtools-11.0.1

Change-Id: I292e6adbf213017d4dc9316e32ba60111ad7e60b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoClean up dependencies
Robert Varga [Wed, 30 Aug 2023 09:47:20 +0000 (11:47 +0200)]
Clean up dependencies

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

Change-Id: I768629694f426f99aaa32a53d19b18642b88a0bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoMerge if() statements
Robert Varga [Tue, 29 Aug 2023 18:58:51 +0000 (20:58 +0200)]
Merge if() statements

There is no point in having nested if() statements, merge them,
eliminating a Sonar warning.

Change-Id: I9a1e325c6366446858fe47fd4956d0754f9b9f19
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBind to org.eclipse.jdt.annotation
Robert Varga [Tue, 29 Aug 2023 18:57:32 +0000 (20:57 +0200)]
Bind to org.eclipse.jdt.annotation

We are using these annotations with scope=compile, hence we can safely
binding to the classes at runtime. Fixes a few Sonar warnings.

Change-Id: I793b847d9d25086e32158f333d8c5c155e554568
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump xtend to 2.32.0
Robert Varga [Tue, 29 Aug 2023 07:06:32 +0000 (09:06 +0200)]
Bump xtend to 2.32.0

https://eclipse.dev/Xtext/xtend/releasenotes.html#/releasenotes/2023/08/27/version-2-32-0

Change-Id: I1179a8129e379fe833a6e6487d22d6c7abad5362
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove CommonDataObjectCodecContext.namespace()
Robert Varga [Mon, 10 Jul 2023 12:14:27 +0000 (14:14 +0200)]
Remove CommonDataObjectCodecContext.namespace()

This method is not used anywhere, remove it. This cascades to
CommonDataObjectCodecPrototype.getNamespace(), which is also unused and
removed -- trimming down the overall memory cost and the need to make up
a namespace.

Change-Id: Iefe432de785d0c7400dd5be87797c849e56c2f9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUnify yangPathArgumentChild()
Robert Varga [Mon, 10 Jul 2023 11:42:31 +0000 (13:42 +0200)]
Unify yangPathArgumentChild()

We have two implementations which are doing essentially the same thing
-- except ChoiceCodecContext performs lookup twice. Reduce the amount of
codec duplication.

JIRA: MDSAL-805
Change-Id: I834bf66d92f8bf3ad8621be28ba3fbb39f52f9fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUnify streamChild() implementations
Robert Varga [Mon, 10 Jul 2023 11:27:33 +0000 (13:27 +0200)]
Unify streamChild() implementations

The two implementations we have perform essentially the same thing, tie
them together.

JIRA: MDSAL-805
Change-Id: I303ae152987b4d478862874b4d9ee3fc8db4f7db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoUnify getStreamChild() implementations
Robert Varga [Mon, 10 Jul 2023 10:00:28 +0000 (12:00 +0200)]
Unify getStreamChild() implementations

We have two implementations, which essentially do the same thing. Unify
them in DataContainerCodecContext.

JIRA: MDSAL-805
Change-Id: I97db0a356c51472a30b206151426921f5ad550cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix mdsal-binding-dom-codec dependencies
Robert Varga [Mon, 10 Jul 2023 11:12:15 +0000 (13:12 +0200)]
Fix mdsal-binding-dom-codec dependencies

We are using JDT annotations, declare that.

Change-Id: I1c4a6d112da9015fb3885e40c33bf27cd31246ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove superfluous documentation
Robert Varga [Mon, 10 Jul 2023 09:43:40 +0000 (11:43 +0200)]
Remove superfluous documentation

DataContainerCodecContext implements contracts, there is no need to
re-state the same contract.

Change-Id: Ie1694ff61c61933df8811dcc39b23eca41cf6319
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRemove PMD/CPD configuration
Robert Varga [Thu, 6 Jul 2023 00:13:32 +0000 (02:13 +0200)]
Remove PMD/CPD configuration

We do not have PMD/CPD plugins configured, there is no need to disable
them.

Change-Id: I05a7ed5978eb54440b6d6009a9ea26af9b29926e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSharpen DataContainerCodecContext generics
Robert Varga [Thu, 29 Jun 2023 21:31:58 +0000 (23:31 +0200)]
Sharpen DataContainerCodecContext generics

Now that RootCodecContext is gone, we can sharpen T to require
CompositeRuntimeType, eliminating a bit of weirdness.

Change-Id: I9f430ceeaa59baedcb7ea2b0e69ad279964eb6ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFold RootCodecContext into BindingCodecContext
Robert Varga [Thu, 29 Jun 2023 20:51:28 +0000 (22:51 +0200)]
Fold RootCodecContext into BindingCodecContext

RootCodecContext exists only for two purposes:
- return for an empty YangInstanceIdentifier lookup
- ease of InstanceIdentifier lookup

In order to fulfill these two roles, it ends up twisting the
BindingDataObjectCodecTreeNode contract in rather nonsensical ways,
preventing a number of further evolutions of the API.

Fold its functionality into BindingCodecContext, eliminating it from the
class hierarchy.

Change-Id: I44a49b78ed9ae418c5c85e48e9441fa1ec1e9862
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoBump versions to 12.0.1-SNAPSHOT
Robert Varga [Fri, 30 Jun 2023 08:11:01 +0000 (10:11 +0200)]
Bump versions to 12.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I7a73013e69e31b3bea46a44afa9e5e7a05b4a711
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRelease mdsal
jenkins-releng [Thu, 29 Jun 2023 22:25:23 +0000 (22:25 +0000)]
Release mdsal

10 days agoAdd interfaces for (Normalized)YangData codec
Robert Varga [Thu, 29 Jun 2023 19:01:03 +0000 (21:01 +0200)]
Add interfaces for (Normalized)YangData codec

We are lacking the ability to transcode yang.binding.YangData to
NormalizedYangData. This patch adds the baseline interfaces required
along with disabled tests.

JIRA: MDSAL-805
Change-Id: I026240e553ffe3415466f94cb1e3f206eb5a3a0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSplit up CodecDataObjectAnalysis
Robert Varga [Thu, 29 Jun 2023 14:47:16 +0000 (16:47 +0200)]
Split up CodecDataObjectAnalysis

CodecDataObjectAnalysis contains two things: the indexing of children
and then the generated class. We need to split these up, so we can
actually plugin in YangData (which needs to former) into the mix.

JIRA: MDSAL-805
Change-Id: Ic38cbf1be4b4011ae5dd983d1826e020a67620c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoReduce unchecked warnings
Robert Varga [Thu, 29 Jun 2023 14:39:19 +0000 (16:39 +0200)]
Reduce unchecked warnings

We do not need DataObject specialization, which solves a few warnings
around casting.

JIRA: MDSAL-805
Change-Id: I1d4ef9938ae75bff182e4f1bfad8d7caaae4a313
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoSplit out BindingDataContainerCodecTreeNode
Robert Varga [Tue, 27 Jun 2023 16:23:02 +0000 (18:23 +0200)]
Split out BindingDataContainerCodecTreeNode

DataContainer contract is well-known and used all over the place. Split
it out so it can be implemented separately. This also reworks codec's
internal type hierarchy to make place for
BindingDataContainerCodecTreeNodes which are not DataObjects.

JIRA: MDSAL-805
Change-Id: I225bb02f2c2a1d9caa6e435a4c2ef8f8f62574bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoReuse cached factory
Robert Varga [Thu, 29 Jun 2023 12:07:41 +0000 (14:07 +0200)]
Reuse cached factory

We can take advantage of local factory to get the loader. This
simplifies things a bit.

Change-Id: Ic1b71c553bc2640697163a544809e1f5de873979
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFix YangDataRuntimeTypes not being available
Robert Varga [Thu, 29 Jun 2023 11:18:03 +0000 (13:18 +0200)]
Fix YangDataRuntimeTypes not being available

CompositeRuntimeType children are always indexed only through
SchemaTree, which means we need to make another pass to get at
YangDataRuntimeTypes.

JIRA: MDSAL-805
Change-Id: I68cfc7fad2c1a7cb3333e48e9b435bc681992641
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoDo not require DataObject for streaming
Robert Varga [Wed, 28 Jun 2023 09:47:28 +0000 (11:47 +0200)]
Do not require DataObject for streaming

DataContainer is completely sufficient, require just that.

JIRA: MDSAL-805
Change-Id: Iff55143f2c3bcc8a4b678649285f170f0353db5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoReduce explicit casts in DataObjectStreamerGenerator
Robert Varga [Wed, 28 Jun 2023 09:20:20 +0000 (11:20 +0200)]
Reduce explicit casts in DataObjectStreamerGenerator

Use instanceof patterns to reduce casts.

Change-Id: I3d1e0f8ea5d4b14135e1604b6f902d9e5193941c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoFixup dom-codec a bit
Robert Varga [Wed, 28 Jun 2023 07:23:49 +0000 (09:23 +0200)]
Fixup dom-codec a bit

With all the moves we can tighten formatting a bit. Also remove a site
with raw types.

Change-Id: Id3b13500598a595517dbbfe9f98893517cd77aa2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
10 days agoRename CaseNodeCodecContext
Robert Varga [Tue, 27 Jun 2023 22:06:41 +0000 (00:06 +0200)]
Rename CaseNodeCodecContext

'CaseCodecContext' is a better name, matching the CaseCodecPrototype we
already have.

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