yangtools.git
3 years agoFixup yang-model-api javadoc warnings 12/91612/1
Robert Varga [Fri, 24 Jul 2020 09:05:36 +0000 (11:05 +0200)]
Fixup yang-model-api javadoc warnings

There are a number of issues javadoc is complaining about, fix them
up.

Change-Id: I82e108faca800b80a85e00aab96cb8ec8fdc91e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 5.0.6-SNAPSHOT 38/91538/2
Robert Varga [Wed, 22 Jul 2020 13:18:32 +0000 (15:18 +0200)]
Bump versions to 5.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I8cc0583d3cf9f32a4ebc7cb971fe29d226196ac6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 7.0.5 34/91534/1
Robert Varga [Wed, 22 Jul 2020 12:15:25 +0000 (14:15 +0200)]
Bump odlparent to 7.0.5

Pick up odlparent with netty fix.

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

This reverts commit 04ed60d275521fd6e6ee57d5b1ce4e6a519d2e35, 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 agoUpdate SchemaNodeIdentifier design a bit 11/91511/3
Robert Varga [Tue, 21 Jul 2020 19:01:20 +0000 (21:01 +0200)]
Update SchemaNodeIdentifier design a bit

Using explicit instanceof checks is not very code friendly, as we
usually end up using either Absolute or Descendant identifier and
forcing an instanceof check is hiding things from the compiler.

Furthermore {first,last}NodeIdentifier are really only useful in
the Absolute case.

Update the design by moving utility methods to Absolute and
add four specialized classes. While this adds a bit of code
duplication and verbosity, the result is a bit better in that we
do not have explicit casts and checks.

Furthermore, in the case of a particular use, for example Absolute,
the code ends up dealing with two concrete implementations, leading
to bimorphic dispatch which is fully visible to JIT.

Change-Id: I2f3b7dc9ac3bf3d038e815f2406bd5c5629f8553
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaNodeIdentifier.{first,last}Identifer() 08/91508/1
Robert Varga [Tue, 21 Jul 2020 15:29:46 +0000 (17:29 +0200)]
Add SchemaNodeIdentifier.{first,last}Identifer()

A number of operations involving SchemaNodeIdentifier are interested
in either the first or the last part of it. Add methods to efficiently
access them.

Change-Id: I0ecb9ee2d4ce0aba7ca7c302a751c273555456e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaNodeIdentifier.Absolute.intern() 02/91502/2
Robert Varga [Tue, 21 Jul 2020 12:02:19 +0000 (14:02 +0200)]
Add SchemaNodeIdentifier.Absolute.intern()

We will be using SchemaNodeIdentifiers in a lot of contexts, some
of which involve dynamic wiring lookups. In these contexts we want
the ability to squash an Absolute schema node identifier into a
JVM-wide single instance -- hence we get benefits of cached hash
code and instance-shortcuts on equals().

Change-Id: I2144ba659a783d585e59103dde3e6d292a63ec48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 5.0.5-SNAPSHOT 95/91395/1
Robert Varga [Fri, 17 Jul 2020 15:54:52 +0000 (17:54 +0200)]
Bump versions to 5.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I35d576671154998adba1643361ce0dc86ad576cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump to odlparent-7.0.4 35/91235/5
Robert Varga [Sat, 11 Jul 2020 14:22:25 +0000 (16:22 +0200)]
Bump to odlparent-7.0.4

Pick up latest upgrades from upstream.

Change-Id: I9843867449ac5f0eaf16d562df493cb13b495f4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse modifiable List when resolving relative xpath 18/91318/9
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>
3 years agoClean up predicates prior to xpath normalization 29/91329/2
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>
3 years agoUpdate approval link 86/91286/2
Robert Varga [Sun, 12 Jul 2020 21:22:14 +0000 (23:22 +0200)]
Update approval link

YANGTOOLS does have an approval link -- it is not easy to find,
but it is linked from graduation review.

Change-Id: Id30ae9493072389b4c6d7da0979acec47af86d64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd INFO.yaml for yangtools 70/91270/1
Anil Belur [Sun, 12 Jul 2020 02:51:11 +0000 (12:51 +1000)]
Add INFO.yaml for yangtools

Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Change-Id: I1ab91a7cde9e13b44181f7d74318a613151cb849

