yangtools.git
5 years agoBump versions by x.y.(z+1) 60/71960/1 v1.2.x
jenkins-releng [Thu, 10 May 2018 23:34:40 +0000 (23:34 +0000)]
Bump versions by x.y.(z+1)

Change-Id: I2360f7297c2fdf53c8b2a2460c669fadefcab013
Signed-off-by: jenkins-releng <jenkins-releng@opendaylight.org>
6 years agoBump to odlparent 2.0.7 08/71508/1
Stephen Kitt [Fri, 27 Apr 2018 10:17:51 +0000 (12:17 +0200)]
Bump to odlparent 2.0.7

Change-Id: I5c328518b4b4fa16c8a1d777bb04a582ea969c50
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoBump to odlparent 2.0.6 16/71316/2
Stephen Kitt [Thu, 26 Apr 2018 11:01:31 +0000 (13:01 +0200)]
Bump to odlparent 2.0.6

Change-Id: I653117c7c009d2f596e8126016c6ca031e1fc435
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoConsider submodule imports when sorting modules 75/70975/6
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>
(cherry picked from commit 35b996f47d08204bdef19f49b5141307cf8c6e0d)

6 years agoAdd ModuleDependencySortTest 80/70980/3
Robert Varga [Thu, 12 Apr 2018 22:31:26 +0000 (00:31 +0200)]
Add ModuleDependencySortTest

We are missing an explicit test suite, start one.

Change-Id: I93e17df5c178d134a5d5a3bd586b398f93b0c4f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7af7d75cdda87b6a94b5b0f42bc3151ad46984a3)

6 years agoAdd YangConstants.operation{Input,Output}QName() 18/70818/4
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>
(cherry picked from commit 410be68c91e90c8a95f974d46303c45745e0784c)

6 years agoAdd QName.withModule(QNameModule) method 17/70817/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.

Change-Id: Ib1ca72210c0114610dafba0dfbbce15a2b8ddc03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 010c1f2204d4f0408a10b81a51c14933522825ad)

6 years agoImprove ClassLoaderUtils.loadClassWithTCCL() 60/70660/1
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>
(cherry picked from commit 4a3cc19a42b3740ec518569ca274153b66f2bc82)

6 years agoFix leafref require-instance implementation 15/70215/2
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>
(cherry picked from commit 38ca7ba1b5222af644f0e782f2876db9e9a58f05)

6 years agoRevert "Realign ImmutableMapNodeBuilder and XML JSON builder" 56/70056/2
Luis Gomez [Sun, 25 Mar 2018 16:29:52 +0000 (16:29 +0000)]
Revert "Realign ImmutableMapNodeBuilder and XML JSON builder"

This reverts commit 69af38512473463b4e8be9f8b30c80f727b31d84,
which breaks data formatting

JIRA: YANGTOOLS-870
Change-Id: Id0a4672da33ec0d5b17cd5a6cd3ca21fa652b1c2
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
6 years agoRealign ImmutableMapNodeBuilder and XML JSON builder 36/68436/7
Atul Gosain [Fri, 16 Feb 2018 20:41:32 +0000 (12:41 -0800)]
Realign ImmutableMapNodeBuilder and XML JSON builder

This patch removes the AugmentationNode wrapper for mapEntryNodes
as the ImutableMapNodeBuilder expects a different heirarchy.

This made the JSON parsing to normalized node in parity with XML codec.

