Stephen Kitt [Tue, 31 Jul 2018 10:20:34 +0000 (12:20 +0200)]
Use CheckUtil instead of CheckUtils
In Checkstyle 8.11, CheckUtils became CheckUtil.
Change-Id: I9508d4893ca36b1f1ae3fc13d8715b23eb3a59df
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Stephen Kitt [Tue, 31 Jul 2018 09:29:06 +0000 (11:29 +0200)]
Switch to odl-guava feature
Change-Id: I7bf4883e1a7a766a4d267f948ba2d6c901a12eac
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Stephen Kitt [Fri, 27 Jul 2018 15:50:25 +0000 (17:50 +0200)]
Build with Mockito 2.1
This adjusts to Mockito changes, including most tests.
Change-Id: I75bea532168c68a4a468f2b41a458d40429ccbe8
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Mon, 30 Jul 2018 17:27:35 +0000 (19:27 +0200)]
Use odlparent-4.0.0-SNAPSHOT
This is a pre-integration on snapshots, so we get a lookahead for
yangtools-2.1.x.
Change-Id: Iec981bbf6acc781beb6d63cf99cd0855dd3f5266
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Aug 2018 09:13:53 +0000 (11:13 +0200)]
Make empty augmentations disappear
Augmentations are pure structural elements, which should disappear
when empty, as they have no semantic meaning.
JIRA: YANGTOOLS-585
Change-Id: I73d269e0da144180a455286420d35f1936434108
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 31 Jul 2018 00:10:03 +0000 (02:10 +0200)]
Make empty lists and choices disappear
This achieves automatic lifecycle behavior, so that lists disappear
as soon as they have zero elements.
Bug4454 test is updated to account for the list disappearing under
normal operation.
JIRA: YANGTOOLS-585
Change-Id: I68220043c0f335324e5a8788b2872f57b750aae9
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Aug 2018 13:01:45 +0000 (15:01 +0200)]
Bump versions to 2.1.0-SNAPSHOT
This starts the development of 2.1.x release train.
Change-Id: I9f369f7386291a8555ac66057f9d71f27b0ab68f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Stephen Kitt [Tue, 31 Jul 2018 09:29:37 +0000 (11:29 +0200)]
Avoid depending on immutables.value at runtime
Change-Id: I7e4ffea6b51523341e46380c3754d788f676a664
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Mon, 30 Jul 2018 22:23:52 +0000 (00:23 +0200)]
Introduce map-related ImmutableNodes operations
These will come in handy for creating empty lists.
JIRA: YANGTOOLS-585
Change-Id: I3173baa03d540196caf50312652dba1876b8b1b9
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 30 Jul 2018 05:21:55 +0000 (07:21 +0200)]
Expand CompatUtils to handle leaf-lists
The rules outlined in compatLeafType are applicable to leaf-lists,
too. Allow leaf-list types to be queried by adding a TypedDataSchemaNode
variant as compatType().
Change-Id: Ia6a3e4cf198069137c470008fde934de64b96996
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 28 Jul 2018 08:26:56 +0000 (10:26 +0200)]
Update CursorAwareDataTree{Modification,Snapshot} API
Create an explicit openCursor() method and return Optional instead
of a Nullable.
Change-Id: I6a9f11726f85acb86e6aaf30b7ede12b8420da37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Jul 2018 08:07:28 +0000 (10:07 +0200)]
Bump versions for next version
Bumps versions to 2.0.10/1.0.10-SNAPSHOT.
Change-Id: I8ff720c54951498aa81dc3dc6f10fe40a039e23c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Marek Gradzki [Tue, 17 Jul 2018 12:09:23 +0000 (14:09 +0200)]
Fix LeafRefValidatation for refs defined in augmentations
LeafRefValidatation.validateNodeData traverses
children of a NormalizedNode
that contain leafrefs or are leafrefs' targets.
Information about referencing nodes and nodes being referenced
is stored in LeafRefContext under QName key.
But AugmentationNode has no QName, so validation was failing
with UnsupportedOperationException.
As a fix, validateNodeData is recursively invoked on AugmentationNode,
to fall into DataContainerNode case.
JIRA: YANGTOOLS-821
Change-Id: I5de7c814f0abe0aec31cced24ea09692bd63a584
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Stephen Kitt [Thu, 19 Jul 2018 12:56:35 +0000 (14:56 +0200)]
Bump to odlparent 3.1.3
Change-Id: I9bdc0215beda398b989bce092df37f3a84f9105a
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Mon, 16 Jul 2018 16:42:21 +0000 (18:42 +0200)]
Bump to next development version
This bumps artifacts 2.0.9/1.0.9-SNAPSHOT.
Change-Id: Ifb1d79ee70e02545b025d2929af7eead9f8958f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Jul 2018 08:04:04 +0000 (10:04 +0200)]
Refactor YangFunctionContext
This fixes code duplication, making sonar happy.
Change-Id: I068b46d654d8f8df378fda7434eb97fba6b8e92f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Jul 2018 08:47:32 +0000 (10:47 +0200)]
Add AbstractEffectiveOperationContainerSchemaNode
InputEffectiveStatementImpl and OutputEffectiveStatementImpl are
pretty much exactly the same, add a common superclass to hold their
implementation.
Change-Id: I1b7b174a006da8430f233a1ac43591cdf6563912
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Jul 2018 08:35:38 +0000 (10:35 +0200)]
Introduce AbstractEffectiveOperationDefinition
RpcEffectiveStatementImpl and ActionEffectiveStatementImpl share
most of their implementation, extract it into a common class --
AbstractEffectiveOperationDefinition
Change-Id: I8ef70d065a0f5c667843613a2df939ce4a5fb5b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 15 Jul 2018 23:51:59 +0000 (01:51 +0200)]
DeclaredStatements can contain default implementations
This eliminates code duplication in implementations, hence is useful
to centralize as a default method.
Change-Id: Icbb1c23018d0104d2e86cb309063b6f924b35337
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 15 Jul 2018 23:38:16 +0000 (01:38 +0200)]
Add ConfigStatementContainerDeclaredStatement
The missing link between ConfigContainerStatement and DeclaredStatement
is filled in, providing a default implementation getConfig().
Change-Id: Icc9c65b0d74bcb0a8a8d1db13514c3ffca86038d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 15 Jul 2018 23:17:09 +0000 (01:17 +0200)]
Add DeclaredStatement utility methods
Effective and Declared statements should share utility methods,
hence update DeclaredStatement to include them.
Change-Id: Ifb9a2b4aedd41ef93c02995e99dc51897dc57db1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Michal Cmarada [Wed, 11 Jul 2018 15:18:59 +0000 (17:18 +0200)]
YANGTOOLS-890 - Fix XML parser bug
When model contains list which has the same name as its
encapsulating parent container it leads to
IllegalStateException: Attributes can be extracted only
from START_ELEMENT. This is caused by list not beeing
processed correctly and one additional empty list item
is created. To fix this it is necessary to end the loop
when end list element is reached.
Change-Id: I0d6f6ec356e503fcfc941f18d9133ea0c9cebc6c
Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Dana Kutenicsova [Fri, 13 Jul 2018 13:26:58 +0000 (15:26 +0200)]
Fix inappropriate warning.
Change-Id: Ib6545ec0ab3911050f9b8f34f81f240620b2f0ea
Signed-off-by: Dana Kutenicsova <dkutenicsova@frinx.io>
Robert Varga [Wed, 11 Jul 2018 21:48:29 +0000 (23:48 +0200)]
Add ObjectRegistry
This is a cleaned-up version of ListenerRegistry, providing a simple
API.
Change-Id: Ic98c702523530db746449d50e6d910cb278261a4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 12 Jul 2018 11:50:22 +0000 (13:50 +0200)]
Remove CPD-reported copy&paste
This refactors methods to have a common utility, keeping CPD happy.
Change-Id: I94e003a8d06fb7047ddfc51ae12c78b348334de6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 12 Jul 2018 09:14:45 +0000 (11:14 +0200)]
Add support for incremental Prerequisites
We really need a method which would allow us to follow a path,
hooking incrementally to each of the elements as they appear.
This patch adds the mechanics to support that lookup, rendering
SchemaNodeIdentifierBuildNamespace largely superfluous, as we
can perform equivalent lookups on ChildSchemaNodeNamespace.
JIRA: YANGTOOLS-859
Change-Id: I7dae9559555ee6ddc95faf1f874cebac9f915c1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Jul 2018 22:40:08 +0000 (00:40 +0200)]
Add AbstractDelegator.toString()
It is useful to provide a baseline identification, add the bits
needed.
Change-Id: I5d1c0e324672d150cf13a5de1a20f3aaa7d7dea4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Jul 2018 20:31:26 +0000 (22:31 +0200)]
Update ListenerRegistry implementation
ListenerRegistry needs some usability improvements in the future,
as well as it can be written with better GC behavior.
Change-Id: Ibcef7af65816a0f084b8614718bade64a3f0f11d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Jul 2018 18:10:34 +0000 (20:10 +0200)]
Document Delegator and AbstractDelegator
Document Delegator.getDelegate() and add an abstract base class
for implementations.
Change-Id: I36426d1862b786fc5413baed7d6ded1fd3f5d4e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 10 Jul 2018 11:19:21 +0000 (13:19 +0200)]
Reduce sonar code smells
In an effort to get Sonar cleaned up, remove valid code smells
reported by it.
Change-Id: I4fc293fbc29c786699c247648b7c0af68044bded
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Jul 2018 16:45:25 +0000 (18:45 +0200)]
Update ModuleActionBuilder and StmtContext documentation
This patch clarifies the API contract around reactor primitives,
so it is clearer as to what the arguments and methods mean.
JIRA: YANGTOOLS-859
Change-Id: I8c4eed7c43dc217547cce57855768b342a698b90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 9 Jul 2018 16:34:28 +0000 (18:34 +0200)]
Limit namespace lookps of import prefixes
Namespace definitions of ImpPrefixToNamespace, ImportPrefixToModuleCtx
and ImportPrefixToSemVerSourceIdentifier are wrong in that they include
search within other imported modules.
This is overreaching and results in false-positive lookups on these
namespaces -- i.e. even prefixes which are not declared in the local
source are lookup up successfully if a matching definition is found
in any of the modules which are imported by local module.
JIRA: YANGTOOLS-889
Change-Id: I28adefef4651a15b191915d7d50d5359d78cb9fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Jul 2018 15:25:37 +0000 (17:25 +0200)]
Fix ModificationPath.toString() reference
Adding ModificationPath unfortunately broke message reporting
in ModifiedNodeDoesNotExistException. Fix that by capturing
YangInstanceIdentifier and reuse it for String.format().
Change-Id: I0e35bdc1362913d6c2794b2187f8152846a913a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 Jun 2018 17:03:21 +0000 (19:03 +0200)]
Bump version for next development cycle
This patch starts the 2.0.8 development cycle.
Change-Id: I1f82ddc6375b0dd3690b6844fce1e3932e801745
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Wed, 30 May 2018 13:54:04 +0000 (15:54 +0200)]
Bump odlparent to 3.1.2
Change-Id: I9da9e4659105f76e2c60574a2af7c9dd7c8515cd
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Thu, 21 Jun 2018 11:04:11 +0000 (13:04 +0200)]
Fix JDK9 pattern handling
Java 9's Pattern is reporting different error strings, deal with
that.
Change-Id: I8f3035530f10a77b23f1531c0ced0b0532795608
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 21 Jun 2018 11:03:43 +0000 (13:03 +0200)]
Fix JDK9 compilation
We need an explicit cast here to suppress javac9 error.
Change-Id: I82b2d6b06a26eebc773863c217a044c56e9432e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 27 Feb 2018 08:25:29 +0000 (09:25 +0100)]
Add DataTreeAwareEffectiveStatement
YANG defines two distinct ways to look at a YANG model:
- schema tree: The definition hierarchy specified within a module.
- data tree: An instantiated tree of any data modeled with YANG,
e.g., configuration data, state data, combined
configuration and state data, RPC or action input,
RPC or action output, or notification.
This means that there really are two notions of 'a child node',
based on schema tree, or based on data tree. The data tree is
a strict subset of schema tree. The layout of the data tree is
such that it does not include RPCs, actions nor notifications --
addressing data tree nodes encapsulated in these requires
first reaching the encapsulation point via schema tree walk.
This patch introduces DataTreeAwareEffectiveStatement
and its companion DataTreeEffectiveStatement, updating extant
statements to support it.
Construction of this namespace has a side-effect of finding
duplicate data nodes within each level of hierarchy, thus fixing
YANGTOOLS-883.
JIRA: YANGTOOLS-853
JIRA: YANGTOOLS-883
Change-Id: Id02bb2557845000fe7fa90d1bf56c8425cce24fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Robert Varga [Tue, 27 Feb 2018 08:25:29 +0000 (09:25 +0100)]
Add SchemaTreeAwareEffectiveStatement
YANG defines two distinct ways to look at a YANG model:
- schema tree: The definition hierarchy specified within a module.
- data tree: An instantiated tree of any data modeled with YANG,
e.g., configuration data, state data, combined
configuration and state data, RPC or action input,
RPC or action output, or notification.
This means that there really are two notions of 'a child node',
based on schema tree, or based on data tree. The data tree is
a strict subset of schema tree.
This patch introduces SchemaTreeAwareEffectiveStatement
and its companion SchemaTreeEffectiveStatement, updating extant
statements to support it.
JIRA: YANGTOOLS-853
Change-Id: Id2c41bb30c4376a846e4e974033b6d621ecfb155
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 12 Jun 2018 16:01:08 +0000 (18:01 +0200)]
Bump version for next development version
This is start of yangtools-2.0.7.
Change-Id: I8d4bbd2b5a2cab84e67cb74d71a83ec85f289b68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Tom Pantelis [Fri, 8 Jun 2018 13:34:19 +0000 (09:34 -0400)]
Improve FilesystemSchemaSourceCache mkdirs handling
mkdirs returns false if the directory already exists. Although
it check exists prior to mkdirs, it's possible for the dir to be
created by another thread in between the calls so make it robust
by checking isDirectory (which also checks exists) if mkdirs returns
false.
Change-Id: If63a2d20400c3093f0aea4c22192fa0e01fde748
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
Robert Varga [Wed, 6 Jun 2018 11:37:04 +0000 (13:37 +0200)]
Fix SchemaContextUtil RevisionAwareXPath resolution
The mapping of yang-model-api SchemaNode hierarchy to YANG namespaces
is confusing, which is compounded by naming -- invoking notions
of equivalence when there is none.
This is very much evident when dealing with children identified by
QName in various contexts -- they usually work, but break down when
choice/case nodes are encountered, because their addressability is
different based on context -- they are addressable via 'node identifier',
but are invisble to XPath contexts.
Document the difference in extant DataNodeContainer and DataSchemaNode
API and introduce DataNodeContainer.findDataNode(), which follows
RFC7950 'data tree', not 'schema tree'.
Change-Id: Ic570da8dd97a686423c7e2b28e0db0d9c6907271
JIRA: YANGTOOLS-885
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 30 May 2018 10:31:24 +0000 (12:31 +0200)]
Improve SingletonSet.spliterator()
We can use a Iterator-less version of the spliterator, adding
further characteristics. Expose these spliterators via
SingletonSpliterators utility class.
Change-Id: I3d7e19cc303c2f0c9c9d79d173bb78d8d5b77eac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 29 May 2018 23:26:05 +0000 (01:26 +0200)]
Add util.concurrent.FluentFutures
FluentFuture provides a lot of ergonomy for API users, so we should
promulgate its use. Unfortunately Guava does not provide convenient
enough APIs and lacks some common constants which are useful.
JIRA: YANGTOOLS-884
Change-Id: I5989f5b3cb78e2e7e8c87183e6ebb08981cae378
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 29 May 2018 19:40:51 +0000 (21:40 +0200)]
Correct Spliterator characteristics
Mutable KeySet/EntrySet versions should report Spliterator.CONCURRENT
rather than Spliterator.IMMUTABLE. Fix that.
Change-Id: I592f79e7ac7b5d401f852ba6981efd490df5c36d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 29 May 2018 12:13:06 +0000 (14:13 +0200)]
Remove ClassLoaderUtils.findFirstGenericArgumentTask()
This has a single caller, inline it there, eliminating a warning.
Change-Id: I8c472df53dec83547b074657343754ed3d75b56a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 28 May 2018 16:49:34 +0000 (18:49 +0200)]
Fix YangModelDependencyInfo handling of arguments
Malformed YANG models could cause a NPE, let's be careful around
them and report IAE instead.
Change-Id: Idf31e2e383142e1283c978eccdf123faa7e40617
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 28 May 2018 07:43:15 +0000 (09:43 +0200)]
Bump versions to next development cycle
1.0.6-SNAPSHOT/2.0.6-SNAPSHOT.
Change-Id: Idb57c0481550a55630b8f401905e207404d9751f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 21:02:12 +0000 (23:02 +0200)]
Track current path in a stack
Rather than creating temporary InstanceIdentifiers, which eagerly
calculate hashCode and cost 32-64 bytes each, use a dedicated stack,
which costs 72-112 bytes without the need for hash code computations.
Since a DataTree may not start at YangInstanceIdentifier.EMPTY, we
need to have a dedicated subclass to properly report the full path.
The contents of the stack are converted to a YangInstanceIdentifier
when needed -- which is only in error paths.
Change-Id: Ifd77a79e6d7481a4355ecb052c9fc2d2c3c1f463
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 22 May 2018 09:07:47 +0000 (11:07 +0200)]
Introduce RequiredElementCountException
This exception captures min-elements/max-elements validation failure,
allowing users to recognize it.
Change-Id: Ia3a8a9a4f90978bac1cf7ced24980fc82cd8582c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 22 May 2018 09:03:46 +0000 (11:03 +0200)]
Eliminate synthetic bridge methods in DataValidationException
Having private constructors requires the compiler to create bridge
methods, relax constructor visibility.
Change-Id: Ibc584b8970d1f288794a45a8df7cf74412b47cac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 17:07:23 +0000 (19:07 +0200)]
Cleanup yang-data-impl tests
- remove unneded throws
- do not store SchemaContext when not needed
- cache SchemaContext when it is used for multiple tests
Change-Id: I7a9ce0bcd08454409e371ca72957b1a4015dedbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 16:25:35 +0000 (18:25 +0200)]
Fix min/max validation inside written value
When the user is writing a complete tree min/max elements
validation needs to occur inside validateStructure(), as that
runs when the data is being introduced. If we fail to validate
it then, the parent will be committed with the assumption that
the written value actually conforms to the schema.
Fix MinMaxElementsValidation to check the number of elements
inside verifyStructure(), so we flat out reject invalid writes.
JIRA: YANGTOOLS-776
Change-Id: Ie804463612403c578f0f9230884ae53641ba76c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 19:44:08 +0000 (21:44 +0200)]
Clean up AbstractDataTreeTip
Remove duplicate code and use static imports for checkArgument()
and checkState().
Change-Id: Ief1bc003e4bdca87188447e11cf3bd7d20c90fae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 22 May 2018 02:05:33 +0000 (04:05 +0200)]
Add cursor benchmarks
Cursor operations are supposedly more efficient as they do not need
to go through YangInstanceIdentifier. Add a microbenchmark to test
that theory.
Change-Id: Ic98b5219bfe5629b0edf6f4cbf8265695afa25f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 22:01:53 +0000 (00:01 +0200)]
Fix benchmarks
Benchmarks have been in a state of disarray, fix them up:
- use yang-test-utils
- properly ready modifications
- upgrade JMH to 1.21
Change-Id: I8fa90cdde3b56664935685ad62452bb7c272cf3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 22 May 2018 01:29:33 +0000 (03:29 +0200)]
Remove checkstyle-logging
Aggregator poms should not be doing checkstyle, remove it.
Change-Id: Ie4560db89d5f03f40a8b28ce1db911c8aec245b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 22 May 2018 00:42:04 +0000 (02:42 +0200)]
Expose ImmutableNodes.mapNodeBuilder(NodeIdentifier)
This utility is useful for users who have a NodeIdentifier handy,
bypassing NodeIdentifier.create().
Change-Id: I10f16ce5048ccb3b646761694b38f431447e09f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 20:09:42 +0000 (22:09 +0200)]
Add a few 3.0.0 FIXMEs
Clarify thrown exceptions and nullness, as well as the need to use
Optional.
Change-Id: I8a960b2593b87552f24d0de3d28cb75a1d4fb040
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 17:21:40 +0000 (19:21 +0200)]
Fix a raw type user
We don't really need to use raw types -- qualify the case and remove
corresponding @SuppressWarnings.
Change-Id: I0797b26bb40059654b718beeaf20095aebd9c3c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 17:32:41 +0000 (19:32 +0200)]
Fix AbstractValueNodeModificationStrategy message typos
We are missing a space in the message, fix that.
Change-Id: Iddc718ebd04d41fa6f994aa9310e9f8bf9b55e5c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 14:39:03 +0000 (16:39 +0200)]
Fix SchemaAwareApplyOperation whitespace
There should be only one space
Change-Id: I1fb3cb1427f356d4d51fc79ee2ffec236e296e5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 21 May 2018 14:38:48 +0000 (16:38 +0200)]
Fix a javadoc typo
writen -> written
Change-Id: I383996cd5b38de896dd1efe1a5ad2595ff4a5bf8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 16 May 2018 15:23:17 +0000 (17:23 +0200)]
Make tests use UntrustedXML instead of XMLInputFactory
We really do not want to instantiate factories in tests, as they
we do not configure them -- use a pre-configured factory in UntrustedXML.
Change-Id: I7b34a426a4fae9819d15053895b5a0aee5af335e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Balaji Varadaraju [Tue, 17 Apr 2018 23:08:32 +0000 (18:08 -0500)]
YANGTOOLS-804: Netconf payload fails to render in JSON for anyxml
When a YANG model contains an anyxml element the output does not render correctly
in JSON in Restconf. XML output works however. Upon investigation we found issue
was with recognising and handling collections in XML. This patch addresses the
same and also enhanced and added more unit tests.
Change-Id: Icb238dd95a3b9af9c4d0f48ff673a7c285925364
Signed-off-by: Balaji Varadaraju <bvaradar@luminanetworks.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 15 May 2018 23:13:04 +0000 (01:13 +0200)]
Add yang-data-api API evolution guidance
This adds 3.0.0 and 4.0.0 evaluation FIXMEs. These need to be accounted
for in release planning and adopted, rejected or pushed out.
Change-Id: I50657a6bbb020189a4ac8662afb16bf1f7b7215f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 12:41:34 +0000 (14:41 +0200)]
Simplify equals() implementation
We can use a simple return statement, do that to keep sonar happy.
Change-Id: I6b7ddbf7c9b7dd65c5595879a84c559b33818905
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 12:37:07 +0000 (14:37 +0200)]
Do not declare URISyntaxException as thrown
This is not thrown from the body, hence we can simply remove it.
Change-Id: Ic5819ddbc25aea0bed7ed7da9ba79a8e40d98a88
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 12:33:10 +0000 (14:33 +0200)]
Move trailing comments
This is to make sonar happy.
Change-Id: Iadb582329c5774c6e302317a70d718869444d2f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 12:26:44 +0000 (14:26 +0200)]
Do not declare runtime exceptions
This is to keep sonar happy.
Change-Id: I306cbab1a471e6aec17e4abc76282766c72164d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 09:13:44 +0000 (11:13 +0200)]
Fix yang-data-impl code smells
This is a pass at addressing Sonar-reported issues.
Change-Id: I39a3aaf3369c6144cc9f03636242809a3de4f4d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 09:07:31 +0000 (11:07 +0200)]
Fix code smells in AlwaysFailOperation
Concentrate IllegalStateException into a utility method.
Change-Id: I45fe9e20cc6c6facfdc4f468cd27d5a2f05719f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 09:06:56 +0000 (11:06 +0200)]
Fix yang-data-jaxen code smell
Using a semicolon confuses Sonar, let's not do that.
Change-Id: I51fee4642b90aa50865b0b1874bf9d81b88fbc77
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 09:06:25 +0000 (11:06 +0200)]
Fix code smell in RootModificationApplyOperation
Runtime exceptions should not be declared.
Change-Id: I04326273b3ed00a0e5f8f3787122ba1fd7360153
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 9 May 2018 09:05:03 +0000 (11:05 +0200)]
Fix YangFunctionContext code smell
Trailing comments are discouraged, move the comment.
Change-Id: Idf7eb55464fe541f9f18095fc819332a786d7cb1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 7 May 2018 11:24:56 +0000 (13:24 +0200)]
Add yang-data-jaxen OSGi activator
While we are providing a ServiceLoader definition, which can be
picked up by SPI Fly, provide an explicit OSGi activator, too.
Change-Id: Id7a221b34c10aeb4f492c9ab71b7af431840d718
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 7 May 2018 09:41:46 +0000 (11:41 +0200)]
Remove misleading TODO
Write+Merge correctly result in both nodes being present, hence
the TODO is not really current.
Change-Id: I14a19ef4f31c665aae264a7a00c7cf41a1a75c6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 13:03:33 +0000 (15:03 +0200)]
Discern exceptions when building LeafRefContext
IOExceptions are unexpected and result in an IllegalStateException,
while LeafRefYangSyntaxErrorException indicates an inconsistent
schema context, hence results in an IllegalArgumentException.
Change-Id: I5282dc964f64af7a46794e3a02e219358fd95285
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 13:00:10 +0000 (15:00 +0200)]
Throw ISE when the thread is interrupted
We really are failing, throw an IllegalStateException rather than
a RuntimeException.
Change-Id: I9a77ff1d537f4836eabbcebf364a070156848949
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 12:57:20 +0000 (14:57 +0200)]
Throw ISE from SharedCodecCache
When we fail to compute a cached value this amounts to an illegal
state -- throw IllegalStateException instead of RuntimeException.
Change-Id: Icafc0b9f054e7d2719f262b2ffac356fac49fa3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 12:52:50 +0000 (14:52 +0200)]
Speed up XMLStreamNormalizedNodeStreamWriter.toString()
We already have a TransformerFactory, no need to create a new one,
which speeds up processing. Also change the thrown exception to
IllegalStateException, as we do not really expect this to fail.
Change-Id: I6710893ec7324a7cba26b13e8d7cdb9c2414167e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 11:32:55 +0000 (13:32 +0200)]
Fix code smells in checkstyle-logging
Simple code structure changes, which will also slightly improve
performance.
Change-Id: I44f78506af8d3b0fb544080e2f6a1b25c9b5e0a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 11:12:19 +0000 (13:12 +0200)]
Fix code smells in yang-parser-spi
These are simple Sonar violations, clear them up.
Change-Id: Ib8e71154ab29e87afff8a3696c8b8749bc2806ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 10:55:03 +0000 (12:55 +0200)]
Fix Sonar-reported code smells in yang-parser-reactor
These are simple violations, fix them up.
Change-Id: I7a9b6a0b1276cb5d74967fb371ef2cdf7645cb84
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 4 May 2018 09:15:05 +0000 (11:15 +0200)]
Bump versions for yangtools-2.0.5 development
This patch bumps to 2.0.5-SNAPSHOT/1.0.5-SNAPSHOT.
Change-Id: Ieb45bc56cad1fdeb2aad057d334b11233c76f365
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 2 May 2018 12:39:12 +0000 (14:39 +0200)]
Make Variant/CheckedValue subclassable
It is useful to specialized these two classes outside of concepts,
for example by providing alternative constructs on top of Variant
and providing a type-bound domain-specific CheckedValue.
Expose constructors and first()/second() to subclasses so that it
is feasible to perform these things.
Change-Id: I1253ba2b0ed115b0b3f6dc6f07138634f15091de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 28 Apr 2018 10:37:52 +0000 (12:37 +0200)]
Do not use jaxen XPath
We are really interested only in Expr and its evaluation, hence we
can skip the BaseXPath class, which is hiding things from us.
This also lowers the memory overhead of compiled expression very
slightly and improves performance, as the result is not needlessly
obfuscated via a singleton list.
Furthermore we no longer go through XPathReaderFactory, which incurs
reflection overhead, but rather instantiate
org.jaxen.saxpath.base.XPathReader directly.
Change-Id: I7fd315c17f4013f927e724226408ba12f8445606
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>