yangtools.git
6 years agoMake Variant/CheckedValue subclassable 64/71664/1
Robert Varga [Wed, 2 May 2018 12:39:12 +0000 (14:39 +0200)]
Make Variant/CheckedValue subclassable

It is useful to specialized these two classes outside of concepts,
for example by providing alternative constructs on top of Variant
and providing a type-bound domain-specific CheckedValue.

Expose constructors and first()/second() to subclasses so that it
is feasible to perform these things.

Change-Id: I1253ba2b0ed115b0b3f6dc6f07138634f15091de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDo not use jaxen XPath 37/71537/2
Robert Varga [Sat, 28 Apr 2018 10:37:52 +0000 (12:37 +0200)]
Do not use jaxen XPath

We are really interested only in Expr and its evaluation, hence we
can skip the BaseXPath class, which is hiding things from us.

This also lowers the memory overhead of compiled expression very
slightly and improves performance, as the result is not needlessly
obfuscated via a singleton list.

Furthermore we no longer go through XPathReaderFactory, which incurs
reflection overhead, but rather instantiate
org.jaxen.saxpath.base.XPathReader directly.

Change-Id: I7fd315c17f4013f927e724226408ba12f8445606
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoStore XPath rather than BaseXPath 36/71536/1
Robert Varga [Sat, 28 Apr 2018 09:57:05 +0000 (11:57 +0200)]
Store XPath rather than BaseXPath

JaxenXPath should not really care how the XPath is implemented,
hence store just the interface. We still need BaseXPath for now.

Change-Id: I2a73cd51a02c0d99d9adf37801bccc83edce523c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoSpeed up YangFunctionContext.isDerivedFrom{OrSelf} 21/71521/2
Robert Varga [Fri, 27 Apr 2018 16:30:53 +0000 (18:30 +0200)]
Speed up YangFunctionContext.isDerivedFrom{OrSelf}

Rather than collecting a HashSet for the sole purpose or running
a single contains(), search for the target identity in ancestry.

Change-Id: I0d8c7b1d390c3f56b848c19b933cffa52a7bf9e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoReorganize YangFunctionContext 20/71520/2
Robert Varga [Fri, 27 Apr 2018 16:15:00 +0000 (18:15 +0200)]
Reorganize YangFunctionContext

Sonar is not very happy about large lambdas, so reorganize this
class to use static methods and method handles as an alternative
to to constants.

Change-Id: I60a31091ed623eed001042574892d55cf9238c09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd DataSchemaContextTreeTest 15/71515/1
Robert Varga [Fri, 27 Apr 2018 14:59:41 +0000 (16:59 +0200)]
Add DataSchemaContextTreeTest

DataSchemaContextTree is completely untested, this patch adds some
unit tests.

Change-Id: I68b3c77080fa1b155ec28ca6ced4d15039437ec8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoClean up DataSchemaContext{Node,Tree} 14/71514/1
Robert Varga [Fri, 27 Apr 2018 14:49:29 +0000 (16:49 +0200)]
Clean up DataSchemaContext{Node,Tree}

This patch fixes a potential NPE when a YangInstanceIdentifier does
not match the schema tree and adds alternative Optional-based methods
for finding children based on relative/absolute YangInstanceIdentifier.

Change-Id: Icdc08c02817ad9d59434a060b6da27dfe2b5ea67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoExpose DataTreeSnapshot's SchemaContext 90/71390/1
Robert Varga [Thu, 26 Apr 2018 09:01:28 +0000 (11:01 +0200)]
Expose DataTreeSnapshot's SchemaContext

There are use cases where we need to acquire the SchemaContext
associated with a snapshot. Introduce a method to acquire it.

Change-Id: I16053e03068e7313d409b4d35353eb3c0328b76f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoExpose copy-based MapEntryNodeBuilder 18/71318/1
Juraj Kosmel [Fri, 9 Dec 2016 14:12:36 +0000 (06:12 -0800)]
Expose copy-based MapEntryNodeBuilder

This is a missing method needed for keyed lists.

Change-Id: Ie62be953c141f3c23cbd25eef261f21cbee1a018
Signed-off-by: Juraj Kosmel <juraj.kosmel@pantheon.tech>
6 years agoAdd CheckedValue future bridge methods 88/71188/1
Robert Varga [Sat, 21 Apr 2018 13:26:09 +0000 (15:26 +0200)]
Add CheckedValue future bridge methods

This patch adds convenience methods to convert a CheckedValue
into a immediately-complete {Completable,Fluent}Future as well
as bridge methods to complete existing {Completable,Settable}Futures
with the contained value.

Change-Id: I9abf3c76b62e591f83b5a219bea434429053164e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix checkstyle in yang-model-export 49/71049/3
Robert Varga [Tue, 17 Apr 2018 17:36:54 +0000 (19:36 +0200)]
Fix checkstyle in yang-model-export

Fix violations and enable enforcement.

Change-Id: I22ac0386510e001e09d3fd883876f92785e2f88f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix checkstyle in yang-parser-api 48/71048/1
Robert Varga [Tue, 17 Apr 2018 17:26:39 +0000 (19:26 +0200)]
Fix checkstyle in yang-parser-api

Fix the few violations and start enforcing checkstyle.

Change-Id: I04929e336d369265969989082e42db61c2a485ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoTag CanonicalValueSupport services 21/71021/1
Robert Varga [Tue, 17 Apr 2018 08:06:14 +0000 (10:06 +0200)]
Tag CanonicalValueSupport services

This generates ServiceLoader service entries, so that supports can
be loaded at runtime.

Change-Id: Ieed985d9db759f23962db9b4e145700ef08765e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoConvert CanonicalValue{Support,Validator} to use Variant 99/70999/8
Robert Varga [Mon, 16 Apr 2018 21:28:17 +0000 (23:28 +0200)]
Convert CanonicalValue{Support,Validator} to use Variant

