mdsal.git
4 years agoBump to odlparent-4.0.15 and yangtools-2.1.17 83/86983/1
Robert Varga [Thu, 16 Jan 2020 14:39:27 +0000 (15:39 +0100)]
Bump to odlparent-4.0.15 and yangtools-2.1.17

Pick up latest updates and fix for SFT.

Change-Id: I49a8a2be424ddb7d879474f66df3105c67d7510d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 3.0.16-SNAPSHOT 13/86913/1
Robert Varga [Wed, 15 Jan 2020 07:15:40 +0000 (08:15 +0100)]
Bump versions to 3.0.16-SNAPSHOT

This starts the next development iteration.

Change-Id: I5e8c43cc6c0db91659b04f161908e2e4f21b9697
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate away from DataNodeIterator 12/86912/1
Robert Varga [Tue, 14 Jan 2020 16:09:05 +0000 (17:09 +0100)]
Migrate away from DataNodeIterator

We do not need to collect the entire analysis, just typedefs
(and containers in a test). Migrate to new SchemaUtils methods which
provide exactly that functionality more efficiently.

Change-Id: Idfbe19c785351f3280eae33c476d533055cb16e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 2.1.16 11/86911/1
Robert Varga [Wed, 15 Jan 2020 07:14:49 +0000 (08:14 +0100)]
Bump yangtools to 2.1.16

This picks up latest fixes and improvements.

Change-Id: Ia0d29038095423c087535e13eec55b0998b36116
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoParse IPv4-mapped IPv6 address as an IPv6 address 85/86785/1
Ajay Lele [Mon, 6 Jan 2020 18:49:50 +0000 (10:49 -0800)]
Parse IPv4-mapped IPv6 address as an IPv6 address

Inet6Address.getByAddress(byte[]) does not explicitly exist, and is
really InetAddress.getByAddress(byte[]). That method ends up returning
an Inet4Address for IPv4-mapped IPv6 addresses.

This in turn causes addressStringV6() to do the wrong thing and format
the address as an Ipv4. This is not caught by validation, as we are
skipping it by default -- and ends up causing problems way later when
such an address meets an enforcement point -- such as DOM->Binding
translation.

Fix this by using Inet6Address.getByAddress(String. byte[], NetworkInterface),
which is guaranteed to result in an Inet6Address.

Also add proper defences to addressStringV6(InetAddress), so that any
attempt to mis-use it is caught.

JIRA: BGPCEP-891
Signed-off-by: Ajay Lele <ajayslele@gmail.com>
Change-Id: Ife4cc9e57bd49b45f2beb73462a865ad84483d8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1d8897caf5cec5f044f870f949a15fa57de54d71)

4 years agoBump versions to 3.0.15-SNAPSHOT 75/86675/6
Robert Varga [Thu, 2 Jan 2020 09:09:55 +0000 (10:09 +0100)]
Bump versions to 3.0.15-SNAPSHOT

This starts the next development iteration.

Change-Id: Ib3401088df6186cd47cf8a464c33e70d69f4aa41
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix RPC method name conflict with JLS 71/86671/4
miroslav.kovac [Mon, 16 Dec 2019 16:28:41 +0000 (17:28 +0100)]
Fix RPC method name conflict with JLS

When we are constructing the method name for use with the RPC
provider interface we need to pay attention to conflicts with
JLS reserved words.

If such a conflict occurs, append a single '$' to the name, so
that we have a valid method name.

JIRA: MDSAL-500
Change-Id: Ifb533e2daa71bc9d1780a5d8eb48da6ce3b2d209
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6e6ebc43866204667658f8bbf7cfb6233caffdc7)
(cherry picked from commit 42a49525a3b291a4af093090a54ab4c88a2313ca)

4 years agoCorrect YangModuleInfo.getInstance() nullness warning 73/86673/3
Robert Varga [Thu, 21 Nov 2019 13:25:04 +0000 (14:25 +0100)]
Correct YangModuleInfo.getInstance() nullness warning

This method is missing a @NonNull, which means we end up issuing
a warning. Fix that up.

JIRA: MDSAL-487
Change-Id: I0870880bceb727b6a820bcdc0fd4177002fb4119
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1144f464d67c5371b30463be5e4e144edaddd05b)
(cherry picked from commit 711ca645dda28542d35d2849bbe5523bb2826664)

4 years agoFix CodeHelper.nonnull() nullness annotation 72/86672/3
Robert Varga [Thu, 21 Nov 2019 13:25:53 +0000 (14:25 +0100)]
Fix CodeHelper.nonnull() nullness annotation

We do not correctly propagate the fact the return is @NonNull,
leading to Eclipse issuing warnings. Fix that.

JIRA: MDSAL-487
Change-Id: I24360192d105423a19165855521bb24bb0bd0678
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8fc4a97304080fafab158ef877e6fc180c030ac0)
(cherry picked from commit 19f99bd7c35c863f2eb708c9ce492480ba0c36ed)

4 years agoBump yangtools to 2.1.15 74/86674/3
Robert Varga [Thu, 2 Jan 2020 09:09:07 +0000 (10:09 +0100)]
Bump yangtools to 2.1.15

This picks up the latest fixes.

Change-Id: Ib85dd74e4e5953a3e8b3d0737513da3ad06ac910
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up AbstractBuilderTemplate.removeProperty() 70/86670/1
Robert Varga [Thu, 19 Dec 2019 14:51:20 +0000 (15:51 +0100)]
Speed up AbstractBuilderTemplate.removeProperty()

