yangtools.git
7 years agoBUG-5410: optimize CaseInsensitiveMap 46/45146/3
Robert Varga [Mon, 5 Sep 2016 09:43:47 +0000 (11:43 +0200)]
BUG-5410: optimize CaseInsensitiveMap

This propagates would-be constants to real constatants,
allowing them to be better optimized.

Change-Id: I500e8060db0f3e22ca19be4188169f74e9a03271
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-5410: import message catalogue 43/45143/3
Robert Varga [Mon, 5 Sep 2016 07:15:43 +0000 (09:15 +0200)]
BUG-5410: import message catalogue

xsd-regex being an Apache source, it uses ResourceBundle
to load translations. Add them to ensure the project works.

Change-Id: If2615cec2edb99eca86e2a06dfc6b3c27b7ca7c5
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoequalsHelper (MoreObjects2) 13/42513/12
Michael Vorburger [Mon, 25 Jul 2016 23:26:14 +0000 (01:26 +0200)]
equalsHelper (MoreObjects2)

Moving this class "downwards" from mdsalutil, because this really is a
generic utility helper class, which probably best fits into
yangtools.utils.

Change-Id: I0d8c6dd44790a85f7efccd6f83d42e6bd7e084bb
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoIncrease unit test coverage for Yangtools 34/46334/2
Igor Foltin [Sun, 2 Oct 2016 10:19:10 +0000 (12:19 +0200)]
Increase unit test coverage for Yangtools

Added test for YangTextSchemaContextResolver.
Extended test for declared statements.

Change-Id: Ibdf7e416287240cae8f673c3ecf817faaf275d5f
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6771: Problem with typedefs nested in augment 23/46223/3
Peter Kajsa [Tue, 27 Sep 2016 12:05:22 +0000 (14:05 +0200)]
Bug 6771: Problem with typedefs nested in augment

When a typedef is nested in a container that is in an augment,
the YANG parser produces an error. This is due to fact, that typedef
statements nested in augments are ignored in statement definition phase,
because AugmentStatement is supported only in full definition phase. The
same issue occurs also for Choice and Case statements. This patch
provides fix of these bugs.

Change-Id: I345fd50e7d9810bbedcc873241338fbdb3186b74
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoIncrease unit test coverage for Yangtools 30/46130/2
Igor Foltin [Fri, 23 Sep 2016 13:18:12 +0000 (15:18 +0200)]
Increase unit test coverage for Yangtools

Added several unit tests.

Change-Id: I57b4b6c84fd489f2546189bb66bc03490ccf194f
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoNaming convetion fix of some unit tests in yang-parser-impl 45/46245/2
Peter Kajsa [Wed, 28 Sep 2016 09:43:30 +0000 (11:43 +0200)]
Naming convetion fix of some unit tests in yang-parser-impl

Change-Id: I2a609752a3f56a2129d4c54355ea347190a40fe1
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoUse YangInstanceIdentifier.EMPTY 32/46132/2
Robert Varga [Fri, 23 Sep 2016 13:44:25 +0000 (15:44 +0200)]
Use YangInstanceIdentifier.EMPTY

Eliminate an internal constant by referring to the well-known
public constant.

Change-Id: I2363714e1f694a352e0163a8c8054c27f22801f7
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAllow QueuedNotificationManager to batch notifications 94/46094/7
Robert Varga [Wed, 21 Sep 2016 15:29:57 +0000 (17:29 +0200)]
Allow QueuedNotificationManager to batch notifications

This patch reworks the queueing logic so that notifications
get completely read from the queue and then propagated to the
listener invoker in one go.

Change-Id: I1a4caaa75f7a206abf4ff5b6829918bd25d79551
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd batching to QueuedNotificationManager 93/46093/2
Robert Varga [Tue, 20 Sep 2016 22:57:00 +0000 (00:57 +0200)]
Add batching to QueuedNotificationManager

Introduce BatchedInvoker, which allows multiple events to be
delivered in one go.

Change-Id: I3d4d054543fa29842d67f6f21f28ff0a47ed135d
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6551: Support for third-party Yang extensions implementation 26/45226/7
Peter Kajsa [Tue, 6 Sep 2016 12:35:02 +0000 (14:35 +0200)]
Bug 6551: Support for third-party Yang extensions implementation

Minor changes in yang statement parser in order to allow implementation
of custom inference pipeline.
- implementation of CustomStatementParserBuilder, which provides
construction of custom statement parser in user-friendly way.
- example and unit test of third-party extension plugin.

Change-Id: I0cdf0e28bd69af4cb41328be6e6a647df58f4fd9
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBUG-5410: use Deque instead of a Stack 40/45140/3
Robert Varga [Mon, 5 Sep 2016 06:54:47 +0000 (08:54 +0200)]
BUG-5410: use Deque instead of a Stack

java.util.Stack is superseded by Deque and its implementations,
which are not synchronized. Use an ArrayDeque instead of a Stack.

Change-Id: I4e7fca6bb77c7122c56d3a85c5de3d264699765a
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoCleanup QueuedNotificationManager 38/45938/2
Robert Varga [Tue, 20 Sep 2016 21:59:32 +0000 (23:59 +0200)]
Cleanup QueuedNotificationManager

Audit code for coding style and unnecessary checks.

