yangtools.git
3 weeks agoMake Cardinality a record 72/114072/2 master
Robert Varga [Thu, 17 Oct 2024 18:36:13 +0000 (20:36 +0200)]
Make Cardinality a record

Cardinality is holding just two numbers, turn it into a record, which
reduces ceremony a bit.

Change-Id: I5ddadb167c411f3e63cc79b9cd09e6624c12e561
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSummarize based on streams 71/114071/1
Robert Varga [Thu, 17 Oct 2024 18:29:56 +0000 (20:29 +0200)]
Summarize based on streams

Collectors.groupingBy() is quite poverful and allows us to create the
summary map using input streams, without iterating.

Change-Id: Ic660cd5bb7947ffc5c54558591a0e54f051f245e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoEliminate SubstatementValidator.Counter 70/114070/1
Robert Varga [Thu, 17 Oct 2024 18:15:21 +0000 (20:15 +0200)]
Eliminate SubstatementValidator.Counter

We can use Map.merge(def, 1, Integer::sum) instead, which performs the
same thing, without the need to have an explicit class.

Change-Id: I6e57cb23d6aecc1c9c9bac9ffb83026a6efe730f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoOverride DataObjectReference.toLegacy() 04/114004/5
Robert Varga [Tue, 15 Oct 2024 15:21:49 +0000 (17:21 +0200)]
Override DataObjectReference.toLegacy()

We need to ensure we project KeyedInstanceIdentifier when asked to go to
legacy. This patch adds the overrides and corresponding tests.

Change-Id: Ib1edbde360ca59c34b0f4c7f199393ffa20b0d8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoMigrate TypeTest 59/114059/1
Robert Varga [Thu, 17 Oct 2024 12:02:13 +0000 (14:02 +0200)]
Migrate TypeTest

Use JUnit5 and improve assertions.

Change-Id: I7ca9966b8040f138d763f5161376ca0b7c71e997
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoMigrate JavaTypeNameTest 58/114058/1
Robert Varga [Thu, 17 Oct 2024 12:00:07 +0000 (14:00 +0200)]
Migrate JavaTypeNameTest

Migrate to JUnit5 and improve test assertions.

Change-Id: Iaee4efab3a078845c3fb446812b5c4f7cb9d6efd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoMigrate ListEqualsTest 57/114057/1
Robert Varga [Thu, 17 Oct 2024 11:51:07 +0000 (13:51 +0200)]
Migrate ListEqualsTest

Migrate to JUnit5 and use BindingMap.of().

Change-Id: Id6313948e0b53d15278799d38ed78920f9dd78d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoBump byte-buddy to 1.15.5 56/114056/1
Robert Varga [Thu, 17 Oct 2024 11:34:49 +0000 (13:34 +0200)]
Bump byte-buddy to 1.15.5

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.15.5

Change-Id: Ib1acf43e90d506e5675f4516b944af2bc020e20d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoBump byte-buddy to 1.15.4 05/114005/1
Robert Varga [Tue, 15 Oct 2024 15:22:48 +0000 (17:22 +0200)]
Bump byte-buddy to 1.15.4

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.15.4

Change-Id: Idc85d932f354563b428a67fc46c527d7d8643212
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoUp date project description 58/113958/1
Robert Varga [Sat, 12 Oct 2024 07:27:18 +0000 (09:27 +0200)]
Up date project description

We now include binding, be sure to mention it.

Change-Id: I53272def1858ee0644fdac21da7259433aeb9596
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove test exception throws 57/113957/3
Robert Varga [Fri, 11 Oct 2024 20:37:41 +0000 (22:37 +0200)]
Remove test exception throws

SonarCloud is pointing out superfluous throws declarations, remove them.

Change-Id: Ie816e416db85cd8b793ad2c97fb288d0d00b83c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoUse List.getFirst()/getLast() 10/113910/3
Robert Varga [Wed, 9 Oct 2024 04:38:35 +0000 (06:38 +0200)]
Use List.getFirst()/getLast()

Take advantage of sequenced collections, improving our production code
a bit.

Change-Id: I8ab1c0dd9227da58c67f6b8205a82ca902f5791f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoBump versions to 14.0.6-SNAPSHOT 11/113911/1
Robert Varga [Wed, 9 Oct 2024 05:37:47 +0000 (07:37 +0200)]
Bump versions to 14.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: Id903f1094401453974d212be68a1eca27758750c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoRelease yangtools v14.0.5
jenkins-releng [Wed, 9 Oct 2024 03:12:51 +0000 (03:12 +0000)]
Release yangtools

5 weeks agoAdjust yangtools-docs with binding 97/113897/1
Robert Varga [Tue, 8 Oct 2024 13:07:46 +0000 (15:07 +0200)]
Adjust yangtools-docs with binding

We need to include more artifacts, update docs projects accordingly.

Change-Id: I60ec822a6302ed0e6ed091e37813a330b2f57243
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoUpdate tests 91/113891/2
Robert Varga [Tue, 8 Oct 2024 09:24:37 +0000 (11:24 +0200)]
Update tests

We are about to switch serialization proxies, update tests to show how
the format changes.