3 years agoFix YangConstants.RFC6020_YIN_MEDIA_TYPE 64/90964/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>
(cherry picked from commit c22a8da40553df3302e02cad846c65ce013fc8e8)

3 years agoUpdate YANG lexer/parser to accept free-standing '+' 04/89104/5
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>
3 years agoClean up OpenConfigVersionSupport 25/90925/1
Robert Varga [Mon, 6 Jul 2020 09:24:27 +0000 (11:24 +0200)]
Clean up OpenConfigVersionSupport

Type parameters should be referencign OpenConfigVersionEffectiveStatement,
fix it up.

Change-Id: Ied2cf301c16270bd21e6f211a97665d682269aaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd UnknownSchemaNodeMixin 22/90922/1
Robert Varga [Sun, 5 Jul 2020 18:28:20 +0000 (20:28 +0200)]
Add UnknownSchemaNodeMixin

Add basic mixin to use with effective statement implementations.

JIRA: YANGTOOLS-1123
Change-Id: Iaa0a7e9624d22999285d36f28ee6a0d797b936db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor ExtensionStatementSupport 18/90918/3
Robert Varga [Fri, 3 Jul 2020 14:52:15 +0000 (16:52 +0200)]
Refactor ExtensionStatementSupport

Using RecursiveObjectLeaker requires integration with object
construction and is inherently dangerous.

As it turns out, we can solve this problem differently, without
having to rely on this magic by pre-allocating the resulting
effective statement and populating it into a thread-local map.

That allows us to pick up that object for purposes of including
it in substatements -- thus breaking the recursion. Once we have
acquired substatements, the real build methods just fill them
into the pre-allocated object are return it.

On exit we check whether we have cleared the state map and clean
it up automatically, as this is not expected to be a major
performance problem.

JIRA: YANGTOOLS-1122
Change-Id: Iebbbffd6f62fa57ce496a2ab7bc8e5792198d3a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor {Module,Submodule}EffectiveStatementImpl 02/87502/7
Robert Varga [Fri, 3 Jul 2020 09:56:35 +0000 (11:56 +0200)]
Refactor {Module,Submodule}EffectiveStatementImpl

Modules and submodules are tied together via AbstractEffectiveModule,
which holds on to old layout. While it is not directly harmful to
these implementations, having statement creation outside of actual
constructors is a long-term goal.

Refactor AbstractEffectiveModule and thus both implementations to
create substatements separately in BaseStatementSupport.

The inlining of submodule statements is hooked into
BaseStatementSupport lifecycle via buildEffectiveSubstatements(),
so that modules can stop mucking with statement build rules and just
pick up whatever was created for the corresponding submodule.

For declared statements we introduce AbstractDeclaredEffectiveRootStatement
as a replacement for AbstractRootStatement, which is now deprecated
for removal.

JIRA: YANGTOOLS-1065
Change-Id: I032bb1ea4f2ee5db87d9b0dbbdeb89f152bc4593
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove statement filter caches from AbstractEffectiveModule 13/90913/3
Robert Varga [Fri, 3 Jul 2020 09:03:21 +0000 (11:03 +0200)]
Remove statement filter caches from AbstractEffectiveModule

Majority of collections kept by AbstractEffectiveModule are simple
filters on effective substatements. Use Collections2.filter()
instead of fully instantiating them.

Since we are dealing with generic Collections, this is also flushing
out a bad use of equality in a test.

JIRA: YANGTOOLS-1065
Change-Id: If6e8689fdd6638aaddfd45c4846086c03d91032e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove simple AbstractEffectiveModule properties 12/90912/1
Robert Varga [Fri, 3 Jul 2020 08:49:39 +0000 (10:49 +0200)]
Remove simple AbstractEffectiveModule properties

A number of properties are just a simple search in substatements,
let's not waste fields on having them cached, as they are typically
unused anyway.

JIRA: YANGTOOLS-1065
Change-Id: I61c05bb89129beb5d0876067763a016e7d850e12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove AbstractEffectiveModule.get{Namespace,Revision} 11/90911/1
Robert Varga [Fri, 3 Jul 2020 08:43:49 +0000 (10:43 +0200)]
Remove AbstractEffectiveModule.get{Namespace,Revision}

