mdsal.git
2 years agoAdd yang-ext:mount extension 98/96498/1
Robert Varga [Wed, 9 Jun 2021 08:54:38 +0000 (10:54 +0200)]
Add yang-ext:mount extension

We are gratiously refering to yang-ext:mount all over the place, without
the construct being actually defined. Add a proper definition so that
our data/schema processing can be correctly hooked into it.

JIRA: MDSAL-665
Change-Id: Ib6076060d693955be236d548e07fca1c88016b5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump yangtools to 7.0.2 49/96449/1
Robert Varga [Tue, 8 Jun 2021 07:13:20 +0000 (09:13 +0200)]
Bump yangtools to 7.0.2

Adopt released version instead of temporary snapshot.

Change-Id: I00fbc1099046cc3ecd229342169cc08e2a3ca50f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDo not use a static String reference in length enforcer 42/96342/1
Robert Varga [Fri, 21 May 2021 11:13:11 +0000 (13:13 +0200)]
Do not use a static String reference in length enforcer

LengthGenerator is making the mistake of having a static reference
to java.lang.String without FQCN. This breaks down if String is
overridden by definition context.

Fix this by using importedName(Type) to emit a properly-scoped
reference.

JIRA: MDSAL-664
Change-Id: I16b12865448bde807f0afd0d35e3145f8b6359c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoReenable mdsal533 test 41/96341/1
Robert Varga [Mon, 24 May 2021 19:58:34 +0000 (21:58 +0200)]
Reenable mdsal533 test

For some reason we lost @Test here, make sure we reinstate it.

Change-Id: I879179761ff33e85dbb4579ed4643db6726b3efe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump upstreams 37/96337/1
Robert Varga [Mon, 24 May 2021 16:53:38 +0000 (18:53 +0200)]
Bump upstreams

Adop odlparent-9.0.2 and yangtools-7.0.2-SNAPSHOT to pick up their
bugfixes.

Change-Id: I2394c3bfcd300caeb16530db0783e544476d516c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix submodule resource resolution 86/96286/5
Ivan Hrasko [Thu, 20 May 2021 10:25:37 +0000 (12:25 +0200)]
Fix submodule resource resolution

Initial integration with yangtools-6.0.0 has changed the resource
resolution logic. Unfortunately the lambda instroduced in
Ifa9780fbdfb411b4613df0ee18407d85e81bd517 incorrectly passed 'module'
and not the requested entity to the resolver -- leading to all
submodules to open their module's resource instead.

Fix the lambda and also add proper asserts to check resources are being
open correctly.

JIRA: MDSAL-663
Change-Id: I293f20c15426490a97bb70b4303f0c7b23114c82
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix CollisionDomain chaining 09/96109/1
Robert Varga [Mon, 10 May 2021 19:21:37 +0000 (21:21 +0200)]
Fix CollisionDomain chaining

A simple augmentation of RPC input fails becase we end up having a
secondary (augment) being attached to another secondary (input), which
triggers a verify error.

Generalize the concept of having secondaries, so that we can have a
secondary -> secondary transition.

Change-Id: I2c1ca5b5473d3db56516385f4957ff11dcf512a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate yangtools to 7.0.1 91/96091/1
Robert Varga [Sun, 9 May 2021 05:12:38 +0000 (07:12 +0200)]
Update yangtools to 7.0.1

We have an upstream release, use it instead of snapshots.

Change-Id: I78f5726fb0754dcedc18cdebc680b12d948e82d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 9.0.1 84/96084/1
Robert Varga [Sat, 8 May 2021 19:48:01 +0000 (21:48 +0200)]
Bump odlparent to 9.0.1

Adopt bugfixes from upstream.

Change-Id: I781263f3803a00ade5b8d49e17c0ffa0155ad86e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRestore getter reference discriptions 78/96078/1
Robert Varga [Sat, 8 May 2021 16:58:24 +0000 (18:58 +0200)]
Restore getter reference discriptions

Previous update has lost propagation type method, make sure we restore
this functionality.

Change-Id: Iedb48d502525024adb9cc5b163384507255cbe47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump to odlparent-9.0.0/yangtools-7.0.1-SNAPSHOT 97/94297/90
Robert Varga [Tue, 22 Dec 2020 21:01:36 +0000 (22:01 +0100)]
Bump to odlparent-9.0.0/yangtools-7.0.1-SNAPSHOT

Aside from the usual mechanical updates, we need to also rewrite
mdsal-binding-generator-impl, as its mechanics relied completely on
TypeDefinition.getPath(), which is no longer available.

The rewritten component is a wee bit more navigable, making a number of
deficiencies clearly visible. These are marked as FIXMEs for future
improvements.

One such problem arises when we attempt to create a derived type from an
enumeration: here we ended up generating an empty DTO rather than
properly specializing the type. Attempting to retain compatibility would
be fruitless, as it would violate a number of method signatures.

Furthermore leafref resolution is made stricter, requiring that
references actually point to a leaf, not to a random location -- which
was true in abstract-topology@2013-02-08.yang test model.

