Robert Varga [Mon, 27 Nov 2017 18:05:38 +0000 (19:05 +0100)]
Bump versions to next development cycle
Change-Id: I3e243ab59fbaa1ef0662761d03f6ac03db2ce755
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
jenkins-releng [Sat, 25 Nov 2017 01:09:04 +0000 (01:09 +0000)]
Release yangtools
Change-Id: I154e2a2bec3171736675e3ac8d574184ce441d2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 24 Nov 2017 14:14:44 +0000 (15:14 +0100)]
Bump odlparent to 3.0.1
Pull in 3.0.1, as it fixes karaf distribution build.
Change-Id: I9ef1e93987a58393ebb2d32eb71c81cb872ef265
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 22 Nov 2017 00:20:31 +0000 (01:20 +0100)]
Clarify SchemaContext getModules() API contract
This clarifies the API contract with regards to iteration ordering
and shuffles the methods around a bit. Also creates additional index
for looking up Module by its QNameModule, which is common when
dealing with NormalizedNode encoding.
Change-Id: I76a8f2f24f4a70e0cf4fab544de6d79e1b476103
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Michael Vorburger [Tue, 21 Nov 2017 15:54:08 +0000 (16:54 +0100)]
Remove deprecated methods without loggerIdentity from SpecialExecutors
for https://jira.opendaylight.org/browse/CONTROLLER-1793
in order to force downstream projects (controller & mdsal) to use the
new methods when they upgrade to yangtools 2.0.0. The thing is that we
cannot fix CONTROLLER-1793 in the current controller & mdsal before
switching to yangtools 2.0.0 anyway, because SpecialExecutors didn't
have the (my) previous change adding the loggerIdentity anyway. So we
might as well do this in one round, instead of keeping these deprecated,
then once we are on yangtools 2.0.0 switch them, and then remove them?
Change-Id: I6a401979d71696536f23e1c5d1665149600f9876
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Robert Varga [Tue, 21 Nov 2017 12:31:53 +0000 (13:31 +0100)]
Eliminate use of deprecated checkstyle interfaces
Update constructors to use their non-deprecated equivalents.
Change-Id: Ibbb72e21b74f6a9c7f0ba90af7b3ec7717d68d81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 21 Nov 2017 11:49:29 +0000 (12:49 +0100)]
Cleanup DataTree interfaces and InMemmoryDataTreeFactory
TipProducingDataTree is a remnant of an API freeze, merge its behavior
into baseline DataTree, adjusting callers.
Also make sure we publish DataTreeFactory properly, so users do not
have to rely on specific implementation -- cleaning up tests in process.
Change-Id: Ic2263a084ba7b8d2c611eb14407e09a78f6d922a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Wed, 15 Nov 2017 20:31:37 +0000 (21:31 +0100)]
Bump odlparent dependencies to 3.0.0
Change-Id: I6efb03faf8913c5f4ad21fa7783ce8b6342447af
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Michael Vorburger [Sat, 4 Nov 2017 03:31:25 +0000 (04:31 +0100)]
Fix FindBugs violations and enable enforcement in utils
Change-Id: I35eff969e51d6ec9b4f4b79b1b8cb2af9b9a8150
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 20 Nov 2017 16:34:07 +0000 (17:34 +0100)]
Rename ChoiceCaseNode to CaseSchemaNode
ChoiceCaseNode is a long-standing misnomer, causing API inconsistency
in yang-model-api. Rename it to CaseSchemaNode, just as all the other
SchemaNodes.
Change-Id: I4f2fa74a69a75ab9b7cd40d27ad756285486a791
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 20 Nov 2017 16:20:22 +0000 (17:20 +0100)]
Fix a few warnings
- potentially static method
- unneeded else statement
- raw RangeConstraint reference
Change-Id: Ic0fb58556f95970bbd06f3716965f97b0ea41e9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 20 Nov 2017 13:13:31 +0000 (14:13 +0100)]
YANGTOOLS-813: add parent schemapath to error report
It is not immediately clear in what context the search is being
made -- make sure we report parent path, too.
Change-Id: I86a15b409c6241d93f24ee75cc68ff78fc067ebc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 20 Nov 2017 13:31:20 +0000 (14:31 +0100)]
Make EffectiveStatements with @Beta
Newly-introduced EffectiveStatement interfaces are not finalized,
hence mark them with @Beta.
Change-Id: I0bdec482d50d71f367202baef466113e9a0f99bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Tue, 17 Oct 2017 16:52:05 +0000 (18:52 +0200)]
YANGTOOLS-812: Add SchemaContextFactory control of deviations
This patch adds missing API and implementation for setting supported
deviations in SchemaContextFactory.
In order to avoid passing of numerous arguments into
createSchemaContext(..) method a concept of a
SchemaContextFactoryConfiguration has been introduced in this patch,
which encapsulates all options possible to set.
Change-Id: I8eef54d729b7bfed4cee41ee6758d969fc375dcf
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 20 Nov 2017 12:00:00 +0000 (13:00 +0100)]
XPath evalution should identify result type
When we select a set of NormalizedNodes, we need to also report
their path, so they can be correctly correlated to schema. Fix
XPathNodesetResult to include this information.
Change-Id: I704cf5512caecb7e90c6130ef6a7809ff92d0fc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 20 Nov 2017 09:06:24 +0000 (10:06 +0100)]
Auto-generate yang-data-jaxen services
Instead of including a static resource, generate it at compile
time.
Change-Id: I079e443668e679f5580d7954161118a99e2032d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 13:36:20 +0000 (14:36 +0100)]
Populate yang-parser-api
This adds a simpistic API to access a pre-configured YANG inference engine,
so its complexities are hidden from users. Both a ServiceLoader and OSGi
loading interface is provided.
Change-Id: Iab444bd1698273c30ac37b8d3ea577ae35db71e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Thu, 16 Nov 2017 11:14:02 +0000 (12:14 +0100)]
Add bundle packaging for yang-data-transform
This allows the module to build an OSGi bundle instead of a plain
JAR.
Change-Id: I2713fdf0aefcccf589984a7271591f4cb95d1d30
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Stephen Kitt [Thu, 19 Oct 2017 16:52:14 +0000 (18:52 +0200)]
Use version ranges for odlparent dependencies
This allows odlparent version bumps to proceed without requiring
synchronised bumps in integration/distribution.
Change-Id: I123bd83bbd4ed43416bdc1958b111b8964d73dbb
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Wed, 15 Nov 2017 22:37:33 +0000 (23:37 +0100)]
Turn StatementSupports into singletons
Since we are exposing these for potential reuse, we need to take
into account the possbility these being needed more than once.
Add getInstance() to share instances.
Change-Id: I9765c521ca7b92915b53da2b3e4ab4e15b445c1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 15 Nov 2017 10:22:48 +0000 (11:22 +0100)]
Document namespace behaviours using singletons
This patch creates constants named BEHAVIOUR to hold the behaviour
for each namespace. This prevents confusion in defining the reactor
and also allows for instance reuse.
Change-Id: Ia03cbd3f8f6aac664895356d9aea89d54e2eb391
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Nov 2017 22:05:10 +0000 (23:05 +0100)]
Add support for RFC6536 extensions
This patch adds support for parsing RFC6536 extensions and related
concepts for end users.
Change-Id: I41ae3192b74660be409c63bbec82a1a14c7de4af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Oct 2017 12:30:36 +0000 (14:30 +0200)]
Bump odlparent to 3.0.0-SNAPSHOT and fix breakages
This patch bumps the odlparent version, bringing in changes
in that release. This break checkstyle-logging, which is fixed
here.
Change-Id: Iee8fae0c70c83add3f4e7bade75eb86bf8f4d4bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Tue, 14 Nov 2017 01:07:56 +0000 (02:07 +0100)]
YANGTOOLS-833: redefine features
Define both stable/experimental repositories and reorganize
features to have proper scope. Let's not split codecs as
we want to encourage cross-codec support.
Change-Id: I314cbc402af8ccfa35d60cbf9e76afe5f66edd47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 Nov 2017 00:36:45 +0000 (01:36 +0100)]
YANGTOOLS-833: Eliminate unneeded dependencies
Trim down dependencies to their bare minimum. This is needed
to properly define our features.
Change-Id: Ie97992c4415509206e72556d49a446e48f5d5028
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 12 Nov 2017 20:18:12 +0000 (21:18 +0100)]
YANGTOOLS-706: move odlext parser support
Use composition with a delegator pattern to implement
YangModeledAnyxmlEffectiveStatementImpl. Also adjust the pattern
used to bring in extensions. This forces them to be be aware
of yang-parser-rfc7950, which is fine, as that is the reactor
they can generally expect to be configured.
Change-Id: I91aa95221efb76753d9ea82dc164c1fffc6755c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 13 Nov 2017 11:51:48 +0000 (12:51 +0100)]
Add support for overriding statement supports
If an extension needs to build a different implementation of a statement,
it needs to be able to override previous definition. Alternative is to
force users to special-case support when building a reactor, which is not
really feasible.
Add overrideSupport(), which performs a replacement operation, but requires
properly-targeted bundle.
Change-Id: Id9b527c115c7a6b815227f8dc796473803bf8a80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 12 Nov 2017 18:57:58 +0000 (19:57 +0100)]
YANGTOOLS-706: separate out RFC8040 extension support
yang-data support should live in its own artifact, now that it can
(with proper UT), move it out of yang-parser-impl.
Also refactor the way extensions are exposed to be consistent with
yang-parser-rfc7950: each extension needs to expose StatementSupports
and NamespaceBehaviours.
Change-Id: Ia691bd9ab4dd78c076ac7874fc91d9e597a8d2cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 13 Nov 2017 16:08:58 +0000 (17:08 +0100)]
Fix checkstyle issues reported by odlparent-3.0.0's checkstyle
This is a preparatory patch, cleaning up violations which will be
enforced by odlparent-3.0.0.
Change-Id: I0ea6b387c9d3095ff01c8e00d10c6d9d0c29aec9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Claudio D. Gasparini [Mon, 13 Nov 2017 07:22:50 +0000 (08:22 +0100)]
BGPCEP-717: Reduce log levels
Investigation udner bgp shows that
SubstatementContext is creating 1 GB spam under
tests outputs.
Change-Id: I3fe1f93db57841fca733561ed1efc3b8b4061827
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
Robert Varga [Sun, 12 Nov 2017 18:07:00 +0000 (19:07 +0100)]
Correct YangData{SchemaNode,EffectiveStatement} interfaces
These remain tightly bound, but YangDataEffectiveStatement provides
its proper argument in its parlance.
Change-Id: I7862cb6e594f661edea39ced468f680a869bc437
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 12 Nov 2017 14:18:10 +0000 (15:18 +0100)]
YANGTOOLS-829: Wire extension support into default reactor
Since we have reorganized, we can now safely pull in extension
supports into DefaultReactors without causing dependency cycles.
Change-Id: I6214ec374ba2320aa7fe20c436749a3df4732a57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 12 Nov 2017 03:26:44 +0000 (04:26 +0100)]
YANGTOOLS-706: Split out yang-parser-rfc7950
With the internal reorganized, we can now safely split off core
rfc7950 parser and turn yang-parser-impl into a wiring artifact,
which pulls in all the bits and pieces and exposes a user-friendly
interface.
Change-Id: Iea3b8f2d76e37c6e0d37620356f7b824f3cfb249
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 12 Nov 2017 03:08:07 +0000 (04:08 +0100)]
Adjust test suite parser update to conform with API changes
This is the next step to parser split-up: make sure the unit test
suite refers to the minimum parser it needs to perform its function.
Change-Id: I8ddb143706debfe9f2ac2fc665ec982c1c4e3039
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 12 Nov 2017 00:34:10 +0000 (01:34 +0100)]
Refactor RFC7950Reactors
This patch corrects {Default,RFC7950}Reactors behavior, eliminating
YangInferencePipeline in the process.
Change-Id: Ica2ecac0baa5bdacb7456aa733b13230cb9c54c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 23:29:19 +0000 (00:29 +0100)]
Move CustomStatementParserBuilder and YangInferencePipeline
Both these classes relate to reactor integration. Move them to
parser.rfc7950.reactor for further evolution. Furthermore
YangValidationBundles can be moved to reactor utilities.
This eliminates parser.stmt.rfc6020 package, paving the way
for splitting out parser.rfc7950.* into a separate artifact.
Change-Id: I44d10f49368d252dd0dfd02b03b3413b53f3331b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 23:25:44 +0000 (00:25 +0100)]
Move yang.parser.stmt.rfc6020.Utils
The only user of the leftover methods is rfc7950.repo. Rename this
class and move it into rfc7950 and hide it.
Change-Id: I5a67e1467fb0c15f18c78d543c520eafcd1cd01c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 22:27:22 +0000 (23:27 +0100)]
YANGTOOLS-829: add parser support for openconfig-hashed-value
This patch adds metamodel and parsing support for openconfig-hashed-value
and its predecessor, openconfig-encrypted-value.
Change-Id: Iac44d2e34a9b4ccc931ddb69e3d6709b962e7378
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 21:10:53 +0000 (22:10 +0100)]
Move Utils.findNode()
This is a plain lookup on SchemaNodeIdentifierBuildNamespace, move
the method there so it can easily be maintained.
Adjust call sites to it returning Optional. One call site relies
on result being StatementContextBase -- rather than polluting the
lookup method, guard the site.
Change-Id: I0553710a79e5ca987d35d9fbedd13c164e78f244
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 15:53:31 +0000 (16:53 +0100)]
Split out OpenConfig extension metamodel
While the effects of the semantic version extensions are deeply
integrated into how YANG parser operates, the metamodel defined
by the extension itself does not need to be hard-wired.
Move the model bits out into a separate component, eliminating
the need for SupportedExtensionsMapping.
Change-Id: I497347ce79a2c07fdc462e83a20babb941c5cb1a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 15:36:33 +0000 (16:36 +0100)]
Split out OpenDaylight yang-ext metamodel
AnyxmlSchemaLocation is an unpublished extensions, which should
not be part of yang-model-api. Split it out into a separate metamodel
extension.
Also clean up parser support, which unfortunately needs to be integrated
due to how the SchemaNode instance is overridden.
Change-Id: Ied1688b82505cd34bfe3151f8686d697f81787ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 14:49:46 +0000 (15:49 +0100)]
Rename yang.parser.rfc6020.repo to yang.parser.rfc7950.repo
Move this package to have a consistent structure of the RFC7950
parser along with its supports.
Change-Id: I2e93285a11451ccd79bedb33dca51bf55e453e89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 14:37:27 +0000 (15:37 +0100)]
Move ASTSchemaSource and its components into rfc6020.repo
ASTSchemaSource, TextToASTTransformer and YangModuleDependencyInfo
are inter-related and depend in YANG text format. Move them to
rfc6020.repo and hide their constructors as appropriate.
Change-Id: I11a8d3b29328a1f2574205d7a8b8ccd192637db4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 14:06:58 +0000 (15:06 +0100)]
Move YangStatementParserListenerImpl
This is a detail of how YangStatementStreamSource operates and hence
should be part of the same package. Move it to rfc6020.repo and hide
it from the world.
Change-Id: Idc43720c83685b425eb058cf4f6ebcfbbeb38ef5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 13:57:53 +0000 (14:57 +0100)]
Merge PathUtils, TypeUtils and Utils methods
All of PathUtils and TypeUtils methods and some of Utils methods
are centered around dealing with statement arguments. Concentrate
all of them into a single utility class, rfc7950.stmt.ArgumentUtils.
This eliminates TypeUtils completely and leaves Utils with only
two methods, which are not used in statement reactor at all.
Change-Id: I816563e362a6294eed3df655be09d3d1d6173a04
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 13:48:27 +0000 (14:48 +0100)]
Move default value checks from TypeUtils to EffectiveStmtUtils
These methods are used by effective statement implementations, hence
EffectiveStmtUtils is the best place to host them for now.
Change-Id: I5151fec7959ef2243ef5094f332ca807f10ff42b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 13:30:38 +0000 (14:30 +0100)]
Create parser.rfc7950.namespace package and populate it
This package contains namespaces populated and used by the parser
implementation.
Change-Id: I0fce253217397356a28e1cc15a8dff2c8c476852
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 13:13:53 +0000 (14:13 +0100)]
Split out TypeUtils.parse{Length,Range}ListFromString
Each of these has a natural place in the respective type's
StatementSupport. Move them out, leaving common items in
TypeUtils for now.
Change-Id: Id879ab588170ec90a74196f8d0d16f37b54f85c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 13:07:15 +0000 (14:07 +0100)]
Move TypeUtils.typeEffectiveSchemaPath()
Only users of this method reside in rfc7950.stmt.type package,
move it to AbstractTypeStatementSupport and hide it.
Change-Id: I867bb4c19456002ec1034d7a21c5d9a2aa0dd4c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 13:00:06 +0000 (14:00 +0100)]
Move String/NumericalRestrictions
These 4 classes are not used anywhere, but if they are to be used,
it will be in rfc7950.stmt.type package. Move them there, factor
them out to follow package convensions and hide them.
This eliminates the rfc6020.effective.type package.
Change-Id: Ib2dae96b152108fb0550b6f07625bd6b7854154b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 12:45:05 +0000 (13:45 +0100)]
Split out PathUtils
These utilities are dealing with SchemaNodeIdentifier path and
with XPath parsing (which share a few details). Split them out
into an explicitly-shared package.
Change-Id: I884ff2b9de836bf44f06066d719c9424c4489e96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:49:13 +0000 (12:49 +0100)]
Move TypeUtils built-in type constants and utilities
These are only used in rfc7950.stmt.type package, hence a natural
place for them is AbstractTypeStatementSupport.
Change-Id: I69f1b25d89351c9bb411de7936df29b7ec6c1728
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:30:37 +0000 (12:30 +0100)]
Remove TypeUtils.isYangTypeBodyStmtString()
This method is not used anywhere, remove it.
Change-Id: Id229e6d7915765891557cb9617e75b6d4eacc696
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:22:11 +0000 (12:22 +0100)]
Move Utils.trimPrefix(String)
This method is invoked only from YangModelDependencyInfo. Move it
there and hide it.
Change-Id: I38f779f6480ee290fe554f6ad04b781c0edef02e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:19:42 +0000 (12:19 +0100)]
Move StmtContextUtils.LIST_KEY_SPLITTER
This splitter is only used by KeyStatementSupport, move it there
and hide it.
Change-Id: I5028b7ebd6f457510fc28e8410125006ec8c659d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:17:59 +0000 (12:17 +0100)]
Remove Utils.transformKeysStringToKeyNodes()
This method is not used anywhere and the same function is performed
by KeyStatementSupport.parseArgumentValue(). Remove this method.
Change-Id: I115b9021d16a2da82bbe35344d20ce9a836c9744
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:15:21 +0000 (12:15 +0100)]
Remove Utils.trimPrefix(QName)
This utility is not used and is also invalid -- QName's localname
cannot possibly contain a prefix specification. Remove the method.
Change-Id: Ia73f303eab925f6592e9d051d2e02caaf26e79fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:14:11 +0000 (12:14 +0100)]
Remove Utils.replaceIllegalCharsForQName()
This utility is not used anywhere, remove it.
Change-Id: I140327f422a025a5bff8e6a52ce507615d1ae62a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 11:12:34 +0000 (12:12 +0100)]
Move Utils.belongsToTheSameModule()
There is only one call site which uses this utility, inline it
there.
Change-Id: Iec3145336f4050046715fd0754934d5c0bdd284a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 02:07:44 +0000 (03:07 +0100)]
Hide {Extension,Input,Output,Submodule}EffeciveStatementImpl
SchemaNode-backing is an implementation detail, which we do not have
to enforce via type safety -- it is sufficient to place verification
guards, as the connection between the two APIs is not clarified and
statement compatibility will get clarified when the fate of those
APIs is decided.
Change-Id: Ib63b3d42437a3292e58d084cbf311b5217b43dbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 01:20:25 +0000 (02:20 +0100)]
Add NormalizedNodes.findNode(NormalizedNode, SchemaPath)
This is a lazy version of the Iterable<PathArgument> method, with
PathArguments being lazily computed.
Change-Id: I1f0b7ae881adb29b5aafd09b69db9e52fd97449f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 11 Nov 2017 00:51:01 +0000 (01:51 +0100)]
Add SchemaPath/SchemaNodeIdentifier.createChild(QName)
We can use a much shorter dispatch when we do not have to deal with
arrays/collections and have a single QName only. Introduce this
variant, which is widely used in YANG parser.
Introduce these methods and adjust some users of alternative methods
to take advantage of the new method.
Change-Id: If1d6288a6607b31bb45e9fd78c0319fb403e1528
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 21:40:58 +0000 (22:40 +0100)]
YANGTOOLS-706: Add TypedefEffectiveStatement.asTypeEffectiveStatement()
This is a bridge method from typedef to the effective type statement,
e.g. the use of a typedef. Promote it from implementation-specific
method to API contract, allowing TypedefEffectiveStatementImpl to be
hidden.
Change-Id: Idd149a2e2c16706c6b6c5cbe79f908907b2ccf89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 17:51:24 +0000 (18:51 +0100)]
YANGTOOLS-706: add utility method for finding substatements
This patch adds the ability to filter substatements on a type,
allowing more convenient use by users. Also convert users to
use this API, which allows us to reduce the footprint of exposed
implementation classes.
Change-Id: I87631810f6fd1df32a26908bbf085cbd25849765
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 17:00:39 +0000 (18:00 +0100)]
YANGTOOLS-706: finish evacuation of stmt.rfc6020.effective
This patch moves the rest of the effective statement classes to their
various places, reducing their visibility where possible.
The place for ImplicingChoiceCaseNode remains to be defined, as its
instantiation is related to the YANGTOOLS-724 mess.
Change-Id: Ia18f120ee7586deaa9b28f725d14822cd785ee9c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 11:04:42 +0000 (12:04 +0100)]
Introduce ElementCountConstraintAware interface
This is a common interface to hold an optional ElementCountConstraint,
e.g. a min-elements/max-elements pair. It is implemented by ListSchemaNode
and LeafListSchemaNode.
Since ConstraintDefinition has been peeled to only contain element
constraints, repurpose it as a final class ElementCountConstraint.
Change-Id: I732b3c2163d5eb889f21ee9d5c458f27aa3cd4bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 13:00:09 +0000 (14:00 +0100)]
Peel WhenConditionAware from ConstraintDefinition
ConstraintDefinition is on its way out, this patch removes its
proxying of WhenConditionAware, shifting it to individual nodes.
This has the effect of removing even more users of
DataSchemaNode.getConstraints(), getting that method ripe for
removal.
Change-Id: Iefcb6ff7705a95ac683d608649a423209a4bc496
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 13:50:11 +0000 (14:50 +0100)]
Refactor TypedSchemaNode
Factoration of WhenConditionAware is flushing out a mismatch between
Annotation and TypedSchemaNode.
TypedSchemaNode should really be called TypedDataSchemaNode, as it
captures nodes which are valid in datastore contexts and capture real
data.
Annotation, while sharing the aspect of being type-aware, is not normal
data as implied by DataSchemaNode. Notably it does not have a concept
of being added by augmentation nor being configuration.
In order to reconcile this mismatch, we really need a TypeAware trait,
which is mixed in with DataSchemaNode in TypedDataSchemaNode. Annotation
mixes it with UnknownSchemaNode -- resulting in more correct interfaces
being exposed.
Change-Id: Ie45b982c1a6ee3287ce57be34104b8f745a215ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 12:13:09 +0000 (13:13 +0100)]
Peel MustConstraintAware from ConstraintDefinition
ConstraintDefinition as such is on its way out, remove its proxying
of MustConstraintAware interface, moving it to appropriate SchemaNodes.
Change-Id: I2cc7cb934cd9eb85e38e62fc6a1678cbfc2f3cfa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 10:12:53 +0000 (11:12 +0100)]
YANGTOOLS-724: mark leaking fields
Lifecycle of 'augmenting' is wrong here, as we are resetting
this field after the effective statement has been built.
This indicates that the constructor is not getting enough/accurate
information about what is going on -- which is something we will
need to fix at some point.
Mark both occurances of this field, make the fields private and
expose a resetAugmenting() method.
Change-Id: Ica2678e885b624c850959fea21ee6120cfbd9da6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 10 Nov 2017 00:47:26 +0000 (01:47 +0100)]
Expand rfc7950.stmt documentation
Add a few more words on the contents of this package.
Change-Id: Ib3c225f934d9f6ee403ae494070c92da69f8859a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 9 Nov 2017 01:50:47 +0000 (02:50 +0100)]
YANGTOOLS-706: reorganize statement definitions
Declared/Effective implementation classes should be hidden behind
their respective statement support. To provide this design safety
measure we need to assign a package to each statement, so that its
implementation details can be properly hidden.
Since we are implementing a combined RFC6020/RFC7950 parser, which
is difficult to split without leaking implementation classes between
RFC6020 and RFC7950, use RFC7960 base package name.
This leaves a few statements behind, as their interactions need to
be cleaned up before they get moved and will be part of a follow-up
patch.
Change-Id: I1a21412773beffd6e3ac81eaecf13073d787526d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 9 Nov 2017 01:21:28 +0000 (02:21 +0100)]
YANGTOOLS-706: Split up base utility classes into rfc6020.util
Utility classes are useful for outside extensions, who should not
be depending on the complete parser. Split them out into a separate
package, so they can be moved out of yang-parser-impl.
Change-Id: I70c5048f87eafbff06ab0f23dd814239f67ee97a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 9 Nov 2017 01:06:25 +0000 (02:06 +0100)]
YANGTOOLS-706: Cleanup Unknown{Effective}StatementImpl
These classes are actually implementing the UnrecognizedStatement
contract, name them accordingly.
Change-Id: Iec5cdd4cc06a99a8252595f043e88efe9ae0efdd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 9 Nov 2017 00:59:38 +0000 (01:59 +0100)]
YANGTOOLS-706: Bridge UnknownSchemaNodes on their interface
When we are constructing SchemaNode world we can safely add instances
which implement UnknownSchemaNode, as that is the bridge in SchemaNode
for tunneling external statements.
Change-Id: If684ab2fdc676ae2daea71374df9542d2e4f753e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 17:27:40 +0000 (18:27 +0100)]
YANGTOOLS-706: Refactor YangInferencePipeline
YangInferencePipeline needs to be more modular to allow splitting
the parser up without sacrificing individual component's ability
to test.
Create yang.parser.impl.DefaultReactors to hold utilities needed
to access a combined RFC6020/RFC7950/RFC8040 reactor and migrate
users.
Change-Id: I32dac393765fa3f13cb6e181b45fb056897950e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 22:48:27 +0000 (23:48 +0100)]
YANGTOOLS-706: Reduce inter-statement implementation coupling
Now that we have proper model.api.stmt interfaces we can reduce
reliance on effective statement implementation classes, leading
a more streamlined implementation.
This patch does not eliminate all of the reliance, as that requires
updating model.api.stmt interfaces to carry enough information
to allow cross-statement inference.
Change-Id: Ib39d8578c954a6e8ecede53ce5a7420e7dd0f2aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 22:24:17 +0000 (23:24 +0100)]
YANGTOOLS-706: Retrofit EffectiveStatement interfaces into parser
Effectie statement implementations should be implementing their
model.api.stmt counterparts, so they can be properly looked up
without relying on implementation details.
Also rename Any{Data,Xml}EffectiveStamentImpl to follow naming
conventions.
Change-Id: Idd79e23f636dea0595ddf8ed804b12be2e82ae66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 20:09:39 +0000 (21:09 +0100)]
YANGTOOLS-706: Correctly wire EffectiveStatements
YangStmtMapping should properly define all EffectiveStatement
mappings, most of which do not even exist.
Change-Id: I7d98fbf3863a936bb4b7eb8e2847d2643bdd968a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 13:05:58 +0000 (14:05 +0100)]
Allow fluent use of BuildAction
This adds the ability to use BuildAction as a fluent builder, simplifying
users and their explicit dependencies.
Change-Id: I4eea2e0c56eb74a7ca0ae860bf00d11b988d54ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 11:23:02 +0000 (12:23 +0100)]
Expose type-specific derived type builder methods
Having a generic builder method is not sufficient for type-safe
users, who have knowledge of the base type, as they will lose
the specialization. Expose already-existing concrete factory methods.
Change-Id: I91195c65801ee2bbe5a93794e410c3914a7a1d24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 11:18:36 +0000 (12:18 +0100)]
Remove DerivedTypes.isInt8() and friends
These methods are no longer needed, as their equivalent can be
performed via a simple instanceof check. Remove them.
Change-Id: Ieb92ad6497a78b6777dd49b5d148b678c1633f20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 11:16:51 +0000 (12:16 +0100)]
Remove ModuleDependencySort.sort(Iterable)
This method has been replaced with the collection-based one, remove
the old one.
Change-Id: Iecb4d7c8085869196ecff040e1e8594f368ee408
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 11:12:58 +0000 (12:12 +0100)]
Remove SubstatementValidator.MAX
This constant has been deprecated for a long time and is not used
in-tree. Remove it.
Change-Id: I724fc1c8066cd9659ebf54cf394a34a4f15439c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Nov 2017 00:57:09 +0000 (01:57 +0100)]
Address RFC7950 API changes
This patch promotes methods marked for promotion from deault
to abstract. Documentation is updated to reflect metamodel
change and provide guidance for implementations.
Also includes *StatementContainer interfaces to properly share
methods revolving around acquiring substatements of known types.
Change-Id: I7e33b3f6e5816adc397f0dee00b1ada46856d504
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Nov 2017 23:50:28 +0000 (00:50 +0100)]
YANGTOOLS-619: Add support for RFC7952 extensions
This patch adds support for md:annotation statement.
Change-Id: I912645c0e01662594346e107766dd86f704f0cca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 4 Nov 2017 15:44:58 +0000 (16:44 +0100)]
YANGTOOLS-706: separate out yang-data StametementDefinition
SupportedExtensions mapping is too central for what we want to achieve.
Split out yang-data StatementDefinition into its own model world, so
others can point to it without accessing parser internals.
Also co-locate the implementation of YangDataStatement with its support,
so they can be easily transported.
Change-Id: Ic7ddfed705da5a0e9e3b20eecb333bb69b3e831c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 4 Nov 2017 08:41:08 +0000 (09:41 +0100)]
Annotate @Nullable argument in SourceException
Change-Id: I439ad3c54faa170fedf5bab5f786e74d9319884c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Nov 2017 17:15:30 +0000 (18:15 +0100)]
YANGTOOLS-706: split out rfc8040-model-api
YangDataSchemaNode needs to live in a separate RFC8040-specific
module, as it is not part of RFC7950 semantic model. Split it
out.
This flushes out the need to properly define YangDataStatement,
which in turn cascades to discrepancies in the structure of our
support classes. Those are cleaned up, with extensions getting
their proper declared statement interfaces and packages.
Change-Id: I84f7ad882172806a5aac8362837b85b50dc3a387
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Nov 2017 16:41:51 +0000 (17:41 +0100)]
Fix LeafListSchemaNode.getDefaults()
This method should be non-default, as marked by FIXME. Furthermore
it should represent a readily-parsed set of values, such that they
can be fed into a data container.
Change-Id: Ib63b3a5a419b13f79901632251b7584f3d18d2b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 6 Nov 2017 18:00:56 +0000 (19:00 +0100)]
Add DataTreeConfiguration copy builder
This adds convenience methods to instantiate Builder, potentially
initialized from a base configuration.
Change-Id: I1cb5db4a0d097856dec5ebcdf9490d89fa349893
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Nov 2017 12:37:33 +0000 (13:37 +0100)]
Eliminate ConstraintDefition.isMandatory()
This flag is not accurate for containers due to the fact that
augment can make it dependent on the document being processed.
Redefine meaning of isMandatory() to reflect just the effect
of 'mandatory' statement.
Change-Id: I0135f2ffd7df454880d8cf259cd21af9585ec857
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 7 Nov 2017 01:23:18 +0000 (02:23 +0100)]
Fix InMemoryDataTreeFactory.create() methods
All of them should be returning TipProducingDataTree, as that is
what we are constructing.
Change-Id: I459128121e954efee6a406f16563209c1a2612ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 7 Nov 2017 14:09:45 +0000 (15:09 +0100)]
YANGTOOLS-826: allow whitespace after function name
As per https://www.w3.org/TR/1999/REC-xpath-
19991116/#exprlex:
"For readability, whitespace may be used in expressions even though
not explicitly allowed by the grammar: ExprWhitespace may be freely
added within patterns before or after any ExprToken."
Add optional whitespace to the pattern to allow for this.
Change-Id: Iea5f7c9539734a5b5d3c1bb7367e615af4d1f9cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Nov 2017 13:00:56 +0000 (14:00 +0100)]
YANGTOOLS-825: extend plugin SPI with import resolution mode
This patch adds the basic API needed for codegen plugins to express
their desired import resolution mode. The default implementation
results in RFC6020/7950 compliant mode.
Change-Id: I60936171b984dab503e1933b21dbcb5bd68278c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 3 Nov 2017 10:45:08 +0000 (11:45 +0100)]
Move TypeDefinitions into yang-model-api
This utility class defines hashCode/toString/equals for TypeDefinitions,
hence it should live in the API package.
Furthermore split it out among concrete TypeDefinitions, so that it is
obvious to implementors they really should be using provided static
methods.
Change-Id: I0bf79f5a20958633ee7562bd44c861e0b0218137
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 7 Nov 2017 18:28:53 +0000 (19:28 +0100)]
YANGTOOLS-827: fix revision compare
When revision statements do not follow guidance from RFC6020/RFC7950
section 7.1.9 and are not order in the order of descending date and
the delta between previous and next version strings is not exactly 1,
we end up picking the wrong version.
This is caused by wrong compareTo() check, which should compare '< 0',
not '== -1'.
Change-Id: Ib7f9a77a9950b6da93ffa30e4c13cc940887ad19
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
3c855240dd70f79e7acd9fa98adb8c6a3580f60b)
Robert Varga [Fri, 3 Nov 2017 09:22:05 +0000 (10:22 +0100)]
Eliminate (Unsigned)IntegerTypeDefinition
These two act only as intermediaries, there is no real reason to
keep them around, as all of their functions are fulfilled either
by RangeRestrictedTypeDefinition or their sub-interfaces.
Change-Id: I48698203d9073d31defba2b0c9df3d8a5859616e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Nov 2017 17:37:49 +0000 (18:37 +0100)]
Consolidate (Unsinged)IntegerTypeEffectiveStatementImpl
The two classes are the same, hence we can concentrate them into
a single class, called IntegralTypeEffectiveStatementImpl.
Change-Id: I8fd5fb3ebe4feaa7005faeaeb5c8f55a692cd662
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Nov 2017 14:43:54 +0000 (15:43 +0100)]
Make RangeRestrictedTypeDefinition type-aware
This brings in native type into RangeRestrictedTypeDefinition, such
that the constraint type is properly qualified.
Change-Id: I1e099edb88abe882de0e937a43629693f1d660e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>