yangtools.git
7 years agoSourceIdentifier.create() method deprecation explained 39/51139/1
Martin Ciglan [Fri, 27 Jan 2017 11:59:41 +0000 (12:59 +0100)]
SourceIdentifier.create() method deprecation explained

    - javadoc
    - imports optimized

Change-Id: I3dfc20fd23a57051784a691875bce0260af39a5e
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
(cherry picked from commit 3c372c27fe31696e35d03361b6476b0ccd035d77)

7 years agoDo not confuse statement and argument names 28/50028/1
Robert Varga [Mon, 26 Dec 2016 18:28:45 +0000 (19:28 +0100)]
Do not confuse statement and argument names

Our extension handling is still flaky, in that it assumes
that implicit extensions take an argument. As we progress
to make these special-cases handled, the confusion is being
flushed out.

This particular error was found when we made argument name
conditional on whether we actually are seeing an argument
being used in the model.

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

7 years agoFix mandatory statement checking 27/50027/1
Robert Varga [Mon, 26 Dec 2016 16:34:10 +0000 (17:34 +0100)]
Fix mandatory statement checking

This fixes a mismatch between the comment and what the method
actually does. For some reason we ended up iterating over the same
collection twice.

Furthermore use .forEach() with a self-referencing lambda instead
of Iterables.concat(), as that can be optimized by the implementation.

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

7 years agoBug 7440: Fix empty parent in deviate "replace" 22/49822/4
Igor Foltin [Fri, 23 Dec 2016 13:29:40 +0000 (14:29 +0100)]
Bug 7440: Fix empty parent in deviate "replace"

Restricted type statement within deviate "replace" statement
now has its SchemaPath properly initialized.

Change-Id: If8a9c6add61ccdda8210f19e5626c925c3c5785e
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
(cherry picked from commit 5797c4f23342d364261e025ac9b1e8b15d197912)

7 years agoBUG-7267: catch RuntimeExceptions when processing sources 33/49433/3
Robert Varga [Wed, 14 Dec 2016 13:30:40 +0000 (14:30 +0100)]
BUG-7267: catch RuntimeExceptions when processing sources

This adds wrapping of all RuntimeExceptions when building
EffectiveSchemaContext. This will allow users to identify
the offending source.

Since raw RuntimeExceptions should not be happening, but
rather should be specialized to SourceException and its
subclasses, also emit a warning guiding users to file
issues to fix codepaths which do not do so.

Also fixes up some instances where we use checkArgument()
and we ca actually use SourceException.throwIf().

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

7 years agoBUG-7038: cleanup parser listener 37/49437/2
Robert Varga [Thu, 27 Oct 2016 21:17:28 +0000 (23:17 +0200)]
BUG-7038: cleanup parser listener

Rework the logic so we throw a SourceException as soon
as possible.

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

7 years agoBUG-7161: Do not tolerate source-level exceptions 36/49436/2
Robert Varga [Fri, 11 Nov 2016 17:58:33 +0000 (18:58 +0100)]
BUG-7161: Do not tolerate source-level exceptions

We should not be suppressing malformed exceptions,
as that can result in us not providing correct
interpretation of models.

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

7 years agoBUG-7267: catch null path offenders 43/49143/3
Robert Varga [Thu, 8 Dec 2016 10:54:29 +0000 (11:54 +0100)]
BUG-7267: catch null path offenders

This provides a guard against invoking QName.create()
with a null base, reporting the original path.

Change-Id: Ic6bc661b94b5214336854a0cb20b6e595e7346e8
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBumping versions by 0.0.1 for next dev cycle 74/49574/1
Anil Belur [Tue, 20 Dec 2016 02:36:36 +0000 (12:36 +1000)]
Bumping versions by 0.0.1 for next dev cycle

Change-Id: I5bdb8493f2051204c3e5c3747f8cfabdb4ffa614
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
7 years agoBUG-5968: Mandatory leaf enforcement does not work in some cases 53/48853/2
Robert Varga [Mon, 21 Nov 2016 12:40:33 +0000 (13:40 +0100)]
BUG-5968: Mandatory leaf enforcement does not work in some cases

Re-spin of reverted changes. Instead of performing the check at
seal() time, which forces validation of entire subtrees, perform
the check when the merge operation is actually broken down into
writes.

Change-Id: I70999f138ae36c09468ff04db0755e04bc7341c7
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit c71add8878f29787db7cc898c4982b0da8e92d2d)

