mdsal.git
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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 years agoremove un-used getChildSizeFromSchema() in StreamWriterGenerator 51/71851/1
Michael Vorburger [Tue, 8 May 2018 15:05:38 +0000 (17:05 +0200)]
remove un-used getChildSizeFromSchema() in StreamWriterGenerator

Change-Id: Iac30c3633963bd5e1e049c3861f30305e70705f8
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
6 years agoCleanup mdsal-binding-java-api-generator compilation tests 39/71839/1
Robert Varga [Mon, 7 May 2018 12:48:14 +0000 (14:48 +0200)]
Cleanup mdsal-binding-java-api-generator compilation tests

Various subclasses of BaseCompilationTest have used copy&pasted
code to generate sources using the same pattern.

Rather than doing that, centralize code generation in the base
class, simplifying the test cases.

Change-Id: I75f10d321805de641cd48a4e69c8115e6514ee91
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup YangModuleInfoTemplate 35/71835/1
Robert Varga [Mon, 7 May 2018 11:43:46 +0000 (13:43 +0200)]
Cleanup YangModuleInfoTemplate

Remove extra space in package declaration and separate imports
from package and body with an empty line.

Change-Id: I4f484f3d3f1a62576d14e7803478fd5edec43cad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAsyncWriteTransaction submit() with @CheckReturnValue 61/66361/7
Michael Vorburger [Mon, 11 Dec 2017 22:17:16 +0000 (23:17 +0100)]
AsyncWriteTransaction submit() with @CheckReturnValue

this seems like a good idea because we would subsequently like to reduce
the internal logging from a WARN for TransactionCommitFailedException to
a DEBUG.

see CONTROLLER-1802 and NETVIRT-916 for the full background story to
where this comes from.

Change-Id: I2de692dfc4d1b2de7d10a56e4341c153214da62d
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
6 years agoRework InMemoryDOMDataStoreConfigProperties 30/71430/5
Robert Varga [Thu, 26 Apr 2018 16:09:42 +0000 (18:09 +0200)]
Rework InMemoryDOMDataStoreConfigProperties

Rework InMemoryDOMDataStoreConfigProperties to use immutables.org,
i.e. generate a builder. Also include debug transaction flag in
properties.

This cleans up InMemoryDOMDataStoreFactory, making it more
straightforward.

Change-Id: Ifae57b87fe8a87d183958e4826afc1e17c173273
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUse QName's imported name for QNAME constant 33/71233/3
Robert Varga [Mon, 23 Apr 2018 21:27:04 +0000 (23:27 +0200)]
Use QName's imported name for QNAME constant

This makes the code a bit more concise, as we do not end up using
a FQCN to locate QName.create().

Change-Id: Iaa3f5f362da8bae43345164ab635c0dc7bf6497f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup EnumTemplate and UnionTemplate 10/70110/17
Robert Varga [Mon, 26 Mar 2018 16:44:54 +0000 (18:44 +0200)]
Cleanup EnumTemplate and UnionTemplate

Now that import tracking works correctly, fixup templates which can
be instantiated as inner classes.

JIRA: MDSAL-327
Change-Id: I4c9e7917a8bc2d021d6cdd60c3d6ef41ccb9af59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoExpose QueuedNotificationManager 40/71440/2
Robert Varga [Thu, 26 Apr 2018 19:16:58 +0000 (21:16 +0200)]
Expose QueuedNotificationManager

This manager is being hooked into in controller's IMDS. Expose
the hook so we can proxy over completely.

Change-Id: Ifb9696cf3257a29a71e0d4587b0494e3e8e656f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRework Java import tracking 09/70109/23
Robert Varga [Sun, 25 Mar 2018 22:52:44 +0000 (00:52 +0200)]
Rework Java import tracking

In order to get nested class imports working, we need a proper
layer which understands how references inside Java code are
looked up.

Introduce AbstractJavaGeneratedType, which creates a tree structure
of how the class is layed out, thus it knows which types are declared
in a particular type's scope. There are two implementions:
- TopLevelJavaGeneratedType, which is responsible for managing what
  is imported into the compilation unit