Change-Id: Ifce7d4fa4febb7f63ce9014e350e69143508e5c7
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoUse LongAdder instead of an atomic long 98/45898/1
Robert Varga [Tue, 20 Sep 2016 14:40:37 +0000 (16:40 +0200)]
Use LongAdder instead of an atomic long

LongAdder has better performance under contention,
use it for tracking counter.

Change-Id: If32e17a8e16b2a1418c744a54aaa84e8479f3852
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd YangInstanceIdentifier fast paths 97/45897/1
Robert Varga [Tue, 20 Sep 2016 14:24:18 +0000 (16:24 +0200)]
Add YangInstanceIdentifier fast paths

Each YangInstanceIdentifier contains() itself and its
.toRelative() is always empty.

Change-Id: I15ef921b661ccd32b9e6308789624798af4d98cf
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix ConstraintDefinition inconsistency 06/45806/5
Robert Varga [Mon, 19 Sep 2016 12:49:42 +0000 (14:49 +0200)]
Fix ConstraintDefinition inconsistency

The API contract around min/max elements is unclear, but the intent
is to provide a simple 'no effective constraint' result. This is
represented by a null return, which is in fact what the users expect.

Clarify the API contract and fix the two implementations to follow
it instead of using 0/MAX_INT for constraints.

Change-Id: I84b2e2714ddd017f319be4fc6dd0f7bec02bbf0d
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoIncrease unit test coverage for Yangtools 45/45745/2
Igor Foltin [Fri, 16 Sep 2016 17:30:10 +0000 (19:30 +0200)]
Increase unit test coverage for Yangtools

Added test for NormalizedNodes.
Added test for DataTreeCandidates
Added test for DataTreeConfiguration.
Added test for NormalizedNodeDataTreeCandidateNode.

Change-Id: I71773e12f5a4d12f38c034740e3622ba94089bbc
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-5410: fixup javadocs 39/45139/2
Robert Varga [Mon, 5 Sep 2016 06:52:34 +0000 (08:52 +0200)]
BUG-5410: fixup javadocs

With the package being moved, full path of exceptions has
changed. Use imported name instead.

Change-Id: I09fb4f0a9f5a31426b65b489da999b5f3d7c4cde
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-5410: add minimal IntStack implementation 81/39181/3
Robert Varga [Fri, 20 May 2016 13:32:07 +0000 (15:32 +0200)]
BUG-5410: add minimal IntStack implementation

Using Stack<Integer> forces integer boxing, which costing us performance.
This patch adds a specialized primitive-based stack, which provides the
minimal needed implementation.

Change-Id: Iee0e977ab87ce32871ddb468dbda47c4afa4e086
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 3899: Milestone: Increase test coverage for Yangtools 59/45459/1
Igor Foltin [Sat, 10 Sep 2016 16:03:16 +0000 (18:03 +0200)]
Bug 3899: Milestone: Increase test coverage for Yangtools

Added test for DataTreeCandidateNodes.
Added test for EnumPairImpl.
Added test for ImmutableNormalizedNodeStreamWriter.

Change-Id: I784be5c9a657fefe53a1f37595b582f09d51f8a4
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-5561: use canonical Bits order 58/45158/4
Robert Varga [Mon, 5 Sep 2016 13:18:54 +0000 (15:18 +0200)]
BUG-5561: use canonical Bits order

This patch makes BitsTypeBuilder order the bit definitions
according to their position. It also adjusts BitsStringCodec
to normalize user input strings to the canonical ordering.

Change-Id: Ia4123a6275130619f9ef91d24b7340520707a67c
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoYangtools documentation 97/45197/3
Igor Foltin [Tue, 6 Sep 2016 07:12:15 +0000 (09:12 +0200)]
Yangtools documentation

Added more documentation to the semantic versioning section

Change-Id: I71554017ee11732ef6f6176ca70711c96ee22480
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoUse lambdas instead of anonymous classes 68/45068/6
Robert Varga [Fri, 2 Sep 2016 13:14:34 +0000 (15:14 +0200)]
Use lambdas instead of anonymous classes

This makes the code more concise.

Change-Id: I0ce9711d0cafcf4660b78d937e5e0c9fa072da5a
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix a few warnings 07/45207/1
Robert Varga [Tue, 6 Sep 2016 08:18:20 +0000 (10:18 +0200)]
Fix a few warnings

Wrong javadoc and unused import.

Change-Id: I9c8a022d1289215cd50f0225bfa46b082984e668
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix a bunch of warnings 48/45148/1
Robert Varga [Mon, 5 Sep 2016 10:11:34 +0000 (12:11 +0200)]
Fix a bunch of warnings

- javadoc order
- unneeded casts
- static methods

Change-Id: I98344b7052eee1a58c709665e92d0cb1a0d72b46
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoEliminate unneeded import 63/44863/2
Robert Varga [Tue, 30 Aug 2016 14:31:24 +0000 (16:31 +0200)]
Eliminate unneeded import

YangStatementParser is not used directly, only its inner class
is needed. Since it is already imported, shorten references
and clean up code.

Change-Id: Ia2298bdf20860bc936ba29234f6568adbe7462c0
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-6497: Do not lose augmentation statement order 75/44975/2
Robert Varga [Tue, 30 Aug 2016 16:41:48 +0000 (18:41 +0200)]
BUG-6497: Do not lose augmentation statement order

This is a follow-up patch to keep augmentation order
in uses statement.

