yangtools.git
7 years agoFix mandatory statement checking 14/49814/3
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>
7 years agoMove StatementContextBase.getStorageNodeType() 11/49811/3
Robert Varga [Mon, 26 Dec 2016 13:04:55 +0000 (14:04 +0100)]
Move StatementContextBase.getStorageNodeType()

We have two implementations of this node, move it out from
StatementContextBase to its only subclass. This way it does
not get overridden in RootStatementContext.

Also move javadoc to the interface definition so it gets
shared by all implementations.

Change-Id: I3d230062ed5e76eaf3032f7c2b09113c94093091
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoTurn Prerequisite into a FunctionInterface 00/49800/4
Robert Varga [Sun, 25 Dec 2016 17:15:06 +0000 (18:15 +0100)]
Turn Prerequisite into a FunctionInterface

isDone() method should never be used by callers, hence it should be removed,
hence we can turn Prerequisite into a FunctionalInterface, with the actual
property being tracked in the implementation.

This allows us to neatly use a lambda for implementing the transformation.

Change-Id: I8cd588f0c6b6fcf926e530e781db35a39b0a8eb8
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoEnhance phase sequencing assertions 99/49799/4
Robert Varga [Sun, 25 Dec 2016 16:03:55 +0000 (17:03 +0100)]
Enhance phase sequencing assertions

Rather than throwing non-descript exceptions, add explicit messages about
what went wrong. Also promote phase sequencing ISE to VerifyException, as
it indicate a reactor implementation error.

Change-Id: I36d4450a3e81c2f4688065f63d686a24fa11a039
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoEliminate superfluous onFullDefinitionDeclared overrides 98/49798/4
Robert Varga [Sun, 25 Dec 2016 15:32:40 +0000 (16:32 +0100)]
Eliminate superfluous onFullDefinitionDeclared overrides

This patch moves invocation of the validator back into AbstractStatementSupport,
rendering majority of overrides useless, as all they did was call (then no-op)
super and then the validator.

This also fixes problems if a subclass redefines the validator to be non-existent
and fails to override (again) onFullDefinitionDeclared().

Drive-by cleanup reduces verbosity of specification implementation classes by
importing the nested interface directly.

The end effect is that it is again possible to reason about hooks being performed
in statements by looking at what implementation overrides there are.

Change-Id: Ibed4cd5eeb128e69637fcf124331aeeeaeb7b4ea
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoValidate identity-ref on full definition 97/49797/4
Robert Varga [Sun, 25 Dec 2016 14:57:44 +0000 (15:57 +0100)]
Validate identity-ref on full definition

This fixes an inconsistency where this statement is the only one
validated on declaration, not on full definition.

Change-Id: Icf454fc3157ce9b568911649b9fcbe4a3a02c397
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoDocumented StatementSupport's SourceException throwing 96/49796/4
Robert Varga [Sun, 25 Dec 2016 15:06:22 +0000 (16:06 +0100)]
Documented StatementSupport's SourceException throwing

Instead of adding a superfluous throws declaration, add javadoc
about the possibility of that exception being thrown. Also adjust
AbstractStatementSupport to reflect that change.

Change-Id: I80dcb3a3b3bd75b415988a021e1489641fb96f87
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd ModelActionBuilder javadocs 01/49801/4
Robert Varga [Sun, 25 Dec 2016 16:24:51 +0000 (17:24 +0100)]
Add ModelActionBuilder javadocs

This adds sorely-needed documentation around ModelActionBuilder,
so that users can actually reason about what they are actually
doing instead of guessing.

Methods which do not have a caller are marked as deprecated so
that potential users are warned that their API contract is
undefined.

Change-Id: Iceb391a6648ea1ab1f920a0f564c37ba5d6bc5e5
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 7159: Stop using deprecated methods from YangParserTestUtils 06/50006/1
Igor Foltin [Wed, 4 Jan 2017 09:24:23 +0000 (10:24 +0100)]
Bug 7159: Stop using deprecated methods from YangParserTestUtils

YangParserTestUtils methods which take YangStatementSourceImpl as parameter
have been deprecated recently. Convert all places that used them
to non-deprecated version of those methods.

Change-Id: I18caddbe2583283db890269318104890064c4c0e
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-7464: Initial import of java-concurrent-hash-trie-map 59/49859/3
Robert Varga [Thu, 29 Dec 2016 12:11:38 +0000 (13:11 +0100)]
BUG-7464: Initial import of java-concurrent-hash-trie-map

This is the initial import of java-concurrent-hash-trie-map, as available
at https://github.com/rovarga/java-concurrent-hash-trie-map/tree/odl-0.2.23.

The upstream from which this code was forked is dead for all intents
and purposes, as demonstrated by lack of reaction to multiple pull requests
over the past year, including the critical correctness fix needed
in OpenDaylight.

This fork will be evolved to clean up the code base according to OpenDaylight
coding practices and to take advantage of both Java 8 and Guava.