- NestedJavaGeneratedType, which does not know about imports per se
  and delegates decisions to its containing type

Templates are updated to properly hook into the type hierarchy, so
their requests for type resolution are properly scoped.

One remaining wrinkle is BuilderTemplate, which abuses the template
system by using its built type as its type. This is worked around
in this patch and will need to be cleaned up later.

JIRA: MDSAL-327
Change-Id: Ie66a93ba85be26b056f118ba9fe14195e8d5a8ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Jie Han <han.jie@zte.com.cn>
6 years agoAdd SnapshotBackedTransaction 18/71418/2
Robert Varga [Thu, 26 Apr 2018 10:20:10 +0000 (12:20 +0200)]
Add SnapshotBackedTransaction

DOMStore implementations working on SnapshotBacked transactions can
provide additional functionality if they have access to the underlying
snapshot.

Expose a method which allows the snapshot to be acquired as long as
the transaction is open.

Change-Id: I408e31be0285fb41732f29206bccd71ce794215e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd CommitInfo and return it from transactions 94/71194/8
Robert Varga [Sun, 22 Apr 2018 23:29:58 +0000 (01:29 +0200)]
Add CommitInfo and return it from transactions

This patch introduces AsyncWriteTransaction.commit(), which
returns a FluentFuture instead of a CheckedFuture.

Since it may be useful for implementations to communicate some
post-commit state, the returned future is specified to return
a non-null CommitInfo. Utility empty CommitInfo implementation
is provided.

JIRA: MDSAL-337
Change-Id: I1c4bd007781515643e602a180d162e35e92116a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRevert "Add NoZone support" 20/71120/3
Robert Varga [Thu, 19 Apr 2018 19:26:30 +0000 (21:26 +0200)]
Revert "Add NoZone support"

This reverts commit c4301c2e5439da8538769bdee0cf6c9bb56209ef
and commit ca8e1f685d01d9d87f6b550edab1be6dd9a5ccea.

Change-Id: I1a838bd1d16dff096a4337ac3501f13f1402f77b
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDocument LogicalDatastoreType 69/71169/1
Robert Varga [Thu, 19 Apr 2018 20:37:01 +0000 (22:37 +0200)]
Document LogicalDatastoreType

This adds some sorely-needed javadocs.

Change-Id: Ief1797b7f63c6b85e53ee0e485453b0dbb07b95c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBinding codec v1 - fix get codec for typedef of empty type 93/62393/17
Jie Han [Tue, 29 Aug 2017 09:19:36 +0000 (17:19 +0800)]
Binding codec v1 - fix get codec for typedef of empty type

- Fix get codec for typedef of empty type,
  the return type of typedef empty type should be
  generated binding class type not boolean.
Change-Id: Icead1cc2d40015e948317095fac9854330630ddf
Signed-off-by: Jie Han <han.jie@zte.com.cn>
6 years agoFix AbstractIetfInetUtil.ipv6AddressFrom() 82/71082/1
Robert Varga [Wed, 18 Apr 2018 12:28:20 +0000 (14:28 +0200)]
Fix AbstractIetfInetUtil.ipv6AddressFrom()

Address should be returned using the no-zone class.

Change-Id: I4943f89fec8ede4348bb6a717477a13b48beae21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd RFC7895 YANG Module Library model 24/71024/3
Robert Varga [Tue, 17 Apr 2018 10:11:57 +0000 (12:11 +0200)]
Add RFC7895 YANG Module Library model

This model is linked to MD-SAL mount points, hence it should really
be provided by MD-SAL.

Change-Id: I4a0c23f8137fd0fff09e6500f27000ff62535fff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd NoZone support 69/70769/7
Robert Varga [Wed, 11 Apr 2018 01:28:40 +0000 (03:28 +0200)]
Add NoZone support

inet-inet-types@2013-07-15 defines no-zone versions of ip-address,
ipv4-address and ipv6-address. These are guaranteed to not contain
a zone, hence are stricter versions of the same types, making them
better candidates for dealing with normal addresses.