Change-Id: Iaef4aa949d225d914af3a04c111d0ec41aab6451
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoYangtools documentation 37/44937/2
Igor Foltin [Wed, 31 Aug 2016 14:53:01 +0000 (16:53 +0200)]
Yangtools documentation

Added documentation for new features introduced in boron:
 - if-feature statement resolution
 - semantic version processing

Change-Id: Ie31df99d428ab3eecdd40972a5977cd654c05a6b
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-6497: Do not lose augmentation statement order 75/44875/3
Robert Varga [Tue, 30 Aug 2016 16:41:48 +0000 (18:41 +0200)]
BUG-6497: Do not lose augmentation statement order

Using an interim HashSet can cause unpredictable order
of augmentations, which means the binding spec will not
assign consistent mapping at runtime.

Fix this by using a LinkedHashSet, which retains insertion
order.

Change-Id: I503102d8b61453cc9c8d35b07158cd97138cda42
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-6316: Fix Bit and EnumPair's position/value types 55/42855/12
Igor Foltin [Tue, 16 Aug 2016 13:06:58 +0000 (15:06 +0200)]
BUG-6316: Fix Bit and EnumPair's position/value types

yang.model.api.type defines the effective model of the world,
where these attributes cannot ever be null, which is in contrast
to yang.model.api.stmt, which is the declared model -- where they
can in fact be null.

Fix this discrepancy by forcing the methods to return simple types

Change-Id: I27b9d6d283cd14b2044890d9ccd19bf92647f27e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6420: Fixed SemVer's valueOf method 59/43959/2
Igor Foltin [Mon, 15 Aug 2016 11:16:54 +0000 (13:16 +0200)]
Bug 6420: Fixed SemVer's valueOf method

SemVer's valueOf method now works correctly when called
with a string that contains only major and minor version.

Change-Id: Ia9656fe121d1d73bbe2dc1de87cb7bd7b445961d
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6410: Fixed initialization of typedefs in rpc 36/44036/3
Igor Foltin [Tue, 16 Aug 2016 08:10:32 +0000 (10:10 +0200)]
Bug 6410: Fixed initialization of typedefs in rpc

In the constructor of RpcEffectiveStatementImpl we initialize substatements
of an rpc statment. However, in the for loop we are incorrectly trying to
find type substatements instead of typedef substatements.

Typedef substatements in RpcEffectiveStatementImpl are now initialized correctly.

Change-Id: Ic9a02727ffb4b6e6c798360e2266dc99d77c79e7
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6419: Fixed SchemaContextEmitter's emitContainer method 75/43975/3
Igor Foltin [Mon, 15 Aug 2016 13:14:56 +0000 (15:14 +0200)]
Bug 6419: Fixed SchemaContextEmitter's emitContainer method

Method emitContainer now emits must statements only once
through the method emitConstraints.

Change-Id: Ib818d7dc25b07df3f35559166a0ef933d19808d0
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 3899: Milestone: Increase test coverage for Yangtools 57/43857/2
Igor Foltin [Fri, 12 Aug 2016 13:43:06 +0000 (15:43 +0200)]
Bug 3899: Milestone: Increase test coverage for Yangtools

Added tests to DataNodeIteratorTest and SchemaContextProxyTest.

Change-Id: If446a0cc0ff415c61b53cf53f96bc49dfaccef08
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6416: Fixed SchemaContextEmitter's emitIdentityrefSpecification method 71/43971/2
Igor Foltin [Mon, 15 Aug 2016 12:41:52 +0000 (14:41 +0200)]
Bug 6416: Fixed SchemaContextEmitter's emitIdentityrefSpecification method

Method emitIdentityrefSpecification now passes proper argument to emitBase method.

Change-Id: I16eda69b03d7da1dbefd222c11514a66568d170b
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6414: Fixed DataNodeIterator's traverseModule method 70/43970/3
Igor Foltin [Mon, 15 Aug 2016 12:21:44 +0000 (14:21 +0200)]
Bug 6414: Fixed DataNodeIterator's traverseModule method

Method traverseModule now gets rpc output properly.

Change-Id: Ifdf6d2685ff63bc4548ac2e6b062412e1812ae40
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoRevert "Bug 5968: Mandatory leaf enforcement does not work in some cases" 68/43968/2
Robert Varga [Mon, 15 Aug 2016 12:12:18 +0000 (12:12 +0000)]
Revert "Bug 5968: Mandatory leaf enforcement does not work in some cases"

This reverts commit 1b987ae3e2484bbef1c9bdd7553bf0733ca06372, as it breaks lispflowmapping.

Change-Id: Ic1806c3f42dd73ecfe6357d9b7beea48c305520c
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove String-based getDataChildByName() 98/42898/7
Robert Varga [Mon, 1 Aug 2016 10:09:24 +0000 (12:09 +0200)]
BUG-865: remove String-based getDataChildByName()

This method has been long-deprecated and should be used
only in tests. Remove it.

Change-Id: I4095154ebe83cb8df32b320db91784d509d86c11
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 5968: Mandatory leaf enforcement does not work in some cases 09/42709/4
Peter Kajsa [Thu, 28 Jul 2016 13:05:16 +0000 (15:05 +0200)]
Bug 5968: Mandatory leaf enforcement does not work in some cases

When MapEntry nodes are directly written into datatree, mandatory leaf
enforcement works correctly. However, when a List, Container or any other
parent node containing MapEntry nodes as its children is written into datatree,
datatree does not check presence of mandatory nodes of in this way written
map entry nodes.