JIRA: NETCONF-486
Change-Id: I25d32acfe7797e0744b42ef7a5f46ab01971c2a8
Signed-off-by: Atul Gosain <agosain@luminanetworks.com>
6 years agoOptimize augment conflict checking 41/69241/2
Robert Varga [Thu, 8 Mar 2018 01:12:43 +0000 (02:12 +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>
(cherry picked from commit 6e4ed947d08856771dbbdf428ba84c44aed45126)

6 years agoFix format string 21/69121/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>
(cherry picked from commit 923eebd3356ac4c02951d398ba3161d4337272e3)

6 years agoValidate parsed QName to identity 79/69079/3
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>
(cherry picked from commit 86ed935221b79680e8aca7a5e561fed6d89ed084)

6 years agoValidate parsed QName to identity 75/69075/3
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>
(cherry picked from commit e7e0e48e6a79b08bb2c976ee3fd69582d84a7e4c)

6 years agoReport parent SchemaPath on error 70/68770/2
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>
(cherry picked from commit f4508dfa04fde2d935c7fbf4da265b7647ee9f8b)

6 years agoCorrect error message 69/68769/2
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>
(cherry picked from commit 995bd31c6db2b531bce117a21af7149f74ec7fe3)

6 years agoYANGTOOLS-813: add parent schemapath to error report 68/68768/2
Robert Varga [Mon, 20 Nov 2017 13:13:31 +0000 (14:13 +0100)]
YANGTOOLS-813: add parent schemapath to error report

It is not immediately clear in what context the search is being
made -- make sure we report parent path, too.

Change-Id: I86a15b409c6241d93f24ee75cc68ff78fc067ebc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0c28880fd3df1ba253161b6b75f63f2d7a6e7c02)

6 years agoEncapsulate regexes in a non-capturing group 61/68461/2
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>
(cherry picked from commit 42b62f098cbabbc286c3a506494c5e280f6c365b)

6 years agoMove Bug4079/Bug5410 tests from yang-parser to yang-model-util 57/68457/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>
(cherry picked from commit cc0855ee7a788a4ef96592f055e8a22698f024b3)

6 years agoBump versions by x.y.(z+1) 98/68598/1
Thanh Ha [Fri, 23 Feb 2018 21:20:43 +0000 (16:20 -0500)]
Bump versions by x.y.(z+1)

Change-Id: Ie4c1a9711111f4bb762dab0f6cc7a73d45b1e5c5
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
6 years agoFix invalid enum definition error string 73/68073/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>
(cherry picked from commit 53eed9f4e005035353b721c7d12f29057ff1f307)

6 years agoCorrect double-quoted string whitespace trimming 03/67903/4
Robert Varga [Sun, 4 Feb 2018 20:04:57 +0000 (21:04 +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>
(cherry picked from commit 664c9179f9b7dc85a1cf7ef004fbd2da849dceae)

6 years agoAllow shared JSONNNSWriter use 28/63928/4
Stephen Kitt [Wed, 20 Sep 2017 14:33:05 +0000 (16:33 +0200)]
Allow shared JSONNNSWriter use

JSONNormalizedNodeStreamWriter.createNestedWriter() gives the
impression that it can be used with an externally-controlled
JsonWriter, e.g. to build a JSON document containing several
serialised NormalizedNode instances. However, since it closes the
JsonWriter when closed itself, it limits the possible uses: currently,
a writer ends up having the same lifetime as a JsonWriter, even though
it doesn’t really have the same scope (because of the SchemaPath in
particular).

This patch changes the behaviour so that the provided JsonWriter has
an independent lifecycle (and needs to be closed by callers). I will
follow up with patches to the few users in ODL.

Change-Id: I9c597fe96937867cffdcbeeddd4b1507de20f2ee
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3b56649b16a40841ff0caef191da42a0d9e73a16)

6 years agoHandling empty text nodes 64/67864/1
Atul Gosain [Wed, 29 Nov 2017 02:07:08 +0000 (18:07 -0800)]
Handling empty text nodes

This is a fix for an issue seen in the patch 63984 on yangtools.
It handles text nodes which are empty.

Change-Id: I6cf1096c511758154df6121d26bf36184385403f
Signed-off-by: Atul Gosain <agosain@luminanetworks.com>
(cherry picked from commit cedf67270d96f385d0c2154582c6ada267b0c005)

6 years agoYANGTOOLS-841: Fix SchemaContextUtil.findNodeInSchemaContext() 29/66829/3
Robert Varga [Tue, 2 Jan 2018 10:23:44 +0000 (11:23 +0100)]
YANGTOOLS-841: Fix SchemaContextUtil.findNodeInSchemaContext()

When performing recursive node lookup, consider
{Action,Notification}NodeContainers, so that we correctly resolved
nested actions and notifications -- which are new elements in RFC7950
metamodel.

Also generalized RPC input/output lookup to work on actions, too.

Change-Id: I877061c7f0370caf1ed04eb9420a43af3b2d3915
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoYANGTOOLS-766: add RFC7951JSONInstanceIdentifierCodec 74/66774/5
Robert Varga [Wed, 27 Dec 2017 01:00:26 +0000 (02:00 +0100)]
YANGTOOLS-766: add RFC7951JSONInstanceIdentifierCodec

RFC7951 non-present prefixes result in last argument namespace reuse,
hence refactor AbstractStringInstanceIdentifierCodec to allow for QNames
to be instantiated using a memoized QNameModule.

The default implementation routes to createQName("", localName), which
preserves backwards compatibility. A specialized subclass
of JSONInstanceIdetifierCodec is created to use memoized QNameModule,
and it is wired to RFC7951 codec supplier.

A similar update is done in AbstractNamespaceCodec, where appendQName()
alternative, which is forwarded the last encountered QNameModule is
added -- the default routes to normal appendQName(), with RFC7951
comparing last QNameModule with current QName's and skipping prefix
serialization if they match.

This is sufficient to make related unit test pass, so remove @Ignore
from it and expand it to assert the decoded YangInstanceIdentifier.

Change-Id: Iec7996d0e1d759623c3cabcbaf0164737afa1649
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 88ed3390d89256f1857d921ccb7766ffe4b04555)

6 years agoYANGTOOLS-766: introduce JSONCodecFactorySupplier 73/66773/3
Robert Varga [Tue, 26 Dec 2017 10:57:08 +0000 (11:57 +0100)]
YANGTOOLS-766: introduce JSONCodecFactorySupplier

We need two separate instances of JSONCodecFactory factory methods,
each with its own conformance, so that we can properly spin out
codecs compliant to RFC7951 and draft-lhotka-netmod-yang-json-02.

This patch provides a new API entrypoints for specifying these, without
actually providing distinct codecs. It also provides proper JsonParserStream
factory methods which take JSONCodecFactory instead of plain SchemaContext
(and thus assuming JSONCodecFactory implementation).

Change-Id: Ib2b402ed865903432645632e89c9b0e04851a05c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit cc3f63f7d403f66a9761e27ae6afcfd30ec48df0)

6 years agoBump odlparent references to 2.0.5 53/66053/2
Robert Varga [Wed, 29 Nov 2017 09:01:07 +0000 (10:01 +0100)]
Bump odlparent references to 2.0.5

Using 2.0.4 is a leftover, bump to 2.0.5.

Change-Id: I4b6f26b5848dfcb3586fb03dba74bf526cc0a0ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG 8927: Netconf response payload fails to render in JSON 94/65394/7
Tomas Cere [Tue, 3 Oct 2017 10:36:26 +0000 (12:36 +0200)]
BUG 8927: Netconf response payload fails to render in JSON