Change-Id: I16e6e8c724f391e262e7b192c2e1f875364785db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
7 years agoFix checkstyle warnings 95/49795/3
Robert Varga [Sun, 25 Dec 2016 14:15:54 +0000 (15:15 +0100)]
Fix checkstyle warnings

Just missing spaces, add them.

Change-Id: Ia5413278efc0948ab337a1ed087e6f99e30fa90a
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoReturn specialized TypeDefinitions 94/49794/3
Robert Varga [Sun, 25 Dec 2016 12:06:07 +0000 (13:06 +0100)]
Return specialized TypeDefinitions

BuiltinEffectiveStatements should declare specialized return
rather than generic TypeDefinition.

Change-Id: I6b5f74c7c13002eb27c37054ed88e2d87ba70a05
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoExpand StatementSupport documentation 02/49802/3
Robert Varga [Sun, 25 Dec 2016 13:44:54 +0000 (14:44 +0100)]
Expand StatementSupport documentation

It is not immediately clear why we have onStatementAdded(),
but it is a critical piece of the parser machinery. Expand its
documentation to provide an example when it is useful.

Change-Id: I52d4da7795a6cbd5271cf6b7aa53e09940e67efd
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd StatementFactory javadocs 92/49792/2
Robert Varga [Sun, 25 Dec 2016 12:04:56 +0000 (13:04 +0100)]
Add StatementFactory javadocs

Adds basic javadocs and @Nonnull annotation.

Change-Id: I32d09d24c002d0912229a3c20880e607bb8ea5fe
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoCleanup YangParserTestUtils 91/49791/2
Robert Varga [Sun, 25 Dec 2016 10:05:53 +0000 (11:05 +0100)]
Cleanup YangParserTestUtils

- add array-based utility methods
- mark YangStatementStreamSource-based methods as deprecated
- add a Resource-based method

Change-Id: I9856d60d9cfaecfcba4f078650e66ef44d799fd0
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 7440: Fix empty parent in deviate "replace" 79/49779/3
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>
7 years agoBug 7395: yang-system-test is unable to access yang files 63/49563/3
Igor Foltin [Mon, 19 Dec 2016 15:50:33 +0000 (16:50 +0100)]
Bug 7395: yang-system-test is unable to access yang files

- yang-system-test should now be able to access yang files

Change-Id: I49535fdf9d39e66f7578a52491aa90ecfc5bb5a4
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-6533: add immutable implementations of yang.model.api 57/44657/8
Robert Varga [Thu, 25 Aug 2016 11:14:27 +0000 (13:14 +0200)]
BUG-6533: add immutable implementations of yang.model.api

This patch introduces Immutables.org annotations to generate
immutable/builder implementation of yang.model.api interfaces.

These are contained in a separate artifact and not available
as a feature, since they currently do not have a user.

Change-Id: I98a9969138a702b67139f323e77fa955162c3d74
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6880: [Yang 1.1] Allow leaf-lists to have default values 73/49473/3
Peter Kajsa [Wed, 14 Dec 2016 09:59:10 +0000 (10:59 +0100)]
Bug 6880: [Yang 1.1] Allow leaf-lists to have default values

Allow leaf-lists to have default values in Yang 1.1 models.

Change-Id: I84df558e886eb695e83686e972f5cb9e1086b061
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBUG-6522: cache isConfiguration() result 67/49567/4
Robert Varga [Mon, 19 Dec 2016 18:56:50 +0000 (19:56 +0100)]
BUG-6522: cache isConfiguration() result

Profiling runs have identified the recursive search for
default config statements as a potential hotspot.

The problem here is that config statements are not common,
hence most of the time we end up traversing up the to the
root context (which is hard-coded config=true) and walk
the declared and effective statements over and over.

By the time this method is called its result should be
invariant, hence add a cache field and use it to side-step
both the recursion and substatement list walk.

Change-Id: I51383a9af0a7594b1d56b954ca9bbda0933b7231
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7051: move isModuleIdentifierWithoutSpecifiedRevision 25/49525/1
Robert Varga [Sun, 18 Dec 2016 13:00:10 +0000 (14:00 +0100)]
BUG-7051: move isModuleIdentifierWithoutSpecifiedRevision

UtilsisModuleIdentifierWithoutSpecifiedRevision() is used only
in NamespaceStorageSupport, move it to remove cross-package
dependency.

Change-Id: I7e6dbdc5f73f08289851f04e3092e63f0d40fa5a
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6870: [Yang 1.1] Support for new "modifier" statement 58/49158/12
Peter Kajsa [Thu, 8 Dec 2016 17:49:59 +0000 (18:49 +0100)]
Bug 6870: [Yang 1.1] Support for new "modifier" statement

The "modifier" statement, which is an optional substatement to the
"pattern" statement, takes as an argument the string "invert-match".
If a pattern has the "invert-match" modifier present, the type is
restricted to values that do not match the pattern.

