yangtools.git
5 years agoRefactor implementations to hide XMLStreamWriter 71/79771/3
Robert Varga [Wed, 16 Jan 2019 15:23:21 +0000 (16:23 +0100)]
Refactor implementations to hide XMLStreamWriter

In order to have control over when we output an element, we need
to make sure we know how the writer is being used.

Refactor XMLStreamNormalizedNodeStreamWriter interaction with its
subclasses so we know when we are leaking the writer -- which
happens only in writeValue().

JIRA: YANGTOOLS-927
Change-Id: I7e7bd62016e994a31fe6d69995e9d088746359da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 127cfbef06dec06721efc4fafe2e9ab551c644e6)

5 years agoBump versions for 2.0.17-SNAPSHOT 29/79729/1
Robert Varga [Sat, 19 Jan 2019 11:40:14 +0000 (12:40 +0100)]
Bump versions for 2.0.17-SNAPSHOT

This starts the next release development.

Change-Id: I0f19deaf1c7f1d12107f9880b834d63d1de9d8b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to odlparent 3.1.6 31/79631/1
Stephen Kitt [Thu, 17 Jan 2019 13:41:29 +0000 (14:41 +0100)]
Bump to odlparent 3.1.6

Change-Id: Id89e75d896a1f9863afec520f8dce47a6fe4eef6
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoDo not write empty string in EmptyXmlCodec 90/79590/1
Robert Varga [Wed, 16 Jan 2019 21:38:04 +0000 (22:38 +0100)]
Do not write empty string in EmptyXmlCodec

Emitting an empty string does nothing but churn writer state,
so speed up EmptyXmlCodec by not touching the writer.

Change-Id: Iab7db37089b84ec1a3c2e3c9381265025e21fdca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix default namespace emission 50/79550/1
Robert Varga [Tue, 15 Jan 2019 18:19:08 +0000 (19:19 +0100)]
Fix default namespace emission

When we are emitting opening a new element, we need to consult
XMLStreamWriter before we emit the element, otherwise its state
already reflects the newly-started element.

In non-repairing mode the JDK writer will accept our invocation
and update the namespace mapping, which will lead us to erroneously
assume we do not need to emit the declaration.

Since it is non-repairing, it will not emit the declaration itself,
leading to a blank document -- something for which we are actually
testing in one of our tests.

In order to improve the confidence in results, also update tests
which used only repairing factories to use both repairing and
non-repairing ones.

JIRA: YANGTOOLS-801
Change-Id: I6975cf21121f7a8f92056b5b49b31d53b685dc0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 706aaed3e21eb3c5d080ee974f27b9348c3d2e92)

5 years agoImprove JAXP implementation compatibility 49/79549/1
Robert Varga [Tue, 15 Jan 2019 16:50:03 +0000 (17:50 +0100)]
Improve JAXP implementation compatibility

Testing with woodstox-core shows a couple of UT failures that
are really assumptions on the implementation. Address them so we
do not get failures when implementation changes (too much).

While we are at it, improve startsWith/contains string checks
by using hamcrest.

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

5 years agoAttach aggragate javadocs to aggragator 96/79096/1
Robert Varga [Mon, 24 Dec 2018 21:23:13 +0000 (22:23 +0100)]
Attach aggragate javadocs to aggragator

This allows us to point users to our aggregated javadocs, hence
they do not fish for them.

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

5 years agoShorten StatementMap$Regular.get(int) 56/79056/1
Robert Varga [Wed, 26 Dec 2018 02:36:03 +0000 (03:36 +0100)]
Shorten StatementMap$Regular.get(int)

We can use a trigraph instead of a if/return combo, saving an
instruction.

Change-Id: If1482da5a4cf83f87b4d995333d757d2fa2d7e12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix StatementMap$RegularAsCollection's size 53/79053/2
Robert Varga [Wed, 12 Sep 2018 09:29:40 +0000 (11:29 +0200)]
Fix StatementMap$RegularAsCollection's size

We are not initializing the size field, hence the class does not
operate correctly. Fix that and correct isEmpty() method.

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

5 years agoCleanup RFC6020_YIN_NAMESPACE usage 49/79049/2
Robert Varga [Tue, 25 Dec 2018 22:29:08 +0000 (23:29 +0100)]
Cleanup RFC6020_YIN_NAMESPACE usage

In export write we really want to use RFC6020_YIN_NAMESPACE_STRING,
not RFC6020_YIN_NAMESPACE, making references proper constants.

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

5 years agoFix noRev map efficiency 47/79047/2
Robert Varga [Tue, 25 Dec 2018 23:07:24 +0000 (00:07 +0100)]
Fix noRev map efficiency

QName.getRevision() always returns non-null, which means we are
always taking the slow version of this branch, as correctly flagged
by Eclipse.

Furthermore we can use QName.withoutRevision() to side-step QName's
localName validation, as the local name is known to have already
been checked.

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

5 years agoSpeed up StatementContextVisitor.getValidStatementDefinition() 44/79044/2
Robert Varga [Tue, 25 Dec 2018 22:18:49 +0000 (23:18 +0100)]
Speed up StatementContextVisitor.getValidStatementDefinition()

Unprefixed statements are most common and we end up creating
a QNameModule each time we encounter them, while we have a common
constant which we can use.

Use the constant, allowing us to allocate fewer objects while
also allowing making interning work.

Change-Id: I9e8847f8bd39fb9bcf6f8d0e8b86d196aeb5e2cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to .16-SNAPSHOT 87/78987/1
Robert Varga [Fri, 21 Dec 2018 23:17:57 +0000 (00:17 +0100)]
Bump versions to .16-SNAPSHOT

