mdsal.git
5 years agoPackage rfc8344 ietf-ip 94/73594/6
Robert Varga [Thu, 28 Jun 2018 22:43:13 +0000 (00:43 +0200)]
Package rfc8344 ietf-ip

This is the NMDA-compliant update, package it, but do not install
yet.

JIRA: MDSAL-358
Change-Id: Ie853d313fdf17facf1f6b306012b48f2ac642574
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPackage rfc8343 ietf-interfaces 93/73593/6
Robert Varga [Thu, 28 Jun 2018 22:34:29 +0000 (00:34 +0200)]
Package rfc8343 ietf-interfaces

This is the NMDA-compliant update, package it, but do not install
yet.

JIRA: MDSAL-358
Change-Id: I67a33a511b50922d20b30489cdcc1c0d084a81ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPackage rfc8342 ietf-datastores, ietf-origin 95/73595/4
Robert Varga [Fri, 29 Jun 2018 00:15:03 +0000 (02:15 +0200)]
Package rfc8342 ietf-datastores, ietf-origin

This is the core model of NMDA, defining how datastores are laid
out. Package it for the identities it provides, which will prove
useful in NMDA MD-SAL design.

JIRA: MDSAL-358
Change-Id: I5de5079495002bdff8677f750301aebf33dcde8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoClarify the event listener failure documentation 80/73880/3
Stephen Kitt [Tue, 10 Jul 2018 14:28:14 +0000 (16:28 +0200)]
Clarify the event listener failure documentation

Change-Id: Ic1f79e926e940a9d3a418b891d28d58603d2d31e
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoTake advantage of FluentFutures 62/73862/2
Robert Varga [Mon, 9 Jul 2018 22:12:06 +0000 (00:12 +0200)]
Take advantage of FluentFutures

FluentFutures allow

Change-Id: I8c260174cf6f824827d8a6ff8df15c00d70c81e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOptimize single-value range checks 43/73743/3
Robert Varga [Wed, 4 Jul 2018 13:54:06 +0000 (15:54 +0200)]
Optimize single-value range checks

For 'length 0' we generate a 'length >= 0 && length <= 0' check,
where we can simply use 'length == 0'. Fix that by teaching
the generator that min and max can be equal.

Change-Id: I1334bfcd590db59b18665f6609ee71c48e4646ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd Binding{Data,RpcFuture}Aware bridge interfaces 24/73824/6
Robert Varga [Mon, 9 Jul 2018 02:30:47 +0000 (04:30 +0200)]
Add Binding{Data,RpcFuture}Aware bridge interfaces

We need to be able to communicate the binding future between two
incarnations of LazyDOMRpcResultFuture: controller and mdsal.

Create a migration interface for this purpose, which exposes
the required method. Convert RpcServiceAdapter to use it instead
of relying on LazyDOMRpcResultFuture class.

The same goes for LazySerializedContainerNode, bridged via
BindingDataAware.

JIRA: SFC-222
Change-Id: Icf5df0a2cfb4ec24d404ac6d077c2755692b9d5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix ClusterSingletonServiceRegistration 53/73753/2
Robert Varga [Wed, 4 Jul 2018 14:48:50 +0000 (16:48 +0200)]
Fix ClusterSingletonServiceRegistration

This interface is intended to be a Registration, not an AutoCloseable,
and so is its only implementation.

Switch from AutoCloseable to ObjectRegistration, so users can take
advantage of the simplified API.

Change-Id: I47be557dce38f23e92d9744f019e327fa03c9321
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix GenericEntityOwnershipCandidateRegistration format 52/73752/2
Robert Varga [Wed, 4 Jul 2018 14:48:22 +0000 (16:48 +0200)]
Fix GenericEntityOwnershipCandidateRegistration format

The javadoc has wrong indent, fix that.

Change-Id: I00ff706bb5ab44d82af6d8755776435e7600284c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoEliminate synthetic access to invoke0() 22/73822/3
Robert Varga [Mon, 9 Jul 2018 02:19:37 +0000 (04:19 +0200)]
Eliminate synthetic access to invoke0()

This method is invoked from InvocationStrategy, hence it being
private generates a synthetic accessor method. Change method
visibility to package-private, eliminating this inefficiency.

Change-Id: I74ee9f8c729ba8d0892316fc405a0d99830b5f04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix xtend warnings 12/73712/1
Robert Varga [Tue, 3 Jul 2018 15:40:46 +0000 (17:40 +0200)]
Fix xtend warnings

xtend-maven-plugin-2.14.0 flushes out a few more warnings, fix them.

Change-Id: I07bfb4da699ec2c176bebd5b6b92289c0e65b002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAllow ipv4-address-no-zone to be parsed 58/72758/17
Robert Varga [Thu, 7 Jun 2018 11:50:35 +0000 (13:50 +0200)]
Allow ipv4-address-no-zone to be parsed

Add methods which allow no-zone addresses to be parsed equally
efficiently as ip addresses.

JIRA: BGPCEP-790
Change-Id: Ic119430e3398777addeec2b41ca8e83eaead363b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove maven site configuration 70/73670/4
Robert Varga [Mon, 2 Jul 2018 22:16:40 +0000 (00:16 +0200)]
Remove maven site configuration

We are not using maven site, remove its leftovers.