Change-Id: I6b448891519a374dc53a24fa48f1455b3c6078dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoBump odlparent to 14.0.4 85/113885/1
Robert Varga [Mon, 7 Oct 2024 19:59:41 +0000 (21:59 +0200)]
Bump odlparent to 14.0.4

Pick up latest upgrades from upstream.

Change-Id: Ic6a5e705dba9a390efbdd979c049a28e75997702
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 weeks agoFixup javadoc formatting 84/113884/1
Robert Varga [Mon, 7 Oct 2024 20:07:47 +0000 (22:07 +0200)]
Fixup javadoc formatting

Upgraded checkstyle is actually enforcing our Javadoc policy w.r.t.
<p> tag statement. Fix offending code.

Change-Id: I376834adf9139c885e94e116e905ae02b8445406
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoBump byte-buddy to 1.15.3 72/113772/1
Robert Varga [Tue, 1 Oct 2024 07:26:02 +0000 (09:26 +0200)]
Bump byte-buddy to 1.15.3

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.15.3

Change-Id: Ifdccd721735a883242a3caea85a159e9a1b76671
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 weeks agoBump byte-buddy to 1.15.2 49/113749/1
Robert Varga [Fri, 27 Sep 2024 15:12:15 +0000 (17:12 +0200)]
Bump byte-buddy to 1.15.2

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.15.2

Change-Id: Ib02a9165a8d22462b0118e42abc47746b01ed451
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 weeks agoExpose BindingDataContainerWriter 19/113519/2
Robert Varga [Fri, 13 Sep 2024 14:50:02 +0000 (16:50 +0200)]
Expose BindingDataContainerWriter

We somehow lost the ability to emit stream events directly into a
NormalizedNodeStreamWriter. This patch restores it.

JIRA: YANGTOOLS-1648
Change-Id: Id8f517c3534ec2dc64c2046462648fab4e849cae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 weeks agoBump Xtend to 2.36.0 31/113631/1
Robert Varga [Tue, 24 Sep 2024 07:46:14 +0000 (09:46 +0200)]
Bump Xtend to 2.36.0

https://eclipse.dev/Xtext/releasenotes.html#/releasenotes/2024/08/25/version-2-36-0

Change-Id: I404aa90b16a947475ed48782eaef93d80ece16ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoDefine a serialization proxy for yang.common.Empty 48/113548/1
Robert Varga [Tue, 17 Sep 2024 07:27:23 +0000 (09:27 +0200)]
Define a serialization proxy for yang.common.Empty

Empty's serial form is tied to its layout. This defines a serialization
proxy which can be used to disconnect it and provide forward
compatibility.

JIRA: YANGTOOLS-1647
Change-Id: Ie13d5907e1b94cd96b10dc25a3633139548f8209
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoDeprecate simple DataTreeFactory.create() 33/113533/1
Robert Varga [Mon, 16 Sep 2024 09:20:43 +0000 (11:20 +0200)]
Deprecate simple DataTreeFactory.create()

We cannot quite guarantee DataTree operation without an
EffectiveModelContext. This patch deprecates the simple method, steering
users towards method which require it.

Change-Id: I2b3f6c6802aed1892113e6d32c131a341a6323ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoAdd Uint{8,16,32,64} and Decimal64 serialization proxies 86/112186/6
Robert Varga [Sun, 16 Jun 2024 04:30:45 +0000 (06:30 +0200)]
Add Uint{8,16,32,64} and Decimal64 serialization proxies

Define serialization proxies for common types. This allows us to provide
compatibility with types serialized in future versions.

JIRA: YANGTOOLS-1647
Change-Id: I36a001a5af37c0c882e7fbb37e55ad379678b6e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoEliminate MutableTreeNode.setSubtreeVersion() 28/113528/1
Robert Varga [Sun, 15 Sep 2024 15:06:03 +0000 (17:06 +0200)]
Eliminate MutableTreeNode.setSubtreeVersion()

Each call to TreeNode.toMutable() is followed by a call to
setSubtreeVersion(). Push the subtree version into toMutable() directly,
making the code a tad more compact.

JIRA: YANGTOOLS-570
Change-Id: I6ab52715bd6678563263d928611f1a5737ac5533
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRemove RpcInputCodec 18/113518/2
Robert Varga [Fri, 13 Sep 2024 14:40:01 +0000 (16:40 +0200)]
Remove RpcInputCodec

This interface used to have two unrelated implementations, but it only
has a single implementation now. Remove it to simplify things slightly.

Change-Id: I542e131e05f6a846ee1d8ba33d25e74744d9dc92
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDataObjectCodecContext.serialize() should be final 17/113517/1
Robert Varga [Fri, 13 Sep 2024 14:38:46 +0000 (16:38 +0200)]
DataObjectCodecContext.serialize() should be final

We do not override this method anywhere, make sure to enforce it by
making it final.

Change-Id: Ia74c8625aca997e12ca80c046469dba1756d5818
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump versions to 14.0.5-SNAPSHOT 64/113364/1
Robert Varga [Mon, 2 Sep 2024 11:49:19 +0000 (13:49 +0200)]
Bump versions to 14.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: If0c33f3b32eed7e1b4050e6eb804507b1e145a62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRelease yangtools v14.0.4
jenkins-releng [Mon, 2 Sep 2024 09:42:42 +0000 (09:42 +0000)]
Release yangtools