7 years agoEliminate use of environment variables 41/48641/2
Robert Varga [Wed, 23 Nov 2016 17:30:12 +0000 (18:30 +0100)]
Eliminate use of environment variables

Change I1edbed691ac1a01c8bfc1c8178d4836781aba0a1
introduced a back-channel to move effective settings
into the IT test. Use that instead of magic properties,
as it is safer.

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

7 years agoFix IT test instantiation 37/48637/1
Robert Varga [Wed, 23 Nov 2016 16:54:39 +0000 (17:54 +0100)]
Fix IT test instantiation

We should be passing maven options for all tests, fix
the two omissions.

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

7 years agoRevert "Bug 5968: Mandatory leaf enforcement does not work in some cases" 28/48528/1
Luis Gomez [Sun, 20 Nov 2016 17:55:22 +0000 (17:55 +0000)]
Revert "Bug 5968: Mandatory leaf enforcement does not work in some cases"

This reverts commit 655c13c48277155b02706b75c88554c4a05ce673
and commit 3e4972b4e8edd7387666808014cd33daddef2cb5.

Change-Id: I9b12e58767ad70cb98a44b0a81560725b1a2afa5
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 8db9e47c66243774ad4291dcbed9012e70f33503)

7 years agoBUG-5717: eliminate StmtContext.substatements() 62/48262/1
Robert Varga [Thu, 10 Nov 2016 12:49:36 +0000 (13:49 +0100)]
BUG-5717: eliminate StmtContext.substatements()

There is a single caller, which really wants to get
the declared belongs-to statement.

Convert the caller and eliminate the method, making
StatementContextBase.substatements a purely-local
collection lending itself to refactoring.

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

7 years agoBUG-6150: add an import statement special-case 58/48258/1
Vratko Polak [Thu, 10 Nov 2016 13:41:15 +0000 (14:41 +0100)]
BUG-6150: add an import statement special-case

This is just a hack to get the bug unblocked, a follow-up
patch is needed to really fix the underlying assumptions
about when a statement should be populated into the map.

Unit tests added.

Change-Id: I80273f1971981d62214e3cabfe687d5fcb61abd3
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
(cherry picked from commit bbce2ddf4f0cfced8ea5ad85d709ce62ffdea41b)

7 years agoBug 5968: Mandatory leaf enforcement does not work in some cases 68/48168/1
Peter Kajsa [Wed, 9 Nov 2016 14:06:59 +0000 (15:06 +0100)]
Bug 5968: Mandatory leaf enforcement does not work in some cases

Fix of possible IllegalStateException.

Change-Id: Ide4d1bf060dc7ff8fc6286d5a1de03f8a6bedbfc
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 3e4972b4e8edd7387666808014cd33daddef2cb5)

7 years agoIntern SchemaContext.NAME 17/48117/1
Robert Varga [Tue, 8 Nov 2016 10:59:56 +0000 (11:59 +0100)]
Intern SchemaContext.NAME

This is a constant, we should be interning it.

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

7 years agoBug 6814: Fix (de)serialization of anyxml in JSON 95/47995/2
Igor Foltin [Tue, 25 Oct 2016 11:10:23 +0000 (13:10 +0200)]
Bug 6814: Fix (de)serialization of anyxml in JSON

JSON parser can now deserialize anyxml nodes.
JSON serializer can now serialize anyxml nodes.

Change-Id: I815afb5aac82618f27cd26d747d6637eb4e962f0
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-7057: introduce UntrustedXML class 28/48028/3
Robert Varga [Fri, 28 Oct 2016 10:21:46 +0000 (12:21 +0200)]
BUG-7057: introduce UntrustedXML class

This adds the basic newDocumentBuilder() and newSAXParser()
methods. The class is expected to grow more methods in future.

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

7 years agoBug 5968: Mandatory leaf enforcement does not work in some cases 80/47980/1
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. This patch provides fix which ensures mandatory node validation
in all cases above.

In addition, full validation on unsealed modification was performed after each MERGE
operation performed on this modification, which may lead to undesirable results,
because unsealed modification does not have to contain all elements, which can be
added during next operations on this modification. This patch fixes this behavior of
MERGE operation and performs full validation during seal() method.

Change-Id: If653eeda5378cf1ed1418123eb33713ee80976d9
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 5ec45595d85f7c42310707ea058dac8a6be62acb)