Change-Id: I9e9d993a16077c1f3af1ab20c197d2e6c9e8c6af
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6869: [Yang 1.1] Allow if-feature in bit, enum, refine & identity 42/49242/9
Peter Kajsa [Mon, 12 Dec 2016 12:23:45 +0000 (13:23 +0100)]
Bug 6869: [Yang 1.1] Allow if-feature in bit, enum, refine & identity

Allow "if-feature" in "bit", "enum", "identity" and "refine"
statements. Presence of an "if-feature" statement in a "bit"
statement does not affect the automatically assigned position.

Change-Id: I487620bc08fc4f57c51172821087feaad04db5fe
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBug 6896: [Yang 1.1] Add support for new statement "action" 20/49320/8
Igor Foltin [Tue, 13 Dec 2016 20:04:00 +0000 (21:04 +0100)]
Bug 6896: [Yang 1.1] Add support for new statement "action"

This patch introduces the "action" statement as defined in YANG 1.1 (RFC7950).
The "action" statement is used to define an operation connected to a specific
container or list data node.

Yang statement parser is now able to parse this statement.

Change-Id: I683be78ee041d1202d6cbc688f34802e2818145a
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6871: [YANG 1.1] Allow "must" in "input", "output" and "notification" statements 39/49339/5
Igor Foltin [Wed, 14 Dec 2016 11:24:03 +0000 (12:24 +0100)]
Bug 6871: [YANG 1.1] Allow "must" in "input", "output" and "notification" statements

Starting with YANG 1.1 (RFC7950), "must" statements can be defined in
"input", "output" and "notification" statements.

Yang statement parser can now parse models containing such statements.

Change-Id: I6b81dd3447bfc50f5a21b79fbdaacfb6e2bf9689
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6883: [Yang 1.1] Add support for a new data definition statement "anydata" 02/49102/9
Peter Kajsa [Wed, 7 Dec 2016 18:27:18 +0000 (19:27 +0100)]
Bug 6883: [Yang 1.1] Add support for a new data definition statement "anydata"

The "anydata" statement is used to represent an unknown set of nodes
that can be modeled with YANG, except anyxml, but for which the data
model is not known at module design time.

Change-Id: I0a7470dbd571087fcc3b8fd8cb2b21668d99d6f1
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBug 6897: [Yang 1.1] Allow notifications to be tied to data nodes 26/48926/18
Igor Foltin [Fri, 9 Dec 2016 15:22:05 +0000 (16:22 +0100)]
Bug 6897: [Yang 1.1] Allow notifications to be tied to data nodes

Since Yang 1.1, a notification can be defined at the top level of a
module, or connected to a specific container or list data node
in the schema tree

Change-Id: Ieac7d9f9962fb9d6d02e1dd89e491d47f4fd99e6
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6897: Adding getSubstatementValidator() method to AbstractStatementSupport 62/49462/4
Peter Kajsa [Fri, 16 Dec 2016 09:14:35 +0000 (10:14 +0100)]
Bug 6897: Adding getSubstatementValidator() method to AbstractStatementSupport

Change-Id: Ice3d198b83d3c1f533a918af4f9747331ff21c63
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBUG-4599: enforce QName's localname 48/49448/2
Robert Varga [Thu, 15 Dec 2016 18:09:03 +0000 (19:09 +0100)]
BUG-4599: enforce QName's localname

Localname should not contain colons, make sure we enforce
this, preventing invalid use of QNames.

Change-Id: Ie8012f266f47a48942890573d924d414b06b7fa5
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-4599: do not attempt to construct invalid QNames 19/29519/17
Robert Varga [Mon, 9 Nov 2015 08:27:39 +0000 (09:27 +0100)]
BUG-4599: do not attempt to construct invalid QNames

QName should not allow for localname to contain ':', so do
not construct it just for lookups. Also move the code to its
only user, so we can evolve it.

Change-Id: Ib6c2b9aa0ea3fa14c1d843162a4b232a12e10cc4
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
7 years agoBUG-4688: add Revision as a dedicated class 72/49372/5
Robert Varga [Wed, 14 Dec 2016 17:18:04 +0000 (18:18 +0100)]
BUG-4688: add Revision as a dedicated class

Defines Revision and adds basic marker to methods whose return value
needs to change complete the transition.

Change-Id: I853ad6f221712a9a6f28b29050ec30ae09d846e9
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoCodify DataTree{Candidate,Tip} hashCode/equals() 97/49397/3
Robert Varga [Wed, 14 Dec 2016 23:31:07 +0000 (00:31 +0100)]
Codify DataTree{Candidate,Tip} hashCode/equals()

Tighten the interface contract to ensure implementations
of these interfaces will always use identity comparisons. This
allows users dealing with these objects to rely on the fact that
they can be compared for equality quickly.