2 months agoExpose org.opendaylight.yangtools.binding.data.codec.impl again 60/113360/1
Robert Varga [Mon, 2 Sep 2024 09:12:38 +0000 (11:12 +0200)]
Expose org.opendaylight.yangtools.binding.data.codec.impl again

This partially reverts 4c790297d02f82d750db09531f350b3ea813d287, so that
unit tests work.

JIRA: YANGTOOLS-1646
Change-Id: I477d4cbb1e45b6b0040831b101587e18cd5b2da8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump versions to 14.0.4-SNAPSHOT 47/113347/1
Robert Varga [Fri, 30 Aug 2024 19:17:53 +0000 (21:17 +0200)]
Bump versions to 14.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I2192feca61338309170ead196b79162ebe49af56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRelease yangtools v14.0.3
jenkins-releng [Fri, 30 Aug 2024 17:41:17 +0000 (17:41 +0000)]
Release yangtools

2 months agoBump odlparent to 14.0.3 44/113344/1
Robert Varga [Fri, 30 Aug 2024 16:48:52 +0000 (18:48 +0200)]
Bump odlparent to 14.0.3

Pick up latest updates.

Change-Id: Ib65cd95e46e8867da7d451888b95fca75f24eed1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump byte-buddy to 1.15.1 32/113332/1
Robert Varga [Fri, 30 Aug 2024 12:42:00 +0000 (14:42 +0200)]
Bump byte-buddy to 1.15.1

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.15.1

Change-Id: Ic780564d53b504190fc111b0cbb761af56057257
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump byte-buddy to 1.15.0 39/113239/1
Robert Varga [Sun, 25 Aug 2024 05:52:29 +0000 (07:52 +0200)]
Bump byte-buddy to 1.15.0

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.14.19
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.15.0

Change-Id: I734f095e9f397b113979a8863101e6d1ab375d07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove BindingClassLoader.toString() and equality 66/112966/4
Robert Varga [Thu, 1 Aug 2024 22:23:20 +0000 (00:23 +0200)]
Improve BindingClassLoader.toString() and equality

Improve BindingClassLoader.toString(), so that we:
- retain identity information, but use a consistent HexFormat string
- expose parent ClassLoader
- expose target from LeafBindingClassLoader

Also codify that a BindingClassLoader operates on object identity, so
there is no confusion about that fact, ever.

Change-Id: I1c9f968ff1e1bf4b4fc5b2a4a5dc64544f7ecfed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix compareAndExchange() check 52/112952/1
Robert Varga [Thu, 1 Aug 2024 18:51:04 +0000 (20:51 +0200)]
Fix compareAndExchange() check

The witness value should be checked against 'local', as that is what we
expect.

Change-Id: Ie4e264e0b978e2cc9557e01e23f8200a4fe4febc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove RootBindingClassLoader logging 51/112951/1
Robert Varga [Thu, 1 Aug 2024 18:49:00 +0000 (20:49 +0200)]
Improve RootBindingClassLoader logging

Log isOurClass() exceptions on trace level to pollution. Add debugs
to point out which class loader we are using for which class.

Change-Id: I9f8eeab0e1fb222d2b40daba51eb7c86cf156d96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix a nullness warning in RootBindingClassLoader 50/112950/1
Robert Varga [Thu, 1 Aug 2024 18:41:42 +0000 (20:41 +0200)]
Fix a nullness warning in RootBindingClassLoader

We have local which we may end up returning not marked as @NonNull. Fix
that.

Change-Id: Idbf59b005c5c5e4b2816d4474966af804bb786ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not expose binding.data.codec.impl 44/112944/1
Robert Varga [Thu, 1 Aug 2024 11:01:44 +0000 (13:01 +0200)]
Do not expose binding.data.codec.impl

These are implementation internals and should not be accessible from
outside.

Change-Id: I2a17caa3818ee8b2df80735d55ec3315f858daf7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRemove BindingCodecTreeFactory 29/112929/3
Robert Varga [Wed, 31 Jul 2024 21:43:09 +0000 (23:43 +0200)]
Remove BindingCodecTreeFactory

This class has been superseded by binding.data.codec.dynamic version of
it. Remove if from binding-data-codec-api, making the codec API
independent of binding-runtime-api.

JIRAL YANGTOOLS-1638
Change-Id: I127102ce7d580771c2a3b9f0cb14c27843a42061
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd (Dynamic)BindingDataCodec et al. 25/112925/5
Robert Varga [Wed, 31 Jul 2024 18:53:57 +0000 (20:53 +0200)]
Add (Dynamic)BindingDataCodec et al.

We have BindingDOMCodecServices, which provides:
- a consistent set of binding-data-codec-api services
- a BindingRuntimeContext
- (indirectly) a EffectiveModelContext

The first item is a binding.data.codec.api concern, which is addressed
by exposing BindingDataCodec, which exposes the individual services. It
also takes care of the third item via an explicit modelContext() method,
as yang.model.api is implied in the services we provide.

The second item is the assumption of a dynamic runtime, where
BindingRuntimeContext is readily available. This is exposed via
binding.data.codec.dynamic.DynamicBindingDataCodec.

