yangtools.git
8 years agoBUG-3189: Check consistency of Instance Identifier and Data 52/21952/2
Tony Tkacik [Wed, 13 May 2015 09:23:27 +0000 (11:23 +0200)]
BUG-3189: Check consistency of Instance Identifier and Data

DataTree allows for a NormalizedNode to be stored at a position which is
inconsistent with its identifier. This can lead to weird errors, as
child metadata nodes are created. Add an explicit check to ensure this
cannot occur.

Change-Id: I25918f1f866beadb1ba7c9687ba1a880942a0d9e
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 8bb72bff26c4f1d2da94af6463ba8ae212e2223a)

8 years agoAdd an explicit guard for root presence 51/21951/2
Robert Varga [Wed, 6 May 2015 09:57:35 +0000 (11:57 +0200)]
Add an explicit guard for root presence

A modification could potentially remove the root node, which would
trigger a failure in Optional.get(). Add an explicit check to provide
better diagnostic in that case.

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

8 years agoAdd YangInstanceIdentifierBuilder.node(PathArgument) 50/21950/2
Robert Varga [Wed, 3 Jun 2015 17:17:20 +0000 (19:17 +0200)]
Add YangInstanceIdentifierBuilder.node(PathArgument)

Forcing users of builder to not reuse PathArgument instances seems
wrong. Allow passing of pre-made PathArguments to a builder.

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

8 years agoRemove code duplication in YangInstanceIdentifierBuilder 49/21949/2
Robert Varga [Wed, 3 Jun 2015 17:13:03 +0000 (19:13 +0200)]
Remove code duplication in YangInstanceIdentifierBuilder

The various node() methods share a tail-end, concentrate in a private
method.

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

8 years agoTake advantage of YangInstanceIdentifier methods 48/21948/2
Robert Varga [Fri, 22 May 2015 16:45:02 +0000 (18:45 +0200)]
Take advantage of YangInstanceIdentifier methods

getPathArguments() returns a list, so we can ditch Iterables.

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

8 years agoBug 3344: Make sure StackedPathArgument stack is non empty. 46/21946/2
Tony Tkacik [Wed, 3 Jun 2015 15:26:32 +0000 (17:26 +0200)]
Bug 3344: Make sure StackedPathArgument stack is non empty.

The while cycle in StackedYangInstanceIdentifier did double
check of tryPathArguments for same instance identifier,
which led to shared state during creation. This may have
resulted in StackedPathArgumements with empty stack.

Changing it into do-while cycle makes sure stack is non empty
and also state during construction is not shared between
multiple invokers.

Change-Id: I834c1f22c477bb03a6bae9c4a366308a0988ce4e
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 73b8669288832cd1d573bde23666dd0ba05abb8a)

8 years agoBUG-3263: remove bridge Collection-based methods 45/21945/2
Robert Varga [Tue, 19 May 2015 08:57:24 +0000 (10:57 +0200)]
BUG-3263: remove bridge Collection-based methods

This class and its methods were used in transition on Lithium and are no
longer needed, so remove them.

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

8 years agoBUG-3263: return a List of PathArguments 44/21944/2
Robert Varga [Mon, 18 May 2015 23:05:42 +0000 (01:05 +0200)]
BUG-3263: return a List of PathArguments

This is a further improvement to the interface, we return a List of path
arguments for both getPathArguments() and getReversePathArguments().
This makes it possible for StackedYangInstanceIdentifier to not retain a
legacy list of path arguments.

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

8 years agoBUG-3263: return a Collection for path arguments 43/21943/2
Robert Varga [Mon, 18 May 2015 22:29:06 +0000 (00:29 +0200)]
BUG-3263: return a Collection for path arguments

With the rework in place, we can now return a Collection from both
getPathArguments() and getReversePathArguments() even in the stacked
case.

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

8 years agoBUG-3263: Split off Fixed/Stacked YangInstanceIdentifier 42/21942/2
Robert Varga [Mon, 18 May 2015 19:03:09 +0000 (21:03 +0200)]
BUG-3263: Split off Fixed/Stacked YangInstanceIdentifier