Variant is useful here, as we can return either a CanonicalValue
or CanonicalValueViolation (which holds error details). This allows
us to side-step exception throws while retaining error information.

Change-Id: Ie3d1d6ff21611391a912b6ccfb208c0d58fa9ab5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd ModifyAction documentation 07/71007/4
Robert Varga [Tue, 17 Apr 2018 01:39:10 +0000 (03:39 +0200)]
Add ModifyAction documentation

Adds partial documentation and marks future evolution considerations.

Change-Id: I0eca13d8d9790435c77a3a9d3fd658f0c5cc8c75
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd TreeType documentation 06/71006/4
Robert Varga [Tue, 17 Apr 2018 01:27:14 +0000 (03:27 +0200)]
Add TreeType documentation

Clarify TreeType's relationship with RFC6020, RFC7950 and RFC8342,
add 2.1.0/3.0.0 design considerations.

Change-Id: Ie74eba7244270015be87fdaf5e48d6d265f6e099
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove unneeded scope 08/71008/1
Robert Varga [Tue, 17 Apr 2018 02:16:49 +0000 (04:16 +0200)]
Remove unneeded scope

odlparent has fixed the scope of metainf-services, remove
the now-unneeded declaration.

Change-Id: I8d29db2ef06e6b141adf876e19753c821469b7a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoConvert base types to implement CanonicalValue 90/70990/6
Robert Varga [Mon, 16 Apr 2018 16:27:54 +0000 (18:27 +0200)]
Convert base types to implement CanonicalValue

With CanonicalValue concept defined we can now retrofit into our
base support types for YANG. Aside from the canonical representation
which these classes provided, this allows them to communicate
value validation as needed.

Change-Id: I3ea24ecc2cbf3c2e23a3020b722b7a038f62b321
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd generalized CanonicalValue YANG concept 89/70989/6
Robert Varga [Mon, 16 Apr 2018 15:54:17 +0000 (17:54 +0200)]
Add generalized CanonicalValue YANG concept

The parsing and validation concepts in DerivedString are really
useful in expressing that a particular value has been validated
to conform to some abstract contract.

This facility will allow us to side-step validation when moving
data between classes, especially when we can prove requried
validation has already been done.

This patch introduces CanonicalValue and support interfaces, so
it can be used more widely.

JIRA: YANGTOOLS-418
Change-Id: Ib3f8723facd60c6737351d863ad0f9cef6c4a5da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd yangtools.concepts.CheckedValue 65/70265/13
Robert Varga [Tue, 3 Apr 2018 07:42:21 +0000 (09:42 +0200)]
Add yangtools.concepts.CheckedValue

There are quite a few places where we would like to conditionally
create a value or report an error. These currently rely on thrown
exceptions, which has a performance penalty.

Introduce CheckedValue, which acts as a combined holder object
for either a value or an Exception. These objects can act as
intermediaries between callers and callees.

The underlying concept here is that of a variant value, which contains
either a value of type A or a value of type B. This patch adds
the concept as a utility Variant<T, U>.

Change-Id: Ibc6f562e22805b38402436cd9c0368dfcbb775fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoConsider submodule imports when sorting modules 74/70974/8
Robert Varga [Mon, 16 Apr 2018 10:24:39 +0000 (12:24 +0200)]
Consider submodule imports when sorting modules

YANGTOOLS-806 started skipping import statements, hence
a module's effective requirements are no longer expressed
in their imports.

Teach ModuleDependencySort about submodules and populate
the graph based on submodule's imports, too.

JIRA: YANGTOOLS-876
Change-Id: I1aed32de034cf2e602e130afcbeafb171fac514b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd ModuleDependencyInfoTest 78/70878/9
Robert Varga [Thu, 12 Apr 2018 22:31:26 +0000 (00:31 +0200)]
Add ModuleDependencyInfoTest

We are missing an explicit test suite, start one.

Change-Id: I93e17df5c178d134a5d5a3bd586b398f93b0c4f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix copyright year 82/70882/1
Robert Varga [Fri, 13 Apr 2018 00:11:16 +0000 (02:11 +0200)]
Fix copyright year

This is a fresh file, not a three-year-old one.

Change-Id: Id01a7249da3d100cf65256edb2bb741aa34a139a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoProvide some yangtools.yang.common javadoc 79/70879/2
Robert Varga [Thu, 12 Apr 2018 23:26:11 +0000 (01:26 +0200)]
Provide some yangtools.yang.common javadoc

This package deserves an introduction, provide one.

Change-Id: I9dfab88255d53915ed0df8ca9d59208a1030824c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoHarden yang-model-util test suite 77/70877/1
Robert Varga [Thu, 12 Apr 2018 22:05:00 +0000 (00:05 +0200)]
Harden yang-model-util test suite

Update the test suite to use yangtools mockito configuration, forcing
all mocking to be done.

Change-Id: Icbf0cd0bc6932b6b807bb6a5ac0fd3712543c99e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMake yang.common base types non-final 75/70875/1
Robert Varga [Thu, 12 Apr 2018 19:34:42 +0000 (21:34 +0200)]
Make yang.common base types non-final

While final classes are useful, we will require the ability to mark
validation level of a particular piece of data in a vein similar to
DerivedString -- which requires subclassing to work memory-efficiently.

This patch prepares for that work by making the types non-final,
but does not allow their particulars to be overridden, so they still
form an effectively-final contract just like DerivedString
representations do.

Change-Id: Id7bde4b49d8b8aeb87c9b6e7317e5aa8f55e98eb
JIRA: YANGTOOLS-418
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFixup DerivedStringValidator representation checking 89/70789/1
Robert Varga [Wed, 11 Apr 2018 15:32:35 +0000 (17:32 +0200)]
Fixup DerivedStringValidator representation checking

