yangtools.git
3 years agoAdd RFC6643 parser support 82/92482/3
Robert Varga [Fri, 18 Sep 2020 15:54:47 +0000 (17:54 +0200)]
Add RFC6643 parser support

RFC6643 defines a way to map SMIv2 to YANG. This mapping retains
the original SMI details using YANG extensions, so that the resulting
model can be mapped back.

This patch adds semantic support for these extensions, so that the
semantics are supported out of the box.

JIRA: YANGTOOLS-1134
Change-Id: I494b2537e89e5a104debe486a9012d22d5c7b3aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoEliminate DQUOT_START/SQUOT_START tokens 51/92251/1
Robert Varga [Sun, 23 Aug 2020 20:53:39 +0000 (22:53 +0200)]
Eliminate DQUOT_START/SQUOT_START tokens

Quoted strings are naturally terminated by end marker, potentially
preceded by DQUOT_STRING/SQUOT_STRING. This renders the corresponding
start tokens really just a academic completeness, costing us memory
while not bringing anything to the table.

Skip generation of these tokens, reducing memory usage by up to 4.5%.

JIRA: YANGTOOLS-1089
Change-Id: I0b7ce9bf292b0dd8475d63869ddfd8d2b86a387c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 92a6c34fae26e54f9cf962228374805198b65059)

3 years agoEliminate quotedString parser construct 42/92242/1
Robert Varga [Sun, 23 Aug 2020 07:10:02 +0000 (09:10 +0200)]
Eliminate quotedString parser construct

Double-quoted strings are very common and having a separate parser
construct is not giving us much for the memory footprint it incurs.

Inline the recursive definition into argument and adjust parsing
code to cope with the change. This results in memory usage improvement
of up to 3.7%.

JIRA: YANGTOOLS-1089
Change-Id: I9fce7d1ed9f8df4bcc602978c66fcfba7bbd8ed8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFurther optimize YANG statement parsing 01/92101/1
Robert Varga [Sat, 22 Aug 2020 20:26:56 +0000 (22:26 +0200)]
Further optimize YANG statement parsing

Recursive definition of stringPart can easily end up with a large
number of retained objects -- i.e. we get StringPartContext for
each concatenation, with potentially small lists of three tokens.

Furthermore each unquotedString has ends up being typically defined
by a UnquotedStringContext containing a single StringPartContext,
which is clearly wasteful.

The grammar we are looking at is not that complex, hence we can
rewrite it without relying on recursion -- thus improving memory
footprint.

JIRA: YANGTOOLS-1089
Change-Id: I18eb1305d3e024d530552ac5cea0b5a928da0048
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0ca5c81f163ed5a56d42cd8d68302654a9bb8918)

3 years agoSpecial-case identifier lexer token 09/92209/1
Robert Varga [Thu, 20 Aug 2020 14:48:41 +0000 (16:48 +0200)]
Special-case identifier lexer token

An unquoted string can be an IDENTIFIER, which is the most common
case anyway. This token does not have to be further validated and
thus it makes sense to special-case it. This has the neat effect
of reducing the depth of our parse tree, too -- bringing memory
usage down by 6.6% versus the original fix.

JIRA: YANGTOOLS-1089
Change-Id: I63701719e90334558048201d70d8264ab9299efb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0ec7fd50a8d7768f55d03e2ad1c6156fb6836c67)

3 years agoAdd a specialized token factory 02/92202/1
Robert Varga [Mon, 10 Aug 2020 12:07:00 +0000 (14:07 +0200)]
Add a specialized token factory

Our baseline parsing footprint is rather large. We can improve it
by looking at token component sizes and using distinct token classes.

Aside from CommonToken, which are using as fallbacks for text
handling, we introduce 4 specialized classes, three of them seeing
typical use.

Since these classes use smaller fields to hold lazy state, as well
as eliminate typical invariants, we end up saving around 39MiB (12%)
of AST size in a typical case from the field.

JIRA: YANGTOOLS-1128
Change-Id: I600ae6cbe755212e2d1a15ae3e6b369ed0b3b962
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f65682b440f3a2767a7852c9b1b3f0d0ea25f95d)

3 years agoAdd timing information about local file discovery 01/92201/1
Robert Varga [Thu, 20 Aug 2020 07:41:39 +0000 (09:41 +0200)]
Add timing information about local file discovery

Locating local files actually requires also pasing them to establish
their SourceIdentifier. Add output to establish timing of this step.