This patch makes YangInstanceIdentifier an abstract class, with two
subclasses: FixedYangInstanceIdentifier and
StackedYangInstanceIdentifier.

The fixed version uses an internal ImmutableList and derives efficiency
from it to the maximum extent allowed.

The stacked version stores a reference to the parent identifier and the
last path argument. It caches the support classes which provide
getPathArguments and getReversePathArguments.

Also introduce a getParent() method, as it can now be implemented
efficiently.

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

8 years agoBaseTypes' QNameModule should be cached 29/21929/2
Robert Varga [Thu, 28 May 2015 10:24:08 +0000 (12:24 +0200)]
BaseTypes' QNameModule should be cached

This QNameModule may be incoming from multiple places, make sure we seed
it into the cache on load.

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

8 years agoMake sure we cache QNameModule instances 30/21930/2
Robert Varga [Thu, 28 May 2015 10:21:55 +0000 (12:21 +0200)]
Make sure we cache QNameModule instances

Parser should be taking advantege of cached QNameModules, as multiple
generations/independent instances within a JVM should still be sharing
them.

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

8 years agoMake test utilities static 31/21931/2
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)

8 years agoDo not instantiate augmentation HashMap in DTO builders 32/21932/2
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)

8 years agoGuard against null data in AbstractLeafCandidateNode 33/21933/2
Robert Varga [Wed, 20 May 2015 19:56:22 +0000 (21:56 +0200)]
Guard against null data in AbstractLeafCandidateNode

An instance of this class is defunct if data is ever null, as accessors
will throw a NPE from Optional.of(). Make sure data passed down is never
null, catching any possible offenders.

This transitively fixes the transformation functions, as they will throw
NPE when they get a null input, as per Function API contract.

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

8 years agoClarify GeneratedTransferObject.getSuperType() 28/21928/1
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)

8 years agoBindingReflections' cache should use cached references 64/21864/2
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 agoBUG 2970 : Throw a specific exception when schema validation fails 82/21882/2
Moiz Raja [Sat, 23 May 2015 00:46:00 +0000 (17:46 -0700)]
BUG 2970 : Throw a specific exception when schema validation fails

When resolving a modification if there is a failure in validating
a data node because it's schema is not present we should throw
a specific exception instead of just an IllegalArgument exception.

This specific exception can be used by CDS to determine if the failure
to add a node was due to a schema validation failure and then we will
attempt to prune data from the normalized node so that the invalid
data elements are removed.

Change-Id: Ieba347c29a9e92ea6aa7ccc2570935cd7a233b8e
Signed-off-by: Moiz Raja <moraja@cisco.com>
9 years agoBug 2816: Changed BooleanStringCodec deserialization 12/20412/7
Debalina Ghosh [Thu, 14 May 2015 16:59:57 +0000 (09:59 -0700)]
Bug 2816: Changed BooleanStringCodec deserialization

Added validate() to deserialize that checks whether input string is true or false.
If some other string is given, IllegalArgumentException is thrown.
Unit test is changed accordingly.

Change-Id: I51e7da19bd4cce85aa707d7741ae3956cc3e8890
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoStop calling get on a possible absent value. 57/21857/1
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 33/21233/1
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 35/21135/2
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 agoClarify the correctness of Optional.get() 75/21175/2
Robert Varga [Wed, 6 May 2015 09:37:58 +0000 (11:37 +0200)]
Clarify the correctness of Optional.get()

The check of Optional.isPresent() exists in all codepaths, but it is not
immediately obvious. Make it more explicit.

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

9 years agoAdd an explicit guard to child modifications 76/21176/2
Robert Varga [Wed, 6 May 2015 09:45:46 +0000 (11:45 +0200)]
Add an explicit guard to child modifications

If we attempt to apply a merge operation to a non-existent child, we may
end up throwing an IllegalStateException stemming from unchecked
Optional.get().

