mdsal.git
4 years agoBindingCodecContext implements BindingNormalizedNodeWriterFactory 96/88196/2
Robert Varga [Sun, 1 Mar 2020 13:34:45 +0000 (14:34 +0100)]
BindingCodecContext implements BindingNormalizedNodeWriterFactory

There is slight confusion between BindingCodecContext and
BindingNormalizedNodeCodecRegistry -- the registry implements this
interface and uses internal methods with exact signatures for most
of them. There's a few methods missing, leading to confusion as to
what is what.

Move the two methods and make BindingCodecContext be the Immutable
reference implementation. This also shows that we have a lifecycle
issue, where we can end up reading codecContext twice.

Fix that race by properly encapsulating state before referring to
the (now static) common method. This has the nice side-effect of
removing state capture of 'this', leading to the indirection lambda
being stateless.

JIRA: MDSAL-825
Change-Id: I81e26ad6865c48035b64d1973bae1bb396d584f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove BindingToNormalizedNodeCodec.deserializeFunction() 95/88195/1
Robert Varga [Sun, 1 Mar 2020 13:17:58 +0000 (14:17 +0100)]
Remove BindingToNormalizedNodeCodec.deserializeFunction()

This method has been deprecated and has no users, remove it and
reduce clutter.

Change-Id: I195913e7117f98b839696f02bfaa46aa62017385
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove AbstractLazyActionContainerNode to SPI 94/88194/1
Robert Varga [Sun, 1 Mar 2020 12:22:00 +0000 (13:22 +0100)]
Move AbstractLazyActionContainerNode to SPI

While this is an implementation detail, it can be shared between
implementations quite reasonably. Pull it out of
binding-dom-codec-impl.

JIRA: MDSAL-825
Change-Id: I21b79bee5b73583a406d17665dfd9aff1376c3c3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate BindingInstanceIdentifierCodec documentation 92/88192/1
Robert Varga [Sun, 1 Mar 2020 12:05:40 +0000 (13:05 +0100)]
Update BindingInstanceIdentifierCodec documentation

Document IllegalArgumentException being thrown and add FIXMEs.

Change-Id: I44e8a8c86b2dd180dc09f23a8a930b23f01b3c75
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReduce BindingNormalizedNodeCodecRegistry proliferation 66/88166/3
Robert Varga [Sat, 29 Feb 2020 15:36:35 +0000 (16:36 +0100)]
Reduce BindingNormalizedNodeCodecRegistry proliferation

Most functional blocks require only a
BindingNormalizedNodeSerializer implementation, not the concrete
implementation. This allows us to disconnect component lifecycle
from BindingCodecContext updates without relying on magic class.

BindingNormalizedNodeCodecRegistry provides a globally updated
holder for these implementations, so that they end up refreshing
their codec based on latest global state.

A follow-up patch will introduce an explicit component, which can
be used in these contexts.

JIRA: MDSAL-525
Change-Id: I6938e23e30656b9dbc960bd6b2ca17c068b67b35
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd type parameter documentation 65/88165/1
Robert Varga [Sat, 29 Feb 2020 15:16:49 +0000 (16:16 +0100)]
Add type parameter documentation

'C' here is undocumented, add at least a single line.

Change-Id: I06f4471983c0ea1fcbff49f45f6e263661030db4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose BindingInstanceIdentifierCodec from BindingCodecTree 60/88160/4
Robert Varga [Sat, 29 Feb 2020 14:38:05 +0000 (15:38 +0100)]
Expose BindingInstanceIdentifierCodec from BindingCodecTree

This codec is in similar class as IdentityCodec -- make sure it is
available to users.

JIRA: MDSAL-522
JIRA: MDSAL-525
Change-Id: I08371dfbbb264991d6d5840838c0736b35921b8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse ListenerRegistry.clear() 58/88158/3
Robert Varga [Sat, 29 Feb 2020 10:57:05 +0000 (11:57 +0100)]
Use ListenerRegistry.clear()

We do not need to access the registrations, just instruct the registry
to clear them.

Change-Id: I710989a5fe473135d5051ab127e23dc33e4227c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoModernize ListenerRegistry users 48/88148/3
Robert Varga [Sat, 29 Feb 2020 10:16:40 +0000 (11:16 +0100)]
Modernize ListenerRegistry users

ListenerRegistry has been modernized for Java 8 way back
in https://git.opendaylight.org/gerrit/c/yangtools/+/73957 and our
users have not been updated.

Use new API surface introduced in that patch, which actually makes
our code cleaner.

Change-Id: Id7e554ed229638cdc871d5b4152cc6795a662514
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove ScanningSchemaServiceProvider.removeListener() 57/88157/2
Robert Varga [Sat, 29 Feb 2020 10:38:39 +0000 (11:38 +0100)]
Remove ScanningSchemaServiceProvider.removeListener()

This method is not used anywhere, remove it.

Change-Id: I5e6d9c25618344b12085d121101ca56b4e09a647
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not use by-listener unregistration 50/88150/2
Robert Varga [Sat, 29 Feb 2020 10:36:10 +0000 (11:36 +0100)]
Do not use by-listener unregistration

This test is the only one needing access to unregister(L). Remove
it via proper registration interaction.

Change-Id: I5eff48b7123820bb090fdb834054fa78fd767e8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove TracingBroker.name 59/88159/3
Robert Varga [Sat, 29 Feb 2020 11:58:15 +0000 (12:58 +0100)]
Remove TracingBroker.name

This can only ever be 'default', remove it as a property.