Another change revolves around nested union types. These previously
ended up being flattened in the class hierarchy, i.e. siblings of the
generated type and enclosed in the top-level type. Refactored code
structure is showing this is inconsistent, as bits/enums end up not as
siblings, but rather normal enclosed types.

This patch leaves a bit of dead code, deactivated test cases as well as
a few uncaught codegen regressions. These will be rectified by follow-up
patches.

JIRA: MDSAL-503
Change-Id: I40c445aa1d3f79fd55f6e8007db1259d9a09c8d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove RpcRoutingStrategyTest 53/96053/1
Robert Varga [Sat, 8 May 2021 10:57:52 +0000 (12:57 +0200)]
Improve RpcRoutingStrategyTest

Rather than relying on mocking and reflection and overall ugliness,
refactor the test to work with proper parser, really making it an
integration thing.

Change-Id: I8efbbd56d1648e3bc663aaf4de96400ee21bfe58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCentralize union/leafref naming 21/96021/2
Robert Varga [Fri, 7 May 2021 13:41:58 +0000 (15:41 +0200)]
Centralize union/leafref naming

We have open-coded dependency between dom-codec and generator-impl where
union member naming is concerned. The entire glue here is rather funky
and flaky, make sure the construction is captured in BindingMapping and
use the magic from there.

Change-Id: I3e19f41b7bab8b8431beae37e4e712e09153e883
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMake sure we re-export yangtools.util 12/96012/1
Robert Varga [Thu, 6 May 2021 08:47:30 +0000 (10:47 +0200)]
Make sure we re-export yangtools.util

ExceptionMapper is declared as a public element, we should be using
'requires transitive' to keep downstreams safe.

Change-Id: I8f2ffd4c2b7365675f3c62f19542bdf41060b1ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSimplify YangSourceDefinition 82/95982/1
Robert Varga [Tue, 4 May 2021 10:32:18 +0000 (12:32 +0200)]
Simplify YangSourceDefinition

We can use asEffectiveStatement() instead of guessing, make the code
flow more obvious.

Change-Id: Ie249bcc05820f7670fab86e9b0e4cfd1dbfa43ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove binding-dom-codec assertions 66/95966/1
Robert Varga [Fri, 30 Apr 2021 15:44:33 +0000 (17:44 +0200)]
Improve binding-dom-codec assertions

We are using a plain checkState(boolean), improve it with a message,
to get some diagnostic when things go wrong.

Change-Id: Ided7ba1f546ea8b861cbb2ec99fae5a8305e97eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove mdsal-binding-java-api-generator asserts 63/95963/1
Robert Varga [Fri, 30 Apr 2021 09:18:48 +0000 (11:18 +0200)]
Improve mdsal-binding-java-api-generator asserts

Use proper assertNotNull() and also be more defensive about type
ordering.

Change-Id: If1ea743a85d8a4bc24db857efa9a8e2ddb2c8791
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove CompilationTest assertions 61/95961/1
Robert Varga [Wed, 28 Apr 2021 18:24:38 +0000 (20:24 +0200)]
Improve CompilationTest assertions

Annotation assertions could use a bit of love, fix that.

Change-Id: I10b5ea21d50a74c198f1565025e6fb4af6877b6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix context-reference test 60/95960/1
Robert Varga [Wed, 28 Apr 2021 17:33:08 +0000 (19:33 +0200)]
Fix context-reference test

The test relies on overly-broad definition of context reference, but we
should only be binding to yang-ext. Fix that.

Change-Id: I43d6beecf2af50f275408fb103b60fbe4633dbee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd an BitAndUnionTOEnclosingTest assert 45/95945/2
Robert Varga [Mon, 26 Apr 2021 19:20:18 +0000 (21:20 +0200)]
Add an BitAndUnionTOEnclosingTest assert

We want to assert the number of enclosed types here, not just blindly
search through them.

Change-Id: I0985842fb2f93847d84467fe86fcdbdd08419a27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump byte-buddy to 1.11.0 26/95826/1
Robert Varga [Mon, 19 Apr 2021 08:40:23 +0000 (10:40 +0200)]
Bump byte-buddy to 1.11.0

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.10.21
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.10.22
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.11.0

Change-Id: I1d31c7b5297fd28b13297aa44c03593770fc7409
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSimplify mdsal-yanglib injection 97/95797/1
Robert Varga [Sat, 17 Apr 2021 19:28:16 +0000 (21:28 +0200)]
Simplify mdsal-yanglib injection

We now have constructor-based injection, hence we do not need a separate
OSGi proxy. Remove those proxies along with their shared substrate.

Change-Id: I923d7b09661d4d75bc1db4df66c7f8b751effed0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFixup checkstyle 64/95764/1
Robert Varga [Tue, 13 Apr 2021 14:14:19 +0000 (16:14 +0200)]
Fixup checkstyle

Updated checkstyle is finding a few violations, fix them up.

Change-Id: Iaf95fde682ed8b1f0bcfd567b67aff90b1eb414a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove osgi.annotation declaration 63/95763/1
Robert Varga [Tue, 13 Apr 2021 14:18:07 +0000 (16:18 +0200)]
Remove osgi.annotation declaration

We are getting this declaration from odlparent, remove it.