Rather than performing a linear unbounded search followed by a
conditional remove, use an interator and remove the first matching
property, bailing out.

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

4 years agoBump versions to 3.0.14-SNAPSHOT 19/85919/1
Robert Varga [Thu, 21 Nov 2019 04:30:18 +0000 (05:30 +0100)]
Bump versions to 3.0.14-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia7f110b37842662f9e9a68e3688fbe784c6ffc91
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent/yangtools to 4.0.14/2.1.14 09/85809/7
Robert Varga [Mon, 18 Nov 2019 07:22:44 +0000 (08:22 +0100)]
Bump odlparent/yangtools to 4.0.14/2.1.14

Adopt latest fixes and upgrades.

Change-Id: I6141fefe5602b578586f9b19680fde4019ef725b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd yangtools javadoc link 92/85892/1
Robert Varga [Wed, 20 Nov 2019 08:12:09 +0000 (09:12 +0100)]
Add yangtools javadoc link

Cross-references mdsal-docs with yangtools-docs.

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

4 years agoResync javadoc links 91/85891/1
Robert Varga [Wed, 20 Nov 2019 12:54:01 +0000 (13:54 +0100)]
Resync javadoc links

This re-synchronizes links to upstreams to match odlparent.

Change-Id: Ibc514a9aa5eb5f068561772b91061567796ed171
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix onDataTreeChanged() references 83/85883/1
Robert Varga [Wed, 20 Nov 2019 08:11:28 +0000 (09:11 +0100)]
Fix onDataTreeChanged() references

Use a link to specific method, not just any matching.

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

4 years agoRemove use of xbase-lib in tests 60/85860/2
Robert Varga [Tue, 19 Nov 2019 15:09:49 +0000 (16:09 +0100)]
Remove use of xbase-lib in tests

The way the expected object is constructed is horrible, just use
plain fluent builder without the extensions. This makes it more
clear and much more concise.

Change-Id: I042dfda9fadcc2b3764a449dfc34300f0928370b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded checkstyle supressions 57/85857/2
Robert Varga [Mon, 18 Nov 2019 10:44:11 +0000 (11:44 +0100)]
Remove unneeded checkstyle supressions

Treading carefully and using Class.asSubclass() allows us to
remove raw types/unchecked casts.

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

4 years agoImport types being checked 55/85855/1
Robert Varga [Mon, 18 Nov 2019 12:44:39 +0000 (13:44 +0100)]
Import types being checked

When we are checking individual component types, we should not
be needing to reference them via the full name. Use imported name
instead.

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

4 years agoAdd Types.isListType(ParameterizedType) 54/85854/1
Robert Varga [Mon, 18 Nov 2019 12:16:37 +0000 (13:16 +0100)]
Add Types.isListType(ParameterizedType)

Performing duplicate checks is not efficient, if the caller already
knows the type is parameterized.

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

4 years agoSpeed up ListsBindingUtils 53/85853/1
Robert Varga [Mon, 18 Nov 2019 12:54:42 +0000 (13:54 +0100)]
Speed up ListsBindingUtils

This just uses proper fluent builder pattern instead of a
temporary variable.

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

4 years agoInline AbstractTypeGenerator.resolveListKeyTOBuilder() 52/85852/1
Robert Varga [Mon, 18 Nov 2019 11:52:47 +0000 (12:52 +0100)]
Inline AbstractTypeGenerator.resolveListKeyTOBuilder()

This method is only called once in a context which can already
know whether it needs to actually call it. Inline the definition,
so that we have a more efficient code flow.

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

4 years agoOptimize AbstractTypeGenerator.listKeys() 51/85851/1
Robert Varga [Mon, 18 Nov 2019 11:36:45 +0000 (12:36 +0100)]
Optimize AbstractTypeGenerator.listKeys()

In case of an empty key definition we end up allocating
short-lived empty ArrayLists, which is not efficient. Also lists
typically have a few elements, so we end up over-allocating them.

This fixes both cases, by checking the definition first and
returning an empty list in case the definition is empty, as well
as properly allocating efficient implementation where needed.

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

4 years agoParse docs version of pom.xml 47/85747/1
Thanh Ha [Mon, 4 Nov 2019 16:11:50 +0000 (11:11 -0500)]
Parse docs version of pom.xml

Issue: MDSAL-489
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: Ie32ef32b3d89e98b9ea432bd8e2ac5ea91bf13b9
(cherry picked from commit da3cf4cd9f78d66a7edac29d6efa74a7b8a867b6)

4 years agoAdd @NonNull annotation to $YangModuleInfoImpl.qnameOf() 09/85309/2
Robert Varga [Mon, 21 Oct 2019 12:44:33 +0000 (14:44 +0200)]
Add @NonNull annotation to $YangModuleInfoImpl.qnameOf()

YangModuleInfoTemplate has a lot of ceremony when we statically
know the types being used by the template. Concentrate imports
into two sets, instantiate them as strings and be done with it.

Since this takes care of most dynamics, making things much easier
and predictable, we can easily add @NonNull annotations as needed.

JIRA: MDSAL-487
Change-Id: Ic9cd4da1002f3edea6f3fb18f9d49e4a377e145b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b0ea6f0f70fbc597779703a4c65dd85b69355de3)