This starts the 2.0.16 development iteration.

Change-Id: I36298775de0fa1e228f6386df17bc7ff3fe17b4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to odlparent 3.1.5 49/78949/2
Robert Varga [Fri, 21 Dec 2018 21:46:41 +0000 (22:46 +0100)]
Bump to odlparent 3.1.5

Change-Id: I9c0a3b8c3c4b2c3d03bb8e3df623d87cd70d724b
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd karaf distribution 74/78974/1
Robert Varga [Fri, 21 Dec 2018 18:30:47 +0000 (19:30 +0100)]
Add karaf distribution

This adds a karaf distribution for the purposes of validating
upstream (odlparent) packaging.

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

5 years agoBump to odlparent-3.1.5-SNAPSHOT 73/78973/1
Robert Varga [Fri, 21 Dec 2018 21:43:33 +0000 (22:43 +0100)]
Bump to odlparent-3.1.5-SNAPSHOT

This bumps to current development version for validation purposes.

Change-Id: I39cdf113bae58184e7601dc160dc97554c1ca280
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoIntern empty leaves 87/78887/1
Robert Varga [Thu, 20 Dec 2018 09:43:09 +0000 (10:43 +0100)]
Intern empty leaves

This patch teaches LeafInterner to intern leaves holding Empty,
as they have only one possible value.

Change-Id: I5afa161ec49b02c33a3e7be28bcda135b6d796cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to 2.0.16-SNAPSHOT 38/78638/1
Robert Varga [Tue, 11 Dec 2018 09:29:37 +0000 (10:29 +0100)]
Bump versions to 2.0.16-SNAPSHOT

This starts the next development cycle.

Change-Id: Ibdcd4ded6a069a64899d52357efe64b4c175da4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPreserve attributes when parsing AnyXml from XML 79/78479/2
Jakub Morvay [Wed, 5 Dec 2018 16:29:38 +0000 (17:29 +0100)]
Preserve attributes when parsing AnyXml from XML

So far, anyxml nodes have been parsed in following pipeline:
 String -> DOM -> Stax -> String -> DOM
Now the parsing is simplified to:
 String -> DOM -> Stax -> DOM

Remove the unnecessary "back to string" step. This step is not just
unnecessary but also stripes down attributes and namespaces from AnyXml
node value.

JIRA: YANGTOOLS-923
Change-Id: If13ce9c7397c37b96a532090e67683a635ae14ef
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 335359d23557e2b54b9df539eeaed8b97668a59e)

5 years agoAllocate new keyes map lazily 22/78322/2
Robert Varga [Thu, 29 Nov 2018 14:25:35 +0000 (15:25 +0100)]
Allocate new keyes map lazily

Do not allocate the map for new mappings until it is actually needed.
This introduces some additional complexity via null checks, but that
is not something major.

Also refactor large equals() method into smaller chunks, so that it
can be inlined more easily.

JIRA: YANGTOOLS-919
Change-Id: Idb4b7a4cb7cde09af2eab0bcebfb71083e64ff2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 62876a059465a1c780eb88e9ef5f285f4a052ec2)

5 years agoBump versions to 2.0.14-SNAPSHOT 20/78120/1
Robert Varga [Sun, 25 Nov 2018 18:30:19 +0000 (19:30 +0100)]
Bump versions to 2.0.14-SNAPSHOT

This starts the next development iteration.

Change-Id: I14fd1f6e73edf822a5f250b8629aa48d6cfa1458
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSeparate out ConstantArrayCollection iterator 16/78116/1
Robert Varga [Sun, 25 Nov 2018 16:59:50 +0000 (17:59 +0100)]
Separate out ConstantArrayCollection iterator

This splits it out into its own static class.

Change-Id: I94a86c65eefdba79db2f5ec3a01b13dbad0b41b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd predicate-free NodeIdentifierWithPredicates constructor 15/78115/1
Robert Varga [Sun, 25 Nov 2018 16:55:01 +0000 (17:55 +0100)]
Add predicate-free NodeIdentifierWithPredicates constructor

This saves some time and figuring out to users, as they can just
not specify any predicates and get a free list. This side-steps
some of the code done in the Map-taking constructor.

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

5 years agoRefactor ImmutableMapEntryNodeSchemaAwareBuilder 14/78114/1
Robert Varga [Thu, 22 Nov 2018 23:43:32 +0000 (00:43 +0100)]
Refactor ImmutableMapEntryNodeSchemaAwareBuilder

This builder's logic is not entirely efficient, as it can constructs
unnecessary NodeIdentifierWithPredicates purely for checking purposes.

Furthermore we can side-step child validation when we are switching
by available children, as we have the entryset available.

JIRA: YANGTOOLS-917
Change-Id: I57d0a156ced3abce7e61403c2b390c074850d612
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c43197e66be08a0ffaa00bbe8405fa4ba23b8656)

5 years agoFactor out {SharedSingleton,ImmutableOffset}MapTemplate 13/78113/1
Robert Varga [Sun, 25 Nov 2018 10:19:25 +0000 (11:19 +0100)]
Factor out {SharedSingleton,ImmutableOffset}MapTemplate

Exposing the single-entry map case has the advantage of providing
instantiateWithValue(Object) method, side-stepping the need for
a temporary array. Split it out of ImmutableMapTemplate, so that
users can provide customized handling as needed.

The same holds true if the keyset is known to contain more than
one key, in which case using ImmutableOffsetMapTemplate can be
faster.

JIRA: YANGTOOLS-917
Change-Id: If08f492ff59bc89f3826a4122cfbcf34657c2210
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit bd16b6161802322cb33c39642ddeb8a59b3e5d48)