Change-Id: I7dec307a4ee8b5b394a929f6ce8cb63229f94485
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 66f1d0a87f3f4f4eaa0aacef0977506866bc74ee)

3 years agoRemove an unneeded continue 62/92162/1
Robert Varga [Fri, 14 Aug 2020 16:29:28 +0000 (18:29 +0200)]
Remove an unneeded continue

We have an if/else branch, no need for another continue.

Change-Id: I4f463c1b23ae869f8d4cae649e82d0d9f4ba37d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoTake advantage of keyword tokenization 58/92158/2
Robert Varga [Fri, 14 Aug 2020 09:09:05 +0000 (11:09 +0200)]
Take advantage of keyword tokenization

Now that the tokenization has been fixed, we can rely on keyword
context to provide us with neatly split prefix and local name --
hence we do not need to perform concat/split.

Change-Id: I5d8e37d2267fefa3c5eafc542e00df33142a0bae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 49a014e5d12793e46a06915df021a07a521d1c06)

3 years agoRework YANG lexer/parser 57/92157/2
Robert Varga [Thu, 13 Aug 2020 18:15:06 +0000 (20:15 +0200)]
Rework YANG lexer/parser

The definitions in the parser and lexer are quite arcane and are
actually wrong, not allowing for a number of edge cases, which are
completely valid.

Furthermore the definition of IDENTIFIER is wrong, as it allows /
and : to appear in it -- effectively ruining the tokenization in
parser.

Refactor the lexer to perform correct tokenization in every situation.
This makes it more complicated, but also much more obvious as to
what is going on -- especially with regard as to what decisions
end up being parser's responsibility.

Refactor the parser so it recognizes YANG tokenization constructs,
notably quoted and unquoted strings, and assemble them from lexer
tokens.

JIRA: YANGTOOLS-1089
Change-Id: I34472bf0a7e262d4f633ce271952bbcd7639ef2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 58de36f365950a14a17b89f4e3ab8e7902090375)

3 years agoReplace block comment with a non-greedy rule 93/92093/1
Robert Varga [Thu, 13 Aug 2020 18:09:10 +0000 (20:09 +0200)]
Replace block comment with a non-greedy rule

We do not need an explicit mode here, we can just use a non-greedy
match and move on. This simplifies things a bit.

Change-Id: Ieab6d9cec1b17c8d86cda49cfc46a258a569e5e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0bf84fba6502cb4bc86f9e558a4a928e6397a793)

3 years agoRework keyword parser rule 44/92044/1
Robert Varga [Tue, 11 Aug 2020 09:38:52 +0000 (11:38 +0200)]
Rework keyword parser rule

A keyword is either a plain identifier, or two identifiers concatenated
through a colon. Make this a bit clearer, aiding debugging of issues.

Also push KeywordContext down to
StatementContextVisitor.getValidStatementDefinition(), so that we can
improve efficiency once IDENTIFIER token has been fixed up.

Change-Id: Ic64285255564ae33f8ad208b9a3598ba20cd26fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 220f54de00be7e3906349059fdd4bb139859ee23)

3 years agoRefactor YANG statement parser structure 43/92043/1
Robert Varga [Tue, 11 Aug 2020 08:47:25 +0000 (10:47 +0200)]
Refactor YANG statement parser structure

Current definition leads to leading whitespace being considered
a part of the statement. This leads to misleading line/character
being reported as the start of the statement.

Fix this by introducing a top-level 'file', which encapsulates
at least one statement with its leading/trailing whitespace. The
other parts then come together naturally.

JIRA: YANGTOOLS-1129
Change-Id: I9f725b09eae6f8acf4397c97c60f99caaade798b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b462288cc6e678b9350551c64ecda96196ebe8b4)

3 years agoFix AnyxmlSchemaLocationStatementSupport declaration 42/92042/1
Robert Varga [Mon, 10 Aug 2020 16:17:25 +0000 (18:17 +0200)]
Fix AnyxmlSchemaLocationStatementSupport declaration

We should not be operating on parameterized EffectiveStatement,
but rather of AnyxmlSchemaLocationEffectiveStatement itself.

Change-Id: I9130f57ced47d416d3d7f300e03eacd876bf0a27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 75c1a6cba6c19befd430415adf09d30d3f46aa36)