Change-Id: I366084f87011cc7519d4c2ef46dd61a2b2df7ceb
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoIntro. new yangtools.testutils artifacts (incl. Mikito) 29/42529/8
Michael Vorburger [Tue, 26 Jul 2016 03:46:08 +0000 (05:46 +0200)]
Intro. new yangtools.testutils artifacts (incl. Mikito)

Seeding new project with proposed Mikito (new), and a
MockitoUnstubbedMethodExceptionAnswer (alternative to
yangtools.mockito-configuration; see the package-info.java in
mockito-configuration about why this is not being proposed in that
project).

Change-Id: I78237936924e0befc0ff17e7604e0fb33262d7cd
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoBug 3899: Milestone: Increase test coverage for Yangtools 09/43509/3
Igor Foltin [Tue, 9 Aug 2016 13:20:11 +0000 (15:20 +0200)]
Bug 3899: Milestone: Increase test coverage for Yangtools

Added test for SchemaContextEmitter

Change-Id: If60531f0a84579519487075a340f73e68c2526eb
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoEliminate QNAME_FUNCTION 36/43336/2
Robert Varga [Mon, 8 Aug 2016 16:31:24 +0000 (18:31 +0200)]
Eliminate QNAME_FUNCTION

Use a method reference instead of a constant function.

Change-Id: Iaecd7a79cf86265cbb00fb60f612d2fe12577d63
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoUse lambdas instead of StmtContextUtils.build{Declared,Effecive} 62/42862/7
Robert Varga [Sun, 31 Jul 2016 19:18:06 +0000 (21:18 +0200)]
Use lambdas instead of StmtContextUtils.build{Declared,Effecive}

Using lambdas at actual call sites reduces verbosity and eliminates
the need for unchecked casts and temporary variables. It also makes
call sites for the two target methods a lot more visible.

Change-Id: I4016c9ba447e22a61aeff5ca98d3adb1b80ef81b
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoImprove yang-maven-plugin error reporting for errors in dependencies 97/43497/3
Michael Vorburger [Tue, 9 Aug 2016 10:32:58 +0000 (12:32 +0200)]
Improve yang-maven-plugin error reporting for errors in dependencies

Instead of e.g. this: [ERROR] yang-to-sources: Unable to parse yang
files from
/home/vorburger/dev/ODL/git/netvirt/vpnservice/aclservice/impl/src/main/yang
java.util.zip.ZipException: invalid LOC header (bad signature) at
java.util.zip.ZipFile.read(Native Method)

it will now report the much more useful variation like this:
java.io.IOException: Exception when reading from:
/home/vorburger/.m2/repository/org/opendaylight/netvirt/neutronvpn-api/0.3.0-SNAPSHOT/neutronvpn-api-0.3.0-SNAPSHOT.jar::META-INF/yang/neutronvpn.yang
at (...)
Caused by: java.util.zip.ZipException: invalid LOC header (bad
signature)

similar to earlier https://git.opendaylight.org/gerrit/#/c/42193/

Change-Id: Ic5bcdc8597825cdc0506516618ec13ede6433bc7
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoBump ietf versions to ...10-SNAPSHOT 15/43515/1
Thanh Ha [Tue, 9 Aug 2016 13:59:36 +0000 (09:59 -0400)]
Bump ietf versions to ...10-SNAPSHOT

Bump versions according to:
https://lists.opendaylight.org/pipermail/release/2016-August/007731.html

Change-Id: I30b795af5841d2f9043ffef6395423bf41ab6e09
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
7 years agoBump versions by 0.1.0 for next dev cycle 55/43455/1
Thanh Ha [Mon, 8 Aug 2016 21:50:23 +0000 (17:50 -0400)]
Bump versions by 0.1.0 for next dev cycle

Change-Id: If7bd200bcf1b559e3fdb734af65e3547ee768d51
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
7 years agoFix list modification with DataTree rooted at MapEntryNode 09/43309/2
Tomas Cere [Mon, 8 Aug 2016 12:26:57 +0000 (14:26 +0200)]
Fix list modification with DataTree rooted at MapEntryNode

Follow up to d8f0f2b146500275441ab8ba0cd2e1907f4b4ce4

We also need to handle the building of the list when rooted
at a MapEntry and return the correct node.

Change-Id: I60390e3fee4e34a44ee9f8836c8b9c147047691b
Signed-off-by: Tomas Cere <tcere@cisco.com>
7 years agoBug 6244: Add context to exceptions thrown by yang statement parser 13/43113/2
Igor Foltin [Thu, 4 Aug 2016 12:30:34 +0000 (14:30 +0200)]
Bug 6244: Add context to exceptions thrown by yang statement parser

Yang statement parser exceptions now contain information
about the failed module and its revision. This information is
represented by SourceIdentifier.

Change-Id: I4a48b5a1e38e0b91a76ac660b131511aefce14a5
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoFix list modification with DataTree rooted at MapEntryNode 25/43225/3
Tomas Cere [Fri, 5 Aug 2016 11:02:58 +0000 (13:02 +0200)]
Fix list modification with DataTree rooted at MapEntryNode

If we had a data tree that was rooted at a MapEntryNode the
node modification was incorrectly enforcing a MapEntryNode when
trying to write into the dataTree.

