mdsal.git
9 years agoBUG-1485: Introduce AbstractRangeGenerator and friends
Robert Varga [Tue, 26 May 2015 20:49:36 +0000 (22:49 +0200)]
BUG-1485: Introduce AbstractRangeGenerator and friends

Adds utility classes for dealing with various range constraints in
generated code. These classes are implemented in pure Java and attempt
to make sure generated code runs as efficiently as possible.

Change-Id: Ie1d05b514937507e225b9bc7559b1949a7e6eb76
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit c5e1800bc2851c90273b6218295ffe2e59fccf91)

9 years agoBUG-1485: store patterns in an array
Robert Varga [Tue, 26 May 2015 18:32:20 +0000 (20:32 +0200)]
BUG-1485: store patterns in an array

Internal compiled patters are only ever iterated over, hence there is no
need to store them in a list. Convert the field into an array, improving
both CPU and memory efficiency very slightly. Also saves instantiation
of a temporary list.

Change-Id: I5140bc81d0a78d4f91d4ad2d6f81cbd6ed1f6d55
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 29c2d3351bdf371274433e71909236f133130bfb)

9 years agoMake test utilities static
Robert Varga [Thu, 28 May 2015 01:59:22 +0000 (03:59 +0200)]
Make test utilities static

These two can be static, make them static.

Change-Id: I3fe54607edbadea4250928e99260906cbaef4629
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 0341b340283af8efa8c7604c1d65ac87aaeecfd1)

9 years agoDo not instantiate augmentation HashMap in DTO builders
Robert Varga [Tue, 26 May 2015 22:18:57 +0000 (00:18 +0200)]
Do not instantiate augmentation HashMap in DTO builders

Tracing has revealed that the OpenFlowPlugin creates a lot of builders,
instantiation a million HashMaps, which accounts for 1% of CPU time.
Most of these maps are never touched, so we can easily optimize this
away by lazily instantiating a HashMap when the first augmentation is
added. Also prevents copying of empty augmentation in the copy
constructor.

Change-Id: I592fe6af65c9f3b65038def8bb4069666bfdc375
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 2cb012f4e814859e10726d02cb1c073321316ab3)

9 years agoClarify GeneratedTransferObject.getSuperType()
Robert Varga [Thu, 28 May 2015 15:23:27 +0000 (17:23 +0200)]
Clarify GeneratedTransferObject.getSuperType()

The Javadoc for this method is confusing and actually misleading.
Clarify it a bit for future's sake.

Change-Id: I52f09e2e9cf864dc00fb4883099ca4df5219327f
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit a2a7dee2cc6a9e83f53acd08408b227416f29bff)

9 years agoBindingReflections' cache should use cached references
Robert Varga [Wed, 3 Jun 2015 17:32:11 +0000 (19:32 +0200)]
BindingReflections' cache should use cached references

Since we will be giving out these all over the place, it is a good idea
to make sure the returned reference is system-global.

Change-Id: I46c4f62c5ea8f8ee13e7745e6c9efd7d865bd6d4
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 47e801b7f26d9e8ce68738bdfd0d1b6e6c83ae0c)

9 years agoStop calling get on a possible absent value.
Tomas Cere [Tue, 2 Jun 2015 12:03:58 +0000 (14:03 +0200)]
Stop calling get on a possible absent value.

Change-Id: I76cc4d6decd7cf65f988dcb87553b280aab21b24
Signed-off-by: Tomas Cere <tcere@cisco.com>
9 years agoAllow instantiation of more efficient RpcServiceInvokers
Robert Varga [Wed, 27 May 2015 10:54:03 +0000 (12:54 +0200)]
Allow instantiation of more efficient RpcServiceInvokers

Current invoker derived from binding class has the downside of
performing localName->methodName conversion on each invocation, which
costs us in the lookup path, as deriving the binding method name is a
costly operation.

Add a new static factory method for creating a RpcServiceInvoker
instance base on a QName->Method map. Provide two additional
implementations: a generic one, which performs a direct lookup in the
map and a specialized one, which performs lookup only on the localName
part of the qname. The latter is used after we have made sure all QNames
come from the same QNameModule.

Change-Id: I6a4b33f0487838b3ae6c15470823e4bc01114aa5
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit aab5a09be514bc7622416bf2a6d4d6a7465f9d7c)

9 years agoOptimize binding InstanceIdentifier methods
Robert Varga [Tue, 26 May 2015 13:09:00 +0000 (15:09 +0200)]
Optimize binding InstanceIdentifier methods

Openflow traces show some overhead from UnmodifiableIterable. As it
turns out, we are instantiating them needlessly for internal iteration.
This stems from accessing getPathArguments() instead of pathArguments,
which are exposed precisely for this optimization.

Make sure to access pathArguments directly, eliminating this overhead.