5 years agoImprove ListEntryNodeDataWithSchema 00/78100/2
Robert Varga [Thu, 22 Nov 2018 22:32:00 +0000 (23:32 +0100)]
Improve ListEntryNodeDataWithSchema

ImmutableMapTemplate allows us to more efficiently instantiate
NodeIdentifierPredicates, as it takes care of ordering of keys
while maintaining an efficient internal representations.

It furthermore provides a keySet() method, which is useful for
quickly checking if a leaf is part of key definition -- unlike
ListSchemaNode.getKeyDefinition(), which is a List and therefore
must be linearly searched.

It also allows us to skip HashMap allocation for unkeyed lists,
clearly showing that the class should be split into two.

JIRA: YANGTOOLS-917
Change-Id: If2d7bbbc5c4fe1ca96097f374f4313aabb411908
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e31b3dc700002b19d92ecc68463ab2711d8af99c)

5 years agoAdd ImmutableMapTemplate 99/78099/2
Robert Varga [Thu, 22 Nov 2018 17:43:42 +0000 (18:43 +0100)]
Add ImmutableMapTemplate

We have couple some hot paths where we know the keySet of an immutable
map we want to instantiate. For these, using
ImmutableOffsetMap.*copyOf() is wasteful, as it performs unnecessary
cache looks and map lookups.

ImmutableMapTemplate can be used to amortize these preparatory steps,
so that an ImmutableOffsetMap (or SharedSingletonMap) can efficiently
be produced by either transforming values of some other map, or by
supplying values in the correct order.

Since we are in the area, improve documentation and @NonNull
annotations of both ImmutableOffsetMap and SharedSingletonMap.

JIRA: YANGTOOLS-917
Change-Id: I8e7808b9bfe751885b842715f7e0346c0e7485b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 048042bd88cc9b1f481c018363c331bca83e4e1f)

5 years agoSpeed up UnorderedMapMixinContextNode 67/78067/2
Robert Varga [Thu, 22 Nov 2018 20:33:32 +0000 (21:33 +0100)]
Speed up UnorderedMapMixinContextNode

NodeIdentifierWithPredicates recognizes ImmutableMap, make sure
we remain on the faster path of it.

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

5 years agoRetrofit SchemaContextProvider 72/78072/2
Robert Varga [Thu, 22 Nov 2018 21:42:02 +0000 (22:42 +0100)]
Retrofit SchemaContextProvider

Since we already have a getSchemaContext() method, we can
get it documented and widely available for free.

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

5 years agoMake InMemoryDataTreeSnapshot implement SchemaContextProvider 71/78071/2
Robert Varga [Thu, 22 Nov 2018 21:34:12 +0000 (22:34 +0100)]
Make InMemoryDataTreeSnapshot implement SchemaContextProvider

Note DataTreeSnapshot's duplication of getSchemaContext(), which
is indicative of a coupling to yang.model.api. This is fine for now,
as this coupling already exists through xpath interfaces, but it
needs to be revisited and cleaned by either removing the method,
or making it a non-default (and inherited from SchemaContextProvider).

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

5 years agoRefactor XMLStreamWriterUtils 70/78070/1
Robert Varga [Thu, 22 Nov 2018 21:19:24 +0000 (22:19 +0100)]
Refactor XMLStreamWriterUtils

This refactors XMLStreamWriterUtils, so that it can be a proper
SchemaContextProvider. This allows us to propagate this property
through SchemaAwareXMLStreamNormalizedNodeStreamWriter the same
way.

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

5 years agoReuse writer field from parent 68/78068/1
Robert Varga [Thu, 22 Nov 2018 21:13:46 +0000 (22:13 +0100)]
Reuse writer field from parent

Writer is a duplicate field, which is already available as
getParent(). Remove the field and use the getter.

Change-Id: I1d5dd866512479268e32affb0ded301fadb5cb11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDocument Identifiable interface contract 57/77857/2
Robert Varga [Thu, 15 Nov 2018 14:31:25 +0000 (15:31 +0100)]
Document Identifiable interface contract

Somehow this core interface went undocumented, fix that and also
clarify it's companion Identifier contract.

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

5 years agoCleanup Immutable documentation 56/77856/1
Robert Varga [Thu, 15 Nov 2018 14:38:30 +0000 (15:38 +0100)]
Cleanup Immutable documentation

This is a simple formatting update, with small rewording to use
better language.

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

5 years agoAdd OptionalBoolean.ofOptional() 20/77720/2
Robert Varga [Thu, 8 Nov 2018 10:28:29 +0000 (11:28 +0100)]
Add OptionalBoolean.ofOptional()

This adds a simple utility method to create symmetry with
fromOptional(). Also cache TRUE/FALSE optionals, so accesses
get a bit faster.

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

5 years agoProperly propagate BuildContext 17/77717/1
Robert Varga [Tue, 13 Nov 2018 07:27:59 +0000 (08:27 +0100)]
Properly propagate BuildContext

YangToSourcesProcessor was not properly propagating BuildContext,
fix that.

JIRA: YANGTOOLS-915
Change-Id: Id4f28fe640bbd4d4ed065b9aa62f0becb2db43ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4bdd0b2f66433d7586a1eb32636bdab8a1d4361c)

5 years agoTolerate empty instance identifier in ImmutableNodes.fromInstanceId() 82/77482/1
Robert Varga [Sun, 4 Nov 2018 20:24:28 +0000 (21:24 +0100)]
Tolerate empty instance identifier in ImmutableNodes.fromInstanceId()