7 years agoBumping versions by 0.0.1 for next dev cycle 12/47912/1
Anil Belur [Fri, 4 Nov 2016 00:25:34 +0000 (10:25 +1000)]
Bumping versions by 0.0.1 for next dev cycle

Change-Id: I85fd0feb332b2c75ce6df52bfde65bc1d52042c4
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
7 years agoHide BuildGlobalContext methods 41/47441/2
Robert Varga [Sun, 23 Oct 2016 14:35:30 +0000 (16:35 +0200)]
Hide BuildGlobalContext methods

Non-public class, there is no point in having its methods
declared as public.

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

7 years agoBUG-4456: rework leaker integration 98/47498/2
Robert Varga [Mon, 24 Oct 2016 16:27:14 +0000 (18:27 +0200)]
BUG-4456: rework leaker integration

Rather than spreading the use of leaker across three
classes, centralize its use in ExtensionEffectiveStatementImpl
by exposing a protected method which can be overridden.

This is a bit cleaner solution and should end up being more
performant, as other statements do not end up touching
the thread-local variable.

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

7 years agoBUG-6522: do not re-read models 29/47529/2
Robert Varga [Tue, 25 Oct 2016 14:22:29 +0000 (16:22 +0200)]
BUG-6522: do not re-read models

The source text is ignored, so there is no point in reading it.

Deprecate the current method which makes it look like the text
is needed. And eliminate the read.

Change-Id: Ib5550e6e40ecad1c0883a21e39fada8136c5b820
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-6522: grow namespaces lazily 85/47585/3
Robert Varga [Tue, 25 Oct 2016 17:22:39 +0000 (19:22 +0200)]
BUG-6522: grow namespaces lazily

NamespaceStorageSupport is the superclass of StatementContextBase,
hence allocating a default-sized HashMap results in ~75MiB wasted
space. Add lazy expansion to limit the overhead associated with
tracking these.

This patch includes 885bb2cb055b7786b6a44d490499949380750644.

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

7 years agoBUG-6522: Optimize toString() methods 89/47589/3
Robert Varga [Tue, 25 Oct 2016 14:19:48 +0000 (16:19 +0200)]
BUG-6522: Optimize toString() methods

There is no need to use String.format(), just use a simple
string concatenation.

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

7 years agoCleanup SupportedExtensionsMapping 18/47618/3
Robert Varga [Wed, 26 Oct 2016 13:28:54 +0000 (15:28 +0200)]
Cleanup SupportedExtensionsMapping

Align members to make them more readable.

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

7 years agoBUG-6522: streamline QNameToStatementDefinitionMap API 19/47619/3
Robert Varga [Tue, 25 Oct 2016 22:44:19 +0000 (00:44 +0200)]
BUG-6522: streamline QNameToStatementDefinitionMap API

This really is a Map, but let's not as far as declaring
it as such.

Add putAll() and putIfAbsent(), which make life way easier
for SourceSpecificContext -- which is the sole user. The end
result is better performance at least in the bulk case,
as we end up populating one of the maps via addAll().

Also take time to formulate the class in terms of lambas,
as that takes a lot of verbosity out.

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

7 years agoBUG-6964: reuse StatementDefinitionNamespace 17/47617/3
Robert Varga [Mon, 24 Oct 2016 19:04:29 +0000 (21:04 +0200)]
BUG-6964: reuse StatementDefinitionNamespace

Instead of performing two lookups, cache the extension's
statement in the source's maps, so it behaves just like
any other statement.

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

7 years agoBUG-6522: intern cached QNames 06/47606/3
Robert Varga [Tue, 25 Oct 2016 17:37:57 +0000 (19:37 +0200)]
BUG-6522: intern cached QNames

Heap analysis has shown a huge number duplicate QNameModules
being retained through QNames in this map, wasting about 4MB
of memory. Make sure we run QName.intern() before we store
them. The lookup path is still okay.

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

7 years agoBUG-6522: Remove an unneeded branch 94/47594/3
Robert Varga [Tue, 25 Oct 2016 18:06:45 +0000 (20:06 +0200)]
BUG-6522: Remove an unneeded branch

Instead of maintaining a boolean in an else branch,
examine the resulting collection to see if there is
anything left. Simplifies and speeds up the code.

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

7 years agoBUG-7025: make the parser tree immutable 93/47593/3
Robert Varga [Tue, 25 Oct 2016 16:04:37 +0000 (18:04 +0200)]
BUG-7025: make the parser tree immutable