4 years agoCleanup YangModuleInfoTemplate 06/85306/1
Robert Varga [Tue, 15 Oct 2019 10:32:16 +0000 (12:32 +0200)]
Cleanup YangModuleInfoTemplate

generateModelProvider() returns a string, use the appropriate
template syntax. Also use Map.putIfAbsent() instead of
containsKey()/put() checks.

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

4 years agoFix spotbugs complaints around logging 99/85299/1
Robert Varga [Mon, 21 Oct 2019 16:52:35 +0000 (18:52 +0200)]
Fix spotbugs complaints around logging

Spotbugs is very much correct about warning about non-constant
format strings. This patch fixes that up.

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

4 years agoUse ImmutableSet in YangModuleInfo 98/85298/1
Robert Varga [Mon, 21 Oct 2019 15:23:01 +0000 (17:23 +0200)]
Use ImmutableSet in YangModuleInfo

This allows us to bind to a concrete implementation, improving
performance very slightly.

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

4 years agoBump versions to 3.0.13-SNAPSHOT 47/85247/1
Robert Varga [Sat, 19 Oct 2019 17:24:08 +0000 (19:24 +0200)]
Bump versions to 3.0.13-SNAPSHOT

This starts the next development iteration.

Change-Id: I2bfcd1a09fca748bce1f61ae4908f84a8794e4b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake Builders sensitive to @Deprecated annotations 46/85246/1
Robert Varga [Sat, 12 Oct 2019 13:54:37 +0000 (15:54 +0200)]
Make Builders sensitive to @Deprecated annotations

When we are generating a builder for a deprecated type, we need to
consider how it deals with deprecated elements.

There are two scenarios here:

1) status=deprecated -> @Deprecated
In this case it is fair game to produce data, hence the builder
is not deprecated and therefore has @SuppressWarnings("deprecation")

2) status=obsolete -> @Deprecated(forRemoval = true)
In this case the data should not be produced at all, hence
the builder needs to be @Deprecated(forRemoval), too.

We recognize both these conditions and act accordingly. We misue
bug-586 test case to hijack compilation testing.

JIRA: MDSAL-485
Change-Id: I9d08116615cf8c5bdb6a8f4977c9810686618cda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e4ccdeadb4ffddae62860f8d080cb2a391a02f1f)
(cherry picked from commit 4479cc2e987417218982644ce3815c38019f54c1)

4 years agoAdd @Deprecated to obsolete elements 45/85245/1
Robert Varga [Sat, 12 Oct 2019 14:06:19 +0000 (16:06 +0200)]
Add @Deprecated to obsolete elements

This adds the functionality to add @Deprecated to obsolete components,
unlike the Java 9 counterpart, we are not marking the result for removal.

JIRA: MDSAL-481
Change-Id: I2e23e37e65b799b363a518fc5d737b40e5a64a3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 510bf99c58b9b76611901d068ce23f32ca9a46a9)
(cherry picked from commit edb2ffc072437984f1ae87fa9568c6a96adc17bf)

4 years agoBump to odlparent-4.0.13/yangtools-2.1.13 32/85232/6
Robert Varga [Sat, 19 Oct 2019 09:41:23 +0000 (11:41 +0200)]
Bump to odlparent-4.0.13/yangtools-2.1.13

This ugprades both upstreams to latest versions.

Change-Id: Ibe19b7ab4e3ea9656ab50ab58dde9f9bccee9645
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix invalid augmentations in binding2 44/85244/1
Robert Varga [Sat, 19 Oct 2019 15:16:28 +0000 (17:16 +0200)]
Fix invalid augmentations in binding2

This applies the changes done in
4e4bb47c41728c15220203602068a5754efbd62f to binding2.

Change-Id: I695dfaff812f62240f500a768eab097e95b720bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd IetfYangUtil.physAddressBytes() 40/85240/2
Robert Varga [Sat, 19 Oct 2019 10:45:29 +0000 (12:45 +0200)]
Add IetfYangUtil.physAddressBytes()

This adds {mac,phys}AddressBytes() to extract these from well-known
objects.

JIRA: MDSAL-486
Change-Id: Id4a9825be476e4a83bf39c4372340b479dd76164
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b6b5ca2897c00acb04367d009fa698235ba6de06)

4 years agoFix invalid augmentations 42/85242/1
Robert Varga [Sat, 19 Oct 2019 12:43:00 +0000 (14:43 +0200)]
Fix invalid augmentations

choice/case structures are collapsed to their parent data tree
node, hence it is invalid to define (in same namespace) the equivalent
of:

container {
  leaf foo { type string; }
  choice some {
    case foo {
      leaf foo { type string; }
    }
  }
}

Fix up the testing model.

Change-Id: I1e3ef8f9b38016e0290221f22b8233fba176bc0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix bug5882 test case 38/85238/1
Robert Varga [Sat, 19 Oct 2019 10:18:54 +0000 (12:18 +0200)]
Fix bug5882 test case

This test case uses illegal duplicate leaves, fix that up.

Change-Id: I3330fafb11b798ab74f9a64b04f4bff8d82b2ce6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove superfluous @NonNull annotation 81/84481/1
Robert Varga [Sun, 15 Sep 2019 10:11:14 +0000 (12:11 +0200)]
Remove superfluous @NonNull annotation

MoreObjects.toStringHelper() is not tagged properly, hence generated
toString() methods generate a ton of nullness warnings. Fix that up
by removing the annotation (to mirror what we are otherwise doing
in other methods).

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

