yangtools.git
3 years agoFire AbstractPrerequisite listeners as soon as they resolve 91/93991/2
Robert Varga [Tue, 1 Dec 2020 13:42:15 +0000 (14:42 +0100)]
Fire AbstractPrerequisite listeners as soon as they resolve

We seem to be stuck with listeners not firing, leaving references
which need to be cleared. Ensure we fire phase listeners as soon
as they are satisfied -- repurposing tryApply() for its logical
purpose.

JIRA: YANGTOOLS-1192
Change-Id: I87d1700e2cc80bfa3fbb5be9a8dc938d6fe55c17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 4.0.15-SNAPSHOT 03/93703/1
Robert Varga [Mon, 9 Nov 2020 17:21:23 +0000 (18:21 +0100)]
Bump versions to 4.0.15-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia3cc5c10f97012c546db796ebd926c476c9d0464
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 6.0.12 02/93702/1
Robert Varga [Mon, 9 Nov 2020 17:18:35 +0000 (18:18 +0100)]
Bump odlparent to 6.0.12

Pick up latest upgrades from upstream.

Change-Id: I90abdcf136f443c2bbff29c002ff04ae79230003
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd LazyCollections.lazyAdd for Sets 86/93686/1
Illia [Mon, 26 Oct 2020 16:15:39 +0000 (18:15 +0200)]
Add LazyCollections.lazyAdd for Sets

This will be used for GenerateType field, which is set of specified
getters.

JIRA: MDSAL-426
Change-Id: I691aa13c88147828890e0639441f607515053af8
Signed-off-by: Illia <illia.ihushev@pantheon.tech>
(cherry picked from commit 7caf3d717451ea9a98b19ab58e175281b5029055)

3 years agoRemove unused SourceSpecificContext methods 12/93612/1
Robert Varga [Thu, 5 Nov 2020 16:42:29 +0000 (17:42 +0100)]
Remove unused SourceSpecificContext methods

These package-private methods are not used, remove them.

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

3 years agoFix PhaseModificationInNamespacePath effects 11/93611/1
Robert Varga [Thu, 5 Nov 2020 11:53:04 +0000 (12:53 +0100)]
Fix PhaseModificationInNamespacePath effects

PhaseModificationInNamespacePath is a set of requirements, working
along the parent->child axis. As we are resolving individual steps
we have to mark each as being impacted by this mutation, not only
the ultimate target.

This ensures that parent statements are not allowed to complete
until the mutation is resolved one way or another -- thus ensuring
proper parent/child phase completion transitions.

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

3 years agoFix transitive if-feature augments 79/93579/1
Robert Varga [Fri, 9 Mar 2018 00:05:41 +0000 (01:05 +0100)]
Fix transitive if-feature augments

We cannot just ignore augments, as they drive namespace population.
Instead of that, let's populate target nodes, but make sure they
are marked as unsupported.

This allows ChildSchemaNodeNamespace-driven lookups to find the resulting
node, but does not allow it to materialize as an EffectiveStatement.

JIRA: YANGTOOLS-859
Change-Id: Ib817e6e20563005427471098bf6ff2991fb60e01
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fdfe9c4914bf8a9f9a92cd1ab390e1f17a89b2ce)
(cherry picked from commit b83966f5abb72503da77c19957c50f9e6dcd69be)

3 years agoRemove check for when being copied 38/93538/1
Robert Varga [Sat, 31 Oct 2020 11:06:21 +0000 (12:06 +0100)]
Remove check for when being copied

We have 'when' explicitly excluded, hence we can never observe
it in validation. Eliminate this dead code.

Change-Id: I4a4fb4c1e2a3d888e02f2db0e49671993e2985ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2abe50d138ad54a0afe9f832cf4469b3cdf59bd8)

3 years agoClarify NamespaceStorageSupport.getParentNamespaceStorage() 95/93495/1
Robert Varga [Fri, 30 Oct 2020 09:08:51 +0000 (10:08 +0100)]
Clarify NamespaceStorageSupport.getParentNamespaceStorage()

This override does seemingly nothing, but in fact splits invocation
groups to two -- those going to SourceSpecificContext and those
going to a NamespaceStorageSupport subclass. More specifically, if
a caller knows it is talking to NamespaceStorageSupport, JIT does
will not consider SourceSpecificContext an implementation.

Furthermore, SourceSpecificContext, as an implementation class,
guarantees it will return BuildGlobalContext.

Change-Id: Ia285f9d7745a9c114d3dd3214c2b82a651db3ce0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 23fa427731dafe9db484f48bcdfe28ba20b5fd32)

3 years agoTighten {Inferred,Substatement}Context.getParentNamespaceStorage() 94/93494/1
Robert Varga [Fri, 30 Oct 2020 09:33:02 +0000 (10:33 +0100)]
Tighten {Inferred,Substatement}Context.getParentNamespaceStorage()

These two methods are guaranteed to return StatementContextBase,
express that in their return type.

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

3 years agoBuildGlobalContext should be final 93/93493/1
Robert Varga [Fri, 30 Oct 2020 08:58:24 +0000 (09:58 +0100)]
BuildGlobalContext should be final

We do not inherit from this class by design, make sure that bit
is captured for JIT to see.

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

