yangtools.git
6 years agoYANGTOOLS-833: Eliminate unneeded dependencies 95/65495/5
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>
6 years agoYANGTOOLS-706: move odlext parser support 62/65462/13
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>
6 years agoAdd support for overriding statement supports 79/65479/7
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>
6 years agoYANGTOOLS-706: separate out RFC8040 extension support 60/65460/13
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>
6 years agoFix checkstyle issues reported by odlparent-3.0.0's checkstyle 90/65490/1
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>
6 years agoBGPCEP-717: Reduce log levels 68/65468/4
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>
6 years agoCorrect YangData{SchemaNode,EffectiveStatement} interfaces 59/65459/6
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>
6 years agoYANGTOOLS-829: Wire extension support into default reactor 57/65457/8
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>
6 years agoYANGTOOLS-706: Split out yang-parser-rfc7950 56/65456/11
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>
6 years agoAdjust test suite parser update to conform with API changes 53/65453/8
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>
6 years agoRefactor RFC7950Reactors 52/65452/9
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>
6 years agoMove CustomStatementParserBuilder and YangInferencePipeline 51/65451/10
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>
6 years agoMove yang.parser.stmt.rfc6020.Utils 50/65450/9
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>
6 years agoYANGTOOLS-829: add parser support for openconfig-hashed-value 49/65449/9
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>
6 years agoMove Utils.findNode() 48/65448/7
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>
6 years agoSplit out OpenConfig extension metamodel 47/65447/7
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>
6 years agoSplit out OpenDaylight yang-ext metamodel 46/65446/9
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>
6 years agoRename yang.parser.rfc6020.repo to yang.parser.rfc7950.repo 45/65445/8
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>
6 years agoMove ASTSchemaSource and its components into rfc6020.repo 44/65444/8
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>
6 years agoMove YangStatementParserListenerImpl 43/65443/7
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>
6 years agoMerge PathUtils, TypeUtils and Utils methods 42/65442/7
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>
6 years agoMove default value checks from TypeUtils to EffectiveStmtUtils 41/65441/7
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>
6 years agoCreate parser.rfc7950.namespace package and populate it 40/65440/7
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>
6 years agoSplit out TypeUtils.parse{Length,Range}ListFromString 39/65439/4
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>
6 years agoMove TypeUtils.typeEffectiveSchemaPath() 38/65438/4
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>
6 years agoMove String/NumericalRestrictions 37/65437/2
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>
6 years agoSplit out PathUtils 36/65436/2
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>
6 years agoMove TypeUtils built-in type constants and utilities 35/65435/2
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>
6 years agoRemove TypeUtils.isYangTypeBodyStmtString() 34/65434/2
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>
6 years agoMove Utils.trimPrefix(String) 33/65433/2
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>
6 years agoMove StmtContextUtils.LIST_KEY_SPLITTER 32/65432/2
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>
6 years agoRemove Utils.transformKeysStringToKeyNodes() 31/65431/2
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>
6 years agoRemove Utils.trimPrefix(QName) 30/65430/2
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>
6 years agoRemove Utils.replaceIllegalCharsForQName() 29/65429/2
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>
6 years agoMove Utils.belongsToTheSameModule() 28/65428/2
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>
6 years agoHide {Extension,Input,Output,Submodule}EffeciveStatementImpl 25/65425/4
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>
6 years agoAdd NormalizedNodes.findNode(NormalizedNode, SchemaPath) 24/65424/6
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>
6 years agoAdd SchemaPath/SchemaNodeIdentifier.createChild(QName) 23/65423/6
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>
6 years agoYANGTOOLS-706: Add TypedefEffectiveStatement.asTypeEffectiveStatement() 20/65420/7
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>
6 years agoYANGTOOLS-706: add utility method for finding substatements 16/65416/8
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>
6 years agoYANGTOOLS-706: finish evacuation of stmt.rfc6020.effective 15/65415/7
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>
6 years agoIntroduce ElementCountConstraintAware interface 52/64952/15
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>
6 years agoPeel WhenConditionAware from ConstraintDefinition 10/65410/10
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>
6 years agoRefactor TypedSchemaNode 09/65409/6
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>
6 years agoPeel MustConstraintAware from ConstraintDefinition 08/65408/7
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>
6 years agoYANGTOOLS-724: mark leaking fields 06/65406/1
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>
6 years agoExpand rfc7950.stmt documentation 04/65404/1
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>
6 years agoYANGTOOLS-706: reorganize statement definitions 52/65352/11
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>
6 years agoYANGTOOLS-706: Split up base utility classes into rfc6020.util 50/65350/5
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>
6 years agoYANGTOOLS-706: Cleanup Unknown{Effective}StatementImpl 48/65348/4
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>
6 years agoYANGTOOLS-706: Bridge UnknownSchemaNodes on their interface 47/65347/4
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>
6 years agoYANGTOOLS-706: Refactor YangInferencePipeline 31/65331/11
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>
6 years agoYANGTOOLS-706: Reduce inter-statement implementation coupling 41/65341/8
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>
6 years agoYANGTOOLS-706: Retrofit EffectiveStatement interfaces into parser 40/65340/7
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>
6 years agoYANGTOOLS-706: Correctly wire EffectiveStatements 36/65336/7
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>
6 years agoAllow fluent use of BuildAction 11/65311/2
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>
6 years agoExpose type-specific derived type builder methods 07/65307/4
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>
6 years agoRemove DerivedTypes.isInt8() and friends 06/65306/4
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>
6 years agoRemove ModuleDependencySort.sort(Iterable) 05/65305/2
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>
6 years agoRemove SubstatementValidator.MAX 04/65304/2
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>
6 years agoAddress RFC7950 API changes 98/65298/3
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>
6 years agoYANGTOOLS-619: Add support for RFC7952 extensions 42/65142/16
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>
6 years agoYANGTOOLS-706: separate out yang-data StametementDefinition 44/65144/9
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>
6 years agoAnnotate @Nullable argument in SourceException 43/65143/8
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>
6 years agoYANGTOOLS-706: split out rfc8040-model-api 22/65122/8
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>
6 years agoFix LeafListSchemaNode.getDefaults() 13/65113/7
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>
6 years agoAdd DataTreeConfiguration copy builder 95/65195/5
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>
6 years agoEliminate ConstraintDefition.isMandatory() 95/65095/14
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>
6 years agoFix InMemoryDataTreeFactory.create() methods 40/65240/5
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>
6 years agoYANGTOOLS-826: allow whitespace after function name 67/65267/3
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>
6 years agoYANGTOOLS-825: extend plugin SPI with import resolution mode 94/65094/7
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>
6 years agoMove TypeDefinitions into yang-model-api 87/65087/9
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>
6 years agoYANGTOOLS-827: fix revision compare 80/65280/1
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)