3 years agoFix YangDataStatementSupport declaration 76/91976/1
Robert Varga [Mon, 10 Aug 2020 16:11:57 +0000 (18:11 +0200)]
Fix YangDataStatementSupport declaration

We should not be operating on parameterized EffectiveStatement,
but rather of YangDataEffectiveStatement itself.

Change-Id: I02797816e712b9a484dca694c77f4074ceb2b0da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 32595bd5e0cc5db2866ef3333df1682b32f2aea6)

3 years agoFix declaration of extension-related supports 75/91975/1
Robert Varga [Mon, 10 Aug 2020 15:13:10 +0000 (17:13 +0200)]
Fix declaration of extension-related supports

We should properly specialize these to UnrecognizedEffectiveStatement,
not just any old statement.

Change-Id: I4a09dd9d25040bf62142444566ca39c61b6c57fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 4.0.14-SNAPSHOT 39/91539/1
Robert Varga [Wed, 22 Jul 2020 13:19:20 +0000 (15:19 +0200)]
Bump versions to 4.0.14-SNAPSHOT

This starts the next development iteration.

Change-Id: I6c1661106bed8a646de57cf05e9ad06504852ceb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 6.0.11 36/91536/1
Robert Varga [Wed, 22 Jul 2020 13:16:37 +0000 (15:16 +0200)]
Bump odlparent to 6.0.11

Pick up fixed-up netty.

Change-Id: I26924aa45d4c73f0e0ea20bec25777aced069059
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRevert "Update YANG lexer/parser to accept free-standing '+'" 30/91530/1
Robert Varga [Wed, 22 Jul 2020 11:09:35 +0000 (13:09 +0200)]
Revert "Update YANG lexer/parser to accept free-standing '+'"

This reverts commit 28f4046966c93a5f3c1e5aa061ad9e5ba946b614, as it
causes a regression around "foo" +"foo" construct.

JIRA: YANGTOOLS-1089
Change-Id: Ib5af7a994c19bf99fb5cb2a875063d623cc6c3f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 4.0.13-SNAPSHOT 57/91357/1
Robert Varga [Fri, 17 Jul 2020 08:05:04 +0000 (10:05 +0200)]
Bump versions to 4.0.13-SNAPSHOT

This starts the next development iteration.

Change-Id: I203a8d1e0cd74334e5508107f2c3d6ed8a06ee77
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 6.0.10 40/91340/1
Robert Varga [Wed, 15 Jul 2020 16:32:34 +0000 (18:32 +0200)]
Bump odlparent to 6.0.10

Pick up latest upgrades before releasing.

Change-Id: Iaf09f6aa254ebbbb336da68aee7829375d38e0eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse modifiable List when resolving relative xpath 33/91333/1
Tomas Cere [Tue, 14 Jul 2020 13:05:18 +0000 (15:05 +0200)]
Use modifiable List when resolving relative xpath

When we have split the path into its components, we can end up
compressing them further. Make sure the list is actually mutable.

JIRA: YANGTOOLS-1125
Change-Id: I1d4cd66d2efbb1955bb189763ea09fefeba93d25
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 69cb7d1ab7a329e2bd19f538b3d598be91c49f2d)

3 years agoClean up predicates prior to xpath normalization 31/91331/1
Tomas Cere [Wed, 15 Jul 2020 08:43:57 +0000 (10:43 +0200)]
Clean up predicates prior to xpath normalization

Path splitting is not equipped to ignore step predicates, which leads
it to do arrive at the wrong path. Remove any predicates before
embarking on resolving the reference.

JIRA: YANGTOOLS-1126
Change-Id: Ia32836ad1acec0762d9baa7ded5f65fa72f39b93
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
(cherry picked from commit 76fac8f8464bd072d9b26dccddb5450d3716dd51)

3 years agoBump versions to 4.0.12-SNAPSHOT 05/91005/3
Robert Varga [Wed, 8 Jul 2020 17:02:23 +0000 (19:02 +0200)]
Bump versions to 4.0.12-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia3c55acba5c2a93b5cdac0c0bc1be104e6292e0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate AbstractTypeStatementSupport 26/91026/1
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>
(cherry picked from commit a0efae9be47c4a403ed59b9846b3bcf766255707)

3 years agoSplit out AbstractTypeStatementSupport.resolveTypeReference() 25/91025/1
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>
(cherry picked from commit 1439def0aa76902f986dfa1f80c8160058958861)