Change-Id: I3ef053baa35c80f555b6b9f0b8813692236afa48
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 96639b4fd02beb3590f62fdfc096936e71ad4a32)

9 years agoBUG-2453 Add enum yang <-> Java mapping to BindingRuntimeContext
Maros Marsalek [Mon, 11 May 2015 14:40:26 +0000 (16:40 +0200)]
BUG-2453 Add enum yang <-> Java mapping to BindingRuntimeContext

BindingRuntimeContext already posses the information about all generated
classes from yang (also enums). This commit makes it public.

Change-Id: I638d73625bdc4720ee6427027246455c6c05aa03
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoBug 2528 - Binding Generator: Generated notification implements ChildOf
Peter Kajsa [Thu, 8 Jan 2015 12:50:02 +0000 (13:50 +0100)]
Bug 2528 - Binding Generator: Generated notification implements ChildOf
interface

Generated Notification interface implements ChildOf<DataObject> interface
which is incorrect. Generated Notification should not implement ChildOf
interface since it is not part of data tree. This could lead to use of
Notification in wrong context and may confuse consumers of APIs.

Notice: The solution replaces "implements ChildOf<DataObject>" with
"implements DataObject" in generated Notification interface. Notification
has structured content, so I think the generated Notification interface should
implements at least DataObject interface in order to be able to construct
InstanceIdentifier for the notification (analogously as it is by RPC's input
and output).

Change-Id: I55c7a8cc4ce450fd712c63f8e77881d4a18674e6
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
9 years agoBUG-2453 Remove custom hashcode/equals from Enum type
Maros Marsalek [Thu, 7 May 2015 12:12:17 +0000 (14:12 +0200)]
BUG-2453 Remove custom hashcode/equals from Enum type

Custom hashcode and equals made it impossible to match Enum types based on
packageName and name.

Change-Id: Ib3eed1f0892234b44f8e3459e48f303732a86ffe
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoBug 2988 - DTO equality appears to be broken by proxy
Martin Bobak [Mon, 25 May 2015 13:09:01 +0000 (15:09 +0200)]
Bug 2988 - DTO equality appears to be broken by proxy

Change-Id: Ib068be34371e8863ef6f2ef8d936d3d6918aba37
Signed-off-by: Martin Bobak <mbobak@cisco.com>
9 years agoBug 3067: Improved error reporting in Binding Data Codec
Tony Tkacik [Wed, 29 Apr 2015 13:35:08 +0000 (15:35 +0200)]
Bug 3067: Improved error reporting in Binding Data Codec

Error reporting in Binding Data Codec was reworked
to throw three additional subclasses of IllegalArgumentException
for specific case of failure:

MissingSchema and MissingSchemaForClass - exception thrown
when schema context associated with codec does not contain
models for supplied class or DOM argument.

IncorrectNesting is thrown when schema is available an user
constructed data with invalid nesting (bypassed generic
compile-time checks).

The checks to determine type of exception are done only
if error condition is detected, so non-error fast path
should not be affected by advanced checks.

Added test which tests these types of exceptions.

Change-Id: Iad020a42317ab46df4d2240568fd6e8205383857
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 3f754cccb393b989bafb8b194edf9da0ec3e9e8a)

9 years agoBug 3151: Fix Not a Proxy Instance Exception
Thomas Bachman [Thu, 7 May 2015 14:55:03 +0000 (10:55 -0400)]
Bug 3151: Fix Not a Proxy Instance Exception

This fixes a bug where a "Not a Proxy Instance"
exception (also IllegalArgumentException) is thrown
when hashCode is invoked in a yangtools generated
builder.

Change-Id: Iddc7ca6e4785e5ce11e41900a438dbb49baeaf6d
Signed-off-by: Thomas Bachman <tbachman@yahoo.com>
9 years agoBug 2333 - Java code generation error, when yang model contains Choice node
pkajsa [Thu, 13 Nov 2014 13:51:20 +0000 (14:51 +0100)]
Bug 2333 - Java code generation error, when yang model contains Choice node
in module body at top level

BindingGeneratorImpl fails (NoSuchElementException) during java source code
generation from yang model which contains Choice node directly in module body
at top level. The parent path of Choice node is empty (because the parent
is the module) and therefore iterator.next() on the path fails. For more
information see Bug 2333.

Change-Id: I6e617eca91bb5d8d2b91ad058a4df5c2793ec81d
Signed-off-by: pkajsa <pkajsa@cisco.com>
9 years agoMerge "Add hooking into NormalizedNodeParsers."
Tony Tkacik [Thu, 30 Apr 2015 13:37:48 +0000 (13:37 +0000)]
Merge "Add hooking into NormalizedNodeParsers."

9 years agoAdd hooking into NormalizedNodeParsers.
Tomas Cere [Tue, 28 Apr 2015 12:35:13 +0000 (14:35 +0200)]
Add hooking into NormalizedNodeParsers.