JSONNormalizedNodeStreamWriter does not write a content of anyXml nodes
correctly mainly due to Text nodes containing whitespaces before, between
or after Element nodes. Therefore the first Text node only was serialized
to JSON and the rest of anyXML content was missing.
This patch provides fix of anyXml content serialization to JSON.

Added a fix for a null pointer for empty text node.

Change-Id: I74f34aecec1a85b2ede4be63e5b6dd74522981e4
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Atul Gosain <agosain@luminanetworks.com>
6 years agoAdd bundle packaging for yang-data-transform 35/65735/2
Stephen Kitt [Thu, 16 Nov 2017 11:14:02 +0000 (12:14 +0100)]
Add bundle packaging for yang-data-transform

This allows the module to build an OSGi bundle instead of a plain
JAR.

Change-Id: I2713fdf0aefcccf589984a7271591f4cb95d1d30
Signed-off-by: Stephen Kitt <skitt@redhat.com>
(cherry picked from commit 4bd7a3afe8fdedefbbb632ec4285a75f46765442)

6 years agoBump versions by x.y.(z+1) 93/65993/1
jenkins-releng [Tue, 28 Nov 2017 03:49:05 +0000 (03:49 +0000)]
Bump versions by x.y.(z+1)

Change-Id: I48a4c53fa1e0d80c7e5f67a14215e458ff440c12
Signed-off-by: jenkins-releng <jenkins-releng@opendaylight.org>
6 years agoYANGTOOLS-826: allow whitespace after function name 03/65303/1
Robert Varga [Tue, 7 Nov 2017 14:09:45 +0000 (15:09 +0100)]
YANGTOOLS-826: allow whitespace after function name

As per https://www.w3.org/TR/1999/REC-xpath-19991116/#exprlex:

"For readability, whitespace may be used in expressions even though
not explicitly allowed by the grammar: ExprWhitespace may be freely
added within patterns before or after any ExprToken."

Add optional whitespace to the pattern to allow for this.

Change-Id: Iea5f7c9539734a5b5d3c1bb7367e615af4d1f9cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 323127cf3a2dcab15e3066b415213e29f55f0516)

6 years agoYANGTOOLS-827: fix revision compare 78/65278/2
Robert Varga [Tue, 7 Nov 2017 18:28:53 +0000 (19:28 +0100)]
YANGTOOLS-827: fix revision compare

When revision statements do not follow guidance from RFC6020/RFC7950
section 7.1.9 and are not order in the order of descending date and
the delta between previous and next version strings is not exactly 1,
we end up picking the wrong version.

This is caused by wrong compareTo() check, which should compare '< 0',
not '== -1'.

Change-Id: Ib7f9a77a9950b6da93ffa30e4c13cc940887ad19
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoYANGTOOLS-823: take modifier into account when enforcing patterns 51/64851/1
Robert Varga [Sat, 28 Oct 2017 11:09:42 +0000 (13:09 +0200)]
YANGTOOLS-823: take modifier into account when enforcing patterns

Modifiers are an RFC7950 addition to the metamodel and need to be
accounted for to comply with the specification.

Change-Id: Ide9625812a2df26e931a2b5d472af80bba07d730
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBug 9242: Reuse deviating statement contexts 44/64644/1
Igor Foltin [Tue, 17 Oct 2017 14:08:18 +0000 (16:08 +0200)]
Bug 9242: Reuse deviating statement contexts

In the process of deviate add/replace resolution we make
copies of deviated statement contexts which are then added
to the deviation target context.

However, making copies of these statement contexts is not
necessary except the ones which represent unknown statements.

Therefore, reuse them during the resolution of deviate add/replace.

By doing this, we also solve the failing deviate replace with
user-defined types as statement contexts that represent deviating
user-defined types are now resolved within their original context.

Change-Id: Ie61a38e270ef648fe61ea283805d149533c10f62
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoBug 9244: Fix deviate replace of implicit substatements 17/64517/1
Igor Foltin [Tue, 17 Oct 2017 09:07:51 +0000 (11:07 +0200)]
Bug 9244: Fix deviate replace of implicit substatements

In case when a deviate replace of a config/mandatory/max/min-elements
substatement targets a node which does not contain an explicitly declared
config/mandatory/max/min-elements, YANG statement parser throws an exception
because it did not find the substatement in the target node.

However, according to RFC6020/7950, these properties are always implicitly
present. Therefore, perform a deviate add instead of throwing an exception
in this particular case.

Change-Id: I79e5c427040c81db7f2f68ebcfa71b274d48816d
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoDo not use String.replace() 34/64434/1
Robert Varga [Sat, 16 Sep 2017 08:28:49 +0000 (10:28 +0200)]
Do not use String.replace()

This forces a Pattern compilation, which we do not really want.
Pre-compile the patterns instead.

Change-Id: Ibcb9f911f4a4089f375264b75ce2f5d9c5f46447
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 359c773d8bffa2caba25cdaf2561ede71fe90736)

6 years agoFix checkArgument() format string 33/64433/1
Robert Varga [Mon, 16 Oct 2017 16:27:16 +0000 (18:27 +0200)]
Fix checkArgument() format string

{} is the wrong placeholder, fix it to %s.

Change-Id: Ibbec204bd3752d05ab381d4834d847141cc28a4a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9dfdd87e26d6ce11e6b1284b93a886958034a921)

6 years agoBug 9241: Action definition should implicitly define input/output 98/64298/1
Igor Foltin [Fri, 13 Oct 2017 10:02:58 +0000 (12:02 +0200)]
Bug 9241: Action definition should implicitly define input/output