3 years agoReuse common superclass for BuiltinTypeStatement 24/91024/1
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>
(cherry picked from commit 92fd7863510db42ec2dded626b4a15c9f07eeabe)

3 years agoMinimize AbstractTypeStatementSupport.internArgument() 23/91023/1
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>
(cherry picked from commit 9544e083ba3cd31f73f1be76cb28081576944ddb)

3 years agoOptimize if-feature statement implementations 22/91022/1
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>
(cherry picked from commit c258cfd0981293f6efe5e2e88d6a313f40320eb0)

3 years agoOptimize path statement implementations 21/91021/1
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>
(cherry picked from commit 1a0ce46f2eb59fb07fdaac1d2b8fb14ee09bad68)

3 years agoEliminate DeviateEffectiveStatementImpl.deviateType 20/91020/1
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>
(cherry picked from commit 459e75746b61004611bb6b1b34eb9dff0ad391a6)

3 years agoFurther optimize RevisionDateStatement implementations 19/91019/1
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>
(cherry picked from commit 1187a03f125c2c95b13bebb4afba4c90d89fc95d)

3 years agoRefactor PatternConstraintImpl 18/91018/1
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>
(cherry picked from commit 49936c5730224b5b5d396499ba56888ce30c3946)

3 years agoConvert pattern statement 17/91017/1
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>
(cherry picked from commit ed04cedfbb0da198a7fd56c86a981bbefcec8dee)

3 years agoRemove MaxElementsEffectiveStatementImpl 16/91016/1
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>
(cherry picked from commit 17be3bd101a7d408c967e3b3dc74540b92c81bbf)

3 years agoConvert AbstractEnumStatementSupport 15/91015/1
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>
(cherry picked from commit 305d5c79b6dba17b6239961b4ce8440c89d21015)

3 years agoMigrate Must/WhenStatementSupport to BaseStatementSupport 14/91014/1
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>
(cherry picked from commit 3e8882b8933feec0e47c4b17d44f5342bb8c84b1)

3 years agoConvert BaseStatementSupport 13/91013/1
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>
(cherry picked from commit 7562f2055d6419461dee5248db9e84f881df10af)

3 years agoConvert ArgumentStatementSupport 12/91012/1
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>
(cherry picked from commit 329864ad749ebc11ef3fa3552c5b027162eb80dd)

3 years agoConvert MaxElementsStatementSupport 11/91011/1
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>
(cherry picked from commit bd31998ec77d9dd3763494675c6ca373e4af0bb8)

3 years agoConvert AbstractIncludeStatementSupport 10/91010/1
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>
(cherry picked from commit 49cd5a097d17058b1569d69d003187ec3ce52db0)

3 years agoConvert RevisionDateStatementSupport 09/91009/1
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>
(cherry picked from commit 40f6c21d96aae6ba92f98559af6cb717de6d4419)

3 years agoConvert ModifierStatementSupport 08/91008/1
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>
(cherry picked from commit 4ae4fcadb105220a164a1b4fc9a00d376636e9c5)

3 years agoRemove unneeded @NonNull annotations 07/91007/1
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>
(cherry picked from commit 00705e04fd9df27a5fa36a0953ba5abde23af3ab)

3 years agoUse ImmutableMap collector in EnumStringCodec 06/91006/1
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>
(cherry picked from commit d3cd104d8a221ab7287a386845be0b8357155777)

3 years agoBump odlparent to 6.0.9 03/91003/1
Robert Varga [Wed, 8 Jul 2020 16:02:49 +0000 (18:02 +0200)]
Bump odlparent to 6.0.9

Pick up latest fixes from upstream.

Change-Id: Idee1a0871b59518c7642a2b255562b5248c89da0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix YangConstants.RFC6020_YIN_MEDIA_TYPE 63/90963/1
Robert Varga [Tue, 7 Jul 2020 17:53:14 +0000 (19:53 +0200)]
Fix YangConstants.RFC6020_YIN_MEDIA_TYPE

The definition and reference are wrong here, fix that up.

JIRA: YANGTOOLS-1124
Change-Id: Ied4f0f1855329a536cdd0b73e38a69dcde72d377
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate YANG lexer/parser to accept free-standing '+' 46/90746/2
Robert Varga [Fri, 17 Apr 2020 18:01:36 +0000 (20:01 +0200)]
Update YANG lexer/parser to accept free-standing '+'