Makes it possible to add a ParsingStrategy into the parsers,
to allow for callbacks/custom processing while parsing.
DefaultParsingStrategy has the same behaviour as the already present parsers.

Change-Id: I5998af4befaf31d3af3f4cf5e2f46ddc32b1e05b
Signed-off-by: Tomas Cere <tcere@cisco.com>
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoMerge "Bug 3051: Fixed pattern checks in generated DTOs"
Robert Varga [Fri, 24 Apr 2015 11:03:54 +0000 (11:03 +0000)]
Merge "Bug 3051: Fixed pattern checks in generated DTOs"

9 years agoBumped model versions to .8-SNAPSHOT
Tony Tkacik [Fri, 24 Apr 2015 08:37:21 +0000 (10:37 +0200)]
Bumped model versions to .8-SNAPSHOT

Change-Id: I1b1c6c3fcd875795f2b8cab1d4146b25c87ee7e7
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBumped Yangtools by minor version.
Tony Tkacik [Thu, 23 Apr 2015 10:03:12 +0000 (10:03 +0000)]
Bumped Yangtools by minor version.

Change-Id: I0c357c757ed78607982abfbf788433e16c88835c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 3051: Fixed pattern checks in generated DTOs
Tony Tkacik [Thu, 23 Apr 2015 15:13:36 +0000 (17:13 +0200)]
Bug 3051: Fixed pattern checks in generated DTOs

Pattern checks in generated DTOs were generated as
OR checks in case model type specified multiple
patterns, but correct behaviour is to do AND.

So in order string needs to verified against
all patterns and match all of them.

Change-Id: If82e282312c82dd71de79534c7fa599fcdcefab4
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "change to interface"
Tony Tkacik [Tue, 21 Apr 2015 08:05:53 +0000 (08:05 +0000)]
Merge "change to interface"

9 years agochange to interface
Debalina Ghosh [Fri, 17 Apr 2015 17:47:06 +0000 (10:47 -0700)]
change to interface

Change-Id: Id16a68b5486e334c01341a646a9e83bb0407272c
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoworkaround for BUG: 2974
Vishal Thapar [Tue, 14 Apr 2015 12:40:19 +0000 (18:10 +0530)]
workaround for BUG: 2974

Suggested workaround for bug2974 is to add
yang-types revision to ietf-interfaces.yang
This change imports latest revision as well as
changes the dependency to ietf-yang-type-20130715

Change-Id: If0ad60b435ae311db656d1a7e49402bc3ef6bb2f
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
9 years agoMerge "BUG-1485: deprecate length/range methods"
Tony Tkacik [Mon, 13 Apr 2015 09:27:14 +0000 (09:27 +0000)]
Merge "BUG-1485: deprecate length/range methods"

9 years agoMerge "Bug 1260: Implemented Binding Caching Codec"
Robert Varga [Mon, 13 Apr 2015 09:18:48 +0000 (09:18 +0000)]
Merge "Bug 1260: Implemented Binding Caching Codec"

9 years agoMerge "Bug 2374 - YANG Binding: Added support for AugmentationHolder interface"
Robert Varga [Mon, 13 Apr 2015 08:40:23 +0000 (08:40 +0000)]
Merge "Bug 2374 - YANG Binding: Added support for AugmentationHolder interface"

9 years agoBUG-1485: deprecate length/range methods
Robert Varga [Wed, 18 Mar 2015 17:20:15 +0000 (18:20 +0100)]
BUG-1485: deprecate length/range methods

These methods leak the internals of how constraints are enforced. No
outside parties should rely on them, so lets mark them deprecated. If we
do not get reports of use, we should be removing them in a future
release.

Change-Id: I128c5abe5c894a4808ff30dcebd6af42d8f682cb
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1260: Implemented Binding Caching Codec
Tony Tkacik [Wed, 8 Apr 2015 17:41:05 +0000 (19:41 +0200)]
Bug 1260: Implemented Binding Caching Codec

Implemented Bidning Caching Codec which maintains
API-user configured cache of serialized data
from Bidning to NormalizedNode.

These cached data are used in subsequent serializations
in order to not allocate new NormalizedNodes for
logically equivalent data.

Change-Id: Iafaed957453569c3e8ecfbb2aed333f3a1fd418f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoDo not declare RuntimeExceptions as thrown
Robert Varga [Sat, 11 Apr 2015 20:40:02 +0000 (22:40 +0200)]
Do not declare RuntimeExceptions as thrown

Fix a bunch of sonar warnings around declaring runtime exceptions.

Change-Id: I6e8267e29ef6c0d3f2d220531ca656ff564331ec
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix constant names
Robert Varga [Sat, 11 Apr 2015 15:03:58 +0000 (17:03 +0200)]
Fix constant names

