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>
Robert Varga [Fri, 13 Oct 2017 10:41:31 +0000 (12:41 +0200)]
Fix ModificationApplyOperation javadoc
Optional has moved, so update javadoc to fix reference to Optional.empty().
Change-Id: I3db8263e4ccd3eb949de79a26811d633ce662387
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Igor Foltin [Fri, 13 Oct 2017 10:02:58 +0000 (12:02 +0200)]
Bug 9241: Action definition should implicitly define input/output
Empty input and output statements are now automatically added to
every action statement that does not declare them explicitly.
Change-Id: I41c037657e83b8e53d314d9b9c6c691ef99e993f
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
Robert Varga [Thu, 12 Oct 2017 09:08:28 +0000 (11:08 +0200)]
Add another parseYangResources() alternative
Add a collection-based alternative to arrays.
Change-Id: I51ebcf5605b165f523cce2909ee3b14bb31729e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 18 Sep 2017 13:01:19 +0000 (15:01 +0200)]
Update IdentitySchemaNode metamodel
Remove the RFC6020 idea that an identity can have only a single
base and switch to RFC7950's idea of allowing multiple base identities.
Change-Id: Iae23357379d199a60b71682ad84119422676bfd1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 18 Jul 2016 16:47:51 +0000 (18:47 +0200)]
BUG-5211: remove SourceStreamAware
This interface is a direct violation of the model.api contract.
It is used only by the YangToSourceProcessor, which can implement
the suggested fix.
Change-Id: I90928a273503ee21e9663c115b7135cf5e1f0608
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 11 Sep 2017 14:51:11 +0000 (16:51 +0200)]
BUG-7568: cleanup BasicCodeGenerator
This is an API-incompatible change to ensure that only the correct method
is implemented.
Change-Id: I59469fddda3b71972639f5c28a3530796de6de28
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 24 Aug 2017 10:56:06 +0000 (12:56 +0200)]
BUG-9043: Remove use of CheckedFuture from YANG components
This patch removes all references to CheckedFuture, future-proofing
our codebase for Guava upgrades.
Change-Id: I2e6f4e97a6f06b01573287e7904c1681ede3d729
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 31 Aug 2017 21:05:06 +0000 (23:05 +0200)]
Enforce statement format validity
Statements with multiple colons and with the colon being the last
character are invalid. Report these as soon as we encounter them.
Change-Id: I9138e513d1bd271fbdb33bb5991e59f4498410ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Peter Kajsa [Thu, 29 Jun 2017 08:34:12 +0000 (10:34 +0200)]
Bug 2444 - Add missing API to Action and Notification definition
Since Yang 1.1, it is allowed to use notification and action
statements also in grouping and augment statements. However,
yang-model-api does not reflect this changes. This patch
adds missing methods to check the origin of notifications and
actions. Required fix of yang-model-export is included as well.
Change-Id: Iba7282e3be4361bba8e6328a57fbbe0cb115a1f5
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Fri, 18 Aug 2017 09:38:16 +0000 (11:38 +0200)]
Cleanup use of Guava library
Turn Preconditions.checkNotNull into Objects.requireNonNull, use it
as static import. Eliminate the use of Optional/Function/Supplier
concepts, which are now native to Java 8.
Change-Id: Ie470283e1b4f706b0601a191626bd1e036d4d723
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 7 Oct 2017 12:16:36 +0000 (14:16 +0200)]
Fix AugmentationIdentifier.compareTo()
The implementation assumed stable Set iteration order, which was
not internally guaranteed, hence two AugmentationIdentifiers could
report as being equal via equals(), but still compare as having
different total ordering -- which could lead to strange results.
Fix this by doing some more work and compare them based on QName's
total ordering. The test suite is fixed up to use explicit iteration
order retained by ImmutableSet rather than relying on HashSet's
hashCode()-based iteration order non-determinism.
Also remove implicit boolean boxing by using assertTrue/assertFalse
in tests.
Change-Id: Iafd4ac8d7d54f0918b0579c6e6f8e76b35b56dd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Jakub Toth [Fri, 22 Sep 2017 13:47:19 +0000 (15:47 +0200)]
Add option to validate yang by module name
Change-Id: If1aa92440cee4510758d78f5c2dc4d619474b7db
Signed-off-by: Jakub Toth <jakub.toth@pantheon.tech>
David Suarez [Wed, 27 Sep 2017 08:40:55 +0000 (10:40 +0200)]
Remove explicit default super-constructor calls
The default constructor is called by default (hence its name), no need
to call it explicitly. Based on this commit [1].
[1] https://git.opendaylight.org/gerrit/#/c/63526/
Change-Id: I0feaf3747fcad25082d74cdb9cc4032180cfba18
Signed-off-by: David Suarez <david.suarez.fuentes@gmail.com>
Robert Varga [Thu, 14 Sep 2017 15:20:19 +0000 (17:20 +0200)]
Add EntrySet/KeySet spliterators
Spliterators do not allow modification of underlying map, hence
we can always instantiate an immutable iterator and flag appropriate
characteristics.
This is an initial cut, which is not perfect: we still should create
dedicated spliterators, which do not instantie entries nor perform
lookahead and have optimized trySplit().
Change-Id: Iad1a8f4b30d5a996484b21c9be589bf80ee7d584
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 20 Aug 2017 09:17:01 +0000 (11:17 +0200)]
Revert "Revert "BUG-7262: Operational data tree should enforce mandatory nodes""
This reverts commit
7e8657de5bbcbcb098eca56df3445d155f20bb50.
Change-Id: Ie976e7b5c64e53c812b0913ef9fb38cb3049a5ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 1 Sep 2017 13:28:30 +0000 (15:28 +0200)]
Cleanup checkstyle warnings and turn enforcement on in yang-data-impl
This patch cleans up bunch of old code to comply with checkstyle rules
and flips the switch so we do not regress.
Change-Id: I2b314d2a672e9b0b7fb225004fd1f3ce770f098a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Wed, 20 Sep 2017 14:33:05 +0000 (16:33 +0200)]
Allow shared JSONNNSWriter use
JSONNormalizedNodeStreamWriter.createNestedWriter() gives the
impression that it can be used with an externally-controlled
JsonWriter, e.g. to build a JSON document containing several
serialised NormalizedNode instances. However, since it closes the
JsonWriter when closed itself, it limits the possible uses: currently,
a writer ends up having the same lifetime as a JsonWriter, even though
it doesn’t really have the same scope (because of the SchemaPath in
particular).
This patch changes the behaviour so that the provided JsonWriter has
an independent lifecycle (and needs to be closed by callers). I will
follow up with patches to the few users in ODL.
Change-Id: I9c597fe96937867cffdcbeeddd4b1507de20f2ee
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Peter Kajsa [Mon, 26 Jun 2017 09:34:49 +0000 (11:34 +0200)]
Bug 2444 - Yin export of all YANG statements
Currently yang-export exports effective world of yang into yin,
what is not correct, because lot of information is not accesible
in effective world anymore.
So the correct solution is to export declared world of yang,
where all information is accessible and in raw form and that is
exactly what we need.
Export of effective world is still retained for cases when
we don't have access to declared form of supplied module or
we want to emit also instantiated statements (e.g. statements added
by uses or augment)
Change-Id: Ic2bc559623d9e72c59e2ed7f6a797cd67933ada6
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Peter Kajsa [Mon, 26 Jun 2017 09:09:27 +0000 (11:09 +0200)]
Bug 2444 - add missing API of some declared statements
Fix of missing API of some declared statements according to
RFC7950. This API is necessary to proper export of declared statements
to Yin.
Change-Id: Icc0209656751b00c5cc7401f7b95d8979af0fa0d
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Jie Han [Fri, 22 Sep 2017 01:17:18 +0000 (09:17 +0800)]
Fix deleteWriteFooBar2ndLevelEmptyContainerTest
- this unit is to test delete-write while the next one is delete-merge,
here its body is duplicated with deleteMergeFooBar2ndLevelEmptyContainerTest
Change-Id: I7bafd002859e23de2d89748fc71c876cb4ab674c
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Jakub Toth [Wed, 20 Sep 2017 11:58:33 +0000 (13:58 +0200)]
Add option to setup output file for logs in validator
* added option -o (--output) to setup path of output file
for logs
Change-Id: I42ba358932c4cf20fa11400490c1d11e2a0f6046
Signed-off-by: Jakub Toth <jakub.toth@pantheon.tech>
Jakub Toth [Tue, 19 Sep 2017 13:26:22 +0000 (15:26 +0200)]
Rename yang-system-test module to yang-model-validator
* yang-model-validator better describes purpose of the module
Change-Id: I7353c23afcfa7f53b37e428564f783565b41f4c6
Signed-off-by: Jakub Toth <jakub.toth@pantheon.tech>
Michael Vorburger [Thu, 28 Sep 2017 20:21:48 +0000 (22:21 +0200)]
Minor JavaDoc fixes in CountingRejectedExecutionHandler
Change-Id: I4bfab54a6c80e751a46fff840f763d1e7fe6aeb0
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Robert Varga [Wed, 19 Jul 2017 11:18:58 +0000 (13:18 +0200)]
BUG-2389: Remove obsolete XML parser classes
yang-data-codec-xml supersedes this parser classes, which have been
deprecated. This patch removes them.
Change-Id: I73778eb0505e402224f0adb46e0fd6477d667522
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Wed, 27 Sep 2017 13:35:45 +0000 (15:35 +0200)]
Bump odlparent 2.0.4 to 2.0.5
Change-Id: I11d5ca5ff224338a5543f13edbe398e545bc8038
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Sat, 16 Sep 2017 08:28:49 +0000 (10:28 +0200)]
Do not use String.replace()
This forces a Pattern compilation, which we do not really want.
Pre-compile the patterns instead.
Change-Id: Ibcb9f911f4a4089f375264b75ce2f5d9c5f46447
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 17 Sep 2017 08:50:42 +0000 (10:50 +0200)]
Further yang-parser-impl checkstyle fixes
Brings the violation count to below 500.
Change-Id: I22ee943c06bf04f3692a511f703573a0a57ec0ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 6 Sep 2017 08:37:59 +0000 (10:37 +0200)]
Remove Named{File,Byte,}InputStream
These utility classes are no longer useful, remove them.
Change-Id: If9e96e978cff5c6a69ac8bfb1c63717c1762d3de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 1 Sep 2017 09:46:18 +0000 (11:46 +0200)]
Remove deprecated Yin/YangStatementSourceImpl
These classes have been superseded by Yin/YangStatementStreamSource,
which have better semantics. Remove them and fixup former call sites.
Change-Id: I9f16e62da8cf38ce35703de6a93b1d5d9dcdf2e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 20 Sep 2017 15:14:24 +0000 (17:14 +0200)]
Rename MainNode methods
CAS_PREV -> casPrev
READ_PREV -> readPrev
WRITE_PREV -> writePrev
Change-Id: Ia918db3c68931d585a5f2922b0923e939814d015
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 20 Sep 2017 15:10:03 +0000 (17:10 +0200)]
Rename recursive INode methods
Change names to conform to Java standards:
- rec_insert -> recInsert
- rec_insertif -> recInsertIf
- rec_lookup -> recLookup
- rec_remove -> recRemove
Change-Id: Ic11da9ac2ae96d8029d0bb08464033bfe027ee0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 20 Sep 2017 15:03:30 +0000 (17:03 +0200)]
Remove BasicNode.string()
This method is not used anywhere, remove it and take all commented-out
support code with it.
Change-Id: I24720c16f562fd391894484566903f1a526ad202
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>