Validated DerviedStrings need to define compareTo() on the base
representation, disable the check for validators.

JIRA: YANGTOOLS-418
Change-Id: I8413674d15fc4caf7492402ddfb92e4de05d9c3f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoImprove ClassLoaderUtils.loadClassWithTCCL() 59/70659/2
Robert Varga [Mon, 9 Apr 2018 13:38:33 +0000 (15:38 +0200)]
Improve ClassLoaderUtils.loadClassWithTCCL()

There are scenarios when we do not have a Thread Context Class Loader,
such as when executing from Netty's GlobalEventExecutor. When we attempt
to load a class in that scenario, the method will throw a NPE, which
exposes users which can deal with the class not being able to load
to a RuntimeException -- preventing recovery.

Detect the case when TCCL is null and report a failure to load the class,
noting the reason for the failure.

Change-Id: Ia6837ba451d290a2070bc24e9e7088c60275cae0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd yang.common.DerivedString class 29/70229/18
Robert Varga [Sat, 31 Mar 2018 23:04:47 +0000 (01:04 +0200)]
Add yang.common.DerivedString class

DerivedString provides the baseline alternative for storing
String-equivalent information. The base class provides to prototype
using which interactions with Strings can be implemented.

Each such type is supported by a DerivedStringSupport, potentially
further validated via a DerivedStringValidator.

JIRA: YANGTOOLS-418
Change-Id: Ifa8c01723fdc43e71cc6ab48fca50963a131ccaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUpdate yang-model-validator output 32/70432/1
Robert Varga [Fri, 6 Apr 2018 14:30:55 +0000 (16:30 +0200)]
Update yang-model-validator output

This cleans up argument handling, updates the commons-cli dependency
and adds -q and -d options for no and debug output.

Change-Id: I04b590019b27acf259830e69748c1d998121648e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump odlparent to 3.1.1 48/70348/1
Robert Varga [Thu, 5 Apr 2018 00:34:18 +0000 (02:34 +0200)]
Bump odlparent to 3.1.1

This is not really needed, as it has zero impact on the produced
artifacts.

Change-Id: Iae694bf5a41c5249bbab490723bf4120b9f4700a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix Decimal64 using Longs.hashCode() 59/70259/1
Robert Varga [Mon, 2 Apr 2018 23:48:19 +0000 (01:48 +0200)]
Fix Decimal64 using Longs.hashCode()

We are a Java 8 user, we should be using Long.hashCode() instead.

Change-Id: I3c18d40569a91341daa148d894c7bbab46cc175b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix leafref require-instance implementation 01/70201/1
Robert Varga [Thu, 29 Mar 2018 21:59:34 +0000 (23:59 +0200)]
Fix leafref require-instance implementation

Both identityref and leafref types default to require-instace=true,
hence we should be starting with that and also properly inherit
the property from the parent type.

Add RequireInstanceRestrictedTypeDefinition to capture the common
method and adjust RequireInstanceRestrictedTypeBuilder to check
for it and initialize the require-instance value appropriately.

JIRA: YANGTOOLS-872
Change-Id: I125d5687950af21694c4510ce64adb00f92ae4e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump versions to next development snapshot 72/70172/1
Robert Varga [Thu, 29 Mar 2018 00:07:40 +0000 (02:07 +0200)]
Bump versions to next development snapshot

This patch starts the 2.0.4 development cycle.

Change-Id: I975e631ebff9c86e083e2aed20ea4b40967a3335
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRequire odl-guava-3.1.0+ 20/70020/1
Robert Varga [Fri, 23 Mar 2018 13:54:05 +0000 (14:54 +0100)]
Require odl-guava-3.1.0+

Guava is bumped incompatibly, hence we need to require it.

Change-Id: Ib2a48568c08fa0279d599d2bb10706ab6cce861d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump to odlparent 3.1.0 66/69866/2
Stephen Kitt [Thu, 22 Mar 2018 17:20:23 +0000 (18:20 +0100)]
Bump to odlparent 3.1.0

Change-Id: I6a556fedf84e256b64fd27507a1c98783dff8b7a
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoAdd another 3.0.0 note 07/69807/1
Robert Varga [Thu, 22 Mar 2018 11:53:21 +0000 (12:53 +0100)]
Add another 3.0.0 note

Our use of Strings for YANG identifiers is confusing to the users
who need to map that string to other namespaces. Expressing the fact
that the string is composed of a limited set of characters would
be beneficial to, for example, mdsal's codegen components.

On the other hand, paying the cost of class encapsulation may not
be feasible and we should just be documenting contractual contents.

Change-Id: I3557bd180a63881b26848f087940ae62816e4214
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRelax identity statement argument checks 35/69635/3
Robert Varga [Mon, 19 Mar 2018 18:45:48 +0000 (19:45 +0100)]
Relax identity statement argument checks

This patch relaxes identity statement checking, so that FD.io's
VLAN model continues to work. Emit a stern warning, but do not fail
if an strictly-invalid identity name is encountered.

Change-Id: If3b3ad3f16372b1d856406480606177ba7851336
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd alternative ClassLoaderUtils methods 08/69608/4
Robert Varga [Mon, 19 Mar 2018 09:20:30 +0000 (10:20 +0100)]
Add alternative ClassLoaderUtils methods

ClassLoaderUtils uses method overloading on a FunctionalInterface,
which renders it not-completely-convenient to use with Java 8 lambdas.

Rather than method overloads, define dedicated methods for common
functional types, deprecating the old ones.