Constants should have capitalized names. Fixes a few sonar warnings.

Change-Id: I600b482a817055784874e91f9cb8c5b06b948302
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Make sure LOOKUP is a proper constant"
Tony Tkacik [Thu, 9 Apr 2015 12:33:42 +0000 (12:33 +0000)]
Merge "Make sure LOOKUP is a proper constant"

9 years agoMerge "Fix modifier ordering"
Tony Tkacik [Thu, 9 Apr 2015 12:32:56 +0000 (12:32 +0000)]
Merge "Fix modifier ordering"

9 years agoMake sure LOOKUP is a proper constant
Robert Varga [Thu, 9 Apr 2015 11:23:22 +0000 (13:23 +0200)]
Make sure LOOKUP is a proper constant

Change-Id: I684ead0df12bdc5c012f8a20e04f4508c5bbb429
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix modifier ordering
Robert Varga [Thu, 9 Apr 2015 11:11:05 +0000 (13:11 +0200)]
Fix modifier ordering

JLS specifies annotations need to to come before other modifiers, of
which visbility should be first.

Change-Id: I754ef08c13256647d024c121e75fd3617ef6d064
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Fixed incorrect signature in NotificationListenerInvoker"
Robert Varga [Wed, 8 Apr 2015 22:55:45 +0000 (22:55 +0000)]
Merge "Fixed incorrect signature in NotificationListenerInvoker"

9 years agoFixed incorrect signature in NotificationListenerInvoker
Tony Tkacik [Wed, 8 Apr 2015 17:42:29 +0000 (19:42 +0200)]
Fixed incorrect signature in NotificationListenerInvoker

Change-Id: I01e54f6193e54b1488a506ae47d24ba8c808281a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Fixed NPE in BindingCodecTree#getSubtreeCodec(YangInstanceIdentifier)"
Robert Varga [Thu, 2 Apr 2015 14:21:46 +0000 (14:21 +0000)]
Merge "Fixed NPE in BindingCodecTree#getSubtreeCodec(YangInstanceIdentifier)"

9 years agoFixed NPE in BindingCodecTree#getSubtreeCodec(YangInstanceIdentifier)
Tony Tkacik [Thu, 2 Apr 2015 13:35:03 +0000 (15:35 +0200)]
Fixed NPE in BindingCodecTree#getSubtreeCodec(YangInstanceIdentifier)

Change-Id: If77807004779ce6ade106f1bacc9918f98f996ee
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-869: kill more sonar warnings
Robert Varga [Tue, 31 Mar 2015 21:11:08 +0000 (23:11 +0200)]
BUG-869: kill more sonar warnings

Empty statement, mis-ordered annotations and keywords, unneeded
keywords.

Change-Id: I88a7ba62b5fe22cda96a1b5243a2ae4968c31ab3
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-869: remove public modifier
Robert Varga [Tue, 31 Mar 2015 20:55:31 +0000 (22:55 +0200)]
BUG-869: remove public modifier

Public is implied for all methods in an interface, do not specify it
explicitly.

Change-Id: Ic673b60111f9ecf62a6242d3bedf8607036a3403
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2374 - YANG Binding: Added support for AugmentationHolder interface
Tony Tkacik [Tue, 31 Mar 2015 12:57:44 +0000 (14:57 +0200)]
Bug 2374 - YANG Binding: Added support for AugmentationHolder interface

Binding specification v1 was originally designed and implemented
in only one implementation of interfaces in mind, which were generated one,
but during Helium additional implementation was introduced, but
specification and generated copy builder constructor did not accounted for
that change. Added additional interface which is implemented by LazyDataObject
that allow copy of augmenations.

Updated code generator to allow for that change and implementation of
LazyDataObject to support new interface contract.

Change-Id: I15aec38259f7f5e95301368d0264dfcf0571e2ba
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Bug 2924: DataCodecTree expose (de)serialization methods for path arguments."
Robert Varga [Tue, 31 Mar 2015 11:19:49 +0000 (11:19 +0000)]
Merge "Bug 2924: DataCodecTree expose (de)serialization methods for path arguments."

9 years agoBug 2924: DataCodecTree expose (de)serialization methods for path arguments.
Tony Tkacik [Tue, 31 Mar 2015 08:39:37 +0000 (10:39 +0200)]
Bug 2924: DataCodecTree expose (de)serialization methods for path arguments.

Change-Id: I21129df70829a6b9a35af8350352907d46d27de2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-869: remove unused assignment
Robert Varga [Mon, 30 Mar 2015 15:34:59 +0000 (17:34 +0200)]
BUG-869: remove unused assignment

This assignment in return does not make sense, remove it.

Change-Id: Ie999973df471af9f5364ddf2154a24ce237278dc
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-869: do not use StringBuffer
Robert Varga [Mon, 30 Mar 2015 15:33:17 +0000 (17:33 +0200)]
BUG-869: do not use StringBuffer

