yangtools.git
2 weeks agoRemove GeneratorReactor.leafGenerators
Robert Varga [Tue, 25 Jan 2022 11:49:48 +0000 (12:49 +0100)]
Remove GeneratorReactor.leafGenerators

This field is completely unused, remove it.

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

2 weeks agoImprove GeneratorReactor timing
Robert Varga [Mon, 24 Jan 2022 09:37:29 +0000 (10:37 +0100)]
Improve GeneratorReactor timing

Parts of generation are not covered by timer, make sure we measure the
entire execution.

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

2 weeks agoRemove remaining concepts.(Checked)Builder references
Ivan Hrasko [Tue, 30 Nov 2021 10:53:40 +0000 (11:53 +0100)]
Remove remaining concepts.(Checked)Builder references

To complete elimination of concepts.(Checked)Builder usage
we have to remove references from manually created Builder
classes and Types.java as well.

JIRA: MDSAL-690
Change-Id: I4a4129bf006d99cf430af6c4d08234208b6620d4
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSimplify leaf access
Robert Varga [Wed, 12 Jan 2022 12:47:53 +0000 (13:47 +0100)]
Simplify leaf access

We do not need to go through the entryset -- just use Map.values(),
eliminating the need for one object indirection.

Change-Id: I5a5226d4b6b256d998e0a30de52bc89e01d1a16d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAlign argument names of getLeafNodes()
Robert Varga [Wed, 12 Jan 2022 11:58:04 +0000 (12:58 +0100)]
Align argument names of getLeafNodes()

Naming here is off: the class and schema do not correspond to each
other, but they are not in parent/child relationship, either.

Change-Id: I3f48ce0beaa446fcf4829fb3faaf24d075516ba2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoInline create{Notification,Rpc}DataContext()
Robert Varga [Wed, 12 Jan 2022 10:51:50 +0000 (11:51 +0100)]
Inline create{Notification,Rpc}DataContext()

We have two methods invoked only from caching loader, inline them,
so that we can eliminate some checks and make visibility obvious.

Change-Id: Id910192224e9a51217f70e125ed58daf08958ab1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClarify BindingReflections.getChildrenClassToMethod()
Robert Varga [Wed, 12 Jan 2022 10:33:15 +0000 (11:33 +0100)]
Clarify BindingReflections.getChildrenClassToMethod()

Keys in the returned map are not any classes, but are guaranteed to be
DataContainers. Document that fact.

Change-Id: Ieac66637f9d5e6c2a9869304fd7a36b376ed5b05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReference SchemaContext.NAME directly
Robert Varga [Tue, 11 Jan 2022 14:33:16 +0000 (15:33 +0100)]
Reference SchemaContext.NAME directly

SchemaContext.getQName() is deprecated, reference the name directly.

Change-Id: Icb22924175667221144fae225296c1be3ea4c758
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix raw Notification warnings
Robert Varga [Tue, 11 Jan 2022 13:44:17 +0000 (14:44 +0100)]
Fix raw Notification warnings

binding.Notification now takes a generic argument, fix a round of raw
references.

Change-Id: I62eed2951a43367e06c69855aaa6a9e43df99392
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove concepts.Builder reference from Builders
Ivan Hrasko [Tue, 30 Nov 2021 10:38:17 +0000 (11:38 +0100)]
Remove concepts.Builder reference from Builders

In order to better localize callers of build() method, remove
reference to concepts.Builder from Xtend BuilderTemplate.

JIRA: MDSAL-690
Change-Id: I7f068fe2e99afd5bc39f187253d8e2917c2a6e75
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix DataObject builer javadoc references
Robert Varga [Mon, 10 Jan 2022 09:54:31 +0000 (10:54 +0100)]
Fix DataObject builer javadoc references

We have a few mis-references generated in documentation, fix them up.

Change-Id: I3040adeb6ec10ca46395212324df29dbe292a82d
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor augment generator linkage
Robert Varga [Tue, 21 Dec 2021 13:22:03 +0000 (14:22 +0100)]
Refactor augment generator linkage

The uses/augment and module/augment cases are quite different from
the perspective how we map their argument reference to generators.

The uses/augment case is quite simple, as it refers to grouping's nodes,
not augmentations. The only variation we need to account for is the
skip back to the defining grouping.

The module/augment case, on the other hand, is more complex, as it can
refer to augmentations -- hence it need to account for changes namespace
changes along uses/grouping as well as back from grouping child to
augmentations.

JIRA: MDSAL-715
Change-Id: I7425301afa6de566d985d19450ccfc64ea527119
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse Empty.value() instead of Empty.getInstance()
Robert Varga [Mon, 22 Nov 2021 13:09:34 +0000 (14:09 +0100)]
Use Empty.value() instead of Empty.getInstance()