Add an explicit argument check for child node presence to provide better
diagnostics.

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

9 years agoBUG-3263: Split out YangInstanceIdentifierBuilder 77/21177/1
Robert Varga [Mon, 18 May 2015 18:29:20 +0000 (20:29 +0200)]
BUG-3263: Split out YangInstanceIdentifierBuilder

The builder is not visible, so increase clarity by splitting it out into
its own file. This reduces clutter in YangInstanceIdentifier.

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

9 years agoBUG-2453 Add enum yang <-> Java mapping to BindingRuntimeContext 30/20030/5
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 94/13994/10
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 29/20029/3
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 48/21048/2
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 agoDo not instantiate objects for hash values 25/20625/1
Robert Varga [Fri, 15 May 2015 17:06:17 +0000 (19:06 +0200)]
Do not instantiate objects for hash values

While having a reference saves us from having an additional field, it will
cost us an additional object overhead once it is materialized. Opt for a
primitive type with a volatile guard.

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

9 years agoMark JSON writers as @Deprecated 65/18065/4
Colin Dixon [Fri, 10 Apr 2015 00:36:49 +0000 (20:36 -0400)]
Mark JSON writers as @Deprecated

Also fixing a few typos.

Change-Id: I69bb45e564149de510ce0cbd2ef0c5c700b0b3e4
Signed-off-by: Colin Dixon <colin@colindixon.com>
9 years agoBUG 2973 - correction of output for empty yang type 36/13736/5
Jozef Gloncak [Thu, 18 Dec 2014 14:08:49 +0000 (15:08 +0100)]
BUG 2973 - correction of output for empty yang type

Empty" type supports (de)serializiation from
JSON array with null ( [null] ) as was specified in
Section 3.3.9 of draft-lhotka-netmod-yang-json-02

Change-Id: I6650893c00212828cd771e477b81811917000713
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit b18ea8d1646806849f0f1ffbba333a04b9ce93f8)

9 years agoBug 3067: Improved error reporting in Binding Data Codec 23/19523/3
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 agoFixing magic numbers 17/18217/10
Debalina Ghosh [Mon, 13 Apr 2015 20:31:43 +0000 (13:31 -0700)]
Fixing magic numbers

Change-Id: Id844166d94e9d8059bb48fadfbccec95fe45cf46
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoElimitating redundant modifiers 34/19734/2
Debalina Ghosh [Wed, 6 May 2015 18:12:25 +0000 (11:12 -0700)]
Elimitating redundant modifiers

Change-Id: I01e55a903937cd2344ef90aac10a247c269bf560
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoBug 3151: Fix Not a Proxy Instance Exception 11/19811/1
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 13/12813/13
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 agoBug 2690 - Yang-Data-Impl: write and then merge on same list in 45/19145/7
Jan Hajnar [Mon, 27 Apr 2015 12:29:09 +0000 (14:29 +0200)]
Bug 2690 - Yang-Data-Impl: write and then merge on same list in
modification produces incorrect result

* added check for previous WRITE operation in recursiveMerge().
If there is some WRITE operation before MERGE we create new WRITE
operations for children => our data created by WRITE won't be
overwritten by merge on container/list.
* These children WRITE transactions will be recursively pushed down in the tree
while there are merge operations on them

Change-Id: Ie346c61c52cb000ee950d137f39d42e1ead3e1ff
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
9 years agoMerge "Fix NPE in DataTreeCandidates"
Tony Tkacik [Tue, 5 May 2015 08:16:56 +0000 (08:16 +0000)]
Merge "Fix NPE in DataTreeCandidates"

9 years agoFix NPE in DataTreeCandidates 43/19543/3
Tom Pantelis [Mon, 4 May 2015 12:01:16 +0000 (08:01 -0400)]
Fix NPE in DataTreeCandidates