This adds a post-processing phase, which walks the entire tree
and makes sure children are initialized to an ImmutableList.

This is essentially the same operation as running the tree
through org.antlr.v4.runtime.Parser.TrimToSizeListener, except
it also initializes empty lists to immutable collection and
uses a more efficient implementation for singletons.

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

7 years agoBUG-7025: Use ParseTreeWalker.DEFAULT 86/47586/3
Robert Varga [Tue, 25 Oct 2016 14:20:57 +0000 (16:20 +0200)]
BUG-7025: Use ParseTreeWalker.DEFAULT

We do not need to instantiate new walkers, as there
is a utility instance available for reuse.

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

7 years agoBUG-6522: lower map sizing 84/47584/3
Robert Varga [Tue, 25 Oct 2016 17:43:37 +0000 (19:43 +0200)]
BUG-6522: lower map sizing

Useing default-sized HashSet is wasteful, as we typically
have only a single requires/mutates action. This will lower
wastage which was observed to be around 600kB.

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

7 years agoBUG-6522: do not accidentally grow lists 83/47583/3
Robert Varga [Tue, 25 Oct 2016 17:11:40 +0000 (19:11 +0200)]
BUG-6522: do not accidentally grow lists

If we end up with an empty collection being passed in,
do not do any processing so we do not inflate lists
unnecessarily. In profiling this showed to waste as
much as 23MiB of memory.

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

7 years agoBUG-6972: optimize SourceSpecificContext 36/47536/3
Robert Varga [Mon, 24 Oct 2016 17:59:48 +0000 (19:59 +0200)]
BUG-6972: optimize SourceSpecificContext

Statement supports are singletons, do not instantiate
them more than once.

Also make sure we grow importedNamespaces lazily, as there
typically are only a few imports.

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

7 years agoBUG-6522: Improve parser reactor logging 35/47535/3
Robert Varga [Sun, 23 Oct 2016 14:36:23 +0000 (16:36 +0200)]
BUG-6522: Improve parser reactor logging

Add a few logging calls and implement toString() methods
so that the reactor progress can be observed.

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

7 years agoBUG-6522: grow StatementContext collections lazily 34/47534/2
Robert Varga [Fri, 21 Oct 2016 09:56:10 +0000 (11:56 +0200)]
BUG-6522: grow StatementContext collections lazily

A lot of statements do not have any substatements at all,
so grow collections as needed. For listeners also remove
sub-collections when then are no longer needed.

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

7 years agoBUG-6972: refactor copy checking 33/47533/2
Robert Varga [Fri, 21 Oct 2016 15:30:05 +0000 (17:30 +0200)]
BUG-6972: refactor copy checking

Original checking code was hard to read, this refactors
it to be more readable and understandable. It also
splits the two sets of copy operation invokers so they
do not share the same set of rules, as they need to be
different.

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

7 years agoBUG-6972: Remove GroupingUtils.needToCreateNewQName() 12/47412/3
Robert Varga [Fri, 21 Oct 2016 14:45:06 +0000 (16:45 +0200)]
BUG-6972: Remove GroupingUtils.needToCreateNewQName()

This is hard-wired to true and has a single caller,
remove the method and simplify caller.

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

7 years agoBUG-6972: eliminate AugmentUtils 32/47532/2
Robert Varga [Mon, 24 Oct 2016 15:00:31 +0000 (17:00 +0200)]
BUG-6972: eliminate AugmentUtils

The only callsite is AugmentStatementImpl, so move the code there
so it can be optimized, resolving a long-standing FIXME.

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

7 years agoBug 6669: Mandatory nodes cannot be added to node from another module via augment 31/47531/2
Peter Kajsa [Thu, 8 Sep 2016 14:25:48 +0000 (16:25 +0200)]
Bug 6669: Mandatory nodes cannot be added to node from another module via augment

Yang parser allowed to add mandatory nodes to target node from another module
via augmentations in some cases. This patch fixes this according to the rules defined
in RFC6020 (https://tools.ietf.org/html/rfc6020#section-3.1,
https://tools.ietf.org/html/rfc6020#section-7.15).

Change-Id: I699fc3c1014583b85ea47504f9a102d06e0b9011
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 092e3656c2276fb4559b336264339e8fb6f38ae9)