Empty..getInstance() is going away, do not generate references to it.

Change-Id: I9322032c8b4c6741d2608948fc98711f3ce2573c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump odlparent/yangtools to 9.0.9/7.0.10
Robert Varga [Sun, 19 Dec 2021 09:42:19 +0000 (10:42 +0100)]
Bump odlparent/yangtools to 9.0.9/7.0.10

Pick up latest fixes from upstream.

Change-Id: I90601e17bd7c2e502ad98077df6f52e401125f66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDo no use reflection to obtain opaque value ctor
Robert Varga [Wed, 8 Dec 2021 16:03:25 +0000 (17:03 +0100)]
Do no use reflection to obtain opaque value ctor

We can do all the lookups and access via java.lang.invoke, let's
not bring java.lang.reflect to the party.

Change-Id: I7528a469270d384fbbbd9680cffe227129cf4d39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a shared type for Pattern
Robert Varga [Tue, 7 Dec 2021 15:37:05 +0000 (16:37 +0100)]
Use a shared type for Pattern

We are looking up the type here multiple times, which is not entirely
efficient. Add a constant to hold the type.

Change-Id: I5da339cd21c5944c13ed2eb66f15b9ae61d56b46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse BindingTypes instead of rollin input/output types
Robert Varga [Tue, 7 Dec 2021 09:13:28 +0000 (10:13 +0100)]
Use BindingTypes instead of rollin input/output types

We have well-known constants covering ConcreteTypes for RpcInput and
RpcOutput. Use them directly, reducing startup time a bit.

Change-Id: I145c4de2db0d3769f6926200f8e8afe6461a445f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoVerify no schema/type overlap
Robert Varga [Fri, 3 Dec 2021 15:31:20 +0000 (16:31 +0100)]
Verify no schema/type overlap

We could end up overwriting previous Schema->Type mapping, let's make
sure we never do that, as that could end up in all sorts of disasters.

Change-Id: Ie4e1682af9c5d59e8ec70b263f0f239f69dd3603
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove BindingRuntimeContext.getActionIdentifier()
Robert Varga [Wed, 1 Dec 2021 14:37:00 +0000 (15:37 +0100)]
Remove BindingRuntimeContext.getActionIdentifier()

This method is left unused, remove it to prevent confusion to users.

JIRA: MDSAL-712
Change-Id: Ic924877f255dc9b2ccafaa64866deefd45a81f17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix action invocation and registration
Robert Varga [Thu, 25 Nov 2021 15:28:33 +0000 (16:28 +0100)]
Fix action invocation and registration

Binding actions involving groupings are a bit more complicated when it
comes to DOM mapping. An instantiated Action can correspond to any
number of ActionEffectiveStatements, but we skimped that over and used
the SchemaPath (and after that, an invalid SchemaNodeIdentifier) to
identify them.

Correct this by requiring users to provide an ActionSpec, which is a
combination of an Action interface and a corresponding instantiation
path.

JIRA: MDSAL-712
Change-Id: I632c0f51b2e71fa1b0a04e43d5b1c50286430b21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoNarrow Notification.implementedInterface() return type
Robert Varga [Tue, 19 Oct 2021 11:59:00 +0000 (13:59 +0200)]
Narrow Notification.implementedInterface() return type

All Notification interfaces should provide their own identity here,
make sure there is no confusion about that.

Change-Id: I9fb7f82fcee7acd38aa05b38a2721ef62f8a1750
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 9.0.0-SNAPSHOT
Robert Varga [Sun, 14 Nov 2021 19:29:17 +0000 (20:29 +0100)]
Bump versions to 9.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: I2e86b89f44c05f9b22bc6fa44bf7f3b983bc3f0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump byte-buddy to 1.12.1
Robert Varga [Sun, 7 Nov 2021 18:16:11 +0000 (19:16 +0100)]
Bump byte-buddy to 1.12.1

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.1
plus the preceding items.

Change-Id: Ie785b9e131369a35584f68a9c9b32ee536b5cead
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse Map.entry() in BindingCodecContext
Robert Varga [Fri, 29 Oct 2021 16:05:21 +0000 (18:05 +0200)]
Use Map.entry() in BindingCodecContext

We are not using nulls, let's use an immutable entry.

Change-Id: I1d2fdd64b8396f991a267c429cf5822d9ada5fa1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoImprove CompilationTestUtils
Robert Varga [Thu, 28 Oct 2021 15:53:16 +0000 (17:53 +0200)]
Improve CompilationTestUtils

We can perform better asserts, let's do that.

Change-Id: I671e1a0425d74b2f87a398102fba9cd890b9efc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd missing requires on yang-common
Robert Varga [Thu, 28 Oct 2021 16:00:36 +0000 (18:00 +0200)]
Add missing requires on yang-common