6 years agoEliminate (Unsigned)IntegerTypeDefinition 86/65086/8
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>
6 years agoConsolidate (Unsinged)IntegerTypeEffectiveStatementImpl 55/65055/10
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>
6 years agoMake RangeRestrictedTypeDefinition type-aware 50/65050/9
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>
6 years agoYANGTOOLS-621: introduce specialized integer types 43/65043/11
Robert Varga [Thu, 2 Nov 2017 11:01:05 +0000 (12:01 +0100)]
YANGTOOLS-621: introduce specialized integer types

This introduces Int{8,16,32,64}TypeDefinition and
Uint{8,16,32,64}TypeDefinition to represent type definitions based
on these 8 builtin types.

This renders (Unsigned)IntegerTypeDefinition only a family capture,
which allows sharing common code paths. Users should refer to
individual types where possible.

Furthermore this eliminates the need for DerivedTypes.is*() methods,
which are deprecated. Users can perform the same function, sans
null checking, via plain instanceof checks.

Change-Id: I2d9620287f10cb7bd4e558b59890da25d976f67a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMake DecimalTypeDefinition.getFractionDigits() return int 52/65052/3
Robert Varga [Thu, 2 Nov 2017 16:53:34 +0000 (17:53 +0100)]
Make DecimalTypeDefinition.getFractionDigits() return int

This is required to be a non-null Integer, which may just as well
be a primitive int.

Change-Id: Ibca5afb3dda7ee56e08b60602c9256a02815c284
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoEnforce decimal64 fraction-digits in derived types 42/65042/6
Robert Varga [Thu, 2 Nov 2017 13:17:26 +0000 (14:17 +0100)]
Enforce decimal64 fraction-digits in derived types

Overriding fraction-digits to a different value than specified by
base type is invalid -- throw a SourceException if we encounter such
a thing.

Change-Id: Ibb79203377ff41eefbf70100d6e86887e2fff185
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoYANGTOOLS-706: split out yang-parser-reactor 38/65038/5
Robert Varga [Thu, 2 Nov 2017 09:57:41 +0000 (10:57 +0100)]
YANGTOOLS-706: split out yang-parser-reactor