Change-Id: I3321b1564516c9097a9790e9d11bf9edcf619aa5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBUG-7697: add defences against nulls 79/73679/1
Robert Varga [Tue, 3 Jul 2018 07:37:41 +0000 (09:37 +0200)]
BUG-7697: add defences against nulls

Null listener is invalid, also make sure we do not ever set
prevRpcs to null.

Change-Id: If8cd16e93a2a07c77a26569c8ecacdc35696cea1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPackage rfc7952 ietf-yang-metadata 01/73601/2
Robert Varga [Fri, 29 Jun 2018 10:03:35 +0000 (12:03 +0200)]
Package rfc7952 ietf-yang-metadata

This is a base exptension required for NMDA models, package it here.

JIRA: MDSAL-358
Change-Id: I567f9d45ffa965b2eb3ea326692128f5af46ae74
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRepackage RFC8345 Network Topologies 91/73591/4
Robert Varga [Thu, 28 Jun 2018 21:56:14 +0000 (23:56 +0200)]
Repackage RFC8345 Network Topologies

This is an upgrade of ietf-network, which is not used anywhere
anymore to RFC8345 with proper modular artifacts.

JIRA: MDSAL-358
Change-Id: I898a1e7aa69d216972ce23dacb13f467ce6f9619
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRefactor GeneratorJavaFile 95/73495/10
Robert Varga [Wed, 27 Jun 2018 17:06:08 +0000 (19:06 +0200)]
Refactor GeneratorJavaFile

This patch reworks GeneratorJavaFile so that it performs two-step
code generation. This allows us to understand what files are going
to be generated before actually generating them.

For bonus points we have removed a dependency on the ancient
plexus-container-default and made mdsal-binding-java-api-generator
maven-agnostic.

JIRA: MDSAL-350
Change-Id: Ie29865d93cce751a5ca265105a24a24049f4ccdb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to yangtools 2.0.7 51/73451/8
Stephen Kitt [Tue, 26 Jun 2018 16:01:36 +0000 (18:01 +0200)]
Bump to yangtools 2.0.7

Change-Id: Ibf88882e8f5611444e952a73fc2bbcf7e2e1709a
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoGenerate code for action statements 78/72678/24
Robert Varga [Wed, 21 Mar 2018 02:57:21 +0000 (03:57 +0100)]
Generate code for action statements

RFC7950 defines actions, which are similar to RPCs in that they
can be invoked. This patch teaches binding codegen to generate
the interfaces for them.

JIRA: MDSAL-300
Change-Id: I8c2f9566e25948c8604d76ce52d86304b0f8be03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOverride xtend-maven-plugin dependencies 71/73571/1
Robert Varga [Thu, 28 Jun 2018 17:23:21 +0000 (19:23 +0200)]
Override xtend-maven-plugin dependencies

org.eclipse.equinox.common-3.10.0 seems to be required for some
reason.

Change-Id: I556c934db07148f05f701d1c541fd1f1bfc34219
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoEnforce patterns in supertype constructors 29/73129/5
Robert Varga [Mon, 18 Jun 2018 12:02:15 +0000 (14:02 +0200)]
Enforce patterns in supertype constructors

We have failed to enforce patterns when being constructed from
a supertype, which would allow creating invalid instances.

Fix that by enforcing patterns consistently.

JIRA: MDSAL-351
Change-Id: I16f4485ec8b6535c7094e3aac018cb6fbb0e5570
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCentralize code generation a bit more 97/73497/2
Robert Varga [Wed, 27 Jun 2018 18:33:19 +0000 (20:33 +0200)]
Centralize code generation a bit more

BaseCompilationTest should be used as the baseline for creating
tests which create source code. Refactor it a bit, to allow for
wider reuse.

Change-Id: I69a9d779222439813efb70b25cf88e5b03ac4f7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUse String.replace(char, char) instead of splitting 94/73494/1
Robert Varga [Wed, 27 Jun 2018 17:28:14 +0000 (19:28 +0200)]
Use String.replace(char, char) instead of splitting

This code really wants to do a simple character substitution,
which has an elegant solution. This means we do not end up
compiling the replacement pattern and use a very efficient method.

Change-Id: I8430ecf9216ae49c3fcc58c24c0315f6510204fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoConstify Types.listTypeFor(BaseYangTypes.STRING_TYPE) 15/73415/7
Robert Varga [Mon, 25 Jun 2018 16:29:25 +0000 (18:29 +0200)]
Constify Types.listTypeFor(BaseYangTypes.STRING_TYPE)

We use this type for each constraint, hence we should be treating
it as a constant.

Change-Id: I1e730ea8439e154295841924776f6049d2347d60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoHide parameterized Types constants 14/73414/7
Robert Varga [Mon, 25 Jun 2018 16:24:32 +0000 (18:24 +0200)]
Hide parameterized Types constants

These constants should be accessed via their specializing static
factory methods. Hide them and fix the single offending caller.

Change-Id: Ia0b63a4154b5e1dc86e73645b7935cb34d9c78cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoLower BindingTypes constant visibility 13/73413/7
Robert Varga [Mon, 25 Jun 2018 16:16:18 +0000 (18:16 +0200)]
Lower BindingTypes constant visibility

All of these types should be accessed via their concretizing
static factory methods, so hide them from outside world.

