mdsal.git
3 years agoClean up CodecDataObjectGenerator documentation 04/91304/2
Robert Varga [Mon, 13 Jul 2020 20:06:45 +0000 (22:06 +0200)]
Clean up CodecDataObjectGenerator documentation

We have a few typos and opportunities for cleanup.

Change-Id: Ibb9f5804ccc05c1b58c51d0ba1ac03fbaef7b223
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd INFO.yaml for mdsal 46/91246/4
Anil Belur [Sun, 12 Jul 2020 00:46:02 +0000 (10:46 +1000)]
Add INFO.yaml for mdsal

Change-Id: Ib3e7c116d04b1c2afbda4ec472c4e31d3cfaf9b2
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove GeneratorUtil.getTopParentTransportObject() 96/91296/1
Robert Varga [Mon, 13 Jul 2020 11:12:34 +0000 (13:12 +0200)]
Remove GeneratorUtil.getTopParentTransportObject()

This method is not used anywhere and is quite inefficient, remove
it.

Change-Id: I3d381793c6c20fb056d03118b942a2257756a4bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoNetty Replicator - improve the reconnection and keepalive mechanisms 52/90752/2
Tibor Král [Tue, 30 Jun 2020 01:29:04 +0000 (03:29 +0200)]
Netty Replicator - improve the reconnection and keepalive mechanisms

In some cases during a network partition the disconnected
channel got closed with delay after a new channel was already created.
This started reconnection process which closed the new channel and
created yet another one.

Also improve the keepalive mechanism since some types of network
partitions left one side unaware of the issue.  It is important both
the Sink and the Source are notified about any connection issue as
soon as possible. PING-PONG messages are exchanged between the two
sides when no deltas are sent for a period of time

Configuration options keepalive-interval-seconds and
max-missed-keepalives added to both configurations.

Change-Id: Iebde72963bddb748ab97617d07cfc77cd8614da4
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b94fbc60c0b41da2f6645ab51188fbcdfa74e4af)

3 years agoAdd documentation for Netty Replication utility 53/90753/1
Tibor Král [Mon, 8 Jun 2020 17:21:11 +0000 (19:21 +0200)]
Add documentation for Netty Replication utility

Provide more information about the replication mechanism,
instalation, configuration and usage.

Change-Id: Ifcfae6853bc1946ac9e58b84219354a543e87ed8
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
3 years agoProvide auto-reconnection for Sink 38/90738/1
Tibor Král [Thu, 25 Jun 2020 16:17:55 +0000 (18:17 +0200)]
Provide auto-reconnection for Sink

In case there is a network partition the Sink needs to
be aware of it and schedule reconnect. This patch adds
configuration knob keepalive-interval-seconds to tweak
how soon after network failure the Sink gets notified.

Change-Id: I1eb2880bb00d1101cd587e4a737ba2f8a485b7ed
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2cbcb2d8589805bcb053462176424dae2b53cd1a)

3 years agoImprove tests and blueprints of Netty Replication Utility 93/90693/2
Tibor Král [Tue, 23 Jun 2020 20:58:52 +0000 (22:58 +0200)]
Improve tests and blueprints of Netty Replication Utility

- Test replication of actual DataTreeChanges from Source
to Sink and fix any related issues.
- Move blueprints to /OSGI-INF/blueprint/ and fix any
related wiring issues

Change-Id: I89c8228538e0462bbe61ca49e1ecf09dad4d4aaf
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a2f2028f4d111e77ca542d2bc2110f38fafd82fb)

3 years agoAdd a unit test for netty replication 70/90570/3
Robert Varga [Mon, 22 Jun 2020 12:44:30 +0000 (14:44 +0200)]
Add a unit test for netty replication

This is a simple unit test, which we can use to validate establishment
of source connection. This flushes out a few bugs, which are also
addressed.

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

3 years agoFixup mdsal-docs 14/90514/1
Robert Varga [Fri, 19 Jun 2020 08:51:02 +0000 (10:51 +0200)]
Fixup mdsal-docs

Merge job is failing, fix it up.

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

3 years agoAdd basic netty replication utility 06/90506/1
Robert Varga [Wed, 17 Jun 2020 10:29:12 +0000 (12:29 +0200)]
Add basic netty replication utility

This adds a source/sink datastore replication component based on
Netty TCP channels. The sink (consumer) connects to source (producer)
via a channel, specifies which data tree it wants replicated and
then listens for DataTreeCandidates to arrive from the source.

Change-Id: Ib283baa9a186ae2fb4ccf909b257006d4645de37
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d7b666857c54c07d9bf5c8e5e38671151d89fb4c)

3 years agoEliminate use of addAugmentation(Class, DataObject) 50/90450/2
Robert Varga [Mon, 15 Jun 2020 12:42:13 +0000 (14:42 +0200)]
Eliminate use of addAugmentation(Class, DataObject)

We have a replacement for this, migrate this user to remove
a warning.

Change-Id: Ib41c26cbd39766a8547edc88be03e3d8acf97265
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 6.0.3-SNAPSHOT 81/90381/1
Robert Varga [Wed, 10 Jun 2020 20:19:00 +0000 (22:19 +0200)]
Bump versions to 6.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: Ice8a9c218fcc912a1e136b1063d83b13fcd50528
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix leafref-to-enum encoding 11/89611/8
Peter Valka [Wed, 6 May 2020 07:54:18 +0000 (09:54 +0200)]
Fix leafref-to-enum encoding

When we have a leafref pointing to an enum via an absolute path,
in and RPC, we end up using a no-op codec, whereas we should be
extracting the name (from enum constant, or SchemaContext).

This ends up being a problem not in codec itself, as it is using
reflection to acquire the return type, defaulting to no-op.

The problem lies with AbstractTypeGenerator, which ends up not
being able to look up the generated type in case of RPC. The problem
here is the order in which types are generated, as the leaf being
referenced is generated after the RPC itself -- hence we cannot
find the definition.