Change-Id: Ifb5348fe98c7fb81a905ea31a995cf90cd2c7694
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSwitch to com.guicedee.services/javax.inject 62/95762/1
Robert Varga [Tue, 13 Apr 2021 14:00:44 +0000 (16:00 +0200)]
Switch to com.guicedee.services/javax.inject

odlparent is removing the declaration of this old artifact, switch
to using the GuicedEE version.

Change-Id: I5acddef14039fe6b1558748636a7c25348569008
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup yang model whitespace 53/95753/3
Robert Varga [Mon, 12 Apr 2021 16:39:57 +0000 (18:39 +0200)]
Cleanup yang model whitespace

We have a ton of trailing whitespace, clean it up.

Change-Id: Ib7f5ae567b83f5b5172386fc496728e8c48131c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix Mdsal302Test's name 50/95750/1
Robert Varga [Mon, 12 Apr 2021 11:28:57 +0000 (13:28 +0200)]
Fix Mdsal302Test's name

The method here has been copy&pasted, causing some confusion. Fix its
name.

Change-Id: If757faeed90dc40c059723d3f50070c1a6a78029
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate ExtendedTypedefTest 46/95746/1
Robert Varga [Mon, 12 Apr 2021 08:06:43 +0000 (10:06 +0200)]
Update ExtendedTypedefTest

Capture properties to make asserts a bit clearer.

Change-Id: I5deba6a41a24b7c64f0dcc2faf7f8f3510236402
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd 'var', 'yield' and 'record' to Java reserved words 33/84133/5
Robert Varga [Mon, 2 Sep 2019 15:50:50 +0000 (17:50 +0200)]
Add 'var', 'yield' and 'record' to Java reserved words

Update reserved words with:
- var, which is reserved since Java 10
- yield, which is reserved since Java 14
- record, which is reserved since Java 16

Change-Id: Ia3455cf60d5afa4b83dfb5cb92364a2d1a6bfb7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSkip java-api-generator tests when running on windows-type OS 84/95684/4
Oleksii Mozghovyi [Tue, 6 Apr 2021 20:06:27 +0000 (23:06 +0300)]
Skip java-api-generator tests when running on windows-type OS

Xtend code generation uses the "line.separator" system property to
generate proper line endings, and there is no possibility to override
this setting w/o modifying the system property. This change disables
some tests to avoid misleading failures when running those on the
windows type os.

Change-Id: I8c9b2776d45a149debe3948ef0d2ce8a682c79d6
Signed-off-by: Oleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove Constant.toFormattedString() 88/95688/2
Robert Varga [Wed, 7 Apr 2021 11:08:19 +0000 (13:08 +0200)]
Remove Constant.toFormattedString()

This method is not really used anywhere and actually is a remnant of the
original PoC. Remove it.

Change-Id: I5e26ea57a98a24085e947ac6bec477d4b8c097bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup GeneratedTypeBuilder/enclosing mechanics 82/95682/3
Robert Varga [Tue, 6 Apr 2021 11:18:59 +0000 (13:18 +0200)]
Cleanup GeneratedTypeBuilder/enclosing mechanics

Rather than requiring a Builder to enclose types, use an already-built
type. This allows splitting out the product phases.

Change-Id: I8bcebb1a010272eadd065cff465d16bbc5992043
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove parent type references 81/95681/1
Robert Varga [Tue, 6 Apr 2021 11:52:28 +0000 (13:52 +0200)]
Remove parent type references

Requiring Constant, Enumeration, GeneratedType and TypeMember to
report its enclosing/parent type leads to circular dependencies, as
the parent type needs to report the objects as well. This leads to
the requirement to perform callouts from constructor -- utterly fusing
parents and children together.

As it turns out, though, these references are not used anywhere and
hence we can completely ditch them.

Change-Id: Ic9bfa6d0b69ffa3bdc1cd02c824405c9e22d0375
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove AbstractTypesTest 64/95664/1
Robert Varga [Sat, 3 Apr 2021 15:59:00 +0000 (17:59 +0200)]
Remove AbstractTypesTest

The test harness used here is quite funky and prone to errors if there
are things like vim temporary files. Use the method dedicated to this
particular uses case, making things simpler and more reliable.

Change-Id: I4320869672ee4949fb18b7cb18aed81a7d548fb2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove asserts in AugmentRelativeXPathTest 32/95632/1
Robert Varga [Thu, 1 Apr 2021 10:37:25 +0000 (12:37 +0200)]
Improve asserts in AugmentRelativeXPathTest

Assertions are very simplistic here, leading to unhelpful reports when
things fail. Improve that.

Change-Id: I389392d1f3b93a62e7b765a96b3feb3bbd587156
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove asserts in IdentityrefTypeTest 27/95627/1
Robert Varga [Wed, 31 Mar 2021 20:45:26 +0000 (22:45 +0200)]
Improve asserts in IdentityrefTypeTest

We have a few useless iterations and indirect asserts. Replace them with
linear code and more closely matched asserts to aid failure diagnostics.