4 years agoBump versions to 3.0.12-SNAPSHOT 17/84417/1
Robert Varga [Fri, 13 Sep 2019 21:51:22 +0000 (23:51 +0200)]
Bump versions to 3.0.12-SNAPSHOT

This starts the next development iteration.

Change-Id: I1ca6b3f1613f9039411533dcb783c35730ee9cf4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse refcounting to lower the number of registrations 12/84412/1
Robert Varga [Mon, 29 Jul 2019 11:09:13 +0000 (13:09 +0200)]
Use refcounting to lower the number of registrations

The fix for MDSAL-461 has introduced multiple registrations for
each YangModuleInfo, which while correct ends up parsing the same
sources multiple times.

This patch updates the handling to guard against that possibility
by adding an explicit reference counting layer, so that each
instance of YangModuleInfo is registered exactly once.

Change-Id: Id925391241cd36a26bfa05cd28f8b747d5d7ba24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 066ee3a904b39637ed7861d3aee2d55d67987139)
(cherry picked from commit fdd972b410fa6929e241fa9481c29eaac3de1a94)

4 years agoRemove YangModuleInfo when it is unregistered 11/84411/1
Robert Varga [Tue, 23 Jul 2019 13:47:22 +0000 (15:47 +0200)]
Remove YangModuleInfo when it is unregistered

This patch addresses a FIXME, which was left in the code base
and thus makes sure we do not retain stale class loaders from
explicit registrations.

Unfortunately the design of this class mixes quite a few aspects:
- the ability to build SchemaContext
- the ability to explicitly register YangModuleInfos (with their
  dependencies)
- the ability to implicitly register YangModuleInfos through
  ClassLoadingStrategy.loadClass() failure path
- the ability to create an instance with pre-populated set of entries
  used only for testing/static purposes

The interplay between these aspects is ill-defined, especially
items 2 and 3, hence fixing the issue in most correct way possible
requires redesigning internal state tracking, explicitly
differentiating between the two cases.

JIRA: MDSAL-461
Change-Id: I8f99d3975e971e32b267788a463d9b73bb57e49e
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6072e689bdef8c166b4633ec5dedc6e7e636b8d5)

4 years agoUse checkState() in ModuleInfoBackedContext 10/84410/1
Robert Varga [Tue, 23 Jul 2019 12:03:43 +0000 (14:03 +0200)]
Use checkState() in ModuleInfoBackedContext

This simplifies the code a bit, by performing a checkState()
instead of explicit if/throw.

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

4 years agoDecrease try-catch block size 09/84409/1
Robert Varga [Tue, 23 Jul 2019 10:33:23 +0000 (12:33 +0200)]
Decrease try-catch block size

We do not want to cover the registration process in (catch Exception),
as that will mask other failures.

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

4 years agoReorganize ModuleInfoBackedContext 08/84408/1
Robert Varga [Thu, 18 Jul 2019 09:08:30 +0000 (11:08 +0200)]
Reorganize ModuleInfoBackedContext

This is just a shuffle of methods, cleaning up the structure
of the file, making things more discoverable.

JIRA: MDSAL-461
Change-Id: Ibf80248cd91880cc0169e1d9a86eb6a95b2f7860
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 27b13859967885ddecb002aa6f92db59266f14c3)

4 years agoModuleInfoBackedContext cache 07/84407/1
Robert Varga [Mon, 24 Jun 2019 09:21:26 +0000 (11:21 +0200)]
ModuleInfoBackedContext cache

ModuleInfoBackedContext can be effectively cached based on
the set of class loading strategy and infos that go into it. This
patch adds such a cache.

JIRA: MDSAL-418
Change-Id: Icbb7ac5270c76c374a6e839010090a002b0ab176
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0a247c177f5e774e453328a24b231773f85581ca)

4 years agoMigrate ModuleInfo cache to BindingReflections 06/84406/1
Robert Varga [Sun, 23 Jun 2019 21:54:34 +0000 (23:54 +0200)]
Migrate ModuleInfo cache to BindingReflections

Reflections are using a cache already, so adding another one does
not really hurt. This allows code reuse between our test suite
and downstreams.

JIRA: MDSAL-418
Change-Id: Id4474a0754f33b880afaff333279969f947df494
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0803bc02293d0121ed58635529ed96b41ae7d828)

4 years agoReduce use of java.lang constructors 05/84405/1
Robert Varga [Tue, 6 Aug 2019 12:12:19 +0000 (14:12 +0200)]
Reduce use of java.lang constructors

Long/Integer constructors have been deprecated, reduce their use.

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

4 years agoFix string duplication in Ipv6Utils 04/84404/1
Robert Varga [Fri, 16 Aug 2019 11:40:52 +0000 (13:40 +0200)]
Fix string duplication in Ipv6Utils

This is minor code smell, create a method to concentrate common
functionality.

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

4 years agoRemove trailing comments 03/84403/1
Robert Varga [Fri, 16 Aug 2019 11:20:53 +0000 (13:20 +0200)]
Remove trailing comments

This fixes up minor code smells reported by sonar.

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

4 years agoFix runtime builder string duplication 02/84402/1
Robert Varga [Fri, 16 Aug 2019 11:36:16 +0000 (13:36 +0200)]
Fix runtime builder string duplication