While this is again highlighting the problem of single-pass code
generation, we can side-step the problem by moving RPC/notification
generation after the root data generation.

As a further complication, we need to record the enum/schema mapping,
as the codec needs to be able to find them via leafref types.

JIRA: MDSAL-552
Change-Id: Ifd92807029cdb7ba92dcad5655bb34d3ff4cef9d
Signed-off-by: Peter Valka <Peter.Valka@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRename query adapter package 69/90369/1
Robert Varga [Wed, 10 Jun 2020 08:49:20 +0000 (10:49 +0200)]
Rename query adapter package

org.opendaylight.mdsal.query.binding.adapter does not match
the overall package structure of binding/DOM adapter. Fix that.

Change-Id: I30bc30856032a3fa7c0d4637dc16c0407743dd54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump to odlparent-7.0.3/yangtools-5.0.3 65/90365/1
Robert Varga [Tue, 9 Jun 2020 22:31:16 +0000 (00:31 +0200)]
Bump to odlparent-7.0.3/yangtools-5.0.3

Pick up latest updates from upstream.

Change-Id: I1f8ac05eecaeac0c7ba0d802543d82c3c7ea7548
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump byte-buddy to 1.10.11 34/90334/1
Robert Varga [Mon, 8 Jun 2020 14:47:44 +0000 (16:47 +0200)]
Bump byte-buddy to 1.10.11

https://github.com/raphw/byte-buddy/blob/master/release-notes.md#4-june-2020-version-11011

Change-Id: I8538ecfa410bfc8fdbdbb87926914961ba2c6f1a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump xtendbeans to 1.3.2 30/90330/1
Robert Varga [Mon, 8 Jun 2020 10:57:38 +0000 (12:57 +0200)]
Bump xtendbeans to 1.3.2

This fixes synthetic bridge method issue.

Change-Id: I3766deed8b8ed8bab5e17dc81e5fb8711c0b62e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 6.0.2-SNAPSHOT 38/90138/1
Robert Varga [Sat, 30 May 2020 13:30:08 +0000 (15:30 +0200)]
Bump versions to 6.0.2-SNAPSHOT

This starts next development iteration.

Change-Id: I6dd75c96d5e17bc6435539d44ecc4d0dcbe54daf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump to odlparent-7.0.2/yangtools-5.0.2 32/90132/1
Robert Varga [Sat, 30 May 2020 09:10:19 +0000 (11:10 +0200)]
Bump to odlparent-7.0.2/yangtools-5.0.2

Pick up latest updates from upstream.

Change-Id: Ibe48d3cc3f1ba0896ff582d285261ea287a0a87b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoLink to odlparent docs 28/90128/2
Robert Varga [Sat, 30 May 2020 00:16:20 +0000 (02:16 +0200)]
Link to odlparent docs

We do not use odlparent, but link to it in case this ever changes.

Change-Id: I98881de9a78fa0bda70dffc9098cd95a7f406005
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump byte-buddy to 1.10.10 14/90114/1
Robert Varga [Fri, 29 May 2020 20:49:02 +0000 (22:49 +0200)]
Bump byte-buddy to 1.10.10

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

Change-Id: I536fc350302459e59245a87ab0d105d8df6ff3df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoPromote ForeignShardThreePhaseCommitCohort to dom.spi 12/90112/3
Robert Varga [Fri, 29 May 2020 19:17:19 +0000 (21:17 +0200)]
Promote ForeignShardThreePhaseCommitCohort to dom.spi

This class is really a sharding SPI thing, promote it as a beta
construct. This allows us to also promote
AbstractShardModificationFactoryBuilder.

Change-Id: I7d29ecbb691cefb79775d384898905a300e9af47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up binding-util tests 00/90100/5
Robert Varga [Fri, 29 May 2020 17:06:31 +0000 (19:06 +0200)]
Clean up binding-util tests

Ditch Truth and use assertThrows() to test exactly what we need.

Change-Id: Ic19ccf7efc67cd0c0ecd03e2c3cdcdac97629ce7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMake methods static 06/90106/2
Robert Varga [Fri, 29 May 2020 17:57:38 +0000 (19:57 +0200)]
Make methods static

Eclipse warning is correct, let's make sure we heed it.

Change-Id: I9e050f1e7f65ff417409a42aaa39434122497555
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoLower mdsal-trace-impl dependencies 01/90101/3
Robert Varga [Fri, 29 May 2020 17:12:55 +0000 (19:12 +0200)]
Lower mdsal-trace-impl dependencies

This component has much lower dependencies, make sure we do not
pull in too much.

Change-Id: Iad80a30f451221343eb8b966af7636f3b85f75dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse ranges for odl-mdsal-binding-runtime-api dependencies 02/90102/3
Robert Varga [Fri, 29 May 2020 17:26:17 +0000 (19:26 +0200)]
Use ranges for odl-mdsal-binding-runtime-api dependencies

mdsal-binding-runtime-spi depends on parser implementation for now,
hence we should bring in the appropriate range of upstream features.

Change-Id: I6cee7c0c86cc6dfda9ca3497cb66eb132af791de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDocument tests 09/90109/1
Robert Varga [Fri, 29 May 2020 18:52:20 +0000 (20:52 +0200)]
Document tests

Since we have brought it a dependency on test-jar, we need to
pull it to docs, too.

JIRA: MDSAL-556
Change-Id: I4914de8c8dc3cc437ec1f162352374abc99186cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate mdsal-binding-test-utils dependency 05/90105/2
Robert Varga [Fri, 29 May 2020 17:54:01 +0000 (19:54 +0200)]
Update mdsal-binding-test-utils dependency

We want to override the dependency to compile, as we want to
document these.