Change-Id: If6dab56c73ed979da4fe43e281cf19a0646d089f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix case-related augment test 69/73469/2
Robert Varga [Wed, 27 Jun 2018 09:50:05 +0000 (11:50 +0200)]
Fix case-related augment test

The test model used in this test is not valid, as it introduces
same container/leaf as both an augmentation of the list and as an
augmentation of that list's choice, leading to the leaf/container
being defined twice in the list's data tree hierarchy.

Change-Id: I582b53ea942f71141e98e14aa0f23878af339b86
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump odlparent to 3.1.2 14/72514/3
Stephen Kitt [Thu, 31 May 2018 07:06:27 +0000 (09:06 +0200)]
Bump odlparent to 3.1.2

Change-Id: Ia9a8df509d9b1b50eb1f93b9c5f0210c1f2828e2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoAdd Action and RpcOutput interfaces 58/73158/10
Robert Varga [Mon, 18 Jun 2018 20:21:56 +0000 (22:21 +0200)]
Add Action and RpcOutput interfaces

This patch adds the binding interface prototype for actions.
Codegen will attach to specializations of this interface for
concrete generated types.

JIRA: MDSAL-300
Change-Id: I2fc97df50033b0d2d8f96b8281a82999a6b62869
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCleanup AbstractForwardedDataBroker 03/73403/4
Robert Varga [Mon, 25 Jun 2018 13:26:40 +0000 (15:26 +0200)]
Cleanup AbstractForwardedDataBroker

Remove unused AutoCloseable and require codec and delegate to be
non-null.

Change-Id: I48888894eff1ca6eb849012f60f03c6c62993387
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix root choice targeting 82/72382/27
Robert Varga [Mon, 28 May 2018 23:16:38 +0000 (01:16 +0200)]
Fix root choice targeting

InstanceIdentifier codec infrastructure cannot deal with choices
which have only grouping children due to the inability to properly
find the choice schema.

Use the case-assisted addressing mode to allow these items to be
properly resolved.

JIRA: MDSAL-45
Change-Id: I61f88e0baa854abc8286ca5c57edd572638ca63b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAllow base type to be passed down 11/73211/7
Robert Varga [Wed, 20 Jun 2018 01:47:12 +0000 (03:47 +0200)]
Allow base type to be passed down

We need this ability to generate RpcOutput-compliant containers.

Change-Id: I8cb7f4ba3771bac07298fda59403d0ff8167aa8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoParameterizedTypeImpl should not allow nulls 39/73239/6
Robert Varga [Wed, 20 Jun 2018 11:01:32 +0000 (13:01 +0200)]
ParameterizedTypeImpl should not allow nulls

Null parameterizations do not make sense, make sure we reject them
with a NPE.

Change-Id: I16266396f2b3eb145f752b314c67b1d92f4ced75
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoinclude YANG module QName in "Schema for %s is not available." error 52/73352/3
Michael Vorburger [Thu, 21 Jun 2018 14:22:15 +0000 (16:22 +0200)]
include YANG module QName in "Schema for %s is not available." error

This is a repeat of I305299ffb3a40036dd72b858ef955ffcf45f6775,
which for some reason (human error or Gerrit bug?!) went into empty.

JIRA: MDSAL-354
Change-Id: Ie7014f824738a7e99799e1637a516617664d63d8
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
5 years agoAdd binding blueprint XML 77/73377/5
Tom Pantelis [Fri, 22 Jun 2018 14:09:35 +0000 (10:09 -0400)]
Add binding blueprint XML

In order to start using the mdsal binding APIs,
we need them advertised.

Change-Id: I0ca67998c074697ef330eeb08df7d2f1abc5ffb0
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd DOM/Binding AdapterFactory 07/73407/2
Robert Varga [Mon, 25 Jun 2018 14:16:08 +0000 (16:16 +0200)]
Add DOM/Binding AdapterFactory

This class forms a single point of entry for all supported adapters,
so that activators can easily use it.

Change-Id: I9950026ade0f56351f09139585d7b69f0cf98465
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd DynamicBindingAdapter 98/73398/8
Robert Varga [Mon, 25 Jun 2018 11:41:38 +0000 (13:41 +0200)]
Add DynamicBindingAdapter

This patch makes translation from DOMServices to their binding
counterparts full dynamic.

It works by listening on DOMServices being published in the service
registry and wrapping them with adapters with same properties.

Change-Id: I2c8d62133ba8f1330b5bcc43ed9ed05db2c982ac
JIRA: MDSAL-353
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unneeded AutoCloseable interfaces 99/73399/1
Robert Varga [Mon, 25 Jun 2018 11:52:05 +0000 (13:52 +0200)]
Remove unneeded AutoCloseable interfaces

Notification adapters do not need AutoCloseable, remove it.

Change-Id: I06332661ab7278ef66d37e0d0920bf52f5776d99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMap RpcProviderService and a BindingService 97/73397/1
Robert Varga [Mon, 25 Jun 2018 11:40:07 +0000 (13:40 +0200)]
Map RpcProviderService and a BindingService

This is an API design omission, this service should be tagged
as a BindingService.

Change-Id: I31eaffbfdb5457b3d61ee3a218d87bf6bae1147c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSimplify BindingMountPointAdapter 96/73396/1
Robert Varga [Mon, 25 Jun 2018 09:31:19 +0000 (11:31 +0200)]
Simplify BindingMountPointAdapter