Change-Id: I9dc02a1917f38e8a0d62279843974b9869c48693
Signed-off-by: Tomas Cere <tcere@cisco.com>
7 years agoBug 3899: Milestone: Increase test coverage for Yangtools 20/43120/2
Igor Foltin [Thu, 4 Aug 2016 14:03:37 +0000 (16:03 +0200)]
Bug 3899: Milestone: Increase test coverage for Yangtools

Added several unit tests.

Change-Id: I67d1b4fa4f879d4af186e6c42c724d66de9ca5d2
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoDo not use revision in AbstractEffectiveDocumentedNode 61/42861/4
Robert Varga [Sun, 31 Jul 2016 18:44:00 +0000 (20:44 +0200)]
Do not use revision in AbstractEffectiveDocumentedNode

Extracting reference from RevisionStatement inside any
DocumentedNode is invalid. RevisionStatements hold their
own reference and they are valid only for modules and
submodules -- which have a reference of their own.

Change-Id: I4522ebbc0449462f80609c1eb06f6a486f4af7af
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: hide SchemaPath constructor 97/42897/2
Robert Varga [Mon, 1 Aug 2016 09:51:24 +0000 (11:51 +0200)]
BUG-865: hide SchemaPath constructor

SchemaPath should not be subclassed outside of this package,
hide its constructor.

Change-Id: I7d5a73dcc537572220a831a0804deccf0d9f6e9d
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix wrong javadoc 96/42896/2
Robert Varga [Mon, 1 Aug 2016 09:51:02 +0000 (11:51 +0200)]
Fix wrong javadoc

This is a copy&paste error, correct it.

Change-Id: Ia48b02c6bf28c5e8ca9338ebbfef50e3c6a7f2bc
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: Remove deprecated XmlStreamUtils constructor 95/42895/2
Robert Varga [Mon, 1 Aug 2016 09:45:04 +0000 (11:45 +0200)]
BUG-865: Remove deprecated XmlStreamUtils constructor

This constructor is no longer used and the class should not be subclassed.
Remove it.

Change-Id: If7b8d470ea66b2a99ec2fe9c4b978571c2413ff1
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove CloneableChildrenMap 93/42893/1
Robert Varga [Mon, 1 Aug 2016 09:39:01 +0000 (11:39 +0200)]
BUG-865: remove CloneableChildrenMap

This class has been deprecated and is not used anywhere. Remove
it.

Change-Id: I7d554de0b50e273a4468f247fdc73a10fdcb6e49
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove JSONCodec.needQuotes() 50/42850/2
Robert Varga [Sun, 31 Jul 2016 13:48:23 +0000 (15:48 +0200)]
BUG-865: remove JSONCodec.needQuotes()

This method is not anywhere and is part of internal contract,
remove it.

Change-Id: I9196b1257422598c97c12cabac97f87773d0993f
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoMake Bit/EnumEffectiveStatementImpl inherit AbstractEffectiveDocumentedNode 60/42860/2
Robert Varga [Sun, 31 Jul 2016 18:29:58 +0000 (20:29 +0200)]
Make Bit/EnumEffectiveStatementImpl inherit AbstractEffectiveDocumentedNode

This removes a bit of code duplication and also fixed EnumEffectiveStatement
not reporting UnknownSchemaNodes.

Change-Id: I7fd1c99d364c9f3d11dd49be77e3a6e650be4c16
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: add proper nullness annotations 54/42854/2
Robert Varga [Sun, 31 Jul 2016 14:45:47 +0000 (16:45 +0200)]
BUG-865: add proper nullness annotations

This fixes the mistake of making DocumentedNode.getStatus()
nullable and adds explicit annotations to DocumentedNode,
SchemaNode and UsesNode.

Change-Id: Ibc773feeca2a3f61d8a74c5b6cbc3028a2f4d260
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove MustDefinitionImpl 53/42853/3
Robert Varga [Sun, 31 Jul 2016 14:25:01 +0000 (16:25 +0200)]
BUG-865: remove MustDefinitionImpl

This implementation is not used anywhere, remove it.

Change-Id: I10de6d971d6e2f7f66fbc073ba9272648ba2ddd8
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: Move ModuleImportImpl and hide it 52/42852/3
Robert Varga [Sun, 31 Jul 2016 14:20:43 +0000 (16:20 +0200)]
BUG-865: Move ModuleImportImpl and hide it

This implementation is used only in the parser,
move it to parser and hide it.

Change-Id: I9a469c01de5a5c077e6fd5aaf52ac6625fcce496
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove BitImpl 80/42780/6
Robert Varga [Fri, 29 Jul 2016 12:30:40 +0000 (14:30 +0200)]
BUG-865: remove BitImpl

Introduce a BitBuilder and remove public BitImpl class.

Change-Id: Icf6297192cba21773a89b87bae817ebb0eebad9e
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoPropagate @Deprecated annotation 79/42779/3
Robert Varga [Fri, 29 Jul 2016 12:11:08 +0000 (14:11 +0200)]
Propagate @Deprecated annotation

getDataChildByName(String) is deprecated, do not shadow
the annotation.

Change-Id: Ib1dbf3e7ea81bde65f79612854588315027398d8
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove deprecated EnumPairImpl 70/42670/6
Robert Varga [Thu, 28 Jul 2016 02:35:03 +0000 (04:35 +0200)]
BUG-865: remove deprecated EnumPairImpl