JIRA: YANGTOOLS-866
Change-Id: I40d5bdb5ef8845dccfc6ee0582acc0142e39cc09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoIntroduce StmtContextUtils.parse(Node)Identifier 85/69485/8
Robert Varga [Wed, 14 Mar 2018 09:27:03 +0000 (10:27 +0100)]
Introduce StmtContextUtils.parse(Node)Identifier

These are an improvement over qnameFromArgument() as they follow
exact RFC7950 specification, performing validity checks and generally
performing better.

JIRA: YANGTOOLS-863
Change-Id: Ifc56cbb93ba0046f4e65f9bc89d0d46b27d74fd3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd YangConstants.operation{Input,Output}QName() 84/69484/3
Robert Varga [Wed, 14 Mar 2018 02:25:51 +0000 (03:25 +0100)]
Add YangConstants.operation{Input,Output}QName()

Since we have QName.withModule(), we can optimize instantiation of
action/RPC input output statements by pre-validating the local name.

This is significantly faster than parsing the string via
StmtContextUtils.qnameFromArgument() and is useful for downstreams
which interaction with actions/RPCs.

Change-Id: If6da796df375f9785e05cb3cf901d64cccf2cfe5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump versions to 2.0.3-SNAPSHOT 66/69366/1
Robert Varga [Mon, 12 Mar 2018 09:24:23 +0000 (10:24 +0100)]
Bump versions to 2.0.3-SNAPSHOT

This bumps versions for next release.

Change-Id: Ie9ce447f339d9b9de49b9eb1bd795ac06e381a5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup Bug6887Test 58/69358/4
Robert Varga [Sun, 11 Mar 2018 21:08:48 +0000 (22:08 +0100)]
Cleanup Bug6887Test

Rather than using ImmutableList, use variadic arguments and their
array to construct the SchemaPath.

Change-Id: Ia3446e17e87981d2ad896d209a7b1f6ebf3f3b26
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd QName.withModule(QNameModule) method 57/69357/4
Robert Varga [Sun, 11 Mar 2018 21:06:02 +0000 (22:06 +0100)]
Add QName.withModule(QNameModule) method

In situations when a companion QName with specified QNameModule needs
to be created, we can side-step localName checking and just directly
reuse it. QName.withModule() does precisely that and two callers
of QName.create() are updated to use it.

Change-Id: Ib1ca72210c0114610dafba0dfbbce15a2b8ddc03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd CollectionWrappers 74/68774/11
Robert Varga [Mon, 26 Feb 2018 15:27:17 +0000 (16:27 +0100)]
Add CollectionWrappers

SchemaNode/SchemaContext has some unfortunate method contracts
which require returning a Set, while they are represented as
java.util.Map.values() in EffectiveStatement world, where they
support keyed lookups, which is really what users require.

To bridge these two worlds without duplicating the same information
in two collections we need a memory-efficient proxy to act as an
adaptor, as we know the primary storage (Map.values()) is known
to be both immutable and conforming to Set interface requirements.

This patch such a class and provides a symmetric List wrapping
utility.

JIRA: YANGTOOLS-853
Change-Id: I052e4f9d58aa1f054450840c2216b0fd2109bc61
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd default implementations of StatementDefinition methods 46/69246/4
Robert Varga [Thu, 8 Mar 2018 01:51:57 +0000 (02:51 +0100)]
Add default implementations of StatementDefinition methods

StatementSupport should be forwarding StatementDefinition methods
it is inheriting to the public view it is capturing.

This makes the API somewhat cleaner by making it explicit these
methods are related.

Change-Id: I3ec5d2bf182824225ebe7a1596cf60f5047848e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoIntroduce ImplicitParentAwareStatementSupport 44/69244/2
Robert Varga [Thu, 8 Mar 2018 01:35:15 +0000 (02:35 +0100)]
Introduce ImplicitParentAwareStatementSupport

Augment statement would like to know if it needs to adapt itself to
its target node -- which is based on whether the target node would
like to wrap any of its children.

Most of the statements do not want to do this, with the notable
excteption if choice statement. Separate getImplicitParentFor()
into a separate interface, so we can optimize this in future.

Change-Id: I1e1e2d8b1fd52d67b1c2f06838670af69e40f99e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoOptimize augment conflict checking 16/69216/2
Robert Varga [Wed, 7 Mar 2018 16:32:30 +0000 (17:32 +0100)]
Optimize augment conflict checking

When we are validating whether a node can be introduced, we end up
needlessly iterating when the source is not a DataDefinitionStatement
and also end up running comparison when a substatement is not a
DataDefinitionStatement,

Refactor the code to take these invariants into account.

Change-Id: Ie55c7dfebacfad1189de1929c23809fd284958b4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix FeatureEffectiveStatementNamespace javadoc 08/69208/1
Robert Varga [Wed, 7 Mar 2018 12:21:47 +0000 (13:21 +0100)]
Fix FeatureEffectiveStatementNamespace javadoc

This namespace obviously contains features, not extensions.

Change-Id: I3aceaff8fd238cb346c53ec9caa9b94520a15d05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd YinXMLEventReaderFactory 92/67892/13
Robert Varga [Sat, 3 Feb 2018 15:29:45 +0000 (16:29 +0100)]
Add YinXMLEventReaderFactory

This is a proper way of exporting YIN models from parser output,
being more correct and much simpler than YinExportUtils.
YinExportUtils.writeModuleToOutputStream() methods are deprecated
in favor of writeModuleAsYinText() and writeSubmoduleAsYinText().

JIRA: YANGTOOLS-858
Change-Id: I9fda3ef3ccf2f3aa9e18d32da85e225d835151f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix format string 18/69118/1
Robert Varga [Tue, 6 Mar 2018 09:51:00 +0000 (10:51 +0100)]
Fix format string

checkArgument uses String.format() strings, not logger.