The lexer is not quite accurate, as it does not allow for strings
starting with a '+' when not quoted. Fix this up, relaxing the
rules.

JIRA: YANGTOOLS-1089
Change-Id: Ifaf9c65966b43f26f37fc88a11d77fc9f43d2c8c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 04ed60d275521fd6e6ee57d5b1ce4e6a519d2e35)

3 years agoDisconnect StmtNamespaceContext from statement 19/90819/2
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>
(cherry picked from commit d69a6a9b2ec6b13c2c83d01c05219ccea880e56c)

3 years agoDo not retain namespace context when not needed 18/90818/2
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>
(cherry picked from commit 1cfaa0281c43f939cd64261e1605e8757d39aa2f)

3 years agoEliminate use of ImmutableList 39/90739/1
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>
(cherry picked from commit cf8b98d69602809355f85703cfe4d635d9f72bdf)

3 years agoFix javadoc to comply with JDK14 03/90803/1
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>
(cherry picked from commit eba6716092f00791c51ab9b6b8cd90835c89ed5d)

3 years agoAdd YangInstanceIdentifier.create(PathArgument) 07/90707/2
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>
(cherry picked from commit 224b2fe77f786ac4c524ee2ec4d581b3914af92b)

3 years agoClean up AntlrXPathParser a bit 87/90487/1
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>
(cherry picked from commit 0826ac2f735ecfa1d51cc297e155865e39e636c1)

3 years agoFix reference to odl-antlr4 79/90579/1
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>
3 years agoBump versions to 4.0.11-SNAPSHOT 44/90544/1
Robert Varga [Mon, 22 Jun 2020 06:47:42 +0000 (08:47 +0200)]
Bump versions to 4.0.11-SNAPSHOT

This starts the next development iteration.

Change-Id: Ie9ad567777834f7dce6b6a4a38954ba91e7be16b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 6.0.8 40/90540/1
Robert Varga [Sun, 21 Jun 2020 14:15:26 +0000 (16:15 +0200)]
Bump odlparent to 6.0.8

Pick up SFT improvements from upstream.

Change-Id: I529bc743d17780f2949f532b0854c2901dc909c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSpeed up YangParser.addLibSource() 25/90425/1
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>
(cherry picked from commit 48dec899e71c23cb3ee07cc85d788d5e7f57b3af)

3 years agoAdd CrossSourceStatementReactor javadocs 24/90424/1
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>
(cherry picked from commit c13ff32821b7624d2a45ab083a9b7b5ab53db3b8)

3 years agoSpeed up YangParser.addSource() 23/90423/1
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>
(cherry picked from commit eb136faf8b1e819b1794a212d1d8a5dce1dd218f)

3 years agoAllow list elements to be interleaved 56/90356/1
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>
(cherry picked from commit eb4617a9867325921e0fd9660898c3fc4dfc8d11)

3 years agoDeprecate ListEntryNodeDataWithSchema.forSchema() 52/90352/1
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>
(cherry picked from commit f04c7c25db26b76c53a93a787838a458778e8bf6)

3 years agoSplit out addCompositeChild(CaseSchemaNode) 51/90351/1
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>
(cherry picked from commit f158b68090d09f72180c9ec5f27096fd228f3f12)

3 years agoClean up variable initialization 50/90350/1
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>
(cherry picked from commit 4f82372f6b3d07663d2ead494fd151e0dfc83a7f)

3 years agoAdd YangInstanceIdentifier.coerceParent() 06/90306/1
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>
(cherry picked from commit 3c488d8405b860834471acc96e7c562156a1c777)

3 years agoAdd MultipleEntryDataWithSchema interface 02/90302/1
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>
(cherry picked from commit 94336a79d974543e50cd5e9047d6bd148e4ddbda)

3 years agoAdd test for union with identity XML codec issue 84/90284/1
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>
(cherry picked from commit 48b7827d5cb4d0506e33f0060a4a81b3a0618116)

3 years agoCheck unions for instance-identifier types 83/90283/1
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>
(cherry picked from commit 8bf10220fc15babe0ad92ae2f439f8fdf925986a)

3 years agoCheck unions for identityref types 82/90282/1
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>
(cherry picked from commit ded2b6279af65315840a43a2d507cd715bdad851)

3 years agoIssue a warning when we encounter a non-QName identityref 81/90281/1
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>
(cherry picked from commit 5bc26d07dce3555aa57af39c45d3c1812794f05f)