Retrofit IetfInetUtil so they return no-zone versions of objects
and also add more efficient convertors to bytes.

Change-Id: I2b0f4775b1656a7b80929e62f03940b1247e1b95
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove draft-clemm-netmod-yang-network-topo-00 models 46/71046/2
Robert Varga [Tue, 17 Apr 2018 16:02:51 +0000 (18:02 +0200)]
Remove draft-clemm-netmod-yang-network-topo-00 models

These models have been superseded by
draft-clemm-netmod-yang-network-topo-01 and have been not
used for some time. Remove the models, trimming our runtime
overhead.

Change-Id: I4eb1218aa3b97b84f166191a6b5741bdaeb38bea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUse QName.withModule() 71/69371/11
Robert Varga [Mon, 12 Mar 2018 10:53:51 +0000 (11:53 +0100)]
Use QName.withModule()

There are multiple places where we are creating a well-known QName
with a new namespace. Use QName.withModule() so we do not end up
checking localName over and over.

Change-Id: I932bf3762bfb6ae201e6b309f8a7d95887b99b00
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump to odlparent 3.1.0 and yangtools 2.0.3 85/69885/7
Stephen Kitt [Thu, 22 Mar 2018 17:24:29 +0000 (18:24 +0100)]
Bump to odlparent 3.1.0 and yangtools 2.0.3

Change-Id: Ibd6d5141acc125e9aa5f72149d2add9ae0d7c148
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoAdd the ietf-ip YANG model (RFC 7277) 81/70181/4
Lorand Jakab [Fri, 6 Apr 2018 12:36:35 +0000 (15:36 +0300)]
Add the ietf-ip YANG model (RFC 7277)

While the ietf-ip YANG model has a newer revision in RFC 8344, this
revision is used in more than one ODL project (sfc, honeycomb/vbd), each
one providing their own file, which is not a good practice. The model
should live in MD-SAL, and then the other project depend on it.

Change-Id: I8cc5ea99f16ae9bcc52afca9436fe5251a4d6361
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
6 years agoFix derived types missing pattern restrictions 29/70729/2
Robert Varga [Tue, 10 Apr 2018 17:14:19 +0000 (19:14 +0200)]
Fix derived types missing pattern restrictions

We have missed a place where constants to support restrictions need
to be generated, which meant that Ipv4AddressNoZone and similar
constructs were not doing correct enforcement.

JIRA: MDSAL-335
Change-Id: Id659362038e001207eab9ca5f1618c376aa0ea5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoartifacts mdsal-binding-test-utils <scope>test 53/70453/2
Michael Vorburger [Fri, 6 Apr 2018 18:39:36 +0000 (20:39 +0200)]
artifacts mdsal-binding-test-utils <scope>test

Change-Id: Iffc49385dd269f045291c2a22e02fbd904d5bb6e
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
6 years agoBinding v2 - fix wrong imports from binding v1 12/70312/2
Jie Han [Wed, 4 Apr 2018 03:04:20 +0000 (11:04 +0800)]
Binding v2 - fix wrong imports from binding v1

- It's a mistake to import classes from binding v1
  when bug MDSAL-253 ported changes from binding v1,
  just fix up.

- Eliminates a mistoken merged yang file.

Change-Id: Ifb094a128d32a45601bb0f1b3af6144e11521897
Signed-off-by: Jie Han <han.jie@zte.com.cn>
6 years agoMap identities to interfaces, not abstract classes 12/69212/39
Robert Varga [Wed, 7 Mar 2018 14:06:04 +0000 (15:06 +0100)]
Map identities to interfaces, not abstract classes

This changes mapping of identities from abstract class to an interface,
allowing for multiple inheritence, as needed by YANG 1.1.

JIRA: MDSAL-326
Change-Id: I01f636f5f055f929cdcee4ccb61e04ad0a6841b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRework YangModuleInfo 51/69751/8
Robert Varga [Wed, 21 Mar 2018 02:56:33 +0000 (03:56 +0100)]
Rework YangModuleInfo