Change-Id: I66ca5bb6fdf1072cc3f9550866ff375f59a6c544
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded cast 49/88149/2
Robert Varga [Sat, 29 Feb 2020 10:28:54 +0000 (11:28 +0100)]
Remove unneeded cast

Pointed out by Eclipse, very true.

Change-Id: If9ad77f87889e423e7918badc1b4bff2480079ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoConvert DOMSchemaServiceImpl into a component 47/88147/1
Robert Varga [Sat, 29 Feb 2020 09:43:46 +0000 (10:43 +0100)]
Convert DOMSchemaServiceImpl into a component

This is a trivial service which has no dependencies, promote it
to a component and remove it from blueprint.

JIRA: MDSAL-521
Change-Id: Ia6f0feb0ad1324e4a57cac476167dfbe4e07eade
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpand test suite to cover uses-augment of actions 35/88135/2
Robert Varga [Fri, 28 Feb 2020 17:39:51 +0000 (18:39 +0100)]
Expand test suite to cover uses-augment of actions

Augment can also target a relative path from uses context, this
expands the testing model to cover that case, too.

The test case flushes out the problem of not handling
action/notification nodes when targeted in this manner, leading
to an obvious hiccup.

JIRA: MDSAL-517
Change-Id: If389440622c31f544917b04e3825fe6e08e08244
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate Mdsal517Test a bit 34/88134/1
Robert Varga [Fri, 28 Feb 2020 17:36:28 +0000 (18:36 +0100)]
Update Mdsal517Test a bit

This just cleans up naming to prevent confusion.

JIRA: MDSAL-617
Change-Id: I75d2e95d2396f63d05cd533f16057f556850763c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoHide BindingCodecContext methods 33/88133/1
Robert Varga [Fri, 28 Feb 2020 17:29:10 +0000 (18:29 +0100)]
Hide BindingCodecContext methods

BindingCodecContext is package-private, so should be its methods.

Change-Id: Ic371d8f63597d0e00f0287903be81cf3e5e49e45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFixup docs references 32/88132/1
Robert Varga [Fri, 28 Feb 2020 16:14:13 +0000 (17:14 +0100)]
Fixup docs references

We do not use blueprint annotations anymore and reference Karaf's
FeaturesService. Adjust docs to reflect that.

Change-Id: I1c5691a81e13ce2cc5aef81d8285c2b59162521d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake OSGiModuleInfoSnapshot generation unsigned 31/88131/1
Robert Varga [Fri, 28 Feb 2020 15:02:58 +0000 (16:02 +0100)]
Make OSGiModuleInfoSnapshot generation unsigned

The intent is to have this an unsigned counter, expose it as such.

JIRA: MDSAL-392
Change-Id: I7d240933ae35288be0ba6a5f8a047587ab179803
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not expose DataObjectSerializerRegistry outside of codec 30/88130/1
Robert Varga [Fri, 28 Feb 2020 14:25:18 +0000 (15:25 +0100)]
Do not expose DataObjectSerializerRegistry outside of codec

BindingNormalizedNodeCodecRegistry should not implement this
interface directly, as it is only used internally.

Change-Id: I02956b6ae399eabb27634a2048c837f05f6ab3ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix minor typos from previous patches 29/88129/1
Robert Varga [Fri, 28 Feb 2020 14:59:15 +0000 (15:59 +0100)]
Fix minor typos from previous patches

Copyrhing header is wrong and we have an extra empty line, clean
that up.

JIRA: MDSAL-392
Change-Id: Id9dcbf88c12a86d6358fc400705b729f394db398
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd KarafFeaturesSupportTest 23/88123/3
Robert Varga [Fri, 28 Feb 2020 13:22:21 +0000 (14:22 +0100)]
Add KarafFeaturesSupportTest

Improve test coverage a bit exercising KarafFeaturesSupport.

JIRA: MDSAL-235
Change-Id: I475e69566bce11c44ec8022b0d6bb1d451f45ff5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake mdsal-dom-schema-osgi Karaf-aware 62/88062/11
Robert Varga [Fri, 28 Feb 2020 11:58:16 +0000 (12:58 +0100)]
Make mdsal-dom-schema-osgi Karaf-aware

Karaf's FeaturesService exposes lifecycle hooks which allow us
to understand in that an installation is in progress, so that
we can suppress updates while we bundles are not fully resolved.

JIRA: MDSAL-235
Change-Id: Ie5c5b862a5d2975cd4cb08ca4bb1976f263578d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRework binding component instantiation 28/88028/18
Robert Varga [Mon, 24 Feb 2020 11:40:56 +0000 (12:40 +0100)]
Rework binding component instantiation

This reshuffles how DOM and Binding interoperate where schema is
concerned. Since Binding requires Classloader information available
at scanning time, we refactor mdsal-dom-schema-service-osgi to
actually perform Binding-aware scanning, so that this information
is available in ModuleInfoSnapshot.

These are published as OSGiModuleInfoSnapshot along with generation
number for easier reference by a new component, OSGiModelRuntime.

DOMSchemaService is realized on top of ServiceRegistry, where it
listens for OSGiModelRuntime and for SchemaContextListeners, driving
an OSGi whiteboard pattern.

This renders mdsal-binding-dom-codec-osgi completely superfluous,
as there is not enough magic going on to justify it.

mdsal-binding-runtime-osgi is also hooked onto OSGiModuleInfoSnapshot,
providing BindingRuntimeContexts as needed and retaining generation
inforation.

JIRA: MDSAL-392
Change-Id: I083caf3abbc3d7e2212d1df14e45d2745096b5f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix augmentation pointing to a grouping action's input 03/88103/10
miroslav.kovac [Thu, 27 Feb 2020 16:51:37 +0000 (17:51 +0100)]
Fix augmentation pointing to a grouping action's input