3 years agoSeparate out correct QName-bearing serialization method 75/90275/1
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>
(cherry picked from commit 7176c6b8f99f4d434634ae941a34c69397f253c1)

3 years agoImprove error message in UnionXmlCodec 74/90274/1
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>
(cherry picked from commit b29b564baaf81b5abb3ba5a2de9a23e043f10a80)

3 years agoPropagate type to XMLStreamWriterUtils 73/90273/1
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>
(cherry picked from commit 22384c114cd763c21096f8d673c7ca7dae24b549)

3 years agoBump versions to 4.0.10-SNAPSHOT 15/90215/1
Robert Varga [Tue, 2 Jun 2020 12:19:31 +0000 (14:19 +0200)]
Bump versions to 4.0.10-SNAPSHOT

This starts the next development iteration.

Change-Id: I153eae0616c72efb1c0bb36af321c8a618809948
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 6.0.7 14/90214/2
Robert Varga [Tue, 2 Jun 2020 12:18:47 +0000 (14:18 +0200)]
Bump odlparent to 6.0.7

Pick up latest upstream upgrades and fixes.

Change-Id: Ia7f34de2d0e7e1eab2fac1148fa7e9640b0f622a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoTeach SchemaAwareApplyOperation about anydata/anyxml 00/90000/2
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>
(cherry picked from commit 4b64f1f8c65d362ce3447aa7f2c97132c253fffa)

3 years agoFix an error message typo 92/89892/2
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>
(cherry picked from commit 66bc339442b0c700079df770b9f3840e328e722c)

3 years agoSimplify AbstractNodeContainerModificationStrategy 59/89959/1
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>
(cherry picked from commit f29dd56fe28f082931273163b0d80b09a28d1b30)

4 years agoOptimize LazyContainerNode.getChild() 74/89274/1
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>
4 years agoAdd NormalizedNodeContainer.size() 73/89273/1
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>
4 years agoBump versions to 4.0.9-SNAPSHOT 16/89116/1
Robert Varga [Sat, 18 Apr 2020 08:14:48 +0000 (10:14 +0200)]
Bump versions to 4.0.9-SNAPSHOT

This starts the next development iteration.

Change-Id: I1de3fa671db8d75b57d9afec8e4731dbc0df2b13
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix relative xPath resolution for leafref types 05/89105/1
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>
4 years agoRemove StackedReversePathArguments.haveSize 02/89102/2
Robert Varga [Wed, 18 Mar 2020 13:38:43 +0000 (14:38 +0100)]
Remove StackedReversePathArguments.haveSize

We do not need to have a separate field here, as the size cannot
legally be here 0 -- as stacking guarantees we have at least one
parent.

Change-Id: Id319d4ef05efc1c3691b7b97b6b188cc09701547
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5198ae72c04d103b4e6e98442df2587b52c202a8)

4 years agoFix junit/hamcrest javadoc links 00/89100/1
Robert Varga [Fri, 17 Apr 2020 15:38:43 +0000 (17:38 +0200)]
Fix junit/hamcrest javadoc links

With odlparent update, we are picking up newer versions for quite
some time, correct our stale links.

Change-Id: I0b76691b479ce6e6affd4dfa7b9298497af0d3c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 6.0.6 99/89099/1
Robert Varga [Fri, 17 Apr 2020 15:37:54 +0000 (17:37 +0200)]
Bump odlparent to 6.0.6

Pick up latest fixes.

Change-Id: Ic97656176c769cdf3ce5321e6fdb32cca71672c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate StmtContextUtils.producesDeclared() for removal 79/89079/1
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>
(cherry picked from commit 751a55c91a5446eccba7d9e78597ded5388a1ffe)

4 years agoUpstream StmtContextUtils.producesDeclared() 78/89078/1
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>
(cherry picked from commit 61507ff3a5b8960b33cf71d90c61c53f2a8b2aff)

4 years agoDo not issue duplicate warnings for lists missing keys 12/89012/2
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>
(cherry picked from commit 1fb451b2a874cf198195895be035478cd9aa1635)

4 years agoRefactor string unescaping 11/89011/1
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>
(cherry picked from commit f8501e012a6585adc523f51d064dfa61ec9ea24e)

4 years agoImprove list key presence checks 07/88807/1
Robert Varga [Tue, 31 Mar 2020 13:21:03 +0000 (15:21 +0200)]
Improve list key presence checks