Change-Id: I5f5fdf5fcb18d93c89bda6e91a4dedca11c00305
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove mdsal-binding-util-tests 99/90099/1
Robert Varga [Fri, 29 May 2020 16:22:31 +0000 (18:22 +0200)]
Remove mdsal-binding-util-tests

mdsal-binding-dom-adapter no longer needs mdsal-binding-util, which
means we can fold unit tests, eliminating an intermediate step.

Change-Id: I5f6aa1d3536eac3ae744ef403b6b8c9b41917091
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up mdsal-binding-util test 98/90098/1
Robert Varga [Fri, 29 May 2020 16:10:55 +0000 (18:10 +0200)]
Clean up mdsal-binding-util test

There is no need to use Truth here, as we can do all we need with
plain JUnit. We actually can do more with assertThrows().

Change-Id: Ifff35e27db7690c052dfc1124c6990faa9f871db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up AssertNonDataObjectsTest 96/90096/1
Robert Varga [Fri, 29 May 2020 16:04:50 +0000 (18:04 +0200)]
Clean up AssertNonDataObjectsTest

The test throwing here actually wants to ensure that an exception
is thrown. Use assertThrows() and while we are at it, add another
assert on message and get rid of Google Thruth dependency, as it
really is not needed.

Change-Id: Ie5d4aa0f0f400ac77d1191eb973c9004fe4eaad6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDrop mdsal-binding-dom-adapter's dependency on in-memory datastore 86/90086/8
Robert Varga [Fri, 29 May 2020 12:25:27 +0000 (14:25 +0200)]
Drop mdsal-binding-dom-adapter's dependency on in-memory datastore

We do not want to be pulling in in-memory datastore just for the
sake of making test-jar work. Now that we binding-test-utils, which
downstreams can nicely depend on, we can express the test-jar
dependency in a reasonable way.

This has the effect of removing the mdsal-dom-inmemory-datastore
from odl-mdsal-binding-dom-adapter.

JIRA: MDSAL-559
Change-Id: I723285a77e0d48ca36cce4d21fffbbcf2c2e9e25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse odl-mdsal-broker in odl-mdsal-binding-dom-adapter 95/90095/1
Robert Varga [Fri, 29 May 2020 15:41:21 +0000 (17:41 +0200)]
Use odl-mdsal-broker in odl-mdsal-binding-dom-adapter

Binding API implementations ride on top of DOM implementations,
which are provided by odl-mdsal-dom-broker. Make sure we express
that in packaging. Solves duplicate packaging of mdsal-dom-broker.

JIRA: MDSAL-560
Change-Id: I6c0da82473d0c65b3586a3f8fcf9f5fa7b815352
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd odl-mdsal-dom-runtime 94/90094/2
Robert Varga [Fri, 29 May 2020 15:20:42 +0000 (17:20 +0200)]
Add odl-mdsal-dom-runtime

Introduce odl-mdsal-dom-runtime, which provides runtime support
for YANG models in OSGi.

Solves duplicate packaging of mdsal-dom-schema-osgi, which really
is an OSGi bundle extender of sorts.

JIRA: MDSAL-560
Change-Id: I96cc75af42c1153043839d52ee21b90376457cc1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up odl-mdsal-binding-runtime 93/90093/2
Robert Varga [Fri, 29 May 2020 14:43:38 +0000 (16:43 +0200)]
Clean up odl-mdsal-binding-runtime

mdsal-dom-schema-osgi does not depend on mdsal-dom-broker, as it
is getting everything it needs from mdsal-dom-spi.

Since this implementation is part of odl-mdsal-binding-runtime,
fix the feature definition to also depend on odl-mdsal-dom-api.

This solves duplicate packaging of:
- mdsal-common-api
- mdsal-dom-api
- mdsal-dom-spi

JIRA: MDSAL-560
Change-Id: Id9351c4d84a055ceb6a77803e60232bf7f5bb646
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBackport controller's binding-broker tests 71/90071/6
Robert Varga [Fri, 29 May 2020 11:11:04 +0000 (13:11 +0200)]
Backport controller's binding-broker tests

Pick up the class as it existed in controller as of
822e39fedebaf35ea9826067ad223dbfa98042ee.

JIRA: MDSAL-557
Change-Id: Ieaaeb594e33f8c5a4ac515d93c70db960cedb81c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump java-diff-utils to 4.4 84/90084/6
Robert Varga [Fri, 29 May 2020 12:04:18 +0000 (14:04 +0200)]
Bump java-diff-utils to 4.4

https://github.com/java-diff-utils/java-diff-utils/blob/master/CHANGELOG.md#44--2019-11-06

Change-Id: Ibe51446a2bd8c65b93e68b85702b1e2d78ceb0a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup testutils implementation 85/90085/3
Robert Varga [Fri, 29 May 2020 12:20:29 +0000 (14:20 +0200)]
Cleanup testutils implementation

We can make the code here more in line with MDSAL coding standards
and fix a few warnings.

Change-Id: I1e8c96aa81df0d073369c1a6ba7bba57329ac1de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoCleanup DataBrokerTestModule error reporting 89/90089/2
Robert Varga [Fri, 29 May 2020 12:40:52 +0000 (14:40 +0200)]
Cleanup DataBrokerTestModule error reporting

Do not declare RuntimeException as thrown and do not wrap reported
RuntimeExceptions. Also make sure we use IllegalStateException as
the wrapper.

JIRA: MDSAL-556
Change-Id: Ifc47004c6d5cc2c974045c3f4d94154b506c8ebd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoModernize DataBrokerFailuresTest 88/90088/2
Robert Varga [Fri, 29 May 2020 12:38:12 +0000 (14:38 +0200)]
Modernize DataBrokerFailuresTest

We have assertThrows() at our disposal, make sure we use it.