When augmentation targets an action input which itself is defined
in a grouping, we need to actually lookup the original definition.

Add a type aliasing information, which should be consulted when
making a simple reference to a type -- and use it in
augmentationToGenTypes().

JIRA: MDSAL-517
Change-Id: I1ef383e8777a7c09a979cbdd84f71be3a0f9b021
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch from NPE to ISE 12/88112/1
Robert Varga [Fri, 28 Feb 2020 05:55:29 +0000 (06:55 +0100)]
Switch from NPE to ISE

When we fail to locate a type it constitutes an IllegalState, not
a plain NPE.

Change-Id: I46eaa470342a5e72ad6a92aefed97e458a2ca398
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix action/grouping lookup mechanics 91/88091/7
Robert Varga [Thu, 27 Feb 2020 09:38:33 +0000 (10:38 +0100)]
Fix action/grouping lookup mechanics

When we are following references towards the original definitions
we need to mind the fact that 'uses' statement may point to a grouping
in a different module and hence we need to adjust namespace accordingly.

The same thing applies when we want to find generated types for such
actions' input/output -- here we need to acquire the correct
ModuleContext.

JIRA: MDSAL-516
Change-Id: I1931279beb8e663e6d8558d50c5d7d274e248cf3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBindingReflections.getModuleInfo() returns @NonNull 00/88100/1
Robert Varga [Thu, 27 Feb 2020 15:38:47 +0000 (16:38 +0100)]
BindingReflections.getModuleInfo() returns @NonNull

A null return here would be an API violation, make sure we catch
these in BindingReflections and do not bother users with potential
nulls.

Change-Id: I1670a46d1de4aeac0730538822157ec6ae216011
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse osgi-core constants 74/88074/1
Robert Varga [Wed, 26 Feb 2020 10:38:07 +0000 (11:38 +0100)]
Use osgi-core constants

Just to keep things consistent, use OSGi's Constants class to get
the bundle id for framework (i.e. SYSTEM_BUNDLE_ID).

Change-Id: I18dae474c944f29ebb32203a12db1c96c2e1483f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove commented-out dependency 44/88044/1
Robert Varga [Tue, 25 Feb 2020 13:53:01 +0000 (14:53 +0100)]
Remove commented-out dependency

We do not need a dependency on javax.annotation, remove it.

Change-Id: I5f71224827f2e4c106820e9859988df5d5d12893
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse BindingCodecTreeFactory in yanglib 43/88043/1
Robert Varga [Tue, 25 Feb 2020 13:49:17 +0000 (14:49 +0100)]
Use BindingCodecTreeFactory in yanglib

Since BindingCodecTreeFactory is a proper component now, we can
use in our yanglib implementations, severing explicit dependency
on binding-dom-codec implementation.

JIRA: MDSAL-392
Change-Id: I76b3ce49a2b25ef7e2f9ff357f98c843659ad181
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove BindingToNormalizedNodeCodec.getDefaultNodeFor() 42/88042/1
Robert Varga [Tue, 25 Feb 2020 11:42:50 +0000 (12:42 +0100)]
Remove BindingToNormalizedNodeCodec.getDefaultNodeFor()

This method is used only in controller compat layer, which is going
away anyway. Remove it from our proper.

Change-Id: I61b73754e08c3b36ce6043e19b1cf25d554888d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUntangle BindingCodecContext/BindingNormalizedNodeCodecRegistry 39/88039/1
Robert Varga [Tue, 25 Feb 2020 11:15:01 +0000 (12:15 +0100)]
Untangle BindingCodecContext/BindingNormalizedNodeCodecRegistry

The relationship here should be clear -- a BindingCodecContext is
self-contained and should not be subject to dynamism. The registry
maintains a 'current' codec.

Achieving this is very simple -- just do not perform upcalls to
Registry when we are looking for a streamer, it would just loop
back to BindingCodecContext and we want to be consistent, i.e. do
not try to upcall to a different BindingCodecContext.

JIRA: MDSAL-392
Change-Id: I720738f122ba89974e32c91ed8c7f3a059c21690
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit off DefaultBindingCodecTreeFactory 38/88038/2
Robert Varga [Tue, 25 Feb 2020 11:07:34 +0000 (12:07 +0100)]
Split off DefaultBindingCodecTreeFactory

BindingCodecTreeFactory is a simple interface which should be backed
by a simple implementation, rather than munging it with the codec
itself. Split it out of BindingNormalizedNodeCodecRegistry and back
it by the corresponding context.

JIRA: MDSAL-392
Change-Id: I1c35d39ab1b7d3b40a6cc3eacd69d3677306c081
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse only BundleContext in BindingClassLoadingStrategy 27/88027/2
Robert Varga [Mon, 24 Feb 2020 12:23:16 +0000 (13:23 +0100)]
Use only BundleContext in BindingClassLoadingStrategy

OSGi DS allows us to inject BundleContext directly, do not bother
with ComponentContext.

JIRA: MDSAL-392
Change-Id: I679d981d36a2e9e8d7df09bc79f87b4e803b1e8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate assertThat() imports 36/88036/1
Robert Varga [Mon, 24 Feb 2020 13:28:09 +0000 (14:28 +0100)]
Migrate assertThat() imports

Assert.assertThat() has been deprecated, with MatcherAssert.assertThat()
being its replacement.

Change-Id: Ifd0f0243756e78f0788f39867514958109d1ab24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse OSGi DS instead of Activator/blueprint 16/87916/8
Robert Varga [Wed, 19 Feb 2020 17:18:52 +0000 (18:18 +0100)]
Use OSGi DS instead of Activator/blueprint