This is a minor code smell, concentrate exception allocation to
get rid of it.

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

4 years agoFix mergeable if-the-else statements 01/84401/1
Robert Varga [Fri, 16 Aug 2019 13:32:11 +0000 (15:32 +0200)]
Fix mergeable if-the-else statements

This fixes DTOs to use simple return expressions. While we are in
the area, also optimize toString() methods to lower their footprint.

Change-Id: Ie206c2942c5fb9b6cbbdc2a31d197560559fd660
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 18748923d6759e0e301b608e6d6bb15a69583bbb)
(cherry picked from commit f9c46078ecd09194cb9f109297c70a296f349829)

4 years agoMake BaseTemplate.asArguments() take a Collection 99/84399/1
Robert Varga [Thu, 5 Sep 2019 12:25:28 +0000 (14:25 +0200)]
Make BaseTemplate.asArguments() take a Collection

This side-steps the need for IterableExtensions, make the code
a tad faster.

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

4 years agoRemove use of new Integer(String) 98/84398/1
Robert Varga [Thu, 5 Sep 2019 10:05:57 +0000 (12:05 +0200)]
Remove use of new Integer(String)

This constructor has been deprecated in Java 9, migrate to
Integer.valueOf(String) instead.

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

4 years agoOptimize array checks 97/84397/1
Robert Varga [Wed, 4 Sep 2019 14:24:01 +0000 (16:24 +0200)]
Optimize array checks

Rather than bouncing through .importedName().contains("[]"), we
can make this check through .name().endsWith("[]"), which prevents
a round-trip to import mechanics and is potentially faster.

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

4 years agoCache computed fieldName in templates 96/84396/1
Robert Varga [Wed, 4 Sep 2019 14:17:32 +0000 (16:17 +0200)]
Cache computed fieldName in templates

We end up using the same name multiple times, which really is an
invariant. Cache and reuse the constant, so that we end up with
more efficient code.

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

4 years agoFix ClassTemplate.genConstructor() declaration 95/84395/1
Robert Varga [Wed, 4 Sep 2019 12:44:47 +0000 (14:44 +0200)]
Fix ClassTemplate.genConstructor() declaration

Using an array here is forcing us to needlessly unwrap the arraylist
(a perfectly iterable thing) to an array, which is only iterater over.

Fix this by passing down an iterable, which means the list can be
passed down as is.

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

4 years agoAcquire first value manually in ClassTemplate 94/84394/1
Robert Varga [Wed, 4 Sep 2019 12:40:35 +0000 (14:40 +0200)]
Acquire first value manually in ClassTemplate

xtend's get(0) extension ends up creating a temporary list
holding a copy of the (single) value. This is not entirely
efficient, as we can get the same result from plain iterator.

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

4 years agoAcquire first entry of type constants in BuilderTemplate 93/84393/1
Robert Varga [Wed, 4 Sep 2019 12:30:47 +0000 (14:30 +0200)]
Acquire first entry of type constants in BuilderTemplate

Current code is relying on xtend Conversions to get first entry
from keySet/values separately. That code ends up copying the entire
collection into an array before picking the first element, which
is ... far from optimal.

Peel the first entrySet item using iterator().next() and then
reference key/value from there, which removes a dependency on
Conversions and is way more efficient.

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

4 years agoOptimize allProperties sorting 92/84392/1
Robert Varga [Wed, 4 Sep 2019 11:55:25 +0000 (13:55 +0200)]
Optimize allProperties sorting

Java 8 has list.sort(), which we can easily short-circuit to
ArrayList's implementation by using 'val' declaration. We can
also make the comparator a constant, so that it is widely reused.

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

4 years agoOptimize ClassTemplate.allProperties 91/84391/1
Robert Varga [Wed, 4 Sep 2019 11:46:14 +0000 (13:46 +0200)]
Optimize ClassTemplate.allProperties

This variable is guaranteed to be a List, declare it as such,
adding following benefits:
- eliminates ClassTemplate's reliance on IterableExtensions
- a few isEmpty() checks get be eliminated, as size() is now
  handled through List.size()

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

4 years agoOptimize BuilderTemplate string references 90/84390/1
Robert Varga [Wed, 4 Sep 2019 11:34:38 +0000 (13:34 +0200)]
Optimize BuilderTemplate string references

AUGMENTATION_FIELD.toFirstUpper is a true constant, make sure we
compute it only once.

Also, in case of augmentable, the augmentable imported name is an
invariant, hence precompute the string and use it multiple times
in the template.

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

4 years agoImprove generated builder documentation 89/84389/1
Robert Varga [Tue, 3 Sep 2019 20:01:24 +0000 (22:01 +0200)]
Improve generated builder documentation

This adds some sorely-needed guidelines as to how to use generated
builders.

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

4 years agoBump yangtools to 2.1.12 68/84368/2
Robert Varga [Fri, 13 Sep 2019 06:58:51 +0000 (08:58 +0200)]
Bump yangtools to 2.1.12

Pick up latest fixes.

Change-Id: Ifb9874f0ef47e4c6f90a5ef3c69aedfbf7dbc45c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove javadoc plugin override 67/84367/2
Robert Varga [Fri, 13 Sep 2019 06:57:06 +0000 (08:57 +0200)]
Remove javadoc plugin override

odlparent is shipping v3.1.1, hence we do not need to provide
an explicit version.