A few statements are explicitly not part of instantiated tree, but
rather define a different data tree instance, which may be related
the instantiated tree.

We checked only for groupings, but we need to also consider input,
output and notification statements.

JIRA: YANGTOOLS-1090
Change-Id: I8f497ec2998b74388924d62c5dbef2b204ecefab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd DataTreeCandidateInputOutput 26/88626/1
Robert Varga [Wed, 18 Mar 2020 10:27:54 +0000 (11:27 +0100)]
Add DataTreeCandidateInputOutput

DataTreeCandidate is a yangtools concept, which is commonly
serialized by users of DataTree. Make sure we support its serialization
in the binary stream -- importing the implementation from controller
as of e66759266dc43d5f58b2837aca5047b42c205e4a.

Change-Id: I5d63a3f9b1ced38e762ce0a74fb3fd820d67614a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5cdad3bad8fe5f0049c157c4e24ae94db1be7b6d)

4 years agoFix StackedYangInstanceIdentifier.getParent() nullness 00/88300/2
Robert Varga [Wed, 18 Mar 2020 13:32:40 +0000 (14:32 +0100)]
Fix StackedYangInstanceIdentifier.getParent() nullness

Stacked version always has a parent, as well as the argument, make
sure we reflect that in annotations.

Change-Id: If0f391920fd77bb718fdb7170b3e0792e1c28c7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRequire JDT annotations transitively 99/88299/1
Robert Varga [Wed, 18 Mar 2020 13:19:03 +0000 (14:19 +0100)]
Require JDT annotations transitively

We are using these in return values and generally in APIs, make sure
we require them transitively.

Change-Id: I78756188922fe8956d373ad98089c886e241b9e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFilter registered listeners 70/88170/1
Robert Varga [Sat, 29 Feb 2020 11:18:28 +0000 (12:18 +0100)]
Filter registered listeners

There is a small race window where the registration could be marked
as unregistered and not removed from the map. Check that condition
before letting the listener through.

Change-Id: I1938e6459faaaadf69bc7907ba6ba71e65fe9e8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd AbstractRegistration.notClosed() 69/88169/1
Robert Varga [Sat, 29 Feb 2020 11:17:07 +0000 (12:17 +0100)]
Add AbstractRegistration.notClosed()

This is a utility method useful for stream integration.

Change-Id: I6408cc25a1a10f010fc4f42ee83d50db31ca8bfa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not instantiate a Consumer for registration 68/88168/1
Robert Varga [Sat, 29 Feb 2020 10:51:34 +0000 (11:51 +0100)]
Do not instantiate a Consumer for registration

Taking a Consumer forces us to instantiate it to capture listeners
Set. We can do the same by simply moving the reference away. For
safety we only get a Collection<?>, for which remove(Object) is just
what we want.

Change-Id: I4f3bd473a75dabee1d1a31e10cf0fefe57c4896b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd ListenerRegistry.clear() 67/88167/1
Robert Varga [Sat, 29 Feb 2020 10:30:28 +0000 (11:30 +0100)]
Add ListenerRegistry.clear()

There are callers who mean to only clear the registry for which
they are accessing the public view. Provide a method to do that
and mark getRegistrations() as deprecated.

Change-Id: I73b18443c505e7c7cea7efec627cc87196793d46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoQName namespace is always non-null 16/88116/1
Robert Varga [Fri, 28 Feb 2020 06:20:08 +0000 (07:20 +0100)]
QName namespace is always non-null

Simplify QName.toString() by realizing the namespace is guaranteed
to be non-null.

Change-Id: I06d2ab019fe9a9542e4ca3114235af6b6db42db1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAugment effective statements can vary in argument 72/88072/1
Robert Varga [Tue, 25 Feb 2020 10:54:39 +0000 (11:54 +0100)]
Augment effective statements can vary in argument

Augment is serving dual purposes, either as a top-levle statement
or embedded in uses statement. The latter means the argument can
vary across instantiations and we therefore need to take that into
account.

JIRA: YANGTOOLS-1065
Change-Id: Ib7ac9870876f477c5c1c1b3da3d73c2bc1d34781
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd inject annotations 23/87923/1
Robert Varga [Thu, 20 Feb 2020 07:45:15 +0000 (08:45 +0100)]
Add inject annotations

Add @Singleton to activation factories, so that they get
recognized by DI frameworks.

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