The reactor should not have any dependencies on support packages,
which has been achieved. Split it out into a separate artifact
to ensure we do not regress in this regard.

Change-Id: I748fae1e8f03d2fdee47016c085c35c73a5fad2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUpdate DataTreeFactory 37/65037/5
Robert Varga [Thu, 2 Nov 2017 09:43:01 +0000 (10:43 +0100)]
Update DataTreeFactory

This patch removes deprecated methods, adds a correctness note to
the single-argument create() method and promotes the other two to
non-Beta status.

Change-Id: I2a081dfa1dadcd19aa7b70109b6cca2be88c10be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove JSONCodecFactory.create(SchemaContext) 36/65036/5
Robert Varga [Thu, 2 Nov 2017 09:35:33 +0000 (10:35 +0100)]
Remove JSONCodecFactory.create(SchemaContext)

This method has been deprecated in favor of various static factory
methods, like getShared(), getPrecomputed(), createLazy() and similar.
Those offer various computation strategies and allow users to better
fine-tune memory/cpu overhead trade-offs based on their use. Remove
the old create() method.

Change-Id: I01bb4063be2273bc7f5cc3e2361b23c01ffa11bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove XmlParserStream.create(NormalizedNodeStreamWriter, SchemaContext) 35/65035/5
Robert Varga [Thu, 2 Nov 2017 09:34:19 +0000 (10:34 +0100)]
Remove XmlParserStream.create(NormalizedNodeStreamWriter, SchemaContext)

This method has been deprecated in favor of the three-argument variant,
which is more powerful. Remove it.

Change-Id: I0416c2931a77cb9bec74de4ad2f02f339a51b4ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove EffectiveSchemaContext.resolveSchemaContext() 34/65034/5
Robert Varga [Thu, 2 Nov 2017 09:32:17 +0000 (10:32 +0100)]
Remove EffectiveSchemaContext.resolveSchemaContext()

This method has been deprecated in favor of SimpleSchemaContext's
forModule() static factory method. Remove it.

Change-Id: Idf4b4834d98b84ffcd8bf91046b9dd3856183d61
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove SchemaTracker.leafSetEntryNode() 33/65033/5
Robert Varga [Thu, 2 Nov 2017 09:30:03 +0000 (10:30 +0100)]
Remove SchemaTracker.leafSetEntryNode()

This no-arg method is deprecated in favor of leafSetEntryNode(QName),
remove it.

Change-Id: Ifc39251bae3afd37e2d0d7e2db248e9c641a3486
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoEliminate IdentityStatement.getBase() 32/65032/5
Robert Varga [Thu, 2 Nov 2017 09:26:51 +0000 (10:26 +0100)]
Eliminate IdentityStatement.getBase()

RFC7950 metamodel indicates an identity can have multiple base
identities -- remove the singular getBase() in favor of getBases().

Change-Id: I145832a69d16d09af19849eeba3e6334e02ebb7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDocument Builder.build() method to throw IllegalStateException 20/65020/6
Robert Varga [Thu, 2 Nov 2017 08:32:29 +0000 (09:32 +0100)]
Document Builder.build() method to throw IllegalStateException

Implementations should be throwing ISE or its subclass when they are
requested to build an object while not enough state has been populated.

Change-Id: I837bc5a3379ffffe3806382ccac97021948673f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoEliminate ModuleIdentifier 26/65026/5
Robert Varga [Thu, 2 Nov 2017 08:46:17 +0000 (09:46 +0100)]
Eliminate ModuleIdentifier

It has been superseded by SourceIdentifier and its concrete subclasses.

Change-Id: I88ae6bd8fae103198ad3caa7957de32f9bbed8e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove ModuleIdentifier from reactor namespaces 94/64994/9
Robert Varga [Wed, 1 Nov 2017 12:26:03 +0000 (13:26 +0100)]
Remove ModuleIdentifier from reactor namespaces

SourceIdentifier fills in the same role, eliminate use of ModuleIdentifier
in reactor sources.

Change-Id: I437307249ec5b88a79864bdaebbf99e90bdd4696
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoDo not use ModuleIdentifier to identify sources 93/64993/8
Robert Varga [Tue, 31 Oct 2017 17:09:14 +0000 (18:09 +0100)]
Do not use ModuleIdentifier to identify sources

This eliminates the use of ModuleIdentifier for library resolution
purposes, paving a way to support semantic imports with module
library.