Change-Id: I723924bee6cafddda2cbc88362c3f5898e17da6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoValidate parsed QName to identity 76/69076/1
Robert Varga [Mon, 5 Mar 2018 14:11:45 +0000 (15:11 +0100)]
Validate parsed QName to identity

We need to validate if parsed QName refers to an existing identity,
this fixes up unused AbstractModuleStringIdentityrefCodec to check
Module references.

Change-Id: Iebbb43681e9b384c43bd81607d169294373bdd72
JIRA: YANGTOOLS-846
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoValidate parsed QName to identity 43/68543/4
Robert Varga [Thu, 22 Feb 2018 14:01:52 +0000 (15:01 +0100)]
Validate parsed QName to identity

We need to validate if parsed QName refers to an existing identity
before allowing it in Identityref codecs. Introduce IdentityCodecUtil
along with a test suite and migrate users over.

JIRA: YANGTOOLS-846
Change-Id: I673ae6df4406110202b86329121a3ca9673fb0ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup resources allocated in @BeforeClass 42/68542/7
Robert Varga [Fri, 23 Feb 2018 12:27:02 +0000 (13:27 +0100)]
Cleanup resources allocated in @BeforeClass

This cleans up static fields after tests have been run.

Change-Id: Idf48234157b2196fadfdabcffd5628ad397639d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoIntern more arguments 04/69004/2
Robert Varga [Fri, 2 Mar 2018 14:37:12 +0000 (15:37 +0100)]
Intern more arguments

modifier, deviate and max-elements were missed in the original
interning patch, add them.

Change-Id: I9b14f4d84657b10f0fd0e56c0f6a867f5e6c8872
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd timing information 48/68848/4
Robert Varga [Tue, 27 Feb 2018 23:54:51 +0000 (00:54 +0100)]
Add timing information

This adds timing information around code generation. It also exposes
the number of YANG modules processed, so we have some guidance
to interpret the time taken. Also lowers verbosity of dependency
scanning.

Change-Id: I7b202a388405e755964fe76d6b81bc42fd92b73b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix YangTextSnippetIterator with OpenConfig extensions 47/68847/2
Robert Varga [Tue, 27 Feb 2018 23:17:56 +0000 (00:17 +0100)]
Fix YangTextSnippetIterator with OpenConfig extensions

Since OC extensions are binding to all revisions, their
StatementSupport's QNameModule (without revision) is presented
by DeclaredStatement. Such a QNameModule does not match the imported
module (which obeys flexible rules) -- which means we cannot readily
look it up from ModuleEffectiveStatement.

Add a workaround to use a loose match until a proper fix is
implemented.

Change-Id: I9393fe7cef7b22014e3c68d69b09f9702dded303
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoOptimize QName.withoutRevision() 46/68846/1
Robert Varga [Tue, 27 Feb 2018 23:15:26 +0000 (00:15 +0100)]
Optimize QName.withoutRevision()

This method is used in a few users to implement loose matches. Optimize
it to not check localName, as that has already been checked. Also introduce
a mirror QNameModule method.

Change-Id: Id1045d79677fd4c0aeb5069f6b151530c545c20b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup AbstractEffectiveDocumentedDataNodeContainer a bit 37/68837/1
Robert Varga [Tue, 27 Feb 2018 20:00:40 +0000 (21:00 +0100)]
Cleanup AbstractEffectiveDocumentedDataNodeContainer a bit

Throw colision exception in a short block, allowing logic to be
better in-lined.

Change-Id: I87d056127869d3c2ea7cc2d240b6f6278b57c9c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoSkip duplicate classpath scanning 28/68828/1
Robert Varga [Tue, 27 Feb 2018 15:54:46 +0000 (16:54 +0100)]
Skip duplicate classpath scanning

Scanning the entire class path for jars is expensive. Do that
only once and capture dependencies so we can do the second pass
in a more direct manner.

JIRA: YANGTOOLS-855
Change-Id: I0763cbac3ea6781ebb400e014837b9f44375de63
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAllow StatementMap to be resized to correct size 24/68824/1
Robert Varga [Tue, 27 Feb 2018 10:20:50 +0000 (11:20 +0100)]
Allow StatementMap to be resized to correct size

StatementStreamSources typically know the correct sizing for substatement
list even when they do not understand them (and thus have not emitted
them) and pass this hint down when they finish processing the statement.

Take advantage of this information by allocating sufficient capacity to
hold all resolved children.

Change-Id: Ib4a96a8d42bad747d56d92e07846724607346e97
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoOptimize YinStatementStreamSource 14/68814/5
Robert Varga [Tue, 27 Feb 2018 12:06:45 +0000 (13:06 +0100)]
Optimize YinStatementStreamSource

This patch converts YinStatementStreamSource to use stateful
StatementWriter interfaces, skipping expensive lookups.

JIRA: YANGTOOLS-854
Change-Id: I4d0931a78f9a08fed3d23045df1763ea4e4a02d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAllow StatementWriter to be stateful 11/68811/5
Robert Varga [Tue, 27 Feb 2018 08:24:32 +0000 (09:24 +0100)]
Allow StatementWriter to be stateful

This patch adds a stateful protocol betwen SourceSpecificContext
and StatementStreamSources, so they do not need to allocate/lookup
objects for statements defined in previous phases.

JIRA: YANGTOOLS-854
Change-Id: I600208a384776a601967bc7b5719cc6632b226db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoPopulate Extension/FeatureEffectiveNamespace 15/68815/2
Robert Varga [Tue, 27 Feb 2018 12:27:57 +0000 (13:27 +0100)]
Populate Extension/FeatureEffectiveNamespace

Modules are the primary providers of these namespaces, make sure
ModuleEffectiveStatementImpl populates them correctly.