Change-Id: I0e5d8cf2200a39de46f975f9cd84174b443b76ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 4.0.12 66/84366/2
Robert Varga [Fri, 13 Sep 2019 06:56:32 +0000 (08:56 +0200)]
Bump odlparent to 4.0.12

This bumps odlparent to the latest release.

Change-Id: I32b4a951974d0f5538eebf1f46c16ec0beceb9b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix curly braces 88/84388/1
Robert Varga [Tue, 6 Aug 2019 12:24:20 +0000 (14:24 +0200)]
Fix curly braces

These anonymous classes should be properly spelled out, as should
private constructors.

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

4 years agoFix checkstyle in javadocs 87/84387/1
Robert Varga [Tue, 6 Aug 2019 11:29:45 +0000 (13:29 +0200)]
Fix checkstyle in javadocs

Updated checkstyle is catching more violations, fix them up.

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

4 years agoFix bad javadoc license headers 86/84386/1
Robert Varga [Mon, 5 Aug 2019 14:20:31 +0000 (16:20 +0200)]
Fix bad javadoc license headers

License headers should not be javadocs, fix that up.

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

4 years agoFix Builder javadoc mis-reference 85/84185/1
Robert Varga [Tue, 3 Sep 2019 19:24:17 +0000 (21:24 +0200)]
Fix Builder javadoc mis-reference

Builders should reference target type in their documentation.

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

4 years agoImprove BaseYangTypes lookups 53/84153/1
Robert Varga [Mon, 2 Sep 2019 15:42:40 +0000 (17:42 +0200)]
Improve BaseYangTypes lookups

Update constant definition to be bound to ImmutableSet, so that
JIT has an easier time optimizing these lookups.

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

4 years agoGuard generator lookup against nulls 56/83956/1
Robert Varga [Sat, 24 Aug 2019 08:46:16 +0000 (10:46 +0200)]
Guard generator lookup against nulls

If we encounter an unsupported type we can end up throwing a NPE
without any details. This hardens the lookup to verify we have
a hit, and report the type if we have a miss.

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

4 years agoEliminate 'txt' temporary 88/83688/1
Robert Varga [Thu, 15 Aug 2019 11:29:15 +0000 (13:29 +0200)]
Eliminate 'txt' temporary

This variable is not really needed and the way it is used SpotBugs
reports a (valid) dead local store. Eliminate the variable completely.

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

4 years agoFix use of StringTokenizer methods 74/83674/1
Robert Varga [Thu, 15 Aug 2019 11:21:56 +0000 (13:21 +0200)]
Fix use of StringTokenizer methods

Rather than using Enumeration-related methods (*Element()), use
the methods provided by StringTokenizer (*Token()), which have
the same functionality, but are not down-casted to Object.

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

4 years agoMake AlphabeticallyTypeMemberComparator Serializable 73/83673/1
Robert Varga [Thu, 15 Aug 2019 11:07:20 +0000 (13:07 +0200)]
Make AlphabeticallyTypeMemberComparator Serializable

Comparators are recommended to be serializable, this fulfills
the need.

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

4 years agoFix SpotBugs complaing around locale 72/83672/1
Robert Varga [Thu, 15 Aug 2019 11:05:50 +0000 (13:05 +0200)]
Fix SpotBugs complaing around locale

We are using english locale, which should work across the platform.

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

4 years agoFix InterfaceTemplate documentation 71/83671/1
Robert Varga [Thu, 15 Aug 2019 11:04:26 +0000 (13:04 +0200)]
Fix InterfaceTemplate documentation

InterfaceTemplate will fail to instantiate with a NPE if a null
type is ever passed in. Fix documentation and remove dead code.

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

4 years agoOptimize whitespace replacement 01/83601/2
Robert Varga [Tue, 6 Aug 2019 15:27:33 +0000 (17:27 +0200)]
Optimize whitespace replacement

Rather than doing two replacements, use a single two-character
matcher and a single replacement pass. While we're in the area,
also create a SPACE constant and use it where we mean ' ' as a
char (not a string).

Change-Id: I30d7c16074fe172a834ecf1bb0fe30a18fdc6bac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse bulk-close for internal registrations 27/83627/1
Robert Varga [Wed, 14 Aug 2019 14:49:59 +0000 (16:49 +0200)]
Use bulk-close for internal registrations

Rather than using wrapped registrations through the public API,
we really want to first remove all modules and then update the
context (if needed).

JIRA: MDSAL-466
Change-Id: Ib281fff7264b3dd11b222095f8286087cb488002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a89133403cedfb24983ef5a9d945ab02232fd1bd)

4 years agoDisable updates when we are stopping 79/83579/1
Robert Varga [Tue, 6 Aug 2019 17:48:05 +0000 (19:48 +0200)]
Disable updates when we are stopping

We should not be propagating bundle updates when we know we are
stopping. This patch marks that knowledge in the tracker.

JIRA: MDSAL-466
Change-Id: Ie4e8b96907a8909150b4080000888d1d10ce8e54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7a739663d766c8ee83fb17e0e4199a3945ad674f)

4 years agoDo not lose newlines/tabs from javadoc 31/83431/1
Robert Varga [Tue, 6 Aug 2019 14:24:44 +0000 (16:24 +0200)]
Do not lose newlines/tabs from javadoc

When we are formatting javadoc for a accessor method, we must treat
any newlines/tabs as whitespace and not lose them, otherwise we would
end up with concatenated words.