Change-Id: I679c4bebdb35465adf5fefcbd0af65a3ab48ef1f
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd YANG Library NETCONF capability 48/49348/4
Robert Varga [Wed, 14 Dec 2016 12:51:40 +0000 (13:51 +0100)]
Add YANG Library NETCONF capability

This extends YangConstants with the IANA allocation made
in RFC7950.

Change-Id: Iaa291578b51a35d3ca33ae0199cdd444a0d0a286
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6874 - [Yang 1.1] Allow "description" and "reference" in "import" and "include" 17/49117/13
Rashmi Pujar [Wed, 7 Dec 2016 21:52:47 +0000 (16:52 -0500)]
Bug 6874 - [Yang 1.1] Allow "description" and "reference" in "import" and "include"

Implementation in yang-parser-impl bundle

Change-Id: Iaa1573144c0939b6954d855d43c0a58379216d75
Signed-off-by: Rashmi Pujar <rpujar@inocybe.com>
7 years agoBUG-7267: catch RuntimeExceptions when processing sources 51/49351/6
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>
7 years agoBUG-4219: remove slf4j-api dependencies 74/49374/2
Stephen Kitt [Wed, 14 Dec 2016 17:27:32 +0000 (18:27 +0100)]
BUG-4219: remove slf4j-api dependencies

These are provided by odlparent and cause issues when generating
features (in preparation for the Karaf 4 migration).

Change-Id: I9881bf1b952b42a475e6633bdf11815c4f40e1f7
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoBUG-6867: simplify definitions with static imports 68/49368/2
Robert Varga [Wed, 14 Dec 2016 16:19:46 +0000 (17:19 +0100)]
BUG-6867: simplify definitions with static imports

Importing YangVersion.* constants makes the definitions
more concise. Also fixes up some issues missed in initial
review.

Change-Id: I991df50a0609dbdb752284cc7713e5687b3f62a0
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6867: Rename of Rfc6020Mapping to YangStmtMapping 54/48854/14
Alexis de Talhouët [Thu, 8 Dec 2016 22:43:11 +0000 (17:43 -0500)]
Bug 6867: Rename of Rfc6020Mapping to YangStmtMapping

Rfc6020Mapping contains also Rfc7950 statements, so
YangStmtMapping is more appropriate name.

Change-Id: Ia4473e2ef7a5117c9e0f840eefe57cd11d93da7f
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
7 years agoBug 6867: Extend yang statement parser to support different yang versions 68/48368/28
Peter Kajsa [Thu, 1 Dec 2016 13:57:24 +0000 (14:57 +0100)]
Bug 6867: Extend yang statement parser to support different yang versions

This patch extends statement parser in order to support different versions
of yang, yin or other statement based languages. Statement parser is able
to distinguish version of each yang, yin or other source and it performs
parsing of the source according to the specific version. Mixed-version
schemacontext (i.e. imports across versions) is supported too.

More in detail, StatementSupportBundle must be initialized by
SupportedVersionBundle, which defines set of supported versions.
In consequence, StatementSupportBundle allows to add version specific
StatementSupport into bundle. Furthermore each RootStatementContext
allows to set its version based on which corresponding StatementSupports
are invoked. For yang models, RootStatementContext version is set based
on a value of yang version statement.

Change-Id: I06bbcbfee091a0f54480d5f5f588a9ed18a84b55
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7267: catch null path offenders 37/49237/1
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 agoBug 7159: Add yang-test-util artifact 29/49129/2
Igor Foltin [Thu, 8 Dec 2016 07:46:22 +0000 (08:46 +0100)]
Bug 7159: Add yang-test-util artifact

This patch introduces a new artifact called yang-test-util which
provides a utility class with convenience methods for producing
effective schema context based on the supplied yang/yin sources
or paths to these sources.

Converted all places to use these helper methods

Change-Id: I49cb3f0df8bdbcf562f68bf600e8e4dd49cfe4f2
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoPropagate @Nonnull and @Nullable annotations 71/47971/7
Stephen Kitt [Wed, 2 Nov 2016 16:42:23 +0000 (17:42 +0100)]
Propagate @Nonnull and @Nullable annotations

These annotations aren't inherited, so for proper null analysis we
need to propagate them.

Change-Id: I9dee3df1e1c72f9767def23e668bfbb239319913
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoClean up un-used Xtend dependency and Maven plugin from testutils 97/48397/3
Michael Vorburger [Wed, 16 Nov 2016 11:53:37 +0000 (12:53 +0100)]
Clean up un-used Xtend dependency and Maven plugin from testutils

I just noticed this dependency while using the MoreAnswers in writing a
test, and realized I probably originally intended to throw in some Xtend
here too ;) but ended up not, so it's cleaner to remove this now.

Change-Id: I5b8abeba61c00c89a7a7b55161191e750ebcaec2
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoBug 7146: Propagate exceptions caught in YangStatementSourceImpl's constructors 31/48631/4
Igor Foltin [Wed, 23 Nov 2016 14:09:25 +0000 (15:09 +0100)]
Bug 7146: Propagate exceptions caught in YangStatementSourceImpl's constructors