If the user specifies an empty InstanceIdentifier, we fail with an
undocumented NoSuchElementException. Make sure we properly handle
this case by returning a container which matches SchemaContext.NAME.

JIRA: YANGTOOLS-914
Change-Id: I0b503d3bed99d73d88e037d35979c503215f3b52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoLimit the TCCL when instantiating UntrustedXML 67/77267/4
Robert Varga [Wed, 24 Oct 2018 21:12:02 +0000 (23:12 +0200)]
Limit the TCCL when instantiating UntrustedXML

JAXP newInstance() methods can end up going through ServiceLoader
with TCCL as its ClassLoader, which means our constants may end up
pointing to a ClassLoader beyond our normal visibility.

This means we can end up picking up a different factory depending
on where we are called from and also can mean the TCCL cannot be
garbage-collected.

Force the TCCL to be the ClassLoader holding UntrustedXML, thus
establishing tight coupling between JAXP implementation discovery
mechanism and UntrustedXML.

JIRA: CONTROLLER-1867
Change-Id: Icacb0e193c7360c73bd07bc5c815bf803ca9ac44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unneeded jaxb-related exclusions 89/77189/2
Robert Varga [Tue, 23 Oct 2018 08:33:54 +0000 (10:33 +0200)]
Remove unneeded jaxb-related exclusions

odlparent-3.1.4 contains proper feature exclusion and also
proper dependecyManagement declaration of jaxb-api, remove them
from here.

Change-Id: I6c04bb424da7bb413169fbf2eb54f7b387246a61
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd CopyHistory.toString() 74/77174/1
Robert Varga [Mon, 22 Oct 2018 11:53:33 +0000 (13:53 +0200)]
Add CopyHistory.toString()

This method makes for easier debugging, add it.

Change-Id: Ib25dc0414dce2ddacecaedafb14b2e0d42e3d50d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to 2.0.13-SNAPSHOT 04/77104/2
Robert Varga [Fri, 19 Oct 2018 13:12:19 +0000 (15:12 +0200)]
Bump versions to 2.0.13-SNAPSHOT

This starts the next development iteration.

Change-Id: I415dd6cb7730e2cd18bab96d69e33eb1bc9e4797
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump yang-xpath versions to 0.1.12-SNAPSHOT 40/77140/1
Robert Varga [Fri, 19 Oct 2018 13:58:15 +0000 (15:58 +0200)]
Bump yang-xpath versions to 0.1.12-SNAPSHOT

This bump was missed previously, fix that up.

Change-Id: Ia5aa358097b989e80cdfdf4b47f8b0b2ce29cc2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump to odlparent 3.1.4 97/77097/1
Stephen Kitt [Fri, 19 Oct 2018 11:10:58 +0000 (13:10 +0200)]
Bump to odlparent 3.1.4

This upgrades to the released version.

Change-Id: I8514dde60713ab8480ebb00bb74eac1f838f049a
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agoBump to odlparent 3.1.4-SNAPSHOT 68/76868/3
Stephen Kitt [Thu, 11 Oct 2018 11:12:57 +0000 (13:12 +0200)]
Bump to odlparent 3.1.4-SNAPSHOT

This bumps our use of odlparent to 3.1.4-SNAPSHOT in anticipation
of a full release.

Change-Id: I8d03ed7321520e9580beb400534d20215d34edd5
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAttach error listeners to lexers 03/77003/1
Robert Varga [Mon, 15 Oct 2018 15:26:39 +0000 (17:26 +0200)]
Attach error listeners to lexers

We currently disconnect parser from standard output, but lexer
may incur errors as well, hence we should do the same dance to
lexers, too.

Change-Id: Ib901cb1fbdba05c721aeba5d60a5e8bda5f48087
JIRA: YANGTOOLS-905
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b88d8bcfa64908ccd2b64462dc6b66bb3c69a47c)

5 years agoImprove IfFeaturePredicateVisitor 02/77002/1
Robert Varga [Sat, 11 Aug 2018 00:10:23 +0000 (02:10 +0200)]
Improve IfFeaturePredicateVisitor

We need to detect parser errors and not print them to stderr,
create an abstract class with the validation functionality
and use it when parsing an if-feature argument.

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

5 years agoExclude javax.xml.stream dependency 99/76999/1
Robert Varga [Sun, 14 Oct 2018 00:56:21 +0000 (02:56 +0200)]
Exclude javax.xml.stream dependency

This dependency is satisfied by the JDK, hence we do not need to
pull it in.

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

5 years agoUpdate .gitreview to track the v2.0.x branch 67/76867/1
Stephen Kitt [Thu, 11 Oct 2018 11:14:14 +0000 (13:14 +0200)]
Update .gitreview to track the v2.0.x branch

Change-Id: Ibcc3381eb2349a91b088de186e8f497280e08a53
Signed-off-by: Stephen Kitt <skitt@redhat.com>
5 years agojaxb-api should be scope=compile 90/76790/1
Robert Varga [Tue, 9 Oct 2018 11:26:15 +0000 (13:26 +0200)]
jaxb-api should be scope=compile

Keeping scope=provided breaks downstream tests with JDK9+,
hence we need to rework the dependencies to make sure we always
pull jaxb-api, but we also need to exclude it from odl-yangtools-data
feature, because it is provided by Karaf.

Change-Id: Id09281c89a74c3d6c780179dfa21ced545318ba1
JIRA: YANGTOOLS-906
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit eeb3076563314a67ccbe2d083dede2051d12e060)

5 years agoCleanup ScannedDependencyTest 85/76585/1
Robert Varga [Tue, 2 Oct 2018 18:17:10 +0000 (20:17 +0200)]
Cleanup ScannedDependencyTest