This patch modernizes YangModuleInfo to not use only strings, but
also yang.common classes. ResourceYangModuleInfo is created to serve
as abstract superclass for generated YangModuleInfo classes.

JIRA: MDSAL-325
Change-Id: I2f28868b7083af17bd23f6fd360ec6673b94d3ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd Types.primitiveVoidType() 46/70146/1
Robert Varga [Mon, 26 Mar 2018 22:36:19 +0000 (00:36 +0200)]
Add Types.primitiveVoidType()

There is a difference between java.lang.Void.class and void.class,
which the code generator does not reflect and works around by
squashing the types when looking up.

Fix this deficiency by introducing primitiveVoidType(), which
correctly wraps void.class.

Change-Id: Iaa5b76805d63cec2857a12733c84edaf8b61eba2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMove getRestrictions() into BaseTemplate 08/70108/2
Robert Varga [Sun, 25 Mar 2018 20:37:18 +0000 (22:37 +0200)]
Move getRestrictions() into BaseTemplate

JavaFileTemplate does not need this functionality, it is much better
hosted in BaseTemplate.

Change-Id: I38fb774ea1b5df92d43cd7ddd35b9b16bb015232
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUpgrade ietf-inet-types dependency to 2013-07-15 56/69956/3
Marek Gradzki [Fri, 23 Mar 2018 08:28:24 +0000 (09:28 +0100)]
Upgrade ietf-inet-types dependency to 2013-07-15

The ietf-restconf already uses ietf-yang-types@2013-07-15,
so bump ietf-inet-types for consistency.

Change-Id: Id9a871a6f7d273efa94dedb1c98451ba27e7ab7d
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
6 years agoImprove EnumerationCodec 51/69351/29
Robert Varga [Sun, 11 Mar 2018 15:25:40 +0000 (16:25 +0100)]
Improve EnumerationCodec

Now that we have proper information from enumerations, we can use
build the codec map as known at generation time and check it against
the type we are receiving, adding proper warnings.

JIRA: MDSAL-317
Change-Id: Ia5bd3d73e44eba2568818b578bc44985fafb6294
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove use of CheckedFuture in ModuleInfoBackedContext 50/69750/4
Robert Varga [Wed, 21 Mar 2018 11:31:28 +0000 (12:31 +0100)]
Remove use of CheckedFuture in ModuleInfoBackedContext

Interface contract requires only ListenableFuture, hence we can
safely migrate.

Change-Id: I2454cfda9d88c9cbab51c297ddf0c819d6b13763
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRevert "Fix add imports of nested classes" 63/69863/2
Robert Varga [Thu, 22 Mar 2018 17:06:11 +0000 (18:06 +0100)]
Revert "Fix add imports of nested classes"

This reverts commit ae34daa2a74d6b952f3567341c163a77ca3a5720.

Concatenating imports does not work as the inner class has to
take into account for containing class name, as that takes
precedence over imports.

Change-Id: I6921b5e923bf6bb48d3f1a118e9beb289c6f6932
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove ietf-inet-types dependency from ietf-interfaces 56/69756/3
Marek Gradzki [Wed, 21 Mar 2018 12:25:38 +0000 (13:25 +0100)]
Remove ietf-inet-types dependency from ietf-interfaces

The ietf-interfaces@2014-05-08.yang depends only
on ietf-yang-types@2013-07-15.yang

Change-Id: I146c0b130ee0a4cb6e7132a8a4ffe4a8f0bc7ccc
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
6 years agoMake DOMDataTreeService extensible 57/68057/12
Robert Varga [Wed, 31 Jan 2018 01:47:23 +0000 (02:47 +0100)]
Make DOMDataTreeService extensible

DOMDataTreeService is a candidate for optional extensions, which
we support via the extensible object pattern. Add the ability for
DOMDataTreeService to be extended.

Change-Id: Ibc891208850c933b2a61598eddbf88e90625c064
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBinding v2 - Fix setter constant naming 94/69794/1
Jie Han [Thu, 22 Mar 2018 08:05:22 +0000 (16:05 +0800)]
Binding v2 - Fix setter constant naming

