yangtools.git
8 years agoAdd a couple of toString() implementations 43/37243/1
Stephen Kitt [Thu, 7 Apr 2016 09:33:09 +0000 (11:33 +0200)]
Add a couple of toString() implementations

These are useful when debugging DataTreeChangeListener conversions.

Change-Id: Ie83bb72b9cd3b3461f758965a673f231755084cb
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoFix LOG formatting issues 77/36977/2
Ryan Goulding [Thu, 31 Mar 2016 20:20:31 +0000 (16:20 -0400)]
Fix LOG formatting issues

In a few places, LOG statements are updated to utilize proper
formatting.

Change-Id: Ic1d0f50a6b561ee1e70e76d096b78928d5af65b1
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoMove CACHED_FILE_PATTERN constant to correct location 33/36933/3
Ryan Goulding [Thu, 31 Mar 2016 04:33:30 +0000 (00:33 -0400)]
Move CACHED_FILE_PATTERN constant to correct location

Constants are generally put together at the top of the class.

Change-Id: I6ab0ea662066cce3f421253cf4c8b110a5fac8b2
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoFilesystemSchemaSourceCache reduce sourceIdToFile(...) visibility 19/36919/4
Ryan Goulding [Wed, 30 Mar 2016 20:47:47 +0000 (16:47 -0400)]
FilesystemSchemaSourceCache reduce sourceIdToFile(...) visibility

Change sourceIdToFile(...) scope to default.  public is not needed, as nothing
calls this function from outside the package.  I pulled autorelease, and
confirmed that no other projects call this function.  Some tests within the
package test this method explicitly, and there is no easy way to decrase
visibility to private.  The @Beta annotation was removed as this API is no
longer advertised publically.

Change-Id: Iacb41bea5eef7477b279f21b0fe2a103dcce3e4b
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoFilesystemSchemaSourceCache to use try-with-resources to ensure stream is closed 30/36930/2
Ryan Goulding [Thu, 31 Mar 2016 04:25:00 +0000 (00:25 -0400)]
FilesystemSchemaSourceCache to use try-with-resources to ensure stream is closed

Use try-with-resources to ensure the stream is closed, avoiding leaks.

Change-Id: I367da3e7e0950cb9c5aa7fad3518bc7079dca1fc
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoStandardize codec serialization to use java.util.Objects.toString(...) 20/36920/2
Ryan Goulding [Wed, 30 Mar 2016 21:30:06 +0000 (17:30 -0400)]
Standardize codec serialization to use java.util.Objects.toString(...)

Standardize serialization calls where appropriate to use
java.util.Objects.toString(object, "") instead of custom ternary expression
for each implementation.

Change-Id: I1f809b96b35d072fa47cd4a8dfb65f411c843e81
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoImprove Error Reporting for non-parsable date for file in schema cache 34/36934/2
Ryan Goulding [Thu, 31 Mar 2016 05:04:38 +0000 (01:04 -0400)]
Improve Error Reporting for non-parsable date for file in schema cache

Add the filename to info message to allow debugging of specific file that
didn't include expected date format.

Change-Id: I548c6bc59ee98fcef964ff96a08d732d3c65de5e
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoBug5531: Can't get complete YIN schema on Windows 44/36944/1
Ivan Hrasko [Thu, 31 Mar 2016 10:46:23 +0000 (12:46 +0200)]
Bug5531: Can't get complete YIN schema on Windows

Added unit test trying to write small module to YIN. If result is not
empty and module is complete then test is sucessfull.

Change-Id: I8b0b0c0c0f787c9a6402dd8b4c74173b89a1b8c5
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
8 years agoAdd test scope for junit 21/36221/3
Thanh Ha [Mon, 14 Mar 2016 21:42:59 +0000 (17:42 -0400)]
Add test scope for junit

Change-Id: I35fbf975623e84f44c9477f226a31e9fda2bc780
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 5531: Can't get complete YIN schema on Windows 04/36804/3
Ivan Hrasko [Tue, 29 Mar 2016 14:26:06 +0000 (16:26 +0200)]
Bug 5531: Can't get complete YIN schema on Windows

Solved by flushing xml writer when module is completely written to YIN.

Change-Id: I7161ddf602602815eedcb0857af745e33c2ed16d
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
8 years agoBUG-4268: clarify length constraint API contract 84/29884/5
Robert Varga [Wed, 18 Nov 2015 19:37:01 +0000 (20:37 +0100)]
BUG-4268: clarify length constraint API contract

The contract did not specify whether the returned constraints are
declared or effective. The intent is to return effective constraints,
which include any constraints imposed by base types -- as is the case
with range constraints.

Change-Id: I0d0582edf87c0a78db3e8664655f139f827217a7
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4268: clarify API contract of range constraints 83/29883/5
Robert Varga [Wed, 18 Nov 2015 19:42:27 +0000 (20:42 +0100)]
BUG-4268: clarify API contract of range constraints

The API definition is not clear whether the constraints show the
declared or effective view of range constraints.

Implementations have been returning the effective view, e.g. including
ranges from base types, which is the API intent. Clarify the API.