Rather than messing with test resources set them up properly
in the project so that we can rely on them being present.

Also make sure we clean up our resources correctly.

Change-Id: Idb1b8a8d87293a255582f7120cdb0e47f7278080
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd NoOp{Listener,Object}Registration 51/76551/1
Robert Varga [Mon, 1 Oct 2018 19:01:01 +0000 (21:01 +0200)]
Add NoOp{Listener,Object}Registration

As it turns out, there are use cases for registration which do
nothing in their close() method. Add utility classes to support
those use cases. Also update javadocs a bit.

Change-Id: Ife196f26229cf54173e9b9046ece22bd0138c2ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd jaxb-api dependency 31/76431/1
Robert Varga [Mon, 24 Sep 2018 16:01:36 +0000 (18:01 +0200)]
Add jaxb-api dependency

For JDK11 we need an explicit scope=provided dependency on
jaxb-api.

JIRA: YANGTOOLS-906
Change-Id: Ifee829a5cd04561f6124ff03b772db2f5d12f04e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit aa676c9045ce081687f814607e977a0609c77bc5)

5 years agoDo not clutter logs with a thrown exception 59/76259/2
Robert Varga [Wed, 19 Sep 2018 10:48:17 +0000 (12:48 +0200)]
Do not clutter logs with a thrown exception

SourceException is an unchecked exception which we handle at a higher
layer. The logging statement does not add anything useful, so let's
remove it.

Change-Id: I8a4654b44469a2193996d1d90e982d01a1a62bf3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix TypedefEffectiveStatementImpl double-checked load 57/76257/2
Robert Varga [Wed, 19 Sep 2018 10:46:46 +0000 (12:46 +0200)]
Fix TypedefEffectiveStatementImpl double-checked load

We really need a volatile read here to make things alright, make
the field volatile.

Change-Id: Id04917a04f9f1fdba6ded2c773571d90106e877f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unneeded interface declaration 54/76254/2
Robert Varga [Wed, 19 Sep 2018 10:45:59 +0000 (12:45 +0200)]
Remove unneeded interface declaration

DataNodeContainer is already specified by superclass, no need to
repeat that declaration.

Change-Id: I9a409662d87b02ec9b4abcba88c90bccf684829a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove unneeded check 52/76252/1
Robert Varga [Wed, 19 Sep 2018 10:45:03 +0000 (12:45 +0200)]
Remove unneeded check

brk is known to be different from -1, hence we can use it directly
rather than using a temporary variable.

Change-Id: If089baa50b8e7b15d8ab03a8e09f7d6d6d0ea7e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to 2.0.12 release cycle 33/76133/1
Robert Varga [Mon, 17 Sep 2018 08:29:51 +0000 (10:29 +0200)]
Bump versions to 2.0.12 release cycle

This bumps versions to next development release.

Change-Id: I427f07c850593195e9479a957984d5a71fef1864
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix logging template 30/76030/1
Robert Varga [Wed, 12 Sep 2018 09:31:27 +0000 (11:31 +0200)]
Fix logging template

Logger template is missing a placeholder, add it.

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

5 years agoConsider AugmentationNodes when direct descendant is not found 44/75944/1
Marek Gradzki [Tue, 14 Aug 2018 08:05:37 +0000 (10:05 +0200)]
Consider AugmentationNodes when direct descendant is not found

With previous refactors it is quite easy to arrive at a simple
solution to take augmentations into account. This also

This includes a unit test from upstream based on afi-safi-name
with bgp-openconfig-extensions.

JIRA: YANGTOOLS-892
Change-Id: I237ed2c6cbed458a2109a48b468a30650f103a48
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e4777b6feff804cdcf633c28d4b654b0e885dbd1)

5 years agoEliminate LeafRefValidation.forEachChoice() 39/75939/1
Robert Varga [Mon, 10 Sep 2018 15:19:51 +0000 (17:19 +0200)]
Eliminate LeafRefValidation.forEachChoice()

As it turns out the two call sites can share more code. Introduce
processChildNode(), inlining forEachChoice() and its surrounding
lookup logic.

JIRA: YANGTOOLS-892
Change-Id: I2091abcd579ce1d48a628c3bdea9b4514b050e29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoSplit up LeafRefValidation.validateNodeData() 20/75920/1
Robert Varga [Mon, 10 Sep 2018 10:02:20 +0000 (12:02 +0200)]
Split up LeafRefValidation.validateNodeData()

Turn this method into a dispatch and move logic into dedicated
methods. This makes it easier to follow the code flow and eliminate
duplicates.

JIRA: YANGTOOLS-892
Change-Id: I840fa0d2e8c7ea86efa05c1afea825e85d890837
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3d22aba92422b08413d95b372ac11a2b26296a01)

5 years agoMinor code cleanups 17/75917/1
Robert Varga [Mon, 10 Sep 2018 09:43:07 +0000 (11:43 +0200)]
Minor code cleanups

- static private method
- reduce use of ChoiceSchemaNode.getCaseNodeByName()
- QNameWithPredicateBuilder(QName)

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

5 years agoUse Iterables.filter() instead of FluentIterable 13/75913/1
Robert Varga [Mon, 10 Sep 2018 08:36:12 +0000 (10:36 +0200)]
Use Iterables.filter() instead of FluentIterable

This removes allocation of one instance of FluentIterable, reducing
the amount of garbage we produce.

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

5 years agoRename LeafRefValidatation to LeafRefValidation 41/75841/1
Robert Varga [Fri, 7 Sep 2018 10:22:25 +0000 (12:22 +0200)]
Rename LeafRefValidatation to LeafRefValidation