With all users migrated, this class can safely be removed.

Change-Id: I939ed0b1d127dabadd45134a83d50a7d3073ac74
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 5518: Beryllium yangtools gives error parsing files with Tail-F deref statement 47/42047/2
Peter Kajsa [Tue, 19 Jul 2016 13:17:36 +0000 (15:17 +0200)]
Bug 5518: Beryllium yangtools gives error parsing files with Tail-F deref statement

Added unit test which creates SchemaContext from yang model which contains call
of DEREF function in xpath expression of MUST statement. Both SchemaContext and
RevisionAwareXpath are created successfully.

Change-Id: I528da17dcd758d8c40904a6692603a833651d5e1
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBug 6112 - yang data impl: teach codec union+identityref 45/41545/5
Isaku Yamahata [Fri, 8 Jul 2016 00:23:04 +0000 (17:23 -0700)]
Bug 6112 - yang data impl: teach codec union+identityref

Identityref requires special handling on serialization/deserialization.
This patch teaches it to yang data codec.

Change-Id: Ib229e8cd5d65baff562945ecdac32982549a7cc6
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoRefactor ModifyAction 14/42414/3
Robert Varga [Sun, 24 Jul 2016 22:21:42 +0000 (00:21 +0200)]
Refactor ModifyAction

Change-Id: I22356a00d1249f87c9c69af0945d51d8d80e9325
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6180 - Parser: Backslash double-quote in double-quoted string not recognized 28/41828/13
Peter Kajsa [Thu, 14 Jul 2016 10:46:14 +0000 (12:46 +0200)]
Bug 6180 - Parser: Backslash double-quote in double-quoted string not recognized

Statement parser removes all double or single quotes from strings,
what is incorrect. This fix removes only first and last quotes if they are
present. All other quotes in the string should be escaped already, since the
ANTLR parser recognizes only correctly enclosed strings.

Further, substitution of backslash-escaped characters in
double-quoted strings is done.

Change-Id: I2f596c73be05178dc5cbebaed12e25e428454219
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBug-6195: Fix issue with leafSetEntryNode in SchemaTracker 45/42445/3
Ajay [Mon, 25 Jul 2016 07:48:01 +0000 (07:48 +0000)]
Bug-6195: Fix issue with leafSetEntryNode in SchemaTracker

Changed SchemaTracker:leafSetEntryNode so that if LeafSetEntryNode
is present without it's parent LeafEntryNode in data-change notification,
it's serialization is handled properly.

Change-Id: I911eef98898f2269b31378b383617373c1b47903
Signed-off-by: Ajay <ajayl.bro@gmail.com>
7 years agoBUG-865: Deprecate EnumPairImpl 69/42669/1
Robert Varga [Thu, 28 Jul 2016 02:33:33 +0000 (04:33 +0200)]
BUG-865: Deprecate EnumPairImpl

Leaking implementation classes leads to badness when users
use them instead of interfaces. Deprecate EnumPairImpl and provide
an alternative available via EnumPairBuilder.

Change-Id: I9a11a6fa54da1ef9594fdb8318fea9482b0703c3
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoUse TypedSchemaNode 63/42663/1
Robert Varga [Wed, 27 Jul 2016 22:15:54 +0000 (00:15 +0200)]
Use TypedSchemaNode

Now that we have introduced the concept, use it for common
codepaths.

Change-Id: I8dd9436fc270ee19661971b2990c4a82abda6097
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoIntroduce common interface for getValue() method 95/42595/3
Robert Varga [Tue, 26 Jul 2016 21:38:12 +0000 (23:38 +0200)]
Introduce common interface for getValue() method

LeafNode and LeafSetEntryNode both share this method. Codec-type users
benefit from being able to call on a common interface bridging the two
otherwise unrelated classes.

Change-Id: I5ef86c6859cf6cb7620aa3e4477941f248640c4f
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoMove Leaf(List)SchemaNode.getType() to a common interface 93/42593/3
Robert Varga [Tue, 26 Jul 2016 21:14:25 +0000 (23:14 +0200)]
Move Leaf(List)SchemaNode.getType() to a common interface

This helps users such as the Java Binding implementation.

Change-Id: Iec2b47f6b6e5974e506edc25905c3a77ee167565
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: move getUnknownSchemaNodes to DocumentedNode 61/42561/1
Robert Varga [Tue, 26 Jul 2016 11:29:23 +0000 (13:29 +0200)]
BUG-865: move getUnknownSchemaNodes to DocumentedNode

We already duplicate this method in SchemaNode and UsesNode.
Furthermore EnumPair is actually a DocumentedNode with unknown
nodes.

Move the method definition to DocumentedNode with a default
implementation which returns an empty list. This allows a more
substantial change, which is making EnumPair not a SchemaNode,
but a DocumentedNode.

Change-Id: I0524d9905aea55f150bff88ca022c4467881c367
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: make EnumPair getQName/getSchemaPath unimplemented 94/41994/7
Robert Varga [Mon, 18 Jul 2016 16:32:41 +0000 (18:32 +0200)]
BUG-865: make EnumPair getQName/getSchemaPath unimplemented

EnumPairs by definition do not have SchemaPath, which makes
them non-SchemaNodes. As a first step make the methods
unimplemented so we can catch offenders.