This saves us some hassle, making the intent more obvious.

JIRA: MDSAL-392
Change-Id: I76a42e206857b1c59d0080c788b157ecf40ba829
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 5.0.0-SNAPSHOT 92/87092/22
Robert Varga [Thu, 23 Jan 2020 07:01:07 +0000 (08:01 +0100)]
Bump yangtools to 5.0.0-SNAPSHOT

This adopts yangtools-5.0.0 at snapshots, so we can shake out
integation issues and base our development on yt-5.0.0 changes.

This forces us to refactor mdsal-binding-dom-codec-osgi, which
is done in this patch. We adopt OSGi DS for tracking services.

JIRA: MDSAL-392
Change-Id: Ib5f7cb9817869ca5fc9053af4620d9536a27dcbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove BindingRuntimeContext{Listener,Service} 17/88017/2
Robert Varga [Sun, 23 Feb 2020 21:26:25 +0000 (22:26 +0100)]
Remove BindingRuntimeContext{Listener,Service}

These are not used anywhere and we'll be publishing the context
to the SR anyway. Remove the code while preparing to have it
refactored with DS.

Change-Id: I7639a7ae64edbbc52789eaa0ce388ce7698ff2d7
JIRA: MDSAL-392
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit up BindingRuntimeContext 27/87927/4
Robert Varga [Thu, 20 Feb 2020 10:24:15 +0000 (11:24 +0100)]
Split up BindingRuntimeContext

We need to disconnect API and implementation here, so that we can
publish BindingRuntimeTypes as a service. The split is done within
runtime-api, though the code is still subject to movement.

JIRA: MDSAL-392
Change-Id: Ied64b89018312daef61d9eb9da3e77a0314eca9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove blueprint component 99/87999/1
Robert Varga [Fri, 21 Feb 2020 19:15:14 +0000 (20:15 +0100)]
Remove blueprint component

A thorough review of MD-SAL lifecycle has shown we bend over
backwards to maintain immutable service view for blueprint
containers.

The basic mindset behind blueprint goes directly against MD-SAL's
view of immutable objects. Specifically, hides all dynamic services
behind proxies, isolating us from the Service Registry. Hence we
cannot use the registry to exchange state -- which defeats the point
of having the service registry.

OSGi Declarative Services use static binding (by default) and allow
us to expose component lifecycle, so that it can be correctly
responded to.

We therefore remove any pretense we are endorsing blueprint -- because
we are not. Everybody should decompose their application properly
and use DS for OSGi.

JIRA: MDSAL-413
Change-Id: I6a53e2f9da80a52d4d53371669158e9db7452c1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoruntime-api does not depend on spec-util 15/87915/1
Robert Varga [Wed, 19 Feb 2020 16:50:33 +0000 (17:50 +0100)]
runtime-api does not depend on spec-util

This is a bad dependency -- nothing in the API should depend on
details of the binding spec.

JIRA: MDSAL-392
Change-Id: I0fd60b7f4531656b8b82cdabd3e1c8777ac92eb7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove BindingSchemaContextUtils 14/87914/1
Robert Varga [Wed, 19 Feb 2020 16:41:07 +0000 (17:41 +0100)]
Remove BindingSchemaContextUtils

This class is not referenced anywhere, remove it.

JIRA: MDSAL-392
Change-Id: Ic82e0b4cd3f119f24753014c77da5e37f26794e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpecialize ModuleInfoBackedContext for no fallback 11/87911/2
Robert Varga [Wed, 19 Feb 2020 15:08:34 +0000 (16:08 +0100)]
Specialize ModuleInfoBackedContext for no fallback

We expect BindingRuntimeContext to accurately access classes in
most scenarios. Make sure we ditch TCCL in those scenarios.

JIRA: MDSAL-392
Change-Id: I4a712a65732b98678f555e31dc9400a588a70d1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit out mdsal-binding-runtime-{api,spi} 09/87909/5
Robert Varga [Wed, 19 Feb 2020 11:29:37 +0000 (12:29 +0100)]
Split out mdsal-binding-runtime-{api,spi}

There are a number of runtime details being carried in generator-api
which are pure runtime details.

Split these out, so that we can properly separate the concerns
and cleanup lifecycle. That in turn allows us to create more focused
users and eliminate code duplication.

JIRA: MDSAL-392
Change-Id: I7fe59a3b5f43516d2fcee7344efa97731ebb7215
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove version declaration 08/87908/1
Robert Varga [Wed, 19 Feb 2020 11:44:54 +0000 (12:44 +0100)]
Remove version declaration

We are inheriting project version, let's not re-declare it.

Change-Id: Ibb00161b6c26a9334efbbc6ffdd5a57af9611db0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSeparate out mdsal-binding-dom-codec-spi 75/87875/2
Robert Varga [Tue, 18 Feb 2020 21:08:48 +0000 (22:08 +0100)]
Separate out mdsal-binding-dom-codec-spi

We have a couple of classes which are appropriate in an SPI package,
make sure they are not part of reference implementaiton.

JIRA: MDSAL-392
Change-Id: I2bf6cac4cc5a128bb954d31b9985238271c1a73c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AugmentationReader 77/87877/2
Robert Varga [Tue, 18 Feb 2020 21:35:56 +0000 (22:35 +0100)]
Remove AugmentationReader

This interface is not useful now that we have AugmentationHolder
in yang-binding. Remove it and any references to it.

