mdsal.git
2 years agoAdd HexFormat FIXMEs 92/97592/1
Robert Varga [Tue, 21 Sep 2021 23:55:40 +0000 (01:55 +0200)]
Add HexFormat FIXMEs

Add markers where we should be taking advantage of Java 17's new
HexFormat class.

Change-Id: I907502f7c976163ec44df62bf056df282ae9a743
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove OSGiBindingAdapterFactory 10/94210/9
Robert Varga [Fri, 11 Dec 2020 10:57:27 +0000 (11:57 +0100)]
Remove OSGiBindingAdapterFactory

We have constructor injection, hence we do not need a separate
OSGi class for BindingAdapterFactory.

Change-Id: I41eeec3112bc8e745cd3b2db9012f28f57746625
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove generatedTypeForExtendedDefinitionTypeWithIdentityrefBaseTypeTest() 91/97591/1
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 years agoRemove useless test 90/97590/1
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 years agoMove a few more tests 19/97219/7
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 years agoFix OSGiDOMSchemaService lifecycle 46/97546/4
Robert Varga [Mon, 20 Sep 2021 15:39:21 +0000 (17:39 +0200)]
Fix OSGiDOMSchemaService lifecycle

Original refactor specified rather invalid lifecycle for the
OSGiModuleInfoSnapshot dependency -- it is missing the dynamic
binding which was there in one version of the patch set.

Unfortunately the invalid instruction (FieldOption for a method) is not
caught and it is causing a rather weird state, where we end up with a
deactivated service still having listeners firing.

Fix injection lifecycle by having a property DYNAMIC and GREEDY
lifecycle -- which does exactly the right thing, except we need to track
a bit more state to make logging more sane.

JIRA: MDSAL-689
Change-Id: Ia027c45daab528821bee9ae93248d9d7e9ada85d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix raw Component{Factory,Instance} references 45/97545/2
Robert Varga [Mon, 20 Sep 2021 14:47:51 +0000 (16:47 +0200)]
Fix raw Component{Factory,Instance} references

These interfaces are now properly generic, bind them to their
corresponding component.

Change-Id: Ib03ec6cfeee4c10fbbfc5e6e0950d1dd035cecfe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup ReadFailedException 79/97479/1
Robert Varga [Mon, 13 Sep 2021 17:52:13 +0000 (19:52 +0200)]
Cleanup ReadFailedException

Remove redundant type specification and make arguments final.

Change-Id: Ib4791bb47c24bbdc6fb1ab6675d302650103ce43
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a FIXME for method returns 90/97390/4
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 years agoBump versions to 8.0.6-SNAPSHOT 51/97451/1
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 years agoBump odlparent/yangtools 50/97450/1
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 years agoCorrect Generator.findGenerator() return type 97/97397/1
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 years agoCentralize Builder and Key suffixes 92/97392/3
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 years agoMove simple BaseTemplate methods 91/97391/1
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 years agoFix rfc8530 description 49/97349/1
Robert Varga [Fri, 27 Aug 2021 22:22:40 +0000 (00:22 +0200)]
Fix rfc8530 description

We have a mis-reference in the description, fix that.

Change-Id: I8f5ed6b9650adc76ee7b1830c63288a4c643092c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 8.0.5-SNAPSHOT 19/97319/1
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 years agoRename mdsal-dom 18/97318/2
Robert Varga [Tue, 24 Aug 2021 13:34:18 +0000 (15:34 +0200)]
Rename mdsal-dom

This is a pure aggregator, let's rename it to match its siblings. This
does not affect anybody, as it's just a build layout thing.

Change-Id: I515a77722d0f7237d80a0a29c5da2ab231515630
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd karaf distribution 17/97317/3
Robert Varga [Tue, 24 Aug 2021 13:15:07 +0000 (15:15 +0200)]
Add karaf distribution

Add a basic distribution.

