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>
Robert Varga [Wed, 27 Mar 2019 12:32:24 +0000 (13:32 +0100)]
Add AnydataNode
This is the counterpart to AnyxmlNode and to AnyDataSchemaNode:
it semantically binds ForeignDataNode to anydata statement, but
leaves out the object model.
JIRA: YANGTOOLS-977
Change-Id: I0095c6f6b274c9d6fef3d66b1bc4086a72f17899
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 27 Mar 2019 11:02:35 +0000 (12:02 +0100)]
Update NormalizedNodeStreamWriter
This updates the NormalizedNodeStreamWriter to separate out scalar
values and DOMSource values. This separation makes it clear that
anyxml (and anydata) support needs to be separated out into
extensions, so the sender and receiver can agree how to handle them.
JIRA: YANGTOOLS-960
Change-Id: I3dd27d6c8b17dd1996a0f88052658e8f220695fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 27 Mar 2019 09:25:41 +0000 (10:25 +0100)]
Define AnyxmlNode and ForeignDataNode
ForeignDataNode is a NormalizedNode anchor pointing towards values
in foreign object models. A prime example is AnyXmlNode, which holds
a value in DOMSource object model.
Since anyxml data can potentially be held in multitude of formats,
define AnyxmlNode which binds ForeignDataNode as a holder of anyxml
value, but does not further specify object model in use.
Finally AnyXmlNode is refactored to be a DOMSource specialization
of AnyxmlNode.
JIRA: YANGTOOLS-975
Change-Id: I1a5476525d711e3e782ed5f8a0691a9fa51f827f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Feb 2019 12:57:42 +0000 (13:57 +0100)]
Update ClassLoaderUtils methods
This documents some of the methods and ensures they do not return
a nullable reference.
Change-Id: I37bb42602b2ff48ac0c55f6517f3cf4d87eea32e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 09:00:52 +0000 (10:00 +0100)]
YangNamespaceContext should not have a default namespace
Default namespace is usually bound separately from prefix, hence
YangNamespaceContext should not contain it.
Change-Id: I14543635dd33997f5cbc7d0f23405a59446de24c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 17:07:10 +0000 (18:07 +0100)]
Prepare RevisionAwareXPath for XPath integration
This fixes up the mistake of using toString() to expose the original
XPath and defines a WithExpression extension, which allows exposing
the parsed expression.
Change-Id: Iac0c36f6bde106f92b91a4bef768de55ad9e6d41
JIRA: YANGTOOLS-966
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 16 Mar 2019 15:13:55 +0000 (16:13 +0100)]
Rework yang-model-validator packaging
There is no point making this a bundle, keep it a simple jar.
Change-Id: Icdffcdc27bd7238314af4a989d8dda825ac9d91f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:37:23 +0000 (15:37 +0100)]
Remove SchemaNodeIdentifierBuildNamespace
This namespace has been superseded by ChildSchemaNodeNamespace
and its utility methods. Remove it.
Change-Id: I60c0a936fe76c23a0265d4d900a23d71faa94f50
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:31:27 +0000 (15:31 +0100)]
Remove CursorAwareDataTreeSnapshot.createCursor()
This method has been superseded by openCursor(), which has
a slightly better contract. Remove the old method.
Change-Id: I4d7f1befeb20f00a7f67c4eb37e33ddcc8bbd380
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:04:57 +0000 (15:04 +0100)]
Remove deprecated {Cached,Fast}ThreadPoolExecutor constructors
We now require identity of the user to acquire logger.
Change-Id: I8d92583d5ca8fcdae2b32b0d22a77559d2dac83d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:02:56 +0000 (15:02 +0100)]
Remove deprecated QueuedNotificationManager interface/constructor
This now a properly-final class without extraneous API elements.
Change-Id: I96bb9c6a9ae276f5da38057a6eabfdf1225da358
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:24:28 +0000 (15:24 +0100)]
Remove DataSchemaContextNode.augmentationProxy()
This method is superseded by EffectiveAugmentationSchema#create(),
remove it.
Change-Id: Ifc30aa4f11ae79d8ed132a93f36c8330a8a77530
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:15:03 +0000 (15:15 +0100)]
Remove duplicate {Declared,Effective}Statement methods
EffectiveStatementBase and AbstractDeclaredStatement pre-date
our use of Java 8 and provided methods to access substatements.
These methods are now part of interface contract, so we can safely
remove their old counterparts.
Change-Id: I10a3b0b3b280af1d41849f7f4f7ef97acb84da39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:13:48 +0000 (15:13 +0100)]
Remove getNodeIdentifierForAugmentation() methods
These are duplicates of the now-centralized method
DataSchemaContextNode#augmentationIdentifierFrom(), remove them.
Change-Id: I289b9b8cfdf808966ea822660088234e551e8c69
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 14:10:16 +0000 (15:10 +0100)]
Remove XMLStreamNormalizedNodeStreamWriter.toString()
This method is not used anywhere, forces us to have a dependency
on transformers and does not allow control over output augmentation.
It has been deprecated in 2.1.x release train, remove it now.
Change-Id: I07b048e16efba657045c4f0ce10376672f0ddece
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 13:59:46 +0000 (14:59 +0100)]
Enforce namespace during input/output lookup
We do not tolerate mismatched RPC/action input/output lookups,
as we now check whether the QName matches before going to localName
dispatch.
Change-Id: Ideec2ab0189b085a8aa791edd0db3aa8def45b17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:47:58 +0000 (11:47 +0100)]
Push out FIXMEs
Push the FIXMEs out to 4.0.0, as we cannot fix them all in 3.0.0
release.
Change-Id: I7192a28569e5f9eaaa5c9693659e4996af99782c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:30:40 +0000 (11:30 +0100)]
Use NPE to report null arguments
Our system should not be tolerating nulls, remove use of IAE
in favor of NPE, so that users are forced to guard.
Change-Id: I35c6521c99f12257deb76ea6fe571faaffec7130
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 11:56:56 +0000 (12:56 +0100)]
Address FIXMEs in StatementStreamSource
We are promoting YangVersion-bearing methods to full contract,
remove the FIXMEs we have had and place a new one for 4.0.0.
Change-Id: I1d02fe5266d17c16b17acb93d78d4579ff43126a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 12:07:02 +0000 (13:07 +0100)]
Make DataTreeSnapshot extend SchemaContextProvider
SchemaContextProvider is the proper contract we want to expose
here. Most notably its @NonNull version.
Change-Id: Ib11c7985d8e1372b2993d17be6aa3a4d460ba574
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 11:50:42 +0000 (12:50 +0100)]
Split out ReadOnlyDataTree interface
Having a read-only view of the DataTree operations allows us to
more safely express access rules, i.e. make it impossible for illegal
access to occur.
Change-Id: I67ae6c8423f63f0686cc7ba2286b0df4b44585ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Danielle Mustillo [Mon, 25 Mar 2019 18:27:45 +0000 (14:27 -0400)]
Strings Ending in Backslash are Improperly Lexed
Using greedy match for SUB_STRING fragment's forward lookahead
is troublesome because it will consume all non-double-quotes
until the final one -- including any escapes present.
This patch fixes the lexer to use non-greedy subrule, so that
escapes are properly accounted for.
JIRA: YANGTOOLS-971
Change-Id: Ic93c5c2bfa807001735125bd0367c29a1a25ea99
Signed-off-by: Danielle Mustillo <danielle.mustillo@ericsson.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 11:43:00 +0000 (12:43 +0100)]
Remove a stray FIXME
This FIXME was addressed already, remove it.
Change-Id: I697fbf5dec237b6a1b726058d58abd6bf9862805
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:52:18 +0000 (11:52 +0100)]
Make TreeNode @NonNullByDefault
This reflects our intent, so make sure we declare it.
Change-Id: I8023e161207aff6f230a651cf6e06dde8f478279
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 11:39:50 +0000 (12:39 +0100)]
Make buildEffectiveModel() non-default
This addresses a previous FIXME.
Change-Id: I2a112116ebca2a8fb375a2f812cbac1187003ac0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:46:21 +0000 (11:46 +0100)]
Address DataTreeTip 3.0.0 FIXMEs
This documents exceptions being thrown and switches to
@NonNullByDefault.
Change-Id: Ibb8df7bb87fbf29888bc95dc978def3229bbcc06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:25:54 +0000 (11:25 +0100)]
Remove impossible checkArgument()s
Private methods' callers are ensuring these cannot trigger, remove
them.
Change-Id: I6783c348ef15866fc34173940fa8ad6d8346887e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:23:41 +0000 (11:23 +0100)]
Address spotbugs warnings
StringIdentityrefCodecs seem to be unused, fix them up a bit
and note their Beta status.
Change-Id: Ia758c3211419411e5934bc66b804057ec4581535
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:10:50 +0000 (11:10 +0100)]
Partially address Codec/Serializer/Deserializer design note
Require non-null input and output, as we should not be encountering
nulls anywhere.
Change-Id: I62655886011d47d4d3495722ac284d055df1a986
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 09:56:22 +0000 (10:56 +0100)]
Clean up DataTreeCandidateNode contract
Use Optional instead of nullable and clarify that the interface
may return a UNMODIFIED node.
JIRA: YANGTOOLS-954
Change-Id: I8e394e14522a9074d503484c5893d5d5a739e4e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 10:13:39 +0000 (11:13 +0100)]
Remove illegal FIXME notes
FluentFuture has moved to be inconvenient to proxy and instantiate,
remove the FIXME which advised transitioning to it.
Change-Id: I85ee7b2cda71704c3df24139bc55ec2fe81b334c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 08:50:46 +0000 (09:50 +0100)]
Add basic support for lenient path expression parsing
This promotes getLocation() to full PathExpression member, allowing
implementations to throw na exception. It also splits path expression
support into lenient and strict, allowing reactor builders to choose
their implementation.
Change-Id: Ia32a22f3de1b3997795400499c7847e1d91ba59e
JIRA: YANGTOOLS-969
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Mar 2019 08:19:49 +0000 (09:19 +0100)]
Add rename notes for Any{Data,Xml}SchemaNode
These interfaces should be renamed to keep consistency with other
SchemaNodes.
Change-Id: Ia5543040817607effdc8f9bbc542c3bdb7e32fd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 25 Mar 2019 17:21:26 +0000 (18:21 +0100)]
Add RFC6241 parser support
This adds extensions to identify get-config/get filter anyxml
nodes. While we provided an implicit support for the extension,
this adds proper extension capture as well as suppressions so
that the extension is not generated outside of its two allowed
places.
JIRA: YANGTOOLS-831
Change-Id: Ib38c31f1b2dd82793cebe72f0ba8e7300f1b6404
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 19 Mar 2019 20:36:17 +0000 (21:36 +0100)]
Integrate leafref path argument parser
This teaches YANG parser to properly parse leaf-ref path expressions,
persing them as needed.
This ends up flushing out problems in test models, which are fixed up,
too. leafref-test.yang has one leaf removed, as that definition is not
valid as per RFC7950 (../ can only be leading the path).
JIRA: YANGTOOLS-969
Change-Id: I92c96945b0b630f4298e8753394db3f3db450863
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 25 Mar 2019 20:27:52 +0000 (21:27 +0100)]
Fix YangXPathMathSupport serializability
Supports should always resolve to a singleton.
Change-Id: I9888465d7fe89fbf9c2e75aa4e7a807ea16ed0e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 25 Mar 2019 19:16:38 +0000 (20:16 +0100)]
Add AbstractVoidStatementSupport utility class
No-argument statements are common, add a utility class to handle
their StatementSupport.
Change-Id: Id4b5d49af63b9111de0545a8049cdadb0ecde170
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 20 Mar 2019 17:37:20 +0000 (18:37 +0100)]
Define the concept of unresolved QName
YANG Xpaths have dynamic namespace resolution for the default
namespace: during parse time we can only bind qualified node
identifiers.
Unqualified node identifiers require an explicit default namespace
binding step, which happens between when the XPath is parsed and
when it is evaluated, when the context node is determined.
This is quite visible in the context of leafref path expressions:
- typedef expressions are bound to the leaf/leafset referencing them
- leaf expressions in groupings are bound only after they have been
completely instantiated (i.e. 'uses' outside of grouping context)
Change-Id: I65341793dc520bcc36c45dec76a303080be115a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 25 Mar 2019 17:59:51 +0000 (18:59 +0100)]
Disconnect EffectiveStatements and SchemaNodes
EffectiveStatements are a replacement for SchemaNodes, there should
not be any API-level binding between the two. The connection is made
strictly through implementation.
Change-Id: I2d2736079e41ca03870f2b203a728b3bd9acff56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 25 Mar 2019 10:54:22 +0000 (11:54 +0100)]
Correct LeafrefTypeDefinition
leaf-ref types do not carry a RevisionAwareXPath, but rather
a PathExpression, which is a subset of YangXPathExpression.
JIRA: YANGTOOLS-969
Change-Id: I5694567ea33a5677f653bded7c57887b60d94332
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 25 Mar 2019 10:30:21 +0000 (11:30 +0100)]
Remove unneeded services inclusions
odlparent-5.0.0 contains the appropriate fix, we do not declare
the inclusion ourselves.
Change-Id: If3e6a76d2c1c0d37b93d81aa7f12d281638918bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 25 Mar 2019 08:52:26 +0000 (09:52 +0100)]
Remove unneeded javax.annotation suppressions
We are not pulling in JSR305 anymore, remove import suppressions.
Change-Id: Ibce8b30dab04e4c84d972e02f6b190ffd104a938
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>