JIRA: YANGTOOLS-853
Change-Id: I9e0313e36a2b7de2bc258a263ac376dc8bd99dc0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd Case/Extension/Feature/IdentityEffectiveStatementNamespace 05/68805/1
Robert Varga [Sat, 24 Feb 2018 21:43:04 +0000 (22:43 +0100)]
Add Case/Extension/Feature/IdentityEffectiveStatementNamespace

This patch adds simple RFC7950 namespaces.

JIRA: YANGTOOLS-853
Change-Id: I753a297a782fc3f9f81f9d1659fc12a7c70b8c28
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDeprecate PrefixToModule.isPreLinkageMap() 80/68680/5
Robert Varga [Sun, 25 Feb 2018 23:30:13 +0000 (00:30 +0100)]
Deprecate PrefixToModule.isPreLinkageMap()

This property is only consulted at places which can be inferred
to set it to true. Deprecate this property, as it is a state leak
defying encapsulation.

Change-Id: I1f159214e6487f482c7801ff73bd697bad6d470a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoTurn YangStatementParserListenerImpl into a visitor 78/68678/8
Robert Varga [Sun, 25 Feb 2018 21:05:16 +0000 (22:05 +0100)]
Turn YangStatementParserListenerImpl into a visitor

Rather than using a listener with two methods, which needs to keep
and re-lookup state, implement such visitStatement(). This allows us
to skip duplicate lookups and will allow us to completely eliminate
all state tracking.

As it turns out we do not need any visitor logic, because we are
always walking statements and descending into their children. Rework
logic to reflect that, eliminating the need for any statekeeping,
as we can track all of the state inline.

JIRA: YANGTOOLS-713
Change-Id: I22a289fdbb2d8ea1501dd4a8eacd7780afbf1c6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMark missed StatementStreamSource methods 79/68679/2
Robert Varga [Sun, 25 Feb 2018 22:13:02 +0000 (23:13 +0100)]
Mark missed StatementStreamSource methods

We have failed to mark methods in this interface for API movement
before 2.0.0, hence they were left out. Mark them for 3.0.0 so we
do not forget again.

Change-Id: Ic24e12e6f9c984f6d92d53aeb2aa38f542306beb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoEncapsulate YangStatementParserListenerImpl.walk() 76/68676/2
Robert Varga [Sun, 25 Feb 2018 20:02:35 +0000 (21:02 +0100)]
Encapsulate YangStatementParserListenerImpl.walk()

As it turns out, the contract between YangStatementStreamSource
is one of walking a tree with a set of parameters. Make sure we
encapsulate this contract, so that it can be efficiently implemented
using a visitor.

This has the benefit of discarding unneeded state more quickly
and not retaining it past errors. It will also allow us to very
simply convert YangStatementParserListenerImpl into a visitor.

JIRA: YANGTOOLS-713
Change-Id: Iac8c4979fb31cb527788837b41d4bbf17ce4b3cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoPrivatize YangStatementParserListenerImpl 75/68675/2
Robert Varga [Sun, 25 Feb 2018 19:34:18 +0000 (20:34 +0100)]
Privatize YangStatementParserListenerImpl

This class is package-visible, hence public methods should only be
the @Override ones.

JIRA: YANGTOOLS-713
Change-Id: Id092b12cf6f2ad309aaf5920b31ae9fb4ab25b58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMake QName/QNameModule a WritableObject 74/68674/2
Robert Varga [Sun, 25 Feb 2018 18:43:49 +0000 (19:43 +0100)]
Make QName/QNameModule a WritableObject

Serializing these objects into a stream is useful, make them implement
WritableObject.

Change-Id: I3fbb147b4deb17afb2ead0dedc716e5a9a5cefc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoQNameModule/QName should implement Identifier 73/68673/2
Robert Varga [Sat, 24 Feb 2018 21:42:24 +0000 (22:42 +0100)]
QNameModule/QName should implement Identifier

These classes are inherently identifier-like, and hence should be
implementing Identifier concept.

Change-Id: Ic494ec42788a176555c56446105511bc4868fad8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoExpose identities from ModuleEffectiveStatement 51/68551/2
Robert Varga [Fri, 23 Feb 2018 15:03:39 +0000 (16:03 +0100)]
Expose identities from ModuleEffectiveStatement

Parser has an accurate, indexed view of all identities defined in
a particular module. Expose this namespace to ModuleEffectiveStatement
users.

Change-Id: I9692cb91b23155191545224bceaf436fd0f6c67e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoEliminate unneeded @BeforeClass 41/68541/4
Robert Varga [Fri, 23 Feb 2018 12:02:55 +0000 (13:02 +0100)]
Eliminate unneeded @BeforeClass

Constructing QNames does not entail exceptions, so we can initialize
them as simple constants.

Change-Id: I84fa394cda4d8478b60a40b8ea7080d4e6b88558
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoReport parent SchemaPath on error 39/68539/1
Robert Varga [Fri, 23 Feb 2018 11:22:28 +0000 (12:22 +0100)]
Report parent SchemaPath on error

When we fail to find a child node, report the full schemapath
of the parent node, so the input can be properly diagnosed.

Change-Id: Id5cf3f55f3c745b55f2a485746dd995b0f056657
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCorrect error message 38/68538/1
Robert Varga [Fri, 23 Feb 2018 11:21:58 +0000 (12:21 +0100)]
Correct error message

Expand "doesn't" to "does not".

Change-Id: I2b530985dd5982d7bcbc95866c1e7e26e52c4b98
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoOptimize QNameModule.equals() a bit 96/68496/1
Robert Varga [Thu, 22 Feb 2018 13:42:48 +0000 (14:42 +0100)]
Optimize QNameModule.equals() a bit

The namespace cannot be null, so we can safely call equals() on it,
skipping checks in Objects.equals().