BindingDOMCodecServices are deprecated in favor of using one of these
interfaces.

We also introduce binding.data.codec.dynamic.BindingDataCodecFactory,
which supersedes binding.data.codec.spi.BindingDOMCodecFactory, as this
is an assumption of dynamism.

binding-data-codec-osgi now explicitly requires
binding-data-codec-dynamic, which is appropriate w.r.t. to assumption of
BindingRuntimeContext being passed around.

JIRA: YANGTOOLS-1638
Change-Id: I7d44063b42c3cddaa39c1c7a8aa28e035bb130a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump byte-buddy to 1.14.18 58/112858/1
Robert Varga [Sun, 28 Jul 2024 21:03:48 +0000 (23:03 +0200)]
Bump byte-buddy to 1.14.18

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.14.18

Change-Id: I254abd8ce16277c191cd7c2dd93eba49aaca8916
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump versions to 14.0.3-SNAPSHOT 57/112857/1
Robert Varga [Sun, 28 Jul 2024 13:43:37 +0000 (15:43 +0200)]
Bump versions to 14.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I626563e5661e91245790c600f7ebce85f96a2dc9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRelease yangtools v14.0.2
jenkins-releng [Sun, 28 Jul 2024 12:05:44 +0000 (12:05 +0000)]
Release yangtools

3 months agoConvert binding-loader to use bnd-parent 55/112855/1
Robert Varga [Sun, 28 Jul 2024 11:20:59 +0000 (13:20 +0200)]
Convert binding-loader to use bnd-parent

This is a nigh-trivial module, convert it to use bnd-parent. Also fixup
description a bit.

Change-Id: I35543143e4de825232c1ab8f6cfd6e8fae3c64f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not specialize Grouping.implementedInterface() 51/112851/2
Robert Varga [Sun, 28 Jul 2024 08:33:09 +0000 (10:33 +0200)]
Do not specialize Grouping.implementedInterface()

Grouping is no longer a DataObject, hence its narrowed
implementedInterface() conflicts with DataObject when used in generic
type specification.

Do not narrow implementedInterface() in groupings.

JIRA: YANGTOOLS-1637
Change-Id: I3a907b2c6f8bc644d68a7aaf8efad3e56506081c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoMigrate AbstractGeneratedTypeBuilderTest to JUnit5 99/112799/2
Robert Varga [Fri, 26 Jul 2024 12:31:29 +0000 (14:31 +0200)]
Migrate AbstractGeneratedTypeBuilderTest to JUnit5

Clean up the test and use assertThrows().

Change-Id: I5113578d105ee4ba99529ad3ecec2aa4eb5371e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump versions to 14.0.2-SNAPSHOT 80/112780/1
Robert Varga [Thu, 25 Jul 2024 16:33:45 +0000 (18:33 +0200)]
Bump versions to 14.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia1a29d72598c0694b4819c5b16d53c956a9d5eaf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRelease yangtools v14.0.1
jenkins-releng [Thu, 25 Jul 2024 13:37:47 +0000 (13:37 +0000)]
Release yangtools

3 months agoBump odlparent to 14.0.2 66/112766/3
Robert Varga [Thu, 25 Jul 2024 10:54:49 +0000 (12:54 +0200)]
Bump odlparent to 14.0.2

Pick up latest updates from upstream.

Change-Id: Ia021695b9bab708f28296670ac22c2a86852be5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoConvert yang-data-api to bnd-parent 67/112767/1
Robert Varga [Thu, 25 Jul 2024 11:23:49 +0000 (13:23 +0200)]
Convert yang-data-api to bnd-parent

This is a straightforward conversion, with @Exports matching
module-info.

Change-Id: I77207d1a445da1da576a222684632cd6220e98f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix EnumerationTypeBuilder error message 53/112753/1
Robert Varga [Thu, 25 Jul 2024 07:49:48 +0000 (09:49 +0200)]
Fix EnumerationTypeBuilder error message

We have a bit of a messy error message here, fix it up to provide
complete information.

Change-Id: Ic39a69036d333216a6700618a22ece03dfccea48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoGrouping is a BindingObject 12/112612/2
Robert Varga [Wed, 17 Jul 2024 15:37:54 +0000 (17:37 +0200)]
Grouping is a BindingObject

Generated groupings are using just Grouping, not DataObject, which has
the unfortunate effect of not allowing them to be specified as caching
specification -- as those require BindingObject.

Restore this ability by making Grouping extend BindingObject.

JIRA: YANGTOOLS-1635
Change-Id: I51591cd9b6cbf1d2fe9659389e441613fdf3b310
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoClean up binding-test-model tests 75/112575/2
Robert Varga [Tue, 16 Jul 2024 10:01:47 +0000 (12:01 +0200)]
Clean up binding-test-model tests

Modernize the tests a bit and hide them.

Change-Id: Ib6b9df83bc182194025aa65fbbbcc36849971c8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agobinding.BaseIdentity is Serializable 74/112574/3
Robert Varga [Tue, 16 Jul 2024 09:42:15 +0000 (11:42 +0200)]
binding.BaseIdentity is Serializable