Exceptions caught in YangStatementSourceImpl's constructors
are currently just logged which may later lead to a NullPointerException
being thrown during yang statement parser parsing cycle.
This patch changes these constructors so that the caught exceptions are
now propagated

Change-Id: I711407f2a3a43a6a069f8706ace1976c1ed70be8
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-5222: use odlparent features as a dependency 75/47775/7
Robert Varga [Mon, 31 Oct 2016 12:50:28 +0000 (13:50 +0100)]
BUG-5222: use odlparent features as a dependency

Specify dependency=true for artifacts provided from odlparent. This
should lower the time we keep reinstalling features.

Change-Id: I1742b66e8929ce165adf9f1befc6649e240631bf
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoCleanup MandatoryLeafEnforcer and DataTreeConfiguration 71/48671/5
Robert Varga [Thu, 24 Nov 2016 15:21:39 +0000 (16:21 +0100)]
Cleanup MandatoryLeafEnforcer and DataTreeConfiguration

This patch cleans up the implementation to simplify the NoOp
implementation, which now becomes anonymous.

Also the instantiation logic is updated to not interpret tree type
as the disabler, as that should be driven by the configuration itself.

This requires temporarily changing the configuration default to
not enforce mandatory nodes for OPERATIONAL -- that will be switched
back in a follow-up patch.

It also requires cleaning up DataTreeConfiguration so that it passes
down the correct rootPath.

Change-Id: I4e885e30433e1ae3cc43233035547d07fbd7556c
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-5968: Mandatory leaf enforcement does not work in some cases 32/48532/5
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>
7 years agoRemove accidental tabs 42/48642/1
Robert Varga [Wed, 23 Nov 2016 18:14:21 +0000 (19:14 +0100)]
Remove accidental tabs

Change-Id: I9b2b23a7c0298b9266d5e67a1aeafe7017464507
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoEliminate use of environment variables 38/48638/1
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>
7 years agoFix IT test instantiation 35/48635/2
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>
7 years agoJava 8: migrate to java.util.function.Function 37/47837/6
Stephen Kitt [Wed, 2 Nov 2016 13:15:20 +0000 (14:15 +0100)]
Java 8: migrate to java.util.function.Function

... where possible without breaking non-@Beta APIs.

Change-Id: I2d1a4708cdc08c83810267757e9eb0b98a6bf1eb
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoAddress trivial eclipse warnings 01/48501/3
Robert Varga [Sat, 19 Nov 2016 14:51:40 +0000 (15:51 +0100)]
Address trivial eclipse warnings

- missing javadoc
- superfluous else branches
- checkstyle violations

Change-Id: Ibf74b95d6ae7d1c9889852f541cce3e9d6b28bb4
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoRevert "Bug 5968: Mandatory leaf enforcement does not work in some cases" 23/48523/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>
7 years agoBug 6868 - [Yang 1.1] Argument of "If-feature" statement may be a boolean expression... 34/48234/6
Rashmi Pujar [Thu, 10 Nov 2016 21:10:27 +0000 (16:10 -0500)]
Bug 6868 - [Yang 1.1] Argument of "If-feature" statement may be a boolean expression over feature names

Change-Id: I04d30b1d2341bd1b30e4c56b11b6da3116787947
Signed-off-by: Rashmi Pujar <rpujar@inocybe.com>
7 years agoBug 6896: [YANG 1.1] Add support for new statement "action" 35/48035/8
Igor Foltin [Sun, 6 Nov 2016 14:37:38 +0000 (15:37 +0100)]
Bug 6896: [YANG 1.1] Add support for new statement "action"

API changes in yang-model-api.

Change-Id: I154400f86f838aef9f93edb948af19ec1fe4110a
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6874: [YANG 1.1] Allow "description" and "reference" in "import" and "include" 46/48246/3
Igor Foltin [Wed, 9 Nov 2016 14:31:08 +0000 (15:31 +0100)]
Bug 6874: [YANG 1.1] Allow "description" and "reference" in "import" and "include"

API changes in yang-model-api.

Change-Id: Id8e2c294374b61e254fd0d023cda4e8071cc86d1
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6871: [YANG 1.1] Allow "must" in "input", "output" and "notification statements" 74/47974/5
Igor Foltin [Wed, 2 Nov 2016 11:26:10 +0000 (12:26 +0100)]
Bug 6871: [YANG 1.1] Allow "must" in "input", "output" and "notification statements"

API changes in yang-model-api.

Change-Id: I79a2ff10dc79bc18094209426676e60849905580
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6877: [YANG 1.1] Allow identities to be derived from multiple base identities 48/48048/6
Igor Foltin [Mon, 7 Nov 2016 12:04:34 +0000 (13:04 +0100)]
Bug 6877: [YANG 1.1] Allow identities to be derived from multiple base identities