JIRA: MDSAL-416
Change-Id: I3c0fc296692a141d6787a5cba8b17738a108274e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions for 3.0.11-SNAPSHOT 06/83106/1
Robert Varga [Thu, 18 Jul 2019 10:59:08 +0000 (12:59 +0200)]
Bump versions for 3.0.11-SNAPSHOT

This starts the next development iteration.

Change-Id: I8255d7cf0dcc4b8d7ea4ba94dc9d50d7dba774bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded null check 50/82950/1
Robert Varga [Mon, 8 Jul 2019 09:24:06 +0000 (11:24 +0200)]
Remove unneeded null check

We are performing a null and an instanceof check, where the latter
can also serve as a a null check. Remove the explicit null check.

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

4 years agoRemove unneeded temporary variables 49/82949/1
Robert Varga [Mon, 8 Jul 2019 09:16:24 +0000 (11:16 +0200)]
Remove unneeded temporary variables

getRpcs/getNotifications() result is only ever iterated over,
we do not need a full Set.

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

4 years agoMake LogicalDatastoreType a WritableObject 23/82923/1
Robert Varga [Wed, 3 Jul 2019 22:37:53 +0000 (00:37 +0200)]
Make LogicalDatastoreType a WritableObject

This is a low-cardinality enum, which we need to serialize quite
often. Make it a simple WritableObject, so users can get common
handling. One specific user is sal-remoterpc-connector, which
needs to be able to serialize DOMDataTreeIdentifier.

JIRA: CONTROLLER-1894
Change-Id: Iee4610e093639629039a2e21ab1cfc852b756169
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b0c200e4da8fced37726872197c510766a7ed4fd)

4 years agoUse cached AugmentationIdentifiers in BindingRuntimeContext 98/82898/2
Robert Varga [Fri, 31 May 2019 10:55:50 +0000 (12:55 +0200)]
Use cached AugmentationIdentifiers in BindingRuntimeContext

AugmentationIdentifiers allocated from BindingRuntimeContext
end up being used across the system. This ensures we squash
instances to system-wide cache.

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

4 years agoImprove getResolvedAugmentationSchema() 97/82897/2
Robert Varga [Fri, 31 May 2019 10:11:08 +0000 (12:11 +0200)]
Improve getResolvedAugmentationSchema()

This method is used for instantiating prototypes, from whence
it is used all over the place. Sharing a single instance allows
us to slightly improve lookups.

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

4 years agoTake advantage of AbstractAugmentable 99/82899/1
Robert Varga [Wed, 1 May 2019 14:34:35 +0000 (16:34 +0200)]
Take advantage of AbstractAugmentable

Rather than hand-rolling Augmentable implementations, take advantage
of AbstractAugmentable as the holder of augmentations -- reducing
the amount of generated code.

Since this leads to generated code not being exposed to augmentation(),
we can now rename the generic argument there to a full-compliant
name.

JIRA: MDSAL-445
Change-Id: I2459489074e9e50e82bd9d1c8eb051f9833b7a0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4fe6932b0f3911ee4a7684d3c9616efbbeb053a1)

4 years agoFix augmented action code generation 90/82890/1
Robert Varga [Tue, 2 Jul 2019 11:49:06 +0000 (13:49 +0200)]
Fix augmented action code generation

When an action is introduced as part of an augment statement, we
attempt to generate it in the augmented module, which refuses to
generate its input/output statements, leading to a NPE.

This patch updates codegen to ignore augmenting actions in the
augmented module and process them as part of augmentation.

JIRA: MDSAL-459
Change-Id: Ibd7d7abc5ec1eec6d32ee1885da00a0de69b2445
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit dee452d009946a175273ac2a21dca4174b2142af)

4 years agoBump versions to 3.0.10-SNAPSHOT 12/82812/1
Robert Varga [Mon, 1 Jul 2019 06:37:45 +0000 (08:37 +0200)]
Bump versions to 3.0.10-SNAPSHOT

This starts the next development iteration.

Change-Id: Iedb025a8e224ef2262687829c316843f7cfa07b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 2.1.11 10/82810/1
Robert Varga [Mon, 1 Jul 2019 04:14:15 +0000 (06:14 +0200)]
Bump yangtools to 2.1.11

This picks up the latest improvements.

Change-Id: Ide1aecefbcd747770d78fd9ff49e1cef14ff64f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 4.0.11 09/82809/1
Robert Varga [Mon, 1 Jul 2019 04:13:44 +0000 (06:13 +0200)]
Bump odlparent to 4.0.11

This picks up the latest updates.

Change-Id: Iad627fdf7c2261aa0c49a7b8a7502d3564b38cad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoResolve bits/union nested type naming 62/82762/1
Robert Varga [Tue, 25 Jun 2019 13:07:06 +0000 (15:07 +0200)]
Resolve bits/union nested type naming

The cases where we allocate an enumeration, bits or union type
for a leaf-like construct (leaf, leaf-list) need to handle an
edge case -- JLS does not allow nested classes to be named the
same as the enclosing class.

Enumeration case was already handled in
AbstractGeneratedTypeBuilder, this patch extends that support
to handle bits and union.

JIRA: MDSAL-458
Change-Id: Idc19b179274c7973ed205ffdae1d2242cbd2dbf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 30952238d240260310d357c2e80be55021ccb1fc)