Objects implementing BaseIdentity are used as values, for example in
ScalarTypeObjects, which are Serializable.

Prior to MDSAL-733 we used Class<? extends BaseIdentity> to pass values
around, which meant we relied on java.lang.Class being Serializable.

Adjust BaseIdentity to extend Serializable and make generated VALUE
implementations properly resolve to singletons.

JIRA: YANGTOOLS-1633
Change-Id: Ic7b759c55bf9091639a983b56341c481632328eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump versions to 14.0.1-SNAPSHOT 76/112576/1
Robert Varga [Tue, 16 Jul 2024 11:28:09 +0000 (13:28 +0200)]
Bump versions to 14.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia454315c6d5e1d8a8df95d754ac66d0e6d4844e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRelease yangtools v14.0.0
jenkins-releng [Tue, 16 Jul 2024 09:21:35 +0000 (09:21 +0000)]
Release yangtools

3 months agoMake sure list keys are final 73/112573/1
Robert Varga [Tue, 16 Jul 2024 08:29:49 +0000 (10:29 +0200)]
Make sure list keys are final

The class generated for a 'key' statement cannot be inherited, make sure
we mark it as final.

JIRA: YANGTOOLS-1632
Change-Id: Ic931143455a8baf2dd1089efc16fda6f5e56cc44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoDo not generate QNAME constaints for Groupings 09/112509/6
Robert Varga [Tue, 9 Jul 2024 08:29:29 +0000 (10:29 +0200)]
Do not generate QNAME constaints for Groupings

QNAME constant is not really needed, as there is nothing on data
addressing side to do. Futhermore, since static members are 'inherited',
this ends up leading to some augmentations having a QNAME member.

Do not add the constant in GroupingGenerator and adjust tests to pick up
the namespace they need from a stable location.

JIRA: YANGTOOLS-1577
Change-Id: Ic03c0d6980317bb8042b482efd03fb9befb00283
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump odlparent to 14.0.1 70/112570/1
Robert Varga [Mon, 15 Jul 2024 17:47:15 +0000 (19:47 +0200)]
Bump odlparent to 14.0.1

Pick up latest updates from upstream.

Change-Id: Id80f9997d53939a6aa1300f3422b3f6701d3159c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAdd DataObject{Identifier,Reference}.builder() static methods 69/112569/4
Robert Varga [Mon, 15 Jul 2024 17:05:40 +0000 (19:05 +0200)]
Add DataObject{Identifier,Reference}.builder() static methods

These methods mirror their YangInstanceIdentifier counterparts, but
route to alternative builders -- most notably
DataObjectIdentifier.Builder.

Attempting to use these is flushing a few bad things in builders, which
we also fix here.

JIRA: YANGTOOLS-1577
Change-Id: If09cdf49fdf924be3554e21e9064268b26fa1c5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoAllow encoding to BindingInstanceIdentifier 64/112464/14
Robert Varga [Mon, 15 Jul 2024 12:32:22 +0000 (14:32 +0200)]
Allow encoding to BindingInstanceIdentifier

Add BindingInstanceIdentifierCodec.toBindingInstanceIdentifier(),
providing a bridge from YangInstanceIdentifier to
BindingInstanceIdentifier.

JIRA: YANGTOOLS-1577
Change-Id: Ic042ce98dd41d7ce44725e810310b844acf75f6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoFix BindingCodecContext.getSubtreeCodec() 67/112567/7
Robert Varga [Mon, 15 Jul 2024 13:58:29 +0000 (15:58 +0200)]
Fix BindingCodecContext.getSubtreeCodec()

The implementation of getSubtreeCodec() has a leaky overlap with
InstanceIdentifierCodec's requirements -- and hence not returning valid
contexts.

Introduce lookupCodecContext(), which can return any manner of
CodecContext, use that in getSubtreeCodec(). getCodecContextNode() is
then a further filter on lookupCodecContext().

JIRA: YANGTOOLS-1577
Change-Id: Ia11ffcde2f9a6ee29599c5e4a35e129bd06f08dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRemove AbstractDataObjectCodecContext 68/112568/3
Robert Varga [Mon, 15 Jul 2024 15:42:51 +0000 (17:42 +0200)]
Remove AbstractDataObjectCodecContext

AbstractDataObjectCodecContext brings in bits of
CommonDataObjectCodecContext implementation into the picture, but it
really is its only specialization. Merge the two classes, adjusting
CodecDataObject accordingly.

JIRA: YANGTOOLS-1577
Change-Id: Iffe9b1981db6df974ab1a454f81aeaeca74c5656
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAllow ModuleRuntimeTypes to be looked up 66/112566/2
Robert Varga [Mon, 15 Jul 2024 14:22:05 +0000 (16:22 +0200)]
Allow ModuleRuntimeTypes to be looked up

We need the ability to lookup module root runtime type in order to
properly perform codec lookups -- for example when looking up a
top-level leaf.

JIRA: YANGTOOLS-1577
Change-Id: Ie2fd4b910d598b05c1d35bdb5489b8efb3f86bdb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAllow returning DataObjectReferences 65/112565/1
Robert Varga [Mon, 15 Jul 2024 12:05:03 +0000 (14:05 +0200)]
Allow returning DataObjectReferences

