Robert Varga [Thu, 2 Jul 2020 18:09:34 +0000 (20:09 +0200)]
Consolidate InstanceIdentifierTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of an
instance-identifier type, migrate it.
JIRA: YANGTOOLS-1065
Change-Id: I07db26a6e96a937c9335afe081d92441b29d3553
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 18:06:11 +0000 (20:06 +0200)]
Consolidate EnumTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of an enum
type, migrate it.
JIRA: YANGTOOLS-1065
Change-Id: I756ee91f4ce9c9e846ee65afbc4629dd23668002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 18:02:43 +0000 (20:02 +0200)]
Consolidate DecimalTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of an decimal
type, migrate it.
JIRA: YANGTOOLS-1065
Change-Id: I352675843882b2fce414b10b58a38315c759278d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 17:59:18 +0000 (19:59 +0200)]
Consolidate BitsTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of an bits
type, migrate it.
JIRA: YANGTOOLS-1065
Change-Id: I80bb47dd6b5aa77aad619c271cea70fdab2547d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 17:52:49 +0000 (19:52 +0200)]
Consolidate UnionTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of an union
type, migrate it.
This was the last user of AbstractTypeStatementSupport, so remove
that, too.
JIRA: YANGTOOLS-1065
Change-Id: Ic69a9b4126062c06fe137c0b3144d431fd8124e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 17:49:30 +0000 (19:49 +0200)]
Consolidate IdentityrefTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of an identityref
type, migrate it.
JIRA: YANGTOOLS-1065
Change-Id: Ibc13fff074cf7c4f597686f75ba55f65f6870ba1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 17:46:43 +0000 (19:46 +0200)]
Consolidate EmptyTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of an empty
type, migrate it.
JIRA: YANGTOOLS-1065
Change-Id: I9b77ce4b609f1624a18de97e3f3c6272ea22003b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 17:43:56 +0000 (19:43 +0200)]
Consolidate BooleanTypeEffectiveStatementImpl
TypeEffectiveStatementImpl can easily support the case of a boolean
type, migrate it.
JIRA: YANGTOOLS-1065
Change-Id: I24bc5fa4909710805d9503db69ed49f65878e1af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 17:38:04 +0000 (19:38 +0200)]
Consolidate BinaryTypeEffectiveStatementImpl
Derived TypeEffectiveStatements follow an obvious pattern, where
we do not need to have specialized subclasses for each of them.
Introduce TypeEffectiveStatementImpl and migrate 'type binary' to
use it.
JIRA: YANGTOOLS-1065
Change-Id: I16c259718c3502d85ad0e77c5f612eb9d601d979
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 16:11:15 +0000 (18:11 +0200)]
Migrate AbstractTypeStatementSupport
Support for 'type' statement is rather twisted, but at the end of
the day, externalizing substatement creation is rather easy.
Switching to BaseStatementSupport allows us to discern when we can
end up pointing to a BuiltinTypeStatement -- since there is not such
thing as an implicit type statement.
On the declared front, this is a straightforward migration to
AbstractDeclaredStatement.WithRawStringArgument subclasses, which
ends up reducing typical footprint from 32 bytes to 16/24 bytes.
On the effective front, this does not really do anything, as these
are handled on per-type basis.
JIRA: YANGTOOLS-1065
Change-Id: I421f72a765fd6a28f984d463d8b9991dd7c1d231
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 16:22:18 +0000 (18:22 +0200)]
Split out AbstractTypeStatementSupport.resolveTypeReference()
The implementation of createEffective() method is quite huge,
split out the switch lookup part out of it, saving a few lines.
JIRA: YANGTOOLS-1065
Change-Id: I97c36b2263a3ee2c4f394f77e3d5651846aa91f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 15:47:29 +0000 (17:47 +0200)]
Reuse common superclass for BuiltinTypeStatement
BuiltinTypeStatement duplicates pretty much all of its implementation
from AbstractDeclaredStatement.WithRawStringArgument. Eliminate
duplication, so we have less code to maintain.
JIRA: YANGTOOLS-1065
Change-Id: Ib27fe7f19001c5ffd563dad41843e74a3539765d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 15:37:13 +0000 (17:37 +0200)]
Minimize AbstractTypeStatementSupport.internArgument()
Use an expression instead of assignement/check to reduce bytecode
footprint.
JIRA: YANGTOOLS-652
Change-Id: I2f900e0175904828e8efc273e9aca391221d19ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 15:21:06 +0000 (17:21 +0200)]
Optimize deviate statement implementations
deviate is a simple statement, optimize the memory layout of its
implementation classes.
JIRA: YANGTOOLS-1065
Change-Id: Ibffb49bca02952f685250d9b5a6a2cdf56966a7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 14:47:40 +0000 (16:47 +0200)]
Optimize refine statement implementations
refine is a simple statement, optimize the memory layout of its
implementation classes. Most of the benefits here are coming from
not needing to retain source/definition, but for simple refines
we can also skip a singleton list.
Also mark future direction for evolving the implementation contract,
as it has some aspects which are definitely not nice.
JIRA: YANGTOOLS-1065
Change-Id: Ic07ba74b0d2ea685a3ce8aed567a89125d04850e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 14:30:33 +0000 (16:30 +0200)]
Optimize unique statement implementations
unique is a simple statement, optimize the memory layout of its
implementation classes.
JIRA: YANGTOOLS-1065
Change-Id: Idccce468b38726ac25851b11352528c489e92b5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 14:35:55 +0000 (16:35 +0200)]
Deprecate UndeclaredEffectiveStatementBase for removal
We have a more powerful way of implementing implict statements
with AbstractUndeclaredEffectiveStatement, which does not require
storage of substatements.
Deprecate UndeclaredEffectiveStatementBase for removal and schedule
a FIXME for 6.0.0.
JIRA: YANGTOOLS-1065
Change-Id: Id0112c7bf9d0f99b37f825aa489924f966591b54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 14:12:11 +0000 (16:12 +0200)]
Optimize if-feature statement implementations
if-feature is a simple statement, optimize the memory layout of its
implementation classes.
JIRA: YANGTOOLS-1065
Change-Id: I9e2a1dbf1f32b4fdfefd965ff88fd63425bcb5d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 13:42:41 +0000 (15:42 +0200)]
Optimize path statement implementations
This migrates 'path' statement support to use denser objects, as
the argument is not affected by any copying around.
JIRA: YANGTOOLS-1065
Change-Id: Idb1281cf54e449db28c63645252a721191ed8de1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 15:13:34 +0000 (17:13 +0200)]
Eliminate DeviateEffectiveStatementImpl.deviateType
We are just duplicating the argument field here, let's get rid
of this.
JIRA: YANGTOOLS-1065
Change-Id: Id8a5855e352cb032b88e9af0ffb30cb64e3653ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 12:19:35 +0000 (14:19 +0200)]
Further optimize RevisionDateStatement implementations
Revision.toString() results in the raw argument string, hence we
can use that to our advantage and save a one field, dropping the
instance size to 16 bytes in typical scenarios.
JIRA: YANGTOOLS-1065
Change-Id: Id0f6c4a64be9ae70ecbe0917c19c9ac2b7aecd57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 12:03:13 +0000 (14:03 +0200)]
Add BaseQNameStatementSupport.historyAndStatusFlags()
A number of subclasses are open-coding the same computation, let's
centralize it a bit.
Change-Id: I1ebbe63a16dcc876324960c2a11baca604476ba5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 2 Jul 2020 11:37:42 +0000 (13:37 +0200)]
Convert UsesStatementSupport to BaseQNameStatementSupport
Uses statement is a bit more complicated in its effective form,
hence we end up with four different implementations when we optimize
for size.
JIRA: YANGTOOLS-1065
Change-Id: I7f01ecd8277a042821cb5b37c0d9406a1e9204be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 18:25:10 +0000 (20:25 +0200)]
Convert bit statement
Convert the mostly trivial case of bit statement, which can be easily
minimized.
Change-Id: I4b1041c3205034d28844be0e8faab5545006ea23
JIRA: YANGTOOLS-1065
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 17:17:04 +0000 (19:17 +0200)]
Mark AbstractEffectiveDocumentedNode(WithStatus) evolution
We want to eventually completely remove these classes, as they are
making SchemaNode assumptions. We already have a less stateful
replacement, which can be used when needed.
Change-Id: I4633ea8b2d1027eed34824fda524704bfdfc8828
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 16:52:56 +0000 (18:52 +0200)]
Refactor PatternConstraintImpl
We have two distinct cases for the definition here, where the smaller
does not have metadata, where as the full does have. This saves four
fields in under-documented cases.
Also mark Pattern(Effective)Statement for further refactor so we do
not have to play weird tricks with constraints.
JIRA: YANGTOOLS-1065
Change-Id: I6748ca7fefdb4b2a088324ff9bba821c131fe7ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 14:54:36 +0000 (16:54 +0200)]
Convert pattern statement
Convert the mostly trivial case of pattern statement, which can be easily
minimized.
We also terminally-deprecate AbstractConstraintEffectiveStatement,
as it is no longer needed.
JIRA: YANGTOOLS-1065
Change-Id: Ib207d3389959822635578733ef09607fe3f2373a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 14:44:12 +0000 (16:44 +0200)]
Remove MaxElementsEffectiveStatementImpl
This is a follow-up patch removing an unused class.
JIRA: YANGTOOLS-1065
Change-Id: I9d8761139db206d917067971a2e840f2df7319ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 14:38:15 +0000 (16:38 +0200)]
Convert range statement
Convert the mostly trivial case of range statement, which can be easily
minimized.
We also terminally-deprecate AbstractListConstraintEffectiveStatement,
as it is no longer needed.
JIRA: YANGTOOLS-1065
Change-Id: I38c0583aaf46670639c4b8a5b9464113c0032bb4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Jun 2020 20:54:47 +0000 (22:54 +0200)]
Convert length statement
Convert the mostly trivial case of length statement, which can be easily
minimized.
JIRA: YANGTOOLS-1065
Change-Id: I4cdb6d80b2b9c71e493e9f145c87e2be9e25ef20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Jun 2020 11:19:35 +0000 (13:19 +0200)]
Migrate Must/WhenStatementSupport to BaseStatementSupport
This allows us to reduce the footprint of individual declared
and effective instances.
JIRA: YANGTOOLS-1065
Change-Id: I6a5dcba7fdbb2a6cdeba54c99627a41423683e05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Jun 2020 20:32:30 +0000 (22:32 +0200)]
Convert AbstractEnumStatementSupport
Convert the mostly trivial case of enum statement, which can be easily
minimized. Also addresses a FIXME for hiding the implementation class.
JIRA: YANGTOOLS-1065
Change-Id: I04d5d87b8ef59f89b41cd46e78761025ac967d78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Jun 2020 21:30:55 +0000 (23:30 +0200)]
Convert BaseStatementSupport
Convert the trivial case of base statement, which can be
easily minimized.
JIRA: YANGTOOLS-1065
Change-Id: If575ee91c1266b500655a96321e938c2abb849cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 08:14:55 +0000 (10:14 +0200)]
Convert ArgumentStatementSupport
Convert the trivial case of argument statement, which can be
easily minimized.
Change-Id: I9f28c3a71d4330fed8518d0866a4a9008df132db
JIRA: YANGTOOLS-1065
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 07:30:56 +0000 (09:30 +0200)]
Convert MaxElementsStatementSupport
Convert the trivial case of max-elements statement, which can be
easily minimized.
JIRA: YANGTOOLS-1065
Change-Id: I47d91af7515e4ecd90776d7df2ae624cf265270f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Jun 2020 21:19:45 +0000 (23:19 +0200)]
Convert AbstractIncludeStatementSupport
Convert the trivial case of include statement, which can be
easily minimized.
JIRA: YANGTOOLS-1065
Change-Id: If837cc29db300f084e19014ed0b09a5e5460aea9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Jun 2020 16:31:49 +0000 (18:31 +0200)]
Convert RevisionDateStatementSupport
Convert the trivial case of revision-date statement, which can be
easily minimized.
JIRA: YANGTOOLS-1065
Change-Id: Ie21335714dc5ebc64f76d18e9c5b077e85dc6c69
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 30 Jun 2020 14:43:25 +0000 (16:43 +0200)]
Convert ModifierStatementSupport
Convert the trivial case of modifier statement, which can be easily
minimized.
JIRA: YANGTOOLS-1065
Change-Id: If2566654249f49ad63956cc062ae173c0cbbd5c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 Jul 2020 08:07:40 +0000 (10:07 +0200)]
Remove unneeded @NonNull annotations
These are inherited from interface specification, no need to
repeat them.
Change-Id: I5d651e67372606d34f48b6ff0bb844ab15cca239
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 29 Jun 2020 21:24:15 +0000 (23:24 +0200)]
Disconnect StmtNamespaceContext from statement
Retaining a reference to any StmtContext is not good, as we end
up retaining the entire build context from each parsed XPath. Make
sure we maintain a simple disconnected YangNamespaceContext
implementation at each root.
JIRA: YANGTOOLS-1116
Change-Id: Ic327647b758c83b94bde05a740c51384f70c4d03
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 29 Jun 2020 19:51:04 +0000 (21:51 +0200)]
Do not retain namespace context when not needed
If we have not recorded presence of a literal expression, there
is no legal way we can be asked to resolve a literal to either
a QName or a YangInstanceIdentifier.
Track creation of YangLiteralExprs, so that we can ditch the
namespace context we will not need it.
JIRA: YANGTOOLS-1115
Change-Id: If1572fc57d78eaaea7feb3025a5a161519df2b9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 29 Jun 2020 10:18:15 +0000 (12:18 +0200)]
Eliminate use of ImmutableList
We can use a simple array, as we are only iterating over this
list.
Change-Id: I34a01bff7cb8da4f936f119fa80a699244c8f519
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 26 Jun 2020 19:57:44 +0000 (21:57 +0200)]
Fix javadoc to comply with JDK14
JDK14 has a stricter default doclet. Fix issues reported by it so
that the code can be compiled with JDK14.
Change-Id: Ieffe3450feeb0d4d9525f3434a17fd8e0dd8c0e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 25 Jun 2020 14:26:39 +0000 (16:26 +0200)]
Add YangInstanceIdentifier.create(PathArgument)
This is a short-circuit version of the varargs create(), which is
slighly faster.
Change-Id: Id6b6ae327cd8e5d63108c766532dd8ab91188637
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 24 Jun 2020 12:04:31 +0000 (14:04 +0200)]
Clean up AntlrXPathParser a bit
This cleans up instantiation so we can better communicate parser
state to the resulting expression.
JIRA: YANGTOOLS-1115
Change-Id: I111926b76f88ca2c4023cdd41b77d56768c38497
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 24 Jun 2020 10:05:52 +0000 (12:05 +0200)]
Use ImmutableMap collector in EnumStringCodec
Reduce the use of intermediate structures by using a direct
collector rather than collecting to a list and then performing
Maps.uniqueIndex().
Change-Id: I0d200211daa240076394af1d3e33ec4df26c146e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 22 Jun 2020 19:14:21 +0000 (21:14 +0200)]
Fix reference to odl-antlr4
This is a slight mistake, we should be referencing the feature
through a range.
Change-Id: I90cea9337596b4c714b7d38e61cea8f77b89e2d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 12 Jun 2020 08:07:59 +0000 (10:07 +0200)]
Deprecate YangStatementStreamSource.getYangText()
We do not need to leak this internal implementation detail,
remove is visibility.
Change-Id: I13be830b8dedff8478c9859cda2c6b1f44eabf31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 12 Jun 2020 06:36:49 +0000 (08:36 +0200)]
Speed up YangParser.addLibSource()
Since we are adding a single source only, we can go through
the single-argument method, making things a tad more efficient.
JIRA: YANGTOOLS-652
Change-Id: I676d8d2cbfdd854c9486a02e3c746cb13849d09c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 12 Jun 2020 06:32:05 +0000 (08:32 +0200)]
Add CrossSourceStatementReactor javadocs
Clarify interface contracts based on current behavior. Also add
a single-argument addLibSource().
JIRA: YANGTOOLS-652
Change-Id: I02829a2cb40ff03f38cc5136a16d76a4f4b27dd0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 12 Jun 2020 06:32:34 +0000 (08:32 +0200)]
Speed up YangParser.addSource()
Since we are adding a single source only, we can go through
the single-argument method, making things a tad more efficient.
JIRA: YANGTOOLS-652
Change-Id: I00519eb6fedaa9ab27b3b3f13bcc0b10b542f134
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Jun 2020 22:33:39 +0000 (00:33 +0200)]
Bump versions to 5.0.4-SNAPSHOT
This starts the next development iteration.
Change-Id: I95f22bc9119ddd26f6915b422cab6454b9febbe5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Jamo Luhrsen [Sun, 31 May 2020 05:29:52 +0000 (22:29 -0700)]
Allow list elements to be interleaved
If a list node A is parsed then list node B and another list with A
is given after, it fails to parse as a duplicate.
Skip checking for duplicate nodes if the node being parsed is found
to correspond to ListEffectiveStatement.
JIRA: YANGTOOLS-1107
Change-Id: I4dae263a1e41444db7a6cce6eb958f397c801070
Signed-off-by: Jamo Luhrsen <jluhrsen@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Jun 2020 12:35:07 +0000 (14:35 +0200)]
Deprecate ListEntryNodeDataWithSchema.forSchema()
This method should not be visible from outside of the package,
make sure we remove it.
Change-Id: I91ecb1439081862dc5d0241ff080b0db13bcaca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Jun 2020 11:50:15 +0000 (13:50 +0200)]
Split out addCompositeChild(CaseSchemaNode)
Choices seem to have this special case, which we should be able to
wire without an explicit cast in most cases.
Change-Id: I5a398957190ccec49b2a9072638f489bbdabd984
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Jun 2020 11:34:04 +0000 (13:34 +0200)]
Clean up variable initialization
We can make local variable final and non-null, improving logic
flow in this method.
Change-Id: I2695acd5cccdef0da61b1f3e246fd9dbcb2e08a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 5 Jun 2020 15:41:08 +0000 (17:41 +0200)]
Add YangInstanceIdentifier.coerceParent()
There are a number of YangInstanceIdentifier users who perform
checks (or otherwise ensure) that YangInstanceIdentifier they are
dealing with is non-empty and hence its getParent() method cannot
possibly return null. These users still interact with methods
which explicitly require a non-null YangInstanceIdentifier -- hence
it would be useful to provide a bridge method which performs this
validation.
Change-Id: I7acb4b04ccbe3c536b690573519171af32089d41
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 5 Jun 2020 13:54:51 +0000 (15:54 +0200)]
Add MultipleEntryDataWithSchema interface
We are sharing essentially the same code in both JSON and XML
parsers, where we really to make this common code exposed from
appropriate NodeDataWithSchema.
Centralizing the interface contract and implementations allows us
to ditch external users of CompositeNodeDataWithSchema.addChild(),
which is now deprecated.
Change-Id: I5aca3d3eecba3f9e6ffee4b9ee15e70afa47aed6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 5 Jun 2020 08:43:51 +0000 (10:43 +0200)]
Bump odlparent to 7.0.3
Pick up fixes from upstream.
Change-Id: I1865f70f06454920c2dd9d3d04146ab5ca52e5dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Anna Bencurova [Wed, 3 Jun 2020 16:28:36 +0000 (18:28 +0200)]
Add test for union with identity XML codec issue
JIRA: YANGTOOLS-1108
Change-Id: Ib33d1865c138474eae8b6fbf04c50688d8a4809a
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Robert Varga [Thu, 4 Jun 2020 12:11:05 +0000 (14:11 +0200)]
Check unions for instance-identifier types
If an instance-identifier type is encountered within a union, we
end up going to TypeDefinitionAwareCodec, which is not equiped to
handle the complexities of XML-encoding instance identifiers. Make
sure we do perform a check to side-step this problem.
Change-Id: Ib5bc79a26808f4101ce182e092418a29e5b7bdc8
JIRA: YANGTOOLS-1108
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Jun 2020 11:06:06 +0000 (13:06 +0200)]
Check unions for identityref types
If an identityref type is encountered within a union, we end up
going to TypeDefinitionAwareCodec, which is not equiped to handle
the complexities of XML-encoding identityrefs. Make sure we do
perform a check to side-step this problem.
JIRA: YANGTOOLS-1108
Change-Id: I8dcf70385aceabc5f3e33a508ddd00f926047774
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Jun 2020 11:22:27 +0000 (13:22 +0200)]
Issue a warning when we encounter a non-QName identityref
identityref types are required to be normalized as a QName, but we
have a legacy fallback to using .toString(). Issue an explicit
warning when this happens.
JIRA: YANGTOOLS-1110
Change-Id: Ia9cfc824e03d7641c7081f479f7a4d6c7c98062c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Jun 2020 10:54:41 +0000 (12:54 +0200)]
Separate out correct QName-bearing serialization method
We want to start deprecating .toString()-based codec, hence we want
to separate the happy path out.
JIRA: YANGTOOLS-1108
Change-Id: Ic5fa79c0649a73583eac4c043bd4c8b4b6b60bc0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Jun 2020 10:45:24 +0000 (12:45 +0200)]
Improve error message in UnionXmlCodec
We are missing a space before value, which would not be properly
delineated.
JIRA: YANGTOOLS-1108
Change-Id: If6da40cd2653ef702e53730fa58923a7b310c3ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 4 Jun 2020 10:14:59 +0000 (12:14 +0200)]
Propagate type to XMLStreamWriterUtils
We have a useless checkArgument here, which is impossible to hit
if we structure this just right.
JIRA: YANGTOOLS-1108
Change-Id: I589da629526026fa09c0dda9c11f0bd5516941a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 30 May 2020 11:08:01 +0000 (13:08 +0200)]
Bump versions to 5.0.3-SNAPSHOT
This starts the next development iteration.
Change-Id: Icd6dab87e1f3b0ccb143d06e6df6da622525d1ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 30 May 2020 01:27:06 +0000 (03:27 +0200)]
Bump odlparent to 7.0.2
Pick up latest upgrades to dependencies.
Change-Id: Ic3d0ec5426870aab1115fb339d0d5251aba81e45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 30 May 2020 00:15:08 +0000 (02:15 +0200)]
Link to odlparent docs
We do not use odlparent, but link to it in case this ever changes.
Change-Id: Ic912a1e42429117aa93b95001d846d8346b4be16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 27 May 2020 12:35:48 +0000 (14:35 +0200)]
Move NormalizedNodeStreamVersion deprecation
There are a number of downstreams which need to handle deprecated
stream versions. Move deprecation to produces, so that we do not
warn when the enum value is used.
Change-Id: Iea46d3ab8f76502cb324d788711ddcaed0dcf555
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 27 May 2020 10:12:40 +0000 (12:12 +0200)]
Teach SchemaAwareApplyOperation about anydata/anyxml
When we encounter an anydata/anyxml element in schema, we should
not be ignoring it, cascading to a silent failure, but rather
treat it as a leaf-like node.
JIRA: YANGTOOLS-1104
Change-Id: I896a3b6e65fe8e5b897e71103d616b3e03f3c1b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 May 2020 11:37:29 +0000 (13:37 +0200)]
Simplify AbstractNodeContainerModificationStrategy
Since we have NormalizedNodeContainer and we know this type, we
can eliminate a few casts, checks and warning suppressions by
retaining proper type safety.
Change-Id: I6e2d0f9fbb20cfe9fdb996544b8328a18576ca3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 May 2020 07:09:21 +0000 (09:09 +0200)]
Return EffectiveModelContext from StmtTestUtils
We are moving away from SchemaContext, make sure our test utilities
are up to it.
Change-Id: Iac60ae1c9fb3b8c8a9e62db6342bd0d099e71ca1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 26 May 2020 10:11:22 +0000 (12:11 +0200)]
Fix an error message typo
We are missing a space here, making it hard to decode what
the source is. Fix that.
Change-Id: Ic9e18f88e3b59e19cd2cd5a529c29276ed9cab06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 7 May 2020 16:26:46 +0000 (18:26 +0200)]
Update docs badges
Update the pointer to docs, as these have changed quite some time
ago.
Change-Id: I59cf4c03b1c7c26bed95d94cb90ba93c66b30e17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
tadei.bilan [Mon, 16 Mar 2020 09:51:36 +0000 (11:51 +0200)]
Add DataTreeCandidates.aggregate() method
MD-SAL datastore access patterns allow for state compression to
occur, as changes are reported in terms of an ordered collection
of DataTreeCandidate objects.
These typically carry all state transitions, which an application
may (or may not) be interested in. In case an application does not
care about seeing all transitions, it may be beneficial to compress
these state transitions, so that they appear to have been caused
by a single transaction.
In order to achieve that, this patch introduces a new utility
method, DataTreeCandidates.aggregate(), which aggregates such a
collecting into a single DataTreeCandidate -- hence allowing
infrastructure components to perform state compression behind
application's back.
JIRA: YANGTOOLS-1014
Change-Id: I31094e303dbbb8430cb427ae6c59ee7956e0117c
Signed-off-by: tadei.bilan <tadei.bilan@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Vladyslav Marchenko <vladyslav.marchenko@pantheon.tech>
Robert Varga [Mon, 27 Apr 2020 11:27:59 +0000 (13:27 +0200)]
Fix benchmarks
The benchmark was mis-generated ever since the compiler was
refactored. Fix it up.
Change-Id: Ia3c184b998b8d509aaf502e97d168c5d8d97b7a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 26 Apr 2020 12:51:39 +0000 (14:51 +0200)]
Deprecate EffectiveModelContextProvider.getSchemaContext()
Steer users towards using EffectiveModelContext -- if they already
have an EffectiveModelContextProvider, they should not be using
getSchemaContext().
Change-Id: Ibcbfa9926a66a3890c1ae3b163c5a16841c2a716
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 23 Apr 2020 20:38:42 +0000 (22:38 +0200)]
Bump versions tp 5.0.2-SNAPSHOT
This starts the next development iteration.
Change-Id: I9b49ffba5404f4c7464839c9ee4f530866739267
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 23 Apr 2020 14:08:29 +0000 (16:08 +0200)]
MountPointContext needs to expose EffectiveModelContext
This is an unfortunate API breakage, but it affects only @Beta
components. In order to be able to provide end-to-end services,
MountPointContext needs to operate on EffectiveModelContext.
JIRA: YANGTOOLS-1102
Change-Id: I64d3c2e1b28c84f5964c2b2da10cc3ef5f73b266
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 22 Apr 2020 14:29:20 +0000 (16:29 +0200)]
Optimize LazyContainerNode.getChild()
This just trims bytecode a bit by using an expression.
Change-Id: I20f8b6e10f42ff20f188f20991fbe0a8f0159396
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 22 Apr 2020 11:32:23 +0000 (13:32 +0200)]
Add NormalizedNodeContainer.size()
While the size of children is available through getValue(), it
is not completely efficient, as it may be forcing instantiation of
a Map.values() view.
Add NormalizedNodeContainer.size() to provide a more efficient way
of accessing this property. This has immediate benefits on both
MinMaxElementsValidation as well as general InMemoryDataTree
transaction performance.
JIRA: YANGTOOLS-1101
Change-Id: I607c2872645850400e4f242152059958729666b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 18 Apr 2020 12:11:52 +0000 (14:11 +0200)]
Bump versions to 5.0.1-SNAPSHOT
This starts the next development iteration.
Change-Id: Ia30a69ec2b7dcfa598b3230c11bdba7bf74e56ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 18 Apr 2020 09:21:48 +0000 (11:21 +0200)]
Clean up AbstractEffectiveDocumentedNode naming
We have two abstract classes here, make sure naming is matching
the naming of DocumentedNode.WithStatus.
Change-Id: I8604cc51e981477be7e90e3979113b64fb661a45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 18 Apr 2020 09:18:35 +0000 (11:18 +0200)]
Hide LengthEffectiveStatementImpl
We do not want to leak an implementation class across statements,
hence we are hiding it. In order to keep things working, update
LengthEffectiveStatement to extend ConstraintMetaDefinition.
Change-Id: I6e61eb06269a7991a5c7c0ac0089d159313d80c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 18 Apr 2020 09:14:21 +0000 (11:14 +0200)]
Hide RangeEffectiveStatementImpl
We do not want to leak an implementation class across statements,
hence we are hiding it. In order to keep things working, update
RangeEffectiveStatement to extend ConstraintMetaDefinition.
Change-Id: I056f93f4d3cef95f431d9f21423c8f8fa46f8a47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 18 Apr 2020 09:03:32 +0000 (11:03 +0200)]
Push out FIXMEs to 6.0.0
We are ramping down for 5.0.0 release, hence we need to push out
remaining FIXMEs out.
Change-Id: Idf66e7907e9dae66b2e6dc9348d5f0b7dfeadf2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 18 Apr 2020 08:24:08 +0000 (10:24 +0200)]
Deprecate NormalizedNodeStreamVersion.{LITHIUM,NEON_SR2}
These version are ancient and do not support Uint types. Deprecate
them to steer users away from them.
Change-Id: Ib3d36cc87e1dd6b0043dc7e447f6ce122c678564
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
miroslav.kovac [Fri, 13 Mar 2020 13:49:23 +0000 (14:49 +0100)]
Fix relative xPath resolution for leafref types
If we have a leaf of type leafref with relative path that crosses
through case and choice schema nodes.
This stems from the historic disconnect about how the path should
be handled: it needs to be resolved in the context of walking the
data tree, not schema tree. That means that choice/case nodes are
not part of the path in the expression and therefore need to be
skipped over.
JIRA: YANGTOOLS-1100
Change-Id: I9908c91b0068f52f4b6719545c738d7c39e2a228
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 17 Apr 2020 10:46:00 +0000 (12:46 +0200)]
Fix boolean parsing leniency
RFC7950 explicitly requires that booleans be encoded as lower-case
"true" or "false", not anything else. Our attempt at leniency misfires
as we are doing the wrong thing if a boolean is coupled with a string
in a union.
JIRA: YANGTOOLS-1097
Change-Id: I6da2f22db7bfb57eec7b519663f2a84fee735cd0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 17 Apr 2020 10:55:18 +0000 (12:55 +0200)]
Improve TypeDefinitionAwareCodecTestHelper.getCodec()
We can be using the passed class and assertThat() to improve type
checks and remove a @SuppressWarnings.
Change-Id: I5e90c98c0914152faa720293666462691e794611
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 17 Apr 2020 10:23:14 +0000 (12:23 +0200)]
Move yand.data.impl.codec tests
These tests are in the wrong package, fix that.
Change-Id: I8482e3608badce85586ce750d98aa635e3f3dc0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 31 Mar 2020 13:50:42 +0000 (15:50 +0200)]
Make BitsTypeDefinition.Bit.position() return Uint32
We seem to be brdiging back and forth between long and Uint32,
as PositionEffectiveStatement is defined in terms of Uint32. Bite
the bullet and convert Bit, too, removing a number of impossible
cases.
JIRA: YANGTOOLS-1072
Change-Id: I16a38b2780ca25b76eb8cc93c66546f9edb9d8b4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 2 Feb 2020 15:04:52 +0000 (16:04 +0100)]
Deprecate StmtContextUtils.producesDeclared() for removal
We will be removing this method in 5.0.0, mark it for removal.
Change-Id: Ibfb56c4e70ee48f7f8007fcd23ae3eca7686fe3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 2 Feb 2020 11:46:05 +0000 (12:46 +0100)]
Upstream StmtContextUtils.producesDeclared()
With Java 8 we can make this method readily available as a default,
without having to have it in a separate utils method.
Since we are at it, also introduce producesEffective(), which allows
us to infer details about the effective instance.
Also migrate open-coded equivalents to use the common method where
possible.
Change-Id: Ie2590c460296efea9fafe6a52bb3548bafe0ae0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 31 Oct 2019 09:33:56 +0000 (10:33 +0100)]
Improve error reporting from data codecs
In order to improve error messages reported, we take advantage
of the previously-defined YangError interface and attach it to
IllegalYangValueException, which the values codecs report when
they encounter an invalid value.
JIRA: YANGTOOLS-763
Change-Id: I4952b9c186cb9438b72bd9a54ee81a2e8b43f5c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Tadei Bilan <tadei.bilan@pantheon.tech>
Robert Varga [Thu, 9 Apr 2020 16:41:16 +0000 (18:41 +0200)]
Do not issue duplicate warnings for lists missing keys
We currently are issuing the config list warning for each instantiated
site, which ends up flooding our logs, as BGPCEP takes advantage of our
lenience -- leading to 3400+ warnings.
Make sure we flag each original list only once, suppressing other
instances of the violation. This presumably will provide enough guidance
while keeping the noise to a sane amount (~200 warnings).
JIRA: YANGTOOLS-1090
Change-Id: I2488ad7144c1827f7689d496669e4c97b62b0570
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 9 Apr 2020 13:59:55 +0000 (15:59 +0200)]
Make DeclarationInTextSource implement hashCode/equals
In order to de-duplicate warnings, we will want to use
StatementSourceReference as a Set member, for which we need all
implementations to behave correctly w.r.t comparison.
JIRA: YANGTOOLS-1090
Change-Id: I18971e7681c02f56300a64cb08fda4bf4eef613a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 9 Nov 2019 04:28:32 +0000 (05:28 +0100)]
Add YangError interface
This adds the interface for communicating details about a failure
triggered by a YANG-defined constraint.
JIRA: YANGTOOLS-176
Change-Id: I9139c086668742005490bd52d55fdb26e7ef70b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Tadei Bilan <tadei.bilan@pantheon.tech>
vladyslav.marchenko [Fri, 6 Mar 2020 13:29:22 +0000 (15:29 +0200)]
Refactor string unescaping
Add explicit tests and rework unescaping of double-quoted strings
so that we do not use arcane patterns.
JIRA: YANGTOOLS-1079
Change-Id: I3b8bd13f260f13796492d19aea35c4c3f27760fc
Signed-off-by: vladyslav.marchenko <Vladyslav.Marchenko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>