JIRA: MDSAL-392
Change-Id: I0c3eeead7cb43eb46b3938b33cb49e94a831dc1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate AugmentationReader for removal 76/87876/2
Robert Varga [Tue, 18 Feb 2020 21:23:52 +0000 (22:23 +0100)]
Deprecate AugmentationReader for removal

AugmentationHolder provides the equivalent functionality in-line
in the DataObject itself. Deprecate AugmentationHolder for removal.

JIRA: MDSAL-392
Change-Id: I51044365a38e26f57792bb2036a2775f3b92d711
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove BindingDataAware 74/87874/1
Robert Varga [Tue, 18 Feb 2020 21:01:10 +0000 (22:01 +0100)]
Remove BindingDataAware

We have an equivalent interface in BindingLazyContainerNode,
hence there is no point in keeping an adapter-specific interface
around.

JIRA: MDSAL-392
Change-Id: I1beb3dc8f709bbce80aee5a9d64ef11f75926a41
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRehost BaseYangTypes 73/87873/3
Robert Varga [Tue, 18 Feb 2020 19:55:42 +0000 (20:55 +0100)]
Rehost BaseYangTypes

These types are closely related to Types and as such are part of
the same API group as binding.model.util. Relocating them allows
us to lower dependencies on mdsal-binding-generator-impl.

JIRA: MDSAL-392
Change-Id: I3ba9097c3194c42d3c8f3f1b3fac521934e7d1cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoYangSchemaUtils is not used anywhere, remove it 72/87872/1
Robert Varga [Tue, 18 Feb 2020 19:49:49 +0000 (20:49 +0100)]
YangSchemaUtils is not used anywhere, remove it

This is the last class in mdsal.binding.generator.util as known
to mdsal-binding-generator-impl, freeing up the package for
relocation.

JIRA: MDSAL-392
Change-Id: I9e6f6839f0950ba3600ef3e49139757f8e7e44d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not depend on generator impl in binding-dom-codec-api 68/87868/3
Robert Varga [Tue, 18 Feb 2020 16:54:24 +0000 (17:54 +0100)]
Do not depend on generator impl in binding-dom-codec-api

The API itself does not depend on a particular generator
implementation, make sure that is reflected in pom.xml.

JIRA: YANGTOOLS-392
Change-Id: Ia35d16df7bc43ac43560a98d387518af2d9fe040
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPromote BindingRuntimeContext to binding-generator-api 28/87828/25
Robert Varga [Mon, 17 Feb 2020 21:50:45 +0000 (22:50 +0100)]
Promote BindingRuntimeContext to binding-generator-api

BindingRuntimeContext only requires BindingRuntimeTypes, make
them required in factory method and have users take care of
implementation binding. This allows us to promote it to an API
utility, reducing cross-implementation clutter.

This refactor also shows that BindingCodecTreeFactory is mixing
apples and oranges, forcing users to deal with things that should
readily come from BindingRuntimeContext -- we refactor that support
code so that it is hosted in ModuleInfoBackedContext instead.

JIRA: MDSAL-392
Change-Id: I6381c889c7a1911f9e524aadf1c06c61e99fd75f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake sure docs depend on codec-api 67/87867/2
Robert Varga [Tue, 18 Feb 2020 16:50:13 +0000 (17:50 +0100)]
Make sure docs depend on codec-api

We want to keep it properly documented, make sure to include
mdsal-binding-dom-codec-api.

JIRA: MDSAL-392
Change-Id: Ic0889bb8c73ebc6019dbbfdb5f0029a4754615c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove mdsal-binding-dom-codec tests 60/87860/16
Robert Varga [Tue, 18 Feb 2020 09:00:52 +0000 (10:00 +0100)]
Move mdsal-binding-dom-codec tests

Keeping the tests in a separate package is not useful, make sure
we match the implementation package.

JIRA: MDSAL-392
Change-Id: Id5f8c1af72203a64f03c681c52ca791f282b678d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPromote codec exceptions to binding.codec.api 54/87854/20
Robert Varga [Mon, 17 Feb 2020 23:53:20 +0000 (00:53 +0100)]
Promote codec exceptions to binding.codec.api

This exception should be part of documented API contract, promote
it.

JIRA: MDSAL-392
Change-Id: Ia0985e0399468ee3f57a4a50f65b38085245edeb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPromote ReferencedTypeImpl to model.api.DefaultType 53/87853/13
Robert Varga [Mon, 17 Feb 2020 23:00:43 +0000 (00:00 +0100)]
Promote ReferencedTypeImpl to model.api.DefaultType

This is simple bare type, taking advantage of only AbstractType,
hence we cen provide it in API and allows users to share.

JIRA: MDSAL-392
Change-Id: I67a4b7d16ba9a80637d3d9454e76fd01ef3fe428
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor GeneratedClassLoadingStrategy 59/87859/11
Robert Varga [Tue, 18 Feb 2020 08:58:07 +0000 (09:58 +0100)]
Refactor GeneratedClassLoadingStrategy

This class holds two implementations, each of which is a singleton.
Make sure we lazy-load implementation classes so that the CHA can
be more effective.

JIRA: MDSAL-392
Change-Id: Ia31f63d877ec1025e1a06bf8676d918857e6fd1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove BindingRuntimeContext.getEnumMapping() 32/87832/10
Robert Varga [Mon, 17 Feb 2020 22:42:21 +0000 (23:42 +0100)]
Remove BindingRuntimeContext.getEnumMapping()

These methods are inexact and unused, remove them to prevent any
confusion as to what goes on w.r.t. enums: their class-to-YANG
mapping is captured in the classes themselves, so go fetch it as
appropriate: either enumerate the class, or if you have an instance,
just call getName().