We are referencing types from yang-common, make sure we require them
and not get them transitively.

Change-Id: Id93e890e3a303b4199e7ae2f2809e29b02f81b7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.8-SNAPSHOT
Robert Varga [Tue, 26 Oct 2021 19:36:06 +0000 (21:36 +0200)]
Bump versions to 8.0.8-SNAPSHOT

This starts the next development iteration.

Change-Id: I55d485d6a4ad9de8147d2deee1ec56ca3f3b7e8c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup BindingTypesTest
Robert Varga [Fri, 22 Oct 2021 11:39:23 +0000 (13:39 +0200)]
Cleanup BindingTypesTest

Use assertThrows() instead of @Text(expected), not that it really
matters here.

Change-Id: I8c8ac3d0c5fc99eebaaaae9c5d0943244e9498f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRequire checker.qual
Robert Varga [Fri, 22 Oct 2021 10:17:35 +0000 (12:17 +0200)]
Require checker.qual

We are using the annotations here, but do not pull in the corresponding
module. Fix that.

Change-Id: Idc25a01c5ba0068763f45f11ddcdfb75a1aae3ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.7-SNAPSHOT
Robert Varga [Wed, 20 Oct 2021 20:13:08 +0000 (22:13 +0200)]
Bump versions to 8.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: Idd52a361f4d44df5bc4cac63d6f6b2b98797d4b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse HierarchicalIdentifier
Robert Varga [Thu, 14 Oct 2021 18:29:19 +0000 (20:29 +0200)]
Use HierarchicalIdentifier

We have a number of identifiers which do not actually implement
Identifier concept but rather Path. We have a replacement for Path,
so let's use it, improving contracts the process of doing so.

Change-Id: Idf506084d1b67993f4a7d37efd23b5fca234375f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump odlparent/yangtools
Robert Varga [Wed, 20 Oct 2021 20:12:22 +0000 (22:12 +0200)]
Bump odlparent/yangtools

Adopt odlparent-9.0.7, yangtools-7.0.9.

Change-Id: I5bafc485191739b184a46c4a3db532a00b50b554
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup mdsal-binding-generator packaging
Robert Varga [Sat, 16 Oct 2021 15:09:23 +0000 (17:09 +0200)]
Cleanup mdsal-binding-generator packaging

We just ditched utilities depending on it, hence we do not need to
pull it anymore. Also adjust dependencies to silence warnings.

Change-Id: If09662e7a49d0df34aadf23a63193d48f3e75044
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove mdsal.binding.yang.types
Robert Varga [Sat, 16 Oct 2021 14:52:56 +0000 (16:52 +0200)]
Remove mdsal.binding.yang.types

This package is not exported by us and therefore not accessible by
anyone. We have just ditched its last user, ditch the package as well,
along with its test suite.

Change-Id: Ida72524105d0134395c06c48a994fc86893567d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate ConfigTypeProvider tests
Robert Varga [Sat, 16 Oct 2021 13:16:03 +0000 (15:16 +0200)]
Migrate ConfigTypeProvider tests

There are a few remaining tests, migrate them and inhume
AbstractTypeProvider et al.

Change-Id: I1aa96547dfa67ef7dc48f8ef948656fab0405ca4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove a chunk of AbstractTypeProvider
Robert Varga [Sat, 16 Oct 2021 13:06:45 +0000 (15:06 +0200)]
Remove a chunk of AbstractTypeProvider

We now have no references to some of the code, remove it before
we proceed further. Also hide methods not called externally, so
they will be identified as unused.

Change-Id: I351355657eb8cd2e19c18d553c18a0590cef8a9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoExpand DefaultBindingGeneratorTest
Robert Varga [Sat, 16 Oct 2021 13:00:05 +0000 (15:00 +0200)]
Expand DefaultBindingGeneratorTest

We have fixed the test model (as it was invalid). Add an explicit test
for the now-unresovled grouping leaf type and also restore the original
negative test.

Change-Id: I14c0d734ee8990f9ad9ac8f8c58f37cafae34990
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove RuntimeTypeProvider
Robert Varga [Sat, 16 Oct 2021 11:55:10 +0000 (13:55 +0200)]
Remove RuntimeTypeProvider

Migrate all disabled tests which rely on it and remove it. This
increases our assertion coverage and reduces the amount of code we lug
around.

Change-Id: I5ecd83b953f021786a7fb9bd8a228c67e528ea7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReduce code duplication a tiny bit
Robert Varga [Fri, 15 Oct 2021 19:55:51 +0000 (21:55 +0200)]
Reduce code duplication a tiny bit

The 'else' part of CaseNodeCodecContext's return is the same as
overridden method, hence call super instead of duplicating code.

Also add a few FIXMEs to guide our intent going forward.