Change-Id: I7685fa428e8975e46f149fcab4c088f89716303f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump odlparent/yangtools 16/97316/2
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 years agoBump versions to 8.0.4-SNAPSHOT 01/97301/1
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 years agoBump upstreams 00/97300/1
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 years agoBump versions to 8.0.3-SNAPSHOT 77/97277/1
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 years agoBump upstreams 67/97267/3
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 years agoShorten JavaFileGeneratorFactory's name 42/97242/1
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 years agoDo not guard utility class constructors 40/97240/3
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 years agoRemove ByteBuddyUtils.{ifEq,markLabel} 27/97227/2
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 years agoImprove AdaptingTracker type safety 26/97226/1
Robert Varga [Mon, 16 Aug 2021 16:55:18 +0000 (18:55 +0200)]
Improve AdaptingTracker type safety

Component{Factory,Instance} are generic with OSGi R7, let's take
advantage of that to improve type safety.

Change-Id: Ibe5c7937ad37117bab3492c9a2dfd5b67b972e4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove DynamicBindingAdapter safety 25/97225/1
Robert Varga [Mon, 16 Aug 2021 16:52:20 +0000 (18:52 +0200)]
Improve DynamicBindingAdapter safety

OSGi R7 uses generic ComponentFactory, let's use proper types to
improve safety.

Change-Id: I6a6a06186af825a54199e1576798ed34ba7be7a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a basic test for Dict 24/97224/2
Robert Varga [Mon, 16 Aug 2021 16:43:46 +0000 (18:43 +0200)]
Add a basic test for Dict

Just test common functionality to increase coverage.

Change-Id: Icb41990aa1c884ed86679d4b1bf44f81e1ea73a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove BindingDOMTransactionChainAdapterTest coverage 23/97223/2
Robert Varga [Mon, 16 Aug 2021 16:28:59 +0000 (18:28 +0200)]
Improve BindingDOMTransactionChainAdapterTest coverage

We are not testing merging transaction chains, let's do that through
a few parameters.

Change-Id: I77fb2a9e6fd335afebccc254df741670023f3750
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSupport DOMAction-level routing 14/97114/14
Robert Varga [Mon, 9 Aug 2021 20:36:05 +0000 (22:36 +0200)]
Support DOMAction-level routing

We have a distinct use case where we want to route actions across
a system. In this scenario, a next hop provider registers itself as the
local provider with the appropriate cost.

This capability is also exposed as the simplest way of registering
binding-level implementations -- where we want to register to all
actions on the operational datastore.

Add explicit documentation around how how the arguments are interpreted
and teach DOMRpcRouter about wildcards -- similar to how it deals with
RPCs.

JIRA: MDSAL-681
Change-Id: I6daf70b28347fab88c8dc467fce267d8ba71e57d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemember netty sink's registration 90/97190/1
Robert Varga [Thu, 12 Aug 2021 12:24:13 +0000 (14:24 +0200)]
Remember netty sink's registration

I928f1f5486b6edc8a62ed006431b7c5f06ddf986 has made a mistake in startup
path of replication source -- it fails to initialize the registration,
leading to a failure during shutdown.

JIRA: MDSAL-682
Change-Id: I4202e9773597169997b4ca88ed4d30819ebae678
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse utility DOMActionInstance constructor 41/97141/1
Robert Varga [Wed, 11 Aug 2021 13:27:13 +0000 (15:27 +0200)]
Use utility DOMActionInstance constructor

We have a simplified method, which creates the intermediate
DOMDataTreeIdentifier. Use it.

Change-Id: I98348c37574e09e7c17e0882bbc9cff6c256525f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove DOMRpcRouterTest 35/97135/2
Robert Varga [Wed, 11 Aug 2021 12:24:37 +0000 (14:24 +0200)]
Improve DOMRpcRouterTest

We have a ton of untested functionality, add a few tests to increase
coverage.

Change-Id: I0885a9a2c1b8f5ca5a3b56b6c03ff0c7acd00563
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix ActionProviderService(Adapter) 24/97024/20
PeterSuna [Mon, 26 Jul 2021 11:19:32 +0000 (13:19 +0200)]
Fix ActionProviderService(Adapter)