StringBuilder is the right one, so let's use that one.

Change-Id: Ic84383c05c3cd6bb0eacf9df0bbb3ed9ae46ee3f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-869: remove public modifier
Robert Varga [Mon, 30 Mar 2015 15:23:40 +0000 (17:23 +0200)]
BUG-869: remove public modifier

public is implied to all identifiers within the enclosing interface.

Change-Id: I43a50c7d51b73074df6d0456cf0d9d9aab24b819
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-869: remove empty statements
Robert Varga [Mon, 30 Mar 2015 15:13:29 +0000 (17:13 +0200)]
BUG-869: remove empty statements

Sonar warnings point to semicolons after method definitions and ;;.
Remove all instances.

Change-Id: I1ba067720abd4c9df3a0c457b947736c9bc6313e
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 2906 - Added support of entering notification by #streamChild()"
Robert Varga [Fri, 27 Mar 2015 10:52:48 +0000 (10:52 +0000)]
Merge "Bug 2906 - Added support of entering notification by #streamChild()"

9 years agoBug 2906 - Added support of entering notification by #streamChild()
Tony Tkacik [Fri, 27 Mar 2015 10:04:50 +0000 (11:04 +0100)]
Bug 2906 - Added support of entering notification by #streamChild()

Root Tree Node context did not allowed to enter notification
using binding classes by #streamChild method, since
notifications were cached in different collection.

Added support for entering notifications using such method.

Change-Id: I28779e763a81519d25d71e319776cdc6f179ef33
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoCleanup checkstyle warnings
Robert Varga [Wed, 25 Mar 2015 07:01:57 +0000 (08:01 +0100)]
Cleanup checkstyle warnings

We have various reported problems, from missing spaces, javadocs to
undocumented classes and parameters.

Change-Id: I38a15258ea5ba8eb8d97f257a36a4d890165b5a0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoextended test coverage of InstanceIdentifier
Kinsey Nietzsche [Wed, 12 Nov 2014 13:47:30 +0000 (14:47 +0100)]
extended test coverage of InstanceIdentifier

Change-Id: Id18ae2ec969612e6c52a19449453f47e4e7e5fff
Signed-off-by: Kinsey Nietzsche <kinsey.nietzsche@pantheon.sk>
9 years agoMerge "Bug 868: Removed Binding to Composite Node codecs."
Robert Varga [Fri, 20 Mar 2015 07:17:23 +0000 (07:17 +0000)]
Merge "Bug 868: Removed Binding to Composite Node codecs."

9 years agoBug 868: Removed Binding to Composite Node codecs.
Tony Tkacik [Thu, 19 Mar 2015 14:29:06 +0000 (15:29 +0100)]
Bug 868: Removed Binding to Composite Node codecs.

Change-Id: Ia54519c88870fada74bd2d7ce579c0e77d687157
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG 2868: Update iana-if-type with RFC 7224
Vishal Thapar [Wed, 18 Mar 2015 13:49:13 +0000 (19:19 +0530)]
BUG 2868: Update iana-if-type with RFC 7224

Change-Id: Ide79db6c34fb23bd2c773a614c35d1e436b7d237
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
9 years agoMerge "Bug 2857: Tied pre-existing implementation to BindingCodecTree."
Robert Varga [Wed, 18 Mar 2015 09:34:56 +0000 (09:34 +0000)]
Merge "Bug 2857: Tied pre-existing implementation to BindingCodecTree."

9 years agoBug 2857: Tied pre-existing implementation to BindingCodecTree.
Tony Tkacik [Thu, 12 Mar 2015 11:06:00 +0000 (12:06 +0100)]
Bug 2857: Tied pre-existing implementation to BindingCodecTree.

BindingCodecTree provides public view into backing structure
of binding-data-codec, which was designed and already implemented
as data tree.

By exposing these power-users could build their own
Binding to DOM adapters, where they could customize some aspects
of serialization or precache over-used codecs in order
to speed up performance.

Change-Id: I827eb6014b28d0b6d4256b677ee56d3081ff80b0
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 2859: Key generation when anonymous Enum was used.
Tony Tkacik [Mon, 16 Mar 2015 13:31:50 +0000 (14:31 +0100)]
Bug 2859: Key generation when anonymous Enum was used.

Binding list key was generated with incorrect type,
when anonymous enumeration was defined in leaf in grouping
and that leaf was used for list.

Change-Id: Idcb114be49280f77af8054d8d83c5d8e6f453665
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Migrate from BindingGeneratorUtil"
Tony Tkacik [Mon, 16 Mar 2015 07:28:07 +0000 (07:28 +0000)]
Merge "Migrate from BindingGeneratorUtil"