JIRA: MDSAL-697
Change-Id: I7dd9576da217f1a186e9298346ee62aa2ede45d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd a ModuleAugmentGenerator FIXME
Robert Varga [Fri, 15 Oct 2021 18:32:52 +0000 (20:32 +0200)]
Add a ModuleAugmentGenerator FIXME

Since we will be dealing with getOriginal(), it seems we had some
dead code from conversion. This might prove useful in what we need
to achieve here.

JIRA: MDSAL-696
Change-Id: I8af7f2277f5adc9c08b304d4f8693fc43ece6778
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove getOriginalIfPossible()
Robert Varga [Fri, 15 Oct 2021 18:31:06 +0000 (20:31 +0200)]
Remove getOriginalIfPossible()

We already have originalNodeOf(), which does precisely the same thing
as we just transplanted.

Change-Id: Ibcafaa23027be1e52e4bb1d8c1f752683fab1aff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup AbstractBindingRuntimeContext.getAvailableAugmentationTypes()
Robert Varga [Fri, 15 Oct 2021 16:01:22 +0000 (18:01 +0200)]
Cleanup AbstractBindingRuntimeContext.getAvailableAugmentationTypes()

We are performing lookups along augmentation instantiation axis using
APIs which are going away. Cleanup the code and move the traversal to
BindingRuntimeTypes.

Leave a FIXME for getting the required intelligence from
GeneratorReactor as well as some sorely-needed documentation as to what
exactly is going on.

JIRA: MDSAL-695
Change-Id: I6dd7ad7807546091bfbc5cced48b574d6bff49e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup findChildSchemaDefinition()
Robert Varga [Fri, 15 Oct 2021 13:46:04 +0000 (15:46 +0200)]
Cleanup findChildSchemaDefinition()

Now that we have the search and codec check split out, we can clean up
some of the logic to ditch if-else blocks. Also fixes a potential NPE.

Change-Id: I2a341d06bd3abfc39d7ecfaaf876e6617ddea037
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove grouping/instantiation lookup code
Robert Varga [Fri, 15 Oct 2021 12:56:29 +0000 (14:56 +0200)]
Move grouping/instantiation lookup code

DatObjectCodecContext should not be concerned with relationships
between parent and child, certainly not to the point of dealing with
where an original grouping leaf is instantiated.

The natural place for this logic is BindingRuntimeContext or
BindingRuntimeTypes, as those get their indices from
mdsal-binding-generator -- which is the core component understanding
these relationships.

Also ditch use of Optionals for tracking walk through dependencies,
which clears up some ugly casts.

Change-Id: I72bfa499794b55c0c6266462b36df56c2ac085c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix GeneratorReactor.mapToGenerator()
Robert Varga [Sun, 5 Sep 2021 22:48:00 +0000 (00:48 +0200)]
Fix GeneratorReactor.mapToGenerator()

GeneratorReactor.mapToGenerator() relies on EffectiveStatements having
an identity, as it looks up only based on statement.

Rework the logic to operate on SchemaInferenceStack's state, which
provides hierarchical path which should match Generator layout. This
turns out to be a simple delegator job, but we need to switch matching
strategies when we go along the grouping or augment axis.

JIRA: MDSAL-694
Change-Id: Id87c54fdfc2ff37cdf44503e0603074a74c1c02c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoProperly annotate byte[]
Robert Varga [Tue, 28 Sep 2021 14:54:47 +0000 (16:54 +0200)]
Properly annotate byte[]

This is the only case where we are using a simple array, which has
different annotation placement than reference types. Recognize it and do
the right thing.

JIRA: MDSAL-678
Change-Id: I38fe9c66cbfcf4388cc74ade241b4e986d2c7d6f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFilter empty augmentations from DataObject.toString()
Robert Varga [Tue, 28 Sep 2021 14:12:48 +0000 (16:12 +0200)]
Filter empty augmentations from DataObject.toString()

Empty augmentations are a hallmark of every toString() result we see.
They carry no semantic meaning, so let's filter them to make life easier
for everyone.

JIRA: MDSAL-691
Change-Id: I79dc07fa72c6c952e797ebb96784788e0dd30241
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd FIXMEs for hex-formatting binary values
Robert Varga [Tue, 28 Sep 2021 14:09:48 +0000 (16:09 +0200)]
Add FIXMEs for hex-formatting binary values

Add FIXMEs to point out where things need to change.

Change-Id: Id7bbd991cf1adf93ee37fa34dfd3314410d72da0
JIRA: MDSAL-692
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix Types.getDefaultRestrictions()
Robert Varga [Tue, 28 Sep 2021 03:39:16 +0000 (05:39 +0200)]
Fix Types.getDefaultRestrictions()

We have a warning about class visibility, fix it by using public
interface. Also mark the method for removal, as it does not seem
to be used.