Patch https://git.opendaylight.org/gerrit/#/c/19473 introduced a
guaranteed NPE in DataTreeCandidates.NodeIterator. applyToModification
constructs a NodeIterator passing in a null parent. However the
NodeIterator ctor has PreCondition for non-null parent. Need to remove
the PreCondition.

(need unit tests for this code)

Change-Id: If778aaeede03a593ad2c6acf859f3741fdf0eedd
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFixing sonar issues in yanf-data-impl leafref 44/19544/1
Debalina Ghosh [Mon, 4 May 2015 18:26:28 +0000 (11:26 -0700)]
Fixing sonar issues in yanf-data-impl leafref

Change-Id: I21c1b2fd3342ac1da28f73eabe8d15a774f3032f
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoMerge "Bug 3016 : This manual serialization of ImmutableList was done because in...
Robert Varga [Mon, 4 May 2015 13:32:00 +0000 (13:32 +0000)]
Merge "Bug 3016 : This manual serialization of ImmutableList was done because in routed rpc, remote server was not able to deserialize the object in AKKA messages properly. Following exception was thrown:"

9 years agoMerge "Removed features-test"
Robert Varga [Mon, 4 May 2015 12:05:21 +0000 (12:05 +0000)]
Merge "Removed features-test"

9 years agoMerge "Removed unused dependency."
Robert Varga [Mon, 4 May 2015 12:05:13 +0000 (12:05 +0000)]
Merge "Removed unused dependency."

9 years agoMerge "Fix sonar issues in AnyXmlEffectiveStatementImpl"
Tony Tkacik [Mon, 4 May 2015 12:03:43 +0000 (12:03 +0000)]
Merge "Fix sonar issues in AnyXmlEffectiveStatementImpl"

9 years agoDo not use recursion in InMemoryDataTreeModification.ready() 89/19489/2
Robert Varga [Sun, 3 May 2015 13:16:42 +0000 (15:16 +0200)]
Do not use recursion in InMemoryDataTreeModification.ready()

This patch reworks the logic to eliminate the recursion in
ModifiedNode.seal(), opting for state-tracking class and simple loops.

Change-Id: I42ab781d84e6ebaccc3ff18c3bca6cebcff4573c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize DataTreeCandidate.applyToModification() 73/19473/5
Robert Varga [Sat, 2 May 2015 04:09:52 +0000 (06:09 +0200)]
Optimize DataTreeCandidate.applyToModification()

Both implementations use recursive calls to themselves. Instead of recursion,
we can use a simplistic single-linked stack of operations and iterate over
them.

While this results in object allocation, these objects are short-lived
and never leak from current thread, which means they are easily
collected. Since the call is not recursive, JIT should be able to more
easily inline and optimize the operations.

Change-Id: I7d82a58c6be3e853ea5bcf9069876370804cb199
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMark methods as static 86/19486/1
Robert Varga [Sun, 3 May 2015 07:08:47 +0000 (09:08 +0200)]
Mark methods as static

Private methods do not take object state, so can be turned into statics.
Also perform drive-by cleanup of sonar warnings.

Change-Id: Icca99c4a9242f9459e278bc9ccb7fa1f67259ff1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix benchmark to compile on JDK8 85/19485/1
Robert Varga [Sun, 3 May 2015 07:43:18 +0000 (09:43 +0200)]
Fix benchmark to compile on JDK8

Since we do not compile benchmarks by default, this part was skipped
when we fixed javadocs.

Change-Id: I22768608bae94f0ab8cecdbd86b661c8a58010ea
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "adding methods to minmaxelements to reduce complexity"
Robert Varga [Fri, 1 May 2015 20:12:49 +0000 (20:12 +0000)]
Merge "adding methods to minmaxelements to reduce complexity"

9 years agoFixed some major sonar warnings in yang-common. 41/19241/3
Tony Tkacik [Tue, 28 Apr 2015 15:28:49 +0000 (17:28 +0200)]
Fixed some major sonar warnings in yang-common.