Use Optional.transform() instead of explicit presence check.

Change-Id: I19f1ef6b49c9f9a4455366258f6edae8c9e790ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd DOM blueprint XML 78/73378/4
Tom Pantelis [Sat, 23 Jun 2018 03:38:19 +0000 (23:38 -0400)]
Add DOM blueprint XML

In order to start using the mdsal DOM APIs,
we need them advertised.

Change-Id: I4988119c399c5984da0b1c56fc7a2d9704c4e176
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
5 years agoTighten childOf type 66/73166/3
Robert Varga [Mon, 18 Jun 2018 22:28:48 +0000 (00:28 +0200)]
Tighten childOf type

Instead of requiring a builder, require a simple type, which is
all we really need.

Change-Id: I765c19308dd17459f9533c6f277c2a3f02a704c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTeach mdsal-binding-dom-codec about cases 56/72456/16
Robert Varga [Tue, 29 May 2018 23:45:08 +0000 (01:45 +0200)]
Teach mdsal-binding-dom-codec about cases

With InstanceIdentifier.Item updates we can now carry unambiguous
identifier of grouping-held classes, which needs to be handled
at codec level: case-bearing PathArguments need to be recognized
and produced to ensure grouping items are correctly addressed.

JIRA: MDSAL-45
Change-Id: If6fa332db2f3c9d033ba2a1fb2c9678dc1e94276
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agominor Checkstyle compliance issues in BindingRuntimeContext 16/73316/3
Michael Vorburger [Thu, 21 Jun 2018 15:21:43 +0000 (17:21 +0200)]
minor Checkstyle compliance issues in BindingRuntimeContext

Change-Id: Ic904359ecb0df84420e05cd00610151a3ea44f49
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
5 years agoinclude YANG module QName in "Schema for %s is not available." error 12/73312/5
Michael Vorburger [Thu, 21 Jun 2018 14:22:15 +0000 (16:22 +0200)]
include YANG module QName in "Schema for %s is not available." error

JIRA: MDSAL-354
Change-Id: I305299ffb3a40036dd72b858ef955ffcf45f6775
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
5 years agoValidate augmentation binding class 61/72961/6
Robert Varga [Wed, 13 Jun 2018 14:34:39 +0000 (16:34 +0200)]
Validate augmentation binding class

LazyDataObject's DataObject.augmentation(Class) implementation
needs to re-validate if the augmentation we are about to decode
matches user-requested augmentation.

This is needed to ensure that we do not return shape-equivalent
augmentation, such as when the same augmentation is applied to
multiple instantiations of the same grouping. In such a case
type-safety indicates that the grouping can have either of the
augmentations, yet in reality its validity depends on
instantiation.

JIRA: MDSAL-328
Change-Id: I57dd70ddead65fc7f61c72b58da4ef6d26e739f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoShare RpcResult Type 57/73157/1
Robert Varga [Mon, 18 Jun 2018 20:08:53 +0000 (22:08 +0200)]
Share RpcResult Type

Add a constant and for RpcResult ConcreteType and an accessor
for its parameterizations.

Change-Id: I1515ab9dfc6e2866c091baa72c515d7d0aff26b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoShare Class Type 56/73156/1
Robert Varga [Mon, 18 Jun 2018 20:05:34 +0000 (22:05 +0200)]
Share Class Type

Add a constant and for java.lang.Class ConcreteType and an accessor
for its parameterizations.

Change-Id: I80ee9a3da1ac13d7066f5ff1e2f546684d6423fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoShare Object Type 55/73155/1
Robert Varga [Mon, 18 Jun 2018 19:58:44 +0000 (21:58 +0200)]
Share Object Type

Add a constant and an accessor for java.lang.Object ConcreteType.

Change-Id: Idb6f120d75c401398d7e1c2cb5d923727d61040a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoShare Serializable Type 54/73154/1
Robert Varga [Mon, 18 Jun 2018 19:54:42 +0000 (21:54 +0200)]
Share Serializable Type

Add a constant and an accessor for java.io.Serializable ConcreteType.

Change-Id: Ie94f954103a0cfae2dc8944bdeb358a8569655fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake identifiable/identifier Types more safe 53/73153/1
Robert Varga [Mon, 18 Jun 2018 19:50:56 +0000 (21:50 +0200)]
Make identifiable/identifier Types more safe

Users should not be referencing the raw type, make sure we reference
the properly-bound type.

Change-Id: I53e86b2ddeceeca528d506fa3ae3bef1e7d3487f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdvertise ClassLoadingStrategy service 09/73009/2
Tom Pantelis [Thu, 14 Jun 2018 21:47:11 +0000 (17:47 -0400)]
Advertise ClassLoadingStrategy service

The ConfigManagerActivator advertises its ModuleInfoBackedContext
as the ClassLoadingStrategy service but the CSS features are being
removed. Therefore advertise mdsal's ModuleInfoBackedContext instance.

Change-Id: Ie03a25db940d3ae17ae5250cafe9fcc32a5baac7
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoChange nested type enumeration tracking 95/69495/25
Robert Varga [Wed, 14 Mar 2018 10:29:08 +0000 (11:29 +0100)]
Change nested type enumeration tracking