Change-Id: I00556715ef3200dc2b46540a05c8e6c0fea0f55e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove generatedTypeForExtendedDefinitionTypeWithIdentityrefBaseTypeTest()
Robert Varga [Tue, 21 Sep 2021 22:27:01 +0000 (00:27 +0200)]
Move generatedTypeForExtendedDefinitionTypeWithIdentityrefBaseTypeTest()

Move this test into the legacy test suite.

Change-Id: I127db528643cc59f76ce3e6198c96508e2c46d01
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove useless test
Robert Varga [Tue, 21 Sep 2021 22:09:00 +0000 (00:09 +0200)]
Remove useless test

This is a test for a null check in dead code, just remove it.

Change-Id: If5a2347a27697640cb109be0a2d93d28de291dd2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove a few more tests
Robert Varga [Mon, 16 Aug 2021 13:26:18 +0000 (15:26 +0200)]
Move a few more tests

A few tests from TypeProviderTest can be re-activated with
DefaultBindingGenerator, migrate them.

Change-Id: I61ffbd5c622bba113d58e32e4d2db6fe7275461b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd a FIXME for method returns
Robert Varga [Sun, 5 Sep 2021 18:00:54 +0000 (20:00 +0200)]
Add a FIXME for method returns

Method semantics are quite counter-intuitive, add a FIXME to ensure
users do not get confused.

Change-Id: Iefca54eb050c6c2df0cf8a4b1a99b641e282beb7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.6-SNAPSHOT
Robert Varga [Sun, 12 Sep 2021 09:27:15 +0000 (11:27 +0200)]
Bump versions to 8.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I22d0d635fd45b187c6deda49d6a7922bad96a69e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump odlparent/yangtools
Robert Varga [Sat, 11 Sep 2021 14:22:08 +0000 (16:22 +0200)]
Bump odlparent/yangtools

Adopt odlparent-9.0.6/yangtools-7.0.8.

Change-Id: I6f5682c34c0358b9bb94bc41a7d9c89c55fa4241
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCorrect Generator.findGenerator() return type
Robert Varga [Mon, 6 Sep 2021 08:09:45 +0000 (10:09 +0200)]
Correct Generator.findGenerator() return type

We can only ever return AbstractExplicitGenerator, make sure we reflect
that in method return type.

Change-Id: Ica9d309910836682476659cb09f9346e2fe16cc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCentralize Builder and Key suffixes
Robert Varga [Sun, 5 Sep 2021 20:21:35 +0000 (22:21 +0200)]
Centralize Builder and Key suffixes

We have a number of places hard-coding these constants, use a common
place for them.

Change-Id: Ifbd633e1bc7fbd66bd72d091955e4353d412b6c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove simple BaseTemplate methods
Robert Varga [Sun, 5 Sep 2021 18:36:23 +0000 (20:36 +0200)]
Move simple BaseTemplate methods

Reduce xtend proliferation by moving simplistic methods into
JavaFileTemplate and using them from there. This has also benefit in
that BaseTemplate does not reference yang.model.api directly.

Change-Id: I0f10e8abd5fcf54f9d288bd882ad5e9b62298113
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.5-SNAPSHOT
Robert Varga [Tue, 24 Aug 2021 14:00:47 +0000 (16:00 +0200)]
Bump versions to 8.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I2b9ba51d0b0399fe171d29a29f71008d57f06eac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump odlparent/yangtools
Robert Varga [Tue, 24 Aug 2021 13:11:44 +0000 (15:11 +0200)]
Bump odlparent/yangtools

Adopt odlparent-9.0.5 and yangtools-7.0.7.

Change-Id: I71532087c44636382c83217468ef8bc810e866d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.4-SNAPSHOT
Robert Varga [Mon, 23 Aug 2021 19:31:15 +0000 (21:31 +0200)]
Bump versions to 8.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I7323c18e83019d36af40c67948a826fa8bcfc828
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump upstreams
Robert Varga [Mon, 23 Aug 2021 19:07:08 +0000 (21:07 +0200)]
Bump upstreams

Adops odlparent-9.0.4 and yangtools-7.0.6.

Change-Id: Ie7505132ad25c7822362927e3bcdcac3e43a42ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.3-SNAPSHOT
Robert Varga [Fri, 20 Aug 2021 09:23:25 +0000 (11:23 +0200)]
Bump versions to 8.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I217e988e73ea089d82f44f08dd88a6c84629bb9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump upstreams
Robert Varga [Thu, 19 Aug 2021 23:07:16 +0000 (01:07 +0200)]
Bump upstreams

Adops odlparent-9.0.3 and yangtools-7.0.5.