Change-Id: If75e20c56432f49113ac3dcd02b6e823026a0907
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove GenEnumResolvingTest asserts 26/95626/1
Robert Varga [Wed, 31 Mar 2021 20:27:30 +0000 (22:27 +0200)]
Improve GenEnumResolvingTest asserts

Use assertThat(instanceOf()) to make failures more descriptive.

Change-Id: I279bda5ff8622b46441e1caa4464c1cc7f95b4cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove Mdsal500Test assert 25/95625/1
Robert Varga [Wed, 31 Mar 2021 13:12:31 +0000 (15:12 +0200)]
Improve Mdsal500Test assert

We are performing a blind offset get, make sure we validate the name of
generated type to catch any mismatches.

Change-Id: I239df35502493e0f54db8524ed4e7714c87393c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix Mdsal554Test asserts 21/95621/2
Robert Varga [Wed, 31 Mar 2021 11:53:03 +0000 (13:53 +0200)]
Fix Mdsal554Test asserts

The assertions here are using the wrong order, causing confusion
on failures. Clean them up.

Change-Id: I2944ae69c854a76df5524f0c6e58a98b53a9d9b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSimplify BinaryTypeTest 22/95622/1
Robert Varga [Wed, 31 Mar 2021 12:04:28 +0000 (14:04 +0200)]
Simplify BinaryTypeTest

We have a very simple utility method to achieve the same thing the test
is doing for models. Simplify it by using a common method.

Change-Id: Ib2311f0f9998f2f42a0b196b5b37fd63be46f048
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove UnionTypeDefTest asserts 19/95619/2
Robert Varga [Wed, 31 Mar 2021 11:18:25 +0000 (13:18 +0200)]
Improve UnionTypeDefTest asserts

Test structure here is less than optimal, having implicit assumptions
and very weak asserts. Improve the situation.

Change-Id: I6024b00de594df41201b6cd7f358b87fb3b2c55f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove GenerateInnerClassForBitsAndUnionInLeavesTest 16/95616/2
Robert Varga [Wed, 31 Mar 2021 10:13:19 +0000 (12:13 +0200)]
Improve GenerateInnerClassForBitsAndUnionInLeavesTest

The assertion structure here is less than optimal, make sure we have
proper size and type asserts, without going through global booleans.

Change-Id: I3609fe7ab6089385a296f623351d6e6bdace5229
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove asserts in Mdsal500Test 12/95612/1
Robert Varga [Tue, 30 Mar 2021 19:08:00 +0000 (21:08 +0200)]
Improve asserts in Mdsal500Test

We are accessing methods blindly here, assert size.

Change-Id: Ia46a31dae0ad63aa898b82a0b7efd32497a11393
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix Netty replication components 84/95584/3
Robert Varga [Sun, 28 Mar 2021 19:53:22 +0000 (21:53 +0200)]
Fix Netty replication components

We should have a public no-arg constructor, fix that. Also fix general
lifecycle issues in deregistration paths.

JIRA: MDSAL-662
Change-Id: I928f1f5486b6edc8a62ed006431b7c5f06ddf986
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoImprove GroupingDefinitionDependencySort 79/95579/1
Robert Varga [Fri, 26 Mar 2021 14:07:22 +0000 (15:07 +0100)]
Improve GroupingDefinitionDependencySort

The sort class does not actually have any state, hence we can convert it
to a utility class with a single public static method.

Change-Id: I7896e625bc47e54b3126c4d5f47c433a1ebebcb4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove more test yangs 77/95577/1
Robert Varga [Fri, 26 Mar 2021 11:47:13 +0000 (12:47 +0100)]
Move more test yangs

We have a few superfluous directories with a single YANG file only.
Move the files so that we have flatter directory layout.

Change-Id: I4d9d01025d1a64f2e344d04bff2f1942310eba27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove bug8449.yang 63/95563/1
Robert Varga [Thu, 25 Mar 2021 21:32:13 +0000 (22:32 +0100)]
Move bug8449.yang

There is no need to have a dedicated directory for a single model,
simplify our layout, fixing Eclipse UT execution in the process.

Change-Id: I147c923a1137443b81a3715a89d3a67803bc264f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBindingGenerator methods return GeneratedTypes 62/95562/3
Robert Varga [Thu, 25 Mar 2021 15:47:47 +0000 (16:47 +0100)]
BindingGenerator methods return GeneratedTypes

The documentation is explicit here and implementation does exactly
this. Update return types to reflect this, which allows us to simplify
at least tests.

Since we are touching tests, improve their assertions by asserting the
number of generated types rather than blanket
assertFalse(types.isEmpty()).

Change-Id: I62a44f0b39f17c26334ade4af2a96337f3ad6504
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup Mdsal554Test 58/95558/1
Robert Varga [Thu, 25 Mar 2021 11:02:21 +0000 (12:02 +0100)]
Cleanup Mdsal554Test

We are shifting modules here, stop doing that. Also assert the number of
types generated before touching any offset.

Change-Id: I5f457fcab5340ad30d9246e92dddf7c473d42220
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup asserts in GeneratedTypesTest 57/95557/1
Robert Varga [Thu, 25 Mar 2021 10:55:54 +0000 (11:55 +0100)]
Cleanup asserts in GeneratedTypesTest