JIRA: MDSAL-392
Change-Id: I0034004e92ae4444efab2401dc16b859047d677a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate BindingRuntimeContext.getEnumMapping() 31/87831/9
Robert Varga [Mon, 17 Feb 2020 22:36:15 +0000 (23:36 +0100)]
Deprecate BindingRuntimeContext.getEnumMapping()

Generated enumerations capture their YANG-declared name and expose
it as their method.

JIRA: MDSAL-392
Change-Id: Iac16b6b3599565f059332ed079c432c0603ac500
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPromote AbstractBaseType to binding.model.api 30/87830/9
Robert Varga [Mon, 17 Feb 2020 22:17:52 +0000 (23:17 +0100)]
Promote AbstractBaseType to binding.model.api

This base class forms an obvious connection between two API concepts,
it should live in the API package as well.

JIRA: MDSAL-392
Change-Id: I5d1209563d2b18f818e3b1c3853b7d7c88fea7a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove BindingSchemaContextUtils.findInstantiatedCase() 29/87829/9
Robert Varga [Mon, 17 Feb 2020 21:58:39 +0000 (22:58 +0100)]
Move BindingSchemaContextUtils.findInstantiatedCase()

The only user is BindingRuntimeContext, move the method there
and sever its dependence in binding.generator.impl.

JIRA: MDSAL-392
Change-Id: I4cc349f5d99a4f9ee0c35b01c553e1ddda263e6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake Binding(Runtime)Generator a proper service 65/87865/3
Robert Varga [Tue, 18 Feb 2020 11:16:43 +0000 (12:16 +0100)]
Make Binding(Runtime)Generator a proper service

We want to expose proper services which implement generator APIs,
not force users to instantiate an implementation by themselves.

This allows us to hide BindingGeneratorImpl and refactor it.

JIRA: MDSAL-392
Change-Id: Id41f8562e87165e8509b9c5076804244d0b342b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse default createParser() only 61/87861/1
Robert Varga [Tue, 18 Feb 2020 09:42:02 +0000 (10:42 +0100)]
Use default createParser() only

Blueprint should be fixed up completely now, use default method
to construct parser.

Change-Id: Ibd452bf36ff22a767d48711a2ba1fe57b217005e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBindingRuntimeTypes should expose SchemaContext 27/87827/1
Robert Varga [Mon, 17 Feb 2020 21:28:38 +0000 (22:28 +0100)]
BindingRuntimeTypes should expose SchemaContext

This is an invariant which is useful to users, make sure we expose
it so that they do not have to track it separately.

Change-Id: If4ddb0915eb433a9f8f857bde473a5de798192ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit ound mdsal-binding-dom-codec-api 26/87826/1
Robert Varga [Mon, 17 Feb 2020 21:04:13 +0000 (22:04 +0100)]
Split ound mdsal-binding-dom-codec-api

The codec has a well-defined API surface, make sure we publish it
as a separate bundle.

Change-Id: Iea7511d7d076320b54dcb719a49767085765a408
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove DispatchSerializers 22/87822/1
Robert Varga [Mon, 17 Feb 2020 17:14:25 +0000 (18:14 +0100)]
Remove DispatchSerializers

These classes are not used anywhere, remove them.

Change-Id: I701c276f6036c7a7a50588d6a18de46831daecfd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate DispatchSerializers for removal 21/87821/1
Robert Varga [Mon, 17 Feb 2020 17:13:40 +0000 (18:13 +0100)]
Deprecate DispatchSerializers for removal

These classes are not used anywhere, deprecate them for removal.

Change-Id: I4538b1c794cd21fd0f21921c0838db620af5eff2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse SchemaNodeIdentifier instead of a SchemaPath 19/87819/1
Robert Varga [Mon, 17 Feb 2020 16:57:07 +0000 (17:57 +0100)]
Use SchemaNodeIdentifier instead of a SchemaPath

This method is not implemented but is going to be needed for RPC
dispatch. Make sure to update it to take SchemaNodeIdentifier,
which is well-defined in terms of lookup.

JIRA: MDSAL-86
Change-Id: I7d188c6912a29cff94f9a4e0b8b0b609bc7c6cae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkstyle a bit 18/87818/1
Robert Varga [Mon, 17 Feb 2020 16:55:45 +0000 (17:55 +0100)]
Fix checkstyle a bit

We have a misaligned method here, fix that up.

Change-Id: Iff4ad3e9a5c2da1e64f73f8b3dfaf78d77b1db85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not use org.junit.rules.ExpectedException redux 11/87811/1
Robert Varga [Mon, 17 Feb 2020 13:01:11 +0000 (14:01 +0100)]
Do not use org.junit.rules.ExpectedException redux

We have assertThrows() which is much more useful, refactor the test
to be more explicit and eliminate use of deprecated elements.

Change-Id: I27d567a2d146451143505756cb47c02a027e779e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove duplicate version declaration 10/87810/1
Robert Varga [Mon, 17 Feb 2020 12:55:21 +0000 (13:55 +0100)]
Remove duplicate version declaration

mdsal-binding-generator-impl matches our project version, hence
it can inherit version from parent.

Change-Id: I1bf665166b6883a47360a20066f6c54cd291b690
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not use org.junit.rules.ExpectedException 64/87664/1
Robert Varga [Thu, 13 Feb 2020 09:50:34 +0000 (10:50 +0100)]
Do not use org.junit.rules.ExpectedException

We have assertThrows() which is much more useful, refactor the test
to be more explicit and eliminate use of deprecated elements.