Change-Id: I22c5ae9be1e8b817b8bf47f82ac28eb10ba6e840
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoShorten JavaFileGeneratorFactory's name
Robert Varga [Tue, 17 Aug 2021 21:04:09 +0000 (23:04 +0200)]
Shorten JavaFileGeneratorFactory's name

The package name here is quite wasteful, hence use something shorter,
which should help with hitting file path limits.

Change-Id: Iade9a8e8a71a5cbfb0b7aef1de253e623c731920
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDo not guard utility class constructors
Robert Varga [Tue, 17 Aug 2021 19:59:51 +0000 (21:59 +0200)]
Do not guard utility class constructors

There is no point in having exception throwing here, just use a simple
comment.

Change-Id: If4e2c22bde3a2456e1aec77ef2a1e846c2732a7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove ByteBuddyUtils.{ifEq,markLabel}
Robert Varga [Mon, 16 Aug 2021 18:20:29 +0000 (20:20 +0200)]
Remove ByteBuddyUtils.{ifEq,markLabel}

Ever since we have moved DataObject.equals() implementations to
generated interfaces this code is no longer used. Remove it to reduce
overall footprint.

Since these are the only methods which require frame informantion, also
ditch the code to mark COMPUTE_FRAMES, providing even more
simplification.

Change-Id: I32f1868e3d82193702835938f54663fb2052ae71
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.2-SNAPSHOT
Robert Varga [Sat, 24 Jul 2021 21:02:12 +0000 (23:02 +0200)]
Bump versions to 8.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: I43dca6e2f7926a176c94d4cc5b08515e632b92cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump yangtools to 7.0.4
Robert Varga [Sat, 24 Jul 2021 18:06:05 +0000 (20:06 +0200)]
Bump yangtools to 7.0.4

Pick up latest fixes from upstream.

Change-Id: If5a2b590bb57cde510f3adaba29fc235f7a607a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRequire yang-common transitively
Robert Varga [Wed, 21 Jul 2021 17:09:57 +0000 (19:09 +0200)]
Require yang-common transitively

We have a number of utilities using yang-common, require it explicitly.

Change-Id: Ief3e652f053ddd1da7f94949f0bf52f20f273ecc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd GeneratorTest
Robert Varga [Thu, 15 Jul 2021 12:34:29 +0000 (14:34 +0200)]
Add GeneratorTest

We have a few tests targeting low-level utility methods in Generator,
add a dedicated GeneratorTest to hold them.

Change-Id: I18ee7f1e66ed1b0519de0b1d61b4e63135f2c947
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSplit out Bug1862Test
Robert Varga [Thu, 15 Jul 2021 12:44:24 +0000 (14:44 +0200)]
Split out Bug1862Test

We have a disabled test here. Split it out and reactivate it.

Change-Id: I38b72751eb38bc492208fdd47af0534c8b6b6c4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFurther cleanup of test classes
Robert Varga [Thu, 15 Jul 2021 12:23:00 +0000 (14:23 +0200)]
Further cleanup of test classes

We have no users of TestLeafSchemaNode and TypeProviderModel is only
used by TypeProviderTest.

Change-Id: I92e8467d60c1e2a784607181674f8ae32b47974b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate Bug4621Test
Robert Varga [Thu, 15 Jul 2021 12:16:55 +0000 (14:16 +0200)]
Migrate Bug4621Test

Move the test into the appropriate package and migrate it to work on top
of DefaultBindingGenerator.

Change-Id: Idc86823388898341d5fe54adc224ad3d5e4fbb27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove unused testing TypeDefinitions
Robert Varga [Thu, 15 Jul 2021 12:07:40 +0000 (14:07 +0200)]
Remove unused testing TypeDefinitions

We are not using these two classes anymore, remove them.

Change-Id: I12b779a4d52c080a3850499a38efd41c32520595
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove TypeProvider interface
Robert Varga [Thu, 15 Jul 2021 11:34:07 +0000 (13:34 +0200)]
Remove TypeProvider interface

We have only a single implementation of this interface, remove it
by collapsing it into AbstractTypeProvider.

Change-Id: I3e8999327a0ddbd7e632099fe1e282f6432bc960
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove BaseYangTypesProvider
Robert Varga [Thu, 15 Jul 2021 11:19:33 +0000 (13:19 +0200)]
Remove BaseYangTypesProvider

This provider is rather unused, collapse it into its sole caller and
eliminate its test.

Change-Id: I41b239babd696fe1e8be6872764bcab93c6b9dd1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove useless TypeProvider tests
Robert Varga [Thu, 15 Jul 2021 10:48:21 +0000 (12:48 +0200)]
Remove useless TypeProvider tests

These tests are just testing null arguments, remove them.

Change-Id: I97a1b87c655fe5159a17ab0d0c07c63d234e380a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup BindingGeneratorUtilTest
Robert Varga [Thu, 15 Jul 2021 10:35:52 +0000 (12:35 +0200)]
Cleanup BindingGeneratorUtilTest