Change-Id: Ic1b94e2239fb9fd906711c8cbb03dd252a190c49
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoSpeed up JSON codec operations 93/68493/2
Robert Varga [Thu, 22 Feb 2018 13:02:42 +0000 (14:02 +0100)]
Speed up JSON codec operations

With the improved SchemaContext, we can perform direct lookup
of Module based on QNameModule -- use that instead of iteration.

Change-Id: Ib5c1146b8c13ac3f52a18ed8334b89b66f6ca40c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix maven plugin ignoring import resolution mode 66/67866/10
Robert Varga [Sat, 3 Feb 2018 19:20:52 +0000 (20:20 +0100)]
Fix maven plugin ignoring import resolution mode

While BasicCodeGenerator has knobs to express required import resolution
mode, the plugin ignores them. This patch reorganizes YangToSourcesProcessor
so that we determine what import resolution mode we need before we start
assembling the SchemaContext.

JIRA: YANGTOOLS-825
Change-Id: Iaec12e3c8ada2173262533cc6d59e54f18095826
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDo not fake an errorMessage for pattern constraints 64/68464/4
Robert Varga [Wed, 21 Feb 2018 13:51:03 +0000 (14:51 +0100)]
Do not fake an errorMessage for pattern constraints

Eagerly-formatting a replacement error message is actively hurting
callers of getErrorMessage(), which really expect that method
to return model-defined error message. Fix that.

JIRA: YANGTOOLS-850
Change-Id: Iddb5f9ae529f1ed49eed735a8931ee396334f578
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd DeclaredStatementFormatter 66/68466/2
Robert Varga [Wed, 21 Feb 2018 14:12:26 +0000 (15:12 +0100)]
Add DeclaredStatementFormatter

Working with downstreams it became apparent they really are using
same YangTextBuilder customizations across multiple statements.

This patch exposes DeclaredStatementFormatter, which acts as
a customization holder off of which YangTextSnippets can be created.

JIRA: MDSAL-301
Change-Id: I4733313dcb98c9b1d244088b5b46d8a197ab2f5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoEncapsulate regexes in a non-capturing group 35/68435/4
Robert Varga [Tue, 20 Feb 2018 18:12:19 +0000 (19:12 +0100)]
Encapsulate regexes in a non-capturing group

Regular expressions are pesky, nwo we are being bitten by branches.
Let's just encapsulate the internal pattern into a non-capturing
group and be done with it.

JIRA: YANGTOOLS-798
Change-Id: If3b3b2fb35ecd336bc23fd7acaf29efa48eb9b74
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMove Bug4079/Bug5410 tests from yang-parser to yang-model-util 56/68456/3
Robert Varga [Wed, 21 Feb 2018 09:43:03 +0000 (10:43 +0100)]
Move Bug4079/Bug5410 tests from yang-parser to yang-model-util

This co-locates the unit test with the class tested.

Change-Id: Ib7d044208946be3347e1b1aedbd87a0cfe1e5a23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMove yang-model-export unit tests 21/68421/1
Robert Varga [Mon, 19 Feb 2018 22:49:47 +0000 (23:49 +0100)]
Move yang-model-export unit tests

This will allow us to co-locate within the same package, leading
to better interaction, as we can use package-private methods to look
at state.

Change-Id: I0ab59c32c166505ac44d5f21ae0aa374eaa08aac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd the ability to build effective model 99/68399/2
Robert Varga [Wed, 14 Feb 2018 09:37:11 +0000 (10:37 +0100)]
Add the ability to build effective model

The effective model consists of ModuleEffectiveStatements
which are guaranteed to have unique QNameModules. Express
that in YangParser.

Change-Id: Id094c40cf5dcf49e6289d3b929f4abf2f9cb6436
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd submodule lookup namespace 18/68418/1
Robert Varga [Mon, 19 Feb 2018 20:08:56 +0000 (21:08 +0100)]
Add submodule lookup namespace

ModuleEffectiveStatement needs to allow looking up which submodules
were included as the effect of include statements. Since submodule
names need to be unique, it is natural to express this as a namespace.

Change-Id: I782caba8dfb9ff4dbea5b81e335f06dc797518d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd YANG/YIN namespace string literals 16/68416/2
Robert Varga [Mon, 19 Feb 2018 15:22:54 +0000 (16:22 +0100)]
Add YANG/YIN namespace string literals

Interacting with Java XML machinery requires the use of Strings
for namespaces. It is useful to implement javax.xml.NamespaceContext
with switch() statement, which unfortunately can only work on explicit
string literals. Expose these literals, improving the ergonomics.

Change-Id: I534d2a6e13960ba7587bfe77ed581e8593e65a17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoExport ResourceYangTextSchemaSource 98/68398/2
Robert Varga [Mon, 19 Feb 2018 07:02:52 +0000 (08:02 +0100)]
Export ResourceYangTextSchemaSource

YangTextSchemaSource.forResource() returns this class, which is hidden,
leading to end user confusion, as the return class cannot be imported.

We cannot change the return value, as that would cause ABI breakage,
hence expose ResourceYangTextSchemaSource and mark it for hiding
in next major release.

Change-Id: Ib03e3df73824172dcd80a58fc33f7bdb4e26c6f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd YangTextSnippet to yang-model-export 93/67893/4
Robert Varga [Sat, 3 Feb 2018 19:33:57 +0000 (20:33 +0100)]
Add YangTextSnippet to yang-model-export

This is a simple class generating a sequence of strings, concatenation
of which produces YANG text corresponding to a DeclaredStatement.

The snipped is properly indented, can omit user-specified statements,
and by default omits statements with default values as per RFC6087.

JIRA: MDSAL-301
Change-Id: Ie45e947dccd33b851e23effb827ddc66690451f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd DefaultStatementDefinition 38/67938/1
Robert Varga [Mon, 5 Feb 2018 05:01:34 +0000 (06:01 +0100)]
Add DefaultStatementDefinition