Empty input and output statements are now automatically added to
every action statement that does not declare them explicitly.

Change-Id: I41c037657e83b8e53d314d9b9c6c691ef99e993f
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoFix AugmentationIdentifier.compareTo() 11/64111/1
Robert Varga [Sat, 7 Oct 2017 12:16:36 +0000 (14:16 +0200)]
Fix AugmentationIdentifier.compareTo()

The implementation assumed stable Set iteration order, which was
not internally guaranteed, hence two AugmentationIdentifiers could
report as being equal via equals(), but still compare as having
different total ordering -- which could lead to strange results.

Fix this by doing some more work and compare them based on QName's
total ordering. The test suite is fixed up to use explicit iteration
order retained by ImmutableSet rather than relying on HashSet's
hashCode()-based iteration order non-determinism.

Also remove implicit boolean boxing by using assertTrue/assertFalse
in tests.

Change-Id: Iafd4ac8d7d54f0918b0579c6e6f8e76b35b56dd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 77b8e16d3a2abfb368d2974a473154fe255f903e)

6 years agoBUG-9218: package yang-model-export 39/63839/1
Robert Varga [Fri, 29 Sep 2017 10:03:45 +0000 (12:03 +0200)]
BUG-9218: package yang-model-export

Downstreams are using this artifact and are actively packaging it
themselves. Fix this by including it with the parser.

Change-Id: If1c6752ac7dd64c933ea7a74ef0ba9ea10e87f1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump odlparent 2.0.4 to 2.0.5 69/63769/1
Stephen Kitt [Wed, 27 Sep 2017 13:35:45 +0000 (15:35 +0200)]
Bump odlparent 2.0.4 to 2.0.5

Change-Id: I11d5ca5ff224338a5543f13edbe398e545bc8038
Signed-off-by: Stephen Kitt <skitt@redhat.com>
(cherry picked from commit 4f8b34fe2d421cae89e6e668b2d5a7f4b289ccac)

6 years agoOverride toString() in Yang/YinStatementStreamSource 85/63085/2
Igor Foltin [Mon, 11 Sep 2017 11:04:07 +0000 (13:04 +0200)]
Override toString() in Yang/YinStatementStreamSource

Yang/YinStatementStreamSource objects are used in log messages
within the YANG statement parser. In order to provide useful
information they need to have the toString() method overridden.

Change-Id: I2bfdda8a6a58256e6f4e1e113b4a5a8174c73ef7
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
(cherry picked from commit ae6268b37a15a3964429dbf125a7661cdc67edc9)

6 years agoBug 7246 - Fix of SchemaTracker initialization and lookup of schema nodes 41/62541/2
Peter Kajsa [Mon, 14 Aug 2017 17:35:33 +0000 (19:35 +0200)]
Bug 7246 - Fix of SchemaTracker initialization and lookup of schema nodes

SchemaUtils methods perform lookup in both the namespace of groupings and
the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs,
actions, notifications, anydatas, and anyxmls. In consequence, performed
lookups are ambiguous due to possible name conflicts between these namespaces.

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

6 years agoBug 8713 - BGP models not compatible with leafref context 90/62890/2
Peter Kajsa [Thu, 7 Sep 2017 11:18:22 +0000 (13:18 +0200)]
Bug 8713 - BGP models not compatible with leafref context

Lookup of parent module should be performed based on the first path
argument from root not the last one.

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

6 years agoBump versions by x.y.(z+1) 79/63579/1
Thanh Ha [Tue, 26 Sep 2017 21:13:13 +0000 (17:13 -0400)]
Bump versions by x.y.(z+1)

Change-Id: I47e978ce4bcb3b13218cf2d4c373f805dea8e7dc
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
6 years agoThrow SourceException instead of IllegalArgumentException 61/62361/1
Robert Varga [Sat, 26 Aug 2017 16:50:55 +0000 (18:50 +0200)]
Throw SourceException instead of IllegalArgumentException

TypeUtils already considers StatementSourceReference, so instead
of home-grown format use SourceException.throwIf().

Change-Id: Ifc81db735d72bb7c98b94c66ac013f8dcc47413c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4a6f8307db1a3e9f31608a73924f48ed2ea7dc6e)

6 years agoBug 9005 - scope of model import prefix should be module/submodule 60/62260/1
Peter Kajsa [Fri, 18 Aug 2017 10:24:32 +0000 (12:24 +0200)]
Bug 9005 - scope of model import prefix should be module/submodule

Yang parser includes all substatements of a submodule into a parent
module including all import statements of the submodule, what causes
mismatch of parent module imports.

Change-Id: I5c0b45348ca5e9f3ae54351c93e940135fe2b99d
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 81c8d73d4d85ef015a06145b2d4315fed8efb49d)

6 years agoFix AnyXml node handling 66/62066/1
Robert Varga [Fri, 18 Aug 2017 12:56:51 +0000 (14:56 +0200)]
Fix AnyXml node handling

Fixup the mixup of calling instanceof on an Optional.

Change-Id: I184e2ad7535129cf19c41dfd5c235285e82e9f28
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7746599ddc0043b518e263faf8a41aa0e3653f92)

6 years agoUpdate .gitreview to v1.2.x 68/61668/1
Thanh Ha [Mon, 14 Aug 2017 16:37:39 +0000 (12:37 -0400)]
Update .gitreview to v1.2.x