We have a number of tests which should be in binding-spec-util,
move them around.

Change-Id: I76900f1f0c87401cf6d4e0b84b8340edbd116f22
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.1-SNAPSHOT
Robert Varga [Fri, 25 Jun 2021 14:50:59 +0000 (16:50 +0200)]
Bump versions to 8.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I42188134fea033a8af370b12784035554a975c6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoLock down mdsal-binding-generator
Robert Varga [Fri, 25 Jun 2021 14:46:22 +0000 (16:46 +0200)]
Lock down mdsal-binding-generator

Expose only the bare minimum API surface from generator, requiring
downstreams to use proper injection.

Change-Id: I7552c90c4d9524b783a627fe883ed31b69ba9274
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoTest self-referencing leafrefs
Robert Varga [Fri, 25 Jun 2021 13:22:36 +0000 (15:22 +0200)]
Test self-referencing leafrefs

Our refactor has lost the ability to detect self-referencing leafrefs.
Add that capability back and activate the relevant unit test.

Change-Id: Idcc09c1a41560588cb8db3974caa8cc4047aa7ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor mdsal-binding-generator artifacts
Robert Varga [Fri, 25 Jun 2021 09:53:52 +0000 (11:53 +0200)]
Refactor mdsal-binding-generator artifacts

Generator artifacts have a layout which belies their actual purpose,
as exposed after mdsal-binding-generator-impl refactor.

mdsal-binding-generator-impl is renamed to mdsal-binding-generator,
absorbing BindingGenerator from the API artifact.

mdsal-binding-generator-{api,util} are renamed to
mdsal-binding-model-{api,ri}, with generator-specific utilities being
moved to mdsal-binding-generator.

This change makes it easier to integrate
mdsal-binding-java-api-generator, as we can directly depend on
mdsal-binding-generator.

Change-Id: Idb8591771837175128e05febb4614d624dca03fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoHide binding.model.api.DefaultType
Robert Varga [Fri, 25 Jun 2021 08:55:27 +0000 (10:55 +0200)]
Hide binding.model.api.DefaultType

Expose DefaultType only from Type.of() static factory methods and adjust
its implementation to remove open-coded toString() methods.

Change-Id: Iaa3c0a7c117f12235a18e75512d9974403ab7f24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup BindingReflections.getModuleInfo()
Robert Varga [Thu, 24 Jun 2021 12:35:13 +0000 (14:35 +0200)]
Cleanup BindingReflections.getModuleInfo()

Simplify callers by throwing only IllegalStateExceptions, i.e.
properly catching our internal errors.

Change-Id: I900f3f1ed1236e54a66ed17c093df6a1c855be50
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump byte-buddy to 1.11.5
Robert Varga [Wed, 2 Jun 2021 08:20:14 +0000 (10:20 +0200)]
Bump byte-buddy to 1.11.5

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.11.1
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.11.2
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.11.3
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.11.4
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.11.5

Also remove ByteBuddyUtils.loadThis(), as it is no longer needed.

Change-Id: I1e32f6d552ce5f1bca1ad71158cb03e1fbfda261
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDo not hash augmentation keys
Robert Varga [Thu, 24 Jun 2021 09:20:30 +0000 (11:20 +0200)]
Do not hash augmentation keys

We do not want to take into account augmentation identity for
hashCode(), as that prevents equivalent augmentation lookups.

This is not a complete solution, as equality still indicates non-equal,
but that's better than what we have.

JIRA: MDSAL-667
Change-Id: I1f4d7122534c175aff6e0d7da27c877d7493f92f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove superfluous plugin dance
Robert Varga [Thu, 24 Jun 2021 10:12:15 +0000 (12:12 +0200)]
Remove superfluous plugin dance

FileGenerator-driven directories are maintained by yang-maven-plugin
itself, there is no need to twiddle with directories here.

Change-Id: I819c622c1816e9f4d4663a68ab20f7187c0ee346
JIRA: MDSAL-232
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup mdsal-binding-dom-codec-osgi dependency
Robert Varga [Wed, 23 Jun 2021 19:18:12 +0000 (21:18 +0200)]
Cleanup mdsal-binding-dom-codec-osgi dependency

We are relying on mdsal-binding-dom-codec-spi only, hence we can lower
the dependency.

JIRA: MDSAL-672
Change-Id: If6950aabd833703062c77ea624b621a64aa64c82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup mdsal-binding-dom-codec dependencies
Robert Varga [Wed, 23 Jun 2021 19:09:46 +0000 (21:09 +0200)]
Cleanup mdsal-binding-dom-codec dependencies

We do not need to bring in mdsal-binding-generator-util, as that is only
used by mdsal-binding-generator-impl.