API changes in yang-model-api

Change-Id: I95745785901f29d421c77a35325cf7565f9d5f51
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-5717: add unique child identifier 41/48241/11
Robert Varga [Fri, 11 Nov 2016 02:46:54 +0000 (03:46 +0100)]
BUG-5717: add unique child identifier

We need to synchronize the parse tree walker with
the StatementWriter, so they can pair statements
across multiple phases. Adjust StatementWriter
to take an int childId to achieve this.

Change-Id: Ie3e210a9084cbe5a86212046083c359393a912f8
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7161: Do not tolerate source-level exceptions 73/48273/4
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>
7 years agoBug 6870: [YANG 1.1] Support for new substatement "modifier" in "pattern" statement 99/47899/5
Igor Foltin [Wed, 2 Nov 2016 09:43:32 +0000 (10:43 +0100)]
Bug 6870: [YANG 1.1] Support for new substatement "modifier" in "pattern" statement

API changes in yang-model-api.

Change-Id: I3ef2dc64b68d17d85e2a6c3ea0da0aece34d2fe7
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6897: [YANG 1.1] Allow notifications to be tied to data nodes 45/48245/2
Igor Foltin [Wed, 9 Nov 2016 15:29:11 +0000 (16:29 +0100)]
Bug 6897: [YANG 1.1] Allow notifications to be tied to data nodes

API changes in yang-model-api.

Change-Id: Id50b2712842ed7d58a14e731c9bcebe0b10a9d9b
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6869: [YANG 1.1] Allow if-feature in bit, enum, identity and refine statements 73/47773/5
Igor Foltin [Mon, 31 Oct 2016 09:52:53 +0000 (10:52 +0100)]
Bug 6869: [YANG 1.1] Allow if-feature in bit, enum, identity and refine statements

API changes in yang-model-api

Change-Id: I5aa4de28e0014e16d1349469024f016f25442635
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6883: [YANG 1.1] Add support for anydata statement 05/48105/4
Igor Foltin [Tue, 8 Nov 2016 09:12:15 +0000 (10:12 +0100)]
Bug 6883: [YANG 1.1] Add support for anydata statement

API changes in yang-model-api.

Change-Id: Ic5afed07a487b7311b83c9bd01a077592f1359ae
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6880: [YANG 1.1] Allow leaf-lists to have default values 85/47985/3
Igor Foltin [Wed, 2 Nov 2016 15:20:34 +0000 (16:20 +0100)]
Bug 6880: [YANG 1.1] Allow leaf-lists to have default values

API changes in yang-model-api

Change-Id: I12dc3b9606a06a751bd7788092dc2de76441f598
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBug 6873: [YANG 1.1] Support for "require-instance" in leafref 83/47983/3
Igor Foltin [Wed, 2 Nov 2016 12:35:38 +0000 (13:35 +0100)]
Bug 6873: [YANG 1.1] Support for "require-instance" in leafref

API changes in yang-model-api.

Change-Id: I1144726d2039137335a955555890dbff5e0c6b45
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
7 years agoBUG-5717: eliminate StmtContext.substatements() 05/48205/8
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>
7 years agoBUG-6150: add an import statement special-case 00/48200/11
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>
7 years agoAdd an empty Deque implementation 40/48240/3
Robert Varga [Fri, 11 Nov 2016 01:53:47 +0000 (02:53 +0100)]
Add an empty Deque implementation

A utility simpleton java.util.Deque which is always empty.
This can be used as a java.uil.Queue, too.

Change-Id: I6435e36bf36b9baf0983cf2fcc13d261c6fa9248
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix CursorAwareDataTreeSnapshot.newModification() 79/48179/2
Robert Varga [Wed, 9 Nov 2016 17:45:36 +0000 (18:45 +0100)]
Fix CursorAwareDataTreeSnapshot.newModification()

Cursor-awareness is a transitive property, i.e. cursor-aware
snapshots create cursor-aware modifications.

This change is needed to make downstream users which deal with
modifications and cursors work without dirty casts.

Change-Id: I96a9942e0f37a2ba2ce760185212699da321c5e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoFix an eclipse warning 06/48206/1
Robert Varga [Thu, 10 Nov 2016 12:56:02 +0000 (13:56 +0100)]
Fix an eclipse warning

Eclipse @Nonnull inference does not work with fields,
hence it produces a warning even when the field has
been checked via instanceof. Fix this by copying
the field into a local variable.

Change-Id: I9d7948c94b7bb292823ce6e5d4b36a276652f8fd
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 5968: Mandatory leaf enforcement does not work in some cases 62/48162/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>
7 years agotarget-ide/ on .gitignore 11/48111/2
Michael Vorburger [Tue, 8 Nov 2016 10:51:37 +0000 (11:51 +0100)]
target-ide/ on .gitignore