ActionProviderServiceAdapter is always passing an empty set of
instances to DOMActionProviderService, which is a direct violation of
API contract. Unfortunately the implementation interprets empty set as
a no-op, resulting in the violation being ignored silently and routing
not working.

JIRA: MDSAL-679
Change-Id: I53a8977365166228ed30130519a2024372d89365
Signed-off-by: PeterSuna <Peter.Suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse a global comparator 34/97134/1
Robert Varga [Wed, 11 Aug 2021 12:01:40 +0000 (14:01 +0200)]
Use a global comparator

Rather than instantiating a new comparator every time, just reuse a
single instance.

Change-Id: Ida1e9c1f41c5ab67a2847173bdcad6a1cd780c0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix a NPE on missing path 29/97129/1
Robert Varga [Tue, 10 Aug 2021 22:08:35 +0000 (00:08 +0200)]
Fix a NPE on missing path

If we have an action registration for a different path, we will end up
with a NPE. Handle this case and throw DOMActionNotAvailableException
instead of a NPE.

Change-Id: Icc01eb2f7b291285fc26392561553520ad784bf3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a FIXME to merge OSGiDOMRpcRouter 23/97123/1
Robert Varga [Tue, 10 Aug 2021 11:18:07 +0000 (13:18 +0200)]
Add a FIXME to merge OSGiDOMRpcRouter

We have constructor injection available, hence we can merge the OSGi
proxy router with DOMRpcRouter. Add a FIXME to that effect.

Change-Id: I4d58bf3036b7f6d89e7d305dfe3e5e670ce67931
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix formatting a bit 22/97122/1
Robert Varga [Tue, 10 Aug 2021 11:10:32 +0000 (13:10 +0200)]
Fix formatting a bit

We are splitting a Map<> declaration, make sure we keep it on the same
line.

Change-Id: Ia5c7601469801522e9eb97a07faedd9ba1672f0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdded documentation which describe Binding Query language API for end user. 78/94778/25
Iaroslav [Mon, 25 Jan 2021 09:16:57 +0000 (11:16 +0200)]
Added documentation which describe Binding Query language API for end user.

User Guide document for Binding Query Feature (Query language
based API for work with YANG based models):
- Feature Overview
- Query structure
- Query Usage
- Examples

JIRA: MDSAL-658
Change-Id: I1cfd3f2526a7deaab96f74c907d4c03563ca744d
Signed-off-by: Iaroslav Kholiavko <iaroslav.kholiavko@pantheon.tech>
2 years agoUse builder fluently 15/97115/1
Robert Varga [Mon, 9 Aug 2021 21:46:53 +0000 (23:46 +0200)]
Use builder fluently

DOMRpcRouter should use ImmutableList.Builder()'s methods as fluent
to maximize expressiveness.

Change-Id: I0e1663041a323cb65595675a029767a68cf2ba64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd a single-instance registerActionImplementation() 13/97113/1
Robert Varga [Mon, 9 Aug 2021 20:25:35 +0000 (22:25 +0200)]
Add a single-instance registerActionImplementation()

Single instances are rather prevalent, make sure we add a faster
specialization.

Change-Id: I58c0048c14868ffd129096f5536f16d2947ee660
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup whitespace in test.yang 12/97112/1
Robert Varga [Mon, 9 Aug 2021 18:10:11 +0000 (20:10 +0200)]
Cleanup whitespace in test.yang

We have some ugliness here, clean it up.

Change-Id: I9107551e82de226e327c8ba50f4dcb11b05b3c5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 8.0.2-SNAPSHOT 18/97018/1
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 years agoBump yangtools to 7.0.4 17/97017/1
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 years agoFix raw type warnings 16/97016/1
Robert Varga [Sat, 24 Jul 2021 18:05:40 +0000 (20:05 +0200)]
Fix raw type warnings

ComponentFactory now takes a proper generic argument, update to use it.