This is a naming typo which went unnoticed for quite some time,
rename the implementation class and instantiate a proxy for
compatibility.

JIRA: YANGTOOLS-892
Change-Id: I3ec77d7df41942502394047e9e13007c6693d3af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2d5b39317c3c5db3fa9c4c258175340d3e347c38)

5 years agoRework choice iteration in LeafRefValidatation 38/75838/1
Robert Varga [Fri, 7 Sep 2018 09:14:48 +0000 (11:14 +0200)]
Rework choice iteration in LeafRefValidatation

Rather than extracting ChoiceNodes into a temporary list, use
a consumer which will be invoked for each of them.

JIRA: YANGTOOLS-892
Change-Id: I0956bed6e446c1ee4bf44c88fcc361abe8a508e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4a29fdd9dadf755ff6b3b6e34e9ff43c22a6b765)

5 years agoCleanup map iteration in LeafRefValidatation 35/75835/1
Robert Varga [Fri, 7 Sep 2018 09:07:09 +0000 (11:07 +0200)]
Cleanup map iteration in LeafRefValidatation

We have two codepaths for non-filtered and filtered map entry case,
which end up iterating over map entries. Rewrite the code in terms
of an optionally-filtered stream, reducing code duplication.

JIRA: YANGTOOLS-892
Change-Id: I3ca37edb66373cc5ab4632210980cd4a467fd198
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRework path LeafRefValidatation path tracking 33/75833/1
Robert Varga [Fri, 7 Sep 2018 08:36:20 +0000 (10:36 +0200)]
Rework path LeafRefValidatation path tracking

Rather than using a plain iterable sourced from LeafRefPath.getPathFromRoot(),
maintain a Deque sourced via getPathTowardsRoot(). This eliminates the need
for Iterables.skip() as well as not forcing getPathFromRoot() being initialized.

Change-Id: I23c054a63b2c0ceed24fcf48d2636508ee13d568
JIRA: YANGTOOLS-892
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPass down predicates instead of the entire predicate node 07/75807/1
Robert Varga [Wed, 5 Sep 2018 22:15:47 +0000 (00:15 +0200)]
Pass down predicates instead of the entire predicate node

Since we are not using the rest of the data, it is much simpler
to just pass down predicates. It also reduces confusion as to
what state we are propagating.

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

5 years agoDo not validate non-existent roots 06/75806/1
Robert Varga [Wed, 5 Sep 2018 21:39:18 +0000 (23:39 +0200)]
Do not validate non-existent roots

If we have no data there is no point to validate anything, and
having the root value as an invariant makes code a lot simpler.

JIRA: YANGTOOLS-892
Change-Id: Ifd68b09c03d90c8881381809047e59f3fe92682b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d2e80009970418f4755854f0918c5d80afb21a34)

5 years agoAdd LeafRefValidatation.computeValues() 05/75805/1
Robert Varga [Wed, 5 Sep 2018 21:24:30 +0000 (23:24 +0200)]
Add LeafRefValidatation.computeValues()

This separates out the heavy-weight value computation, simplifying
callers a bit.

JIRA: YANGTOOLS-892
Change-Id: I218659f830aec822f80decd3622c9890df832379
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit dd1f03b367b7fcec4d3a0a10bc81d4126d7c88f4)

5 years agoEliminate leafRefTargetNodeDataLog() 03/75803/1
Robert Varga [Wed, 5 Sep 2018 20:12:02 +0000 (22:12 +0200)]
Eliminate leafRefTargetNodeDataLog()

Now that we captured invariants, we can proceed to turn
leafRefTargetNodeDataLog() into a simpler lambda form.

JIRA: YANGTOOLS-892
Change-Id: I4644d0f3bc31f9f9cb3643e8443159522f14ccaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 86e7fb7d83ea73633b4e50bfbe95ded122b69a85)

5 years agoUntangle result processing logic. 01/75801/1
Robert Varga [Wed, 5 Sep 2018 19:33:55 +0000 (21:33 +0200)]
Untangle result processing logic.

leafRefTargetNodeDataLog() is needlessly complex, where it is called
with 3 different sets of arguments from validateLeafRefTargetNodeData()
only.

Inline two of those callers, reducing nesting significantly and
making the code flow more obvious.

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

5 years agoMove LeafRefPath creation from fast path 98/75798/1
Robert Varga [Wed, 5 Sep 2018 18:15:00 +0000 (20:15 +0200)]
Move LeafRefPath creation from fast path

LeafRefValidation is the fast path and LeafRefPath we are creating
is in an invariant. Cache it in LeafRefContext as needed.

JIRA: YANGTOOLS-892
Change-Id: I40ef136630b7cdacca84b2f08a9e0491daa03c14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4b7393b11151722f44c19236684c661cf5f8edd0)

5 years agoCleanup leafref path parsing 95/75795/1
Robert Varga [Wed, 5 Sep 2018 17:39:45 +0000 (19:39 +0200)]
Cleanup leafref path parsing

We have a String on input and LeafRefPathParserImpl uses ANTLR's
CharStreams -- hence it makes no sense to bounce input through
an InputStream.

Remove this atrocity, eliminating an IOException/IllegalStateException
error path in process.

JIRA: YANGTOOLS-892
Change-Id: I78eadf30da6a1e64621ca4c14dfa13e84524b591
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 23b7ff7e2e39e0d520e249ae5b256746acef5abd)

5 years agoCleanup LeafRefContext(Tree)Builder 81/75781/1
Robert Varga [Wed, 5 Sep 2018 17:28:16 +0000 (19:28 +0200)]
Cleanup LeafRefContext(Tree)Builder