Change-Id: I0a3fbb507df6a65c531fa82f18e0cdb892d32e13
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoIntern SchemaContext.NAME 13/48113/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>
7 years agoBUG-7038: update StatementWriter.startElement() 54/47754/7
Robert Varga [Sun, 30 Oct 2016 00:04:43 +0000 (02:04 +0200)]
BUG-7038: update StatementWriter.startElement()

As noted in YangStatementParserListenerImpl, type
statement handling requires some hacks to work
with current structure.

Move the hack up to StatementContextWriter
by requiring StatementStreamSources to provide
the argument name when then they call startElement().

Change-Id: Ice763854c7dfb80adf27e45fdd8c14c90f3771f5
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7062: add revision awareness to Yin/YangTextSchemaSource 52/47752/7
Robert Varga [Sat, 29 Oct 2016 21:30:04 +0000 (23:30 +0200)]
BUG-7062: add revision awareness to Yin/YangTextSchemaSource

This adds support for parsing file names according
to https://tools.ietf.org/html/rfc6020#section-5.2.

Change-Id: I497aeba2cd801f618fa6a1075558325332623e31
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7054: Check YinDomSchemaSource validity 53/47753/7
Robert Varga [Sat, 29 Oct 2016 22:52:21 +0000 (00:52 +0200)]
BUG-7054: Check YinDomSchemaSource validity

This adds defensive checks on DOMSource, so that basic
YIN structure (namespace, root element, revision, module name)
are discovered.

These are used to construct an accurate SourceIdentifier, which
is then used as the identifier.

Change-Id: I2d2245a903ce687e860d04905f0eb0a966617ceb
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 5968: Mandatory leaf enforcement does not work in some cases 33/44233/10
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>
7 years agoBug 6814: Fix (de)serialization of anyxml in JSON 91/47491/4
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 6986: Yang parser system test options 44/47844/4
Peter Kajsa [Wed, 2 Nov 2016 15:30:48 +0000 (16:30 +0100)]
Bug 6986: Yang parser system test options

Added following options to yang parser system test:
usage: yang-system-test [-f features] [-h help] [-p path] [-v verbose] yangFiles...
 -f,--features <arg>   features is a string in the form
                       [feature(,feature)*] and feature is a string in the
                       form [($namespace?revision=$revision)$local_name].
                       This option is used to prune the data model by
                       removing all nodes that are defined with a
                       "if-feature".
 -h,--help             print help message and exit.
 -p,--path <arg>       path is a colon (:) separated list of directories
                       to search for yang modules.
 -v,--verbose          shows details about the results of test running.

Plus yang-system-test was added as a submodule to yang-aggregator.

Change-Id: I5e45edd78d222590aa1a2b3601fcb2f663a4a1d3
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoJava 8: use lambdas and function references 36/47836/2
Stephen Kitt [Wed, 2 Nov 2016 12:33:43 +0000 (13:33 +0100)]
Java 8: use lambdas and function references

This simply switches functional declarations to lambdas where
possible, and lambdas to function references where possible.

Change-Id: I3c0c97349b05aa8e8ecdda85906cbe41ed5c9c1a
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoCleanup: remove redundant type parameters 35/47835/2
Stephen Kitt [Wed, 2 Nov 2016 12:06:12 +0000 (13:06 +0100)]
Cleanup: remove redundant type parameters

Change-Id: Ifcbaf9b3656af33de3fcdda76a671a1eb7cafaba
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoCleanup: remove redundant casts 34/47834/2
Stephen Kitt [Wed, 2 Nov 2016 12:02:36 +0000 (13:02 +0100)]
Cleanup: remove redundant casts

Change-Id: Ibeca74821b2f03c97a31d7bb1b1691c14df33e15
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoBUG-6958: remove yang-data-{api,util} from odl-yangtools-yang-data 58/47658/3
Stephen Kitt [Thu, 27 Oct 2016 09:08:05 +0000 (11:08 +0200)]
BUG-6958: remove yang-data-{api,util} from odl-yangtools-yang-data

Now that yang-data-api and yang-data-util are provided by
odl-yangtools-yang-parser, and since odl-yangtools-yang-data depends
on odl-yangtools-yang-parser, there's no need to keep them in
odl-yangtools-yang-data.

Change-Id: If568088907c16e32d63f6475b7120bca09df1be2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoGuard Pattern constants with @RegEx 38/40338/8
Robert Varga [Tue, 14 Jun 2016 23:50:14 +0000 (01:50 +0200)]
Guard Pattern constants with @RegEx

We use some hard-coded patterns, extract them to string constants
and annotate those with @RegEx, so they are compile-time validated.

Change-Id: I651d18d665c42abb9402e4ae4669ae058f07b159
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6986: Yang parser system test 38/47538/7
Peter Kajsa [Mon, 24 Oct 2016 11:35:44 +0000 (13:35 +0200)]
Bug 6986: Yang parser system test

In order to measure performance of Yangtools code, a specific
system test is needed.