7 years agoBUG-6972: Consolidate copy operations 30/47530/2
Robert Varga [Fri, 21 Oct 2016 15:10:54 +0000 (17:10 +0200)]
BUG-6972: Consolidate copy operations

This patch moves common code into a 'copy statement' utility
method, making sure we have do not leak it.

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

7 years agoBug 6979 - yang.model.util.EffectiveAugmentationSchema is mutable 66/47666/2
Filip Gregor [Tue, 25 Oct 2016 11:10:34 +0000 (13:10 +0200)]
Bug 6979 - yang.model.util.EffectiveAugmentationSchema is mutable

fixed leak of mutable set

Change-Id: Iaa0dac93e3521a9a091feb7ea0c78e9c6b0e20e5
Signed-off-by: Filip Gregor <fgregor@cisco.com>
(cherry picked from commit e16dd0836ee7375d8c710f1ae9247f4d258f4760)

7 years agoBug 6329: Parser fails when target node of uses-augment is an unknown node 04/47404/1
Peter Kajsa [Thu, 22 Sep 2016 11:57:39 +0000 (13:57 +0200)]
Bug 6329: Parser fails when target node of uses-augment is an unknown node

Yang parser fails when target node of uses-augment is an unknown node. It is not
quite clear whether such yang model is valid according to RFC6020 or not, but
yang parser failure causes lots of trouble, because such augment is used widely
in some yang models. So this patch prevents failure of yang parser and rather
introduces a warning and augmentation is not performed, when target node is
an unknown node.

Change-Id: I7f1c5d7b3ef0898ca098466702d7cb1ad7a0f30f
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBUG-6522: create a specialized CopyHistory object 83/47383/2
Robert Varga [Fri, 21 Oct 2016 13:45:43 +0000 (15:45 +0200)]
BUG-6522: create a specialized CopyHistory object

Copy histories have a limited number of operations, hence
mutating implementation can express the set of required operations
more efficiently. Also adds some tests to make sure the class
works correctly.

Change-Id: I0b2fd9fffa8a4bc754a9eff3808648f8f5726243
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-6522: share instances of Config(Effective)Statement 47/47347/1
Robert Varga [Fri, 21 Oct 2016 09:00:15 +0000 (11:00 +0200)]
BUG-6522: share instances of Config(Effective)Statement

Config statement has low cardinality, use specialized classes
for its representation.

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

7 years agoBUG-6522: allocate copyHistory lazily 38/47338/1
Robert Varga [Fri, 21 Oct 2016 09:39:14 +0000 (11:39 +0200)]
BUG-6522: allocate copyHistory lazily

Most of the statements start off with being just originals,
so we can use a shared constant for their copy history
and replace it when it is modified.

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

7 years agoBUG-6522: Adjust collection sizes 28/47328/3
Robert Varga [Fri, 21 Oct 2016 08:38:21 +0000 (10:38 +0200)]
BUG-6522: Adjust collection sizes

StatementContexts are typically leaves or have a low number
of children, leading to wasted space during parsing.

Force collections to be allocated with minimum size and have
them grow as needed, so we limit the run-time overhead.

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

7 years agoImprove ContextBuilder error reporting 21/47321/2
Robert Varga [Thu, 20 Oct 2016 15:14:21 +0000 (17:14 +0200)]
Improve ContextBuilder error reporting

Instead of throwing an IllegalArgumentException throw
a proper SourceException, which will explain what statement
does not take an argument, pointing to the offending source.

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

7 years agoBUG-6965: introduce BuiltinDeclaredStatements 23/47323/2
Robert Varga [Thu, 20 Oct 2016 16:31:11 +0000 (18:31 +0200)]
BUG-6965: introduce BuiltinDeclaredStatements

This patch adds squashing of YANG builtin types into
singletons when such types are not otherwise modified.

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

7 years agoBUG-6964: define a namespace to hold model-defined statements 22/47322/1
Robert Varga [Thu, 20 Oct 2016 12:22:50 +0000 (14:22 +0200)]
BUG-6964: define a namespace to hold model-defined statements

This patch adds a new namespace, StatementDefinitionNamespace,
which holds StatementDefinitions for all extensions defined in
the models being processed.

This namespace is then used to acquire a shared definition instead
of instantiating a definition everytime it is referenced.

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

7 years agoBug 6491: Some imports are not exposed in Module.getImports 17/47317/2
Filip Gregor [Wed, 19 Oct 2016 13:57:33 +0000 (15:57 +0200)]
Bug 6491: Some imports are not exposed in Module.getImports