Implementing StatementDefinition contract can be tricky and it is
often misused by using implementation classes. Introduce a utility
default implementation, which enforces statement representations
being interfaces.

Change-Id: Icd2ce998dc8001cfa4a1d44f48017204c6dd02f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoExpose EffectiveModuleStatement prefix mapping 91/67891/8
Robert Varga [Sat, 3 Feb 2018 12:35:24 +0000 (13:35 +0100)]
Expose EffectiveModuleStatement prefix mapping

ModuleEffectiveStatement should expose mapping of prefixes
to imported modules (and self) as well as reverse mapping of
QNameModule to prefix, so that users can map properly map
QNames encountered within a module.

This patch exposes that information via two new namespaces,
which are present only in ModuleEffectiveStatements. Furthermore
EffectiveStatementBase is updated to allow subclasses to contain
namespaces.

JIRA: MDSAL-301
Change-Id: I5139c32eff18c1fa703dd8d3c98882939f82b109
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCorrect double-quoted string whitespace trimming 99/67899/3
Robert Varga [Sun, 4 Feb 2018 15:31:11 +0000 (16:31 +0100)]
Correct double-quoted string whitespace trimming

We need to trim leading and trailing whitespace when it comes from
YANG text, so that the resulting string matches expectations.

This patch adds the required trimming.

JIRA: YANGTOOLS-845
Change-Id: I21777583c5d18819e68c089cd9f2cf51179b0530
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoSwitch YangToSourcesProcessor to use YangParser 16/67816/4
Robert Varga [Thu, 1 Feb 2018 12:39:17 +0000 (13:39 +0100)]
Switch YangToSourcesProcessor to use YangParser

Rather than going through YangTextSchemaContextResolver, use
YangParser to assemble the SchemaContext. This gives us better
control over the parsing process and also allows us to build
only sources which are required to generate code in local directory.

JIRA: YANGTOOLS-825
Change-Id: Ie3c49517aedd5ae3604ed27dc5bd1f1f1fa7a4d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDeprecate CopyableNode at al. 52/67752/3
Robert Varga [Tue, 30 Jan 2018 22:48:40 +0000 (23:48 +0100)]
Deprecate CopyableNode at al.

isAddedByUses(), isAugmenting() and similar constructs relate to how
a particular node became effective. This really has not place in the
effective model of the world.

This patch concentrates duplicate methods into an interface hierarchy
and marks them as @deprecated, along with justification. This allows
us to track down users and the semantics they really are after.

Since we are touching SchemaContext, mark its future direction, which
should see it shed a lot of nonsensical methods.

Change-Id: Ibdaf52e45076006e979204ac75e7bae6aeffd29a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoyang-parser-impl supports ASTSchemaSource 11/67811/2
Robert Varga [Thu, 1 Feb 2018 11:27:33 +0000 (12:27 +0100)]
yang-parser-impl supports ASTSchemaSource

yang-parser-rfc7950 supports bridging parsing from ASTSchemaSource,
which is an intermediate product of parsing from YangTextSchemaSource.

Make sure we propagate this capability from YangParserImpl, so that
users can efficiently integrate with it. While we're in the area
teach YangStatementStreamSource how to instantiate itself from
an ASTSchemaSource and add ASTSchemaSource.toString().

Change-Id: I0b6440b6fc4e7522c70261cffcef0afafed8ba53
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix invalid enum definition error string 06/67806/1
Robert Varga [Thu, 1 Feb 2018 10:09:35 +0000 (11:09 +0100)]
Fix invalid enum definition error string

This is a copy&paste problem, the string should not be referencing
bits but enums.

Change-Id: I5adc98a5db92b88bf7e20dcc6141213347858f58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMark metainf-services 76/67576/1
Robert Varga [Thu, 25 Jan 2018 15:17:11 +0000 (16:17 +0100)]
Mark metainf-services

Until we get odlparent-3.0.3 with a fixed declaration, fix our features
by marking metainf-services as provided.

Change-Id: If54a0a89dade4e2a4aed4ddf84d0abae5b11fc24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd checkstyle-logging to yangtools-artifacts 42/67342/1
Robert Varga [Fri, 19 Jan 2018 08:50:41 +0000 (09:50 +0100)]
Add checkstyle-logging to yangtools-artifacts

All artifacts should be communicated to downstreams, fix that.

Change-Id: Ida1ca8cfd6162ed7fb54d512b69821df5d666686
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoStart 2.0.2 release cycle 98/67298/1
Robert Varga [Thu, 18 Jan 2018 18:14:51 +0000 (19:14 +0100)]
Start 2.0.2 release cycle

Bump versions by 0.0.1.

Change-Id: I67e5db2ed702ed53336c7ba207c0c89c4b9fa17a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoYANGTOOLS-844: Filtering/SimpleSchemaContext violate getModules() contract 12/67212/13
Robert Varga [Tue, 16 Jan 2018 16:21:50 +0000 (17:21 +0100)]
YANGTOOLS-844: Filtering/SimpleSchemaContext violate getModules() contract

getModules() is explicit about how the modules should be ordered,
which is not compatible with ModuleDependencySort. As it turns out
ModuleDependencySort is only needed in MD-SAL codegen, where we
already invoke it explicitly.

Explicitly sort modules according to requirements of getModules(),
fulfilling that contract.

This also affects findModule(String) and related functions, which
are sorted, but in inverse order of what is specified. Fix that
by adjusting AbstractSchemaContext.REVISION_COMPARATOR and
introducing NAME_REVISION_COMPARATOR for use in places where modules
are not guaranteed to have a unique name.

Change-Id: Ie91685b830694764158381e4696e3f7d5bb57fba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>