toBinding() promises a DataObjectReference, hence we can remove the
check for KeylessStep -- resulting in DataObjectReference.

JIRA: YANGTOOLS-1577
Change-Id: I342f5b8d815542b558b1d088162c95feb49f0ca1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoFixup BindingInstanceIdentifierCodec 64/112564/1
Robert Varga [Mon, 15 Jul 2024 11:45:36 +0000 (13:45 +0200)]
Fixup BindingInstanceIdentifierCodec

The argument here should be final, fix that.

JIRA: YANGTOOLS-1577
Change-Id: I2312307b80db570eae33849d2403848c176514f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoFix XSD pattern specifics 65/111365/13
Peter Suna [Fri, 12 Apr 2024 08:22:16 +0000 (10:22 +0200)]
Fix XSD pattern specifics

Replace XSD multi character escape and substraction group pattern
with compatible Java regex.

Create a test to reproduce the issue with converting XSD patterns
into Java-compatible regex.

JIRA: YANGTOOLS-1571
Change-Id: Iab302638c3a436058f6de1d5dd5abd6e76fc411c
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
4 months agoUpdate InstanceNotification mapping 94/112494/13
Robert Varga [Mon, 8 Jul 2024 18:42:21 +0000 (20:42 +0200)]
Update InstanceNotification mapping

InstanceNotification is capturing its parent, which can reasonably be
Grouping, which is not a DataObject.

The situation is not dissimilar to that of RpcInput/RpcOutput for
actions. There we generate a data anchor at the place of definition for
wide reuse -- but generate an interface for each instantiation in
non-grouping.

In this case, though, we cannot generate a DataObject, as we are
inherently tied to an instance identifier.

We therefore go the 'like a grouping' route, generating a reusable
interface, which is then inherited by all concrete instantiations.

JIRA: YANGTOOLS-1577
Change-Id: I54383bc2fe1d060d20911861297ec59d49ddbfc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoUse Grouping as fieldsFrom() argument 18/112518/2
Robert Varga [Tue, 9 Jul 2024 13:28:04 +0000 (15:28 +0200)]
Use Grouping as fieldsFrom() argument

fieldsFrom() is using DataObject, which has other implications than just
a grouping. Since we now have a dedicated construct, use that to mark
what is possible to pass down.

JIRA: YANGTOOLS-1577
Change-Id: If8ab18f26ac09ddc88cadc64fa4efddf15a821bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRefactor NotificationGenerator 04/112504/5
Robert Varga [Tue, 9 Jul 2024 03:21:26 +0000 (05:21 +0200)]
Refactor NotificationGenerator

We really have three generators in one. Let's properly specialize them
at instantiation. We will need this to generate more species of things.

JIRA: YANGTOOLS-1577
Change-Id: I2a7e2ab075464722ffe8458078966822da96b29e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoUse a switch with patterns in AbstractCompositeGenerator 03/112503/3
Robert Varga [Tue, 9 Jul 2024 02:44:11 +0000 (04:44 +0200)]
Use a switch with patterns in AbstractCompositeGenerator

We have a plain cascade dispatch, use switch with patterns instead,
making things a tad cleaner.

JIRA: YANGTOOLS-1577
Change-Id: If96a34beb5e3ed3ab9947f7102330f19ff7aa501
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoSeparate out DataObjectIdentifier.Builder 02/112502/1
Robert Varga [Tue, 9 Jul 2024 01:56:41 +0000 (03:56 +0200)]
Separate out DataObjectIdentifier.Builder

This builder guarantees its result is a DataObjectIdentifier, as it
guards its contents from becoming wildcarded.

JIRA: YANGTOOLS-1577
Change-Id: I61b2bf5bc91bce24f02f6ef938b4c55f2a3bb33f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRemove DataTreeCandidateNodes.empty() 88/112488/1
Robert Varga [Mon, 8 Jul 2024 10:29:20 +0000 (12:29 +0200)]
Remove DataTreeCandidateNodes.empty()

An empty node does not make sense and is not used anywhere -- remove it.

JIRA: YANGTOOLS-1630
Change-Id: Ifc21888070e64a9dcb8f86485cf9018988b65b66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAdd the ability to store versioning information 63/112163/4
Robert Varga [Fri, 14 Jun 2024 11:58:43 +0000 (13:58 +0200)]
Add the ability to store versioning information

Introduce data.tree.api.VersionIInfo and allow it to be attached to
internal version tracking during commit() time. This information can
be retried via DataTreeSnapshot.readVersionInfo().

JIRA: YANGTOOLS-1554
Change-Id: I26f78feec4c97bc488c3ddf5914cdc0a22b72eef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAdd CandidateNode.Compacted 72/112472/2
Robert Varga [Sun, 7 Jul 2024 17:10:21 +0000 (19:10 +0200)]
Add CandidateNode.Compacted

A Compacted event indicates the underlying MVCC tracking data has been
prune. For most users this is just as Unmodified, but state replication
machines need to see this even separately.

JIRA: YANGTOOLS-1631
Change-Id: I9da0ccc06ba8c64f54dcffee9c25a657fa3d68be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoIntroduce DataTreeCandidate.CandidateNode 66/112466/6
Robert Varga [Sun, 7 Jul 2024 10:37:10 +0000 (12:37 +0200)]
Introduce DataTreeCandidate.CandidateNode