JIRA: MDSAL-672
Change-Id: I5ef15bb2b4d0c6a12606b6b2995ad30f2820c942
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd non-null getters for leaf objects
Konstantin.Nosach [Wed, 25 Nov 2020 12:07:32 +0000 (14:07 +0200)]
Add non-null getters for leaf objects

DTO getters inherently return nullable objects. We have a nonnullFoo()
concept, which is very powerful with Lists/Maps, where we return an
empty collection. This turns out to be very useful for end users, who
can worry about other logic problems instead.

This patch introduces a similar construct for non-complex getters, so
that

  container foo {
    leaf bar {
      type string;
    }
  }

ends up generating a default method:

  interface Foo {
    default @NonNull String requireBar() {
        // ..
    }
  }

which nicely throws an exception distinct from NPE and retaining call
site.

JIRA: MDSAL-602
Change-Id: Ia66ee61f51fb9b6eb11aea3736e5246aadad6a3e
Signed-off-by: Kostiantyn Nosach <kostiantyn.nosach@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove unified documentation generator
Robert Varga [Wed, 23 Jun 2021 12:25:42 +0000 (14:25 +0200)]
Move unified documentation generator

maven-sal-api-gen-plugin is not really useful anymore, move its
sole remaining generator into dom's unified-html-generator. It
also is deprecated, since it's never been actually used.

JIRA: MDSAL-232
Change-Id: Id6ed104ca6171d9c3d3b1d9be260211bc6e089a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRename additionalConfiguration
Robert Varga [Wed, 23 Jun 2021 09:51:44 +0000 (11:51 +0200)]
Rename additionalConfiguration

Since we are using FileGeneratorFactory, the configuration map is our
only source of configuration, rename arguments to match that.

JIRA: MDSAL-232
Change-Id: I5da112835906e070ae9016fd62f72459b9e6f4de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse FileGenerator for java-api-generator
Robert Varga [Sun, 11 Nov 2018 20:19:16 +0000 (21:19 +0100)]
Use FileGenerator for java-api-generator

Do not use deprecated BasicCodeGenerator interface to interact with
yang-maven-plugin. Using FileGenerator allows us to decouple lifecycle
and eliminate a bit of duplication.

JIRA: MDSAL-232
Change-Id: I04931ff6f70f548de5a49042201283c7e503f92e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMake JavaFileTemplate.importedName() identify all name collisions.
Iaroslav [Wed, 23 Dec 2020 10:23:54 +0000 (12:23 +0200)]
Make JavaFileTemplate.importedName() identify all name collisions.

Refactor xtend files to use importedName instead of fillyQualifiedName
to prevent full package path in generated files.

JIRA: MDSAL-649
Change-Id: I569f46bb095512274b28c0decd5d2d2eefe7f7dd
Signed-off-by: Iaroslav Kholiavko <iaroslav.kholiavko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix UnionTypeCodec.loader() expectations
Robert Varga [Mon, 21 Jun 2021 10:15:11 +0000 (12:15 +0200)]
Fix UnionTypeCodec.loader() expectations

A union type can be derived via a typedef, in which case we will
not see a top-level RuntimeGeneratedUnion. Update the loader to walk
the inheritence hierarchy to locate union types.

Change-Id: I664c21c0400140c1f02a7c48f455608751ddd072
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump to yangtools-7.0.3
Robert Varga [Sat, 19 Jun 2021 09:27:32 +0000 (11:27 +0200)]
Bump to yangtools-7.0.3

Pick up fixes from upstream.

Change-Id: Iad48c8176c3c91e79552266e2943c80e09e0a3bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoTreat wildcards as objects
Robert Varga [Wed, 16 Jun 2021 09:11:59 +0000 (11:11 +0200)]
Treat wildcards as objects

The effort to properly specialize leafref values has created
opportunities for WildcardType to be reported as the return. Handle
these as Objects for now, but also issue FIXMEs for a follow-up proper
fix.

JIRA: MDSAL-668
JIRA: MDSAL-670
Change-Id: I4e8a6ff3aa23a3e94c1ec4a52726e9caf9e9c4ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUpdate CodecDataObjectGenerator FIXME
Robert Varga [Wed, 16 Jun 2021 09:18:31 +0000 (11:18 +0200)]
Update CodecDataObjectGenerator FIXME

We have an issue tracking the activation of Fixed generator, make sure
the FIXME is referencing it.

JIRA: MDSAL-443
Change-Id: Id5af6daa7ee777592b214085dbe61fecc4ac8305
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix union losing patterns
Robert Varga [Wed, 9 Jun 2021 20:34:46 +0000 (22:34 +0200)]
Fix union losing patterns

Union typedefs need to generate type enforcement patterns for their
constituent types. Make sure that happens.

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