Change-Id: I73ba32227467eca5e189bf76f01099caba760913
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoadding methods to minmaxelements to reduce complexity 82/18882/3
Debalina Ghosh [Wed, 22 Apr 2015 20:48:04 +0000 (13:48 -0700)]
adding methods to minmaxelements to reduce complexity

Change-Id: I7a451b68b1d4f1aa8d2560b61f70c8f6a4481a9b
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoFix sonar issues in AnyXmlEffectiveStatementImpl 80/18880/5
Debalina Ghosh [Wed, 22 Apr 2015 18:43:44 +0000 (11:43 -0700)]
Fix sonar issues in AnyXmlEffectiveStatementImpl

Change-Id: I41472f04d21fdcedbe8afaae1942cbc4ac21dddf
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoBug 3016 : This manual serialization of ImmutableList was done because in routed... 15/19415/1
Harman Singh [Thu, 30 Apr 2015 21:37:25 +0000 (14:37 -0700)]
Bug 3016 : This manual serialization of ImmutableList was done because in routed rpc,
remote server was not able to deserialize the object in AKKA messages properly.
Following exception was thrown:

ERROR Remoting - cannot assign instance of com.google.common.collect.RegularImmutableList
to field org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.legacyPath of type
com.google.common.collect.ImmutableList in instance of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier

Change-Id: I74daf7ab5a6d4c164bb87b1bebc5f4e2dffb8753
Signed-off-by: Harman Singh <harmasin@cisco.com>
9 years agoMerge "Fixed sonar issues in ClassLoaderUtils."
Robert Varga [Thu, 30 Apr 2015 15:53:01 +0000 (15:53 +0000)]
Merge "Fixed sonar issues in ClassLoaderUtils."

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 agoMerge "Bug 2983 - Throws ResultAlreadySet instead of IllegalStateException"
Tony Tkacik [Thu, 30 Apr 2015 13:21:34 +0000 (13:21 +0000)]
Merge "Bug 2983 - Throws ResultAlreadySet instead of IllegalStateException"

9 years agoRemoved features-test 24/19324/1
Tony Tkacik [Wed, 29 Apr 2015 16:48:44 +0000 (18:48 +0200)]
Removed features-test

Yangtools Feature Test was replaced by odlparent feature test.

Change-Id: I972a06d283c2dca1aadfb0b3068708ef7c8dff17
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoRemoved unused dependency. 23/19323/1
Tony Tkacik [Wed, 29 Apr 2015 16:46:12 +0000 (18:46 +0200)]
Removed unused dependency.

Change-Id: If27764d177a80e9aa4a46abbb9c675b0f503056f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 2366 - Effective statement implementation 13/19013/7
Peter Kajsa [Fri, 24 Apr 2015 13:08:36 +0000 (15:08 +0200)]
Bug 2366 - Effective statement implementation

- implementation of addedByUses, addedByAugmentation, Original and
  other fields initialization
- bugfix of augmentation in uses stmt (yang models in /test/resources/model)
- bugfix and test of forward referencing augmentations and uses
- added implementation to Module, Deviation and Import effective statements
- implementation of unit tests
- implementation of Submodule effective statement in progress

Change-Id: Ib4d98cf8875655a7d75ffa6bfd59601638a9ad57
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
9 years agoFixed sonar issues in ClassLoaderUtils. 82/19282/1
Tony Tkacik [Wed, 29 Apr 2015 09:24:45 +0000 (11:24 +0200)]
Fixed sonar issues in ClassLoaderUtils.

Change-Id: I7c21cd2978732ab318a1707043ae8f448e9ba48a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 2983 - Throws ResultAlreadySet instead of IllegalStateException 44/18844/4
Jan Hajnar [Wed, 22 Apr 2015 14:11:32 +0000 (16:11 +0200)]
Bug 2983 - Throws ResultAlreadySet instead of IllegalStateException

* added custom exception when trying to set NormalizedNodeResult
* added more descriptive error when getting NormalizedNodeResult already
set exception