Checking for numeral suffix encroaches on model-defined names,
for example in 'leaf foo1', we end up assuming the number is coming
from our code, leading to weird renaming effects.

Isolate our counter with '$', which cannot come from the user, hence
nesting of 'leaf foo1' becomes 'Foo1$1' instead of 'Foo2'.

JIRA: MDSAL-324
Change-Id: Ica309c6c3da012abdf1d5bb9237544f555b7b1cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMake BindingToNormalizedNodeCodec non-final 79/72879/3
Robert Varga [Tue, 12 Jun 2018 14:50:16 +0000 (16:50 +0200)]
Make BindingToNormalizedNodeCodec non-final

Most of this functionality is duplicated in the controller,
make this class non-final to allow the functionality to be
subclassed in the controller.

Change-Id: Ia44c2194ee85d06bbe20ac913fa4a99721f66f01
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd a few toString() methods 86/72886/1
Robert Varga [Tue, 12 Jun 2018 15:20:24 +0000 (17:20 +0200)]
Add a few toString() methods

These help when converting to DataTree ;-).

Change-Id: I9b0fdb428ebe0265cb4321bd6ee31dedb4811950
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoReference java.lang.Override through importedName 70/72770/2
Robert Varga [Thu, 7 Jun 2018 16:29:30 +0000 (18:29 +0200)]
Reference java.lang.Override through importedName

This looks a bit weird, but we must not assume Override is not
shadowed in our class or really in package, otherwise we could
end up with code which does not compile.

JIRA: MDSAL-349
Change-Id: I701daea54fa7a234d75a8fa694a5bd46360b827e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPopulate enumeration conflicting names 48/72748/3
Robert Varga [Thu, 7 Jun 2018 11:00:51 +0000 (13:00 +0200)]
Populate enumeration conflicting names

Pairs need to be accounted as conflicting names to prevent clashes
with classes used by the enumeration template.

JIRA: MDSAL-348
Change-Id: I22e5c72ec944027e20858813c98fed21553d92bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix IetfInetUtil.ipv{4,6}PrefixFor(Ipv{4,6}Address) 59/72759/2
Robert Varga [Thu, 7 Jun 2018 13:21:14 +0000 (15:21 +0200)]
Fix IetfInetUtil.ipv{4,6}PrefixFor(Ipv{4,6}Address)

These methods forgot to account for possible zone, leading to
illegal prefixes being handed out.

Change-Id: Iac4a27eae0ddd1f1215afcca289410eb1f54f458
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix eclipse warnings in ietf-inet-types 57/72757/1
Robert Varga [Thu, 7 Jun 2018 12:30:10 +0000 (14:30 +0200)]
Fix eclipse warnings in ietf-inet-types

Using raw Constructor is superfluous, add arguments to remove
warnings.

Change-Id: I6a09b04ca5792e2c6d4fa54b664b68dce86e6944
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix eclipse warnings in ietf-type-util 38/72738/1
Robert Varga [Wed, 6 Jun 2018 16:43:59 +0000 (18:43 +0200)]
Fix eclipse warnings in ietf-type-util

Straightforward fixes of raw types and unnecessary else statement.

Change-Id: I01ccab14c58b748ce19e0174785d116e228c01f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRPC input/output are always present 83/72683/3
Robert Varga [Tue, 5 Jun 2018 09:59:13 +0000 (11:59 +0200)]
RPC input/output are always present

We are always generating input/output and hence we need to properly
bridge the methods. This simplifies the code a bit.

Change-Id: If19b7841692582179664debfba9dfeeb51401d51
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSpeed up TypedefResolver.getAllTypedefs() 82/72682/2
Robert Varga [Tue, 5 Jun 2018 09:58:01 +0000 (11:58 +0200)]
Speed up TypedefResolver.getAllTypedefs()

RPC input/output are always present, no need to guard them
with a null check.

Change-Id: I1f801d7e690f2b1b32c7c423aa22f4b40dd2ce96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoOptimize findInputOutput() 81/72681/2
Robert Varga [Tue, 5 Jun 2018 09:57:13 +0000 (11:57 +0200)]
Optimize findInputOutput()

We do not need to instantiate output name until after we checked
input name match.

Change-Id: I5de8c205b5941e9944cde9072f1b5c6e9b3463a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump yangtools to 2.0.5 57/72357/5
Robert Varga [Mon, 28 May 2018 10:13:06 +0000 (12:13 +0200)]
Bump yangtools to 2.0.5

Change-Id: Ia6f422cee5b5f9b363dac9d0645076d576d34963
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove AsyncWriteTransaction#submit 28/72628/4
Tom Pantelis [Sun, 3 Jun 2018 18:43:17 +0000 (14:43 -0400)]
Remove AsyncWriteTransaction#submit

Change-Id: I0fd4babc5c9754d524653979f5d6ada4198cbe6a
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
5 years agoRename Augmentable.getAugmentation() to augmentation() 39/71239/13
Robert Varga [Mon, 23 Apr 2018 23:00:16 +0000 (01:00 +0200)]
Rename Augmentable.getAugmentation() to augmentation()

This patch dodges the conflict with leaves named 'augmentation',
so that models containing them can pass code generation. Also tag
it as returning @Nullable, as that is the API contract.