Change-Id: I929fefa2b1e5079e5efbcc53212f1a281efb0ce6
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
6 years agoUpdate .gitreview to stable/nitrogen 67/61667/1
Thanh Ha [Mon, 14 Aug 2017 16:24:04 +0000 (12:24 -0400)]
Update .gitreview to stable/nitrogen

Change-Id: If6efd078cae174868ec2ee5b8016b4b877674c2d
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
6 years agoBug 8691 - Update yang-parser-impl grammars 39/61539/2
Peter Kajsa [Fri, 11 Aug 2017 09:38:08 +0000 (11:38 +0200)]
Bug 8691 - Update yang-parser-impl grammars

Update of YangStatementLexer.g4 after migration to antlr 4.7.

Change-Id: Ie2482c1b155a0119862f855738c5f55d8df938c8
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
6 years agoRemove duplicate version declaration 88/61488/2
Robert Varga [Thu, 10 Aug 2017 11:25:10 +0000 (13:25 +0200)]
Remove duplicate version declaration

odlparent is declaring this for use, no need to repeat it here.

Change-Id: Ic426ae0fa01f14f90a4c4355106e2420794de1dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBug 8922 - Evaluation of if-features is done regardless of ancestors 77/61377/5
Peter Kajsa [Tue, 8 Aug 2017 16:11:16 +0000 (18:11 +0200)]
Bug 8922 - Evaluation of if-features is done regardless of ancestors

Evaluation of if-features for a statement is done regardless of its
ancestors. This is not correct and if an ancestor of a statement is
not supported by features, then current statement should be
unsupported too. In other words, if a statement is not supported by
features, then all its children should be unsupported too.

Change-Id: Ieb8a3c32849808a4492f518f4481aaef45c11cae
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
6 years agoMake sure binary values are properly wrapped 64/61464/1
Robert Varga [Thu, 10 Aug 2017 00:23:46 +0000 (02:23 +0200)]
Make sure binary values are properly wrapped

Leaking byte[] in case binary leaves an avenue for data modification.
Disallow that by always cloning byte[].

Change-Id: Ic3cde28a4af19800d00f0f1e1ab9084b6e6951ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump odlparent 2.0.2 to 2.0.4 55/61355/4
Stephen Kitt [Tue, 8 Aug 2017 16:14:12 +0000 (18:14 +0200)]
Bump odlparent 2.0.2 to 2.0.4

Change-Id: I17495da43f8cbde07cabcb9d9657737af2e450de
Signed-off-by: Stephen Kitt <skitt@redhat.com>
6 years agoBug 8940: Fix XML parsing of anyxml nodes 21/61421/1
Igor Foltin [Wed, 9 Aug 2017 12:06:03 +0000 (14:06 +0200)]
Bug 8940: Fix XML parsing of anyxml nodes

The new XML parser unescapes already escaped special characters
in anyxml nodes which triggers an exception when loading parsed
anyxml data into org.w3c.dom.Document object.

Use the Guava's XmlEscapers to properly handle special escaped
characters in anyxml nodes.

Change-Id: Ifa79f7d6f6736253afc5092afded5f118bf84ab5
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoEnforce no split packages 12/61212/6
Robert Varga [Fri, 4 Aug 2017 21:56:32 +0000 (23:56 +0200)]
Enforce no split packages

This adds a guard to prevent accidental split packages.

Change-Id: I063ec1ee6090c60d177c22c9ad8cbeafb54f70ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoReduce CheckedFuture proliferation 36/61236/3
Robert Varga [Sun, 6 Aug 2017 14:05:36 +0000 (16:05 +0200)]
Reduce CheckedFuture proliferation

We are not really using checkedGet() here, hence we can switch
to ListenableFuture.

Change-Id: I7c8e7bbcdc6fe180a88d27079196b9a69cc67dd0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove unneeded version declaration 32/61232/1
Robert Varga [Sun, 6 Aug 2017 13:26:52 +0000 (15:26 +0200)]
Remove unneeded version declaration

These versions are declared upstream, no need to repeat them here.

Change-Id: Iac58a882ebbb57206348b48165f013b87aca9ff6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBug 8831 - Yang 1.1 default values are not checked correctly 70/61170/3
Peter Kajsa [Fri, 4 Aug 2017 13:28:29 +0000 (15:28 +0200)]
Bug 8831 - Yang 1.1 default values are not checked correctly

When a leaf has a union type, and a default that does not correspond
to the first member of that union type, the default is not processed
correctly and IllegalStateException is thrown during the check of if-feature
statements. The same bug occurs also in case, when the default is a
number, which is in the range of the first member of the union etc..

Change-Id: Ic3b165eb5c4416dee2216f47c240ce596e3f7dd2
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
6 years agoCleanup JSONCodecFactory.create() users 98/61098/1
Robert Varga [Thu, 3 Aug 2017 09:33:30 +0000 (11:33 +0200)]
Cleanup JSONCodecFactory.create() users

JSONCodecFactory.create() is deprecated, use getShared() instead.

Change-Id: I2abf0350391e067e3668760f88776130cf14f74e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoCleanup SchemaTracker logic 97/61097/1
Robert Varga [Thu, 3 Aug 2017 09:29:44 +0000 (11:29 +0200)]
Cleanup SchemaTracker logic

Do not perform duplicate null checks.

Change-Id: If1fa8631e9e6d93fa2063bea0c395d3fdcba87ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUse Objects.requireNonNull instead of Preconditions.checkNotNull 74/60974/2
Robert Varga [Tue, 1 Aug 2017 09:47:27 +0000 (11:47 +0200)]
Use Objects.requireNonNull instead of Preconditions.checkNotNull