These are package-private classes, make them final, eliminate
unneeded methods and improve code formatting.

JIRA: YANGTOOLS-892
Change-Id: I8a4925a665b1bcac7abd8088719e80f53229bafe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d76c8ce876f2609dd9775eb58cfd2ee012b27ad9)

5 years agoDo not leak Optional in QNameWithPredicateImpl.toString() 67/75767/2
Robert Varga [Wed, 5 Sep 2018 15:19:49 +0000 (17:19 +0200)]
Do not leak Optional in QNameWithPredicateImpl.toString()

The toString() method blindly appends the revision, leading to
Optional[] being present in the result. Fix the method to look
at the returned version and append the query only when it is
present -- just like QName does.

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

5 years agoCleanup LeafRefPath 65/75765/1
Robert Varga [Wed, 5 Sep 2018 15:46:13 +0000 (17:46 +0200)]
Cleanup LeafRefPath

Remove commented-out code and cleanup javadocs.

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

5 years agoConsider namespace in namesakes 54/75754/2
Robert Varga [Wed, 5 Sep 2018 10:53:46 +0000 (12:53 +0200)]
Consider namespace in namesakes

XML (unlike JSON) has explicit namespaces which we need to take
into consideration when determining whether two elements have the
same name.

JIRA: YANGTOOLS-900
Change-Id: I0d53bee5d18d211343c094941985bd3f0b6a8776
Signed-off-by: Isabel Lloret <illoret@indra.es>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoClean various constructs 11/75611/1
Stephen Kitt [Wed, 29 Aug 2018 16:38:57 +0000 (18:38 +0200)]
Clean various constructs

* Remove intern() on constant strings.
* Avoid some casts by changing test instance types.
* Remove a number of unnecessary type specifiers and casts.
* Remove an unnecessary return.
* Use StringBuilder::append()'s substring parameters instead of a
  separate String::substring().

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

5 years agoLoosen RpcResultBuilder argument 10/75610/1
Robert Varga [Fri, 10 Aug 2018 10:57:10 +0000 (12:57 +0200)]
Loosen RpcResultBuilder argument

withRpcErrors can accept a collection of any RpcError subclasses,
express that in the API contract.

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

5 years agoDo not use SchemaNodeIdentifierBuildNamespace prerequisites 09/75609/1
Robert Varga [Thu, 12 Jul 2018 09:26:35 +0000 (11:26 +0200)]
Do not use SchemaNodeIdentifierBuildNamespace prerequisites

Incremental lookups on ChildSchemaNodeNamespace allow us to react
to childen being created, hence we do not have an assumption that
the target node must be instantiated by someone else (like eager
instantiation).

This will also allow us better recovery if the target node is not
going to appear due to being disabled by if-feature.

JIRA: YANGTOOLS-694
Change-Id: Ibc05e18037bb85d42ed7123293e7f83f896aad5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 509988128ed9d5fe314a14906114f53778200e47)

5 years agoAdd NamespaceBehaviour.toString() 08/75608/1
Robert Varga [Wed, 8 Aug 2018 15:54:06 +0000 (17:54 +0200)]
Add NamespaceBehaviour.toString()

A toString() method aids debugging immensely, define some basic
implementations.

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

5 years agoOmit empty attributes in toString() 18/75518/1
Robert Varga [Mon, 27 Aug 2018 15:05:09 +0000 (17:05 +0200)]
Omit empty attributes in toString()

Do not emit attributes when they are empty, which brings
the verbosity down quite a bit -- as this is typically the case.

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

5 years agoOptimize ImmutableNodes.fromInstanceId() 01/75501/1
Robert Varga [Mon, 27 Aug 2018 09:23:09 +0000 (11:23 +0200)]
Optimize ImmutableNodes.fromInstanceId()

We are doing a single pass over the YangInstanceIdentifier, hence
we can simply iterate over the nodes, without creating another
YangInstanceIdentifier at each step.

Also cleanup method visibility, mark methods final and merge some
common codepaths.

JIRA: YANGTOOLS-897
Change-Id: I7bd599436dd16f943bae71f3adce289164be25c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 38c0fcab1667af91ef8ee0fc1e4b1cd9075f031a)

5 years agoFix unique argument parser 33/75233/1
Robert Varga [Thu, 16 Aug 2018 12:30:11 +0000 (14:30 +0200)]
Fix unique argument parser

Unique argument can use horizontal tabs and line-breaks as separators
in addition to spaces. Deal with them instead of rejecting input.

Change-Id: I5fb6137b9b73c5c844a05cc59fb9261868834a24
JIRA: YANGTOOLS-893
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 68de00c780737c1844f7d045d6f1ecfd0e83f957)

5 years agoFix yang-data-jaxen dependencies 77/74877/1
Robert Varga [Mon, 6 Aug 2018 14:32:51 +0000 (16:32 +0200)]
Fix yang-data-jaxen dependencies

We should depend on yang-data-impl for testing only.

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

5 years agoBump versions to 2.0.11-SNAPSHOT 58/74858/1
Robert Varga [Mon, 6 Aug 2018 13:49:42 +0000 (15:49 +0200)]
Bump versions to 2.0.11-SNAPSHOT

This bumps version to next release development.

Change-Id: Ibdef02162752fd1f1cd87fcdbc95e07a83f7f04f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAllows to find child of Operation definition (RPC, Action) 48/74848/1
Jakub Tóth [Mon, 6 Aug 2018 11:43:58 +0000 (13:43 +0200)]
Allows to find child of Operation definition (RPC, Action)