DataTreeCandidateNode's design dates back to Java 7 days, which shows in
its layout -- users need to understand behaviours implied by
ModificationType and do not get much other help.

This patch introduces CandidateNode, which is a sealed interface
exposing the bare basics and a number of non-sealed specializations to
handle all the different cases that may occur.

This allows users to use enhanced switch statements to differentiate
between the cases, working quite nicely with Java 21.

We also re-structure the SPI implementations to reduce confusion and
prepare for interop -- allowing us to share code via
AbstractDataeTreeCandidateNode.

Baseline implementations are explosed via
data.tree.spi.ImmutableCandidateNodes and its methods.

JIRA: YANGTOOLS-1630
Change-Id: I9f2cb5365f527acd9ecb1b684de2f09abe9083db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoFix OpaqueObject contract 63/112463/3
Robert Varga [Sat, 6 Jul 2024 16:05:27 +0000 (18:05 +0200)]
Fix OpaqueObject contract

OpaqueObject, while it represents a YANG modeled data tree, does not
expose its underlying structure -- and therefore it is not a
binding.DataContainer.

Promote OpaqueObject into a top-level BindingObject contract,
maintaining exposed implementedInterface(), without DataContainer
implication.

Furthermore do not capture ChildOf relationship in generated interfaces,
as that implies DataObject, again implying DataContainer -- and we do
not want that.

JIRA: YANGTOOLS-1577
Change-Id: Ic3baa0df23e7ca5642ca70624a2f6b6e0710b9d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAdd PropertyStep 62/112462/3
Robert Varga [Sat, 6 Jul 2024 13:00:45 +0000 (15:00 +0200)]
Add PropertyStep

PropertyStep identifies a terminal node in the DataContainer tree
structure -- i.e. something which is not a DataContainer. An
ExactPropertyStep is a valid BindingInstanceIdentifier.Step.

This also adds a PropertyIdentifier as a BindingInstanceIdentifier
subclass -- combinding a DataObjectIdentifier and a ExactPropertyStep.

This ends up almost completing the binding-spec level of changes, except
it highlights the problem that an OpaqueObject is a DataContainer: and
that should not be the case.

JIRA: YANGTOOLS-1577
Change-Id: Ia45cc327b4767d8317468ddef7b4c06f497c3d04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoPromote ScalarTypeObject 59/112459/1
Robert Varga [Fri, 5 Jul 2024 21:10:12 +0000 (23:10 +0200)]
Promote ScalarTypeObject

ScalarTypeObject has passed its @Beta lifecycle, promote it to a stable
contract.

Change-Id: I871e7ddbc8ad4be46fc002e71b14b783dae1a241
JIRA: YANGTOOLS-1576
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAdd AbstractEntryObject 52/112452/7
Robert Varga [Fri, 5 Jul 2024 15:47:13 +0000 (17:47 +0200)]
Add AbstractEntryObject

Add AbstractEntryObject and teach codegen to take advantage of it in
generated EntryObject implementations. This lowers the number of
distinct implementations of KeyAware.key() contract, reducing boiler
plate code and hopefully helping the JVM a tiny bit.

JIRA: YANGTOOLS-1626
Change-Id: I27022ce385cc02431172f0bedd0cd68e29943ea7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRefactor key tracking 56/112456/1
Robert Varga [Fri, 5 Jul 2024 18:21:56 +0000 (20:21 +0200)]
Refactor key tracking

Make BuilderGenerator verify the returned type is a
GeneratedTransferObject. This allows us to remove a cast in
AbstractBuilderTemplate.

Also relocate key property extraction into AbstractBaseTemplate, where
we eschew creating a dedicated comparator.

JIRA: YANGTOOLS-1626
Change-Id: I6c28499f052b901289492108710a095f852b8814
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoEntryObject implies Augmentable 51/112451/8
Robert Varga [Fri, 5 Jul 2024 15:22:13 +0000 (17:22 +0200)]
EntryObject implies Augmentable

EntryObjects are always Augmentable, express that in the base interface
specification. We update BindingTypes.extractAugmentableTarget() to also
recognize this implication -- and extract the first from specialization.

JIRA: YANGTOOLS-1609
Change-Id: Ida98a65c18d6c608ec78c9cc8cd4ac9454e891d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRework Augmentation type extraction 54/112454/4
Robert Varga [Fri, 5 Jul 2024 17:07:42 +0000 (19:07 +0200)]
Rework Augmentation type extraction

Rather than relying on reflection and comparison of FQCN, expose the
appropriate BindingTypes method. This also drops @Beta annotation from
the two methods.

Change-Id: Ib4841e581d6152f32296913effef1fa8b7efbf41
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoAbstractAugmentable is not @Beta 50/112450/3
Robert Varga [Fri, 5 Jul 2024 15:21:06 +0000 (17:21 +0200)]
AbstractAugmentable is not @Beta

Remove the annotation, as this is a fully-functional construct. Also
make sure we force users to implement their own
hashCode()/equals()/toString() methods.