4 years agoRemove unused Matcher 45/82745/2
Robert Varga [Wed, 26 Jun 2019 11:20:33 +0000 (13:20 +0200)]
Remove unused Matcher

DOT_MATCHER is not used anywhere, remove it.

Change-Id: Ibc9cbdab0d9008cfd63522db951c93843ea20a66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReuse SUCCESS_FUTURE 47/82747/1
Robert Varga [Mon, 24 Jun 2019 15:36:40 +0000 (17:36 +0200)]
Reuse SUCCESS_FUTURE

Rather than allocating new temporary objects reuse a constant
we have handy.

Change-Id: I3b27eb1cc75c967e4f880e2c5f287c040276f674
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFlatten submodule hierarchy for YangModuleInfo 70/82670/1
Anna Bencurova [Mon, 10 Jun 2019 12:55:49 +0000 (14:55 +0200)]
Flatten submodule hierarchy for YangModuleInfo

YANG inherently contains modules and submodules, where submodules
do not really have further submodules. While YANG 1.0 allowed
inclusion of submodules in other submodules, and that is modeled
in yang-model-api, this practice has been deprecated with YANG 1.1.

If we are faced with multiple such includes, for example both
module and submodule including a second submodule, we could end up
generating superfluous classes, just to represent the second
submodule twice (once for module's purposes and once for submodule's
purposes) -- hence when all of them are collected recursively, we
would end up with two distinct instances for the same source.

Since submodules are not directly visible outside of the main class,
this hierarchy is not public API and is a purely internal thing.

This patch re-organizes generation so that we present all submodules
as dependencies of the main module, which automatically solves the
problem, while also making for nicer class layout, as we do not get
multiply-nested classes.

JIRA: MDSAL-457
Change-Id: Ic78edaf852f3497f3c4c96fdca3a77de30b7f8c1
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4a8ae0d2fbffc56edc956cde9a9ecde28f3e9a34)

4 years agoCheck registration being closed 56/82556/1
Robert Varga [Tue, 30 Apr 2019 03:35:41 +0000 (05:35 +0200)]
Check registration being closed

Check if the registration has been closed before firing events.
This way we stop delivering events a bit sooner, improving shutdown
speed and correctness.

JIRA: MDSAL-429
Change-Id: I533f2b07e8cd14597c29d2d3d9c11c44a1bb7ff5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d90336420645d32d2c4684c7fd3839827e903774)

4 years agoAdd a simplified SimpleDOMActionResult constructor 38/82238/1
Robert Varga [Fri, 24 May 2019 14:59:11 +0000 (16:59 +0200)]
Add a simplified SimpleDOMActionResult constructor

If the user is not providing any errors, it should be a fair
game to provide just the value.

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

5 years agoGroupingDefinitionDependencySort needs to consider actions 26/82126/1
Robert Varga [Wed, 15 May 2019 12:01:19 +0000 (14:01 +0200)]
GroupingDefinitionDependencySort needs to consider actions

In order to be able to correctly process actions/notifications
which can refer to other groupings, we must properly sort them
within each module.

To do that, GroupingDefinitionDependencySort must consider
uses nodes within them to properly construct the dependency
graph.

JIRA: MDSAL-448
Change-Id: I627702e39b1ab235b1c77ceaa2717ee03b3b2e39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6fca42e6bde88795354a2a2386bc7a6d76aaec47)

5 years agoDo not issue immediate build when looking up grouping 90/82090/1
Robert Varga [Wed, 15 May 2019 11:52:34 +0000 (13:52 +0200)]
Do not issue immediate build when looking up grouping

If we fail to find a grouping, we will end up with a NPE which
does not provide any information. Move the .build() call so that
the proper ISE kicks in.

JIRA: MDSAL-448
Change-Id: I57d6a74074b49def9bbc814732cfc48cd5265072
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e802061e56eea9779e13eede5f949aa96666ea28)

5 years agoAllow SnapshotBackedReadTransaction customization 52/81952/1
Robert Varga [Tue, 7 May 2019 13:03:57 +0000 (15:03 +0200)]
Allow SnapshotBackedReadTransaction customization

In some specific cases we need to customize abort-like handling,
which is already implemented for write-like transactions, but is
not present for read-only transaction.

This patch adds the capability to attach a close() handler and
makes sure AbstractSnapshotBackedTransactionChain takes advantage
of it.

JIRA: CONTROLLER-1879
Change-Id: Ic7027956556b5dd25120ee81613a6151e5dbc501
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit bd73bf5803137b27e25a647ff056da3f59e0a682)

5 years agoFix memory leak in BA mount service 03/81903/1
Robert Varga [Sun, 5 May 2019 18:15:19 +0000 (20:15 +0200)]
Fix memory leak in BA mount service

The cache used in BA mount service uses weakKeys() so the keys
(DOM mountpoint) could be GCed when no except cache, referenced
them).

However the values in the cache (BA mountpoint) also kept a reference
to the key, so the key was never weakly reachable and thus never GCed
resulting in a memory leak.

This is especially visible in case of frequent reconnects of netconf
mountpoints where after every reconnect a new DOM mountpoint is
created, requiring a new BA mountpoint creating new entry in the
cache of BA mount service.

This patch updates the entire suite of adapters, as it is shared
across all instances.

Change-Id: I9c109dd6d499d6185842d6a1ad5a59d75565af5c
Signed-off-by: Maros Marsalek <mmarsalek@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8ae89c54f8019f53327001d1b916a53963097b34)