3 years agoStorageSpecific.storageType is private and final 92/93492/1
Robert Varga [Fri, 30 Oct 2020 08:10:24 +0000 (09:10 +0100)]
StorageSpecific.storageType is private and final

Somehow this field escaped our usual attention, make sure it's
properly final and private.

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

3 years agoUse coerceStatemntArgument for YinElementStatement 91/93491/1
Robert Varga [Fri, 30 Oct 2020 01:25:28 +0000 (02:25 +0100)]
Use coerceStatemntArgument for YinElementStatement

yin-element requires an argument, it is fair to coerce it and get
rid of a nullness warning.

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

3 years agoRecheck fields when cleaning up listeners 72/93472/1
Robert Varga [Thu, 29 Oct 2020 16:51:17 +0000 (17:51 +0100)]
Recheck fields when cleaning up listeners

We may end up in a situation where we trigger multiple times, in
which case we can end up with mutated state and therefore cannot
rely on fields being non-null.

JIRA: YANGTOOLS-1155
Change-Id: I5607843d1e02483faa387a5630f3c4c06a3be62a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1105cf5bc00628ee6dc2d86dce1ef4225050a5ba)

3 years agoAdd faster NormalizedNodes.findNode() alternatives 58/93358/1
Robert Varga [Sun, 25 Oct 2020 20:10:03 +0000 (21:10 +0100)]
Add faster NormalizedNodes.findNode() alternatives

End users are going through iterators needlessly when they want
to touch just a single PathArgument. Add methods which side-step
the intermediate List.

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

3 years agoSpeed up NormalizedNodes.getDirectChild() 57/93357/1
Robert Varga [Sun, 25 Oct 2020 20:05:39 +0000 (21:05 +0100)]
Speed up NormalizedNodes.getDirectChild()

Deal with positive matches first, let ValueNode be dealt with using
the default path.

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

3 years agoMake YangNamespaceContextNamespace global 46/92946/1
Robert Varga [Tue, 6 Oct 2020 18:47:55 +0000 (20:47 +0200)]
Make YangNamespaceContextNamespace global

The crux of the problem with not being able to resolve prefixes comes
from the fact we end up reusing the same context for both submodule
and module. Turn the namespace into a global one, keyed by the root
context.

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

3 years agoInclude Uint.ZERO in lower saturation bounds 02/92702/1
Robert Varga [Fri, 2 Oct 2020 14:44:13 +0000 (16:44 +0200)]
Include Uint.ZERO in lower saturation bounds

This is a slight performance optimization, use constant zero for
zero values.

Change-Id: I4cc3e2e8656746b8fce7a43ddb42df8865221653
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8ab64bd42a9a35858fa69543e6e16f9b5de76af6)

3 years agoAdd Uint saturated converters 01/92701/2
Robert Varga [Mon, 28 Sep 2020 16:57:15 +0000 (18:57 +0200)]
Add Uint saturated converters

There are a number of places where we need to perform a saturated
conversion, i.e. when we have a 'long' count and need to put it into
a Uint32 field. Add methods to deal with that.

JIRA: YANGTOOLS-1135
Change-Id: Ia0bb2e9f0400d975ce1f4b150704dcf526d3bc82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 254b2d0b480ae2ddec8b5db9b97cb5fef084d93c)

3 years agoUse Uint constants in base types 99/92699/2
Robert Varga [Fri, 2 Oct 2020 14:13:14 +0000 (16:13 +0200)]
Use Uint constants in base types

Rather than using valueOf(), use exposed ZERO and MAX_VALUE,
improving initialization speed just a little.

Change-Id: Ib6938c039bdf8773d6000f9eb6b56cf8f01ae1d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConvert uint tests to assertThrows() 98/92698/1
Robert Varga [Fri, 2 Oct 2020 13:28:32 +0000 (15:28 +0200)]
Convert uint tests to assertThrows()

We have a number of tests which can be consolidated, use assertThrows.
This flushes out a bad test case, which is corrected.

Change-Id: I3b0b760cb89a4dbd93ebe44af2ed917b0698fc31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix warnings when we are augmenting-in a list 66/92566/2
Robert Varga [Mon, 21 Sep 2020 10:48:07 +0000 (12:48 +0200)]
Fix warnings when we are augmenting-in a list

When we are targetting a non-configuration list we end up issuing
a warning because the augment content contains the list as well --
and is not suppressed. Add logic to suppress it.

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

3 years agoRemove IetfYangSmiv2Namespace 91/92491/1
Robert Varga [Fri, 18 Sep 2020 20:49:04 +0000 (22:49 +0200)]
Remove IetfYangSmiv2Namespace

This namespace is useless, remove it.

JIRA: YANGTOOLS-1134
Change-Id: Ic285d7e68daf090b6a024f38a32de0c8e15414c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 24120d6b7770c2c45e51176f048b98191edd69b7)
(cherry picked from commit b3984761684cc2992a026669391d10e3b55c4c16)

3 years agoRemove unneeded overrides 05/92505/1
Robert Varga [Fri, 18 Sep 2020 19:35:14 +0000 (21:35 +0200)]
Remove unneeded overrides

We have a number of overridden methods we do not need, remove them.

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

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)