9 years agoMerge "BUG-2829: make static QName field hold a cached reference"
Tony Tkacik [Mon, 16 Mar 2015 07:13:14 +0000 (07:13 +0000)]
Merge "BUG-2829: make static QName field hold a cached reference"

9 years agoAdd ietf-interfaces to model.
Deepthi V V [Tue, 10 Mar 2015 10:46:23 +0000 (16:16 +0530)]
Add ietf-interfaces to model.

ietf-interfaces is a standard ietf yang model. This will be used by
vpnservice project.

Signed-off-by: Deepthi V V <deepthi.v.v@ericsson.com>
Change-Id: I787e945a39417cc85c79b11cb28264b82cd168e6
Signed-off-by: Deepthi V V <deepthi.v.v@ericsson.com>
9 years agoMigrate from BindingGeneratorUtil
Robert Varga [Thu, 12 Mar 2015 22:50:52 +0000 (23:50 +0100)]
Migrate from BindingGeneratorUtil

BindingMapping is the new home for mapping module namespaces to java
package names.

Change-Id: I61ecf91c2ffa78a6e62c00feaf5fd7879dd89cf9
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2287 - TypeProviderImpl retains empty HashMaps
Ladislav Borak [Tue, 9 Dec 2014 11:32:24 +0000 (12:32 +0100)]
Bug 2287 - TypeProviderImpl retains empty HashMaps

Allocating default HashMaps is wasteful, especially if we end up not
storing anything in them. This fixes that case by making sure we
allocate a map only after we are sure we are going to put something into
it. Also be conservative about the size, so we do not waste too much
space.

Change-Id: I85ad1506e732a5c3728ef3529e7e0b5b430d758a
Signed-off-by: Ladislav Borak <lborak@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-2829: make static QName field hold a cached reference
Robert Varga [Thu, 12 Mar 2015 19:49:11 +0000 (20:49 +0100)]
BUG-2829: make static QName field hold a cached reference

A QName (and QNameModule) exposes an API to obtain a system-wide
shared reference to an object. Use this facility to share QNameModules
across all generated classes, as well as sharing potentially duplicate
QNames.

Change-Id: Icfd0c48edbd37e54be1a436480d5808d4efaf29d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Eliminate all trailing whitespace in xtend"
Tony Tkacik [Thu, 12 Mar 2015 17:10:46 +0000 (17:10 +0000)]
Merge "Eliminate all trailing whitespace in xtend"

9 years agoMerge "Make sure we do not generate trailing whitespace"
Tony Tkacik [Thu, 12 Mar 2015 17:10:41 +0000 (17:10 +0000)]
Merge "Make sure we do not generate trailing whitespace"

9 years agoEliminate all trailing whitespace in xtend
Robert Varga [Thu, 12 Mar 2015 16:44:31 +0000 (17:44 +0100)]
Eliminate all trailing whitespace in xtend

The API generator output should not contain trailing whitespace --
cleanup the templates to make sure we do not pollute output.

Change-Id: Ia312d1e2a0218a51eac42a62446bb6af63d69ee6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMake sure we do not generate trailing whitespace
Robert Varga [Thu, 12 Mar 2015 16:42:08 +0000 (17:42 +0100)]
Make sure we do not generate trailing whitespace

If we get an empy line in description, it is possible for us to generate
trailing whitespace. Make sure we don't do that and also clean any
trailing whitespace from the source file itself.

Change-Id: I8ea20c92cce5a6dccc1c107af97b959af4264f84
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 2248 - mvn clean install is failing due to checkstyle"
Robert Varga [Thu, 12 Mar 2015 14:50:26 +0000 (14:50 +0000)]
Merge "Bug 2248 - mvn clean install is failing due to checkstyle"

9 years agoMerge "Fixed generation of UnionBuilders for anonymous unions."
Robert Varga [Thu, 12 Mar 2015 14:47:15 +0000 (14:47 +0000)]
Merge "Fixed generation of UnionBuilders for anonymous unions."

9 years agoIntroduction of more powerful binding codec APIs
Tony Tkacik [Tue, 3 Mar 2015 11:06:31 +0000 (12:06 +0100)]
Introduction of more powerful binding codec APIs

Introduces new more expresive APIs, which allows
user to customize serialization / deserialization.

Introduced new concepts:

 - Subtree codecs
    - Tree and cursor based APIs for locating subtree
 - Caching Codec - codec which uses cache for serialization

Change-Id: If4868c9cd20c56d2ce0498bd2ded90b1265f7b67
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoFixed generation of UnionBuilders for anonymous unions.
Tony Tkacik [Thu, 12 Mar 2015 13:27:22 +0000 (14:27 +0100)]
Fixed generation of UnionBuilders for anonymous unions.