Change-Id: Iafd2904b570f3aded3e8cbd934e9db5f19c03b26
JIRA: MDSAL-2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRename Identifiable.getKey() to key() 34/71234/13
Robert Varga [Mon, 23 Apr 2018 18:21:40 +0000 (20:21 +0200)]
Rename Identifiable.getKey() to key()

Identifiable's getKey() method has a tendency to conflict with models
which define a leaf named 'key'. Rename the method so it does not
conflict with generated getters and unify its definition in
BindingMapping. Also tag it as returning @NonNull, as that is the API
contract.

Since 'key' is a valid property, Builders cannot use a 'setKey' method,
hence it is renamed to 'withKey'.

JIRA: MDSAL-2
Change-Id: Idda720c31fd5519ab21a1722ab5072da5b18fcc9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRevert "Do not generate GhoiceIn" 66/72366/12
Robert Varga [Mon, 28 May 2018 15:10:11 +0000 (17:10 +0200)]
Revert "Do not generate GhoiceIn"

This reverts commit 4714aa33bf2538c6c8178f06bc362be8a2b8f9ce.

Change-Id: I2bf320711df534e0df1405b67a33f670cf7f5a79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoTeach InstanceIdentifier about case-based addressing 11/72211/22
Robert Varga [Wed, 23 May 2018 20:24:43 +0000 (22:24 +0200)]
Teach InstanceIdentifier about case-based addressing

InstanceIdentifier needs to be able to address items which are
coming from a grouping referenced by uses immediately within
a case statement.

The reason for this is that the items in the grouping do not have
their namespace capture class generated for the instantiation,
hence they are not addressable via the usual ChildOf<> relationship.

With the advent of ChoiceIn<>, we can use the classes generated
for case statements to act as a namespace anchor and pivot to
the grouping member. This patch adds the necessary methods.

JIRA: MDSAL-45
Change-Id: I1cc626e391b450e5b32c505ecf6021c39f55532d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd more information to BindingReflections 05/72405/4
Robert Varga [Tue, 29 May 2018 12:08:57 +0000 (14:08 +0200)]
Add more information to BindingReflections

Preconditions should provide enough context for diagnostics,
add it.

Change-Id: If6b365d64e6c4a0505aeee5b6347beddd07b5172
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUse new ClassLoaderUtils methods 04/72404/4
Robert Varga [Tue, 29 May 2018 09:56:21 +0000 (11:56 +0200)]
Use new ClassLoaderUtils methods

There is no need to cast the lambdas with new methods, use those
instead of withClassLoader().

Change-Id: I4eadce6867fe2df7c9732ec74b2dcdcd04ec0eaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDeprecate InstanceIdentifier.(Identifiable)Item constructors 05/72305/12
Robert Varga [Fri, 25 May 2018 12:00:42 +0000 (14:00 +0200)]
Deprecate InstanceIdentifier.(Identifiable)Item constructors

We will need dedicated subclasses to capture the case type and we
do not want to allow external subclasses -- hence we need to deprecate
public constructors.

JIRA: MDSAL-45
Change-Id: If717c9ae507bba9dccec96a27fedd5ca9dc5ea3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoLoosen leader method visibility 81/72381/4
Robert Varga [Mon, 28 May 2018 23:08:15 +0000 (01:08 +0200)]
Loosen leader method visibility

createData*Context() methods are called from a nested subclass, hence
access to them generates synthetic accessors. Loosen visibility to
eliminate those accessors.

Change-Id: I558a4b13d4967c7a01ac1bbcfd628df140f90000
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove InstanceIdentifier.builder(InstanceIdentifier) 65/72365/10
Robert Varga [Mon, 28 May 2018 13:38:39 +0000 (15:38 +0200)]
Remove InstanceIdentifier.builder(InstanceIdentifier)

This method has been deprecated for 4+ years, remove it.

Change-Id: I93e6ec23c50a8492ac8a5bde97b794fac5caa53f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove InstanceIdentifierBuilder.toInstance() 03/72303/14
Robert Varga [Fri, 25 May 2018 11:40:55 +0000 (13:40 +0200)]
Remove InstanceIdentifierBuilder.toInstance()

This method has been deprecated for 3+ years, remove it.

Change-Id: I4de9b386c2f266cebc8114fdfbbc1e662542b60d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDefault AsyncWriteTransaction#submit() 72/72172/4
Tom Pantelis [Tue, 22 May 2018 16:27:46 +0000 (12:27 -0400)]
Default AsyncWriteTransaction#submit()

Also changed all overrides and call sites of submit()
to commit().

Change-Id: I3306aacf0d91de0ce902b9d5983b30f0ff912b64
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
5 years agoImprove InstanceIdentifier documentation 04/72304/8
Robert Varga [Fri, 25 May 2018 11:47:10 +0000 (13:47 +0200)]
Improve InstanceIdentifier documentation

This adds a few javadocs to clarify what is going on.

Change-Id: I9983e7d6715fc06c7d18a61fd74a0660c8d2b4ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix BindingReflections with no revisions 79/72379/1
Robert Varga [Mon, 28 May 2018 20:48:28 +0000 (22:48 +0200)]
Fix BindingReflections with no revisions