Change-Id: Id43230f36454df1ead22d7358d3259d36e74e6e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMove mdsal-binding-dom-adapter tests 70/90070/3
Robert Varga [Fri, 29 May 2020 10:46:04 +0000 (12:46 +0200)]
Move mdsal-binding-dom-adapter tests

There are two things in dom.adapter.test package: test harness
and individual test cases. Make sure we move the test cases away
to reduce confusion about what is to be used by downstreams.

JIRA: MDSAL-557
Change-Id: I366ea9ad80ea22d88008e1813aa892ec3ecb22a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoModernize DataBrokerTestModule 69/90069/1
Robert Varga [Fri, 29 May 2020 10:09:18 +0000 (12:09 +0200)]
Modernize DataBrokerTestModule

Before we release this thing make sure we give out an
EffectiveModelContextSupplier.

JIRA: MDSAL-556
Change-Id: I27f219f398713d53db9e05af44a029b3281367a4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDataBrokerTestModule getBindingToNormalizedNodeCodec() & Co. 68/90068/2
Michael Vorburger [Thu, 18 Jan 2018 02:15:23 +0000 (03:15 +0100)]
DataBrokerTestModule getBindingToNormalizedNodeCodec() & Co.

need these exposed for a new standalone component style test  I'm on

JIRA: MDSAL-556
Change-Id: I5efd3a6e507d46d035067a561aaca7c2f80f51e6
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBug 8163: getDataTreeChangeListenerExecutor() & DataBrokerTestModule 66/90066/1
Michael Vorburger [Thu, 13 Jul 2017 21:17:24 +0000 (02:47 +0530)]
Bug 8163: getDataTreeChangeListenerExecutor() & DataBrokerTestModule

Adjust AbstractDataBrokerTestCustomizer with a
getDataTreeChangeListenerExecutor() instead of a
setDataTreeChangeListenerExecutor(), just for more consistency with the
existing getCommitCoordinatorExecutor() method.  Also less confusing (to
me) than seeing the private Executor set by default which may get
changed by the setter later.

Adjust ConcurrentDataBrokerTestCustomizer with the
useMTDataTreeChangeListenerExecutor as a constructor argument, instead
of an useMTDataTreeChangeListenerExecutor() method, just for consistency
for how you already have it in AbstractConcurrentDataBrokerTest.

Extend ConstantSchemaAbstractDataBrokerTest and DataBrokerTestModule to
allow passing through this new opt-in tweak flag, so that tests in
downstream projects such as genius and netvirt can staring exploring
enabling this.

JIRA: MDSAL-556
Change-Id: I4ad85ac48163d2f4bac865f46a3b047d5b7d333a
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAbstractConcurrentDataBrokerTest @deprecate-s the AbstractDataBrokerTest 65/90065/1
Michael Vorburger [Mon, 6 Feb 2017 23:23:31 +0000 (00:23 +0100)]
AbstractConcurrentDataBrokerTest @deprecate-s the AbstractDataBrokerTest

This is take #2 on a similar earlier attempt which made the same change
directly in AbstractDataBrokerTest, which broke some downstrean tests,
which were BADLY WRITTEN (!) because the assumed single threaded direct
execution (which DataBroker does not guarantee).

https://bugs.opendaylight.org/show_bug.cgi?id=7538 has full background

JIRA: MDSAL-556
Change-Id: I05ac3525bdcf1ab9c99dfa15b98e090848d0fddc
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAbstractDataBrokerTestTest which actually does something 62/90062/6
Michael Vorburger [Wed, 5 Oct 2016 16:22:25 +0000 (18:22 +0200)]
AbstractDataBrokerTestTest which actually does something

Incl. verification that each @Test cleans up after itself.  We had a
suspicion that this didn't work; it turns out that it actually does and
we had another problem somewhere else.  Contributing this test still
seems useful for future non-regression.

JIRA: MDSAL-556
Change-Id: I295ebde45a0c030ab74852788b45203cdf6639e0
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDataBrokerTestModule: use AbstractDataBrokerTest without inheritance 61/90061/5
Michael Vorburger [Wed, 10 Aug 2016 15:22:30 +0000 (17:22 +0200)]
DataBrokerTestModule: use AbstractDataBrokerTest without inheritance

While starting to write JUnit tests (for functional components) with the
AbstractDataBrokerTest, I found myself not liking its design which
forces one to use a class SomeTest extends AbstractDataBrokerTest...

Modern JUnit tests should be written by composition, not enforced
inheritance.  Thus this new DataBrokerTestModule allows one to obtain a
DataBroker suitable for Tests from anywhere.