Change-Id: I6edecae04b9cba3b1452584b7cf7645dfcc5e57b
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 5396: Regex processing of yang models is broken. 87/36587/2
Peter Kajsa [Tue, 22 Mar 2016 17:39:20 +0000 (18:39 +0100)]
Bug 5396: Regex processing of yang models is broken.

Yang statement parser should not replace type statement context by potentional
type statement context from the Map of context's substatements.

Change-Id: I9fa90f53bf8d7f9ebb269628abadeab1bf4c03b5
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 5567 NPE - invoking of equals on nullable element 95/36495/2
Martin Sunal [Mon, 21 Mar 2016 13:12:21 +0000 (14:12 +0100)]
Bug 5567 NPE - invoking of equals on nullable element

Change-Id: I51b757b0bf03f3f2cf5862e3624936f961cd5d87
Signed-off-by: Martin Sunal <msunal@cisco.com>
8 years agoBUG-5504: use Object.toString() without overrides in precondition 88/36288/2
Robert Varga [Wed, 16 Mar 2016 12:57:17 +0000 (13:57 +0100)]
BUG-5504: use Object.toString() without overrides in precondition

The precondition check could end up using a lot of memory due to dump of the
data tree. Implement a simpler version and use that in the message.

Change-Id: I494cb92c7f4691d235e8ffac6f79c696e4ea0f48
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 5550 - Omit the check of mandatory nodes in uses-augment 23/36423/1
Peter Kajsa [Fri, 18 Mar 2016 07:26:04 +0000 (08:26 +0100)]
Bug 5550 - Omit the check of mandatory nodes in uses-augment

Yang statement parser should omit check of mandatory nodes in uses-augment.

Change-Id: If6d02bf7013717dbe039b214cae69bf177aa073b
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoUse String concatenation instead of StringBuffer/Builder 18/35918/2
Stephen Kitt [Tue, 8 Mar 2016 10:09:29 +0000 (11:09 +0100)]
Use String concatenation instead of StringBuffer/Builder

... and avoid mixing append() and concatenation.

Change-Id: I1860cb191804413c00fa560abdccaa6f2979c70e
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoRemove unnecessary String() constructor invocations 90/35890/4
Stephen Kitt [Mon, 7 Mar 2016 17:38:26 +0000 (18:38 +0100)]
Remove unnecessary String() constructor invocations

Document legimitate uses, and clean up the containing test classes
(which mostly involves disabling IntelliJ's warnings about invalid
uses of equals()).

Clean up a few only-null variables and a couple of other small
issues.

Change-Id: I7a6177b266589c15b9b169a99a9f2a9054da94ed
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoBug 3324: Yangtools documentation 50/34550/4
Igor Foltin [Thu, 25 Feb 2016 15:44:24 +0000 (16:44 +0100)]
Bug 3324: Yangtools documentation

Added documentation for the following topic - Working with YANG Model.

Added documentation for the following topic - Working with YANG Data.

Change-Id: Ib07d9a5b2ac2ec96313875481065bcdff695e7e3
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoBug 5481: When condition of augment added in constraints of augment target 58/36058/2
Peter Kajsa [Wed, 9 Mar 2016 17:22:46 +0000 (18:22 +0100)]
Bug 5481: When condition of augment added in constraints of augment target

The patch excludes When, Status, Description and Reference statements
from copying of top augment's nodes.

Change-Id: I72bf65aba09e43799ac619cd4de9ed03230ad071
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoRemove explicit throws of SourceException 72/35872/3
Robert Varga [Mon, 7 Mar 2016 12:46:17 +0000 (13:46 +0100)]
Remove explicit throws of SourceException

SourceException is a RuntimeException, no need to declared it as thrown
(and Sonar is touchy about it).

Change-Id: Ic27e4bda3642f8e7a3fa8c8ab95a32c05dcc00e6
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoAvoid re-throwing exceptions directly 85/35885/3
Stephen Kitt [Mon, 7 Mar 2016 16:26:04 +0000 (17:26 +0100)]
Avoid re-throwing exceptions directly

Change-Id: Ib6ed75dbe762c5465beca0fead6a18455cebe2e1
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoDrop duplicate Maven dependencies 84/35884/3
Stephen Kitt [Mon, 7 Mar 2016 16:25:41 +0000 (17:25 +0100)]
Drop duplicate Maven dependencies

Change-Id: Ie77dd8612e50a7bbdab245d71d73446bc93f21a8
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoSimplify boolean expressions 83/35883/3
Stephen Kitt [Mon, 7 Mar 2016 16:23:18 +0000 (17:23 +0100)]
Simplify boolean expressions

* Avoid comparing explicitly with true or false.
* Merge simple conditional return statements.
* Avoid ? true : false.
* Use assertFalse() instead of negating assertTrue().

Change-Id: I6f037da92850bb67710c031fd321f51ca6f3b351
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoBug 5335: augmenting a mandatory node on a presence container 80/35880/5
Peter Kajsa [Thu, 3 Mar 2016 13:46:34 +0000 (14:46 +0100)]
Bug 5335: augmenting a mandatory node on a presence container

Yang parser didn't perform cross module augmentation of mandatory
node on a presence container which belongs to the same module.
RFC6020 section 3.1 considers a presence container as not mandatory
node, therefore such augmentation should be allowed.