Change-Id: I8613afbd3028d602a17f9ea7024e8abde6b8cf48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEnable spotbugs in mdsal-binding-java-api-generator 16/76916/22
Robert Varga [Thu, 11 Oct 2018 23:22:07 +0000 (01:22 +0200)]
Enable spotbugs in mdsal-binding-java-api-generator

This fixes up the issues reported and flips enforcement to on.

Change-Id: I205b07535f42f6a3f3c5ae4e14167de4982e9338
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump to odlparent-6.0.5/yangtools-4.0.7 44/87544/1
Robert Varga [Mon, 10 Feb 2020 14:18:45 +0000 (15:18 +0100)]
Bump to odlparent-6.0.5/yangtools-4.0.7

This picks up latest updates from both yangtools and odlparent.

Change-Id: I5ad354f87e65c4ea2141d3bc13c414e89869f833
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse EqualityQueuedNotificationManager 50/86350/5
Robert Varga [Wed, 11 Dec 2019 11:26:26 +0000 (12:26 +0100)]
Use EqualityQueuedNotificationManager

Since we are using Registrations as the key into notification
manager, there is no point it the manager using identity wrappers
-- registrations already perform that role.

Clean things up by using EqualityQueuedNotificationManager.

JIRA: MDSAL-514
Change-Id: Ief05a302169d205ed167e7fb88418910d029f9dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoLower reliance on SchemaNode collection types 96/87096/4
Robert Varga [Thu, 23 Jan 2020 09:41:31 +0000 (10:41 +0100)]
Lower reliance on SchemaNode collection types

As YANG Tools is moving to lazily-constructed views of various
SchemaNode collections, code gets in the way by using Sets and
invariants and similar. This patch migrates the users, so that
we can seamlessly migrate.

JIRA: YANGTOOLS-1068
Change-Id: I5affc1bd93695aef17d8e961fcfc1e3305d1888d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove use of org.junit.rules.ExpectedException 99/87099/1
Robert Varga [Thu, 23 Jan 2020 11:02:46 +0000 (12:02 +0100)]
Remove use of org.junit.rules.ExpectedException

We can use assertThrows() instead.

Change-Id: I8d752851d11496c74388f625067e41582447a8c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump byte-buddy to 1.10.7 65/87065/1
Robert Varga [Tue, 21 Jan 2020 11:58:48 +0000 (12:58 +0100)]
Bump byte-buddy to 1.10.7

There are a number of improvements, including Java compatibility,
update our repackaged version to current latest.

Change-Id: I8b54a1b20e510e2738d6f61f62d7b088db534e78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix path namespace resolution 32/86432/10
miroslav.kovac [Mon, 16 Dec 2019 15:57:22 +0000 (16:57 +0100)]
Fix path namespace resolution

If a path is defined in terms of a submodule-local import,
SchemaContextUtil.findDataSchemaNode() breaks down because
it's reparse attempt fails to find the import in the actual
module.

SchemaContextUtil is providing findDataTreeSchemaNode() which
works properly on parsed PathExpression, use that instead.

JIRA: MDSAL-499
Change-Id: Ifa8a8958d7118d851d27fcc2c70c6d8382e3e3c0
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump to odlparent-6.0.4 and yangtools-4.0.6 81/86981/1
Robert Varga [Thu, 16 Jan 2020 14:35:00 +0000 (15:35 +0100)]
Bump to odlparent-6.0.4 and yangtools-4.0.6

Pick up latest updates and fix for SFT.

Change-Id: Ia95f9aa740d77407043d7a59823c0c71cad0e681
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate away from DataNodeIterator 96/86896/3
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 to yangtools-4.0.5 95/86895/3
Robert Varga [Tue, 14 Jan 2020 16:02:29 +0000 (17:02 +0100)]
Bump to yangtools-4.0.5

This picks up the latest improvements.

Change-Id: If88980b7f1e38e1ee3c736a7bd04ddecd4d0f74e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse parallelStream() to generate files 94/86894/2
Robert Varga [Tue, 7 Jan 2020 20:35:22 +0000 (21:35 +0100)]
Use parallelStream() to generate files

This is a follow-up cleanup, reducing complexity of parallel dispatch
by taking advantage of parallel streams.

Change-Id: I7f5edd1444f171fba9b7118531678875a8692223
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGenerate binding files in parallel 95/86795/3
Robert Varga [Tue, 7 Jan 2020 20:35:22 +0000 (21:35 +0100)]
Generate binding files in parallel

Binding-generated files are standalone in that the process of
generating its source does not have any other side effects.

Improve the performance by generating these files in parallel
using the common ForkJoin pool -- thus taking advantage of all
available cores.

Change-Id: I4ee9efea0371fe9574721701ea9674793209cf24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReturn Ipv{4,6}AddressNoZone when formatting from binary 89/86789/1
Robert Varga [Tue, 7 Jan 2020 12:57:43 +0000 (13:57 +0100)]
Return Ipv{4,6}AddressNoZone when formatting from binary

Ever since MDSAL-440 was implemented, there is no point in our
utilities returning Ipv4Address objects as they never contain a zone
and therefore are equivalent to Ipv4AddressNoZone.

Ipv4AddressNoZone has the additional benefit that the lack of a zone
is contained in the type definition -- hence it can be propagated
through Java interfaces in a type-safe manner. Futhermore, given
the relationship between the two classes, the non-presence of zone
can be ascertained via a simple instanceof check rather than
searching the string.

JIRA: MDSAL-511
Change-Id: I7e0ed85bad7a63af9e9a6f8838609c0e53776ab0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd utility methods to strip zone from Ipv{4,6}Address 88/86788/1
Robert Varga [Tue, 7 Jan 2020 11:25:33 +0000 (12:25 +0100)]
Add utility methods to strip zone from Ipv{4,6}Address