These methods are provided as default methods in Module, remove
them to reduce clutter.

JIRA: YANGTOOLS-1065
Change-Id: I6139d1ee9d0ab42f6a52677a20d6823b2dc98022
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove AbstractEffectiveModule.name 10/90910/1
Robert Varga [Fri, 3 Jul 2020 08:42:26 +0000 (10:42 +0200)]
Remove AbstractEffectiveModule.name

This field is just shadowing argument(), remove it.

JIRA: YANGTOOLS-1065
Change-Id: Ib3b078548269b50ae69f4cecceee47dc9890b562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDeprecate EffectiveStatementBase for removal 05/90905/3
Robert Varga [Thu, 2 Jul 2020 22:27:43 +0000 (00:27 +0200)]
Deprecate EffectiveStatementBase for removal

With all immediate users migrated or deprecated, mark the grim
future for this class, slating it for removal/integration.

JIRA: YANGTOOLS-1065
Change-Id: I4d06bdceedc3fcf5e45125f2f7fcfffe3de7d35e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove {Numerical,String}RestrictionsImpl 04/90904/3
Robert Varga [Thu, 2 Jul 2020 22:13:53 +0000 (00:13 +0200)]
Remove {Numerical,String}RestrictionsImpl

As noted during previous migration, these classesalong with their
support is unused. Furthermore NumericalRestrictions is
mis-declared.

Remove the implementation and drop a FIXME for next major version,
so that we at least fix the definition or decide its overall
future.

Note this concept is probably useful, as it gates towards tasks
which are currently done by AbstractTypeStatementSupport and those
could be split out if we rework interactions with simple built-in
types.

JIRA: YANGTOOLS-1065
Change-Id: Ief43d59dbc541b094ca80e39382f8c0c8767bac2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate InstanceIdentifierSpecificationSupport 03/90903/2
Robert Varga [Thu, 2 Jul 2020 22:08:34 +0000 (00:08 +0200)]
Migrate InstanceIdentifierSpecificationSupport

InstanceIdentifierSpecificationSupport can use memory-efficient
representation through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I821172baf33bd639fd52e02160db7122b4f53367
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate LeafrefSpecificationSupport 02/90902/3
Robert Varga [Thu, 2 Jul 2020 21:56:30 +0000 (23:56 +0200)]
Migrate LeafrefSpecificationSupport

LeafrefSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I735563730e8c382b49ea01fccc00191ffcfdfb14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate UnionSpecificationSupport 01/90901/2
Robert Varga [Thu, 2 Jul 2020 21:44:23 +0000 (23:44 +0200)]
Migrate UnionSpecificationSupport

UnionSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I93ad3126e000c489776ea92aed58e9183e93da42
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate IdentityRefSpecificationSupport 00/90900/2
Robert Varga [Thu, 2 Jul 2020 21:28:27 +0000 (23:28 +0200)]
Migrate IdentityRefSpecificationSupport

IdentityRefSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: Ic198df95ab519f42c687b7bec0d0620b9c9a9126
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate EnumSpecificationSupport 99/90899/4
Robert Varga [Thu, 2 Jul 2020 21:08:20 +0000 (23:08 +0200)]
Migrate EnumSpecificationSupport

EnumSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I0b211e2cfd09cae8e69ca614b190a562ba85e090
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate Decimal64SpecificationSupport 96/90896/3
Robert Varga [Thu, 2 Jul 2020 20:54:20 +0000 (22:54 +0200)]
Migrate Decimal64SpecificationSupport

Decimal64SpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: Ic00af914cf31095179b2e9da4484679929431ed0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate BitsSpecificationSupport 95/90895/3
Robert Varga [Thu, 2 Jul 2020 20:43:18 +0000 (22:43 +0200)]
Migrate BitsSpecificationSupport

BitsSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: Id2d9b816388584ceda3c8cc8528b8cccfae08fbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate IntegralTypeEffectiveStatementImpl 94/90894/4
Robert Varga [Thu, 2 Jul 2020 18:25:52 +0000 (20:25 +0200)]
Consolidate IntegralTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of each
integral type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I21f9cbdd97966f7a1d36ae536ac01fb93f3596ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate StringTypeEffectiveStatementImpl 93/90893/5
Robert Varga [Thu, 2 Jul 2020 18:18:59 +0000 (20:18 +0200)]
Consolidate StringTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of a string
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: Icaf85f1cb49f98a8c019fb0752777f00a98b5491
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate LeafrefTypeEffectiveStatementImpl 92/90892/5
Robert Varga [Thu, 2 Jul 2020 18:14:41 +0000 (20:14 +0200)]
Consolidate LeafrefTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of a
leafref type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I39bd8f7520c4c1678725ab2dfb1d805fc07e8034
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate InstanceIdentifierTypeEffectiveStatementImpl 91/90891/4
Robert Varga [Thu, 2 Jul 2020 18:09:34 +0000 (20:09 +0200)]
Consolidate InstanceIdentifierTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an
instance-identifier type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I07db26a6e96a937c9335afe081d92441b29d3553
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate EnumTypeEffectiveStatementImpl 90/90890/4
Robert Varga [Thu, 2 Jul 2020 18:06:11 +0000 (20:06 +0200)]
Consolidate EnumTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an enum
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I756ee91f4ce9c9e846ee65afbc4629dd23668002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate DecimalTypeEffectiveStatementImpl 89/90889/5
Robert Varga [Thu, 2 Jul 2020 18:02:43 +0000 (20:02 +0200)]
Consolidate DecimalTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an decimal
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I352675843882b2fce414b10b58a38315c759278d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate BitsTypeEffectiveStatementImpl 88/90888/4
Robert Varga [Thu, 2 Jul 2020 17:59:18 +0000 (19:59 +0200)]
Consolidate BitsTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an bits
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I80bb47dd6b5aa77aad619c271cea70fdab2547d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate UnionTypeEffectiveStatementImpl 87/90887/4
Robert Varga [Thu, 2 Jul 2020 17:52:49 +0000 (19:52 +0200)]
Consolidate UnionTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an union
type, migrate it.

This was the last user of AbstractTypeStatementSupport, so remove
that, too.

JIRA: YANGTOOLS-1065
Change-Id: Ic69a9b4126062c06fe137c0b3144d431fd8124e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate IdentityrefTypeEffectiveStatementImpl 86/90886/4
Robert Varga [Thu, 2 Jul 2020 17:49:30 +0000 (19:49 +0200)]
Consolidate IdentityrefTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an identityref
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: Ibc13fff074cf7c4f597686f75ba55f65f6870ba1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate EmptyTypeEffectiveStatementImpl 85/90885/4
Robert Varga [Thu, 2 Jul 2020 17:46:43 +0000 (19:46 +0200)]
Consolidate EmptyTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an empty
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I9b77ce4b609f1624a18de97e3f3c6272ea22003b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate BooleanTypeEffectiveStatementImpl 84/90884/4
Robert Varga [Thu, 2 Jul 2020 17:43:56 +0000 (19:43 +0200)]
Consolidate BooleanTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of a boolean
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I24bc5fa4909710805d9503db69ed49f65878e1af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate BinaryTypeEffectiveStatementImpl 83/90883/4
Robert Varga [Thu, 2 Jul 2020 17:38:04 +0000 (19:38 +0200)]
Consolidate BinaryTypeEffectiveStatementImpl

Derived TypeEffectiveStatements follow an obvious pattern, where
we do not need to have specialized subclasses for each of them.

Introduce TypeEffectiveStatementImpl and migrate 'type binary' to
use it.

JIRA: YANGTOOLS-1065
Change-Id: I16c259718c3502d85ad0e77c5f612eb9d601d979
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate AbstractTypeStatementSupport 82/90882/5
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>
3 years agoSplit out AbstractTypeStatementSupport.resolveTypeReference() 81/90881/4
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>
3 years agoReuse common superclass for BuiltinTypeStatement 80/90880/4
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>
3 years agoMinimize AbstractTypeStatementSupport.internArgument() 78/90878/4
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>
3 years agoOptimize deviate statement implementations 77/90877/5
Robert Varga [Thu, 2 Jul 2020 15:21:06 +0000 (17:21 +0200)]
Optimize deviate statement implementations