Change-Id: I67e2c7d1107240604e80e4b14edd5841953ac17b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRequire yang-common transitively 79/96979/1
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 years agoFix network-topology leafrefs 76/96976/1
Robert Varga [Wed, 21 Jul 2021 13:30:11 +0000 (15:30 +0200)]
Fix network-topology leafrefs

We are using leafref paths in a typedef. YANG XPath evaluation rules
mean that our use of unqualified names will pick up default namespace
from whereever we are referenced -- and thus we end up point not into
ietf-network namespace anymore.

JIRA: MDSAL-677
Change-Id: I4f55f766cdc304c70ee8d3675c2e5365654f613a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove ietf-type-util assertions 70/96970/1
Robert Varga [Wed, 21 Jul 2021 09:50:58 +0000 (11:50 +0200)]
Improve ietf-type-util assertions

A number of areas are improved:
- use assertThrows instead of @Test(expected=)
- do not declare Exception as thrown
- use assertThat(foo, instanceOf)) instead of assertTrue()
- use assertEquals() instead of assertTrue()

Change-Id: I0633f116d8afb2ebc46282e72f25bc4fd9c3b97a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd generalized IetfInetUtil.ipPrefixFor() 62/96962/2
Robert Varga [Tue, 20 Jul 2021 18:43:01 +0000 (20:43 +0200)]
Add generalized IetfInetUtil.ipPrefixFor()

Conversion of IpAddress (or IpAddressNoZone) to a IpPrefix is rather
something which is useful to reduce RSI where we already provide
base address->prefix utilities.

Change-Id: I2242e8945065763f6941dff0db1c6f4f14776286
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd GeneratorTest 99/96899/4
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 years agoSplit out Bug1862Test 00/96900/4
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 years agoFurther cleanup of test classes 98/96898/1
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 years agoMigrate Bug4621Test 97/96897/1
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 years agoRemove unused testing TypeDefinitions 96/96896/1
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 years agoRemove TypeProvider interface 95/96895/1
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 years agoRemove BaseYangTypesProvider 94/96894/1
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 years agoRemove useless TypeProvider tests 93/96893/2
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 years agoCleanup BindingGeneratorUtilTest 92/96892/1
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 years agoBump versions to 8.0.1-SNAPSHOT 74/96674/1
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 years agoLock down mdsal-binding-generator 73/96673/2
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 years agoTest self-referencing leafrefs 71/96671/1
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 years agoRefactor mdsal-binding-generator artifacts 67/96667/2
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 years agoHide binding.model.api.DefaultType 66/96666/2
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 years agoEliminate org.opendaylight.mdsal.binding.generator.spi 65/96665/1
Robert Varga [Thu, 24 Jun 2021 14:49:10 +0000 (16:49 +0200)]
Eliminate org.opendaylight.mdsal.binding.generator.spi

This package is not really used anywhere, remove it to lower confusion.

Change-Id: Iecc4917325749ad12553aa646c5ec894994f54b6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoMove BaseYangTypesProvider 61/96661/1
Robert Varga [Thu, 24 Jun 2021 12:52:43 +0000 (14:52 +0200)]
Move BaseYangTypesProvider

BaseYangTypesProvider is not really used anywhere, centralize it in
mdsal-binding-generator-impl prior to its removal.

Change-Id: I7c92885446f2ce25869f364f8ec922c3d2f43c88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup BindingReflections.getModuleInfo() 60/96660/1
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 years agoDOMDataTreeChangeListener.onInitialData() is mandatory 57/96657/4
Robert Varga [Thu, 24 Jun 2021 11:58:11 +0000 (13:58 +0200)]
DOMDataTreeChangeListener.onInitialData() is mandatory

Hiding this method is ugly, make sure users are aware of it.

JIRA: MDSAL-674
Change-Id: I9e733b46dea6251b43b3aa97d06e056fd7e8af16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoHide mdsal.binding.yang.types 59/96659/1
Robert Varga [Thu, 24 Jun 2021 12:12:03 +0000 (14:12 +0200)]
Hide mdsal.binding.yang.types

Code in these classes is legacy and should be cleaned up. Stop
exporting it as a first step.