Change-Id: Idfb885472b191c0685b6e385c405e18934e0b84f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoEliminate IdentityrefTypeDefinition.getIdentity() 56/64956/9
Robert Varga [Tue, 31 Oct 2017 16:07:38 +0000 (17:07 +0100)]
Eliminate IdentityrefTypeDefinition.getIdentity()

getIdentity() implies singularity, which is not correct with respect
to RFC7950 metamodel. Remove the method in favor of getIdentities().

Change-Id: Idcffd7dcbe8f9303408d0d09e46cad959b38c21e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix IdentityrefTypeDefinition comparison 55/64955/7
Robert Varga [Tue, 31 Oct 2017 16:01:11 +0000 (17:01 +0100)]
Fix IdentityrefTypeDefinition comparison

IdentityrefTypeDefinition can contain multiple base identities, hence
the comparison needs to take into account all of them.

Change-Id: Ibe90cf1dc7fed8a2c1f3f7f16606f85d6761bb50
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoBUG-8043: correct RangeConstraint definition 45/62445/18
Robert Varga [Tue, 29 Aug 2017 15:36:34 +0000 (17:36 +0200)]
BUG-8043: correct RangeConstraint definition

Each type has at most one range constraint attached to it, reflect
that fact in yang-model-api hiearchy.

This has implications on RangeStatement: it should not be exposing
RangeConstraints, as that is not what the argument holds. Reuse
ValueRange from previous work on LengthConstraint and model ranges
in a similar fashion.

Change-Id: Ia3d13ce2e27b37c579bf40b30032451996c59914
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUpdate TypeDefinition design 73/64873/9
Robert Varga [Mon, 30 Oct 2017 11:04:06 +0000 (12:04 +0100)]
Update TypeDefinition design

Use Optional to communicate presence of default value and units. Update
call sites to do the right thing, also for previously-missed changes.

Change-Id: Icfffb752507e2810a6afb157faa09d07680292cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoMake ListSchemaNode.getUniqueConstraints() non-default 72/64872/8
Robert Varga [Mon, 30 Oct 2017 08:19:02 +0000 (09:19 +0100)]
Make ListSchemaNode.getUniqueConstraints() non-default

This method should always be overridden, make it non-default.

Change-Id: Ifdf6ed9cde3d1857db00b49b4aa5304265b7fc78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoFix NotificationDefinition 71/64871/8
Robert Varga [Sun, 29 Oct 2017 21:48:41 +0000 (22:48 +0100)]
Fix NotificationDefinition

NotificationDefinition should provide MustDefinitions directly, as
it cannot have any other constraints.

Change-Id: Icf38b5b832979fafac8c38b09b108509014fc48c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoUpdate ChoiceSchemaNode design 52/64852/12
Robert Varga [Sat, 28 Oct 2017 14:54:46 +0000 (16:54 +0200)]
Update ChoiceSchemaNode design

ChoiceCaseSchemaNodes have unique QName, which how the only implementation
keeps track of them, hence they should be exposed as a SortedMap keyed by
QName.

This renders getCaseNodeByName() obsolete, as there are better ways of
getting the same result.

Change-Id: Ia52b6d22b3df66546a3ead7addcfd1aba9b0b6a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoQNameModule should implement Comparable<QNameModule> 53/64853/7
Robert Varga [Sat, 28 Oct 2017 15:04:27 +0000 (17:04 +0200)]
QNameModule should implement Comparable<QNameModule>

It is a composition of URI and Revision, both of which are Comparable.
compareTo() now compares URI first and then Revision.

Change-Id: If36815df36264b4fbd6abe9896d35a7a11f5a8f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoRemove LeafSchemaNode.getUnits/getDefault() 40/64840/12
Robert Varga [Fri, 27 Oct 2017 23:49:16 +0000 (01:49 +0200)]
Remove LeafSchemaNode.getUnits/getDefault()

These details are already encoded in LeafSchemaNode's type. Remove them from
LeafSchemaNode to prevent confusion and direct users to the type definition.

Change-Id: I588ccefeabc83d801122f78c4b55d1a0b863a039
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
6 years agoYANGTOOLS-823: take modifier into account when enforcing patterns 49/64849/5
Robert Varga [Sat, 28 Oct 2017 11:02:07 +0000 (13:02 +0200)]
YANGTOOLS-823: take modifier into account when enforcing patterns

Modifiers are an RFC7950 addition to the metamodel and need to be
accounted for to comply with the specification.

Change-Id: Ide9625812a2df26e931a2b5d472af80bba07d730
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>