Change-Id: Ie1048ed6d294a507cc90c65ded7dbfb6d8c6018f
Signed-off-by: Jakub Tóth <jakub.toth@pantheon.tech>
5 years agoMake sure we mark phase modification 06/74806/4
Robert Varga [Fri, 3 Aug 2018 18:23:46 +0000 (20:23 +0200)]
Make sure we mark phase modification

Once we resolve the target we need to paint it, so it does not
complete before our modification has had a chance to run.

JIRA: YANGTOOLS-859
Change-Id: I8b29a8eef4d01f8c02d13d759061e93c379029e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMigrate @Nullable annotation 07/74807/2
Robert Varga [Fri, 3 Aug 2018 18:32:07 +0000 (20:32 +0200)]
Migrate @Nullable annotation

Migrating the annotation fixes an eclipse warning.

Change-Id: I8a07c05e4bf0b61c5dfa2b0ba1d15bb0a7ae89e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCentralize AugmentationIdentifier instantiation 94/74794/4
Robert Varga [Fri, 3 Aug 2018 09:58:08 +0000 (11:58 +0200)]
Centralize AugmentationIdentifier instantiation

We have duplicate code all over the place, centralize this in
DataSchemaContextNode.

Change-Id: Icb79740b3a113d0383d583403d48e9a5f427eb66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove duplicate instantiation of EffectiveAugmentationSchema 92/74792/5
Robert Varga [Fri, 3 Aug 2018 09:34:53 +0000 (11:34 +0200)]
Remove duplicate instantiation of EffectiveAugmentationSchema

We have four independent call sites, doing the same thing. Unify
all the callers behind EffectiveAugmentationSchema.create().

Change-Id: Ib4e4202cd64cff15d35cf275afbba7c00f853121
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoMove search methods to NormalizedNodeContext 89/71789/14
Robert Varga [Mon, 30 Apr 2018 19:22:19 +0000 (21:22 +0200)]
Move search methods to NormalizedNodeContext

When we know we have a NormalizedNodeContext we can forgo bouncing
through the navigator to get a target node context. This simplifies
things a bit when we want to implement more complex logic.

This is not exactly extensible way of operation, but we know we will
only be evaluating on our context.

Change-Id: Ib8bea239f3193c54d3eacab903c75f9d43aee4e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd yang-xpath-impl 73/71973/23
Robert Varga [Wed, 9 May 2018 18:54:22 +0000 (20:54 +0200)]
Add yang-xpath-impl

This adds an antlr-based XPath parser, which results in
yang-xpath-api expressions.

The grammar file (xpath.g4) is taken from
https://github.com/antlr/grammars-v4/blob/master/xpath/xpath.g4
at commit a3ff48932b0168d93d184a988fa40723b60f6c27.

JIRA: YANGTOOLS-877
Change-Id: Ic7cfdb2d8d132577840f910786f72ed75b17c79e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoFix LeafRefContext for relative refs defined in external grouping 30/74630/2
Marek Gradzki [Mon, 30 Jul 2018 06:45:29 +0000 (08:45 +0200)]
Fix LeafRefContext for relative refs defined in external grouping

LeafRefPathParserListenerImpl builds LeafRefPath
using namespace of the module which contains leafref definition.

While it is valid approach for absolute paths with prefix (YANGTOOLS-749),
it cannot be used with groupings, because they are bound to namespace
when contents of the grouping is added to the schema tree.

This patch fixes the relative path case
by using the module which uses leafref.

JIRA: YANGTOOLS-891
Change-Id: Ia903138f80c437937374eb7d3460fdbe8b2a97c2
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
5 years agoJaxen binding should use DataSchemaContextTree 28/71528/12
Robert Varga [Fri, 27 Apr 2018 20:46:32 +0000 (22:46 +0200)]
Jaxen binding should use DataSchemaContextTree

Context tree is a simple structure which allows traversal of nodes
in the order of NormalizedNodes in a strictly-forward way.

This allows us to not muck with SchemaContext when we need to look
up our SchemaNode, as it is readily available.

Change-Id: Ic6c67c1e064ffe74433debd4f1a63e24a8571791
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd yang-xpath-api 18/71818/20
Robert Varga [Fri, 4 May 2018 21:46:12 +0000 (23:46 +0200)]
Add yang-xpath-api

This patch adds the basic model of a YANG-extended XPath 1.0
expression.

JIRA: YANGTOOLS-877
Change-Id: Id5f619e6acd956b7b43f9faba75f34051e3dc509
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoUpdate toString() encapsulation 37/74737/1
Robert Varga [Wed, 1 Aug 2018 12:40:43 +0000 (14:40 +0200)]
Update toString() encapsulation

Since we do not know the contents/format of toString() return,
make sure we bracket it.

Change-Id: Id552bb59bf3beb62548d5860ab9abe2db062bf80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoPropagate delegate.toString() as symbolic name 27/74727/1
Robert Varga [Wed, 1 Aug 2018 10:31:22 +0000 (12:31 +0200)]
Propagate delegate.toString() as symbolic name

With use of delegated ByteSources we are losing location of the
source, as there is no symbolic name being filled in.

Change-Id: Ie53207ca3af13de49a8b45d11b78ebb828145e66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRework identifier path subscription 94/74694/4
Robert Varga [Tue, 31 Jul 2018 13:21:19 +0000 (15:21 +0200)]
Rework identifier path subscription

Rather than creating multiple prerequisites, define the logic
inside a dedicated class, which gets reused.

JIRA: YANGTOOLS-859
Change-Id: I25259bd4571bc684b0f25d9d058efd5ff1d7798b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>