The *(Test)Module naming convention is obviously inspired by a DI point
of view (think Spring Framework's @Configuration classes, or Google
Guice or Dagger (yay!) *Module classes - which is exactly what this
really is - a particular way to obtain an instance of an
implementationof some service (here a DataBroker) in a certain
environment (here for tests).

The internal implementation of DataBrokerTestModule could be changed
later; I guess ideally what's in AbstractDataBrokerTest could go into
DataBrokerTestModule and AbstractDataBrokerTest could use it, but for
now I'm too lazy to change that, as this does the trick nicely.  Later
implementation changes would be transparent to users of
DataBrokerTestModule.

JIRA: MDSAL-556
Change-Id: I9641f527bbc0cb92732f2e513cdd64cc6a837200
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix SnapshotBackedWriteTransaction error message 54/89954/1
Robert Varga [Tue, 26 May 2020 11:15:42 +0000 (13:15 +0200)]
Fix SnapshotBackedWriteTransaction error message

The message is misleading, as we are not performing a write, but
a merge operation.

Change-Id: I8b61ac7b0bf5f3ae746a2b6c1883a02e6fe61e47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDo not use raw superclass for CodecDataObject instances 98/81998/9
Robert Varga [Sat, 11 May 2019 09:47:38 +0000 (11:47 +0200)]
Do not use raw superclass for CodecDataObject instances

We can improve generated class accuracy by specifying generic type
argument of CodecDataObject, thus making generated classes look
not like raw subclasses.

JIRA: MDSAL-550
Change-Id: If0581ea7186793539c9bc149c5e62c6db906616b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd test-sources for mdsal-binding-dom-adapter 64/89664/1
Robert Varga [Mon, 11 May 2020 15:58:41 +0000 (17:58 +0200)]
Add test-sources for mdsal-binding-dom-adapter

We are (unwisely) constructing a test-jar here, hence we should
also be publishing the corresponding sources.

Change-Id: I08ffb23b1e5eb8036e16237b8bc6fb0c6480f848
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd lazily-instantiated maps 88/89588/26
Robert Varga [Mon, 4 May 2020 12:34:27 +0000 (14:34 +0200)]
Add lazily-instantiated maps

Instantiating an ImmutableMap on each access is quite wasteful,
as there are a number of cases where we do not need the entire
mapping to be instantiated.

Typical uses touch the Map only once -- either to lookup a value
based on the key, or to iterate through the values. Others are
possible, but those two cover most of the patterns.

We add the prerequisite indirection and two implementations to
support each of the cases. The iterator part is optimized to
perform lazy object instantiation -- similar to LazyBindingList.

The lookup part works in a rather similar way, except it keeps
a lookup ConcurrentHashMap as the primary storage and values
are seen as expendable secondary storage. This makes iteration
order unstable, which might be seen as a violation of immutable
contract -- but our contract is a Map and mappings remain stable.

JIRA: MDSAL-539
Change-Id: I7c095065915f3c0d7b180d4aa1494e15d6374a11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd lazily-instantiated lists 08/89608/14
Robert Varga [Tue, 5 May 2020 20:03:26 +0000 (22:03 +0200)]
Add lazily-instantiated lists

Lists are usually searched linearly. For large lists we can end
up instantiating a large number of items upfront, some of which is
wasteful.

The cutoff point can be configured via a JVM property, which is
interpreted as a dynamic constant.

JIRA: MDSAL-551
Change-Id: I9e7c987929481143b931e763f4ef0313745a5c89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGuarantee non-null in CodecDataObject.codecKey() 89/89589/2
Robert Varga [Mon, 4 May 2020 13:49:50 +0000 (15:49 +0200)]
Guarantee non-null in CodecDataObject.codecKey()

The key loaded is guaranteed to be non-null, propagate that
annotation outwards.

Change-Id: If6bf3f4a7d5cabd760da603abb9038bb1e665b37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEliminate KeyedListNodeCodecContext.Unordered.getKey() 87/89587/2
Robert Varga [Mon, 4 May 2020 12:40:40 +0000 (14:40 +0200)]
Eliminate KeyedListNodeCodecContext.Unordered.getKey()

This method and the methodhandle invoker are completely superfluous,
as we can directly access key() from the created object. While capturing
a MethodHandle lowers what method can be invoked, it does not really
buy us much, as the observed class will we always the same.

That property is visible enough (wired through an invokeExact() on the
constructor), hence JIT should be able to optimize without this help.

Change-Id: Id24eac8e74782f750576c90d60485b2dcbdcff9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTake advantage of MapNode.size() 85/89585/2
Robert Varga [Mon, 4 May 2020 11:17:34 +0000 (13:17 +0200)]
Take advantage of MapNode.size()

Checking the size allows us to skip instantiating values, plus we
can pass it down to map construction, where a correct strategy
can be taken based on the size.

JIRA: MDSAL-539
Change-Id: Ib42e290571cf162150b6e94b24df4aca5a9762ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove semicolons in comments 26/89526/2
Robert Varga [Thu, 30 Apr 2020 07:31:29 +0000 (09:31 +0200)]
Remove semicolons in comments

sonarcloud insists this is commented-out code, which it is for
documentation purposes. Eliminating the trailing semicolon fools
it just enough to not notice.

Change-Id: I0546beb3b7584e426c2470c95bd4e8c177617bde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd InstanceIdentifier.verifyTarget() 73/89573/3
Robert Varga [Sun, 3 May 2020 08:04:18 +0000 (10:04 +0200)]
Add InstanceIdentifier.verifyTarget()

There are a number of places where users are casting InstanceIdentifiers,
just to restore type-safety after a type-unsafe operation, such as
going through serialization. Add InstanceIdentifier.verifyTarget(),
which restores type safety.

Change-Id: I2bfa69eb938b4a6b86b88e4054369b3abadf7c7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd odl-mdsal-trace artifact declaration 94/89494/3
Robert Varga [Tue, 28 Apr 2020 16:23:01 +0000 (18:23 +0200)]
Add odl-mdsal-trace artifact declaration

Since controller was encroaching on this space and its version
did cover our functionality this was never packaged. Now that
controller does not package it, we need to do that ourselves.

JIRA: MDSAL-547
Change-Id: I38faf8cb9da554357b134c8a37fa9b6affe4f9b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd datastore benchmark 57/89457/2
Robert Varga [Mon, 27 Apr 2020 19:14:57 +0000 (21:14 +0200)]
Add datastore benchmark

Change-Id: I2e5b1589805ddf9feae4d54667e60483a6c16530
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove notification delivery defensiveness 42/89442/4
Robert Varga [Mon, 27 Apr 2020 11:45:28 +0000 (13:45 +0200)]
Improve notification delivery defensiveness

If a listener throws an exception, make sure to log it and proceed
as if nothing happened.

JIRA: MDSAL-544
Change-Id: I0ca54bb5c517115b840ad03ea24d442c7762ff05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix unsubscribe checks in DOMNotificationRouterEvent 41/89441/3
Robert Varga [Mon, 27 Apr 2020 11:42:12 +0000 (13:42 +0200)]
Fix unsubscribe checks in DOMNotificationRouterEvent

The checks here are based on old assumption that the listener
would be set to null, which does not hold true for quite some
time. Update the check to close a simple race.

JIRA: MDSAL-545
Change-Id: I950ffcbcf732d4c24dcad675b81c2889465d9045
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 6.0.1-SNAPSHOT 72/89272/11
Robert Varga [Wed, 22 Apr 2020 18:34:49 +0000 (20:34 +0200)]
Bump versions to 6.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I047dbba41739424eaeca008143fbe8ed7e466daf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAllow DOMMountPoint to not have a model context 97/89397/2
Robert Varga [Sun, 26 Apr 2020 13:50:17 +0000 (15:50 +0200)]
Allow DOMMountPoint to not have a model context

We need to allow mount points without a context, as that is what
NETCONF requires for now.

JIRA: MDSAL-435
Change-Id: Ia74bc3416162663e67003486cf67f3cfac46e340
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Remove deprecated uint migration elements" 96/89396/1
Robert Varga [Sun, 26 Apr 2020 13:06:09 +0000 (15:06 +0200)]
Revert "Remove deprecated uint migration elements"

This reverts commit 1382c1d88b753e152ff26eae1091cd42e5aba76b,
reinstating generation of compatibility elements.

JIRA: MDSAL-490
Change-Id: Ia59eb16f3f0e534ce7339c46c24fc4d0b22d6f05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump to yangtools-5.0.1 25/89325/2
Robert Varga [Thu, 23 Apr 2020 15:39:25 +0000 (17:39 +0200)]
Bump to yangtools-5.0.1

We need further changes to tie together netconf and us.

Change-Id: Ia3668c7a79221f060159696c5554ef1c21e38782
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Update RPC invocation to take ContainerNode" 24/89324/1
Robert Varga [Thu, 23 Apr 2020 18:24:27 +0000 (20:24 +0200)]
Revert "Update RPC invocation to take ContainerNode"

This reverts commit f77a6182a4af3150fac68911cc98d0259342136d, as
we cannot tolerate ContainerNode in arguments either, due to how
netconf is implemented.

JIRA: MDSAL-303
Change-Id: Ib176d71aebcb85da36a65f3048cfef32e474bcd4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Turn DOMRpcResult's result back to NormalizedNode" 23/89323/1
Robert Varga [Thu, 23 Apr 2020 18:23:56 +0000 (20:23 +0200)]
Revert "Turn DOMRpcResult's result back to NormalizedNode"

This reverts commit db7aba121dd8f6b4ee793325a31d91e28e0185d3, as
we are backing things out.

JIRA: MDSAL-303
Change-Id: Iaa0842f1c6ce16e401595f21ad14bc547705f6eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTurn DOMRpcResult's result back to NormalizedNode 18/89318/1
Robert Varga [Thu, 23 Apr 2020 14:17:13 +0000 (16:17 +0200)]
Turn DOMRpcResult's result back to NormalizedNode

Eventhough we really want to have ContainerNode here, NETCONF
is utterly misusing normalization to tunnel AnyXmlNode here.

Revert the change donewwwe have done, so that it continues to
work.

JIRA: MDSAL-303
Change-Id: Ie675609fe4dc5e77e1f4e8ee2ea471a9f1d3d87b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCatch nulls in RpcServiceAdapter 02/89302/5
Robert Varga [Thu, 23 Apr 2020 06:39:32 +0000 (08:39 +0200)]
Catch nulls in RpcServiceAdapter

Binding/DOM invocation should not tolerate null input, make sure
we stop such attempts early.

JIRA: MDSAL-303
Change-Id: I2ca04b820154768b50b2353b1f99e48c31484035
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup BindingRuntimeHelpers 10/89310/4
Robert Varga [Thu, 23 Apr 2020 11:38:04 +0000 (13:38 +0200)]
Cleanup BindingRuntimeHelpers

We need to differentiate between testing (static context) and dynamic
contexts. This makes it possible to use these helpers in OSGi if we
inject the right set of services.

Change-Id: Ibc22b1597320956408217b98d44c9ea3fdd98c32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGenerate legacy List adaptation 09/89309/3
Robert Varga [Thu, 23 Apr 2020 10:50:53 +0000 (12:50 +0200)]
Generate legacy List adaptation

In order to lower the pain of migration, generate legacy setFoo()
methods with List argument. These internally perform translation
to an ImmutableMap with unique index.

JIRA: MDSAL-434
Change-Id: If364c50a1f48d94b72520c674cbd033fe53646a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFurther deprecate addAugmentation() 08/89308/2
Robert Varga [Thu, 23 Apr 2020 10:31:54 +0000 (12:31 +0200)]
Further deprecate addAugmentation()

We want to remove this method in next major release. Make sure
its deprecated for removal.

JIRA: MDSAL-183
Change-Id: I8d76a1eeab07e9fd40f6d970be391dbf3b26f542
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AbstractBindingRuntimeContext.toString() 06/89306/2
Robert Varga [Thu, 23 Apr 2020 09:08:31 +0000 (11:08 +0200)]
Remove AbstractBindingRuntimeContext.toString()

BindingRuntimeTypes can have a huge string representation, which
hurts when combined with a subclass of it being present in OSGi SR
and bundle-diag printing out services.

Change-Id: I38a95c6283454930674f5d6311829d7450559f0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate RPC invocation to take ContainerNode 96/89296/2
Robert Varga [Thu, 23 Apr 2020 00:07:59 +0000 (02:07 +0200)]
Update RPC invocation to take ContainerNode

Our acceptance of NormalizedNode here is misleading, we should be
taking a ContainerNode, just as actions do.

Change-Id: I1c24a24a8f42decd4a000b01805b51913fe05bf2
JIRA: MDSAL-303
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOSGiDOMSchemaService should provide YANG sources 97/89297/2
Robert Varga [Thu, 23 Apr 2020 00:19:17 +0000 (02:19 +0200)]
OSGiDOMSchemaService should provide YANG sources

This was caught in downstream integration: the refactor here
forgo to add routing towards YANG source.

JIRA: MDSAL-392
Change-Id: I27b792eb932c68c89aeab21c69f7338ecb68d73b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate BindingRuntime{Context,Generator,Types} 94/89294/5
Robert Varga [Wed, 22 Apr 2020 22:13:54 +0000 (00:13 +0200)]
Update BindingRuntime{Context,Generator,Types}

These interfaces should be operating on EffectiveModelContext to
provide smooth transition to downstreams. Fix that, along with
implementation and tests.

JIRA: MDSAL-435
Change-Id: Idfb155984d1261203d225c8293189941d5d345e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdjust DOMMountPoint to be EffectiveModelContextProvider 93/89293/2
Robert Varga [Wed, 22 Apr 2020 19:44:14 +0000 (21:44 +0200)]
Adjust DOMMountPoint to be EffectiveModelContextProvider

SchemaContext does not cut it here. We really should not have this
at all and should rely on DOMSchemaService being present, but that
refactor has to wait for another breaking release.

JIRA: MDSAL-435
Change-Id: I3182b0cda7809cf7b90fe0a05413a9b88541bfb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReduce use of BaseTemplate.getterMethodName() 65/89265/1
Robert Varga [Wed, 22 Apr 2020 12:24:55 +0000 (14:24 +0200)]
Reduce use of BaseTemplate.getterMethodName()

We are using BuilderGeneratedProperty in Builder(Impl)Template,
and this class has access to the getter method. We therefore do
not need to construct the getter name, but rather can access it
directly.

Change-Id: I1b61c347d2919acf763d1f7d11ca9471b8a25f0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate misnamed FooBuilder.addAugmentation() 90/89190/4
Robert Varga [Tue, 21 Apr 2020 09:26:47 +0000 (11:26 +0200)]
Deprecate misnamed FooBuilder.addAugmentation()

Add explicit documentation to generated methods and deprecate
the two-argument addAugmetation() variant. Steer users towards
the one-argument variant or removeAugmentation().

JIRA: MDSAL-183
Change-Id: I496cfa542cb1f35cec975cd8288ef79e2b38fba6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoClean up GeneratedProperty use 62/89262/2
Robert Varga [Wed, 22 Apr 2020 10:25:20 +0000 (12:25 +0200)]
Clean up GeneratedProperty use

Previous patch made a bit of a mess in GeneratedProperty. Clean this
up by creating a dedicated BuilderGeneratedProperty to hold the
properties created in java-api-generator.

Also add a few dedicated tests to ensure generated builders what
they are supposed to do.

JIRA: MDSAL-451
Change-Id: I594475019a997277560f77d4ef51144f2b281ffe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpand ValueMechanics with NONNULL 54/89254/1
Robert Varga [Tue, 21 Apr 2020 20:09:30 +0000 (22:09 +0200)]
Expand ValueMechanics with NONNULL

Since we have introduced a backchannel to add semantics, this can
be (mis)used to communicate nullness guarantees. Add another
ValueMechanics which can be recognized as needed.

JIRA: MDSAL-492
Change-Id: Ic50bb827c2e410ab4afb9dd6dd20941be689bd2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSquash empty lists/maps 36/89236/2
Robert Varga [Tue, 21 Apr 2020 13:11:41 +0000 (15:11 +0200)]
Squash empty lists/maps

Dealing with lists requires us to interfere with what the user
is giving us in builders, effectively creating new mechanics.

This patch adds the model metadata to carry these around, exposing
just how badly broken some binding.model.api construcs are misused.
We do not fix the misuse, but make it slightly worse, but also mark
the mess for future cleanup.

JIRA: MDSAL-451
Change-Id: I43b3ddccff69bec9a4e98b3c8e73aac4679c1d1f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCentralize non-key property copies 35/89235/1
Robert Varga [Tue, 21 Apr 2020 12:44:25 +0000 (14:44 +0200)]
Centralize non-key property copies

AbstractBuilderTemplate can discern between a copied key property
and other properties. Make sure we split the second part into a
separte method, allowing it to be customized.

The immediate benefit here is that we do not end up copying properties
if there are no keys.

JIRA: MDSAL-451
Change-Id: Ic1ba59d12cd65e7e8991345d50dc80db3fc029bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFixup DataObjectCodecContext.createBindingProxy() nullness 92/89192/1
Robert Varga [Tue, 21 Apr 2020 09:50:35 +0000 (11:50 +0200)]
Fixup DataObjectCodecContext.createBindingProxy() nullness

This method cannot return a null, nor can anything which ultimately
uses it as its sole return.

Change-Id: Ia7bc32fa050777130a635d3929fbce6da705bb22
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSquash empty MapNode/UnkeyedListNode objects to null 91/89191/1
Robert Varga [Tue, 21 Apr 2020 09:43:55 +0000 (11:43 +0200)]
Squash empty MapNode/UnkeyedListNode objects to null

When we encounter an empty keyed/unkeyed list, we need to treat
it as it were not present. This adjusts the appropriate codecs
to ensure that is the case.

JIRA: MDSAL-452
Change-Id: Iba70207642e014d59a94cc09a69da988ee71c63f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSimplify builder's addAugmentation() method 42/45742/7
Robert Varga [Mon, 20 Apr 2020 23:15:06 +0000 (01:15 +0200)]
Simplify builder's addAugmentation() method

All augmentation already extend DataObject, which really is to say
that Augmentation should be doing the same. This has the benefit
of giving us access to DataContainer.implementedInterface(), which
we can use to add a simplified addAugmentation() method.

JIRA: MDSAL-183
Change-Id: I053a2d23e6bf95e07fa58e4078a37661e6e726a3
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove explicit UOE throws 83/89183/1
Robert Varga [Tue, 21 Apr 2020 05:50:55 +0000 (07:50 +0200)]
Remove explicit UOE throws

Private constructors do not really have to be that defensive.
Remove exception throws and related tests.

Change-Id: I245264a78607d136d92a4c18d68f5d5df17a4832
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd CodeHelper.emptyToNull() 77/89177/3
Robert Varga [Mon, 20 Apr 2020 22:30:16 +0000 (00:30 +0200)]
Add CodeHelper.emptyToNull()

We will need to be squashing empty collections to nulls, add
utility methods to do that.

JIRA: MDSAL-451
Change-Id: I28510efc2e10cef6181a9241d52f88c9cfd884e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove CodeHelpers.nonNullValue() 76/89176/3
Robert Varga [Mon, 20 Apr 2020 22:27:29 +0000 (00:27 +0200)]
Remove CodeHelpers.nonNullValue()

This method is used only with augmentations. Remove it and update
callers to use Objects.requireNonNull() instead.

This removes a source of IAEs in favor of more consistent NPE
as well as trims down a few bytes from builder classes.

Change-Id: I57ee77c19230f57b34bf85eb5e31863f17372437
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd CodeHelper documentation 75/89175/1
Robert Varga [Mon, 20 Apr 2020 22:19:33 +0000 (00:19 +0200)]
Add CodeHelper documentation

We are missing documentation for generic method types, add a few
words.

Change-Id: I3c3faa2836f4a6b55283028d04f5528728149bff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove often-used class imports 73/89173/3
Robert Varga [Mon, 20 Apr 2020 18:28:29 +0000 (20:28 +0200)]
Improve often-used class imports

importedName(Class) is slightly slower than importName(JavaTypeName),
hence improve performance by creating a few more often-used constants.

Change-Id: I2af9ad97bc2122a83c26cd247faf15e136bdb768
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReorder encapsulation checks 52/89152/1
Robert Varga [Mon, 20 Apr 2020 18:03:04 +0000 (20:03 +0200)]
Reorder encapsulation checks

Reordering checks provides a small speed up due to fewer checks
being made on average, as we take care of most popular types first.

Change-Id: I0acc2e77007054c7c35ad159d98bb3be1cdabfee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up BaseYangTypesProvider's restricted types 50/89150/2
Robert Varga [Mon, 20 Apr 2020 13:20:54 +0000 (15:20 +0200)]
Speed up BaseYangTypesProvider's restricted types

We are currently bouncing through explicit classes and a switch
expression which pretty-much duplicates BaseYangTypes. Clean this
up by exposing an alternative method to create restricted types,
so that we can first lookup mapping and then create a restricted
type.

Change-Id: I98601b6bf4ddb43c76c62d4f988d174456be4229
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove BaseYangTypes.javaTypeForYangType() 49/89149/2
Robert Varga [Mon, 20 Apr 2020 13:00:30 +0000 (15:00 +0200)]
Improve BaseYangTypes.javaTypeForYangType()

This method should not tolerate nulls and it can be implemented
in terms of a simple switch() statement instead of a lookup map.

Change-Id: Icbef37aec6aef2d1a445ce26dcc3b7479b0ec81f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoClean up test naming confusion 48/89148/2
Robert Varga [Mon, 20 Apr 2020 13:02:49 +0000 (15:02 +0200)]
Clean up test naming confusion

BaseTypeProvider is really a BaseTypesTest, and that test is really
BaseYangTypesProviderTest. Clean them up, relocating them as to their
home packages.

Change-Id: I37f9a78fe48b1954882bfa344f1d866c9591e14b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up BaseYangTypesProvider 47/89147/1
Robert Varga [Mon, 20 Apr 2020 12:40:45 +0000 (14:40 +0200)]
Speed up BaseYangTypesProvider

Most of the time we do not need to go through the switch expression
and restricted types. Short-circuit lookup when we know we do not
have restrictions.

Change-Id: I84568a180c6ed208e077dbe3c0cb749e84acf3cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCorrect ClassTemplate's check for types 46/89146/6
Robert Varga [Mon, 20 Apr 2020 11:51:53 +0000 (13:51 +0200)]
Correct ClassTemplate's check for types

ClassTemplate's checks run against Java Types, which is fine, except
that we should be referencing them through BaseYangTypes, so that we
have the incidental alignment well covered.

Furthermore the checks rely on FQCN, which is potentially slow to
compute, while the new checks rely on plain type equality -- hence
potentially speeding up things and lowering the number of branches.

We also drop a FIXMEs to clarify situation around InstanceIdentifier.

Change-Id: I3328199a8ec56e28d58582c076f1344fb4459103
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCorrect UnionTemplate's check for types 45/89145/4
Robert Varga [Mon, 20 Apr 2020 11:35:50 +0000 (13:35 +0200)]
Correct UnionTemplate's check for types

UnionTemplate's checks run against Java Types, which is fine, except
that we should be referencing them through BaseYangTypes, so that we
have the incidental alignment well covered.

Change-Id: I5be3708d80ee5c376178df14dbc76333a01e06ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove BaseYangtypes to binding.model.util 44/89144/4
Robert Varga [Mon, 20 Apr 2020 11:31:37 +0000 (13:31 +0200)]
Move BaseYangtypes to binding.model.util

These constants sit between Types and BindingTypes, hence they should
not be in a completely different package.

Change-Id: If9894102e27b8dd3568493ef615c40328d213ca9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit out BaseYangTypesProvider 43/89143/4
Robert Varga [Mon, 20 Apr 2020 11:18:09 +0000 (13:18 +0200)]
Split out BaseYangTypesProvider

BaseYangTypes is related to binding.model.api, while the type provider
is related to binding.generator.api. Split out
BaseYangTypes.BASE_YANG_TYPES_PROVIDER as a BaseYangTypesProvider.INSTANCE,
separating these two concerns.

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