Most callers really want to operate of Ipv4AddressNoZone, as a zone
does not make sense. Some amount of translation may be needed when
dealing with models which we have no control over, hence ensuring
no zone is present needs to be done quickly.

This adds ipv4AddressNoZoneFor(Ipv4Address), which does an efficient
check (for the case where the source is already a NoZone) and strips
the zone.

Change-Id: Ieada4625637d0216983b515324bb5d33f5d33a99
JIRA: MDSAL-510
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove mdsal-uint24-netty 71/86771/2
Robert Varga [Mon, 6 Jan 2020 23:21:50 +0000 (00:21 +0100)]
Move mdsal-uint24-netty

We can expect to have more Netty integrations, this creates a
top-level directory to hold those artifacts.

Change-Id: Ied1645b64b71ddfe9e090f129dc68e8fc785a9c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCentralize Inet4Address enforcement 82/86782/1
Robert Varga [Tue, 7 Jan 2020 10:23:35 +0000 (11:23 +0100)]
Centralize Inet4Address enforcement

We have four call sites doing the same thing. centralize enforcement
by introducing a dedicated method.

Change-Id: I8129d7bf74b6360b12181fe3c9bf8d61c10e7678
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoParse IPv4-mapped IPv6 address as an IPv6 address 57/86757/3
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>
4 years agoEliminate shift variable 65/86765/1
Robert Varga [Mon, 6 Jan 2020 22:36:21 +0000 (23:36 +0100)]
Eliminate shift variable

We do not need to track shift amount, as we can can just shift
the entire previous result, leading to more invariants in the loop.

JIRA: MDSAL-509
Change-Id: I13a108be27cac2fe4498952f3f05437927c999c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd DottedQuad/int interface 62/86762/1
Robert Varga [Mon, 6 Jan 2020 22:17:05 +0000 (23:17 +0100)]
Add DottedQuad/int interface

DottedQuad is essentially an Ipv4Address, hence we should have
the same level of support. Add interface to create DottedQuad from
bits and serialize it to bits.

JIRA: MDSAL-509
Change-Id: I9cee4afa1993a0090f10b3969152344e03e9adc0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse string concatenation for addressString(int) 52/86752/5
Robert Varga [Mon, 6 Jan 2020 17:55:13 +0000 (18:55 +0100)]
Use string concatenation for addressString(int)

Java 11 has cool concatenation, use that instead of a StringBuilder.

JIRA: MDSAL-509
Change-Id: I3d8bd227e85ad611997cbfd7224ff3c31a5bf725
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd IPv4 address bridges to primitive int 51/86751/3
Robert Varga [Mon, 6 Jan 2020 17:41:24 +0000 (18:41 +0100)]
Add IPv4 address bridges to primitive int

Interfacing Ipv4Address(NoZone) with plain int is useful when
we we want to interface with byte streams, such as DataInput
or Netty's ByteBuf. This adds the methods to do so.

JIRA: MDSAL-509
Change-Id: Icce95e4a94ae41be4fc2aee352f83655ea55e89f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd HexString/DottedQuad/Uuid support to IetfYangUtil 16/86716/3
Robert Varga [Sun, 5 Jan 2020 12:33:34 +0000 (13:33 +0100)]
Add HexString/DottedQuad/Uuid support to IetfYangUtil

HexString is similar to a MacAddress and PhysAddress, hence it is
very simple to support it.

DottedQuad is essentially an Ipv4Address, hence it is almost as
simple to support it, too.

Uuid can be created from java.util.UUID, so that is the input
we are expecting.

JIRA: MDSAL-508
Change-Id: I82abd68b23bf857deeb9a64eefb69164fe6c8b24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd uint24.yang 97/86697/4
Robert Varga [Sat, 4 Jan 2020 10:40:52 +0000 (11:40 +0100)]
Add uint24.yang

uint24 is used in a variety of binary protocols (rsvp,lisp,bgp),
this adds a common definition of this type and the corresponding
netty utilities.

JIRA: MDSAL-507
Change-Id: I5170c2bb9ed65d25bada3a85aca6c22f9ba4696b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoLower provideTypeForLeafref() visibility 35/86635/1
Robert Varga [Mon, 30 Dec 2019 19:30:04 +0000 (20:30 +0100)]
Lower provideTypeForLeafref() visibility

This method is only used internally and in tests, make sure we
hide it.

Change-Id: Ic911c4fe70ddd6ac96d539d195c80e5ece4b54ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup AbstractTypeProvider.isLeafRefSelfReference() 28/86628/1
Robert Varga [Mon, 30 Dec 2019 12:45:01 +0000 (13:45 +0100)]
Cleanup AbstractTypeProvider.isLeafRefSelfReference()

This method's logic eagerly strips the xpath, even when we may
end up not needing it. Refactor implementation to initialize
later (and bail quicker).

Change-Id: I7a54d14dcc3def1cc01f65523c5cf6e1277a0fce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Revert "Do not emit empty lists to NormalizedNodes"" 02/86502/7
Robert Varga [Thu, 19 Dec 2019 12:40:10 +0000 (13:40 +0100)]
Revert "Revert "Do not emit empty lists to NormalizedNodes""

This reverts commit 73b85db4f60f2fb003af6cfdffaaef51b2ac2df2,
reinstating the changes done in cbe6a8cafaec862f2a918ecc9af99720090d3c8a
as part of MDSAL-456.

JIRA: MDSAL-450
Change-Id: Ib9ee71194ab06eb873b9257b4e7eed450162f816
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>