We are making some iffy assert choices here, leading to errors rather
than test failures. Refactor asserts a bit, so we have logically safe
code.

Change-Id: I2673ab81a93eae718a2cd8e99e67af91c8cd03e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix asserts in BindingGeneratorImplTest 56/95556/1
Robert Varga [Thu, 25 Mar 2021 10:31:47 +0000 (11:31 +0100)]
Fix asserts in BindingGeneratorImplTest

Assertions here are the 'assertTrue()' kind, where they really can be
much more expressive. Fix that, making failures easier to diagnose.

Change-Id: I4a244d9633e314bbf92b9d8cc1632c1058a59afd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove unused TypeProvider methods 55/95555/2
Robert Varga [Thu, 25 Mar 2021 08:34:36 +0000 (09:34 +0100)]
Remove unused TypeProvider methods

There are three methods related to source code, which are no longer
used by anyone:
- getConstructorPropertyName(SchemaNode node);
- getParamNameFromType(TypeDefinition<?> type);
- getTypeDefaultConstruction(LeafSchemaNode node);

These were useful for Config Subsystem a long time ago, but since its
removal they have no users. Their implementation is a rather big chunk
of unused code, which is a pure maintenance burden. Remove them.

Change-Id: Ic6419b0f65c9575dc593a3c32d01b53edffb8530
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCentralize Data/Listener/Service suffixes 51/95551/1
Robert Varga [Wed, 24 Mar 2021 13:57:24 +0000 (14:57 +0100)]
Centralize Data/Listener/Service suffixes

We have a central place for these strings in BindingMapping,
make sure we do not duplicate their definition.

Change-Id: I2c7e74830668cf9e3e0fd92ecadef0d3cc2a58d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoModernize DOMForwardedWriteTransactionTest 65/95365/2
Robert Varga [Fri, 26 Feb 2021 09:38:04 +0000 (10:38 +0100)]
Modernize DOMForwardedWriteTransactionTest

Use proper assertions instead of try/catch blocks, fail()s and
assertTrue()s.

Change-Id: Ife42d56c54f725d2cf842b429c552172dfce429d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix String length checker 31/95331/5
Robert Varga [Wed, 24 Feb 2021 00:11:08 +0000 (01:11 +0100)]
Fix String length checker

We are enforcing length restrictions on String.length(), which is
the wrong measure, as it returns the number of code units in the
String. We actually want to compare the number of code points, i.e.
we need to use String.codePointCount().

JIRA: MDSAL-661
Change-Id: I7291aabb67ec9d002cdeb52befd1723707113121
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent/yangtools to 8.1.1/6.0.5 52/95352/1
Robert Varga [Wed, 24 Feb 2021 15:35:58 +0000 (16:35 +0100)]
Bump odlparent/yangtools to 8.1.1/6.0.5

Adopt latest versions.

Change-Id: I2bc8323184ac482daf59812b907b3c4ecd27f025
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove an unused import 30/95330/1
Robert Varga [Wed, 24 Feb 2021 00:08:12 +0000 (01:08 +0100)]
Remove an unused import

This is an xtend/java warning, fix it.

Change-Id: Iedb1472972de60e2074d1adf967815129705c08d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDocument usage of Binding Query Language 09/94809/7
Konstantin.Nosach [Tue, 26 Jan 2021 10:50:33 +0000 (12:50 +0200)]
Document usage of Binding Query Language

Adds documentation specific to the developer guide:
- Compears two approaches for retrieving data from storage
- Read-like operation (old one approach)
- Query-like operation (new one approach)

JIRA: MDSAL-656
Change-Id: Ie84224a584256f411d63b0ecb900f341f9fa3d35
Signed-off-by: Kostiantyn Nosach <kostiantyn.nosach@pantheon.tech>
3 years agoRehost CompatUtils 05/95105/1
Robert Varga [Wed, 10 Feb 2021 07:17:53 +0000 (08:17 +0100)]
Rehost CompatUtils

The decisions as to what to do about TypeDefinitions is inherently
ours, let's get a copy of CompatUtils so we can evolve it rather
than relying on yangtools to give us the right thing.

JIRA: YANGTOOLS-1216
Change-Id: I7c0be728043837b86c879b13b6f3d0e5578c2dc5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove DOMDataTreeShard and all related interfaces 96/95096/2
Robert Varga [Tue, 9 Feb 2021 17:24:27 +0000 (18:24 +0100)]
Remove DOMDataTreeShard and all related interfaces

All the APIs related to producer/consumers have been deprecated,
now remove them to reduce clutter.

JIRA: MDSAL-660
Change-Id: I55f567c3f280e33fdcea78b585e604d218944a50
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDo not generate 'isFoo()' methods 73/94273/11
Robert Varga [Fri, 18 Dec 2020 17:28:28 +0000 (18:28 +0100)]
Do not generate 'isFoo()' methods

Remove compatibility boolean getter generation, i.e.
'Boolean getFoo()' methods no longer get 'Boolean isFoo()' siblings.