- ported from:
  https://git.opendaylight.org/gerrit/69658

Change-Id: Ia86cbdc88e6dd6a87430df467b6d61f11010f6c5
Signed-off-by: Jie Han <han.jie@zte.com.cn>
6 years agoRevert "Rework inlined union generation" 69/69769/1
Robert Varga [Wed, 21 Mar 2018 16:26:45 +0000 (17:26 +0100)]
Revert "Rework inlined union generation"

This reverts commit beef61289ca5b34724f8c8b73ca851f991af7bb7.

Change-Id: Ib1b60da6bae45202671582cd3648d6626d61064b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRevert "Fixup test for MDSAL-320" 68/69768/1
Robert Varga [Wed, 21 Mar 2018 16:26:42 +0000 (17:26 +0100)]
Revert "Fixup test for MDSAL-320"

This reverts commit 61736ccb14776c6ff8a6c6bcea1ac3a7d55e37a4.

Change-Id: Iab35483edff5c3d2618a26fbd3bbee79141ef499
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoReintroduce BindingRuntimeContext.getEnumMapping(String) 98/69698/1
Robert Varga [Tue, 20 Mar 2018 17:30:43 +0000 (18:30 +0100)]
Reintroduce BindingRuntimeContext.getEnumMapping(String)

We dropped this mathod while we still have a user in the controller,
add it back, this time having the ability to work with deeply-nested
enumerations.

Change-Id: Id3449aada7406bca67d24cfd7bde3d58f0206043
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoChange transformation from DOMRpcResult to RpcResult 77/69677/3
Peter Nosal [Mon, 19 Mar 2018 07:59:37 +0000 (08:59 +0100)]
Change transformation from DOMRpcResult to RpcResult

When RpcResult was created, it was always as successful RpcResult,
this is changed so in presence of RpcErrors, RcpResult is built as
failed RpcResult with RpcErrors and binding result.

Change-Id: I7ee54dfffb271505fd52feee4c6b2235c0ae4964
Signed-off-by: Peter Nosal <peter.nosal@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFixup test for MDSAL-320 69/69669/1
Robert Varga [Tue, 20 Mar 2018 12:59:12 +0000 (13:59 +0100)]
Fixup test for MDSAL-320

This is a namespace cleanup, change the model and namespace to mdsal320
instead of yt320.

JIRA: MDSAL-320
Change-Id: If58588c89b9005878a1a65780b2e22e1b37f4cab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix setter constant naming 58/69658/2
Robert Varga [Tue, 20 Mar 2018 09:19:30 +0000 (10:19 +0100)]
Fix setter constant naming

Bouncing property name through upper/lower case does not really work,
as it breaks with capitalized properties. Also remove the public constant
so we do not retain the input list -- the patterns are not really useful
anyway.

JIRA: MDSAL-323
Change-Id: I7aa5677e27c6dddc13cc25336500ba0b583b021f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRework inlined union generation 10/69610/8
Robert Varga [Mon, 19 Mar 2018 08:43:11 +0000 (09:43 +0100)]
Rework inlined union generation

Unions internal to a leaf union end up being incompletely generated,
as they lack getValue(), hashCode(), equals() and do not correctly
bind to its enclosing builder -- leading to a generated code not being
compilable.

There are multiple issues here, all of which are addressed in this patch:
- value/hashCode/equals properties are created in the wrong place
- property return type is set to the builder, not its product
- union builder type is not set as a union
- builders for nested types are not correctly emitted

JIRA: MDSAL-320
Change-Id: I60697c74669d4508922ea3ee22e2f0fe5d99b322
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDisambiguate generated nested enumerations 99/69599/11
Robert Varga [Mon, 19 Mar 2018 01:11:45 +0000 (02:11 +0100)]
Disambiguate generated nested enumerations

In case we have an enumeration defined directly in a leaf of the same
name as its containing generated type (list, container, etc.), we can
end up violating JLS section 8.1 class naming requirements.

Detect this condition and munge the type name by appending a '$' to
prevent this conflict.

