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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Robert Varga [Fri, 27 Oct 2017 23:34:52 +0000 (01:34 +0200)]
Mark ModuleImport technical debt
ModuleImport should not be part of effective world because it's sole
purpose is to provide String->QNameModule mapping.
Change-Id: I9cabc16b7c711edffad8ba9c9306f1fe0c5c81ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 23:03:10 +0000 (01:03 +0200)]
Clean up PatternConstraint's String confusion
Make getRawRegularExpression() non-default and make sure we use descriptive
names for the two strings -- one is a XSD RegEx String, the other
a Pattern-compatible String.
Change-Id: I6a8be40aa172cdd2c4b0c461836245bc5a63a83b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 22:34:08 +0000 (00:34 +0200)]
Make PatternConstraint.getModifier() non-default
Also change its return value to an optional, so that we properly
express its 0..1 cardinality.
Change-Id: I08ba48f31960ccbb1cc45ade46e441fb0d47deff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 22:16:22 +0000 (00:16 +0200)]
Cleanup NotificationNodeContainer
Make the API consistent with ActionNodeContainer, e.g. by not providing
a default implementation.
Change-Id: I42b74a37ea6c76b79e357e4413a94c085dbcd2ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 21:08:19 +0000 (23:08 +0200)]
Eliminate duplicate EnumPairBuilder boilerplate
We are performing the same block of operations in two different places,
create a utility method to hold common code for both code paths.
Change-Id: Ic7adb46fe15d5d2d307833349975faa04d935517
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 18:05:33 +0000 (20:05 +0200)]
Cleanup DocumentedNode
Make description/reference work on Optional and fixup users.
Change-Id: I744b9c59c8c3cc160636ef8c3ff18298c66a275a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Thanh Ha [Mon, 30 Oct 2017 20:50:42 +0000 (16:50 -0400)]
Remove deploy-site.xml
With the javadoc jobs now available to generate javadoc it is time to
remove the maven-sites and related files.
Change-Id: I82f655c97c62befd90bf31ee6ec285fbaa4f40e4
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Robert Varga [Fri, 27 Oct 2017 17:47:03 +0000 (19:47 +0200)]
Make ConstraintMetaDefition attributes Optional
Both error message and application tag can be null, wrap them in
an Optional, reducing confusion for users around empty string
semantics in their values.
Change-Id: Ie96850655b23bda81c864e3804b21e05ace5acbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 17:36:57 +0000 (19:36 +0200)]
Make ConstraintMetaDefinition extend DocumentedNode
It shares description/reference with DocumentedNode, and usuall also
unknown nodes. Tie the two together so we get consistent method
definitions across the board.
Change-Id: I4336059304715323155576e1229e2c32fc859df1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 17:26:32 +0000 (19:26 +0200)]
Make Module.getContact()/getOrganization() return Optional
These methods can return null, but have not been marked as such,
make the contract explicit by using an Optional return.
Change-Id: Id9e74fc7ee957fbb2f5c03255177a65bc23dd3a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 16:28:13 +0000 (18:28 +0200)]
Introduce DataNodeContainer.findDataChildByName()
This the primary, non-null returning replacement of getDataChildByName(),
which is turned into a deprecated default utility method. This forces
users to check the return, flusing out potential inconsistencies like
null nodes in collections.
Change-Id: I8e81044c21a9b5daaa63c3ba347aa13a4222ae44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 16:05:24 +0000 (18:05 +0200)]
Make AnyDataSchemaNode.getSchemaOfAnyData() return Optional
Rather than going the nullable route, return an optional, forcing
users to define behaviour when the schema is not present.
Change-Id: I220debe08c031d4490e29805fc846637043899f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 15:59:34 +0000 (17:59 +0200)]
Introduce WhenConditionAware
getWhenCondition() is used by multiple interfaces, extract it to
a dedicated interface so the individual definitions are consistent.
Change-Id: I177f8dcddd1ffa150ffe50c106475ee624343a20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 14:09:59 +0000 (16:09 +0200)]
Make ActionNodeContainer.getActions() non-default
The API specification should not rely on particular exceptions, those
should be handled by sub-interfaces. Since we can make breaking API
changes, now is the time to change this.
Change-Id: I3bc3bee4abd8794343d811aa4bfdb5a64677eda8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 21:22:53 +0000 (23:22 +0200)]
Clean up CrossSourceStatementReactor
Remove deprecated methods, so we move towards a more builder-like
interface.
Change-Id: I28c86e35fd7d1a258e612651f1aa3420597f6cce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Oct 2017 14:56:10 +0000 (16:56 +0200)]
Fix Revision.ofNullable() javadoc
Update javadoc to identify proper execption that is thrown.
Change-Id: Icde0b6932b7ed7769f9ed18cc205c77b060c2b82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 21:06:46 +0000 (23:06 +0200)]
YangSyntaxErrorException should identify its source
Having just the module name is not sufficient in reactor settings where
there may be diverse sources involved.
Update YangSyntaxErrorException to contain SourceIdentifier when available.
Change-Id: Ied076ecd60fcef000ef498f632d2288fa2f6d954
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 20:17:27 +0000 (22:17 +0200)]
Update concepts.Registration
Do not allow Registration.close() to throw checked exceptions. While it
is a good practice to check for exceptions in foreign code, it is purely
optional and should include RuntimeExceptions as well.
Also update AbstractRegistration to enforce identity hashCode/equals and
also toString() format.
Change-Id: I8d70273e1a42943288a16ac8edf40381707da186
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 19:55:42 +0000 (21:55 +0200)]
Clean up data.api.SchemaUtils
Remove deprecated classes and reformulate internals to perform explicit
finds.
Change-Id: I9ad4ea68f1bbde67a7a54145679804d49cc5ff77
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 18:39:17 +0000 (20:39 +0200)]
Make Module extends NamespaceAware and DocumentedNode
Module already shares the same methods, make sure we inherit them
from a single place to ensure API compatibility.
Change-Id: Ib4653484fb2d619621e7eac117c862e487f8765a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 26 Oct 2017 22:10:43 +0000 (00:10 +0200)]
BUG-4688: update Revision design a bit more
As it turns out, we need to have a reasonable serialization into Java
code -- where we already are supporting @Nullable arguments in places
like QName.create(String, String, String).
Add an ofNullable(String) factory method which returns
an Optional<Revision>, forming a convenient bridge for code generators.
Change-Id: Iacea1725e9fbe304bf63fbf087f4b14a8a352ccd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 18:35:32 +0000 (20:35 +0200)]
Make Deviation extend DocumentedNode
It shares the same attributes, make sure they are related to keep
our APIs consistent and reusable.
Change-Id: I270b9742dce5539698b0ed7a51097409031b9577
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 18:31:47 +0000 (20:31 +0200)]
Fix yang.model.api.AugmentationSchema
This interface has long been sticking out as not following naming
conventions. Fix that and make it extended DocumentedNode.WithStatus
to properly tie its attributes to a common definition.
Change-Id: Ibf5c477bf80175597a6d34f7370457233c5310c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 17:41:26 +0000 (19:41 +0200)]
Fix checkstyle in yang-parser-impl and enable enforcement
This patch sweeps the sources and flips the switch so we do not
regress over time.
Change-Id: Id1322696341c6ffdfb892ce69e5b07bde0a1543e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 13:42:34 +0000 (15:42 +0200)]
BUG-4688: eliminate QName(Module).getFormattedRevision()
Since we are capturing revisions in their objects, these methods do not
really serve a purpose, remove them.
Change-Id: Iac1601fd5e049472d3cda77db9ff306b0443d4ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 12:26:37 +0000 (14:26 +0200)]
BUG-4688: Make SourceIdentifier use Revision
There is no need to treat the string representation differently,
just use Revision everywhere. This forces us to clean up module
names to actually match revisions.
Change-Id: Ibc6b268a8dc4156e9c2940018c6f696f5fe3c6ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 11:50:59 +0000 (13:50 +0200)]
BUG-4688: remove SimpleDateFormatUtil
Convert FilesystemSchemaSourceCache to use Revision and remove
SimpleDateFormatUtil as it is not used anywhere anymore.
Change-Id: Ie59921866bf84fbbe75a07cdcf3cc44f8bdafcd2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 11:42:17 +0000 (13:42 +0200)]
BUG-4688: Move SourceIdentifier.REVISION_PATTERN to yang.common.Revision
Revision class is the natural home for this pattern, as it already
is defining the same thing for internal purposes. Expose
REVISION_PATTERN from Revision and remove it from SourceIdentifier.
Change-Id: I994b5ad4eaeb6560334ebda088aa4492c90afa8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 10:09:09 +0000 (12:09 +0200)]
BUG-4688: switch revisions from Date to Revision
This is a mass conversion of revision representation from java.util.Date
to yang.common.Revision. Using java.util.Date was a mistake from the get
go, causing confusion in users and implementation.
QName.parseRevision() is removed in favor of Revision.valueOf() and invalid
revision strings are updated.
Change-Id: Ifce810bab4183186b67f5f3acfad03ac9c081815
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 00:18:40 +0000 (02:18 +0200)]
BUG-4688: align Optional/nullable Date usage
This patch introduces proper nullable/Optional bridge methods, so that
we have a clear hand-off between APIs.
Change-Id: I448feffa7a64eb97cfc74b830d2242ecb55880a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Oct 2017 22:45:20 +0000 (00:45 +0200)]
BUG-4688: update Revision class design
Since Revision is typically captured property, with complete semantics
when it is missing, it is useful to define operations on nullable and
optional Revisions.
Furthermore we know what the proper format is, so rather than relying
on a date object, use the underlying string. This saves us some work
when communicating with others.
Change-Id: I5716f416cf87697f832c05d6223dbc9dd87dfd15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Oct 2017 16:36:25 +0000 (18:36 +0200)]
Fix wrong comparison
This is pointed out by eclipse: QName will never compare as equal
with a QNameModule. Fix the thinko.
Change-Id: I32b0856fb533189be4700a4f7e3eeb00eb319b44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Oct 2017 22:33:40 +0000 (00:33 +0200)]
Correct IdentitySchemaNode documentation
Do not leak implementation details, but rather explain API contract.
Change-Id: I773dbd157883dab403b1468abd0bae4289a61f06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 18 Aug 2017 14:01:01 +0000 (16:01 +0200)]
Enforce non-null QNameModule namespace
QNameModule without a namespace does not really make sense,
enforce valid namespace.
Change-Id: I62e8daf71deba15e4d3bdb975046223ade57cdbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Oct 2017 15:49:22 +0000 (17:49 +0200)]
BUG-4688: eliminate SimpleDateFormatUtil.DEFAULT_DATE_REV
This is the final push for eliminating DEFAULT_DATE_REV, with all
other issues resolved, this removes the constant, adjusts the code
to correctly interpret non-present revisions and fixes up test
cases, eliminating the leaking 1970-01-01 string.
This actually fixes a few test cases, which relied on import with
revision 1970-01-01 matching modules which do not declare revision.
Change-Id: I59dbe8b06ad2d94e6a677959f29f5c2b52357d0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 23 Oct 2017 23:11:49 +0000 (01:11 +0200)]
BUG-4688: Rework SchemaContext module lookups
SchemaContext.findModule*() family of methods is making the mistake
of treating null revision as a wildcard. This does not match RFC6020
and RFC7950, which allow for modules without a revision, hence we need
to mark non-existing modules with a magic constant, which maps to
1970-01-01.
While we can use identity checks and assume such a revision will not
be seen in the wild, this approach does not really work with maps
and creates confusion with users, who need to treat DEFAULT_DATE_REV
as something special.
This patch cleans up the lookup methods and makes
ModuleIdentifier.getRevision() return an Optional<Date>, in preparation
to making the transition to SourceIdentifier.
As a side-effect we switch to using QNameModule-based lookups in couple
of places, which are significantly faster than combined name/revision
lookups.
Change-Id: I5602192e26d721d2461248c612d98a1b305c6958
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Oct 2017 11:46:07 +0000 (13:46 +0200)]
Use QName.parseRevision() instead of SimpleDateFormatUtil
It has an interface better suited for testing, simplifying test code.
Change-Id: I14fbaf3bebf3a64280d4141ba533395d2b41f015
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 23 Oct 2017 22:02:15 +0000 (00:02 +0200)]
BUG-4688: switch IncludeStatementImpl to use queries
Use IdentifierKeyCriterion instead of lookups based on magic constants,
eliminating last real user of SimpleDateFormatUtil.DEFAULT_DATE_IMP and
killing that magic number completely.
Change-Id: I72cb7babe6904155d10e6c2a36d6d8731e58c7e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 23 Oct 2017 16:49:42 +0000 (18:49 +0200)]
BUG-4688: switch semantic imports to queries
Use NamespaceKeyCriterion-based lookup for resolution of semver-based
imports. This simplifies the code quite a bit and makes it obvious
that revision and semver imports have really different mechanics.
Change-Id: I27696fbd4903037477c8c4b091f4ab83891bc53c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 21 Oct 2017 06:44:12 +0000 (08:44 +0200)]
BUG-4688: switch revision imports to queries
Use NamespaceKeyCriterion-based lookup for resolution of revision-based
imports, which eliminates the need to use
SimpleDateFormatUtil.DEFAULT_DATE_IMP in this lookup path and re-lookups,
as those are already taken care of in the criterion resolution process.
Change-Id: Ie20f3be9591da9ff65348c3c8f5d7cb071c98769
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 23 Oct 2017 18:40:51 +0000 (20:40 +0200)]
Lazily populate listeners and derived namespaces
Rather than allocating collections eagerly only allocate them as
needed, so our footprint is lower when these are not used.
Since listeners are unregistered once they fire, also make sure
we free up the collection when it is empty.
Change-Id: Ia1b20718fbc7bc41de75820b602ffb8c9fdcf0a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Oct 2017 12:08:59 +0000 (14:08 +0200)]
BUG-4688: Add flexible match support to NamespaceStorageSupport
This patch adds the support for flexible match of namespace keys
based on filter/reduce mechanics -- which are required to consistently
support revisionless and semantic imports without reliance on
magic constants in public interfaces.
In order to support required mechanics, we need to fix
the ValueAddedListener implementation and their lifecycle and introduce
a predicate-based match.
Change-Id: Icb22850e44de05d59820e1974e204dc1541e1f76
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Oct 2017 12:43:48 +0000 (14:43 +0200)]
Cleanup NamespaceBehaviourWithListeners
Lower method visibility and eliminate unneeded method indirection,
as it makes things less clear than they could be.
Furthermore move isRequestedValue() so that it is a property of
ValueAddedListener -- eliminating the requirement of the listener
having an exact key.
Change-Id: Ibc3b207740349c9268c4a42072348c680295def8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 29 Aug 2017 07:19:57 +0000 (09:19 +0200)]
BUG-8043: correct LengthConstraint definition
Each type has at most one length constraint attached to it, reflect
that fact in yang-model-api hiearchy.
This has implications on LengthStatement: it should not be exposing
LengthConstraints, as that is not what the argument holds. Define
ValueRange construct to hold the parsed-out (but unresolved) ranges
as parsed from length argument.
Change-Id: I38e1e5a40a0b7562d202816f126cc1ecec414d0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Igor Foltin [Tue, 17 Oct 2017 14:08:18 +0000 (16:08 +0200)]
Bug 9242: Reuse deviating statement contexts
In the process of deviate add/replace resolution we make
copies of deviated statement contexts which are then added
to the deviation target context.
However, making copies of these statement contexts is not
necessary except the ones which represent unknown statements.
Therefore, reuse them during the resolution of deviate add/replace.
By doing this, we also solve the failing deviate replace with
user-defined types as statement contexts that represent deviating
user-defined types are now resolved within their original context.
Change-Id: Ie61a38e270ef648fe61ea283805d149533c10f62
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Robert Varga [Fri, 20 Oct 2017 23:16:04 +0000 (01:16 +0200)]
Improve StatementContextBase documentation
Clarify intended behavior of addPhaseCompletedListener().
Change-Id: I23025cfb64a7069e84c0f0c182f3c78e500e2e73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Oct 2017 16:59:33 +0000 (18:59 +0200)]
Do not accept null phase in ModifierImpl
This would constitute a coding error, hence detect it explicitly.
Change-Id: I41bccb4cccc68aa5f4a592ca9bba602cb1ef3ad8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Oct 2017 20:47:27 +0000 (22:47 +0200)]
BUG-4866: fix ImpPrefixToModuleIdentifier
ImpPrefixToModuleIdentifier is used only as indirection in
Prefix -> ModuleIdentifier -> QNameModule lookup. This is better
served via imported module context.
Rename the namespace to ImportPrefixToModuleCtx and have it return
imported StmtCtx directy, changing the lookup to work with
Prefix -> StmtCtx -> QNameModule.
This eliminates the need for ModuleIdentifierToModuleQName namespace,
as there is nothing depending on its contents -- so remove it too,
lowering our footprint and simplifying code a bit.
Change-Id: I9804cd940fd732798cbd43194591637d021d1ac8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Oct 2017 09:24:10 +0000 (11:24 +0200)]
BUG-4688: migrate IncludedModuleContext
IncludedModuleContext is a simple namespace, which does not perform
actual lookups on the keys, but rather is intercepted by
RootStatementContext.
We can safely migrate its key from ModuleIdentifier to SourceIdentifier,
peeling off yet another potentially special-cased path.
Change-Id: I56865175201a01fb381c0c049aedcf6213fc7f87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Oct 2017 09:09:46 +0000 (11:09 +0200)]
BUG-4688: Fix IncludedSubmoduleNameToIdentifier namespace
This namespace is used as an indirection towards lookup of submodule's
StmtContext. This is completely unnecessary, as we can easily store
the context in the namespace, as we already have it available when
include statement's prerequisite is resolved.
This eliminates the need for a ModuleIdentifier-based lookup.
Change-Id: I21b0aad832cad57ad35980df4e0b33b44d77b084
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 20:39:43 +0000 (22:39 +0200)]
BUG-4688: Fix BelongsToPrefixToModuleIdentifier namespace
This namespace is used as a lookup indirection in the lookup of
QNameModule corresponding to a prefix:
String -> BelongsToPrefixToModuleIdentifier ->
ModuleIdentifierToModuleQName -> QNameModule
Whereas we get the target module's StmtContext from the reactor,
and hence can go through ModuleCtxToModuleQName namespace instead:
String -> BelongsToPrefixToModuleCtx ->
ModuleCtxToModuleQName -> QNameModule
This has the benefit of not needing any wildcard searches and
us getting precisely the QNameModule of the module which satisfied
our reactor requirement. It also removes the only source of
SimpleDateFormatUtil.DEFAULT_BELONGS_TO_DATE and hence that magic
value is removed, too.
Change-Id: I1d74bed41952ba7f15bfeb6af94193632b8fb8ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 18:18:25 +0000 (20:18 +0200)]
BUG-4688: Switch BelongsToModuleContext to SourceIdentifier
Instead of using deprecated ModuleIdentifier, use SourceIdentifier.
Change-Id: Ifb3dc771db3664260b44e5e824b5aa769811bd0a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 17:13:03 +0000 (19:13 +0200)]
BUG-4688: Rename StmtContext.Mutable.addRequiredModule()
This method is a misnomer, as we really are requiring a source to be
resolved. Rename the method to addRequiredSource() and make it work
with SourceIdentifier.
Also add a note that the method should be eliminate in favor of using
a namespace inside the reactor.
Change-Id: I39ce96da090bdf07af545e7dbd40363e5c048267
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 16:12:28 +0000 (18:12 +0200)]
BUG-4688: Eliminate use of ModuleIdentifier in ImpPrefixToSemVerModuleIdentifier
ModuleIdentifier being used to resolve semantic version is slightly
wrong, we already have SemVerSourceIdentifier, which serves exactly
the same purpose.
Rename ImpPrefixToSemVerModuleIdentifier namespace to better reflect
its use -- ImportPrefixToSemVerSourceIdentifier and adjust it to
carry SemVerSourceIdentifier.
This eliminates the need for ModuleIdentifier.getSemanticVersion()
and ModuleIdentifier.getNamespace() -- making it very obvious that
SourceIdentifier is the same thing with a different representation
of a revision.
Change-Id: Iac9948a271b1dcc09d8aeb3de4e019d3842a4562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 16:03:51 +0000 (18:03 +0200)]
BUG-4688: Eliminate SourceIdentifier.create()
This method has been deprecated and direct instantiations should go
through Revision/SemVerSourceIdentifier.
Change-Id: I8a9e13637fc9d6f183edc8b8774e3d4183c138fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 11:24:06 +0000 (13:24 +0200)]
BUG-4688: Eliminate Module.DEFAULT_SEMANTIC_VERSION
Modules do not really have a default version. Rework the logic
in terms of Optional<SemVer>, without any magic constants.
Change-Id: I07bde806b6575fb56e7078258088025ca603e8f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 13:36:01 +0000 (15:36 +0200)]
BUG-4688: Eliminate ModuleIdentifier.getQNameModule()
This method should be part of Module only, remove it and its sole user,
which happens to be a test.
Change-Id: I481050cb9e8601a5cb294bf1f2493d1fa6adb040
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 09:59:03 +0000 (11:59 +0200)]
BUG-4688: Disconnect Module and ModuleIdentifier
ModuleIdentifier is a utility used to identify module source, not really
a Module, since Modules are identified by various attributes in different
contexts. Disconnect these two interfaces so they can evolve independently.
Also eliminate SchemaContext.getAllModuleIdentifiers() and move its
funcitonality to SchemaContextUtil, where it can be applied to any
SchemaContext.
Change-Id: I4fd858d7b962d7dd219b6dc570c239d56028c6ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Oct 2017 09:06:36 +0000 (11:06 +0200)]
Fix Module.getVersion()
We should be returning YangVersion instead of a String, do exactly
that.
Change-Id: Ieeef1b8f1da9a5084d969cb217f7994374eea425
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Tomas Cere [Tue, 3 Oct 2017 10:36:26 +0000 (12:36 +0200)]
BUG 8927: Netconf response payload fails to render in JSON
JSONNormalizedNodeStreamWriter does not write a content of anyXml nodes
correctly mainly due to Text nodes containing whitespaces before, between
or after Element nodes. Therefore the first Text node only was serialized
to JSON and the rest of anyXML content was missing.
This patch provides fix of anyXml content serialization to JSON.
Change-Id: I74f34aecec1a85b2ede4be63e5b6dd74522981e4
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Thu, 3 Aug 2017 11:20:43 +0000 (13:20 +0200)]
Bug 7051 - moving of CustomStatementParserBuilder
Moving of CustomStatementParserBuilder to new package rfc6020.ext
in order to eliminate undesired dependency of
org.opendaylight.yangtools.yang.parser.stmt.reactor
on org.opendaylight.yangtools.yang.parser.stmt.rfc6020
Change-Id: I255f2d568d6db915332884246a7b8ddda9e23431
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Fri, 13 Oct 2017 10:42:03 +0000 (12:42 +0200)]
BUG-9265: Switch empty type mapping from Void to Empty
Using Void means NormalizedNode.getValue() has to be nullable,
which wreaks havoc to a lot of places. Switch mapping to Empty, which
is a singleton dedicated to representing this type.
This flushes out quite a few of null violations, which are also fixed
up.
Change-Id: I4de3afed3d641eda292fdd4116497f3f22a0d770
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Michael Vorburger [Thu, 28 Sep 2017 21:32:19 +0000 (23:32 +0200)]
SpecialExecutors with LoggingThreadUncaughtExceptionHandler
Change-Id: I133bbf474a60681f061968a8f9ed1ed32671fd6a
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Peter Kajsa [Wed, 11 Oct 2017 09:31:53 +0000 (11:31 +0200)]
Ietf-routing identity issue test
Change-Id: I5e00763d7ca7a215649841a11bc16f2a544d0537
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Igor Foltin [Tue, 17 Oct 2017 09:07:51 +0000 (11:07 +0200)]
Bug 9244: Fix deviate replace of implicit substatements
In case when a deviate replace of a config/mandatory/max/min-elements
substatement targets a node which does not contain an explicitly declared
config/mandatory/max/min-elements, YANG statement parser throws an exception
because it did not find the substatement in the target node.
However, according to RFC6020/7950, these properties are always implicitly
present. Therefore, perform a deviate add instead of throwing an exception
in this particular case.
Change-Id: I79e5c427040c81db7f2f68ebcfa71b274d48816d
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Robert Varga [Tue, 10 Oct 2017 16:01:39 +0000 (18:01 +0200)]
BUG-4661: Introduce Decimal64, Empty, Uint{8,16,32,64}
This introduces specialized classes for native YANG types. The types
are not used yet.
Change-Id: I356f134c27ea4c8e593da067c2a5e8f2c989bbea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 17 Oct 2017 22:38:17 +0000 (00:38 +0200)]
Remove Module.getSource() and SchemaContext.getModuleSource()
This method does not fit the metamodel, as the concept of a YANG
source is only available in the declared world and above. The specific
concept of a YANG text source is defined at the repo.api level
and should be used from there.
Remove this method.
Change-Id: I9de39f538683d86fc40dd5ada9e13bddc3de8b38
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Oct 2017 14:57:18 +0000 (16:57 +0200)]
Fix odlparent-3-detected checkstyle issues
This is a preparatory patch to keep the transition changes down.
Change-Id: Iabbebc4c0dcae2bf248c523d5fd4041f6b99e140
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 29 Sep 2017 10:03:45 +0000 (12:03 +0200)]
BUG-9218: package yang-model-export
Downstreams are using this artifact and are actively packaging it
themselves. Fix this by including it with the parser.
Change-Id: If1c6752ac7dd64c933ea7a74ef0ba9ea10e87f1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
da7d07bbbc98f8dd2893e3d2eaf43af818ff0b40)
Robert Varga [Mon, 16 Oct 2017 17:04:04 +0000 (19:04 +0200)]
Do not wrap SourceException
SourceException and InferenceException are based on RuntimeException,
there is no need to wrap them in ISE. Remove the wrapper.
Change-Id: Ie599ba317671cfe2d91d54be6864d83e7e2b7c25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Oct 2017 16:27:16 +0000 (18:27 +0200)]
Fix checkArgument() format string
{} is the wrong placeholder, fix it to %s.
Change-Id: Ibbec204bd3752d05ab381d4834d847141cc28a4a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 16 Jan 2016 01:12:16 +0000 (02:12 +0100)]
BUG-865: Remove TreeNodeFactory.createTreeNodeRecursively()
Lazy equivalents offer lower memory footprint, remove the recursive
one.
Change-Id: Ic1646d54826c36e30e59bacd9bc67afbe056cdc6
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Robert Varga [Mon, 16 Oct 2017 11:28:31 +0000 (13:28 +0200)]
Eliminate use of DataTreeFactory.create(TreeType)
Use DataTreeConfiguration instead and consolidate tests to eliminate
unneded dependency in implementation.
Change-Id: I6d4c1978b6ac3a11727f7bd5a2a9da537a0bc757
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Oct 2017 11:17:11 +0000 (13:17 +0200)]
Fix raw type warning
We can specify leaf type to be string, fixing eclipse warnings.
Change-Id: I46390c88fab2188197e4b7a4c66e6be5eb484e8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>