When a module does not have a revision statement, we end up using
.norev instead of the usual .revXXYYZZ package component. This means
that valid Binding classes are not recognized by
getModelRootPackageName(), throwing IllegalArgumentException.

Fix this by updating matcher pattern to account for .norev being
a possibility.

Change-Id: Ifeede5cd2371a73eca7b189af3f3ac95db4acb9d
JIRA: MDSAL-346
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix codegen of root choices 77/72377/1
Robert Varga [Mon, 28 May 2018 17:51:15 +0000 (19:51 +0200)]
Fix codegen of root choices

If a choice which is a direct child of a module is targeted via
an augment, codegen fails.

The reason for this is that it attempts to use an empty SchemaPath
to find a DataSchemaNode: something that cannot be done. The problem
is the assumption that a Module is a SchemaNode -- which it is not.

To fix this, recognize when the parent path is empty and short-circuit
to the defining module if that is the case.

JIRA: MDSAL-345
Change-Id: I52679c822b220271d943bfbc421049d2dc394d70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix YangModuleInfoTemplate 75/72375/2
Robert Varga [Mon, 28 May 2018 17:29:06 +0000 (19:29 +0200)]
Fix YangModuleInfoTemplate

Optional is not comparable, hence we need to pass an explicit
Comparator to the TreeMap.

JIRA: MDSAL-344
Change-Id: I79e8000c85ed74d3f14e77da156038f3c781aa59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDo not generate GhoiceIn 31/72331/1
Robert Varga [Sat, 26 May 2018 09:08:22 +0000 (11:08 +0200)]
Do not generate GhoiceIn

It seems this break OFP, until we understand how, do not generate
the interface binding.

Change-Id: Ib24f0e1bfe1d6b3c1186e9d1057ab6bd43630cda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUse java.util.Objects.requireNonNull in InstanceIdentifier 02/72302/2
Robert Varga [Fri, 25 May 2018 11:39:24 +0000 (13:39 +0200)]
Use java.util.Objects.requireNonNull in InstanceIdentifier

This migrates InstanceIdentifier to use static imports, making
the code a bit more concise.

Change-Id: I4eb4ea737b6d75a67593db2b0099f61c37407ef4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd ChoiceIn marker interface 09/72209/5
Robert Varga [Wed, 23 May 2018 20:06:54 +0000 (22:06 +0200)]
Add ChoiceIn marker interface

This interface is needed to tie choice interfaces to their definition
parent -- transitively allowing us disambiguate grouping-defined uses
child children. This patch adds the interface and teaches codegen
when to generate it.

JIRA: MDSAL-45
Change-Id: Iecc1d504dd1d016a8fec3c26afe4e3c565b31d9b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoImprove QNAME field definition 36/71836/8
Robert Varga [Tue, 24 Apr 2018 09:26:46 +0000 (11:26 +0200)]
Improve QNAME field definition

The constant field that contains the QName corresponding to the
generated construct can rely on YangModuleInfo associated with
the generated module. Since that class already contains the module's
QName, we can lift it from there and use it to define the constant.

This has the benefit of not duplicating strings in classes, leading
to smaller footprint and improves startup time, as the strings do not
have to be parsed when the class is loaded.

JIRA: MDSAL-339
Change-Id: Ia7d336e3d386955f83648543b1e98f820ebbaf40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup unchecked casts in InstanceIdentifier 08/72208/1
Robert Varga [Wed, 23 May 2018 20:05:16 +0000 (22:05 +0200)]
Cleanup unchecked casts in InstanceIdentifier

Using AbstractPathArgument allows us to retain the required type
capture, allowing us to eliminate a couple of SuppressWarnings.

Change-Id: I73748c7f4a3348a6a1d2961e9377a8740d427e32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMake RPC implementations return ListenableFuture 62/69362/38
Robert Varga [Sun, 11 Mar 2018 22:42:29 +0000 (23:42 +0100)]
Make RPC implementations return ListenableFuture

Common implementations are using ListenableFuture and we really
need to make it convenient to attach to RPC results. Change
the signature of returned type to use ListenableFuture<?>.

Change-Id: Ic60a8bbab230ff174f0927a81727f478d4eb3fde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAlways generate RPC input/output 55/69355/41
Robert Varga [Sun, 11 Mar 2018 16:19:05 +0000 (17:19 +0100)]
Always generate RPC input/output

Do not suppress implicit input/output RPC statements, as they may
be augmented and the implementation should have a way to receive
those augmentations.

Change-Id: Ie7d1adde5732c65412c13c80e8b555a5626d34e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove RFC6021 models 76/72076/3
Robert Varga [Thu, 17 May 2018 20:11:16 +0000 (22:11 +0200)]
Remove RFC6021 models

This patch removes old versions of ietf-{inet,yang}-types, which
are not used in OpenDaylight proper.

Also models are documented where they come from and their content
is harmonized with https://github.com/YangModels/yang/ to make them
text-equal.

JIRA: MDSAL-338
Change-Id: I8b9f5bac484bdf52bc7abe8f72f5817e111e069d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd @Nullable annotations on getters 99/69399/13
Stephen Kitt [Mon, 12 Mar 2018 18:19:33 +0000 (19:19 +0100)]
Add @Nullable annotations on getters

Generated getters’ documentation states that they can return null if
no value is present; this patch adds a @Nullable annotation to
accompany the comment, allowing null-pointer analysis on generated
bindings.