in case of no revision in module and imported module, method
getImports returns empty Set.
added tests, fixed Set with imports in AbstractEffectiveModule

Change-Id: Ie23196d9cbcca98266580d11a85d66c06ac8561c
Signed-off-by: Filip Gregor <fgregor@cisco.com>
(cherry picked from commit a9aa900b8c5d1dbe16011a0c6c0f00cbb2ec105e)

7 years agoBug 6961: SchemaContext.getAllModuleIdentifiers() doesnt work for submodules 14/47314/1
Filip Gregor [Wed, 19 Oct 2016 11:41:28 +0000 (13:41 +0200)]
Bug 6961: SchemaContext.getAllModuleIdentifiers() doesnt work for submodules

added submodules to return value from method getAllModuleIdentifiers

Change-Id: I9f328d0050457b7094cbb420f0e0205b8034cf6f
Signed-off-by: Filip Gregor <fgregor@cisco.com>
(cherry picked from commit 097a1cc73aa3ffbf1898b38cba4f6c66956a4c3b)

7 years agoReuse cardinality constants 93/47193/1
Robert Varga [Tue, 18 Oct 2016 00:20:16 +0000 (02:20 +0200)]
Reuse cardinality constants

0..1, 0..MAX and 1..1 are common cardinalities. Instead of leaking the MAX constant
create additional builder methods which reuse Cardinality objects.

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

7 years agoFix inefficient ConstraintEffectiveStatements 71/47171/2
Robert Varga [Tue, 18 Oct 2016 14:28:35 +0000 (16:28 +0200)]
Fix inefficient ConstraintEffectiveStatements

Leaking a mutable ArrayList is incorrect, as the result
should be immutable. Furthermore not providing a hint
results in wasted space. Fix this by copying the temporary
ArrayList into an ImmutableList.

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

7 years agoFix GroupingEffectiveStatementImpl's unknown nodes 70/47170/1
Robert Varga [Tue, 18 Oct 2016 14:30:07 +0000 (16:30 +0200)]
Fix GroupingEffectiveStatementImpl's unknown nodes

Heap analysis has pointed out a linked list, which is both
a correctness problem (it should be immutable) and efficiency
issue, as most of the time this list should be empty.

Use ImmutableList.Builder to build an immutable list of
unknown statements.

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

7 years agoBUG-4456: add RecursiveExtensionResolver 84/47084/1
Robert Varga [Mon, 17 Oct 2016 21:58:54 +0000 (23:58 +0200)]
BUG-4456: add RecursiveExtensionResolver

This patch adds a hack which allows us to instantiate
recursive extensions. The solution is rather ugly, but
should be workable.

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

7 years agoBUG-6757: revert fix for BUG-4456 41/47041/2
Robert Varga [Mon, 17 Oct 2016 20:19:54 +0000 (22:19 +0200)]
BUG-6757: revert fix for BUG-4456

The fix has introduced a massive memory leak, which causes
all of temporary build objects to be retained in the final
SchemaContext.

Instead of the leak, add an explicit guard to detect
extensions (transitively) referencing themselves.

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

7 years agoFix failing unit test in QueuedNotificationManagerTest 70/47070/1
Igor Foltin [Tue, 18 Oct 2016 10:02:48 +0000 (12:02 +0200)]
Fix failing unit test in QueuedNotificationManagerTest

Change-Id: I6a8a467cb2b3965753dccbe9b8bdd8e81a9bce80
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
(cherry picked from commit 8e48344eca0be664e9e4be1480d24fdfdec9f7a5)

7 years agoUse lambdas instead of anonymous classes 40/47040/1
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>
(cherry picked from commit f6eae2a11c570c1097eb9202debc7e36ce72ef6d)

7 years agoUse lambdas instead of StmtContextUtils.build{Declared,Effecive} 39/47039/1
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>
(cherry picked from commit 7e9cdeeef2d18011f43bd848267e13855655f8ad)

7 years agoBUG-5561: use canonical Bits order 16/47016/1
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>
(cherry picked from commit b3315a133684c91930b8e2f4004a327e50d48954)

7 years agoFix a bunch of warnings 15/47015/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>
(cherry picked from commit 7ee0100fadc14a764b1d971013d28f057457f20e)