Change-Id: I1e8952f9bd26ef9e94c747dd1760c13462711930
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
7 years agoBUG-7054: add YinStatementStreamSource 36/47736/9
Robert Varga [Fri, 28 Oct 2016 12:42:04 +0000 (14:42 +0200)]
BUG-7054: add YinStatementStreamSource

This is a basic stream source, which traverses a DOM node
and its children, emitting stream events.

Change-Id: I536bd97c4b94a818cdf366b0028251f1100d9667
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7054: add a YinTextToDomTransformer 18/47718/10
Robert Varga [Fri, 28 Oct 2016 09:08:18 +0000 (11:08 +0200)]
BUG-7054: add a YinTextToDomTransformer

This is needed to turn a YIN text document into an in-memory
DOM document. That will be then processed by the parser.

Change-Id: I5d3ced18c99f1298b8385247cbfc8fef32e927bb
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7054: support .xml for YIN files 50/47750/2
Robert Varga [Sat, 29 Oct 2016 10:37:52 +0000 (12:37 +0200)]
BUG-7054: support .xml for YIN files

Requiring .yin only is a bit restrictive, allow files
to end with .xml, too.

Change-Id: I0408326c9b4a1bdaa7ed9203651b2b0bf346668a
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7052: move YangErrorListener 49/47749/2
Robert Varga [Sat, 29 Oct 2016 09:27:01 +0000 (11:27 +0200)]
BUG-7052: move YangErrorListener

This class is used by the YANG-specific parser, move it
out of generic 'impl' package to rfc6020.repo.

Change-Id: I402851a4e6aa85090d6f736014ea440c8c79dc5e
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-865: remove old parser remnants 48/47748/2
Robert Varga [Sat, 29 Oct 2016 00:55:40 +0000 (02:55 +0200)]
BUG-865: remove old parser remnants

These classes were used by the old parser, but are
no longer used. Somehow they were not removed, so
do that now.

Change-Id: I366c10bdd8401875e15b68e73a3eaf1a46662eb4
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7057: introduce UntrustedXML class 27/47727/5
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>
7 years agoBUG-7052: move ModuleIdentifierImpl 35/47735/4
Robert Varga [Fri, 28 Oct 2016 12:08:29 +0000 (14:08 +0200)]
BUG-7052: move ModuleIdentifierImpl

This is the last remnant of the old parser. Since this
implements a model.api concept, move it to model.util
so it can be widely reused.

Change-Id: Ife75438560b3981cf3bf4608c8a2e28faecc4ed7
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-6522: fix missed optimization 43/47743/1
Robert Varga [Fri, 28 Oct 2016 19:08:59 +0000 (21:08 +0200)]
BUG-6522: fix missed optimization

Previous patch has started to check the namespace node
and allocate a map when needed, but we forgot to initialize
it to ImmutableList. This patch fixes that.

Change-Id: I2d99f8d0e63e594e2b73a547e15a879fbc3c40bd
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7038: cleanup parser listener 08/47708/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>
7 years agoBUG-6522: do not cache import in SourceSpecificContext 07/47707/1
Robert Varga [Thu, 27 Oct 2016 18:39:15 +0000 (20:39 +0200)]
BUG-6522: do not cache import in SourceSpecificContext

Change-Id: Ia40da378f598f69208c5aa4afa55d5d12d86752a
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7051: move nasmespace declarations 06/47706/1
Robert Varga [Thu, 27 Oct 2016 18:35:31 +0000 (20:35 +0200)]
BUG-7051: move nasmespace declarations

ImportedModuleContext and IncludedModuleContext are based
on the same concepts as BelongsToModuleContext, hence they
should live in the same package.

Alternative would be to move them to rfc6020, but that really
is not appropriate, as it would increase coupling
of stmt.reactor with stmt.rfc6020.

Change-Id: Id60f4788d84404b861b5fba17b68eba7a43cc3cc
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoCleanup StatementContextWriter 93/47693/2
Robert Varga [Thu, 27 Oct 2016 16:58:05 +0000 (18:58 +0200)]
Cleanup StatementContextWriter

- do not declare SourceException as thrown
- make class final
- make phase final
- hide deferredCreate()

Change-Id: I72cdf60859fc70f1bdf8cf9b9f2845990535abf6
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoDocument RootStatementContext's relationship to other nodes 92/47692/2
Robert Varga [Thu, 27 Oct 2016 13:16:53 +0000 (15:16 +0200)]
Document RootStatementContext's relationship to other nodes

This adds a wee bit of information of how RootStatementContext
relates to other contexts.

Also adds lazy population of included lists, as these are typically
empty or sparsely populated. These are also enforced to be
RootSchemaContexts to make navigation through the maze of
implementations of storage methods more obvious.

Change-Id: I2a3f91c454a0213e6678ef97a91690acda32a2ca
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBug 6979 - yang.model.util.EffectiveAugmentationSchema is mutable 31/47631/3
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>