This would help avoid various NPEs we’ve seen in practice in Genius
and NetVirt.

Change-Id: I8c8cfa9ae24d34f3a7140623065dfb377f5f2a13
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoChange ClusterSingletonServiceService.closeServiceInstance() 63/72163/1
Robert Varga [Tue, 22 May 2018 13:50:23 +0000 (15:50 +0200)]
Change ClusterSingletonServiceService.closeServiceInstance()

Requiring ListenableFuture<Void> is overly restrictive, we should
allow implementations to give us whatever future they have -- all
we care about is their completion.

JIRA: MDSAL-340
Change-Id: Ic61c3731b7be53d45ea9a9bdb8dd9786f20ee111
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDocument JavassistUtils thread safety 65/71865/5
Robert Varga [Tue, 8 May 2018 20:42:10 +0000 (22:42 +0200)]
Document JavassistUtils thread safety

JavassistUtils has a clear locking and thread safety policy, document
that. Also defines a nullness contract and takes advantage of
Map.computeIfAbsent().

Change-Id: I6005d399db3168def6cde49049f21f7affc59937
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove JavassistUtils.get() 64/71864/4
Robert Varga [Tue, 8 May 2018 20:36:20 +0000 (22:36 +0200)]
Remove JavassistUtils.get()

Javassist.asCtClass() is the only caller, remove the API entrypoint
so that we achieve full synchronization.

Change-Id: I591204b0bc4ccbc5b1438189148fd6928e84c7c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoadd additional (debug) logging to AbstractStreamWriterGenerator 49/71849/4
Michael Vorburger [Tue, 8 May 2018 14:59:24 +0000 (16:59 +0200)]
add additional (debug) logging to AbstractStreamWriterGenerator

* LOG.debug() in generateSerializer() to see if in a load test
scenario that ever gets called twice for the same type (it should not)
due to a concurrency bug I'm not seeing.

* reduce the only other LOG.debug() in that class to trace()
because that one will happen more often (constantly?) and make it hard
to see the other one.

* log onBindingRuntimeContextUpdated() on the off chance
that changing the BindingRuntimeContext somehow could cause this
suspected concurrency issue.

* log constructor to better understand the lifecycle of
AbstractStreamWriterGenerator in production.

* add Guava Cache removalListener with logging to see if this is caused
by eviction by GC due to .weakKeys() - ACK to tpantelis for this hunch.

JIRA: MDSAL-213
Change-Id: I2416131fe140ee483cc93740480ee0e37f0ce130
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
6 years agomake AbstractStreamWriterGenerator loadSerializerFor() delegate 52/71852/4
Michael Vorburger [Tue, 8 May 2018 15:22:46 +0000 (17:22 +0200)]
make AbstractStreamWriterGenerator loadSerializerFor() delegate

to the getSerializer() instead of copy/pasting
implementations.getUnchecked(), so that we can possibly add logging
and/or locking in a single place in the future.

JIRA: MDSAL-213
Change-Id: Ida9b0cb387933f83903e0a8d716087959f4d5c4e
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
6 years agoRemove JavassistUtils.createClass() 63/71863/3
Robert Varga [Tue, 8 May 2018 20:32:29 +0000 (22:32 +0200)]
Remove JavassistUtils.createClass()

These methods are unused, remove them.

Change-Id: I03000d9b765eb32b004be5efdf8e6e5cbd42c5f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove JavassistUtils.method utils 62/71862/3
Robert Varga [Tue, 8 May 2018 20:25:20 +0000 (22:25 +0200)]
Remove JavassistUtils.method utils

These do not have a synchronization strategy defined and are not
used anywhere: remove them.

Change-Id: If06aa67674657c53cfd417d963c5d18ee6fcb572
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove JavassistUtils.{method,staticMethod} 61/71861/3
Robert Varga [Tue, 8 May 2018 20:14:45 +0000 (22:14 +0200)]
Remove JavassistUtils.{method,staticMethod}

These methods are not being used anywhere, remove them.

Change-Id: I0d535312754a91c95625e3009f7f70e59443dcb8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup JavassistUtils 60/71860/2
Robert Varga [Tue, 8 May 2018 20:07:11 +0000 (22:07 +0200)]
Cleanup JavassistUtils

Add explicit assumption that asCtClass() is synchronize and follow
that to AbstractStreamWriterGenerator synchronization.

Change-Id: I0f9141d535d370c0285aa6d5e43f45ab4bd0a1eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup AbstractStreamWriterGenerator 59/71859/2
Robert Varga [Tue, 8 May 2018 19:51:42 +0000 (21:51 +0200)]
Cleanup AbstractStreamWriterGenerator

ClassLoaderUtils is providing a lambda-friendly API, take advantage
of that. Also also runs .toString() outside of the class loader,
minimizing the code being run there.

Change-Id: I9ecf5c12a957c508ad5d4d27117d9099ce1f789b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agofix minor typo in DataContainer 50/71850/2
Michael Vorburger [Tue, 8 May 2018 15:04:04 +0000 (17:04 +0200)]
fix minor typo in DataContainer

Change-Id: I9a98ab56441b2d49ef6b1b02403c45154d540644
Signed-off-by: Michael Vorburger <vorburger@redhat.com>