JIRA: YANGTOOLS-1626
Change-Id: I2d2f981e3a828096d82d55de0791437cfdafe709
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoUpdate KeyStep documentation 43/112443/3
Robert Varga [Thu, 4 Jul 2024 15:01:20 +0000 (17:01 +0200)]
Update KeyStep documentation

Reference EntryObject instead of KeyAware.

JIRA: YANGTOOLS-1577
Change-Id: I8500f4709d26f9bad5986da37e987474ad6f4374
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoDo not use KeyAware in BindingMap 42/112442/3
Robert Varga [Thu, 4 Jul 2024 14:59:52 +0000 (16:59 +0200)]
Do not use KeyAware in BindingMap

We are using EntryObjects, use key() method from there rather than from
KeyAware.

JIRA: YANGTOOLS-1577
Change-Id: Ib9cf83dfdbd3743f92bbfb38581eacae1ee58607
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRemove InstanceIdentifier.AbstractPathArgument 40/112440/2
Robert Varga [Thu, 4 Jul 2024 14:42:17 +0000 (16:42 +0200)]
Remove InstanceIdentifier.AbstractPathArgument

This class has been previously deprecated for removal and is no longer
used. Remove it.

JIRA: YANGTOOLS-1577
Change-Id: I3dca6be0c7b6d8099f01d6c19a5d68810313f4ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoDeprecate yang.binding.InstanceIdentifier 39/112439/1
Robert Varga [Thu, 4 Jul 2024 14:39:52 +0000 (16:39 +0200)]
Deprecate yang.binding.InstanceIdentifier

This class is being replaced by DataObject{Reference,Identifier}, mark
this fact.

JIRA: YANGTOOLS-1577
Change-Id: I2c2e2f8cca2f73673be754d9226a236634b3669b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoBump odlparent to 14.0.0 35/112435/1
Robert Varga [Thu, 4 Jul 2024 10:49:34 +0000 (12:49 +0200)]
Bump odlparent to 14.0.0

Use a released version of odlparent again.

Change-Id: I0dbb78dcb2fe960bb0482de3703128f84c16d79a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoFix InstanceIdentifier.toReference() return 29/112429/1
Robert Varga [Wed, 3 Jul 2024 09:33:10 +0000 (11:33 +0200)]
Fix InstanceIdentifier.toReference() return

Guarantee a non-null object here.

JIRA: YANGTOOLS-1577
Change-Id: I0d4361c36ea7eb7b50523f61215b48a5aad45e1a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoClean up Sonar warnings 21/112421/2
Robert Varga [Tue, 2 Jul 2024 14:44:41 +0000 (16:44 +0200)]
Clean up Sonar warnings

This makes a pass at fixing up minor issues reported by Sonar.

JIRA: YANGTOOLS-1576
Change-Id: I629b2504d374310965fa92bbfc4ea1d23d4b0935
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoFixup binding-bundle-parent reference 23/112423/1
Robert Varga [Tue, 2 Jul 2024 15:38:41 +0000 (17:38 +0200)]
Fixup binding-bundle-parent reference

We need to also use the correct artifactId, not just the path.

Change-Id: I76d4f99e89c4c6bb390aeda6bfdc4ab238ff4166
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoIntroduce BindingInstanceIdentifier.Step 19/112419/1
Robert Varga [Tue, 2 Jul 2024 13:52:07 +0000 (15:52 +0200)]
Introduce BindingInstanceIdentifier.Step

The identifier is composed a number of steps -- just as exposed from
DataObjectIdentifier, but slightly more general.

JIRA: YANGTOOLS-1577
Change-Id: I14d808664a11a3ea144af65df0f6ab3c467e3358
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoSharpen ChildOf type argument 18/112418/1
Robert Varga [Tue, 2 Jul 2024 13:46:46 +0000 (15:46 +0200)]
Sharpen ChildOf type argument

ChildOf's parent cannot be any old Object, it has to be a DataContainer
-- improving usage safety.

JIRA: YANGTOOLS-1577
Change-Id: I024247b40b9209ef980759fe7eba8d0e504a9bc9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoClean up binding-model stuff a bit 98/112398/1
Robert Varga [Sun, 30 Jun 2024 13:49:11 +0000 (15:49 +0200)]
Clean up binding-model stuff a bit

Re-introduce mockito-configuration and reorder module-info.java
references.

JIRA: YANGTOOLS-1576
Change-Id: Idde312f750f6865551a28a14b7fecd66e3d51709
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoMerge binding-model-{api,ri} 89/112389/3
Robert Varga [Sun, 30 Jun 2024 09:10:10 +0000 (11:10 +0200)]
Merge binding-model-{api,ri}

Splitting model-api from model-ri does not make much sense at this
point. Merge the two into binding-model, which properly depends on
binding-spec, just as model-ri used to.

JIRA: YANGTOOLS-1576
Change-Id: I13d5c592b6b60edcc264d9885376f83a2ccb9368
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoRename binding-parent to binding-bundle-parent 96/112396/1
Robert Varga [Sun, 30 Jun 2024 12:46:35 +0000 (14:46 +0200)]
Rename binding-parent to binding-bundle-parent

We are going to have a 'binding-bnd-parent', so let's keep consistent
naming here.

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