Change-Id: I431b8d9ce4b6782a15b3efd85a1b31be73d161c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoHide NodeWrappedType 58/96658/1
Robert Varga [Thu, 24 Jun 2021 12:02:18 +0000 (14:02 +0200)]
Hide NodeWrappedType

This class is an internal implementation detail, hide it.

Change-Id: Ib76f76332c0a3d0cb8abb4a63e7ab824a8bfad82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDepend on rfc8346 in docs 56/96656/2
Robert Varga [Thu, 24 Jun 2021 11:57:34 +0000 (13:57 +0200)]
Depend on rfc8346 in docs

Force bundle to be created before docs, so that features are tested
last.

Change-Id: If1e992dff1b12c473825b9ed07970cfd74448a55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump byte-buddy to 1.11.5 07/96407/3
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 years agoDo not hash augmentation keys 52/96652/2
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 years agoRemove superfluous plugin dance 55/96655/3
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 years agoRemove useless no-op constructRequire() 38/96638/1
Robert Varga [Wed, 23 Jun 2021 19:47:35 +0000 (21:47 +0200)]
Remove useless no-op constructRequire()

We want to have as few implementations as possible, the default
implementation already is a no-op, so reflect that.

JIRA: MDSAL-602
Change-Id: I452f8f5dddc48ef14605768722f83f7c0743ddfd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup mdsal-binding-dom-codec-osgi dependency 37/96637/2
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 years agoCleanup mdsal-binding-dom-adapter dependencies 36/96636/1
Robert Varga [Wed, 23 Jun 2021 19:13:04 +0000 (21:13 +0200)]
Cleanup mdsal-binding-dom-adapter dependencies

yang-model-util's inference faculties are only used by
mdsal-binding-dom-codec, hence we should not be explicitly including
them.

JIRA: MDSAL-672
Change-Id: Ibe16a93639349645c7bb6c65889c2b803f606383
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCleanup mdsal-binding-dom-codec dependencies 35/96635/1
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 years agoCleanup mdsal-dom-schema-osgi dependencies 34/96634/1
Robert Varga [Wed, 23 Jun 2021 19:05:37 +0000 (21:05 +0200)]
Cleanup mdsal-dom-schema-osgi dependencies

We do not need to pull in anything from yangtools, as we are completely
serviced by mdsal-binding-runtime-spi.

JIRA: MDSAL-672
Change-Id: Ia006161a63fb1f7b42eb356e4191237c336aee4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix mdsal-binding-api dependencies 32/96632/3
Robert Varga [Wed, 23 Jun 2021 18:30:49 +0000 (20:30 +0200)]
Fix mdsal-binding-api dependencies

We should not be pulling in yang-data-api, as that exposes users to a
ton of DOM-specific interfaces, causing confusion.

JIRA: MDSAL-672
Change-Id: Id55f2cdd446b6d77202f79d0b05c7005166561a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove mdsal-common-util 33/96633/1
Robert Varga [Wed, 23 Jun 2021 18:56:38 +0000 (20:56 +0200)]
Remove mdsal-common-util

This artifact is completely empty, remove it to prevent confusion.

JIRA: MDSAL-672
Change-Id: Iadc8a7a87f7abe120c5651058cf49d2e70e94021
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd non-null getters for leaf objects 32/93932/17
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 years agoMove unified documentation generator 28/96628/3
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 years agoPromote replicate to a full feature 29/96629/2
Robert Varga [Wed, 23 Jun 2021 12:45:44 +0000 (14:45 +0200)]
Promote replicate to a full feature

There are a few issues in packaging, fix them up and drop
the -exp- infix from feature names.

JIRA: MDSAL-671
Change-Id: I4f3fc6fbba71da77a8c1b8c0ee149955cb43080f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove WADL generator 27/96627/1
Robert Varga [Wed, 23 Jun 2021 12:15:09 +0000 (14:15 +0200)]
Remove WADL generator

WADL generator has been downstreamed to NETCONF project as
restconf-wadl-generator. Remove it from MD-SAL.