Change-Id: I19cb47368ea5b575fa2ce89bb0c4b6a934bdaae3
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoPackage JavaDoc to clarify what this artifact is & does 08/42508/3
Michael Vorburger [Mon, 25 Jul 2016 22:30:35 +0000 (00:30 +0200)]
Package JavaDoc to clarify what this artifact is & does

Full disclosure: I LIKE the concept of what one could call
MockitoNotImplementedExceptionAnswer, and have separately implemented
the same (one can find this idea publicly on the web in several places).

I don't think having this configured by default automagically is good;
that is just too sneaky and surprising IMHO.  One should be able to use
a popular utility and expect it to behave as it's documented?

No offense meant to anyone.  None taken I hope.

Change-Id: Idf30e82c2cb1777065de781a5eecc220416161ca
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoCheckstyle clean up about 200 trivial violation 11/42511/1
Michael Vorburger [Mon, 25 Jul 2016 23:12:40 +0000 (01:12 +0200)]
Checkstyle clean up about 200 trivial violation

I've intentionally started with the very simple formatting type changes
here.  This does not take care of everything yet, but it's a start.
Hopefully sending a few batches also makes it easier  (AssertionError e)
{to review.

Change-Id: Ibf328746c6880138a56eb36837bc8e789647b9bd
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoOrganize Imports to be Checkstyle compliant in utils 09/42509/1
Michael Vorburger [Mon, 25 Jul 2016 22:46:08 +0000 (00:46 +0200)]
Organize Imports to be Checkstyle compliant in utils

Change-Id: I7bf2721ea5cbe310d73fd1f5f7784395bd44d871
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoFix a few warnings 49/42149/3
Robert Varga [Wed, 20 Jul 2016 13:44:27 +0000 (15:44 +0200)]
Fix a few warnings

Use of raw type and use of deprecated junit methods.

Change-Id: Iafd1c515eb2b1598e56a0d4e4f19b459fce47aab
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6240: Entities of imported module's submodule are not visible 12/42312/2
Peter Kajsa [Thu, 21 Jul 2016 10:46:22 +0000 (12:46 +0200)]
Bug 6240: Entities of imported module's submodule are not visible

Yang statement parser didn't lookup yang elements in submodules of imported module.
Therefore each submodule element was always invisible to other modules even if they
imported parent module of the submodule.

This patch adds IncludeContext to the each RootStatementContext in order to allow
lookup of yang elements also in included submodules.

Change-Id: I9993b9fe110a5e80e9a61258a40841af13c18320
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoFix checkstyle errors and activate enforcement for concepts 08/42408/1
Robert Varga [Sun, 24 Jul 2016 17:16:41 +0000 (19:16 +0200)]
Fix checkstyle errors and activate enforcement for concepts

In an effort to clean our code up, this activates enforcement
of checkstyle rules in concepts and makes sure the build passes.

Change-Id: Ide488a7e4664ff146c23f5f84a2a284055dcb0b3
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoKill trailing whitespace 07/42407/2
Robert Varga [Sun, 24 Jul 2016 15:54:24 +0000 (17:54 +0200)]
Kill trailing whitespace

Addresses checkstyle warnings about trailing whitespace.

Change-Id: Iaa05edcdb22138ec805ab782d94be7f2c8de6458
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd missing license headers 68/42368/1
Thanh Ha [Sat, 23 Jul 2016 01:27:29 +0000 (21:27 -0400)]
Add missing license headers

Change-Id: I5a284260b0700e605ca6781131191955339df3eb
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
7 years agoBUG-865: remove SourceIdentifier.cachedReference() 50/41750/3
Robert Varga [Wed, 13 Jul 2016 08:45:10 +0000 (10:45 +0200)]
BUG-865: remove SourceIdentifier.cachedReference()

This has been superseded by SourceIdentifier.intern().

Change-Id: Idf5deb6653180e9b9185cb34182ff4cf07da7685
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoImprove yang-maven-plugin error reporting 93/42193/2
Michael Vorburger [Thu, 21 Jul 2016 01:58:22 +0000 (03:58 +0200)]
Improve yang-maven-plugin error reporting

Instead of e.g. this: org.apache.maven.plugin.MojoFailureException:
Failed to scan for YANG files in depedencies (...) Caused by:
java.util.zip.ZipException: invalid CEN header (bad signature) at
java.util.zip.ZipFile.open(Native Method)

it will now report the much more useful variation like this:
org.apache.maven.plugin.MojoFailureException: Failed to scan for YANG
files in dependency:
/home/vorburger/.m2/repository/org/opendaylight/openflowplugin/model/model-flow-base/0.3.0-SNAPSHOT/model-flow-base-0.3.0-SNAPSHOT.jar

Change-Id: I1062d10d9157f9ac6b44cd86a29af8cc8e87b25f
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoFix minor bug in (new) LogMessageExtractorCheck 94/42194/2
Michael Vorburger [Thu, 21 Jul 2016 02:06:59 +0000 (04:06 +0200)]
Fix minor bug in (new) LogMessageExtractorCheck

Normally the target/ directory already exists of course, but if you e.g.
run just "mvn process-sources" then, on some project, the target/
directory may not exist (yet) - and thus this code must ensure it
creates it.

Change-Id: I764e3673433a4abb6819b883f24d7622ac2f352b
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoCheckstyle clean-up src/test/java 88/42188/1
Michael Vorburger [Thu, 21 Jul 2016 01:05:00 +0000 (03:05 +0200)]
Checkstyle clean-up src/test/java

Required to be able to run (enforce) CS on src/test as well.

Change-Id: Ifa974a62fc5d912fc6e8a710851da7618254e256
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoBUG-865: Remove DataTreeFactory#create() 50/32850/10
Robert Varga [Fri, 15 Jan 2016 20:48:21 +0000 (21:48 +0100)]
BUG-865: Remove DataTreeFactory#create()

This method has been deprecated in favor of more specific create
methods. Remove it.

Change-Id: I5631f8e6354ea8abd5002241d5ecbc6e51b5c584
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
7 years agoBUG-865: remove CrossSourceStatementReactor.buildEffectiveMappedToSource() 93/41993/3
Robert Varga [Mon, 18 Jul 2016 16:38:46 +0000 (18:38 +0200)]
BUG-865: remove CrossSourceStatementReactor.buildEffectiveMappedToSource()

This method has been deprecated and is used by a test. Remove the test
and the method.

Change-Id: Icf44b4361626dd6cf470d8e7547adfbcd1784ac8
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoMake YangToSourcesProcessor methods static 92/41992/3
Robert Varga [Mon, 18 Jul 2016 16:42:24 +0000 (18:42 +0200)]
Make YangToSourcesProcessor methods static

Utility methods can be made static.

Change-Id: I1ad42b3f83fb661c6ec0022d213d4946dbf1157a
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove SchemaContextUtil.findParentModuleByType() 91/41991/2
Robert Varga [Mon, 18 Jul 2016 16:21:24 +0000 (18:21 +0200)]
BUG-865: remove SchemaContextUtil.findParentModuleByType()

This method has been deprecated and is no longer used
anywhere: remove it.

Change-Id: Idd5d1398f9743e301ed4a8a71de053128b354bf7
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove deprecated BaseTypes constants 89/41989/2
Robert Varga [Mon, 18 Jul 2016 16:19:44 +0000 (18:19 +0200)]
BUG-865: remove deprecated BaseTypes constants

These constants have been deprecated and are no longer
used anywhere.

Change-Id: Ied9ae9303eeb76a8f7de99e74ff3a7f44cc8aa3b
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove InstanceIdentifierTypeDefinition#.getPathStatement() 88/41988/2
Robert Varga [Mon, 18 Jul 2016 16:15:51 +0000 (18:15 +0200)]
BUG-865: remove InstanceIdentifierTypeDefinition#.getPathStatement()

Remove this deprecated method.

Change-Id: Id54fdfecc8601fa1c85870ee1334e650813ac07d
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove DataSchemaNodeAware 87/41987/2
Robert Varga [Mon, 18 Jul 2016 16:12:59 +0000 (18:12 +0200)]
BUG-865: remove DataSchemaNodeAware

This interface has been integrated into NormalizedNodeStreamWriter
and has no other users: remove it.

Change-Id: If7d6923c52f15fdc79784edcbb8b665368961082
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove SchemaContextHolder 86/41986/2
Robert Varga [Mon, 18 Jul 2016 16:08:17 +0000 (18:08 +0200)]
BUG-865: remove SchemaContextHolder

This interface has been deprecated and is not used by any
live code, remove it.

Change-Id: Ibb556ada5bedba765cac5d375ec52024c5f3ef06
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: eliminate getYangText() 85/41385/4
Robert Varga [Wed, 6 Jul 2016 09:51:12 +0000 (11:51 +0200)]
BUG-865: eliminate getYangText()

Change-Id: Id8a952cb7b299e1eccd49279f91bf6bf41b8986e
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix bug FileNotFoundException: target/logger-messages.txt polluting logs 71/42071/2
Michael Vorburger [Tue, 19 Jul 2016 17:05:46 +0000 (19:05 +0200)]
Fix bug FileNotFoundException: target/logger-messages.txt polluting logs

Change-Id: I1f9bfd493d1554b4d081738c7bb6e4a30fa19290
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoRemove use of Guava Charsets 74/41974/4
Robert Varga [Mon, 18 Jul 2016 14:19:35 +0000 (16:19 +0200)]
Remove use of Guava Charsets

We have StandardCharsets, use those.

Change-Id: I92677e8a72cf16fc03df25226c967221959f14c5
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6022: Deviation statement is not fully available in the YANG parser output 52/40752/9
Igor Foltin [Thu, 23 Jun 2016 07:11:36 +0000 (09:11 +0200)]
Bug 6022: Deviation statement is not fully available in the YANG parser output

- deviation statement can now contain one or more deviate statements
as it is defined in rfc6020
- deviate statement now provides more information about deviated statements

Change-Id: I38ebb5932626df9a0c2de00220474a88ca7f2bc9
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoNew LogMessageExtractorCheck which writes out TXT report of all loggers 10/39410/10
Michael Vorburger [Wed, 25 May 2016 12:58:03 +0000 (14:58 +0200)]
New LogMessageExtractorCheck which writes out TXT report of all loggers

Change-Id: I853c742901131293c58c78bea821fe0d12957f07
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoAdd toString() to InMemoryDataTreeCandidate 10/39310/4
Tomas Cere [Tue, 24 May 2016 09:01:14 +0000 (11:01 +0200)]
Add toString() to InMemoryDataTreeCandidate

Change-Id: I9ece88ef6e2c5db17f46d732316f52984269d7d3
Signed-off-by: Tomas Cere <tcere@cisco.com>