Thanh Ha [Wed, 30 Sep 2015 21:50:25 +0000 (17:50 -0400)]
Use odlparent-lite for artifacts pom
Change-Id: I663bd08a28c4e7abc39e5b8eef8b9f1ab6664bf9
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Robert Varga [Fri, 18 Sep 2015 09:39:42 +0000 (11:39 +0200)]
Cleanup AugmentUtils
Du no copy collections, user preconditions, use pre-instantiated sets
and similar.
Change-Id: I1fadd465650323504515e3df9393d42c8593c1e8
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 1 Oct 2015 06:44:16 +0000 (08:44 +0200)]
Cleanup imports
Unused imports should be removed. Also remove unused isMap local
variable.
Change-Id: I4c45aebe0538f84b87828ac9725cfe121d3befa3
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 1 Oct 2015 06:43:20 +0000 (08:43 +0200)]
Cleanup TypeUtils
Preconditions, Immutable{Map,Set}, comparator speed up.
Change-Id: Ib4a1673aa0c3bf11ec7c69b3b3fcf1352d7c4e56
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tom Pantelis [Thu, 1 Oct 2015 07:11:28 +0000 (03:11 -0400)]
Fix performance issue in EffectiveStatementBase
While running some feature tests I took some thread dumps and noticed
the following stack trace in each:
java.lang.Thread.State: RUNNABLE
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Throwable.java:783)
- locked <0x00000000e5aff880> (a
java.util.NoSuchElementException)
at java.lang.Throwable.<init>(Throwable.java:250)
at java.lang.Exception.<init>(Exception.java:41)
at java.lang.RuntimeException.<init>(RuntimeException.java:51)
at
java.util.NoSuchElementException.<init>(NoSuchElementException.java:47)
at
com.google.common.collect.AbstractIterator.next(AbstractIterator.java:154)
at com.google.common.collect.Iterators.find(Iterators.java:717)
at com.google.common.collect.Iterables.find(Iterables.java:646)
at
org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase.firstEffective(EffectiveStatementBase.java:105)
The problem is that Iterables.find throws NoSuchElementException if not
found which is expensive when called many times. I changed it to call
tryFind instead which returns an Optional and this significantly
improved performance. The test time went from 15 min to 3 min.
There may be other classes that call Iterables.find - I didn't check.
If so they can be fixed in subsequent patches.
Change-Id: I0b3d02979b6d7fc97752c4b2429720b0807b853b
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Robert Varga [Thu, 28 May 2015 11:43:12 +0000 (13:43 +0200)]
Enforce SchemaPath correctness
SchemaPath must never contain a null element unless it is ROOT or SAME.
Current implementation allows that to happen by checking for null items
in the collections/lists it gets from the user.
Change-Id: Ibb85f84f54ad9c9049ac2ce8bb88371942b16880
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 18 Sep 2015 09:52:45 +0000 (11:52 +0200)]
Cleanup yang-parser-impl Utils
Pre-compiled paterns, reused splitters and similar.
Change-Id: Ia8b6aebb0d3d1922018078b3e33ebba7e9740769
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tony Tkacik [Wed, 30 Sep 2015 20:00:50 +0000 (22:00 +0200)]
Introduced ChildSchemaNodes namespace to parser
Use of purpose-built namespaces in new parser
simplifies code and speed ups search.
Introduced ChildSchemaNodes namespace in order
to speed up search for refines and uses.
Change-Id: Ie716b5798a3cca77dff3e3799383f82649273f97
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Wed, 30 Sep 2015 16:56:43 +0000 (18:56 +0200)]
Fixed parser failing to continue parsing on '\n\n \n\n '"
Statement grammar used hidden tokens to skip comments
which in some cases when there was emtpy line, comment, empty
line ended up emitting two SEP tokens, but parser rules
were written expecting only zero or one SEP tokens.
Changing parser rules to expect multiple SEP tokens,
fixed that issue.
Change-Id: Ic3ea43f520582863681740534aa42739069056a3
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Wed, 30 Sep 2015 13:40:20 +0000 (15:40 +0200)]
Fixed Enum statement not accepting allowed symbols.
Change-Id: I267e4f70d96d459f068553a7c265c9bc24d43006
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Wed, 30 Sep 2015 13:11:41 +0000 (15:11 +0200)]
Bug 4376: Fixed incorrect assumption about QName in extensions
Original parser contained incorrect proactive code, which tried
to parse extension argument as QName even if it semantics was
not specified, this was carried to new parser as requirement
for argument which was incorrect.
Changed type of such statement to string and made QName parsing
optional.
Change-Id: I782390113b549b76c90a94604605e8bf2f4896bc
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Martin Ciglan [Wed, 30 Sep 2015 11:37:05 +0000 (13:37 +0200)]
Bug 4378: New parser can't handle "}}" sequence
Two and more subsequent occurences of right brace "}" shoudln't
be recognized by lexer as STRING.
Change-Id: Ic033e923b380f86cba424dec2fceae432d65c6e0
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Igor Foltin [Mon, 21 Sep 2015 08:33:00 +0000 (10:33 +0200)]
Fixed some major sonar issues
in yang-parser-impl.
Change-Id: I056ae4effa76ffdd91407d61f80426c8c88f6ff4
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Peter Kajsa [Mon, 21 Sep 2015 11:05:48 +0000 (13:05 +0200)]
Bug 3670: Replaced YANG parser for new statement parser
Parser switch in yangtools:
- yang-maven-plugin switch to new parser
- repo and related classes e.g. SharedSchemaContextFactory, YangModelDependencyInfo, TextToASTTransformer
- parser switch in yangtools benchmarks
Yangtools retest:
- yang-maven-plugin-it test fix
- model-export SimpleModuleTest bug fix
- yang data unit tests fix
- yang-maven-plugin yang models from dependencies resolution fix
- additional unit tests switch to new statement parser
- extension definition fix in test models
Change-Id: I75c8b67af01212a8ac5b832625f9405bb0108455
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Tue, 29 Sep 2015 05:33:25 +0000 (07:33 +0200)]
Make initRanges() private
Sonar warngs about the method being overridable.
Change-Id: Ie804bd50d71b0935a87cffc2a0f0bc1e79de2ed0
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 29 Sep 2015 05:25:33 +0000 (07:25 +0200)]
Fix sonar naming warnings
Fields/constants should comply with naming conventions.
Change-Id: I8955e0408e508e7eba7cb90bab78218885b12d0a
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 28 Sep 2015 15:09:31 +0000 (17:09 +0200)]
Do not instantiate QNameModules needlessly
Rather than using URL-based QName constructor, use a QNameModule-based
one, which saves object instantiation and results in potential reuse.
Change-Id: Ia0bd87743b062ed71c32d4d2ed2563525e681ce8
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 28 Sep 2015 11:34:00 +0000 (13:34 +0200)]
Do not instantiate a temporary list
There is no need for a collection, use just the iterable.
Change-Id: I1a3587f74e3eac2ee249c31832623f63242b0839
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 28 Sep 2015 09:33:26 +0000 (11:33 +0200)]
Introduce SchemaNodeIdentifier.asSchemaPath()
Converting SchemaNodeIdentifier to a SchemaPath needs to be efficient,
reuse the fact the two classes are organized in the same way.
Change-Id: Ifa18f4378b66a94aa9f8e9d45fd274be9a517005
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 28 Sep 2015 08:39:06 +0000 (10:39 +0200)]
Use SchemaPath.getParent()
Creating a parent SchemaPath is simple, no need to fork them.
Change-Id: I6c93e6a913fa582f8cd615deb992738f22afe0e0
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 6 Sep 2015 08:24:55 +0000 (10:24 +0200)]
Remove YangInstanceIdentifierBuilder.toInstance()
This method has been renamed to build(), remove the old name.
Change-Id: I93ba014e8dc598d4e04b4278d750c76c6ce6232b
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 16:25:33 +0000 (18:25 +0200)]
Use Objects.equals() in yang-model-util
Simplifies implementations of equals() considerably.
Change-Id: I1d86308156abdca36ad9c770621a82e852ad56ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 16:29:09 +0000 (18:29 +0200)]
Use Objects.equals() in yang-data-impl
Simplifies implementation of equals().
Change-Id: I4b69eba21c775a25c89a3ff0696dd5c2cb4e4696
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 16:25:06 +0000 (18:25 +0200)]
Use Objects.equals() in yang-model-api
Simplifies and clarifies the code.
Change-Id: I1dba9eeeb9ce69be6de9f0fd4088ac6afa7d0e25
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 16:24:38 +0000 (18:24 +0200)]
Use Objects.equals() in QName.equals()
Simplifies the code.
Change-Id: Ibac465c5bbc5a5ab8b5b3b40b5c57a042c93d095
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 15:34:02 +0000 (17:34 +0200)]
Use Objects.equals() in effective statements
This simplifies equals() method implementations and performs various
obvious cleanups:
- boolean assignement via trigraph
- explicit isEmpty() before ImmutableList.copyOf()
- private fields
And adds a couple of FIXMEs for follow-up.
Change-Id: Id591cef7f777efaa02e0cb77d47245762a103363
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 12:22:09 +0000 (14:22 +0200)]
Use SimpleImmutableEntry in ValueWithQName
SimpleImmutableEntry gives us everything we need, there is no need for
duplicate (and incorrect from Entry interface definition) code.
Change-Id: I4490d9b5fc06547ee30fd05d31495a9a7005956e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 12:15:29 +0000 (14:15 +0200)]
Use Objects.hashCode()
Use JRE-provided Objects.hashCode(), lowering the number of branches in
our code.
Change-Id: I90e8dc80253c6bed49d8d561faced71729cc62f4
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 11:48:00 +0000 (13:48 +0200)]
Fix a few sonar warnings
- redundant and misordered modifiers
- use java.util.Objects instead of Guava
Change-Id: Idfa45254bb30b4f308c51869b50b2883a56a85ed
Signed-off-by: Robert Varga <rovarga@cisco.com>
Filip Gregor [Fri, 25 Sep 2015 14:44:29 +0000 (16:44 +0200)]
Bug 3876: unit test coverage increase
Add a simple test suite, cleanup pom.xml and fix a couple of typos.
Change-Id: Ib40f1344bea339bcf89c6f7981ba2888b1fe255e
Signed-off-by: Filip Gregor <filip.gregor@pantheon.sk>
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 24 Sep 2015 09:05:23 +0000 (11:05 +0200)]
Use YangInstanceIdentifier.getAncestor()
Instead of limiting the path arguments, get the appropriate ancestor,
which results in consistent instance identifier formatting.
Change-Id: I2fc3447f8786c8d7a9ada68d8bf6fc0915591382
Signed-off-by: Robert Varga <rovarga@cisco.com>
Martin Ciglan [Thu, 17 Sep 2015 11:23:42 +0000 (13:23 +0200)]
Bug 4321: Misconfigured input parameters in yang-maven-plugin (YangToSourcesMojo.java)
Use of default values for 'required' & 'readOnly' elements of inspectDependencies
annotation type Parameter to not to disturb pom.xml files.
This has been discovered in IntelliJ IDEA environment.
Change-Id: I440c62b692001971ee60145203d6931aff0e0db3
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Peter Kajsa [Wed, 2 Sep 2015 11:49:20 +0000 (13:49 +0200)]
Bug4231 - Yang tools failing to parse Augmentations under "uses" clause.
The problem occurs when uses-augment is nested in another Augment statement.
In this case the parent node of uses node is not subclass of SchemaNode
but it is AugmentationSchemaNode (it is not subclass of SchemaNode) and in
consequence class cast exception occurs.
Change-Id: I674392889e561f357297fa220051e8c3728f537d
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Igor Foltin [Fri, 18 Sep 2015 12:55:47 +0000 (14:55 +0200)]
Fixed some major sonar issues in yang-data-codec-json.
Change-Id: I31f2342a226fc68742f9f892d7e9fff712fef282
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Igor Foltin [Thu, 17 Sep 2015 10:35:08 +0000 (12:35 +0200)]
Fixed some major sonar issues in yang-data-api, yang-data-operations
Change-Id: Ic099300378a864e119c10958f721efdfde81599d
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Igor Foltin [Wed, 16 Sep 2015 10:58:27 +0000 (12:58 +0200)]
Fixed some major sonar issues
in checkstyle-logging and
yang-data-util.
Change-Id: Ie2e9753964c5e39d0288861e6f4301cd03d59de0
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Tony Tkacik [Thu, 3 Sep 2015 09:52:59 +0000 (11:52 +0200)]
Removal of migrated or obsolute artifacts.
Removed artifacts which are obsolute or were
splitted off into MD-SAL projects.
Change-Id: I8238a67676f25c11388ad94d276252a8a67df535
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Igor Foltin [Mon, 14 Sep 2015 08:25:36 +0000 (10:25 +0200)]
Fixed some major sonar issues in yang-validation-tool
Change-Id: Ifba514ef314df1829f8e1497238cfc3a7705bd0f
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Igor Foltin [Fri, 11 Sep 2015 13:03:56 +0000 (15:03 +0200)]
Fixed some major sonar issues
- mockito-configuration
- websocket-client
- yang-common
- concepts
Change-Id: I5a418919e09ce7e423d31a64759349b9e05be5ad
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Igor Foltin [Fri, 11 Sep 2015 11:30:23 +0000 (13:30 +0200)]
Fixed some blocker sonar issues in yang-data-impl
Change-Id: I0e8351ebd08b54cce8613c5628409249f5a042cb
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Robert Varga [Fri, 18 Sep 2015 08:14:19 +0000 (10:14 +0200)]
Cleanup GroupingUtils
Use ImmutableSets to keep things efficient.
Change-Id: I3ba4b106908f28a0ad195c2619e1758350284345
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tony Tkacik [Tue, 1 Sep 2015 14:06:54 +0000 (16:06 +0200)]
Bug 3875: Introduced transforming stream writer
Introduced simple QName transforming stream writer
which could be used to re-stream and rebuild
YANG Data with replacement of QNames.
QNameTransformingStreamWriter currently supports
custom mapping, replacement of specified QNameModules
and replacement of specified QNames
Change-Id: I98b253a0f184e1996d78b99fa8cfb20a7d588b96
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Fri, 18 Sep 2015 12:03:55 +0000 (14:03 +0200)]
BUG-4300: adjust unit tests
Previous patch has renamed classes and was not rebased on top of the UT
expansion, leading to unit tests being broken. Adjust checks to reflect
new class names.
Change-Id: I6ff782984527d0d81402746b85c2732f2ecd4660
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 15 Sep 2015 04:47:45 +0000 (06:47 +0200)]
Refactor URLSchemaContextResolver
For use with the yang-maven-plugin, we need the ability to register
different sources than URL. Since the internal machinery of
URLSchemaContextResolver already handles the tasks, factor it out to a
separate class.
Change-Id: Ie310f7ce4633b3f2fb7755bf4b0e3aa8e60c51a4
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 15 Sep 2015 01:08:52 +0000 (03:08 +0200)]
Do not instantiate a ByteSource
YangTextSchemaSource is already a ByteSource, no need to wrap it again.
Change-Id: I938704862c44d7eef6fdc55996580026a4b755bb
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 21:23:50 +0000 (23:23 +0200)]
BUG-865: Migrate tests to non-deprecated API
Prepare for the deprecated methods being removed
Change-Id: I0cbf84b4bda3535e70cd8dbe24e1708d6127e5de
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 13 Sep 2015 20:27:03 +0000 (22:27 +0200)]
BUG-4300: Make Lazy*ContainerNode really lazy
Our LazyContainerNode/MaterializedContainerNode combo meant that a
TreeNode was either non-materialized (Lazy) or fully-materialized (after
it was touched again). This meant we could end up stalling for
significant amount of time (when a large map was materialized), or ended
up materializing leaves which can never be modified -- like key leaves
in a list.
This patch fixes the problem by introducing a middle stage, where only
children which were modified are tracked and requests to non-modified
children are served from the data portion. This means materialization
occurs gradually as needed -- preventing stalls and improving memory
efficiency.
Change-Id: I480f675423f8e1f0e999ad609e40093e3f4a267e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 18 Sep 2015 08:14:19 +0000 (10:14 +0200)]
Cleanup GroupingUtils
Reformat and use ImmutableSets to keep things efficient.
Change-Id: Ia6cb9befdd18995272b2f6510eb5d8b16476e6d9
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 17 Sep 2015 15:11:00 +0000 (17:11 +0200)]
Remove redundant final modifiers
These were missed in previous conversion to final classes, remove them
to silence sonar.
Change-Id: I886b39b43842cedecddf8e018197751c2488b0be
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 17 Sep 2015 01:37:08 +0000 (03:37 +0200)]
BUG-4309: include iana-afn-safi in model features
This fixes a failure to package iana-afn-safi.
Change-Id: I68d53a9c30041da0196d9513872c1a05a661b18f
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 07:34:11 +0000 (09:34 +0200)]
BUG-2399: Introduce ModificationType.(DIS)APPEARED
In order to support automatic container lifecycle, we need to expose new
semantics so users can understand their creation/deletion. This is
needed because no current type match the semantics without introducing
special-cases.
Change-Id: I733ff39b97fcdcb5677dd179d2bed87975b95b4f
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 07:18:38 +0000 (09:18 +0200)]
BUG-865: Remove ModificationType.MERGE
MERGE type has been deprecated in Lithium and has not been emitted
anywhere.
Change-Id: I91584ce6ac75bedab2fec257ec4ac2e80cbdc895
Signed-off-by: Robert Varga <rovarga@cisco.com>
Stephen Kitt [Fri, 11 Sep 2015 14:39:39 +0000 (16:39 +0200)]
BUG-4109: Correct checkstyle dependency and avoid a couple of NPEs
We need to ensure that the version of checkstyle used to build the
plugin extension is the same as that used when running the
maven-checkstyle-plugin. (Otherwise, ABI changes break the checks,
notably changes in type values.) To do this, depend on the
maven-checkstyle-plugin; it's not particularly elegant but it gets the
job done.
Also fix a couple of places where a type or variable name is retrieved
before further checks which could be done beforehand. By doing the
risk-free checks before calculating the type or variable name, we
avoid NPEs.
Clean up an "if () { return true; } else { return false; }".
Change-Id: Iec696a7486e43f52db69befe12c6a053903c879d
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 10 Sep 2015 17:48:26 +0000 (19:48 +0200)]
BUG-4288: check for existing child modification
When we are issuing a merge on a previously-written node we need to make
sure the written node's data is pushed down to child nodes. This could
have ended up overwriting nodes which have occured under and after the
write being replaced. Guard against this mishap with an explicit check.
Change-Id: I2425dc758b8099de349641cd3bef9949cfccf57c
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 26 Nov 2014 21:09:10 +0000 (22:09 +0100)]
BUG-3876: Add jaxen-based XPath evaluation component
This the basic infrastructure needed to bridge NormalizedNodes with
jaxen. Given a SchemaContext and a NormalizedNode tree, users of this
component are able to evaluate XPath expressions.
Change-Id: Idbd0a7a954f725e84581fe63399ddf44df8e1333
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 11:08:08 +0000 (13:08 +0200)]
Fix checkstyle warnings in concepts
This is just grooming various minor code layout things. Also deprecates
OrderedSet, as it is impossible to implement.
Change-Id: I94e0547644d8cfa4023103912758a7083c84ac8f
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 16 Sep 2015 16:02:29 +0000 (18:02 +0200)]
Expand yang-data-api test suite
This adds some trivial tests.
Change-Id: I76b2ed6d76657f9687d7ab1b449857f44ea22d67
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 16 Sep 2015 18:50:24 +0000 (20:50 +0200)]
Fix sonar warnings is yang-parser-impl
Comments, boolean expressions at al.
Change-Id: Idad65cb6c001cd1d42cf99771c94468e7a87b5f0
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 16 Sep 2015 18:49:29 +0000 (20:49 +0200)]
Use ImmutableSet/Map in YangValidationBundles
These could easily be subverted, so make them proper constants. Also
saves some memory and fixes some sonar warnings (about declarations
being to a concrete class).
Change-Id: I8f176ed7173b9b3eedce48b4e58131f00690ffc6
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 17:13:22 +0000 (19:13 +0200)]
BUG-865: remove TypeDefinitionAwareCodec nested classes
These classes have been made package-private in previous release, remove
them now.
Change-Id: I7c4a030efd556436eb53770cc69bb71b44f119ed
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 09:09:44 +0000 (11:09 +0200)]
YangInstanceIdentifier fixes
Expands the test suite and fixes sonar warnings.
Change-Id: I7ade090c7f3cb5ae0223e0c45ed0e790a680e303
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 21:05:43 +0000 (23:05 +0200)]
BUG-2219: reenable test
A test case was left disabled for when the bug is fixed, but was not
re-enabled afterwards.
Change-Id: I4d52d578d2eea830a03fd2ae6e9303f46cfac521
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 19:52:00 +0000 (21:52 +0200)]
BUG-865: remove MavenLogAware and CodeGenerator
These two interfaces have been long-deprecated and should not be used.
Remove them and adjust the test suite accordingly.
Change-Id: I93606ae441880b8974b001f7c8d9d8ef7ad2a336
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 20:52:58 +0000 (22:52 +0200)]
BUG-2220: re-enable test
This test has been marked to be activated once this bug is fixed, but
has been forgotten about. Re-activate it.
Change-Id: I9d93f3266c2055298e0a3e1f473a55591c2b9b0f
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 20:37:53 +0000 (22:37 +0200)]
BUG-865: clean up yang.parser.builder
Removes previously-deprecated methods. Also properly deprecates
ConstraintsBuilder.toInstance() so it can be removed in the next
release.
Change-Id: Ib493b064a8fa838916bfb54962681c58bba89002
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 20:20:20 +0000 (22:20 +0200)]
BUG-865: remove yang-data-impl deprecated methods
This removes a few methods which have been deprecated before Lithium
shipped.
Change-Id: I00e3119ac112a07b778f14d940900ae53619b7c1
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 20:10:24 +0000 (22:10 +0200)]
BUG-865: Remove AugmentationSchemaProxy
It has been deprecated before Lithium shipped, remove it.
Change-Id: I32f9e51011fd814549faedcfa9c7fbc2f049f212
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 18:58:49 +0000 (20:58 +0200)]
BUG-865: remove JSONNormalizedNodeStreamWriter.create()
These methods have been deprecated in Lithium, remove them.
Change-Id: Id407ce6404b5b897807c9d62b751cf9cd00298b9
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 18:31:19 +0000 (20:31 +0200)]
BUG-865: Remove deprecated methods in yang.model.util
These have been deprecated before Lithium shipped and can therefore be
removed.
Change-Id: Ia71b9343c7ef04f0424711c75581ce2ca5e3e770
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 18:19:07 +0000 (20:19 +0200)]
BUG-865: remove DefaultDataTreeCandidate
This class has been deprecated in Lithium, remove it.
Change-Id: Ib7c4dc46b285eaed0018a49bee3037d7a098884e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 16:36:24 +0000 (18:36 +0200)]
BUG-865: remove NodeModification
NodeModification is long-deprecated, remove it.
Change-Id: I294febf131c8c30af7e0a1f4312352e1dc803586
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 16:10:34 +0000 (18:10 +0200)]
BUG-865: remove yang.model.util.repo
It has been deprecated in favor of yang.model.repo.utl.
Change-Id: Idae43e14b2853c7f348e016d7d6213acabe6ffc5
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 15:08:03 +0000 (17:08 +0200)]
BUG-865: remove ChoiceNode
ChoiceNode was deprecated in favor of ChoiceSchemaNode in Lithium.
Remove it.
Change-Id: I4acfdcbce5fdd99fb8a893fa5820623fcb527a3f
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 15:05:23 +0000 (17:05 +0200)]
BUG-865: Remove CompositeObjectRegistrationBuilder.toInstance()
This method has been deprecated in a previous release, now remove it.
Change-Id: I7cf84713df50001ef15d99c0ac5adfcb14a40625
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 15:03:13 +0000 (17:03 +0200)]
BUG-865: remove deprecated DeadlockDetectingListeningExecutorService constructors
Function-based constructors have been deprecated in a previous release,
now remove them.
Change-Id: I0a1a64811504936fdc6e16186d4094b782c4c0cb
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 14:58:13 +0000 (16:58 +0200)]
BUG-865: remove HashCodeBuilder.toInstance()
This method was deprecated in favor of build() in Lithium, remove it.
Change-Id: I52ce7aef4ff7a4ed29bb9a4a8a1a8bd6be09fe94
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 14:57:09 +0000 (16:57 +0200)]
BUG-865: remove DurationStatsTracker
It has been deprecated in Lithium, remove it now.
Change-Id: I8e6b5be72c521881acbd7e860d6a3fdad85fed33
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 10:42:01 +0000 (12:42 +0200)]
Cleanup yang-parser-impl
All around fixes:
- methods which can be made static
- Optional instance sharing
- Raw types
Change-Id: I04e2e7190cd4ffeda7d8a7fc2530f2c8e7bb27a8
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 10:12:55 +0000 (12:12 +0200)]
Cleanup yang-model-util
Various warnings fixed.
Change-Id: Id2e7c6f100e2b6698204dfb70243b33d33be2488
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 10:10:48 +0000 (12:10 +0200)]
Clean Decimal64 up
Remove proxy fields
Share the default constraints
Change-Id: I3fa1fa735d583e032f3f77a03d0f22e039f65714
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 14 Sep 2015 10:59:44 +0000 (12:59 +0200)]
Fix OffsetMap's unneeded modifiers
Sonar warnings: final is implied by class being final.
Change-Id: I53f97e56df4e0904584305be648541293669ef95
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 21 Jun 2015 21:01:16 +0000 (23:01 +0200)]
Speed BooleanStringCodec up
Do not instantiate lower-cased strings, but rather use
equalsIgnoreCase(). Also make sure we call it on a constant.
Change-Id: I6ac4219c3cb2e3c09565a9eaf00c7a634d17afd4
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
98b6009c05b266fe84afa40e75d9a73a87bf6436)
Robert Varga [Sun, 13 Sep 2015 17:27:57 +0000 (19:27 +0200)]
StoreTreeNodes: use YangInstanceIdentifier.getAncestor()
Removes open-coded YangInstanceIdentifier instantiation, as
getAncestor() will prevent copying path arguments around for both Fixed
and StackedYangInstanceIdentifier.
Change-Id: I1bcbaaf61a15f49d529df3cd057f7eeb8672b73a
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 13 Sep 2015 16:57:58 +0000 (18:57 +0200)]
Introduce YangInstanceIdentifier.getAncestor()
We have callsites which want to create a truncated
YangInstanceIdentifier and open-code instantiation. This is not
efficient, as those users do not have an understanding of the
implementation details, thus they have to resort to Iterables.limit()
and similar -- which forces copying of path arguments and untrusted
instantiation of YangInstanceIdentifier.
This patch introduces getAncestor(int), which performs this operation
with explicit knowledge of a particular implementation, resulting in
as much reuse as possible: for FixedYangInstanceIdentifier it uses a
subList(), for StackedYangInstanceIdentifier we return either a
direct/indirect parent, or use FixedYangInstanceIdentifier's version.
Change-Id: I355200199ac9791bb6d027fcdfa2a1162208a627
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 13 Sep 2015 16:25:05 +0000 (18:25 +0200)]
StoreTreeNodes: use SimpleImmutableEntry
Returned entry is just a DTO, so it does not conform to the usual Map
rules. Use an immutable version which does not allow setting of the
value.
Change-Id: Ib96afb442e9dc4f6173f2861033a799f98949e1d
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 9 Sep 2015 10:49:00 +0000 (10:49 +0000)]
Revert "Maven Plugin: Disable invalidVersion unit test"
This reverts commit
cf7736b10ac16c25928caaf132308d4704af6f53.
With JJB propagating the properties, the hotfix is no longer needed.
Change-Id: I39f1cb0fd8e0f76976bcbc9007f5e429410ceb8d
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 6 Sep 2015 00:50:12 +0000 (02:50 +0200)]
Cleanup yang-data-api documentation a bit
Lowers the number of checkstyle warnings and fixes a few typos.
Change-Id: Ica6d96987990e959f949b1376e5dbd23d8b39f90
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 7 Sep 2015 15:54:13 +0000 (17:54 +0200)]
BUG-4261: introduce NormalizedNodeInterners
This is the infrastructure for sharing LeafNode and LeafSetEntryNode
instances. It does not convert any users to actually take advantage of
them.
Change-Id: I40048c60d4aa5984df194391576a94c4b0681a3a
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 7 Sep 2015 21:55:23 +0000 (23:55 +0200)]
BUG-3876: Add XPath interfaces
This patch introduces the basic set of interfaces implemented by XPath
evaluation providers.
Change-Id: Ib4f766844f635ec1d6cdd582208547e7c63edc56
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 11 Sep 2015 20:37:19 +0000 (22:37 +0200)]
Make ChildTrackingPolicy an abstract class
Rather than switching on an enum to instantiate the map for children,
make it an interface contract. While the functionality will remain the
same, this will allow allocation of the map based on information
available from the SchemaNode.
Change-Id: Ibeee8c6c991fb592f5e1af02c86ebbfe8ef85bf2
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 11 Sep 2015 10:29:15 +0000 (12:29 +0200)]
Implement ConstantArrayCollection.toString()
Missing toString() breaks places which rely on collections properly
formatting their elements. Add an implementation and provide a simple
test suite. Also add hashCode()/equals().
Change-Id: I09ce7ecf2c541ab546e9b2a6f9916f0e76d4a511
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 13 Sep 2015 18:47:09 +0000 (20:47 +0200)]
BUG-4145: check if entire YangInstanceIdentifier is present in SchemaContext
A failure to find the SchemaNode for a path argument results in a
NullPointerException. We need the SchemaNode to understand whether it
targets an augmentation, as those need to be pruned from string output.
This patch improves the behaviour by throwing an
IllegalArgumentException with a description of which component we failed
to find.
Change-Id: I128eb63cf05b278b1af7516d426a6f0bafa87b90
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tony Tkacik [Fri, 11 Sep 2015 09:00:56 +0000 (11:00 +0200)]
Fixed Maven plugin not working without install phase.
Fixed small typo, which broke YANG Maven plugin,
when project sources was compiled without install
phase and YANG models were loaded from other artefact
in same build reactor.
[ERROR] yang-to-sources: Unable to parse yang files from /Users/repenno/Documents/sfc-ut3/sfc-provider/src/main/yang
java.io.FileNotFoundException:
/Users/repenno/Documents/sfc-ut3/sfc-model/target/classes (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at
org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream.<init>(Nam
edFileInputStream.java:18)
at
org.opendaylight.yangtools.yang2sources.plugin.YangSourceFromFile.openStrea
m(YangSourceFromFile.java:27)
at
org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.toStr
eamsWithoutDuplicates(YangToSourcesProcessor.java:197)
Change-Id: Ia0b7d68dd3c0102134e5425a0705044e92fa0386
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Thu, 10 Sep 2015 07:57:46 +0000 (09:57 +0200)]
Implement ImmutableOffsetMap.toString()
Previous patch inadvertedly removed the Map-specific implementation of
toString() -- as it used to be iunherited from AbstractMap. This patch
introduces it back.
Change-Id: Id186a75b5e4880461375c8031756461db78fee0e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 7 Sep 2015 19:37:26 +0000 (21:37 +0200)]
BUG-4275: Improve MapAdaptor and LazyContainerNode map overhead
Analysis of a heap dump has shown that for two-entry containers we end
up allocating HashMaps with default load factor. This boils down to
HashMap's copy constructor enforcing allocation to at least 16 entries
and also us not properly sizing for small maps.
MapAdaptor is taught to use HashMap.clone() and fall back to conservative
sizing on small inputs.
LazyContainerNode is taught to properly size the copy map when being
converted to a Mutable.
Change-Id: I6ad36aea31aab2e5e70176143d74e97c6d6a9ca5
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 8 Sep 2015 20:59:44 +0000 (22:59 +0200)]
Make OffsetMaps work on direct values
We do not really have a use-case for lazy values at this point. Remove
the capability, opting for increased efficiency instead.
Change-Id: Ie0c66d0c91c8fcdca44a2c8e49b6e9263c8a58df
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 4 Sep 2015 14:49:58 +0000 (16:49 +0200)]
Introduce SharedSingletonMap
ImmutableMap can be very expensive in terms of memory overhead when
storing a large number of singleton maps which have the same keySet(),
because it instantiates an ImmutableSet, which remains cached. That ends
up costing 24 bytes in local testing.
This patch implements a replacement class which retains the same
properties, but shares the keySet instances -- thus lowering the overall
overhead. For these instances we introduce an SingletonSet class, which
is memory-efficient and gives us direct access to the container entry.
This leaves entrySet() as the only method which allocates objects. We do
not cache returned objects in the expectation any caller users them as
pure DTOs, hence they end up being cheap.
Change-Id: I64e74d8e661d2689d32bea31e1cdf72e87ed64af
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sat, 29 Aug 2015 09:02:52 +0000 (11:02 +0200)]
BUG-4158: *MapPhase should extend Mutable/Immutable
The two phases correspond to Mutable/Immutable, let's make sure we mark
them as such.
Change-Id: I98a3b9f3acbc0046fe4c14cf6ba975f2eea7b9c9
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 8 Sep 2015 09:31:14 +0000 (11:31 +0200)]
BUG-4278: Improve TOUCH operation effects
The implementation of TOUCH operation would bump the subtree version of
the node even if there were no children coming in, resulting in needless
promotion of LazyContainerNodes to MaterializedContainerNodes.
If a TOUCH operation does not result in any of the children being
modified, the subtree version should not be bumped, since the subtree
was not changed. This should be the case if the user-specified children
are empty and also if the all nodes end up not modifying the data tree.
Detect both conditions and reuse the original metadata node instead of
replacing it -- this preventing LazyContainerNode promotion.
Change-Id: Icdbde02e7c3f503a9ada28b58fd27e3e3a3ef812
Signed-off-by: Robert Varga <rovarga@cisco.com>
Peter Kajsa [Tue, 8 Sep 2015 12:01:36 +0000 (14:01 +0200)]
Maven plugin ignores exact YANG duplicates in dependencies
Maven plugin failed if same YANG file was available
in two different artifacts available via transitive dependencies
which actually prevented use-cases as non-breaking
artifact renaming.
Change-Id: I88dee0470568910c35e4f310bf850605dea1ca4c
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>