Change-Id: I18e90e7d7227efe31767734df1ce525df60104d5
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 2248 - mvn clean install is failing due to checkstyle
Ladislav Borak [Thu, 11 Dec 2014 12:07:59 +0000 (13:07 +0100)]
Bug 2248 - mvn clean install is failing due to checkstyle

- added check in BaseTemplate.imports() if imported type has same package
  as generated type

Change-Id: Ifefb4be88c145aa222541cbb901aa9cab63b510d
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBUG-1513: introduce ChoiceSchemaNode
Robert Varga [Tue, 10 Mar 2015 12:03:32 +0000 (13:03 +0100)]
BUG-1513: introduce ChoiceSchemaNode

This introduces the alternative name, which does not clash with
yang-data-api. Also deprecated ChoiceNode.

Change-Id: I42e93c45804dc8e3952d08c697f772d776c303c3
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Fix a generic warning"
Tony Tkacik [Tue, 10 Mar 2015 15:27:24 +0000 (15:27 +0000)]
Merge "Fix a generic warning"

9 years agoFix a generic warning
Robert Varga [Tue, 10 Mar 2015 14:47:32 +0000 (15:47 +0100)]
Fix a generic warning

Add generic arguments to fix a warning.

Change-Id: I249258370efe32d26189cf236818c483b8f0d915
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoIntroduced MethodHandle based invokers for Notification and RPCs
Tony Tkacik [Thu, 5 Mar 2015 21:04:43 +0000 (22:04 +0100)]
Introduced MethodHandle based invokers for Notification and RPCs

This invokers are used to provide genereralized access to any
generated callback / rpc method using one approach for
any RPC.

Change-Id: I4d6ce7c71f658b5e2c6e805479aa47a8f09fb989
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Remove unnecessary casts"
Tony Tkacik [Sun, 8 Mar 2015 10:37:07 +0000 (10:37 +0000)]
Merge "Remove unnecessary casts"

9 years agoMerge "Remove unnecessary casts"
Tony Tkacik [Sun, 8 Mar 2015 10:36:48 +0000 (10:36 +0000)]
Merge "Remove unnecessary casts"

9 years agoMerge "Remove unnecessary casts"
Tony Tkacik [Sun, 8 Mar 2015 10:36:37 +0000 (10:36 +0000)]
Merge "Remove unnecessary casts"

9 years agoMerge "Do not rely on transitive dependencies"
Tony Tkacik [Sun, 8 Mar 2015 10:36:28 +0000 (10:36 +0000)]
Merge "Do not rely on transitive dependencies"

9 years agoRemove unnecessary casts
Robert Varga [Thu, 5 Mar 2015 13:30:24 +0000 (14:30 +0100)]
Remove unnecessary casts

xtend 2.7.x makes instanceof check an implicit cast for subsequent
variable usage, so these generate warnings. Also remove use of
deprecated types and speed up stringuilder usage by passing characters
instead of strings where possible.

Change-Id: I3131166a2fedf09743e6baf4159ba15357a37993
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove unnecessary casts
Robert Varga [Thu, 5 Mar 2015 13:30:02 +0000 (14:30 +0100)]
Remove unnecessary casts

xtend 2.7.x makes instanceof check an implicit cast for subsequent
variable usage, so these generate warnings.

Change-Id: I88f7b68cd2fdddf0bb39c2bbc8f2c8533de22006
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove unnecessary casts
Robert Varga [Thu, 5 Mar 2015 13:28:51 +0000 (14:28 +0100)]
Remove unnecessary casts

xtend 2.7.x makes instanceof check an implicit cast for subsequent
variable usage, so these generate warnings.

Change-Id: Ic28a868eeef8167a1f7e8b3946c2ea13526818dc
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDo not rely on transitive dependencies
Robert Varga [Thu, 5 Mar 2015 13:00:23 +0000 (14:00 +0100)]
Do not rely on transitive dependencies

Maven core and build API should have scope=provided.

Change-Id: Id34b075fb92247507a61b79daee6c4ab73647f53
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoUse Collection.size() instead of Iterables.size()
Robert Varga [Sat, 28 Feb 2015 21:03:00 +0000 (22:03 +0100)]
Use Collection.size() instead of Iterables.size()

Now that NormalizedNodeContainer returns a Collection of children, we
can use its size() method directly, speeding things up just a little
bit.

Change-Id: I7b336d0029084140ea853716a38f8abb87da7c26
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 2539: Properly report incorrect Instance Identifiers"
Tony Tkacik [Thu, 26 Feb 2015 15:36:36 +0000 (15:36 +0000)]
Merge "Bug 2539: Properly report incorrect Instance Identifiers"

9 years agoBug 2539: Properly report incorrect Instance Identifiers
Tony Tkacik [Mon, 19 Jan 2015 14:24:12 +0000 (15:24 +0100)]
Bug 2539: Properly report incorrect Instance Identifiers