This is a Java-8 equivalent, use it to reduce dependecies on Guava.

Change-Id: Id4ec468b8908fb4d7a272af607c65b3b0bbc0583
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix/suppress checkstyle warnings 73/60973/3
Robert Varga [Tue, 1 Aug 2017 09:22:18 +0000 (11:22 +0200)]
Fix/suppress checkstyle warnings

Some of the argument names are coming from superclasses, add suppression
of those. Others can be easily renamed.

Change-Id: I75e746287fc2278790091185d967dfcc2d16d94e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoShare codepath between snapshot methods 20/60920/6
Robert Varga [Sat, 29 Jul 2017 15:34:44 +0000 (17:34 +0200)]
Share codepath between snapshot methods

Eliminate a bit of code duplication by creating a snapshot()
methods which does the looping. Also fixes up some violations
and makes the contract more explicit.

Change-Id: Ic02f9c148b85cbbef53ab632a22bc68f1c16f6b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix of Module.getPrefix() to return prefix also in case of submodule 64/59564/8
Peter Kajsa [Tue, 27 Jun 2017 12:01:53 +0000 (14:01 +0200)]
Fix of Module.getPrefix() to return prefix also in case of submodule

Module.getPrefix() returns null for all submodules.
However, in case of submodule a prefix for module's
namespace is defined in belongs-to statement.
This information is required by yang-export where
namespaces need to be binded to corresponding prefixes.

Change-Id: Ifa5406654021fd017b442b6c351a4e0b4f5fd55d
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
6 years agoDowngrade stax2-api to 3.1.4 08/60908/1
Robert Varga [Sat, 29 Jul 2017 12:21:20 +0000 (14:21 +0200)]
Downgrade stax2-api to 3.1.4

As it turns out, downstream is using jackson, which is bound
to 3.1.x version of stax2-api. Downgrade to match.

Change-Id: I7a86037abceac8499986af11392da5112570d838
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoAdd XmlParserStream.traverse(DOMSource) 64/60864/5
Igor Foltin [Fri, 28 Jul 2017 11:29:38 +0000 (13:29 +0200)]
Add XmlParserStream.traverse(DOMSource)

This adds an alternative traversal based on DOMSource. This is needed
as it seems XMLStreamReaders based on DOMSource are in short supply and
in some cases we are interpreting a part of an already-parsed Document
as a NormalizedNode.

Change-Id: I3e21daa144ca90d868f71b3f5af318f4c35cc24f
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-8733: add YangInstanceIdentifierBuilder.append() 68/60768/2
Robert Varga [Tue, 25 Jul 2017 11:27:54 +0000 (13:27 +0200)]
BUG-8733: add YangInstanceIdentifierBuilder.append()

In scope of BUG-8733 we need the ability to efficiently append
a set of PathArguments. Introduce a Builder method to do exactly
that.

Change-Id: I06e655490dd5c7e92588eeb5a5e5237479e7ff7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2671dcb87d3717b0b82e4404d02593d99300399b)

6 years agoBUG-2389: Deprecate yang-data-impl XML codec 58/60558/3
Robert Varga [Wed, 19 Jul 2017 10:51:27 +0000 (12:51 +0200)]
BUG-2389: Deprecate yang-data-impl XML codec

This codec infrastructure has been superseded by yang-data-codec-xml,
deprecate the classes for removal in 2.0.0.

Change-Id: I35b117503eafdcd7ef1268a33ec8303d43d426ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBug 8803: check for null return NamespaceContext.getNamespaceURI() 36/60736/4
Igor Foltin [Tue, 25 Jul 2017 15:18:39 +0000 (17:18 +0200)]
Bug 8803: check for null return NamespaceContext.getNamespaceURI()

The javadoc indicates that for unbound prefixes this method should be
returning NULL_NS_URI (which is defined as an empty string), and there
is no mention of the possibility of returning null anywhere.

Nevertheless JDK8-default XMLOutputWriter returns null for unbound
prefixes, which leads to an infinite loop in RandomPrefix.

Fix this by adding an explicit check for null, too.

Change-Id: Ib8af7d03eb59b004f2fcb4d1806c0f4f256a974a
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-8733: add EmptyDataTreeCandidateNode 32/60632/1
Robert Varga [Fri, 21 Jul 2017 09:07:09 +0000 (11:07 +0200)]
BUG-8733: add EmptyDataTreeCandidateNode

This class is used by multiple downstreams, hence it is useful to
expose it from DataTreeCandidateNodes.

Change-Id: I88e247c3a9a2cb7fffab4d73f6f8b7ef211a3ea0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 14f1f133238c61049894ee8047c9c253ae9a7b3a)

6 years agoMake ReadWriteTrieMap extend ForwardingMap 60/60560/4
Robert Varga [Wed, 19 Jul 2017 11:58:20 +0000 (13:58 +0200)]
Make ReadWriteTrieMap extend ForwardingMap

ForwardingMap gives us some of the implementation details we are
duplicating here. Hence subclass ForwardingMap and remove those
duplications.

Change-Id: I5cb6b839f19f2247fb7fdc78f46127739f484898
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-7464: do not depend on odlparent's triemap 62/60562/2
Robert Varga [Wed, 19 Jul 2017 12:10:17 +0000 (14:10 +0200)]
BUG-7464: do not depend on odlparent's triemap

We have our internal fork, not need to pull in odlparent packaging
of it.