JIRA: MDSAL-659
Change-Id: Ib7111ea600296ce1d55730c1d9c754abf3f4f78b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove deprecated uint migration elements, take 2 48/95048/3
Robert Varga [Fri, 5 Feb 2021 16:31:21 +0000 (17:31 +0100)]
Remove deprecated uint migration elements, take 2

It's been 18 months since we introduced this particular change in
mapping, giving ample time for users to migrate.

Remove code generated to support uint8/16/32/64 mapping transition,
so that users are forced to interface with proper types.

JIRA: MDSAL-490
Change-Id: I03c80a92dbb6bb429b5bd939cb2068a0289defc5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove setFoo(List) compatibility setters 29/91429/6
Robert Varga [Sun, 19 Jul 2020 12:00:58 +0000 (14:00 +0200)]
Remove setFoo(List) compatibility setters

A migration setter was present to eash downstream users'
migration from List<Foo> to Map<FooKey, Foo>. This is no longer
necessary, remove the setter.

JIRA: MDSAL-540
Change-Id: I587ff1eaf81fca912cdb0c1370d1fd7ecd248d7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Illia <illia.ihushev@pantheon.tech>
3 years agoBump versions to 8.0.0-SNAPSHOT 34/95034/1
Robert Varga [Fri, 5 Feb 2021 08:13:21 +0000 (09:13 +0100)]
Bump versions to 8.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: I345d38f8e9e77aba90fa00a6282a59668abf8d97
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate byte-buddy integration 06/95006/2
Robert Varga [Wed, 3 Feb 2021 09:16:53 +0000 (10:16 +0100)]
Update byte-buddy integration

Update ByteBuddy to 1.10.20.

Reuse ElementMatcher for isDefaultConstructor(), lowering
the amount of garbage we potentially generate. While we are at it
make sure our intra-package use patters are more consistent.

Change-Id: I5cc297129c4b04eade4d1a8a9dfb96cd8504554e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 7.0.6-SNAPSHOT 88/94788/1
Robert Varga [Mon, 25 Jan 2021 14:44:18 +0000 (15:44 +0100)]
Bump versions to 7.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I9981dbfe7447c995cfad982d5bb2108b470e066d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDeprecate mdsal-dom-api tests 73/94773/1
Robert Varga [Sun, 24 Jan 2021 14:07:18 +0000 (15:07 +0100)]
Deprecate mdsal-dom-api tests

This is a follow-up to Producer/Consumer APIs being deprecated. Also
DOMExceptionsTest does not bring anything to the table.

Change-Id: Ia3919582faca2fb3fc586a5cfb4210122e8f5d33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd query support for decimal64 71/94771/1
Robert Varga [Sun, 24 Jan 2021 13:27:22 +0000 (14:27 +0100)]
Add query support for decimal64

As it turns out we are also missing support for leaves based on
decimal64 type. Add it.

JIRA: MDSAL-652
Change-Id: Id9c8954341492348e0fc36434336c5e522915709
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoNested lists cannot be decoded 37/94737/3
Peter Suna [Fri, 22 Jan 2021 15:53:42 +0000 (16:53 +0100)]
Nested lists cannot be decoded

DOMQueryIterator is a bit confused about the path it is returning,
causing binding codec to fail. As it turns out, we have violated
expected invariants in various places.

JIRA: MDSAL-654
Change-Id: Ibf7466f6f390f517f1186a725c265a88e7266934
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdopt odlparent-8.1.0/yangtools-6.0.4 09/94209/8
Robert Varga [Thu, 21 Jan 2021 13:04:44 +0000 (14:04 +0100)]
Adopt odlparent-8.1.0/yangtools-6.0.4

Adopt OSGi R7 as well by migrating osgi.core pointers to the new
place.

Change-Id: I7351883bd53c40b82abda744d9eefcb49ef183d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix DOMQueryPredicate comparable matches 36/94736/3
Peter Suna [Fri, 22 Jan 2021 15:12:05 +0000 (16:12 +0100)]
Fix DOMQueryPredicate comparable matches

Boundary condition checking is wrong here due negation brainfart:
gte/gt and lte/lt should include/exclude 0, not the other way around.

JIRA: MDSAL-653
Change-Id: Ieaaf5b4fe0367d9e59cd03a2c177898d909e6ce8
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd MatchBuilderPath.BooleanLeafReference 44/94744/2
Robert Varga [Fri, 22 Jan 2021 21:12:12 +0000 (22:12 +0100)]
Add MatchBuilderPath.BooleanLeafReference

This is a notable omission from the interface, allow users to
target Boolean types.

JIRA: MDSAL-652
Change-Id: Ie62f6419bf3db57887797f7bc88f7ec5dfd5f203
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd a Sonar description 31/94631/1
Robert Varga [Thu, 14 Jan 2021 17:54:29 +0000 (18:54 +0100)]
Add a Sonar description

This removes the generic blob we inherit from odlparent with
something more meaningful.

Change-Id: I916a1755dc709566b466e3541ea878c110b8711e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix a few sonar warnings 30/94630/1
Robert Varga [Thu, 14 Jan 2021 17:28:58 +0000 (18:28 +0100)]
Fix a few sonar warnings

Sonar is pointing out a few trivial issues, fix them up.