Change-Id: Ia68cac2a96ac0a95fa38a83cb1cdc1c09540533b
JIRA: MDSAL-321
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoIntegrate JavaTypeName as Identifier 08/69408/16
Robert Varga [Mon, 12 Mar 2018 20:33:57 +0000 (21:33 +0100)]
Integrate JavaTypeName as Identifier

This changes 'Type' to implement Identifiable<JavaTypeName>, which
allows us to cleanly manage Java type naming and namespace handling.

Type's base mathods are made default and name tracking is reworked
to always be based on JavaTypeName.

JIRA: MDSAL-321
Change-Id: Id8512d38eb2eed9bd2ce4d6b172937bebde03581
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd binding.model.api.Java{Package,Type}Name 07/69407/11
Robert Varga [Mon, 12 Mar 2018 18:08:18 +0000 (19:08 +0100)]
Add binding.model.api.Java{Package,Type}Name

This adds the basic concept of a JavaTypeName, which reflects a Java
class or interface -- something that is a 'type. JavaPackageName
is similar, it defines a names Java package.

JIRA: MDSAL-321
Change-Id: Ia914fb001444292e00f6089853e1c434b95043ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCache module package name in ModuleContext 56/69356/22
Robert Varga [Sun, 11 Mar 2018 16:30:35 +0000 (17:30 +0100)]
Cache module package name in ModuleContext

Creating this string is expensive and we have multiple call sites
generating it. Centralize its (lazy) allocation.

Change-Id: Ief43c180a7aec798408e9e15602be7f7e1856bd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMDSAL-292: Binding v2 - Pattern attribute ignored for leaf-list/leaf 09/67709/16
Jie Han [Tue, 30 Jan 2018 08:29:03 +0000 (16:29 +0800)]
MDSAL-292: Binding v2 - Pattern attribute ignored for leaf-list/leaf

- Support pattern constraint for leaf of type string,
  add suffix with leaf name to avoid conflicts of constant name
  from multiple patterns of different leaf/leaf-lists.

Change-Id: Iafc6f94c08300b19439adbf2dc714a4cd96c9afc
Signed-off-by: Jie Han <han.jie@zte.com.cn>
6 years agoBinding v2 - Export declared regexes to generated code 49/69549/6
Jie Han [Fri, 16 Mar 2018 09:40:24 +0000 (17:40 +0800)]
Binding v2 - Export declared regexes to generated code

- Ported from:
  https://git.opendaylight.org/gerrit/#/c/68916/20

- Split out an constantTemplate which would be reused
  by renderers of class, interface and builder.

- Eliminates TypeConstants and puts PATTERN_CONSTANT_NAME
  etc. in BindingMapping.

Change-Id: Id1c0b70e5dd520d27dc764c290b0d7e7d5b14cec
Signed-off-by: Jie Han <han.jie@zte.com.cn>
6 years agoFix add imports of nested classes 21/69421/9
Jie Han [Tue, 13 Mar 2018 07:46:02 +0000 (15:46 +0800)]
Fix add imports of nested classes

- Use importedName instead of
  directly hard code class FQN in the template.

Change-Id: Icb39df83f6c09461a2130c3ba3a9b2151a30fb85
Signed-off-by: Jie Han <han.jie@zte.com.cn>
6 years agoMDSAL-292: Binding v1 - Pattern attribute ignored for leaf-list/leaf 51/67851/27
Jie Han [Fri, 2 Feb 2018 03:11:34 +0000 (11:11 +0800)]
MDSAL-292: Binding v1 - Pattern attribute ignored for leaf-list/leaf

- Support pattern constraint for leaf-list/leaf

- support modifier statement for pattern of yang 1.1

- Add test yang

Change-Id: I1a2f2b24a023479dee8ee9de08374386d38ba17a
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup mdsal-binding-java-api-generator tests 98/69598/3
Robert Varga [Mon, 19 Mar 2018 01:13:58 +0000 (02:13 +0100)]
Cleanup mdsal-binding-java-api-generator tests

We have a lot of copy&pasted code here, trim it down by providing
convenience classes.

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