Change-Id: I8910df0e484e81bb7a5c7c554833889c8ce336f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-7464: Switch to use forked TrieMap 43/51843/7
Robert Varga [Tue, 14 Feb 2017 09:13:49 +0000 (10:13 +0100)]
BUG-7464: Switch to use forked TrieMap

Switch from dead upstream to our forked version of TrieMap.

Change-Id: Ide40b87b96d16500e2a8566d3d627ca1aac8d762
Signed-off-by: Robert Varga <rovarga@cisco.com>
6 years agoBUG-7051: move yang-data support into its own package 57/60557/2
Robert Varga [Wed, 19 Jul 2017 09:36:30 +0000 (11:36 +0200)]
BUG-7051: move yang-data support into its own package

yang-data is defined in RFC8040, hence it should not live in rfc6020
package. This allows us to hide some of its details.

Change-Id: Ic965404cff5530863a873fd5d52f7e086339f911
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBug 7051 - Refactoring of StmtContextUtils 41/54841/23
Peter Kajsa [Thu, 6 Jul 2017 08:05:01 +0000 (10:05 +0200)]
Bug 7051 - Refactoring of StmtContextUtils

Refactoring of StmtContextUtils in order to remove undesired dependencies
on stmt.rfc6020 package.

Change-Id: Ia0e494ba792e9eb8a92aadebb806748af5fe8cee
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBug 8745: Add support for parsing attributes to the new XML parser 18/60018/9
Igor Foltin [Thu, 6 Jul 2017 11:53:17 +0000 (13:53 +0200)]
Bug 8745: Add support for parsing attributes to the new XML parser

New XML parser is now able to parse XML attributes in order to provide
necessary information for processing edit-config messages in NETCONF.

Make some members of ImmutableNormalizedNodeStreamWriter
protected so they can be reused
in the EditOperationNormalizedNodeStreamWriter extension in NETCONF.

Add a unit test

This patch is a prerequisite for the following change in NETCONF:
https://git.opendaylight.org/gerrit/#/c/60014/

Change-Id: Idfd87279814e324dc914809fb09abfbb27eefa4a
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoBug 8715: Add strictParsing switch to the new XML parser 67/59167/11
Igor Foltin [Mon, 19 Jun 2017 12:37:20 +0000 (14:37 +0200)]
Bug 8715: Add strictParsing switch to the new XML parser

Add the option to switch strict parsing mode on/off to
the new XML parser. If the mode is switched on, the parser
will throw an exception if it encounters unknown child nodes
in YANG containers and lists. If the mode is off, the parser
will skip such nodes.

Change-Id: Ieece9b15ced06282a43877c2c1e884515217244b
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoBug 8675: Fix a design flaw of the new XML parser 36/59036/12
Igor Foltin [Thu, 15 Jun 2017 14:51:24 +0000 (16:51 +0200)]
Bug 8675: Fix a design flaw of the new XML parser

The actual flaw is that the parser wraps the parentNode
SchemaNode inside a CompositeNodeDataWithSchema which emits
only its child nodes into the provided NormalizedNodeStreamWriter.
The parentNode itself is not emitted which is a problem.
Therefore we need to check the parentNode type and put it
into a corresponding ...NodeDataWithSchema.

Bug description on bugzilla has been updated with a more
thorough explanation.

Adjust existing unit tests accordingly.

Add javadocs to ...NodeDataWithSchema classes.

Change-Id: I900717f652cd93e36c229bc91d3854b5ab99f09a
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoBUG-6972: eliminate StmtContext.getOrder() 63/60063/3
Robert Varga [Fri, 7 Jul 2017 08:41:13 +0000 (10:41 +0200)]
BUG-6972: eliminate StmtContext.getOrder()

This is not really used, so try to eliminate it, saving a couple
of bytes in StatementContextBase.

Change-Id: If9a5126c9110f50324bb94b7fecdb3845874b763
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-6972: Add OptionaBoolean utility 50/60050/7
Robert Varga [Fri, 7 Jul 2017 00:22:06 +0000 (02:22 +0200)]
BUG-6972: Add OptionaBoolean utility

This utility allows us to store an optional boolean in a byte field,
reducing the cost from 2 bytes (two boolean fields) or 4/8 bytes
(reference) to a single byte.

Also converts eligible classes. Trims down StatementContextBase
and DeviateEffectiveStatementImpl.

Change-Id: I5444bd4bb7aa0ea52202b08fcfcf9207ea045fa9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump odlparent to 2.0.2 09/60109/1
Robert Varga [Sun, 9 Jul 2017 17:13:34 +0000 (19:13 +0200)]
Bump odlparent to 2.0.2

Adjust to new release.

Change-Id: Ibafa857802141994140027f203656eee64323694
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBug 7051 - moving of SubstatementValidator into spi.meta package 29/59929/1
Peter Kajsa [Tue, 4 Jul 2017 10:56:39 +0000 (12:56 +0200)]
Bug 7051 - moving of SubstatementValidator into spi.meta package

Moving of SubstatementValidator into spi.meta package in order
to remove undesired dependencies between parser packages.

Change-Id: If0b3bb969c25c37fb4658fa9c4659d53e13c04bb
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
6 years agoBump odlparent dependency to 2.0.1 52/59852/1
Robert Varga [Mon, 3 Jul 2017 08:52:47 +0000 (10:52 +0200)]
Bump odlparent dependency to 2.0.1

Bumps odlparent to latest release.