JIRA: MDSAL-232
Change-Id: I7179fd305b0a5135e2251519c994a25bd479b02a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoConvert DocumentationGenerator to FileGenerator 04/96604/2
Robert Varga [Wed, 23 Jun 2021 11:34:22 +0000 (13:34 +0200)]
Convert DocumentationGenerator to FileGenerator

Migrate to using FileGenerator, which is a more modern replacement
for BasicCodeGenerator.

JIRA: MDSAL-232
Change-Id: I591b1dbb21bda24be76305abad2999dd9fce1d99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoConvert WADL generator to FileGenerator API 03/96603/1
Robert Varga [Wed, 23 Jun 2021 10:27:44 +0000 (12:27 +0200)]
Convert WADL generator to FileGenerator API

FileGeneratorFactory acts as a proper bootstrap for generators,
and it really pushes us towards a proper generator/template split,
slightly reducing the use of Xtend for non-templating purposes.

JIRA: MDSAL-232
Change-Id: I5414bd154b02a87eb0cfccf776de54f38ca5fab9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRename additionalConfiguration 02/96602/1
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 years agoInline WADL generator methods 01/96601/1
Robert Varga [Wed, 23 Jun 2021 09:40:05 +0000 (11:40 +0200)]
Inline WADL generator methods

We have quite a few methods used only once, make sure we make them
more templatey.

JIRA: MDSAL-232
Change-Id: I6ba1cce80f09c9d7e102922d461fc976f5fd8271
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove 'maven' packages 00/96600/1
Robert Varga [Wed, 23 Jun 2021 09:32:19 +0000 (11:32 +0200)]
Remove 'maven' packages

We have four packages here, hosting 6 classes, make sure we squash
them to two packages, each holding 3 classes.

JIRA: MDSAL-232
Change-Id: I9665ca6f7d5ef229ffe3be4f0ff9193ceca605d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse FileGenerator for java-api-generator 80/77680/17
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 years agoMake JavaFileTemplate.importedName() identify all name collisions. 98/94298/12
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 years agoFix UnionTypeCodec.loader() expectations 81/96581/1
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 years agoBump to yangtools-7.0.3 67/96567/1
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 years agoAdd Member.equalRoot() 60/96560/1
Robert Varga [Fri, 18 Jun 2021 12:51:44 +0000 (14:51 +0200)]
Add Member.equalRoot()

When we are considering two distinct augmentations to, say, RPC input,
we need to consider more than just the local name, as otherwise we end
up shifting more than needed.

Change-Id: If717d54dfc3f6e5caa8d7e0955c752439ffac141
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRestore augmentation sorting semantics 54/96554/2
Robert Varga [Wed, 16 Jun 2021 15:53:06 +0000 (17:53 +0200)]
Restore augmentation sorting semantics

Augmentation sort we are performing to order augmentations has another,
undocumented, impact. It provides stability of generated code towards
reformats of the YANG source, so that changing the order of augment
statements (by itself) does not change the naming of generated fields.

The simple comparator failed to take this effect, leading to an
incompatible change of assignments which is extremely hard to untangle.
Fix this by restoring previous sorting behaviour.

Change-Id: I7164e6e06d47fcded3261752a8a0f587afc70274
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoTreat wildcards as objects 46/96546/7
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 years agoUpdate CodecDataObjectGenerator FIXME 45/96545/1
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 years agoAssert schema tree class claim 06/96506/1
Robert Varga [Wed, 9 Jun 2021 23:33:47 +0000 (01:33 +0200)]
Assert schema tree class claim

'action' statement is displacing 'grouping' as per its claim on
schema tree namespace. 'rpc' historically does something radically
different, but we really want to go the 'action' route.

This change in behavior is already happening as part of CollisionDomain
mode of operation, here we add an explicit test for that scenario.

JIRA: MDSAL-666
Change-Id: Ie46b1234f5b01c66a8e3657ce984ec59d3a2475e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix union losing patterns 05/96505/2
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>