deviate is a simple statement, optimize the memory layout of its
implementation classes.

JIRA: YANGTOOLS-1065
Change-Id: Ibffb49bca02952f685250d9b5a6a2cdf56966a7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoOptimize refine statement implementations 75/90875/4
Robert Varga [Thu, 2 Jul 2020 14:47:40 +0000 (16:47 +0200)]
Optimize refine statement implementations

refine is a simple statement, optimize the memory layout of its
implementation classes. Most of the benefits here are coming from
not needing to retain source/definition, but for simple refines
we can also skip a singleton list.

Also mark future direction for evolving the implementation contract,
as it has some aspects which are definitely not nice.

JIRA: YANGTOOLS-1065
Change-Id: Ic07ba74b0d2ea685a3ce8aed567a89125d04850e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoOptimize unique statement implementations 73/90873/3
Robert Varga [Thu, 2 Jul 2020 14:30:33 +0000 (16:30 +0200)]
Optimize unique statement implementations

unique is a simple statement, optimize the memory layout of its
implementation classes.

JIRA: YANGTOOLS-1065
Change-Id: Idccce468b38726ac25851b11352528c489e92b5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDeprecate UndeclaredEffectiveStatementBase for removal 74/90874/2
Robert Varga [Thu, 2 Jul 2020 14:35:55 +0000 (16:35 +0200)]
Deprecate UndeclaredEffectiveStatementBase for removal

We have a more powerful way of implementing implict statements
with AbstractUndeclaredEffectiveStatement, which does not require
storage of substatements.

Deprecate UndeclaredEffectiveStatementBase for removal and schedule
a FIXME for 6.0.0.

JIRA: YANGTOOLS-1065
Change-Id: Id0112c7bf9d0f99b37f825aa489924f966591b54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoOptimize if-feature statement implementations 72/90872/2
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>
3 years agoOptimize path statement implementations 71/90871/2
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>
3 years agoEliminate DeviateEffectiveStatementImpl.deviateType 76/90876/2
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>
3 years agoFurther optimize RevisionDateStatement implementations 68/90868/2
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>
3 years agoAdd BaseQNameStatementSupport.historyAndStatusFlags() 67/90867/3
Robert Varga [Thu, 2 Jul 2020 12:03:13 +0000 (14:03 +0200)]
Add BaseQNameStatementSupport.historyAndStatusFlags()

A number of subclasses are open-coding the same computation, let's
centralize it a bit.

Change-Id: I1ebbe63a16dcc876324960c2a11baca604476ba5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConvert UsesStatementSupport to BaseQNameStatementSupport 66/90866/2
Robert Varga [Thu, 2 Jul 2020 11:37:42 +0000 (13:37 +0200)]
Convert UsesStatementSupport to BaseQNameStatementSupport

Uses statement is a bit more complicated in its effective form,
hence we end up with four different implementations when we optimize
for size.

JIRA: YANGTOOLS-1065
Change-Id: I7f01ecd8277a042821cb5b37c0d9406a1e9204be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConvert bit statement 46/90846/3
Robert Varga [Wed, 1 Jul 2020 18:25:10 +0000 (20:25 +0200)]
Convert bit statement

Convert the mostly trivial case of bit statement, which can be easily
minimized.

Change-Id: I4b1041c3205034d28844be0e8faab5545006ea23
JIRA: YANGTOOLS-1065
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMark AbstractEffectiveDocumentedNode(WithStatus) evolution 44/90844/3
Robert Varga [Wed, 1 Jul 2020 17:17:04 +0000 (19:17 +0200)]
Mark AbstractEffectiveDocumentedNode(WithStatus) evolution

We want to eventually completely remove these classes, as they are
making SchemaNode assumptions. We already have a less stateful
replacement, which can be used when needed.

Change-Id: I4633ea8b2d1027eed34824fda524704bfdfc8828
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor PatternConstraintImpl 43/90843/4
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>
3 years agoConvert pattern statement 42/90842/3
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>
3 years agoRemove MaxElementsEffectiveStatementImpl 41/90841/2
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>
3 years agoConvert range statement 39/90839/2
Robert Varga [Wed, 1 Jul 2020 14:38:15 +0000 (16:38 +0200)]
Convert range statement