Change-Id: I6dc7a9d842404f5826279b800763f3044ee5ab9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse doCallRealMethod() instead of when() 40/94540/1
Robert Varga [Sat, 9 Jan 2021 08:51:08 +0000 (09:51 +0100)]
Use doCallRealMethod() instead of when()

We use doReturn() and similar across the board, fix this single
outlier.

Change-Id: I47866407b30613e3af61cd9d429930269cb4e60b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix Javadoc deprecation links 37/94537/1
Robert Varga [Sat, 9 Jan 2021 07:33:29 +0000 (08:33 +0100)]
Fix Javadoc deprecation links

There is a typo in specification of the reference, leading to
this bit being rendered without a link. Fix that.

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

3 years agoBump versions to 7.0.5-SNAPSHOT 99/94499/1
Robert Varga [Fri, 8 Jan 2021 13:35:13 +0000 (14:35 +0100)]
Bump versions to 7.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I2dcf27e5cd4523922a0bda00f9b5ea11e61ed550
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBe more defensive around List types 78/94478/3
Robert Varga [Thu, 7 Jan 2021 16:00:14 +0000 (17:00 +0100)]
Be more defensive around List types

We can end up generating a windcard type, in which case the arguments
will be empty. Use Types.objectType() in that case.

JIRA: MDSAL-651
Change-Id: I5fe15a1cd0eb4f10154c268fea2092dd52cd390a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix javadoc formatting in interfaces 83/94483/1
Robert Varga [Thu, 7 Jan 2021 17:37:55 +0000 (18:37 +0100)]
Fix javadoc formatting in interfaces

We end up generating two periods, fix that.

Change-Id: Ib270c8838ecca1b51b86be6e49633858fbf8af82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate getDataChildByName() users 99/94299/3
Robert Varga [Thu, 24 Dec 2020 13:21:02 +0000 (14:21 +0100)]
Migrate getDataChildByName() users

This method has been deprecated, move to its nullable replacement.

Change-Id: I0c4353701cf423b5c6ae0b52ca5dd96945ceecec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump to odlparent-8.0.3/yangtools-6.0.3 77/94477/1
Robert Varga [Thu, 7 Jan 2021 14:03:40 +0000 (15:03 +0100)]
Bump to odlparent-8.0.3/yangtools-6.0.3

Pick up latest fixes from upstream.

Change-Id: Ia1da11a6d64ee4f12e65e0863057a40f5919973d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix module name reference 23/94323/1
Robert Varga [Thu, 31 Dec 2020 15:14:10 +0000 (16:14 +0100)]
Fix module name reference

Modules use UnqualifiedQName, which borks the javadoc by leaking
its 'toString()' representation. Fix that.

Change-Id: Iad120ff9fdf7e073f079ef8bf9c354fc04d04560
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate mdsal-binding-dom-codec-spi JPMS 07/94307/1
Robert Varga [Thu, 24 Dec 2020 13:40:07 +0000 (14:40 +0100)]
Update mdsal-binding-dom-codec-spi JPMS

We are using checker annotations, mark that in module-info.

Change-Id: Ief86f6f09f07f9ca06a9a62536815682651b94c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDeprecate Producer/Consumer/Sharding APIs 89/94289/1
Robert Varga [Sun, 20 Dec 2020 22:16:25 +0000 (23:16 +0100)]
Deprecate Producer/Consumer/Sharding APIs

These APIs never saw adoption due to their complexity and lack of
applicability in real-world applications. Deprecate them for removal,
as they will be replaced with proper NMDA replacement.

Change-Id: I5c2eb21bde4b5c6b83cb8a0579307bf851a4f5fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate mdsal-dom-api JPMS definition 88/94288/1
Robert Varga [Sun, 20 Dec 2020 21:52:44 +0000 (22:52 +0100)]
Update mdsal-dom-api JPMS definition

We are missing a few references here, fix them up.

Change-Id: I5a43649867883c2301da2eb7482fb4537f7dffc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 7.0.4-SNAPSHOT 84/94284/1
Robert Varga [Sat, 19 Dec 2020 12:11:59 +0000 (13:11 +0100)]
Bump versions to 7.0.4-SNAPSHOT

This starts the next development iteraration.

Change-Id: Iee95c3ba478b52df34ecd9350ca926113cb9c86f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoTag generated classes with Generated annotation 00/94000/9
Iaroslav [Wed, 2 Dec 2020 09:18:34 +0000 (11:18 +0200)]
Tag generated classes with Generated annotation

After this patch @javax.annotation.processing.Generated will be added
to Generated source Java files.

JIRA: MDSAL-597
Change-Id: I377b0be5e4815e428d53a99f9528e46c67e352aa
Signed-off-by: Iaroslav <iaroslav.kholiavko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSpecialize relative leafref types during instantiation 01/88401/86
miroslav.kovac [Wed, 11 Mar 2020 15:42:29 +0000 (16:42 +0100)]
Specialize relative leafref types during instantiation

leaf of relative leafref type declared in grouping could reference
node outside of it. In such case target node of leafref depends on
location where its origin grouping used. Before property from
relative leafref was calculated from its origin grouping and this
property were used at all GeneratedTypes produced from the
grouping users.