Change-Id: I42d4b70ebb140696c269301cfb2ca405bf061487
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix uninitialized ExtensionDefinition for openconfig-version 40/59240/2
Igor Foltin [Tue, 20 Jun 2017 14:01:17 +0000 (16:01 +0200)]
Fix uninitialized ExtensionDefinition for openconfig-version

The StatementDefinition for openconfig-version extension is
not bound to any revision. When populating the ExtensionNamespace
with openconfig-version, we have to store it with a revisionless
QName key. This way we can properly extract the corresponding
ExtensionDefinition later down the road in the
UnknownEffectiveStatementBase.

This issue causes NPE in MDSAL's binding generator v2.

Change-Id: Ie24c09b56986c87b5118d715ec6c8e755cf07ebe
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
6 years agoBump odlparent dependency to 2.0.0 73/50173/13
Robert Varga [Wed, 21 Jun 2017 14:03:22 +0000 (16:03 +0200)]
Bump odlparent dependency to 2.0.0

This patch updates the dependency to 2.0.0. Furthermore it eliminates
karaf 3 features and fixes Guava changes.

Change-Id: I2f9d3bda9ed12c58ca44f44e66f1110cceaf200b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove use of ALTLRInputStream 22/59022/1
Robert Varga [Thu, 15 Jun 2017 12:20:37 +0000 (14:20 +0200)]
Remove use of ALTLRInputStream

As of 4.7, CharStreams is a better interface for this same
functionality.

Change-Id: I1ceadded34654fbfe3f4e4402b714c21c857fe4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBump antlr4 to 4.7 42/58942/3
Robert Varga [Wed, 14 Jun 2017 12:05:48 +0000 (14:05 +0200)]
Bump antlr4 to 4.7

https://github.com/antlr/antlr4/releases/tag/4.6
https://github.com/antlr/antlr4/releases/tag/4.7

Change-Id: I0600e2fe5914a966cf0cb8528f853285de83d490
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBe strict about boolean arguments 70/58270/42
Robert Varga [Mon, 5 Jun 2017 16:55:50 +0000 (18:55 +0200)]
Be strict about boolean arguments

RFC6020 and RFC7950 mandate the argument to be either 'true' or 'false',
which is different from Boolean.valueOf(String), which accepts any
string. Fix this by providing our own parse method.

Change-Id: I87d39d5a9238f79cb34c66efa08ed67c2a02eb82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMigrate to odlparent 1.9.0 29/58829/3
Thanh Ha [Tue, 13 Jun 2017 15:48:44 +0000 (11:48 -0400)]
Migrate to odlparent 1.9.0

Change-Id: I03df34a82c721da72e087241c36928a668a90d45
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
6 years agoBug 2444 - fix of several issues in yang-model-export 16/57816/12
Peter Kajsa [Thu, 25 May 2017 13:42:57 +0000 (15:42 +0200)]
Bug 2444 - fix of several issues in yang-model-export

Add Yin export of:
- action, anydata and modifier statements
- must statement in notification, input and output
- description and reference in import statements
- notification statements in data nodes
- unique statement in list statements
- optional of organisation and contact statements
- require-instance statement in leafref specification
- length statement in binary specification
- multiple base identities in identity-ref type
  and identity definition
- default values in leaf-list statement

Change-Id: I1e1662716caaf8fe118bb7db55148bc13ee81951
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
6 years agoFix sonar complaints around generic type naming 15/58815/1
Robert Varga [Tue, 13 Jun 2017 12:18:41 +0000 (14:18 +0200)]
Fix sonar complaints around generic type naming

A, D are what we are using elsewhere, so shorten AT/DT to those
to keep sonar happy.

Change-Id: I3c42eb2c5bc0e87048059619e254ab52f204ad8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-7052: extract SimpleSchemaContext 52/58752/4
Robert Varga [Mon, 12 Jun 2017 16:42:51 +0000 (18:42 +0200)]
BUG-7052: extract SimpleSchemaContext

Some parts of EffectiveSchemaContext are not dependent on parser
proper and just fill out the blanks left by AbstractSchemaContext.

Extract these bits into SimpleSchemaContext for wider reuse.

Change-Id: I72238ec67b958e3e7918e399e9643264b11860db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-7052: deprecate YangParseException 51/58751/3
Robert Varga [Mon, 12 Jun 2017 16:15:40 +0000 (18:15 +0200)]
BUG-7052: deprecate YangParseException

This exception is no longer used and should be removed to reduce
confusion.

Change-Id: Ie5c298c8e8a5aa4bdd11ecf5768d14f5584f1344
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-7052: Move ModuleDependencySort to yang-model-util 50/58750/3
Robert Varga [Mon, 12 Jun 2017 16:05:10 +0000 (18:05 +0200)]
BUG-7052: Move ModuleDependencySort to yang-model-util

This is a useful utility which has no dependencies on parser proper,
hence should be part of yang-model-util.

Change-Id: I8c584d61e57ec513261e59f0fa306f50747b7b5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBypass array-based sort 46/58746/3
Robert Varga [Mon, 12 Jun 2017 15:21:42 +0000 (17:21 +0200)]
Bypass array-based sort

This makes unneeded copies, move over to Iterable-based sort.

Change-Id: I58d4b6b31e4e7927c1139bc6e2920a4e783597f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-7052: Move TopologicalSort to util package 44/58744/3
Robert Varga [Mon, 12 Jun 2017 14:56:50 +0000 (16:56 +0200)]
BUG-7052: Move TopologicalSort to util package

This utility has no dependencies on parser and is generally useful.
Expose it as a beta API from util package.

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