Robert Varga [Mon, 4 Sep 2017 07:51:29 +0000 (09:51 +0200)]
Fix benchmark compilation and runtime
Benchmark has been broken for some time, fix it up.
Change-Id: If2e1f3292a110947a1428a096de20e90591b0f6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 24 Aug 2017 14:41:54 +0000 (16:41 +0200)]
BUG-8043: introduce RangeRestrictedTypeDefinition
{Decimal,Integer,UnsignedInteger}TypeDefinition share the same method
and semantics, capture them in RangeRestrictedTypeDefinition.
Change-Id: I5fa6dbf5efdcc3797abc628a98e034602b8285ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 24 Aug 2017 14:32:05 +0000 (16:32 +0200)]
BUG-8043: introduce LengthRestrictedTypeDefinition
{Binary,String}TypeDefinition share the same method and semantics,
capture them in LengthRestrictedTypeDefinition.
Change-Id: Id913e79e2d2c9a2090721c1ed6e5bee8f309051c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 2 Sep 2017 13:06:30 +0000 (15:06 +0200)]
Kill websocket-client
This artifact is a useless experiment, which we do not package
for a long time. Kill it finally.
Change-Id: I9c0fe90065a75809b715606ce857856bd568af42
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 2 Sep 2017 12:25:23 +0000 (14:25 +0200)]
Enable checkstyle on yang-data-codec-gson
Gneeral cleanup and enable checkstyle.
Change-Id: Ib63901ef099b1b457504e2b8e11341ab357a394a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 1 Sep 2017 13:29:10 +0000 (15:29 +0200)]
Remove antlr version override
antlr is pre-configured from odlparent, no need to override its
version.
Change-Id: I86a83c22bea34f95688c63141a30454dd82b4a96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 2 Sep 2017 12:57:53 +0000 (14:57 +0200)]
Activate checkstyle in yang-system-test
Fix a few offences and flip the switch.
Change-Id: I0c0601d3db712b3d9ae8dd6ca53195885d7d81ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 2 Sep 2017 12:53:54 +0000 (14:53 +0200)]
Enforce checkstyle on yang-test-util
Fixup a few warnings and flip the switch.
Change-Id: If82a193f6c3287edb24ef6e19ed78c823d48f736
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Mon, 14 Aug 2017 17:35:33 +0000 (19:35 +0200)]
Bug 7246 - Fix of SchemaTracker initialization and lookup of schema nodes
SchemaUtils methods perform lookup in both the namespace of groupings and
the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs,
actions, notifications, anydatas, and anyxmls. In consequence, performed
lookups are ambiguous due to possible name conflicts between these namespaces.
Change-Id: Icd3e141b21d0adaf0126b539454e640c0ea0b5a6
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Mon, 7 Aug 2017 17:56:13 +0000 (19:56 +0200)]
Cleanup SystemTestUtils
Remove use of deprecated class. Also convert to using collections.
Change-Id: I15eeee89628dfedb2ca0baf9a9b4f318801daddb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 26 Aug 2017 16:50:55 +0000 (18:50 +0200)]
Throw SourceException instead of IllegalArgumentException
TypeUtils already considers StatementSourceReference, so instead
of home-grown format use SourceException.throwIf().
Change-Id: Ifc81db735d72bb7c98b94c66ac013f8dcc47413c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 24 Aug 2017 15:19:09 +0000 (17:19 +0200)]
Mark getIdentity() as deprecated
Super interface marks this as deprecated, implementations should do
the same.
Change-Id: Ic48fe6064e2f0a96b4f35e8cfcd499764451e995
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 24 Aug 2017 14:12:03 +0000 (16:12 +0200)]
BUG-8043: AbstractConstraintEffectiveStatement update
This forms the baseline for implementing sub-interfaces of
ConstraintMetaDefinition, so it should itself implement that
interface.
Change-Id: Idcd9819c7262c236c39c96b8294b128de9f0410e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 24 Aug 2017 12:04:04 +0000 (14:04 +0200)]
Use Guava's Interner instead of ObjectCache
Guava's Interner does pretty much the same thing, no need to use
ObjectCache.
Change-Id: I4ee79155aeac465bfd59392656f555c3509459fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Aug 2017 02:15:43 +0000 (04:15 +0200)]
Do not instantiate needless objects in augment
Non-mutable versions of accessors are cheaper and should be used
wherever we do not modify state.
Change-Id: I200d843b830af59d407da346d0b09aa4909a4467
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 8 Aug 2017 01:39:21 +0000 (03:39 +0200)]
BUG-7052: move copy operation to StatementContextBase
The copy operation works on top of StatementContextBase concepts
aside from argument adaptation. Move the copy operation around,
cleaning up some of the access patterns along the way.
Change-Id: I34413c7d2c4d314503e9c9adffc7e2f0d2ea2531
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Fri, 18 Aug 2017 10:24:32 +0000 (12:24 +0200)]
Bug 9005 - scope of model import prefix should be module/submodule
Yang parser includes all substatements of a submodule into a parent
module including all import statements of the submodule, what causes
mismatch of parent module imports.
Change-Id: I5c0b45348ca5e9f3ae54351c93e940135fe2b99d
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Fri, 18 Aug 2017 10:11:27 +0000 (12:11 +0200)]
Remove yangtools.util.Identifiables
This class does not hold anything useful in Java 8 world and was
deprecated. Remove it.
Change-Id: Id5c870a64f203adda12f9ca697531223c2d5b379
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 18 Aug 2017 12:56:51 +0000 (14:56 +0200)]
Fix AnyXml node handling
Fixup the mixup of calling instanceof on an Optional.
Change-Id: I184e2ad7535129cf19c41dfd5c235285e82e9f28
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 20 Aug 2017 08:28:04 +0000 (10:28 +0200)]
Revert "BUG-7262: Operational data tree should enforce mandatory nodes"
This reverts commit
8befab93f3eb3683ddf68665542bf64c3f36f9f7.
Downstreams are not disconnected from master yet and this exposes
issues with mis-alignment of models and implementation.
Change-Id: Ifc0a9113b7985011be0eff1853d7668e85ece403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 2 Aug 2017 10:52:11 +0000 (12:52 +0200)]
Cleanup testutils
Cleans up sonar warnings and re-organizes code a bit.
Change-Id: I99761f484cd992d994f1bca7c681190a055793cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 6 Aug 2017 23:10:25 +0000 (01:10 +0200)]
Simplify DeviateStatementImpl.addStatement()
There is a copy&paste line here which can be eliminated with some
application of structured programming.
Change-Id: If3fffc7f07648de1456a8fbe02feba44ed40b0e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 7 Aug 2017 01:04:18 +0000 (03:04 +0200)]
Refactor argument adaptation
Adapting arguments is really a StatementSupport-level operation, and
should not be part of a specific reactor implementation.
This patch creates the appropriate interfaces required to have
StatementSupport classes a say when arguments are adapted.
Change-Id: Ifa3e25b96d9f451a53a99a30be2573abe7ee744c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 6 Aug 2017 23:03:08 +0000 (01:03 +0200)]
BUG-7052: remove StmtContext.createCopy()
The two StmtContext.createCopy() methods are the final bits of
spi.meta dependending on stmt.reactor.
This patch eliminates them by introducing Mutable.childCopyOf()
methods, which perform the same function, except the are hosted
in the new parent object, which internally knows it is
a StatementContextBase.
Change-Id: I16978eb62851295a5c922224a051d200c5e32abc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 24 Nov 2016 16:00:57 +0000 (17:00 +0100)]
BUG-7262: Operational data tree should enforce mandatory nodes
This flips the switch on enforcement of mandatory nodes in operational
data trees by default.
Change-Id: Id9c44d119a324ea711c36cea9a87728d0cbcc3ae
Signed-off-by: Robert Varga <rovarga@cisco.com>
Thanh Ha [Mon, 14 Aug 2017 15:36:07 +0000 (11:36 -0400)]
Remove unused property declaration yang.codegen...
yang-codegen-version does not appear to be used anywhere so remove it.
Change-Id: Ib775144a7f38e3fd44256033467fb09456bd1eae
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Robert Varga [Sat, 5 Aug 2017 16:57:11 +0000 (18:57 +0200)]
Eliminate LeafRefPathParseException
LeafRefPathParseException is never caught and used only internally.
Refactor internals to return an Optional() and propagate an IAE instead.
Change-Id: Ibd35390b1481e16a73980d0b5aaf10b929ae282c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 5 Aug 2017 16:56:19 +0000 (18:56 +0200)]
Use ValueNode in LeafRefValidation
ValueNode is the common ancestor of LeafNode and LeafsetEntryNode,
so we can do a single instanceof check.
Change-Id: I3faf13cae56896e234520c8d7498cf85e0e742a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Thanh Ha [Mon, 14 Aug 2017 15:32:30 +0000 (11:32 -0400)]
Bump versions by (x+1).y.z for next dev cycle
YangTools versions are bumped as follows:
1) 0.y.z-SNAPSHOT versions are bumped to 1.0.0-SNAPSHOT
2) 1.y.z-SNAPSHOT versions are bumped to 2.0.0-SNAPSHOT
Change-Id: Iab0b1edc3b72d7d5918db235fc2d9209862f94ed
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Peter Kajsa [Fri, 11 Aug 2017 09:38:08 +0000 (11:38 +0200)]
Bug 8691 - Update yang-parser-impl grammars
Update of YangStatementLexer.g4 after migration to antlr 4.7.
Change-Id: Ie2482c1b155a0119862f855738c5f55d8df938c8
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Thu, 10 Aug 2017 11:25:10 +0000 (13:25 +0200)]
Remove duplicate version declaration
odlparent is declaring this for use, no need to repeat it here.
Change-Id: Ic426ae0fa01f14f90a4c4355106e2420794de1dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Tue, 8 Aug 2017 16:11:16 +0000 (18:11 +0200)]
Bug 8922 - Evaluation of if-features is done regardless of ancestors
Evaluation of if-features for a statement is done regardless of its
ancestors. This is not correct and if an ancestor of a statement is
not supported by features, then current statement should be
unsupported too. In other words, if a statement is not supported by
features, then all its children should be unsupported too.
Change-Id: Ieb8a3c32849808a4492f518f4481aaef45c11cae
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Thu, 10 Aug 2017 00:23:46 +0000 (02:23 +0200)]
Make sure binary values are properly wrapped
Leaking byte[] in case binary leaves an avenue for data modification.
Disallow that by always cloning byte[].
Change-Id: Ic3cde28a4af19800d00f0f1e1ab9084b6e6951ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Tue, 8 Aug 2017 16:14:12 +0000 (18:14 +0200)]
Bump odlparent 2.0.2 to 2.0.4
Change-Id: I17495da43f8cbde07cabcb9d9657737af2e450de
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Igor Foltin [Wed, 9 Aug 2017 12:06:03 +0000 (14:06 +0200)]
Bug 8940: Fix XML parsing of anyxml nodes
The new XML parser unescapes already escaped special characters
in anyxml nodes which triggers an exception when loading parsed
anyxml data into org.w3c.dom.Document object.
Use the Guava's XmlEscapers to properly handle special escaped
characters in anyxml nodes.
Change-Id: Ifa79f7d6f6736253afc5092afded5f118bf84ab5
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Robert Varga [Fri, 4 Aug 2017 21:56:32 +0000 (23:56 +0200)]
Enforce no split packages
This adds a guard to prevent accidental split packages.
Change-Id: I063ec1ee6090c60d177c22c9ad8cbeafb54f70ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 6 Aug 2017 14:05:36 +0000 (16:05 +0200)]
Reduce CheckedFuture proliferation
We are not really using checkedGet() here, hence we can switch
to ListenableFuture.
Change-Id: I7c8e7bbcdc6fe180a88d27079196b9a69cc67dd0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 6 Aug 2017 13:26:52 +0000 (15:26 +0200)]
Remove unneeded version declaration
These versions are declared upstream, no need to repeat them here.
Change-Id: Iac58a882ebbb57206348b48165f013b87aca9ff6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Fri, 4 Aug 2017 13:28:29 +0000 (15:28 +0200)]
Bug 8831 - Yang 1.1 default values are not checked correctly
When a leaf has a union type, and a default that does not correspond
to the first member of that union type, the default is not processed
correctly and IllegalStateException is thrown during the check of if-feature
statements. The same bug occurs also in case, when the default is a
number, which is in the range of the first member of the union etc..
Change-Id: Ic3b165eb5c4416dee2216f47c240ce596e3f7dd2
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Thu, 3 Aug 2017 09:33:30 +0000 (11:33 +0200)]
Cleanup JSONCodecFactory.create() users
JSONCodecFactory.create() is deprecated, use getShared() instead.
Change-Id: I2abf0350391e067e3668760f88776130cf14f74e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 3 Aug 2017 09:29:44 +0000 (11:29 +0200)]
Cleanup SchemaTracker logic
Do not perform duplicate null checks.
Change-Id: If1fa8631e9e6d93fa2063bea0c395d3fdcba87ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Aug 2017 09:47:27 +0000 (11:47 +0200)]
Use Objects.requireNonNull instead of Preconditions.checkNotNull
This is a Java-8 equivalent, use it to reduce dependecies on Guava.
Change-Id: Id4ec468b8908fb4d7a272af607c65b3b0bbc0583
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Aug 2017 09:22:18 +0000 (11:22 +0200)]
Fix/suppress checkstyle warnings
Some of the argument names are coming from superclasses, add suppression
of those. Others can be easily renamed.
Change-Id: I75e746287fc2278790091185d967dfcc2d16d94e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 29 Jul 2017 15:34:44 +0000 (17:34 +0200)]
Share codepath between snapshot methods
Eliminate a bit of code duplication by creating a snapshot()
methods which does the looping. Also fixes up some violations
and makes the contract more explicit.
Change-Id: Ic02f9c148b85cbbef53ab632a22bc68f1c16f6b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Tue, 27 Jun 2017 12:01:53 +0000 (14:01 +0200)]
Fix of Module.getPrefix() to return prefix also in case of submodule
Module.getPrefix() returns null for all submodules.
However, in case of submodule a prefix for module's
namespace is defined in belongs-to statement.
This information is required by yang-export where
namespaces need to be binded to corresponding prefixes.
Change-Id: Ifa5406654021fd017b442b6c351a4e0b4f5fd55d
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Sat, 29 Jul 2017 12:21:20 +0000 (14:21 +0200)]
Downgrade stax2-api to 3.1.4
As it turns out, downstream is using jackson, which is bound
to 3.1.x version of stax2-api. Downgrade to match.
Change-Id: I7a86037abceac8499986af11392da5112570d838
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Igor Foltin [Fri, 28 Jul 2017 11:29:38 +0000 (13:29 +0200)]
Add XmlParserStream.traverse(DOMSource)
This adds an alternative traversal based on DOMSource. This is needed
as it seems XMLStreamReaders based on DOMSource are in short supply and
in some cases we are interpreting a part of an already-parsed Document
as a NormalizedNode.
Change-Id: I3e21daa144ca90d868f71b3f5af318f4c35cc24f
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 25 Jul 2017 11:27:54 +0000 (13:27 +0200)]
BUG-8733: add YangInstanceIdentifierBuilder.append()
In scope of BUG-8733 we need the ability to efficiently append
a set of PathArguments. Introduce a Builder method to do exactly
that.
Change-Id: I06e655490dd5c7e92588eeb5a5e5237479e7ff7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
2671dcb87d3717b0b82e4404d02593d99300399b)
Robert Varga [Wed, 19 Jul 2017 10:51:27 +0000 (12:51 +0200)]
BUG-2389: Deprecate yang-data-impl XML codec
This codec infrastructure has been superseded by yang-data-codec-xml,
deprecate the classes for removal in 2.0.0.
Change-Id: I35b117503eafdcd7ef1268a33ec8303d43d426ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Igor Foltin [Tue, 25 Jul 2017 15:18:39 +0000 (17:18 +0200)]
Bug 8803: check for null return NamespaceContext.getNamespaceURI()
The javadoc indicates that for unbound prefixes this method should be
returning NULL_NS_URI (which is defined as an empty string), and there
is no mention of the possibility of returning null anywhere.
Nevertheless JDK8-default XMLOutputWriter returns null for unbound
prefixes, which leads to an infinite loop in RandomPrefix.
Fix this by adding an explicit check for null, too.
Change-Id: Ib8af7d03eb59b004f2fcb4d1806c0f4f256a974a
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 21 Jul 2017 09:07:09 +0000 (11:07 +0200)]
BUG-8733: add EmptyDataTreeCandidateNode
This class is used by multiple downstreams, hence it is useful to
expose it from DataTreeCandidateNodes.
Change-Id: I88e247c3a9a2cb7fffab4d73f6f8b7ef211a3ea0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
14f1f133238c61049894ee8047c9c253ae9a7b3a)
Robert Varga [Wed, 19 Jul 2017 11:58:20 +0000 (13:58 +0200)]
Make ReadWriteTrieMap extend ForwardingMap
ForwardingMap gives us some of the implementation details we are
duplicating here. Hence subclass ForwardingMap and remove those
duplications.
Change-Id: I5cb6b839f19f2247fb7fdc78f46127739f484898
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 19 Jul 2017 12:10:17 +0000 (14:10 +0200)]
BUG-7464: do not depend on odlparent's triemap
We have our internal fork, not need to pull in odlparent packaging
of it.
Change-Id: I8910df0e484e81bb7a5c7c554833889c8ce336f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 Feb 2017 09:13:49 +0000 (10:13 +0100)]
BUG-7464: Switch to use forked TrieMap
Switch from dead upstream to our forked version of TrieMap.
Change-Id: Ide40b87b96d16500e2a8566d3d627ca1aac8d762
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 19 Jul 2017 09:36:30 +0000 (11:36 +0200)]
BUG-7051: move yang-data support into its own package
yang-data is defined in RFC8040, hence it should not live in rfc6020
package. This allows us to hide some of its details.
Change-Id: Ic965404cff5530863a873fd5d52f7e086339f911
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Thu, 6 Jul 2017 08:05:01 +0000 (10:05 +0200)]
Bug 7051 - Refactoring of StmtContextUtils
Refactoring of StmtContextUtils in order to remove undesired dependencies
on stmt.rfc6020 package.
Change-Id: Ia0e494ba792e9eb8a92aadebb806748af5fe8cee
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Igor Foltin [Thu, 6 Jul 2017 11:53:17 +0000 (13:53 +0200)]
Bug 8745: Add support for parsing attributes to the new XML parser
New XML parser is now able to parse XML attributes in order to provide
necessary information for processing edit-config messages in NETCONF.
Make some members of ImmutableNormalizedNodeStreamWriter
protected so they can be reused
in the EditOperationNormalizedNodeStreamWriter extension in NETCONF.
Add a unit test
This patch is a prerequisite for the following change in NETCONF:
https://git.opendaylight.org/gerrit/#/c/60014/
Change-Id: Idfd87279814e324dc914809fb09abfbb27eefa4a
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Igor Foltin [Mon, 19 Jun 2017 12:37:20 +0000 (14:37 +0200)]
Bug 8715: Add strictParsing switch to the new XML parser
Add the option to switch strict parsing mode on/off to
the new XML parser. If the mode is switched on, the parser
will throw an exception if it encounters unknown child nodes
in YANG containers and lists. If the mode is off, the parser
will skip such nodes.
Change-Id: Ieece9b15ced06282a43877c2c1e884515217244b
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Igor Foltin [Thu, 15 Jun 2017 14:51:24 +0000 (16:51 +0200)]
Bug 8675: Fix a design flaw of the new XML parser
The actual flaw is that the parser wraps the parentNode
SchemaNode inside a CompositeNodeDataWithSchema which emits
only its child nodes into the provided NormalizedNodeStreamWriter.
The parentNode itself is not emitted which is a problem.
Therefore we need to check the parentNode type and put it
into a corresponding ...NodeDataWithSchema.
Bug description on bugzilla has been updated with a more
thorough explanation.
Adjust existing unit tests accordingly.
Add javadocs to ...NodeDataWithSchema classes.
Change-Id: I900717f652cd93e36c229bc91d3854b5ab99f09a
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Robert Varga [Fri, 7 Jul 2017 08:41:13 +0000 (10:41 +0200)]
BUG-6972: eliminate StmtContext.getOrder()
This is not really used, so try to eliminate it, saving a couple
of bytes in StatementContextBase.
Change-Id: If9a5126c9110f50324bb94b7fecdb3845874b763
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 7 Jul 2017 00:22:06 +0000 (02:22 +0200)]
BUG-6972: Add OptionaBoolean utility
This utility allows us to store an optional boolean in a byte field,
reducing the cost from 2 bytes (two boolean fields) or 4/8 bytes
(reference) to a single byte.
Also converts eligible classes. Trims down StatementContextBase
and DeviateEffectiveStatementImpl.
Change-Id: I5444bd4bb7aa0ea52202b08fcfcf9207ea045fa9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 9 Jul 2017 17:13:34 +0000 (19:13 +0200)]
Bump odlparent to 2.0.2
Adjust to new release.
Change-Id: Ibafa857802141994140027f203656eee64323694
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Tue, 4 Jul 2017 10:56:39 +0000 (12:56 +0200)]
Bug 7051 - moving of SubstatementValidator into spi.meta package
Moving of SubstatementValidator into spi.meta package in order
to remove undesired dependencies between parser packages.
Change-Id: If0b3bb969c25c37fb4658fa9c4659d53e13c04bb
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Mon, 3 Jul 2017 08:52:47 +0000 (10:52 +0200)]
Bump odlparent dependency to 2.0.1
Bumps odlparent to latest release.
Change-Id: I42d4b70ebb140696c269301cfb2ca405bf061487
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Igor Foltin [Tue, 20 Jun 2017 14:01:17 +0000 (16:01 +0200)]
Fix uninitialized ExtensionDefinition for openconfig-version
The StatementDefinition for openconfig-version extension is
not bound to any revision. When populating the ExtensionNamespace
with openconfig-version, we have to store it with a revisionless
QName key. This way we can properly extract the corresponding
ExtensionDefinition later down the road in the
UnknownEffectiveStatementBase.
This issue causes NPE in MDSAL's binding generator v2.
Change-Id: Ie24c09b56986c87b5118d715ec6c8e755cf07ebe
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Robert Varga [Wed, 21 Jun 2017 14:03:22 +0000 (16:03 +0200)]
Bump odlparent dependency to 2.0.0
This patch updates the dependency to 2.0.0. Furthermore it eliminates
karaf 3 features and fixes Guava changes.
Change-Id: I2f9d3bda9ed12c58ca44f44e66f1110cceaf200b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 15 Jun 2017 12:20:37 +0000 (14:20 +0200)]
Remove use of ALTLRInputStream
As of 4.7, CharStreams is a better interface for this same
functionality.
Change-Id: I1ceadded34654fbfe3f4e4402b714c21c857fe4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 14 Jun 2017 12:05:48 +0000 (14:05 +0200)]
Bump antlr4 to 4.7
https://github.com/antlr/antlr4/releases/tag/4.6
https://github.com/antlr/antlr4/releases/tag/4.7
Change-Id: I0600e2fe5914a966cf0cb8528f853285de83d490
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 5 Jun 2017 16:55:50 +0000 (18:55 +0200)]
Be strict about boolean arguments
RFC6020 and RFC7950 mandate the argument to be either 'true' or 'false',
which is different from Boolean.valueOf(String), which accepts any
string. Fix this by providing our own parse method.
Change-Id: I87d39d5a9238f79cb34c66efa08ed67c2a02eb82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Thanh Ha [Tue, 13 Jun 2017 15:48:44 +0000 (11:48 -0400)]
Migrate to odlparent 1.9.0
Change-Id: I03df34a82c721da72e087241c36928a668a90d45
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Peter Kajsa [Thu, 25 May 2017 13:42:57 +0000 (15:42 +0200)]
Bug 2444 - fix of several issues in yang-model-export
Add Yin export of:
- action, anydata and modifier statements
- must statement in notification, input and output
- description and reference in import statements
- notification statements in data nodes
- unique statement in list statements
- optional of organisation and contact statements
- require-instance statement in leafref specification
- length statement in binary specification
- multiple base identities in identity-ref type
and identity definition
- default values in leaf-list statement
Change-Id: I1e1662716caaf8fe118bb7db55148bc13ee81951
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Tue, 13 Jun 2017 12:18:41 +0000 (14:18 +0200)]
Fix sonar complaints around generic type naming
A, D are what we are using elsewhere, so shorten AT/DT to those
to keep sonar happy.
Change-Id: I3c42eb2c5bc0e87048059619e254ab52f204ad8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Jun 2017 16:42:51 +0000 (18:42 +0200)]
BUG-7052: extract SimpleSchemaContext
Some parts of EffectiveSchemaContext are not dependent on parser
proper and just fill out the blanks left by AbstractSchemaContext.
Extract these bits into SimpleSchemaContext for wider reuse.
Change-Id: I72238ec67b958e3e7918e399e9643264b11860db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Jun 2017 16:15:40 +0000 (18:15 +0200)]
BUG-7052: deprecate YangParseException
This exception is no longer used and should be removed to reduce
confusion.
Change-Id: Ie5c298c8e8a5aa4bdd11ecf5768d14f5584f1344
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Jun 2017 16:05:10 +0000 (18:05 +0200)]
BUG-7052: Move ModuleDependencySort to yang-model-util
This is a useful utility which has no dependencies on parser proper,
hence should be part of yang-model-util.
Change-Id: I8c584d61e57ec513261e59f0fa306f50747b7b5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Jun 2017 15:21:42 +0000 (17:21 +0200)]
Bypass array-based sort
This makes unneeded copies, move over to Iterable-based sort.
Change-Id: I58d4b6b31e4e7927c1139bc6e2920a4e783597f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Jun 2017 14:56:50 +0000 (16:56 +0200)]
BUG-7052: Move TopologicalSort to util package
This utility has no dependencies on parser and is generally useful.
Expose it as a beta API from util package.
Change-Id: Iba50e8c0064748498307ca88f99273532c089168
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 9 Jun 2017 12:49:36 +0000 (14:49 +0200)]
Reformulate ModuleDependencySort in terms of a Table
Rather that using nested Maps, use a Table, which is what really
the graph is.
Change-Id: Ia0b8c86142e990d7d8f88885d31a3e5ddc6a5842
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Jun 2017 18:59:30 +0000 (20:59 +0200)]
Fix checkstyle offences found by newer plugin
These are not caught by the old plugin, but the 1.9.0 odlparent will
expose these failures. Fix them up before that happens.
Change-Id: I93b0eb76fda3b5b3e189dc2eb2dd9bf462d7e9db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Jun 2017 07:57:55 +0000 (09:57 +0200)]
Enable checkstyle in yang-model-util
Change-Id: I52d97ddfb88eaedd168a373e55ab06e0f21b8f46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
xygeng [Mon, 12 Jun 2017 07:57:50 +0000 (15:57 +0800)]
Bug 6897: [YANG 1.1] Allow notifications to be tied to data nodes
Change-Id: I6143907b8d2ee1b9e78cb9d76c0db3d252419f00
Signed-off-by: Geng Xingyuan <geng.xingyuan@zte.com.cn>
Robert Varga [Sat, 10 Jun 2017 15:15:28 +0000 (17:15 +0200)]
yang-maven-plugin-it: add checkstyle
Cleans up offenses and flip the switch.
Change-Id: Icdf9256ddcdffe4215bbaadcde1bd4de6f79551d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 9 Jun 2017 10:00:58 +0000 (12:00 +0200)]
Optimize ModuleDependencySort
This class can use some love to improve its performance:
- eliminate unneeded String.format() calls
- perform revision formatting only when needed
- streamline getModuleByNameAndRevision() to eliminate duplicate
lookups and checks
Change-Id: Iac88e223bb108110a9081ce0e6edcdd748d5b52a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 9 Jun 2017 09:34:38 +0000 (11:34 +0200)]
Do not duplicate findModuleByNamespaceAndRevision()
This method is already defined as a default method in SchemaContext,
hence there is no need to re-define it.
Change-Id: I419d502bffea6e5f25c60aefb31bf3f14dd3f58e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 9 Jun 2017 09:17:47 +0000 (11:17 +0200)]
Do not create temporary array for module sorting
ModuleDependencySort uses an internal iterable anyway, so expose
that method and pass our temporary set, skipping an unnecessary
copy operation.
Change-Id: I2253ed4edc3837ebb9182bcb1b0069d94e2f83e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 17:25:38 +0000 (19:25 +0200)]
BUG-7052: move EffectiveSchemaContext
EffectiveSchemaContext is used only from reactor (and some tests),
and it produces a dependency in rfc6020. Move it to reactor and
eliminate users who do not really care.
Change-Id: I46ffbfde001f07f8a29b192377e5b93c7128c624
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 9 Jun 2017 00:11:29 +0000 (02:11 +0200)]
Make getOriginalCtx() give out an Optional
This simplifies its users and make things more streamlined, by
eliminating a source of nulls. While we are at it, migrate some
optionals.
Change-Id: I9f5c051db33b1898ca5decd523055adbd1309855
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 23:38:56 +0000 (01:38 +0200)]
BUG-6972: inline copy operation modifications
Copy operations is really internal to StatementContextBase hence
all the work of setting state can be done in the constructor.
This allows us to make some of the state final. While it does not
help the footprint issue, it is a stepping-stone to defining a
proper set of copy operations.
Change-Id: I0586ecb0757a3126b9e4ed3dbd0ea6c5a2547544
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 17:16:46 +0000 (19:16 +0200)]
BUG-7052: remove AbstractEffectiveSchemaContext
This is essentially a copy of AbstractSchemaContext, so reduce
code duplication by removing it.
Change-Id: I736017a379c4796a7afed6933525b354f1f852bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 17:02:49 +0000 (19:02 +0200)]
BUG-6972: Do not allow root StmtContext to be copied
It cannot be targeted, hence it does not make sense to copy it.
Removes a chunk of duplicate code and takes this class out of the
picture where copy operations are concerned.
Change-Id: I7a8d46ba59658a534534cd8204c43d894d017247
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 16:43:21 +0000 (18:43 +0200)]
Eliminate StmtContext.isRootContext()
This condition is already available by checking getParent(), so there
is no need for method proliferation.
Change-Id: I7eaeca1655dbdffe1a6738f439b12afa165e30b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 15:47:53 +0000 (17:47 +0200)]
Remove appendCopyHistory from public view
This is an internal detail of the copy process, hence it should not
be visible in StmtContext.Mutable.
Change-Id: I890af7f9f8273fc3960c4acd5340fa97f5c3c6c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 00:09:44 +0000 (02:09 +0200)]
BUG-7052: Move qnameFromArgument to StmtContextUtils
This has no dependencies on RFC6020, move it to common statement
utilities. Also takes all utility methods used by it.
This removes {BuildGlobal,Substatement}Context->rfc6020.Utils and
rfc6020.Utils -> reactor.RootStatementContext dependencies, which
by defition is Good.
Change-Id: I9ff90a0be8c4eaee2c085c9333a71c12619d2d7c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Jun 2017 22:51:21 +0000 (00:51 +0200)]
BUG-7052: reduce StatementContextBase proliferation even more
This splits up the mutable and immutable views of declared/effective
statements so we do not access mutable state when all we need is
immutable view.
The mutable view now has only StmtContext.Mutable, hence users get
more isolation from the reactor implementation.
Change-Id: I3e77b3837beea533590cad681c1895e047c9a2a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Jun 2017 06:58:07 +0000 (08:58 +0200)]
BUG-7052: Move RecursiveObjectLeader to util
This is a general utility. Expand warnings and move it to util,
reducing more reactor->rfc6020 dependencies.
Change-Id: If21a560633f31bb25edaed8ac8e87b882f27dc83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Jun 2017 21:31:40 +0000 (23:31 +0200)]
BUG-7052: reduce StatementContextBase proliferation
In some places we require StatementContextBase where only a simple
StmtContext or Mutable is enough. Fix those places up and move mutator
methods into Mutable.
This frees up parser.spi from reactor imports and lowers rfc6020's
reliance on reactor internals.
A nice side-effect is that we do not leak the mutable aspect of
StatementContextBase from StmtContext references.
One violation of this contract is caching of 'supportedByFeatures',
which is now costing an instanceof check. Since that is an optimization
this is a fair thing.
Change-Id: I6b4991264ef8c3322260f0962d41eeaa79b1b427
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 6 Jun 2017 23:43:46 +0000 (01:43 +0200)]
Enforce namespace listener compatibility
If we happened to register a listener to a namespace which does not
support listening, we would silently ignore the listener. Instead
of doing that, complain loudly when such a thing occurs.
Change-Id: If77bbec91571178fe7a1ada169a824d5d8a6807c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 6 Jun 2017 21:50:24 +0000 (23:50 +0200)]
Refactor InferenceAction
An inference action's prerequisite may only be accessed once the
action fires. Hence require a key context to give out the value
of a particular Prerequisite.
Also audit methods interfacing to StatementContextBase and lower
their expectations where possible.
Change-Id: I71cec8647d7e013598dcdf2faf9d0a46c5105938
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 5 Jun 2017 17:19:06 +0000 (19:19 +0200)]
Move DeviateKind parsing
This parser is only used in DeviateStatementImpl, so move it there
and do not clutter Utils.
Change-Id: Ie878f22e5fdd28fc2e3747a1af61a25b92a44d05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 6 Jun 2017 20:55:00 +0000 (22:55 +0200)]
ModifierImpl has no use for phase
Since the field is unused, reduce confusion by not propagating it.
Change-Id: Id541143dffc536b4487628c301950d5f4d98385e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>