Change-Id: I35beffc79a4951134ba64c07ad1ed627b431031b
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
9 years agoMerge "Cleanup some major sonar warning in yang/*"
Robert Varga [Tue, 28 Apr 2015 19:22:56 +0000 (19:22 +0000)]
Merge "Cleanup some major sonar warning in yang/*"

9 years agoMerge "Bumped Checkstyle to 6.1.1 to be in sync with Maven plugin."
Robert Varga [Tue, 28 Apr 2015 19:08:26 +0000 (19:08 +0000)]
Merge "Bumped Checkstyle to 6.1.1 to be in sync with Maven plugin."

9 years agoAdd hooking into NormalizedNodeParsers. 43/18443/11
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 agoBumped Checkstyle to 6.1.1 to be in sync with Maven plugin. 07/19207/1
Tony Tkacik [Tue, 28 Apr 2015 12:31:22 +0000 (14:31 +0200)]
Bumped Checkstyle to 6.1.1 to be in sync with Maven plugin.

Checkstyle checks needs to be in sync with Checkstyle maven
plugin due to static final constants, which were not
preserved between 2.14 and 2.15 which resulted in
NullPointerExceptions.

Change-Id: I043a9b8bf196b44636f3496e5fd65efce9eccc80
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoCleanup some major sonar warning in yang/* 35/19135/1
Tony Tkacik [Mon, 27 Apr 2015 09:11:03 +0000 (09:11 +0000)]
Cleanup some major sonar warning in yang/*

Change-Id: I7d300fbb5521a3fcad6dea8ceea96eb9a5419fa9
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-2882: introduce cursor-based modification API 95/18595/15
Robert Varga [Sun, 19 Apr 2015 02:36:43 +0000 (04:36 +0200)]
BUG-2882: introduce cursor-based modification API

This patch introduces the notion of a DataTreeSnapshotCursor and a
DataTreeModificationCurser as its mutating variant. The use of cursors
can lean to potential savings when applying multiple operations which
share a common root nested deeper in the data tree.

Change-Id: Iaed2c3d2d0260c97f4dfa36410b1c0944ba37c6c
Signed-off-by: Robert Varga <rovarga@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 84/18984/1
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. 06/18906/2
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 agoMerge "Bug 2363, Bug 2205. Beta version of LeafRefContext tree computation"
Tony Tkacik [Thu, 23 Apr 2015 19:37:19 +0000 (19:37 +0000)]
Merge "Bug 2363, Bug 2205. Beta version of LeafRefContext tree computation"

9 years agoBug 2363, Bug 2205. Beta version of LeafRefContext tree computation 91/14891/19
Peter Kajsa [Wed, 4 Feb 2015 09:06:09 +0000 (10:06 +0100)]
Bug 2363, Bug 2205. Beta version of LeafRefContext tree computation

beta version of DataTree leafrefs values validation

Currently works (Bug 2363):

- LeafRefContext tree build with all relations:
          - isReferencing/ hasReferencingChild
          - isReferenced/ hasReferencedChild
          - leafref target node -> leafref source nodes
- validation of LeafRef Path and Predicates syntax according to RFC6020
  specification
- parsing of all LeafRef Path components (i.e.: LeafRef absolute/relative
  target path, path Predicates, key path expressions) into LeafRefPath
  instance
- pack of utils methods over LeafRefContext tree
- a couple of simple tests

Currently works (Bug 2205):

- validation of LeafRefs values and LeafRefs targets for WRITE, MERGE and
  DELETE operations
- leafref path predicates evaluation (also multiple)

Currently known issues (Bug 2363):

- improve leafref identification, also for cases when type of the leaf is
  typedef -> typedef -> etc.. -> leafref
- handle also choices without case
- questionable issue is, whether it is necessary to merge referencing and
  referencedBy subtrees under the root context (currently are not)
- in equals method check also for predicates equality
- test the solution

Currently known issues (Bug 2205):
- handle also UnkeyedLists
- perfrom further testing
- increase unit tests coverage
- add tests for special cases.

Change-Id: Id873fb446fe40855993fe00e6a56f82d3daee491
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
9 years agoBug 2366: new parser API extensions support implemented 21/18421/7
Gregor Zatko [Thu, 23 Apr 2015 06:58:18 +0000 (08:58 +0200)]
Bug 2366: new parser API extensions support implemented

Change-Id: Ic8b25287a5e79b6c95e40eb65f7f305e9ba41145
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Signed-off-by: Gregor Zatko <gzatko@cisco.com>
9 years agoBug 3051: Fixed pattern checks in generated DTOs 22/18922/1
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 agoExpose YangInstanceIdentifier.EMPTY 16/18916/1
Robert Varga [Thu, 23 Apr 2015 13:01:20 +0000 (15:01 +0200)]
Expose YangInstanceIdentifier.EMPTY

Quite a few users have custom-made versions of this field. Expose it as
an API element.

Change-Id: I2e77b6bc7751b8e4be92df139c9b1cf782328414
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSchemaAwareApplyOperation.checkDeleteApplicable() can be static 56/18856/4
Robert Varga [Wed, 22 Apr 2015 15:33:37 +0000 (17:33 +0200)]
SchemaAwareApplyOperation.checkDeleteApplicable() can be static

This method does not touch local state, so make it static.

Change-Id: I973fb25e4989c7969ddb5df18e2d683d2cbc15ef
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDump the modification which fails to produce a root node 55/18855/4
Robert Varga [Wed, 22 Apr 2015 15:32:47 +0000 (17:32 +0200)]
Dump the modification which fails to produce a root node

For CDS implementation, there seems to be a bug where we fail to create
an appropriate changeset. Also be sure to send debug on how the
candidate is being applied.

Change-Id: Ie0eccd831169ff42c002851633926713dba20c74
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFixed thread-safety issue in YANG parser. 08/18908/1
Tony Tkacik [Thu, 23 Apr 2015 10:27:19 +0000 (12:27 +0200)]
Fixed thread-safety issue in YANG parser.

Change-Id: I9a83ecb316528ee99bc1905ea1d2e7e3f61f11e3
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Fix missing format placeholder"
Tony Tkacik [Wed, 22 Apr 2015 18:28:43 +0000 (18:28 +0000)]
Merge "Fix missing format placeholder"

9 years agoMerge "Add parser support for non-strict schema lookup."
Tony Tkacik [Wed, 22 Apr 2015 18:28:10 +0000 (18:28 +0000)]
Merge "Add parser support for non-strict schema lookup."

9 years agoMerge "Introduce InstanceIdToNodes into yang-data-impl"
Tony Tkacik [Wed, 22 Apr 2015 18:25:56 +0000 (18:25 +0000)]
Merge "Introduce InstanceIdToNodes into yang-data-impl"

9 years agoSonar issues clean-up 45/18745/5
Gregor Zatko [Wed, 22 Apr 2015 13:56:11 +0000 (15:56 +0200)]
Sonar issues clean-up

Change-Id: I9267a5e8dc8347f04a04977043b558369e35670b
Signed-off-by: Gregor Zatko <gzatko@cisco.com>
9 years agoMerge "tests for arguments parsing parsing Augment in Uses (except extensions)"
Tony Tkacik [Wed, 22 Apr 2015 15:54:40 +0000 (15:54 +0000)]
Merge "tests for arguments parsing parsing Augment in Uses (except extensions)"

9 years agoMerge "Fix ifelse curly braces"
Tony Tkacik [Wed, 22 Apr 2015 15:53:39 +0000 (15:53 +0000)]
Merge "Fix ifelse curly braces"

9 years agoMerge "Fixing findbugs"
Tony Tkacik [Wed, 22 Apr 2015 15:52:02 +0000 (15:52 +0000)]
Merge "Fixing findbugs"

9 years agoIntroduce InstanceIdToNodes into yang-data-impl 41/18741/6
Maros Marsalek [Tue, 21 Apr 2015 12:15:19 +0000 (14:15 +0200)]
Introduce InstanceIdToNodes into yang-data-impl

This utility class transforms instance identifier into a normalized node
structure. Suitable for netconf/restconf protocols.

Change-Id: Ib91afe858ee1d5871dd20222b4a8dba56664df73
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoAdd parser support for non-strict schema lookup. 51/18851/1
Tomas Cere [Wed, 22 Apr 2015 14:44:02 +0000 (16:44 +0200)]
Add parser support for non-strict schema lookup.

If parsers are in non-strict mode they will ignore parsing
any node that fails schema lookup.

Change-Id: I61fa05a2607477a7378952d8a88283f2ca98a13c
Signed-off-by: Tomas Cere <tcere@cisco.com>
9 years agoMerge changes I7c9bd36f,I09573668
Tony Tkacik [Wed, 22 Apr 2015 13:26:57 +0000 (13:26 +0000)]
Merge changes I7c9bd36f,I09573668

* changes:
  Add a revisionless QName constructor
  Fix DataTreeCandidateNode API definition

9 years agotests for arguments parsing 08/18408/6
Gregor Zatko [Wed, 22 Apr 2015 08:42:32 +0000 (10:42 +0200)]
tests for arguments parsing
parsing Augment in Uses (except extensions)

Change-Id: I331f97cc38d8a060c24d76f482e42618ee046316
Signed-off-by: Gregor Zatko <gzatko@cisco.com>
9 years agoFix ifelse curly braces 81/18781/1
Debalina Ghosh [Tue, 21 Apr 2015 21:15:35 +0000 (14:15 -0700)]
Fix ifelse curly braces

Change-Id: I174644fd63e25ae0a499908ef60b683407e78185
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoFix missing format placeholder 55/18755/1
Robert Varga [Tue, 21 Apr 2015 15:44:34 +0000 (17:44 +0200)]
Fix missing format placeholder

The modification is not logged because we are missing the %s
placeholder.

Change-Id: I8dd1b72a3fe1dde516cad063996731964c1fac29
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 2900: Fixed incorrect instanceof check in xml codec."
Robert Varga [Tue, 21 Apr 2015 08:52:12 +0000 (08:52 +0000)]
Merge "Bug 2900: Fixed incorrect instanceof check in xml codec."

9 years agoBug 2900: Fixed incorrect instanceof check in xml codec. 93/18693/1
Tony Tkacik [Tue, 21 Apr 2015 08:34:29 +0000 (08:34 +0000)]
Bug 2900: Fixed incorrect instanceof check in xml codec.

Change-Id: I4b48f73458b8876271ce8ee219f9babd05ec632b
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 agoMerge "Sonar issues clean-up"
Tony Tkacik [Tue, 21 Apr 2015 07:47:16 +0000 (07:47 +0000)]
Merge "Sonar issues clean-up"

9 years agoFixing findbugs 92/18492/2
Debalina Ghosh [Thu, 16 Apr 2015 21:25:05 +0000 (14:25 -0700)]
Fixing findbugs

Change-Id: I153b8f990b79b3600d40ac239b5930fabb1f9f63
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agochange to interface 58/18558/3
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 agoFindbugs for yang parser impl util 61/18561/2
Debalina Ghosh [Fri, 17 Apr 2015 18:49:59 +0000 (11:49 -0700)]
Findbugs for yang parser impl util

Change-Id: I82f976de66bb3806f0f8d35ab77ca19cdad87b40
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
9 years agoAdd a revisionless QName constructor 90/18590/5
Robert Varga [Sat, 18 Apr 2015 21:31:38 +0000 (23:31 +0200)]
Add a revisionless QName constructor

We already provide a string-based constructor, but that requires a valid
revision date. A QNameModule does not require a revision, which is
reflected by other factory methods. Add a two-string factory method,
which does not take a revision argument.

Change-Id: I7c9bd36fc972a843b6b45ef972400a8f77f9c9b0
Signed-off-by: Robert Varga <rovarga@cisco.com>