Change-Id: I61f45519db3536ab377fdf2987b083806a3aa51e
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoRemove redundant modifiers 82/35882/2
Stephen Kitt [Mon, 7 Mar 2016 16:19:17 +0000 (17:19 +0100)]
Remove redundant modifiers

* Use <?> instead of <? extends Object>.
* Delete unnecessary semi-colons.
* Drop public static from interface members (they're the default).
* Drop final from static methods (it's the default).
* Drop private from enum constructors (it's the default).
* Collapse common exception handlers.
* Clean up obsolete imports.

Change-Id: I8f7f74a126f558cba0a99fd0b7376cfdbccc4390
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoUse Collections.singletonList() instead of Arrays.asList() 86/35886/2
Stephen Kitt [Mon, 7 Mar 2016 16:29:52 +0000 (17:29 +0100)]
Use Collections.singletonList() instead of Arrays.asList()

... for calls with single parameters.

Change-Id: I9481dde463898f4d49061ed99670e42bf7e9aa25
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoFix TrieMap tests a bit 34/35834/2
Robert Varga [Fri, 4 Mar 2016 21:49:53 +0000 (22:49 +0100)]
Fix TrieMap tests a bit

Assert that the read-only map is isolated from write map. Also do not
use guava where not needed.

Change-Id: I91b16a47125156bf12d27f730c373dfc94060de9
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoReduce cyclomatic complexity 68/35868/1
Robert Varga [Mon, 7 Mar 2016 10:44:10 +0000 (11:44 +0100)]
Reduce cyclomatic complexity

Reduces number of branches in methods.

Change-Id: I79e2b453dd82d0baf1ac3b8c75dea31c7fca4523
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 5437: Issue accessing mounted device supporting OpenConfig BGP. 76/35576/1
Peter Kajsa [Tue, 1 Mar 2016 09:52:16 +0000 (10:52 +0100)]
Bug 5437: Issue accessing mounted device supporting OpenConfig BGP.

Yangtools evaluated a relative path of leafref in the incorrect context.
Relative path of leafref should be evaluated in the final context of leafref node.

Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Change-Id: I24821d1b12d4456058e0ec1049542972fe29b903

8 years agoRename yang test files to match module names 09/35309/5
Andrej Mak [Wed, 24 Feb 2016 06:29:19 +0000 (07:29 +0100)]
Rename yang test files to match module names

Change-Id: I1108fd2b3c66b068c1f22b4bab65e2a3f8f8d3d9
Signed-off-by: Andrej Mak <andmak@cisco.com>
8 years agoBug 3899: Milestone Increase test coverage for YangTools - builder 08/34908/4
Filip Gregor [Wed, 17 Feb 2016 13:51:43 +0000 (14:51 +0100)]
Bug 3899: Milestone Increase test coverage for YangTools - builder

added tests for more builders

Change-Id: I127bcef2c24608321edc9dabd74451baf5e7b151
Signed-off-by: Filip Gregor <fgregor@cisco.com>
8 years agoBug 3899: Milestone Increase test coverage for YangTools - Path 76/34676/11
Filip Gregor [Mon, 15 Feb 2016 13:48:14 +0000 (14:48 +0100)]
Bug 3899: Milestone Increase test coverage for YangTools - Path

added tests for pathargument, yang-common

Change-Id: I84b6b3f8e9b495b49241d983168846314569aa02
Signed-off-by: Filip Gregor <fgregor@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 78/34478/14
Jakub Toth [Thu, 11 Feb 2016 16:30:26 +0000 (17:30 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

UtilTest

Change-Id: I4e1580214ea23f2e9121c9e57866db18c90eae55
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoMove SchemaOrderedNormalizedNodeWriter to yangtools 84/34884/4
Andrej Mak [Thu, 18 Feb 2016 10:01:31 +0000 (11:01 +0100)]
Move SchemaOrderedNormalizedNodeWriter to yangtools

Move SchemaOrderedNormalizedNodeWriter from netconf to yangtools
and refactor to reuse existing code.

Change-Id: Icdd7a1a2b43fd8e8ab0312b770d954b73939ff69
Signed-off-by: Andrej Mak <andmak@cisco.com>
8 years agoSwitch to odlparent-lite 09/35109/3
Robert Varga [Fri, 19 Feb 2016 16:01:45 +0000 (17:01 +0100)]
Switch to odlparent-lite

The aggregator should not be inheriting from the full parent, just lite.

Change-Id: I9b449d48b28b170040f1f14bace8edab8a5e9fb4
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove JDK 8 doclint override 08/35108/3
Robert Varga [Fri, 19 Feb 2016 16:00:01 +0000 (17:00 +0100)]
Remove JDK 8 doclint override

This should not be present here.

Change-Id: I16d43381b38ac1499a8bfdf47f2490399ba51434
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools - declared statements 73/34773/2
Igor Foltin [Tue, 16 Feb 2016 19:05:53 +0000 (20:05 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools - declared statements

Added unit tests for several declared yang statements.

Change-Id: Ic23a7ef0572ccae1931eee2640a50ddc26ef2475
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 57/34657/4
Jakub Toth [Mon, 15 Feb 2016 07:49:17 +0000 (08:49 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

YangToSourcesMojoTest

Change-Id: I3e22b99eec2e8ec974241ea9bcc0a800045529a2
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 38/34538/5
Jakub Toth [Fri, 12 Feb 2016 09:50:51 +0000 (10:50 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

YangSourceInZipFileTest

Change-Id: I04d37c5190ace6f40fe0933911e7d761b7e5157c
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoEliminate SourceException throws declarations 75/34775/2
Robert Varga [Tue, 16 Feb 2016 19:13:07 +0000 (20:13 +0100)]
Eliminate SourceException throws declarations

SourceException is a RuntimeException, no need to declare it, fixing
Sonar warnings.

Change-Id: I1a96ecd098cfcd489a17a2307a27256bce2754fc
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoUse String.indexOf(char) instead of String 74/34774/2
Robert Varga [Tue, 16 Feb 2016 19:15:45 +0000 (20:15 +0100)]
Use String.indexOf(char) instead of String

Fixes sonar warnings and improves performance just bit.

Change-Id: I5b8ce70077af7ba5e13a74e9bdd00aca8822dcc2
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoRemove an unneeded null check 37/34637/3
Robert Varga [Sun, 14 Feb 2016 22:29:41 +0000 (23:29 +0100)]
Remove an unneeded null check

instanceof performs a null check, hence we do not have to do it
ourselves. Saves a branch.

Change-Id: Icb4e29c5adb94a1c971fa8019064324ef1cadbf2
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 51/34551/7
Jakub Toth [Fri, 12 Feb 2016 11:59:51 +0000 (12:59 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

YangToSourcesProcessorTest

Change-Id: Ia82b733cad2308524da0e1ded9b5a9ef3b03571f
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 40/34540/3
Jakub Toth [Fri, 12 Feb 2016 10:31:31 +0000 (11:31 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

YangSourceFromFileTest

Change-Id: I6f0330bc6411c46e5dac9677a44952d648e0bd70
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 43/34443/3
Jakub Toth [Thu, 11 Feb 2016 09:04:51 +0000 (10:04 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

FilesystemSchemaSourceCacheTest

Change-Id: I2f9276ce1cb3e3742115819192b28abcef95eb17
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 12/34412/8
Jakub Toth [Tue, 9 Feb 2016 15:19:01 +0000 (16:19 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

SchemaSourceTransformerTest

Change-Id: I12892be51e74a37faaa7cc513385229f208018e6
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone Increase test coverage for YangTools - Types 71/34471/9
Filip Gregor [Thu, 11 Feb 2016 11:48:18 +0000 (12:48 +0100)]
Bug 3899: Milestone Increase test coverage for YangTools - Types

tests for types

Change-Id: Ifd2ba78eb2c1bb915c3f172d51d6f4c42421278c
Signed-off-by: Filip Gregor <fgregor@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 53/34453/3
Jakub Toth [Thu, 11 Feb 2016 10:00:33 +0000 (11:00 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

InMemorySchemaSourceCacheTest

Change-Id: I883e053884c514c0c9ac343e1d6485bc9424e7ac
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone Increase test coverage for YangTools 56/33856/19
Filip Gregor [Mon, 1 Feb 2016 15:25:12 +0000 (16:25 +0100)]
Bug 3899: Milestone Increase test coverage for YangTools

Tests for Dom serializer, builders

Change-Id: Id60b0f8572a64e01a8a0ff3b7792a0e38cbdce65
Signed-off-by: Filip Gregor <fgregor@cisco.com>
8 years agoDo not use String.split() 70/34570/2
Robert Varga [Fri, 12 Feb 2016 17:31:50 +0000 (18:31 +0100)]
Do not use String.split()

Instead of straight array split, use a Splitter and split to list.

Change-Id: If40131a97be64b1bc92e723d5e257e520aea32b4
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agofeatures-test is no longer published from yangtools 67/34567/2
Robert Varga [Fri, 12 Feb 2016 15:15:02 +0000 (16:15 +0100)]
features-test is no longer published from yangtools

It got moved to odlparent, reflect this fact.

Change-Id: I3db53f520a12617e9cc6894fbc7b8e96bac76a3f
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoNoddeWithValue is generic 57/34557/3
Robert Varga [Fri, 12 Feb 2016 13:12:20 +0000 (14:12 +0100)]
NoddeWithValue is generic

This fixes warnings with use of the raw type. Also cleans up references
to YangInstanceIdentifier inner classes.

Change-Id: If2f88f14e14c9b0b858187ba99a491af485e19d2
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 06/34406/2
Igor Foltin [Wed, 10 Feb 2016 15:24:51 +0000 (16:24 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

Added unit test for DomToNormalizedNodeParserFactory.

Added unit test for declared anyxml statement.
More tests for declared yang statements will be added in the future.

Change-Id: If98d5fe6a4ac634c9060d2bbe186e0cb90482a35
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 72/34172/11
Jakub Toth [Fri, 5 Feb 2016 16:02:14 +0000 (17:02 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

test XmlDocumentUtilsTest

Change-Id: I8d4958b048e1bf392182b409d4998429712781b6
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 68/34268/7
Jakub Toth [Mon, 8 Feb 2016 15:08:11 +0000 (16:08 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

test InstanceIdentifierForXmlCodecTest

Change-Id: I3dc7f58309ae900825a10d5ea0a878cf037c24e5
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 4079: Unable to compile pattern defined in module 84/34384/1
Igor Foltin [Wed, 10 Feb 2016 11:09:12 +0000 (12:09 +0100)]
Bug 4079: Unable to compile pattern defined in module
          when using Unicode blocks

The original patch for this bug fixed the problem
only in the old yang parser.

This patch fixes the issue in the new yang parser.

Change-Id: I07c7ad8d00ab0f8f39888afd1468054e74574cb4
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 24/34324/3
Jakub Toth [Tue, 9 Feb 2016 13:51:34 +0000 (14:51 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

test RefcountedRegistrationTest

Change-Id: Ie3053de3422ec5ffe4bb8ae7e7bf23b147ac4a4d
Signed-off-by: Jakub Toth <jatoth@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 12/34312/2
Igor Foltin [Tue, 9 Feb 2016 10:52:34 +0000 (11:52 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

Added unit test for StringPatternCheckingCodec.

Change-Id: I95883efa82d0e987fa0b5b6e507513e105aca267
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoBUG-2646: downgrade warnings to debug 26/34126/2
Robert Varga [Fri, 5 Feb 2016 08:51:04 +0000 (09:51 +0100)]
BUG-2646: downgrade warnings to debug

Stop flooding logs with warnings until we find an acceptable solution
for adding augmentations and refines to unknown extensions.

Change-Id: I74a942347690cecc94c4022d7c0a1e397a042d5a
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3899: Milestone: Increase test coverage for Yangtools 51/34151/2
Igor Foltin [Fri, 5 Feb 2016 12:58:34 +0000 (13:58 +0100)]
Bug 3899: Milestone: Increase test coverage for Yangtools

Added unit tests for data tree operations with ordered list

Change-Id: I82314d98fbb04ad336de9e7a15a433ab78454180
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoEnable site generation for yangtools 11/27711/13
Thanh Ha [Wed, 30 Sep 2015 22:20:11 +0000 (18:20 -0400)]
Enable site generation for yangtools

See:
https://nexus.opendaylight.org/content/sites/site/org.opendaylight.releng.builder/master/maven-site.html

Change-Id: I280ca59132c90326f43615f9eb5d5ea601a423ae
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoFix javadoc formatting issues 40/34040/1
Thanh Ha [Thu, 4 Feb 2016 02:30:26 +0000 (21:30 -0500)]
Fix javadoc formatting issues

- Fix javadoc '<' and '>' to &lt; and &gt; escape characters
- Add missing @throws

Change-Id: Idcbc8217f931de655e38687df6a89cc94b346cb2
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBUG-4662: introduce the SemVer concept 55/32455/4
Robert Varga [Wed, 13 Jan 2016 00:12:15 +0000 (01:12 +0100)]
BUG-4662: introduce the SemVer concept

This is a very simple DTO concept for semantic versions.

Change-Id: I752f36198b03c37ef4116088baf1938248a01fd2
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoFix compatibility with Java 8 type inference 90/33890/1
Robert Varga [Tue, 2 Feb 2016 12:24:11 +0000 (13:24 +0100)]
Fix compatibility with Java 8 type inference

Add a raw cast to side-step inference rules being more strict.

Change-Id: I855a687cc2d7141383c6aff57dba6adf0a5eef91
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoopendalight -> opendaylight 57/29657/3
Stephen Kitt [Fri, 13 Nov 2015 15:29:52 +0000 (16:29 +0100)]
opendalight -> opendaylight

and delete a couple of commented lines of code.

Change-Id: Ia27a2e9f049876da04894896f7befff00bf44279
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoBug 4969: Unable to find base type of leafref for old yang parser types. 51/33851/1
Peter Kajsa [Mon, 1 Feb 2016 13:00:10 +0000 (14:00 +0100)]
Bug 4969: Unable to find base type of leafref for old yang parser types.

Added backward compatibility with old yang parser into
the method SchemaContextUtil.findParentModuleOfReferencingType.

Change-Id: I3e49296cb8beb45c67cda99986bffa7a8ba1a022
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 4969: Invalid regex pattern for xpath conditions stripping. 80/33780/3
Peter Kajsa [Fri, 29 Jan 2016 13:56:10 +0000 (14:56 +0100)]
Bug 4969: Invalid regex pattern for xpath conditions stripping.

Original regex pattern performed greedy match.
The fix excludes square brackets inside a match.

Change-Id: I3a95a041ab87f6d9d7d4c1e1bcf70095ece24fff
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoyang.data.impl.schema.tree clean-up 89/33489/3
Stephen Kitt [Mon, 25 Jan 2016 16:32:41 +0000 (17:32 +0100)]
yang.data.impl.schema.tree clean-up

* Propagate @Nonnull and @Nullable declarations.
* Suppress unused warnings for AbstractCursor's closed field.
* Remove redundant generic type declarations.
* In AbstractDataTreeCandidateNode, make sure that either newData or
  oldData is not null (or both).
* Remove CaseEnforcer::enforceOnTreeNode() which is unused.
* Remove unnecessary semi-colons in MandatoryLeafEnforcer.
* Remove MinMaxElementsValidation::checkOriginalPresent() which is
  unused.
* SchemaAwareApplyOperation::checkConflicting indicates its result
  using an exception, so drop the return value which is always true
  (this method isn't used anywhere else in Boron).
* SchemaAwareApplyOperation::checkNotConflicting is static, so its
  final modifier is redundant.

Change-Id: I7f1ebe53753edd0b0ec5c333ac0cc2850c959f15
Signed-off-by: Stephen Kitt <skitt@redhat.com>
8 years agoBug 5101: Status deprecated must not be propagated via uses statement 75/33775/2
Peter Kajsa [Fri, 29 Jan 2016 12:35:40 +0000 (13:35 +0100)]
Bug 5101: Status deprecated must not be propagated via uses statement

Status of grouping statement is not propagated via uses statement.

Change-Id: I2c2bf9d9222ea1be78b440c5c52ea675dcaeb89d
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 4969: NPE in JSONCodecFactory by attempt to find codec for a leafref 54/33354/4
Peter Kajsa [Fri, 22 Jan 2016 10:39:37 +0000 (11:39 +0100)]
Bug 4969: NPE in JSONCodecFactory by attempt to find codec for a leafref

Attempt to find codec for a leafref results in NPE in JSONCodecFactory, because
SchemaContextUtils cannot find baseType of derived leafref type.

Change-Id: If5288210b4f4d200b18063cf58fdf873b1d12be1
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 5059: Do not fail when 'refine' targets an extension. 31/33631/2
Peter Kajsa [Tue, 26 Jan 2016 14:13:23 +0000 (15:13 +0100)]
Bug 5059: Do not fail when 'refine' targets an extension.

Yang parser does not fail when 'refine' targets an extension, but
the parser logs a warning and the refine statement is ignored.

Change-Id: I9a4ad46ac254c36b64b44903162361c1e14f4e71
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 5019: Add QName param to NormalizedNodeWriter#leafSetEntryNode 22/33222/4
Tom Pantelis [Thu, 21 Jan 2016 15:35:29 +0000 (10:35 -0500)]
Bug 5019: Add QName param to NormalizedNodeWriter#leafSetEntryNode

NormalizedNodeWriter allows us to emit a single LeafSetEntryNode, which
breaks assumptions in NormalizedNodeStreamWriter -- specifically that
the receiver has seen its parent LeafsetNode.

In this case this is not true, so we need to supply the QName to pass
down the identity of the entry.

Change-Id: I45187800c62ec36b276724d230a922634c556a9b
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix compilation failure with Java 8 target 08/33608/1
Robert Varga [Wed, 27 Jan 2016 09:47:35 +0000 (10:47 +0100)]
Fix compilation failure with Java 8 target

Java 8 is more strict about generic inference, hence it does not allow
to play shenanigans.

Change-Id: I84d80e2910099dec98c8106540e1b349f47f41c2
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove YinSchemaSource 51/32851/6
Robert Varga [Fri, 15 Jan 2016 20:53:29 +0000 (21:53 +0100)]
Remove YinSchemaSource

This interface has been superseded, remove it.

Change-Id: If05eba38827746f9d98007b497c744c59e56fed2
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoRemove of/copyOf factory methods 52/32852/5
Robert Varga [Fri, 15 Jan 2016 20:56:12 +0000 (21:56 +0100)]
Remove of/copyOf factory methods

These have been deprecated in favor of their ordered/unordered
counterparts, remove them.

Change-Id: Ide5ecfb1141b03597f72757fc91d56715d18c308
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoSimplify RevisionAwareXPathImpl 22/32022/2
Robert Varga [Sat, 2 Jan 2016 15:41:36 +0000 (16:41 +0100)]
Simplify RevisionAwareXPathImpl

Java 8 has a Boolean.hashCode(), which supplies the functionality which
we have open-coded. Reuse implementation to reduce overhead.

Change-Id: I2d0424ec354816bcac470e385f4507de3a1f6054
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4295: fix merge callsite 77/33477/4
Robert Varga [Mon, 25 Jan 2016 09:58:55 +0000 (10:58 +0100)]
BUG-4295: fix merge callsite

This is a fixup of the previous patch. The problem was expanding a merge
into a new node, which used a direct value propagation with a merge.
That is not correct, as the merge should be pushed via
ModificationApplyOperation, which in case of unkeyed lists will turn it
into a write.

Change-Id: I93c8be80e4467b5d3a1e20f26f5576bd701b1375
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4684: validate changes against effective state 66/30266/11
Robert Varga [Tue, 19 Jan 2016 20:50:35 +0000 (21:50 +0100)]
BUG-4684: validate changes against effective state

In order to deal with merges, we would have to concoct a very fragile
machinery, which would perform the equivalent of apply(), except it
would not produce merged data.

Instead of that let us pass down version, which is all we need to run
the apply operation. Once applied, we will have a preliminary result of
apply, which we can reuse under some circumstances -- which is if the
observed current metadata node does not change and if the SchemaContext
(and hence the associated SchemaAwareApplyOperation object) does not
change.

If either does, we re-calculate the result -- but that may not be
accurate at this point.

Change-Id: I145969e47136b324c07868bd00ded0764ef634f4
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Signed-off-by: Filip.Gregor <fgregor@cisco.com>
8 years agoAdd leaf context when value deserialization fails 78/33378/2
Robert Varga [Fri, 22 Jan 2016 17:56:06 +0000 (18:56 +0100)]
Add leaf context when value deserialization fails

When the codecs throw an IllegalArgumentException, it is useful to know
which leaf has failed to parse. Catch the exception and chain it to an
exception which gives more context.

Change-Id: I6466b5d86294a1f0116477081267a80c0a696bfb
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4295: handle merge into unkeyed list 63/33463/3
Robert Varga [Mon, 25 Jan 2016 09:58:55 +0000 (10:58 +0100)]
BUG-4295: handle merge into unkeyed list

A merge into an unkeyed list equals to a write.

Change-Id: Iaded1cab2bdf38ee9595ebfe579dbb566b2beae4
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove deprecated concepts 53/32853/5
Robert Varga [Fri, 15 Jan 2016 20:57:57 +0000 (21:57 +0100)]
Remove deprecated concepts

These concepts are unused, remove them.

Change-Id: I3501427445c7a30bbc6ce78c904545be9cacef23
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBump yangtools to 1.0.0-SNAPSHOT 54/32854/2
Robert Varga [Fri, 15 Jan 2016 20:59:58 +0000 (21:59 +0100)]
Bump yangtools to 1.0.0-SNAPSHOT

As per Boron versioning plan, yangtools should be 1.0.0-SNAPSHOT.

Change-Id: I128fcc0647066eda3e27ab49abf853c6a71107fc
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4295: Fixed incorrectly introduced nodes when MERGE was followed by DELETE 18/33118/2
Tony Tkacik [Wed, 20 Jan 2016 17:20:32 +0000 (18:20 +0100)]
Bug 4295: Fixed incorrectly introduced nodes when MERGE was followed by DELETE

ModificationNode lost state in situations when
parent node was MERGE which indroduced child nodes
and child node was deleted. That resulted into recording NONE,
which during apply of MERGE was expanded back to original MERGE
which caused reintroduction of deleted node.

Change-Id: Ia2085f5475b49957ef8ac7ab6c629ca3eef803f2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoFix yang-maven-plugin generating superfluous files 81/33081/1
Robert Varga [Wed, 20 Jan 2016 12:32:42 +0000 (13:32 +0100)]
Fix yang-maven-plugin generating superfluous files

Logic detecting whether a file belongs to the current project has been
broken in change I75c8b67af01212a8ac5b832625f9405bb0108455. It works
most of the time with 'mvn clean install', but fails if there is a
generate-sources phase before dependency projects are
packaged/installed. This typically happens when invoked from IDE such as
Eclipse.

Perform correct checks to see if a particular file was injected from
current project.

The correct fix is to use SchemaContextResolver, where we inject local
files, capture their SchemaSourceIdentifiers, then inject any
dependencies. That way we can perform the lookup based on
ModuleIdentifiers and not rely on the particulars what form was used to
get the source.

Change-Id: I2392dc05bfbc94d613ec896d38fac21734a5bc81
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4295: instantiate MERGE operations lazily 53/26853/40
Peter Kajsa [Tue, 5 Jan 2016 09:14:00 +0000 (10:14 +0100)]
BUG-4295: instantiate MERGE operations lazily

This patch reworks how merges are done in a DataTreeModification by
moving the logic to SchemaAwareApplyOperation, which is the final
recipient of the resulting ModifiedNode.

This way the code is co-located and can be specialized based on
information available for that particular node, and the container merge
code is cleanly separated from the leaf node code, which turns each
merge into a write.

When a merge occurs on a previously-written node, we graft all merged
children onto the write, using recursion only when necessary.

checkPresentChild method renamed.
Fix of ModifiedNode and added unit test.

Change-Id: I674e3d2150e796472e831abdcfa0fad582b69759
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Filip.Gregor <fgregor@cisco.com>
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoInclude identityref leaves in interner 32/33032/2
Robert Varga [Tue, 19 Jan 2016 20:03:20 +0000 (21:03 +0100)]
Include identityref leaves in interner

Identitrefs, while being extensible, have an upper bound on possible
values. Intern them just as we do enums.

Change-Id: I86a0411cfcce6a83616fe04e20bd97921c80bb21
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoAdd a bit of documentation in AbstractReadyIterator 41/33041/1
Robert Varga [Tue, 19 Jan 2016 21:21:31 +0000 (22:21 +0100)]
Add a bit of documentation in AbstractReadyIterator

Some of the comments have been lost. This class implements a depth-first
tree iterator, which does not use stack for keeping state, hence its
code flow should be better commented.

Change-Id: I604b0cef6f402c0e10403a7c29d272939ba2e8bd
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoIntroduce formatting methods for SourceException 11/32111/14
Robert Varga [Mon, 4 Jan 2016 23:46:14 +0000 (00:46 +0100)]
Introduce formatting methods for SourceException

- throwIf() is similar to Preconditions.checkArgument(), but checks the
  inverse condition
- throwIfNull() is similar to Preconditions.checkNotNull()
- new constructors with string formatting
- fix {Invalid,Missing}SubstatementException not having a version

Change-Id: I95d15fb6a591f77b0be17d9ca50f51d3636c80ed
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-865: deprecate recursive node instantiation 61/32861/2
Robert Varga [Sat, 16 Jan 2016 01:05:31 +0000 (02:05 +0100)]
BUG-865: deprecate recursive node instantiation

Recursive create() method forces a full materialization, which is slow
and not memory-efficient. Lazily-instantiated nodes work equally well
using less memory.

Change-Id: I320f375090df480c1b376f543cb0b00649b44234
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4459 - Parser fails when enum contains illegal characters for QName. 93/28393/21
Peter Kajsa [Tue, 13 Oct 2015 15:29:24 +0000 (17:29 +0200)]
Bug 4459 - Parser fails when enum contains illegal characters for QName.

RFC6020 defines enum argument as string, but we need to parse QName from it
due to binding part of yangtools. However, parsing of the enum containing
illegal characters for QName causes IllegalArgumentException.

Change-Id: Iccd5523e12ca9bdfa44efd0fab09ef764990b837
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 4540: Yang parser exceptions should follow consistent path 78/31078/16
Igor Foltin [Wed, 9 Dec 2015 14:27:20 +0000 (15:27 +0100)]
Bug 4540: Yang parser exceptions should follow consistent path

Replaced FileInputStream with NamedFileInputStream
in order to provide source path.

Replaced several standard Java exceptions with
yang-parser-impl exceptions where appropriate.

Added StatementSourceReference object into error messages.

Code refactoring based on codestyle rules.

Change-Id: I7e0c80d1d1c4644fa8c61a420ba0055ae84d2398
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoAdded support for root in create(TreeType, YangInstanceIdentifier) 69/32269/2
Tony Tkacik [Fri, 8 Jan 2016 10:54:31 +0000 (11:54 +0100)]
Added support for root in create(TreeType, YangInstanceIdentifier)

Change-Id: If31258a2e9d88f94cde835106d12b3b2ca6a12d5
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoVersion bump ietf.topology.version to 9 88/32688/2
Thanh Ha [Fri, 15 Jan 2016 00:48:17 +0000 (19:48 -0500)]
Version bump ietf.topology.version to 9

This was missed in the previous version bump commit.

Change-Id: I7077d20d28f82283eb8a7f801c55ab683cf0d6b6
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBumping versions by 0.1.0 for next dev cycle 86/32686/1
Thanh Ha [Fri, 15 Jan 2016 00:22:55 +0000 (19:22 -0500)]
Bumping versions by 0.1.0 for next dev cycle

Change-Id: If160e96c378f527e83147cfc24f26de3b3c080ba
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 4933: Yang parser does not accept deviate "not-supported" 14/32414/7
Peter Kajsa [Tue, 12 Jan 2016 12:45:30 +0000 (13:45 +0100)]
Bug 4933: Yang parser does not accept deviate "not-supported"

The method parseDeviateFromString does not parse input string
to Deviate enum correctly. This problem occurs when yang keyword
does not match java indentifier of Deviate enum.

Change-Id: I188b9539c804a561b13adac9df247fd57fab8599
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoMake NodeWithValue generic 66/26866/10
Robert Varga [Sat, 22 Aug 2015 09:17:02 +0000 (11:17 +0200)]
Make NodeWithValue generic

Retaining the type of contained value is useful in various places, which
means we don't have to add an explicit cast.

Change-Id: Ibf3b16fd7b3348730f3efb3e284a345e69003e30
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3874: Support of yang modeled AnyXML - JSON deserialization 42/29742/17
Peter Kajsa [Mon, 16 Nov 2015 10:28:29 +0000 (11:28 +0100)]
Bug 3874: Support of yang modeled AnyXML - JSON deserialization

- added support of yang modeled anyXml deserialization from JSON
- basic unit tests

Change-Id: Idd52bfe900a52d5d1b30d2cf25449f606e339d50
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoSimplify Utils.parseStatus() 45/32445/1
Robert Varga [Tue, 12 Jan 2016 21:13:07 +0000 (22:13 +0100)]
Simplify Utils.parseStatus()

No need for a local variable, and use proper log formatting instead of
string concat.

Change-Id: Id5fd1dba61cf984a3aa08f4b2b7ee367ff24e307
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 2062 - StreamWriter APIs loses information about leaf-set ordering 58/32258/4
Jan Hajnar [Fri, 7 Aug 2015 12:20:01 +0000 (14:20 +0200)]
Bug 2062 - StreamWriter APIs loses information about leaf-set ordering

* added start methods for OrderedLeafSet
* modified classes that use NormalizedNodeStreamWriter to use
startOrderedLeafSet when needed.

Change-Id: I890a338313229b1600adcf5ac2ef1c8b440a220d
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>