When leafref pointed outside of its origin grouping, Object for leaves,
List<?> for leaf-list were used as property type. Now type resolving is
running from locations, where relative leafref is added by uses and its
ancestors grouping do not add a node at the leafref path.

JIRA: MDSAL-426
JIRA: MDSAL-533
Change-Id: I5004f0579778527511b4b028e00f7ab9c3051731
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Ilya Igushev <illia.ihushev@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoChange `is` to `get` in generated classes 48/94148/11
Robert Varga [Fri, 18 Dec 2020 17:08:16 +0000 (18:08 +0100)]
Change `is` to `get` in generated classes

In generated classes for Boolean types getters should be as in other
types. e.g.: `isBoolData` should be `getBoolData`.

We generate compatibility methods, so users have some time to migrate.

JIRA: MDSAL-426
Change-Id: Id7386520484dbedf2b7772ab586b476983ca33f2
Signed-off-by: Iaroslav <iaroslav.kholiavko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix replicate's parent version 43/94243/2
Robert Varga [Tue, 15 Dec 2020 08:25:51 +0000 (09:25 +0100)]
Fix replicate's parent version

We are referencing odlparent at wrong version here, fix that up.

Change-Id: I4506d216d251757e0208dc9abe5629c05ee510cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove getter @Nullable annotations for non-List/Map types 24/94024/4
Iaroslav [Fri, 4 Dec 2020 10:36:44 +0000 (12:36 +0200)]
Remove getter @Nullable annotations for non-List/Map types

In generated types getter will no longer be marked @Nullable annotation
for non List and Map types.

Jira: MDSAL-603
Change-Id: I2ad00e625f652399e184fca1a7a00d3ed36d3dff
Signed-off-by: Iaroslav <iaroslav.kholiavko@pantheon.tech>
3 years agoBump upstream versions 23/94223/1
Robert Varga [Mon, 14 Dec 2020 12:04:20 +0000 (13:04 +0100)]
Bump upstream versions

Adopt odlparent-8.0.2 and yangtools-6.0.2 for the fixes they
contain.

Change-Id: I916bdb3a122f3a368245df2446bb3673b52b1d00
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoEliminate blueprint from replicate-netty 83/93983/9
tadei.bilan [Tue, 1 Dec 2020 12:30:21 +0000 (14:30 +0200)]
Eliminate blueprint from replicate-netty

Replace blueprint with OSGI DS

JIRA: MDSAL-588
Change-Id: Idc9053adac0a7f137727f47297d920878916d6ae
Signed-off-by: tadei.bilan <tadei.bilan@pantheon.tech>
3 years agoFix checkstyle 08/94208/2
Robert Varga [Fri, 11 Dec 2020 10:56:56 +0000 (11:56 +0100)]
Fix checkstyle

Upgraded checkstyle is a bit touchier about anonymous classes,
fix reported violations.

Change-Id: I98d060ed9c44d49ae57f1b9fce33527fa6bcd48d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate ChoiceNodeCodecContext 83/94183/3
Robert Varga [Fri, 11 Dec 2020 02:03:43 +0000 (03:03 +0100)]
Update ChoiceNodeCodecContext

Sonar does not like code in comments, promote them to class
javadoc, which will silence Sonar and is overall a Good Thing(tm).

Change-Id: I0a8150cfbcd9a82abf5e94a2a56c7444634ee9da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix a sonar complaint 88/94188/2
Robert Varga [Fri, 11 Dec 2020 02:41:24 +0000 (03:41 +0100)]
Fix a sonar complaint

Sonar wants us to merge the two if statements, which makes sense.
Also use a method reference instead of a full lambda.

Change-Id: I465ab536ab9b5bedde870b741a47becbc271ca8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd private ServiceLoaderState constructors 87/94187/4
Robert Varga [Fri, 11 Dec 2020 02:24:43 +0000 (03:24 +0100)]
Add private ServiceLoaderState constructors

These three classes are pure field holders, hence they should have
private constructors.

Change-Id: I02818541a7a20808d3fc6f35b56e40c993a9ca94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoShortcut StringBuilder.append(boolean) 86/94186/4
Robert Varga [Fri, 11 Dec 2020 02:19:36 +0000 (03:19 +0100)]
Shortcut StringBuilder.append(boolean)

We are using an if/else statement for a simple boolean append,
refactor it so we pass an expression.

Change-Id: I4924db1276bec0a1e3d2e16e37a8bfe181086422
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix a Sonar logic complaint 85/94185/3
Robert Varga [Fri, 11 Dec 2020 02:14:20 +0000 (03:14 +0100)]
Fix a Sonar logic complaint

Invert the condition so that we can use a simple expression instead
of a if/else.

Change-Id: I8e1662e82706a8c6b6c7884258fe9e6010e4f2b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup DataObjectCodecContext 84/94184/3
Robert Varga [Fri, 11 Dec 2020 02:10:02 +0000 (03:10 +0100)]
Cleanup DataObjectCodecContext

We have an unneeded if/else here, merge it together for better
expresiveness. Also clean up comments a bit and log exceptions
encountered.

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