7 years agoIntro. new yangtools.testutils artifacts (incl. Mikito) 80/45880/2
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>
(cherry picked from commit f07653736cdf6665a0ab8e39fe5427a095c1730b)

7 years agoAdd YangInstanceIdentifier fast paths 53/46353/2
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>
(cherry picked from commit 5593e8c66e6a6e2badbcd75aafb0f42a6fb62d0c)

7 years agoUse YangInstanceIdentifier.EMPTY 52/46352/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>
(cherry picked from commit 9fe172e110f6eab2f1b0093a2acff3dd27a9d9e4)

7 years agoBug 6771: Problem with typedefs nested in augment 51/46351/1
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>
(cherry picked from commit baa1b88aaf83bc2917a3b0859f950c1e8daf40ba)

7 years agoAllow QueuedNotificationManager to batch notifications 43/46143/1
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>
(cherry picked from commit ddc17ff5daf9a58c5cf5f4ede3e49621c0db3d6c)

7 years agoAdd batching to QueuedNotificationManager 36/46136/1
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>
(cherry picked from commit 8aaf251e7eb6616384794e31bcd107ffe8fdba2e)

7 years agoCleanup QueuedNotificationManager 27/46127/1
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>
(cherry picked from commit a0d690e3b716c7574c8fa39b3291220a42a7bdd0)

7 years agoBug 6551: Support for third-party Yang extensions implementation 49/46049/1
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 agoFix ConstraintDefinition inconsistency 21/45821/2
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>
(cherry picked from commit edc4d5d22bd1120a47378deb9df56847c8769100)

7 years agoBumping versions by 0.0.1 for next dev cycle 53/45653/1
Anil Belur [Thu, 15 Sep 2016 22:38:04 +0000 (08:38 +1000)]
Bumping versions by 0.0.1 for next dev cycle

Change-Id: I10c423dd908a899ece7f186bf821a070a26770d6
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
7 years agoYangtools documentation 19/45319/1
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>
(cherry picked from commit dbfc518701f0ed1f74b2b5d55cc8c27064174925)

7 years agoYangtools documentation 79/44979/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>
(cherry picked from commit 5cba929ce67b946502776b9b436dccd32e6c37e2)

7 years agoBUG-6497: Do not lose augmentation statement order 76/44976/1
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 agoBUG-6497: Do not lose augmentation statement order 65/44965/1
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>
(cherry picked from commit 3c4bdfac3a8b04ecd1d6eab2cdadbb365b54664e)

7 years agoBUG-6316: Fix Bit and EnumPair's position/value types 14/44614/2
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>
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBug 6420: Fixed SemVer's valueOf method 52/44752/1
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>
(cherry picked from commit 9fb2e2367686d5fa1ae56dba0f5209ba2b822e8c)

7 years agoBug 6410: Fixed initialization of typedefs in rpc 67/44067/2
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>
(cherry picked from commit 8b7928e1337c94936434af5b4d9844804d2720de)

7 years agoBug 6419: Fixed SchemaContextEmitter's emitContainer method 54/44054/1
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>
(cherry picked from commit a664580e83425f01943698e7ff52e48bd3411cfb)

7 years agoBug 3899: Milestone: Increase test coverage for Yangtools 41/44041/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>
(cherry picked from commit 387ea1eaaf1ac2482cf3bd761a6caea0f8b92be9)

7 years agoBug 6416: Fixed SchemaContextEmitter's emitIdentityrefSpecification method 40/44040/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>
(cherry picked from commit b52c31309ed0221d2e7b17e8361d22ee10e52abb)

7 years agoBug 6414: Fixed DataNodeIterator's traverseModule method 38/44038/1
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>
(cherry picked from commit 211be58dd12278fe8f8be6936229cfb979478a4a)

7 years agoBug 3899: Milestone: Increase test coverage for Yangtools 88/43688/2
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>
(cherry picked from commit f77f673e129e7a866bd21f6072c600f75471a068)

7 years agoImprove yang-maven-plugin error reporting for errors in dependencies 17/43517/1
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>
(cherry picked from commit 1d98955b96490bfda3cba04e004c29e00a3e80e6)

7 years agoUpdate .gitreview for stable/boron 01/43401/1
Thanh Ha [Mon, 8 Aug 2016 21:40:37 +0000 (17:40 -0400)]
Update .gitreview for stable/boron

Change-Id: I605765d148fd26786395d750b83ef40a2e057299
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>