Robert Varga [Tue, 9 Jul 2019 12:00:32 +0000 (14:00 +0200)]
Fix yang-parser-rfc7950 module name
The bundle has wrong Automatic-Module-Name, fix that up.
Change-Id: Ieb6821dac0ea8ab8130fc498b7e032eb174890b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Jul 2019 09:39:25 +0000 (11:39 +0200)]
Add rfc8528-data-api
Mount points require a rather complex interaction with
NormalizedNodeStreamWriter, which is defined in a new artifact.
Change-Id: If3063151c7eca561b5382e2da6ddc339cba94e4f
JIRA: YANGTOOLS-1007
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Jul 2019 09:30:43 +0000 (11:30 +0200)]
Add YangLibraryConstants
RFC8528's data representation rules require components dealing with
mountpoints on both schema and data levels to recognize
ietf-yang-library data for the purposes of interpretation of other
contained data. This patch adds the minimum information required
to identify the data items required.
Change-Id: I9be2e1d6527d316a475dc1e47d7670e75383810b
JIRA: YANGTOOLS-1007
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Jul 2019 08:58:40 +0000 (10:58 +0200)]
Allow statements to efficiently lookup actions/notifications
As actions and notifications are part of schema tree, we can reuse
that namespace to efficiently look them up.
Change-Id: I07d6dcc44648fb74c774a7437743db486e444a62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 3 Jul 2019 22:34:51 +0000 (00:34 +0200)]
Allow actions/notifications to be efficiently looked up
It is quite common to look up actions/notifications through
their QName. Add a method to look them up directly to
{Action,Notification}NodeContainer.
Change-Id: Ib643f60b932e6298f95aaaf67981347104c4299f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Anna Bencurova [Mon, 1 Jul 2019 13:34:05 +0000 (15:34 +0200)]
Make sure root JSON context is properly flushed
If we are dealing with an exclusive context which contains
only children which can be skipped, we can end up attempting
to close the context without it first having been emitted,
leading to a GSON splat.
In order to fix this, we need make sure we do not directly
emitEnd(), but rather endNode() -- so that the context can
emit its starts if it has not done so.
JIRA: YANGTOOLS-1008
Change-Id: I02452abe24c7a42b83246a113f284990f6211d9f
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Jul 2019 10:34:52 +0000 (12:34 +0200)]
Unify ComplexJson SchemaContext references
This introduces AbstractComplexJsonTest, which maintains the schema
context for complexjson models and the corresponding codec factory.
Change-Id: I667fd5274a6e315679854e79389a42c93d3d72eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 3 Jul 2019 22:30:16 +0000 (00:30 +0200)]
Specialize SchemaPath.create(boolean, QName)
As it turns out we use single-QName variant quite heavily, this
provides a specialized method, which does not have varargs.
Change-Id: I5a3f1bc7379fe6c387fd8d0fb3cfb9cef0139c72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 3 Jul 2019 12:49:45 +0000 (14:49 +0200)]
Split uint factory methods
This splits up internal methods lookup methods, so that they are
more easily inlined. Also mark cache access as potential VarHandle
users.
Change-Id: I1892290d347fba9e662394fda0ca5ce4394514d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 21 Jun 2019 05:15:09 +0000 (07:15 +0200)]
Bump odlparent to 5.0.1
This picks up the next odlparent release.
Change-Id: I189d00c83577c602acfd25053e6b35bf20d18123
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Aug 2018 18:37:30 +0000 (20:37 +0200)]
Add prerequisiteUnavailable()
This method should be invoked when we know the prerequisite is
not available. This adds the very basic notion and hooks for that.
Change-Id: Ibdb7a04737292be1f3a091057601af7db8325a38
JIRA: YANGTOOLS-859
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 27 Feb 2018 20:01:27 +0000 (21:01 +0100)]
Handle implicit parent statements during copy operations
Rather than special-casing choice nodes, make sure we create a proper
implicit statement when effective nodes are being introduced.
JIRA: YANGTOOLS-724
Change-Id: I5c2f26df31ba78623cd1dd156710f3a12db8c671
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 27 Jun 2019 10:30:44 +0000 (12:30 +0200)]
Use assertThat(isA()) instead of assertTrue(instanceof)
This improves errors reported when tests are failing, which is
a good thing.
Change-Id: I9ac82a7915de2faced58401f77fc0707a31b2754
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 26 Jun 2019 15:57:16 +0000 (17:57 +0200)]
Add a nullness annotation
Effective mountpoint statement has to have a non-null path,
this adds the annotation to express that.
Change-Id: I85d3ee89b2334cb39351811d733d7aa02a59e8bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 21 Jun 2019 23:47:42 +0000 (01:47 +0200)]
Add explicit serialization format
Having control over the entries that go in and out we get to choose
what sorts of maps are we going to use.
Change-Id: I7cb47c2452752ca046dbc0451c828ca3ba49193f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 24 Jun 2019 12:09:05 +0000 (14:09 +0200)]
Migrate off of deprecated NodeIdentifierWithPredicates methods
This migrates to replacement methods, eliminating warnings.
Change-Id: Iaa15e588f20b6cdc1f6fc63b45d6dacb116fa67d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 24 Jun 2019 08:45:45 +0000 (10:45 +0200)]
Migrate off of deprecated NodeIdentifierWithPredicates methods
This migrates to replacement methods, eliminating warnings.
Change-Id: I2862aec39ebfbcdc1f762e2868f6b84ebe2c72a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 20 Jun 2019 14:19:09 +0000 (16:19 +0200)]
Add SharedSingletonMap.getEntry()
This adds access to the single entry being present in the map,
without the need to encapsulate it via entrySet().
Change-Id: Ifbb101285bb4825237fceb37db025334b1307c0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 11 Jun 2019 16:53:18 +0000 (18:53 +0200)]
Deduplicate concurrent SchemaContext loads
In case we are running concurrent SchemaContext computation, if
the result is not cached we will have multiple results. These
need to be reconciled with the cache, so that those results will
be squashed into a single instance.
JIRA: YANGTOOLS-1004
Change-Id: I82df2b32a534d0acc803548579fb8ad138853c68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 12 Jun 2019 09:42:32 +0000 (11:42 +0200)]
Bump versions to 3.0.3-SNAPSHOT (again)
This starts the next development iteration.
Change-Id: I35551bbd2ea36e65e36ca88eaec9be966a643d85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 12 Jun 2019 09:41:35 +0000 (11:41 +0200)]
Fix version mis-bump
These instances were not properly bumped, fix that.
Change-Id: Ia057bd0823b16198cf184f20b22f571a8cb5aeb3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 12 Jun 2019 09:41:13 +0000 (11:41 +0200)]
Revert "Bump versions to 3.0.3-SNAPSHOT"
This reverts commit
7ec04bfab1274091de745f29f2c4ee00e550ebe4.
Change-Id: I4fc92a77262194e3416db51c552990b895e6836c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 12 Jun 2019 00:43:14 +0000 (02:43 +0200)]
Bump versions to 3.0.3-SNAPSHOT
This starts the next development iteration.
Change-Id: I6a454b23fd831606a64beec8e1d6b1370e7c3913
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 11 Jun 2019 09:18:45 +0000 (11:18 +0200)]
Recognize AnyDataSchemaNode
CompositeNodeDataWithSchema needs to recognize anydata nodes and
not fall back to a generic.
Change-Id: Id545fde1f4911754ceb1a8a63c8519125206afba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 7 Jun 2019 14:33:56 +0000 (16:33 +0200)]
Emit end of anyxml data
Since we are emitting the start of anyxml node, and we have fixed
the thinko in
36326770d563bfe2a5332738b02e66d6132574a9, we also
need to emit its end.
JIRA: YANGTOOLS-1002
Change-Id: I5e8497cd33ad4be270d5e9b5366e39c04e017486
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
PeterSuna [Fri, 31 May 2019 12:53:49 +0000 (14:53 +0200)]
Fix DOMSourceAnydata normalization
Internal DOMSource contains nested a top-level element, which acts
as a container for internal nodes. We need to skip this element
when we are attempting to parse the content, otherwise we will end
up with incorrect schema/data nesting.
Change-Id: Iaa2c799a2437dadf9ee2735092e1346d1f275d55
Signed-off-by: PeterSuna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 7 Jun 2019 13:41:54 +0000 (15:41 +0200)]
End anydata element
Since startAnydata() is opening an element we must make sure
we close it again. This flushes out a thinko around tracking
endElement depth, which must be decremented before check.
JIRA: YANGTOOLS-1002
Change-Id: I8f0b31eb9f165d384c1e680e5fc19763e9f67fbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 7 Jun 2019 13:39:08 +0000 (15:39 +0200)]
Flush element when streaming NormalizedAnydata
We must make sure parent StreamWriterFacade emits any started
open elements to the writer, otherwise can end up with weird
XML, which suddenly emits a self-closing element.
Issue a flushElement() before writing the data.
JIRA: YANGTOOLS-1002
Change-Id: Ib3933ddad22e490782a144306b8df10a033d74ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 7 Jun 2019 13:29:08 +0000 (15:29 +0200)]
Remove dead code from StreamWriterFacade
This code was leftover from the opaque anydata implementation
and does not serve any purpose, hence kill it.
Change-Id: I58c1ebcfc4677cfdeec85770fcaa1024f18859e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 7 Jun 2019 09:37:47 +0000 (11:37 +0200)]
Add sibling serialization test
This adds the model update and a simple test for sibling
serialization boundaries.
Change-Id: I0f67626f56d86bbbfd02486c376b66efabd3b81c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 6 Jun 2019 13:42:50 +0000 (15:42 +0200)]
Make ReusableImmutableNormalizedNodeStreamWriter reuse leaf builders
LeafSetEntryNode and LeafNode cannot have children, hence we can
easily reuse their instances.
Change-Id: Ic347a3e89648d6a67ca81dc65c6c320647b078b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 6 Jun 2019 10:23:49 +0000 (12:23 +0200)]
Expose ReusableStreamReceiver
ReusableImmutableNormalizedNodeStreamWriter has two properties
which are not inherently tied to it being bound to immutable nodes:
- it can have its state reset
- it exposes a NormalizedNode result of a streaming session
Expose these traits as ReusableStreamReceiver, so that users
can use the API rather than the implementation.
Change-Id: I841211c89520c4a5c67d436c8a49d719e8f7f1b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 30 May 2019 23:42:54 +0000 (01:42 +0200)]
Deprecate NodeIdentifierWithPredicates.getKeyValues()
Map vieew is not necessary, as it leaks hashCode()/equals(),
preventing us from optimizing the layout of the structure.
This patch introduces alternative method for accessing predicates
without relying on Map, while retaining the possibility of getting
a Map view.
Change-Id: Ieb2c8794056fe481d4905862e30fe0601c2ab152
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 30 May 2019 21:42:18 +0000 (23:42 +0200)]
Remove AbstractPathArgument.hashCodeGuard
This patch removes the explicit boolean guard around hashCode,
which guarantees disambiguation between 0 and uncomputed.
The single byte expended here has an actual cost of 7 bytes,
as it is forcing all subclasses to have a padding of 7 with
default settings in most environments.
This changes instance sizes as follows (32bit/64bit):
NodeIdentifier 24(3)/32(7) -> 24(4)/24(0)
NodeIdentifierWithPredicates 32(7)/40(7) -> 24(0)/32(0)
NodeWithValue 32(7)/40(7) -> 24(0)/32(0)
Most notable here is the reduction of
NodeIdentifierWithPredicates, which cannot reasonably be
shared, as it depends on user data.
Change-Id: Ia444cf708f5209cb22f2661e48f2f2ffaf150281
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 27 May 2019 19:12:02 +0000 (21:12 +0200)]
Bump versions to 3.0.2-SNAPSHOT
This starts the next development iteration.
Change-Id: I74d4e84d0c9a2c9f2cf8c0cd131175280b71e2bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 30 May 2019 17:06:07 +0000 (19:06 +0200)]
Cleanup testing AugmentationIdentifier instantiations
Using ImmutableList.of() is slightly faster, use that.
Change-Id: Ia45d18dc840e8985a1037e7235c01da5f873d870
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 30 May 2019 17:03:24 +0000 (19:03 +0200)]
Add AugmentationIdentifier.create() methods
This adds two flavors of AugmentationIdentifier.create(), which
use a global weak cache for normalizing AugmentationIdentifiers.
The cache is carefully populated, i.e. it makes a point of using
immutable keys only.
JIRA: YANGTOOLS-998
Change-Id: I1e7d65b995e50773ec2260c9fb01bc1c6bbaafbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 30 May 2019 16:44:15 +0000 (18:44 +0200)]
Deprecate NodeIdentifierWithPredicates constructors
Provide static factory methods for instantiating
NodeIdentifierWithPredicates, so that we can deprecate public
constructors, allowing us to evolve the class itself.
JIRA: CONTROLLER-1000
Change-Id: I05916b45c2c94caab717ae96b699ca2b264cc2da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
PeterSuna [Tue, 28 May 2019 15:50:53 +0000 (17:50 +0200)]
Create unit test for anydata.
-Add test for Serialization (Fail)
-Add test for Deserialization (Pass)
Change-Id: Ic7de2373f1a4effbedce35aded6b6223dac3c9ab
Signed-off-by: PeterSuna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 30 May 2019 10:09:06 +0000 (12:09 +0200)]
Add ImmutableMetadataNormalizedAnydata.ofOptional()
The only user of ImmutableMetadataNormalizedAnydata is using it
only optionally, based on metadata presence. This indicates a static
factory method is usable more than the plain constructor.
Change-Id: I0379fd89acfcf6d12264da9cbb041da772449988
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 30 May 2019 10:08:19 +0000 (12:08 +0200)]
Add missing @NonNull annotations
Static factories are missing these annotations, making downstreams'
life harder.
Change-Id: I8a8ccaf19e32b01efa5037a09dcee4cab078f72d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 29 May 2019 23:50:00 +0000 (01:50 +0200)]
Document and fix DOMSourceAnydata streaming
W3C DOM requires each document to have a single root element, and
we are using the anydata element as the container. This is required
because anydata (and anyxml) can hold a list, in which case we would
be faced with a document which has multiple root elements.
Document this fact and adjust streaming interfaces/handling to take
this into account.
JIRA: YANGTOOLS-993
Change-Id: Ifcc7777d60359c942b8f033307ab63295525ca1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 29 May 2019 22:20:06 +0000 (00:20 +0200)]
Refactor anydata-related interfaces
As it turns out we need to expose more of our capabilities into
the API interface, as otherwise we cannot link the functionality
in javadoc.
This refactors interfaces/implementations, allowing redirection.
JIRA: YANGTOOLS-993
Change-Id: I142c9d50247d32d3ce24cb03e739618246a35a95
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 29 May 2019 12:57:45 +0000 (14:57 +0200)]
Add AugmentationIdentifier(ImmutableSet)
There are situations where we know input is an ImmutableSet,
expose a constructor to wire such calls directly.
Change-Id: Id1ae48ee64c88119767c7e538a3379f5bdcb257c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 27 May 2019 20:01:57 +0000 (22:01 +0200)]
Cleanup NormalizedAnydata
NormalizedAnydata is used only with conjuction with SchemaContext
and DataSchemaNode, make sure users don't have to just through
hoops.
This also fixes SchemaTracker integration by providing a utility
single-child parent for use with the specified context node as well
as fixing support for streaming metadata.
JIRA: YANGTOOLS-995
Change-Id: I11b4ac769c8d54faddc19eab3d094b2ba4f43aa3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 27 May 2019 08:58:51 +0000 (10:58 +0200)]
Add JSON support for normalized anydata
Since we have an entrypoint which can introduce anydata in the
system, JSON codec needs to be able to emit normalized anydata.
JIRA: YANGTOOLS-997
Change-Id: Ia8aa38553e37786f0358cb5888a16c3d1cfd4704
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 27 May 2019 10:52:23 +0000 (12:52 +0200)]
Add support for Anydata content normalization
In order to transport anydata payloads between parser-based
representations, we need to normalize it and attach a proper
DataSchemaContextTree/DataSchemaContextNode to the structure,
so that the contained data can be properly interpreted.
This patch adds NormalizedAnydata representation, which captures
this information and teaches the XML codec to handle transaformations
to/from the normalized form.
JIRA: YANGTOOLS-995
Change-Id: I3403db3a0250290505c405b5775601d47aadcbbc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 21 May 2019 14:22:20 +0000 (16:22 +0200)]
Rework Anydata model
AnydataNodes cannot really be made opaque due to stateful nature
of their representation in XML. While we can work around identifiers
by capturing their namespace specification, we cannot work around
identity and instance-identifier codecs, which require full namespace
declaration being available.
Since we cannot understand the value parsing until the content is
bound to a particular model, which may actually never happen, we would
have to lug around the entire NamespaceContext for each node
encountered -- and that is not quite feasible.
This patch takes the escape route by embracing the fact that streamers
and anydata instances need to hash out their streaming properties
themselves.
JIRA: YANGTOOLS-993
Change-Id: If1118902394afb651cfbee3313b2810cdf4e1231
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
PeterSuna [Thu, 23 May 2019 14:14:08 +0000 (16:14 +0200)]
Create unit tests for anydata implemetnation.
- Add parse anydata test from yang file.
- Add test for anydata in testDeviateAdd.
Change-Id: I1647274eab97390247aa06a73f28a77e98e7b4d0
Signed-off-by: PeterSuna <peter.suna@pantheon.tech>
Robert Varga [Tue, 21 May 2019 18:07:04 +0000 (20:07 +0200)]
Add a missing annotation
QName.readFrom() is guaranteed to return non-null.
Change-Id: I462ae82d56433d7bd1a41d2df93f41f7495d8fdd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 20 May 2019 06:19:18 +0000 (08:19 +0200)]
Add support for opaque anydata XML input
This patch adds preliminary support for streaming anydata nodes
into opaque values.
JIRA: YANGTOOLS-991
Change-Id: Iebe67aaf32cc7dde6c54541e8036f9a47544f573
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 17 May 2019 00:07:37 +0000 (02:07 +0200)]
Add support for opaque anydata XML output
Streaming opaque anydata content requires simple element emission,
which is implemented by this patch along with a very simple unit
test.
JIRA: YANGTOOLS-991
Change-Id: Ia1730b7415a34fcabbb936c7ef06e5a8522a2299
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 16 May 2019 18:48:52 +0000 (20:48 +0200)]
Add OpaqueAnydataExtension and related interfaces
This ties together NormalizedNodeStreamWriter with OpaqueAnydata,
so that opaque anydata nodes may be streamed.
Implementation for both canonical sides of streaming are added,
too.
JIRA: YANGTOOLS-978
Change-Id: I85fa7b2441760d11093f61bfdae1948c852060d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 21 May 2019 09:54:47 +0000 (11:54 +0200)]
Tighten XmlParserStream.setValue()
The argument type to setValue() is required to be a
SimpleNodeDataWithSchema, make sure to express that in declaration
and have callers perform cast -- which is already guarded by
instanceof checks.
Change-Id: I65c668c4dba8855d2e79014254182d2069a1d6cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 21 May 2019 09:46:54 +0000 (11:46 +0200)]
Cache translated XML attributes
Rather than parsing XML namespace strings over and over, use
two simple caches to speed the lookups.
Change-Id: I1c305843f50b62c059d73cb339b62d125b9fd356
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 9 May 2019 16:32:32 +0000 (18:32 +0200)]
Add AnydataNode specialization to OpaqueData
This bridges AnydataNode with OpaqueData by specializing anydata
with opaque data context. Related builders are also provided.
JIRA: YANGTOOLS-978
Change-Id: I042749c066b984835741c6ec66e9014f54b8221c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 16 May 2019 12:27:44 +0000 (14:27 +0200)]
Add OpaqueData structure
anydata requires us to model its content, which we know effectively
nothing about. Futhermore its content cannot be transported across
serialization formats, notably from XML to JSON.
This adds the prerequisite OpaqueData interfaces and their builders.
JIRA: YANGTOOLS-978
Change-Id: I62f214f09b7d8f58a5eb7f047b1ba67e250d7933
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 16 May 2019 08:59:35 +0000 (10:59 +0200)]
Do not push nulls into Deque
ArrayDeque does not support nulls, hence we need to do proper
unknown depth tracking in MetadataDecorator.
JIRA: YANGTOOLS-990
Change-Id: Ibb71c571bde0e9b249a821d6262a7136a55cbe8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 May 2019 14:43:30 +0000 (16:43 +0200)]
Add ReusableImmutableNormalizedNodeStreamWriter
In certain situations it can be beneficial to reuse the same
writer multiple times, resetting it between uses.
This patch adds a reusable version of
ImmutableNormalizedNodeStreamWriter, which provides this service.
JIRA: YANGTOOLS-988
Change-Id: Id74e8ddcaec0e730e805cf300d455c6bf5357156
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 May 2019 12:32:09 +0000 (14:32 +0200)]
Add ObjectExtensions annorations
This adds @NonNull annotations to streamline users.
Change-Id: I0ada109600a15e98e52b1163a9a9b8822dbf0d06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 May 2019 10:56:56 +0000 (12:56 +0200)]
Add ObjectExtensions.Factory
Rather than allowing direct instantiation, indirect instantiation
through a Factory which performs validation.
Change-Id: If6301db3e6550d99e2746768df6b6312e85d4135
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 May 2019 10:11:04 +0000 (12:11 +0200)]
Allow LeafSetEntryNodes to be added to result builder
This amends the check of parent builders to account for
NormalizedNodeResultBuilder, so that individual entries may be
received. Also optimizes the checking a bit by caching the current
builder instead of fetching it from the stack.
JIRA: YANGTOOLS-987
Change-Id: I7b77bd17ffd4671b5d5c2fbe25dee8d95757a1f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 13 May 2019 12:32:53 +0000 (14:32 +0200)]
Introduce ObjectExtensions
This is a simplistic implementation of ClassToInstanceMap, which
takes a fixes set of extensions and an object which is supposed
to implement them.
Change-Id: I010866fedb7c753f1f792ca75252dc9729264b42
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 13 May 2019 09:28:14 +0000 (11:28 +0200)]
Add FIXMEs to remove generic type argument
anyXmlBuilder() methods are not really parameterized, add a FIXME
to drop the unused parameter.
Change-Id: Id35501283d0ca2a85654cd47a640bbfbc8824258
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Jakub Toth [Tue, 23 Apr 2019 13:46:34 +0000 (06:46 -0700)]
Allow builders to optionally use LinkedHashMap
Some devices are unreasonably touchy about the order of children
we send them -- i.e. they expect to encounter direct container
children before seeing any augmented children. While we push them
to NormalizedNode builders in this order, the builders are using
plain HashMaps (and rightfully so) to track them, which means
they can get reordered.
This patch introduces a new system property,
org.opendaylight.yangtools.yang.data.impl.schema.builder.retain-child-order,
which when set to "true" will cause DataContainerBuilders to use
LinkedHashMaps to track children, sacrificing efficiency to retain
the original insertion order.
JIRA: YANGTOOLS-984
Change-Id: Ica1616c3fa93559c6458eba4030a5ceaac7be58a
Signed-off-by: Jakub Toth <jtoth@luminanetworks.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Apr 2019 04:55:03 +0000 (06:55 +0200)]
Use null SchemaPath if we cannot construct it
Constructing QName from enum arguments is a design deficiency
of SchemaNodes. There is not much we can do at this point, so mask
failures to process extensions by assigning them a null path.
JIRA: YANGTOOLS-983
Change-Id: I9138b1620157c6017cb36e8e7c2ff81bfbeb378c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Apr 2019 22:47:22 +0000 (00:47 +0200)]
Some more nullness updates
We missed these two places in the previous round.
Change-Id: Id502071ee04dffffaff2bba572e848b78a7c8db8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Apr 2019 19:43:14 +0000 (21:43 +0200)]
Update RpcResultBuilder
Annotation @NonNull returns and make sure we correctly propagate
out ImmutableList as the implementation.
Change-Id: I0e0e78dda729305a99958240228b5349048ff2d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Apr 2019 19:42:21 +0000 (21:42 +0200)]
Revision should be Immutable
This class has only a single member, which is immutable and is final,
which means it is Immutable. Reflect that in the class hierarchy.
Change-Id: I1cc8866e5d4b3344361581bf0037971855bd2f5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Apr 2019 19:34:26 +0000 (21:34 +0200)]
Add explicit @NonNull annotations to YangInstanceIdentifier
YangInstanceIdentifier has a number of methods which are guaranteed
to return non-null. This retrofits them with proper annotations, so
that downstream use gets a bit smoother.
Change-Id: I2d5a80270e8371f98cdb292a9cc6cec5fc63df2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 10 Apr 2019 06:44:16 +0000 (08:44 +0200)]
Remove CollectionsWrappers map support
This was a mistake, as wrapping a Map in such an anonymous way
is not useful at all.
Change-Id: I2dcd1313b89ccf276ab8230db935fe48a9025605
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Apr 2019 21:08:32 +0000 (23:08 +0200)]
Expand CollectionWrappers
This adds a wrapper around a Map's values and also makes all
wrappers implement Delegator interface. Furthermore we recognize
cross-wrapping between List and Set and unpeel the backing
collection, so as to reduce object retention chains.
Change-Id: Ie6bd5826c328ab6db656758e3bad2f3b9f656255
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Apr 2019 17:16:37 +0000 (19:16 +0200)]
Use XMLStreamException for reporting parsing errors
Using IllegalStateException is pure evil, as users do not expect
a RuntimeException to be thrown from contexts which can clearly
report a checked exception.
Use a properly-formatted XMLStreamException instead.
Change-Id: Iecee17e19b3ac380bcb2b7fc1c46f27e789c20bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 20:50:54 +0000 (22:50 +0200)]
Cleanup YIN tests
Most of the tests are using the same schemaContext, share it via
AbstractYinModulesTest. Also remove use of getDataChildByName().
Change-Id: Id3d0992623bfc3f13309ec50042a204ca829319e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 19:44:08 +0000 (21:44 +0200)]
Add DataNodeContainer.findDataChildByName(QName, QName...)
This is a utility method, which traverses the tree of nodes,
equivalent to individually checking and calling
findDataChildByName(QName). It stops when any component is not
found.
Change-Id: I98f3c0f4ba6f32fe8f984547f20b84981db07f3f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 18:34:12 +0000 (20:34 +0200)]
Reduce use of getChildByName()
This reduces the number of warnings and also the number of required
assertions.
Change-Id: I96456a15ec817b6335572fd373d117af887dd38b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 19:16:26 +0000 (21:16 +0200)]
Reduce use of DataSchemaContextTree.getChild()
findChild() is a better replacement, use that instead of the
deprecated method.
Change-Id: Idce2d2fb464fd72b30c98617519bfad5ba7c6a55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 21:46:11 +0000 (23:46 +0200)]
Bump versions to 3.0.0-SNAPSHOT
This mass-bumps versions for next development cycle.
Change-Id: I0433a3d81d3affb8001d660813e9909ff2e16a07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 08:38:02 +0000 (10:38 +0200)]
Move NormalizedMetadata#LEGACY_ATTRIBUTE_NAMESPACE
This namespace is used by the XML codec only, make sure we do not
burden others with it.
Change-Id: I24fd526d4e78929cbaea18d7a395f9de604a2137
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 07:32:09 +0000 (09:32 +0200)]
Remove misleading comment
The comment about .get() being safe is not relevant, remove it.
Change-Id: I92ed59e6ef72968ed7cfbdc1da0e22817431483c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Apr 2019 01:10:04 +0000 (03:10 +0200)]
Fix NONE operation node with automatic lifecycle
In case when previous operations fizzle into a NONE operation
on top of a non-present node, automatic lifecycle would fail
because there is no node to disappear.
Fix this case by not requiring the delegate operation to return
a present node.
JIRA: YANGTOOLS-938
Change-Id: I6b4a01af61e148efa0bae3953dd5aa80b2e63398
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 6 Apr 2019 15:36:26 +0000 (17:36 +0200)]
Fix AnyXmlNode root element namespace/attribute forwarding
Even if we do not forward the START_ELEMENT event, we need to take
care of forwarding namespace/attributes.
JIRA: YANGTOOLS-497
Change-Id: I7f7586220e321e8ea3395eeebc4995579ca83747
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 5 Apr 2019 17:21:36 +0000 (19:21 +0200)]
Introduce EffectiveModelContextFactory
EffectiveModelContext is a superset of SchemaContext, which we will
need to drive transition EffectiveStatements. Make sure we have a
matching factory. This deprecates SchemaContextFactory in favor
of the new EffectiveModelContextFactory and updates implementations
accordingly.
Change-Id: I3548042bc9286dc3c65b082f62f3ff0e74114d6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 5 Apr 2019 18:13:17 +0000 (20:13 +0200)]
Allow EffectiveModelContextProvider to throw ISE
In cases where the context is not available (for whatever reason),
allow implementations to throw ISE.
Change-Id: If2cacd98d81f11ff5caad0f9528619d999c3ac51
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 5 Apr 2019 16:58:43 +0000 (18:58 +0200)]
Fix ImmutableMetadataNormalizedNodeStreamWriter state
When we instantiate an ImmutableMetadataNormalizedNodeStreamWriter
from State, we need to also push the metadata builder on stack.
JIRA: YANGTOOLS-961
Change-Id: Ia016ddbd5485fbcf50388d5f8401c41cbd09a813
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Apr 2019 19:42:43 +0000 (21:42 +0200)]
Introduce EffectiveModelContext
EffectiveModelContext ties together SchemaNode world, as represented
by SchemaContext and EffectiveStatement world, which does not have
a representation, yet.
Change-Id: I1b1eba4c4030c597151662b2cafefdc841943701
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Apr 2019 19:24:33 +0000 (21:24 +0200)]
Rename EffectiveModelContext to ReactorDeclaredModel
This renames EffectiveModelContext to vacate the name, with the new
name better reflecting its nature.
Change-Id: I84000e2c19d9bdee6f561fd83f39bb5eb2033bab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 5 Mar 2019 12:00:31 +0000 (13:00 +0100)]
Remove AttributesContainer
We have NormalizedMetadata which acts as a replacement of NormalizedNode
attributes. Remove AttributesContainer and all its uses within our codebase.
JIRA: YANGTOOLS-960
Change-Id: I8f8d0292ffec4bea3805acaef3c7f6648e9c96f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Apr 2019 16:31:13 +0000 (18:31 +0200)]
Remove ModifyAction and related code
ModifyAction is a NETCONF leak, which really should be metadata.
Since metadata is disconnected from NormalizedNodes, there is just
no use case to support it in ImmutableNodes/InstanceIdToNodes.
Downstreams can instead create the NormalizedNode structure and
create a shadow metadata structure, holding any metadata they wish.
Change-Id: I2afa4087871e8602278e0bb0d0cc0fbe2fb0df08
JIRA: YANGTOOLS-960
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 3 Apr 2019 15:51:51 +0000 (17:51 +0200)]
Remove NormalizedNodeStreamAttributeWriter
This removes NormalizedNodeStreamAttributeWriter, which has been
superseded by NormalizedMetadataStreamWriter. This also forces
XML codec to migrate and take proper care of attribute/metadata
mapping.
JIRA: YANGTOOLS-960
Change-Id: Ie4f54595e9c3bb02b712264a10d49a6fe5513d04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 3 Apr 2019 16:08:58 +0000 (18:08 +0200)]
Switch NodeDataWithSchema to use NormalizedMetadataStreamWriter
Rather than routing attributes, require users to work on metadata.
Change-Id: I99a0b90056d00db6b70ccc4e5635809f50ad410d
JIRA: YANGTOOLS-961
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Apr 2019 00:46:01 +0000 (02:46 +0200)]
Switch XML value encoding
Rather than directly emitting the value, this reworks the patch
to return it encoded. This will be important when we are writing
out annotations.
JIRA: YANGTOOLS-961
Change-Id: I81c970d3b215514059b3d12ffa9c5a9ad5ba986b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 5 Mar 2019 11:40:19 +0000 (12:40 +0100)]
Integrate ImmutableNormalizedNodeStreamWriter with metadata
This adds basic immutable, builder-driven implementation of
NormalizedMetadata.
It also teaches ImmutableNormalizedNodeStreamWriter about
metadata annotations by implementing NormalizedMetadataStreamWriter
interface and exposing acquired metadata through
NormalizedNodeMetadataResult.
JIRA: YANGTOOLS-961
Change-Id: Ifff34a8885a5ee0593520d6aae47c55adfcd66dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 3 Apr 2019 21:34:03 +0000 (23:34 +0200)]
Teach CodecCache about AnnotationSchemaNodes
AnotationSchemaNodes are also typed, they need to be handled by codec
caches. Achieve this by allowing any composition of SchemaNode and
TypeAware to be used.
JIRA: YANGTOOLS-961
Change-Id: I6397d6dc21b18d07e7581dbda6c5d66fa64d0df0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 3 Apr 2019 19:52:08 +0000 (21:52 +0200)]
Define legacy unprefixed XML attribute namespace
Since we are switching from pass-through XML attributes to a proper
definition of RFC7952 metadata, we need a conduit to handle legacy
unprefixed attributes until they can be properly bound to their
metadata (or similar, like RFC6241) definition.
This patch adds the namespace and language to support such attributes.
JIRA: YANGTOOLS-961
Change-Id: Ie5763f77faad0a4c480d081ba06ac0f9df420b20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 31 Mar 2019 22:29:56 +0000 (00:29 +0200)]
Expose all child annotations
There is no real point in hiding what children are available, at
least not for now. Expose children as a map.
Change-Id: I5152379a45ecd173bc798de76f177eed8427c605
JIRA: YANGTOOLS-961
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 29 Mar 2019 09:51:31 +0000 (10:51 +0100)]
Expose QueuedNotificationManager statistics
This backports the MXBean defined in the controller project and makes
an implementation of it available through getMXBean().
JIRA: CONTROLLER-653
BUGZILLA: BUG-1446
Change-Id: Ica8dff7aef8989f2b23b1fc8c100a535998273b1
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 28 Mar 2019 20:41:09 +0000 (21:41 +0100)]
Add ImmutableNormalizedNode implementation
This updates the design a bit and adds a builder-driven
implementation.
JIRA: YANGTOOLS-961
Change-Id: I74546d25b045abda23f0fce35bb064178c841c64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 28 Mar 2019 16:21:53 +0000 (17:21 +0100)]
Create YangInstanceIdentifier serialized form
We will need to evolve YangInstanceIdentifier and PathArgument, but
they are bound to their serialized form. Add Externalizable proxies
so we can move them in the future somewhere else.
JIRA: YANGTOOLS-979
Change-Id: I6823c55c2cbd1abe9e05945a4fbb2de411fe0792
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 27 Mar 2019 16:26:00 +0000 (17:26 +0100)]
Update QueuedNotificationManager.BatchedInvoker
Since QueuedNotificationManager is a final class, there is no
point in hiding the fact the listener is invoked with
ImmutableList<N>, which is a much friendlier proposition than
an opaque Collection<? extends N>. Fix that up.
Change-Id: Iebd233ba250487710d726406890899b73133ecff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>