Convert the mostly trivial case of range statement, which can be easily
minimized.

We also terminally-deprecate AbstractListConstraintEffectiveStatement,
as it is no longer needed.

JIRA: YANGTOOLS-1065
Change-Id: I38c0583aaf46670639c4b8a5b9464113c0032bb4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConvert length statement 29/90829/11
Robert Varga [Tue, 30 Jun 2020 20:54:47 +0000 (22:54 +0200)]
Convert length statement

Convert the mostly trivial case of length statement, which can be easily
minimized.

JIRA: YANGTOOLS-1065
Change-Id: I4cdb6d80b2b9c71e493e9f145c87e2be9e25ef20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate Must/WhenStatementSupport to BaseStatementSupport 23/90823/9
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>
3 years agoConvert AbstractEnumStatementSupport 27/90827/6
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>
3 years agoConvert BaseStatementSupport 30/90830/4
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>
3 years agoConvert ArgumentStatementSupport 38/90838/3
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>
3 years agoConvert MaxElementsStatementSupport 36/90836/4
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>
3 years agoConvert AbstractIncludeStatementSupport 28/90828/4
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>
3 years agoConvert RevisionDateStatementSupport 25/90825/4
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>
3 years agoConvert ModifierStatementSupport 24/90824/3
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>
3 years agoRemove unneeded @NonNull annotations 37/90837/2
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>
3 years agoDisconnect StmtNamespaceContext from statement 14/90814/3
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>
3 years agoDo not retain namespace context when not needed 12/90812/3
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>
3 years agoEliminate use of ImmutableList 05/90805/2
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>
3 years agoFix javadoc to comply with JDK14 78/90778/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>
3 years agoAdd YangInstanceIdentifier.create(PathArgument) 98/90698/1
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>
3 years agoClean up AntlrXPathParser a bit 23/90623/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>
3 years agoUse ImmutableMap collector in EnumStringCodec 21/90621/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>
3 years agoFix reference to odl-antlr4 78/90578/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 agoDeprecate YangStatementStreamSource.getYangText() 22/90422/1
Robert Varga [Fri, 12 Jun 2020 08:07:59 +0000 (10:07 +0200)]
Deprecate YangStatementStreamSource.getYangText()

We do not need to leak this internal implementation detail,
remove is visibility.

Change-Id: I13be830b8dedff8478c9859cda2c6b1f44eabf31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSpeed up YangParser.addLibSource() 21/90421/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>
3 years agoAdd CrossSourceStatementReactor javadocs 19/90419/2
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>
3 years agoSpeed up YangParser.addSource() 20/90420/2
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>
3 years agoBump versions to 5.0.4-SNAPSHOT 63/90363/1
Robert Varga [Tue, 9 Jun 2020 22:33:39 +0000 (00:33 +0200)]
Bump versions to 5.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I95f22bc9119ddd26f6915b422cab6454b9febbe5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAllow list elements to be interleaved 75/90175/9
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>
3 years agoDeprecate ListEntryNodeDataWithSchema.forSchema() 49/90349/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>
3 years agoSplit out addCompositeChild(CaseSchemaNode) 46/90346/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>
3 years agoClean up variable initialization 45/90345/2
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>
3 years agoAdd YangInstanceIdentifier.coerceParent() 05/90305/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>
3 years agoAdd MultipleEntryDataWithSchema interface 01/90301/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>
3 years agoBump odlparent to 7.0.3 97/90297/1
Robert Varga [Fri, 5 Jun 2020 08:43:51 +0000 (10:43 +0200)]
Bump odlparent to 7.0.3

Pick up fixes from upstream.

Change-Id: I1865f70f06454920c2dd9d3d04146ab5ca52e5dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd test for union with identity XML codec issue 36/90236/6
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>
3 years agoCheck unions for instance-identifier types 52/90252/2
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>
3 years agoCheck unions for identityref types 50/90250/4
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>
3 years agoIssue a warning when we encounter a non-QName identityref 51/90251/5
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>
3 years agoSeparate out correct QName-bearing serialization method 49/90249/3
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>
3 years agoImprove error message in UnionXmlCodec 48/90248/2
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>