Binding Data Codec throws IllegalArgumentException
with description for incorrect instance identifiers
instead of generic NullPointerExceptions.

Change-Id: Ia47c83925a18f029c70b2816e2fcb58632027e3c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge changes I4f081454,Ibe6f283d,I83acfee3,If7a08ff1,Ia0f847dd, ...
Tony Tkacik [Thu, 26 Feb 2015 08:29:44 +0000 (08:29 +0000)]
Merge changes I4f081454,Ibe6f283d,I83acfee3,If7a08ff1,Ia0f847dd, ...

* changes:
  Spellcheck AugmentableDataNodeContainerEmitterSource
  Use simple string concat in DataObjectSerializerSource
  Fix BindingNormalizedNodeCodecRegistry thread safety
  Compact BitsCodec
  Do not declare Exception as thrown
  DataContainerCodecPrototype should be final
  Fix code alignment

9 years agoSpellcheck AugmentableDataNodeContainerEmitterSource
Robert Varga [Wed, 25 Feb 2015 22:34:26 +0000 (23:34 +0100)]
Spellcheck AugmentableDataNodeContainerEmitterSource

Simple rename of an internal class to fix a typo.

Change-Id: I4f081454b5612d2960ff85158ca5cdf2adf17519
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoUse simple string concat in DataObjectSerializerSource
Robert Varga [Wed, 25 Feb 2015 22:32:40 +0000 (23:32 +0100)]
Use simple string concat in DataObjectSerializerSource

Allocating a default-sized StringBuilder is not optimal, we'd really
want to preallocate it with the initial string, at which point it
becomes not much more than a simple concat.

Change-Id: Ibe6f283dccebb347982561c4acacf615a8fff4cf
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix BindingNormalizedNodeCodecRegistry thread safety
Robert Varga [Wed, 25 Feb 2015 16:16:36 +0000 (17:16 +0100)]
Fix BindingNormalizedNodeCodecRegistry thread safety

Registry has a codecContext, which can be asynchronously updated. Make
sure it is volatile, so that any changes are guaranteed to propagate.

Change-Id: I83acfee3bb5f3bf3de6873161dd491e7d5882988
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoCompact BitsCodec
Robert Varga [Wed, 25 Feb 2015 16:19:56 +0000 (17:19 +0100)]
Compact BitsCodec

Instead of an if/else block, just use the result and store it directly
into array.

Change-Id: If7a08ff1a644b8bfbf023d8e5393896eb4e9b643
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDo not declare Exception as thrown
Robert Varga [Wed, 25 Feb 2015 16:28:42 +0000 (17:28 +0100)]
Do not declare Exception as thrown

This Callable never throws, so do not declare the exception, fixing a
sonar warning.

Change-Id: Ia0f847dd31ebc09d91993ded5e5bb2fc6486b7d6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDataContainerCodecPrototype should be final
Robert Varga [Wed, 25 Feb 2015 16:19:01 +0000 (17:19 +0100)]
DataContainerCodecPrototype should be final

Let's help the runtime by declaring the class final, as it is
package-private and does not have descendants.

Change-Id: I8d994dc307c0d831b92a95775fd21e39f3ef1fd0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix code alignment
Robert Varga [Wed, 25 Feb 2015 16:18:13 +0000 (17:18 +0100)]
Fix code alignment

Declaration and comment missed one leading space, fix that.

Change-Id: I198a96668ec0ad94b1b1118949988e88321f8b43
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMark classes/fields as final
Robert Varga [Wed, 25 Feb 2015 13:43:26 +0000 (14:43 +0100)]
Mark classes/fields as final

Making sure that we follow coding patterns, will actually improve what
the JIT can do for us.

Change-Id: I125a6c058ea603d2e9545c42ff8ab969372c371d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSkip ArrayList instantiation during deserialization
Robert Varga [Wed, 25 Feb 2015 11:24:36 +0000 (12:24 +0100)]
Skip ArrayList instantiation during deserialization

We use the ArrayList just as an index holder, after which we just
extract the underlying array. The libraries by default perform a copy
and then JIT has to prove what is going on to remove that overhead.

Let's make it super-easy instead by filling the array ourselves.

Change-Id: Ib48992538b3cd8a9a0c11011fe444e24b23dc825
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-2689: Cast exception when serializing L3Address from groupbasedpolicy policy...
Martin Ciglan [Fri, 20 Feb 2015 15:10:15 +0000 (16:10 +0100)]
BUG-2689: Cast exception when serializing L3Address from groupbasedpolicy policy.yang

When deserializing L3AddressKey, alphabetical order of key arguments
didn't match with order of related QNames as defined in yang model.

The binding-independent world retains the ordering specified in model,
while the binding-aware world requires constructor arguments to be
alpha-sorted.

Change-Id: Icb277fed97d0984ca1a60aa7add7817db727facc
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>