yangtools.git
8 years agoBUG-4803: optimize unordered cache 82/31782/3
Robert Varga [Tue, 22 Dec 2015 15:21:31 +0000 (16:21 +0100)]
BUG-4803: optimize unordered cache

This patch side-steps the need to perform kopu operations when the
offsets are already constructed. It also optimizes the number of
ImmutableSet instances present in the system.

Change-Id: I8a9b42e053d88c85bf5e75eb5a58da9bd08ce6d0
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: introduce unordered offset maps 26/31726/7
Robert Varga [Mon, 21 Dec 2015 18:42:25 +0000 (19:42 +0100)]
BUG-4803: introduce unordered offset maps

This patch introduces the static factories and methods which allow users
to select the appropriate implementation, either to retain or to ignore
iteration order.

Change-Id: I07dcf77927660461cbd266439463e8d64a1c89db
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: fix MutableOffsetMap's insertion order 25/31725/6
Robert Varga [Mon, 21 Dec 2015 17:06:55 +0000 (18:06 +0100)]
BUG-4803: fix MutableOffsetMap's insertion order

When a pairing backed by the array is removed, the order of pairings
would not follow the insertion order. This patch introduces an explicit
removal marker object and when the marker is present we defer to
newKeys map.

Change-Id: Ib27313e0df44754f5219d64126e0ec2a472a503f
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: invalidate cache before each test 66/31766/3
Robert Varga [Tue, 22 Dec 2015 11:04:10 +0000 (12:04 +0100)]
BUG-4803: invalidate cache before each test

Running tests will pollute the cache, so we need to clear it before each
test.

Change-Id: I0cc171c22409d81092d82d5570a3c0068bbfc889
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: introduce ordered/unordered offsets 11/31711/4
Robert Varga [Mon, 21 Dec 2015 14:46:21 +0000 (15:46 +0100)]
BUG-4803: introduce ordered/unordered offsets

This patch makes an explicit copy of the offset map, ensuring we do not
retain the input reference in copyOf(). We introduce two versions, one
for ordered and one for unordered maps.

This fixes ImmutableOffsetMap potentially not honoring the input
iteration order.

Change-Id: Iff835e2a5028c0dde6de2f39b298b7b4b334826a
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: make MutableOffsetMap abstract 05/31705/5
Robert Varga [Mon, 21 Dec 2015 14:16:34 +0000 (15:16 +0100)]
BUG-4803: make MutableOffsetMap abstract

We will need two implementations, one Ordered and Unordered, have make
the base class abstract and implement the Ordered version.

Change-Id: I26826c30470b47aba88ddfb106fd6e7afcd7f288
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: make ImmutableOffsetMap abstract 04/31704/4
Robert Varga [Mon, 21 Dec 2015 14:11:49 +0000 (15:11 +0100)]
BUG-4803: make ImmutableOffsetMap abstract

We will need two implementations, ordered and unordered. Make
ImmutableOffsetMap abstract and introduce the Ordered implementation.

Change-Id: I082512d71496c98e2ec3fd8b308ff897703ae01b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: make SharedSingletonMap abstract 03/31703/3
Robert Varga [Mon, 21 Dec 2015 13:26:43 +0000 (14:26 +0100)]
BUG-4803: make SharedSingletonMap abstract

SharedSingletonMap needs to have two implementations, ordered and
unordered. Start off with making the class abstract and introducing the
Ordered version.

Change-Id: Ide1c7abc533e925114fc9452adf04e9f5bd09091
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4803: fix equals() method 19/31519/5
Robert Varga [Thu, 17 Dec 2015 16:18:47 +0000 (17:18 +0100)]
BUG-4803: fix equals() method

The implementation required the map's ordering to be the same, which is
a violation of the Map contract.

Change-Id: I8f3308b9cabd5c011e7c2dadfe520407ad2c4672
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse QNameModule#intern() 96/31896/3
Robert Varga [Sat, 26 Dec 2015 16:07:30 +0000 (17:07 +0100)]
Use QNameModule#intern()

QNameModule#cachedReference() is deprecated, use #intern() instead.

Change-Id: Ic60eb4f3968f3e3251e2b798c385043a717c5089
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoMake BitImpl.unknownNodes final 20/32020/3
Robert Varga [Sat, 2 Jan 2016 15:36:31 +0000 (16:36 +0100)]
Make BitImpl.unknownNodes final

This field is really constant, so let's make it final and adjust
hashCode accordingly.

Change-Id: I598b238cadbe74102dcce6db9f7939080db98e92
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoLog attempts to override fraction-digits 18/32018/2
Robert Varga [Sat, 2 Jan 2016 15:07:00 +0000 (16:07 +0100)]
Log attempts to override fraction-digits

We should emit a warning when a model attempts to override
fraction-digits from a base type.

Change-Id: I2aa801288fff8894cc8b8afe22f27c19630e2331
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoUse a constant Charset 96/31996/3
Robert Varga [Sat, 2 Jan 2016 11:28:42 +0000 (12:28 +0100)]
Use a constant Charset

Instead of looking the charset up, use StandardCharsets.

Change-Id: I8d3b00f3472e1a82f705ecb4743b6122c45f752b
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoAdd raw type suppression 91/31991/2
Robert Varga [Sat, 2 Jan 2016 10:41:19 +0000 (11:41 +0100)]
Add raw type suppression

The builder cannot be parameterized without additional casts, add
warning suppression.

Change-Id: I8dab4e0b22143e23d9cfd97d816aca746c2a324e
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoClean codecs up 89/31989/3
Robert Varga [Sat, 2 Jan 2016 10:28:42 +0000 (11:28 +0100)]
Clean codecs up

Add markers for lookups which are not needed with new type
implementation. Also use preconditions instead of explicit if/throw
pairs. Eliminate unneded local variables.

Change-Id: Ifdce997d985276984311fd78c58277d5a1ea738d
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-865: deprecate XmlUtils.resolveBaseTypeFrom() 86/31986/3
Robert Varga [Sat, 2 Jan 2016 09:59:22 +0000 (10:59 +0100)]
BUG-865: deprecate XmlUtils.resolveBaseTypeFrom()

This method was needed with ExtendedType, which did not preserve the
identity of the type. Since the new parser uses yang.model.util.type,
performing an instanceof check on the type directly works as expected.

Change-Id: Ie31aea38cdd70857726e2df20f102a0c6648c11f
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoRemove unused writeElement variant 90/31990/2
Robert Varga [Sat, 2 Jan 2016 10:33:04 +0000 (11:33 +0100)]
Remove unused writeElement variant

TypeDefinition-enabled writeElemnent() is not used anywhere, removed it.

Change-Id: Icd98fed7a49522b95b26c5550c43a1199a9ce01d
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoClean GSON-based codec 88/31988/2
Robert Varga [Sat, 2 Jan 2016 10:06:22 +0000 (11:06 +0100)]
Clean GSON-based codec

Place a deprecation marker, make test methods static, reorder imports.

Change-Id: I0979f9f15d231debc53b978ef2534c2f3cf8f14e
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-865: deprecate publicly-visible constructor 87/31987/2
Robert Varga [Sat, 2 Jan 2016 10:04:32 +0000 (11:04 +0100)]
BUG-865: deprecate publicly-visible constructor

XmlStreamUtils should become a final class in the future, deprecate the
protected constructor so that we can remove it in the future.

Change-Id: I29d31e3b4e569ec80953b12cba9d1024c2298d30
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoDataTreeCandidateTip should be recursive 11/31911/3
Robert Varga [Mon, 28 Dec 2015 15:14:06 +0000 (16:14 +0100)]
DataTreeCandidateTip should be recursive

DataTreeCandidateTip#prepare() should return a DataTreeCandidateTip, not
just a DataTreeCandidate. This makes the operations equal to
TipProducingDataTree.

Change-Id: Ie49e6cd5c432c35067fa14ea76746f834a60d22e
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoClean SharedSchemaContextFactory up 08/31908/2
Robert Varga [Mon, 28 Dec 2015 09:46:21 +0000 (10:46 +0100)]
Clean SharedSchemaContextFactory up

Use ImmutableList, order imports, use explicit collection instantiation.

Change-Id: I037e0ee192d5e670bbbf4996a6a731efb7773df2
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoPre-size ArrayLists 07/31907/2
Robert Varga [Mon, 28 Dec 2015 09:01:52 +0000 (10:01 +0100)]
Pre-size ArrayLists

We know the number of elements which are going to be put into the lists,
make sure to size the lists appropriately.

Change-Id: I46346bb48cb6088358ec46b849a698fb2cea6693
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-865: deprecate SchemaContextHolder 02/32002/2
Robert Varga [Sat, 2 Jan 2016 13:24:40 +0000 (14:24 +0100)]
BUG-865: deprecate SchemaContextHolder

The interface is undocumented and barely implemented. It has the same
method as SchemaContextProvider (which is undocumented, too). Deprecate
it so the users use SchemaContextProvider instead.

Change-Id: I707affb449309260f6b8f83c4509cd5ec6510914
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-865: Deprecate org.opendaylight.yangtools.yang.data.impl.codec.xml.retest 92/31992/3
Robert Varga [Sat, 2 Jan 2016 10:46:12 +0000 (11:46 +0100)]
BUG-865: Deprecate org.opendaylight.yangtools.yang.data.impl.codec.xml.retest

This package should not have been introduced, deprecate it and schedule
for removal.

Change-Id: I9ed134227b439ebda9de5e8c5fefd28a42300cfb
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4861: Make FractionDigitsStatement#getValue() return an int 17/32017/2
Robert Varga [Sat, 2 Jan 2016 14:59:47 +0000 (15:59 +0100)]
BUG-4861: Make FractionDigitsStatement#getValue() return an int

@Nonnull with an Integer boils down to a simple int. Make users' life
easier.

Change-Id: I90faace6feb6bc5dea4dd6f1f375f44c6e7a8bf5
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4861: Make ValueStatement.getValue() return an int 16/32016/2
Robert Varga [Sat, 2 Jan 2016 14:55:44 +0000 (15:55 +0100)]
BUG-4861: Make ValueStatement.getValue() return an int

@Nonnull with an Integer equals to retuning an int.

Change-Id: I046a69a3d40e0f5028a3d4a5cda2724fb0c73019
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4861: Make PositionStatement.getValue() return a long 15/32015/2
Robert Varga [Sat, 2 Jan 2016 14:52:49 +0000 (15:52 +0100)]
BUG-4861: Make PositionStatement.getValue() return a long

@Nonnull with a Long means we can just use a long instance.

Change-Id: I33a8a500dca0dc279ae4227b24a0e766e1317a23
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4861: Make RequireInstanceStatement#getValue() return boolean 14/32014/2
Robert Varga [Sat, 2 Jan 2016 14:49:32 +0000 (15:49 +0100)]
BUG-4861: Make RequireInstanceStatement#getValue() return boolean

@Nonnull with Boolean means we can use a primitive boolean, make users'
life easier.

Change-Id: I42ec575484dcfd9c92781608b614634a03bc3939
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4861: Make YinElementStatement#getValue() return a boolean 13/32013/2
Robert Varga [Sat, 2 Jan 2016 14:46:55 +0000 (15:46 +0100)]
BUG-4861: Make YinElementStatement#getValue() return a boolean

@Nonnull wih a Boolean means we have to have a boolean anyway, so let's
return that, making users' life easier.

Change-Id: Ib1ac1addeedd46a39aae0bc6a34504c05c4fd1ef
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4861: Make ConfigStatement#value() return a boolean 12/32012/2
Robert Varga [Sat, 2 Jan 2016 14:41:54 +0000 (15:41 +0100)]
BUG-4861: Make ConfigStatement#value() return a boolean

@Nonnull Boolean is really a plain boolean. Make sure the API matches
that.

Change-Id: I4d1f0e9a3a6b1e059e1a10b5ac2206ad7e26c1f0
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4861: Add primitive type FIXMEs 11/32011/2
Robert Varga [Sat, 2 Jan 2016 14:30:01 +0000 (15:30 +0100)]
BUG-4861: Add primitive type FIXMEs

We return a @Nonnull object which corresponds to a primitive type. Add
FIXMEs to convert these into primitive types.

Change-Id: Ie1833c5bbe3d779a88e09b6f191a4e1b2ffbac72
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoClarify RevisionStatement having a non-null value 10/32010/1
Robert Varga [Sat, 2 Jan 2016 14:28:09 +0000 (15:28 +0100)]
Clarify RevisionStatement having a non-null value

Revision statement has to always have a proper value.

Change-Id: If9cda800db10b47da8bfb5ce659b721f984a1df1
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoClarify model.api.stmt Collection returns 09/32009/1
Robert Varga [Sat, 2 Jan 2016 14:25:59 +0000 (15:25 +0100)]
Clarify model.api.stmt Collection returns

All methods returning collections are @Nonnull.

Change-Id: I4ace46c144beff4bc2de95a9543bb1bb6cb3c803
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoRemove useless override 08/32008/1
Robert Varga [Sat, 2 Jan 2016 14:24:56 +0000 (15:24 +0100)]
Remove useless override

DataDefinitionStatement already provides getName() with the same
signature, remove unneeded overriden method.

Change-Id: I7dd9d56c90b089213e519cb69c1f22c81e1eaf7b
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoCleanup whitespace 07/32007/1
Robert Varga [Sat, 2 Jan 2016 14:15:44 +0000 (15:15 +0100)]
Cleanup whitespace

Remove unneeded empty lines, add new separators as needed.

Change-Id: I1504793bc7bbccd5c509907a9e0c4cd4fdd264ed
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4680: data tree-LeafRefValidatation string handling 64/30964/8
Filip.Gregor [Fri, 4 Dec 2015 09:48:45 +0000 (10:48 +0100)]
Bug 4680: data tree-LeafRefValidatation string handling

minor fix

Change-Id: Ie3e518542de28eac8ec1c335e9e8394b85bb0c03
Signed-off-by: Filip.Gregor <fgregor@cisco.com>
8 years agoBug 4654: Logging checker throws a NPE 98/31198/5
Filip.Gregor [Fri, 11 Dec 2015 12:28:06 +0000 (13:28 +0100)]
Bug 4654: Logging checker throws a NPE

fixed test, added invalid log msg

Change-Id: I8abd90d9e304829a989b110029d9fd8d062ca9fa
Signed-off-by: Filip.Gregor <fgregor@cisco.com>
8 years agoBug 4079: Unable to compile pattern defined in module 80/26080/14
Igor Foltin [Fri, 2 Oct 2015 11:46:24 +0000 (13:46 +0200)]
Bug 4079: Unable to compile pattern defined in module
          when using Unicode blocks

In the XML Schema specification, Unicode character blocks are
matched by "\p{Is...}", whereas Java expects "\p{In...}".
This change has been added and tested.

Fixed handling of possible false replacements.
The pattern is now compiled ahead of time.

Change-Id: I817e61c3f938166f8013e1733f7c7e4fb80faaf6
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoRevert "Do not retain HashMap$KeySet()" 11/31511/2
Maros Marsalek [Thu, 17 Dec 2015 14:33:26 +0000 (15:33 +0100)]
Revert "Do not retain HashMap$KeySet()"

Commit breaks equals() for NormalizedNodes, because the ordering
of child nodes is taken into account (which should not happen, since
child nodes are in a Map collection).

This reverts commit 2ba1793707e8cd44ed93d3f6100de2d9d6089d0c.

Change-Id: Ic26d40865d55b70c355e44c48ba5dee484874d6e
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
8 years agoBug 4646: Parser accepts invalid models 02/30202/13
Filip.Gregor [Wed, 25 Nov 2015 14:47:49 +0000 (15:47 +0100)]
Bug 4646: Parser accepts invalid models

fixed exceptions, reworked tests

Change-Id: I35941730696aa3f6563695e929ab9952d5551b3b
Signed-off-by: Filip.Gregor <fgregor@cisco.com>
8 years agoDo not retain HashMap$KeySet() 65/31365/3
Robert Varga [Tue, 15 Dec 2015 16:34:52 +0000 (17:34 +0100)]
Do not retain HashMap$KeySet()

This adds a defensive copy of the key set so we do not end up retaining
the original map via a view.

This patch also ensures that (Immutable)OffsetMap retain iteration order
across cache hits.

Change-Id: I1dfa8441093e289a207bd7a11b0a9299e2161d63
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4793: Fix CaseShorthandImpl#isConfiguration() 68/31468/3
Robert Varga [Wed, 16 Dec 2015 17:42:22 +0000 (18:42 +0100)]
BUG-4793: Fix CaseShorthandImpl#isConfiguration()

The shorthand case statement should defer to the statement which implied
it for isConfiguration(). Since we're here, make this
implementation-specific class package-private and final. Also eliminate
all the fields which should be proxied by the statement. Finally use
ImmutableSet/List for collections.

Change-Id: Ie832c2d27f9e3dbdc485c68fcfa1205e45a4afbd
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-865 Deprecated getQName in EnumPair. 79/30979/4
Tony Tkacik [Tue, 8 Dec 2015 13:30:22 +0000 (14:30 +0100)]
BUG-865 Deprecated getQName in EnumPair.

Change-Id: I9f2ed25b2000c2a28051fe06cba2e63c02afcc14
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 4610 - Do not create duplicate declared statements 88/31188/3
Peter Kajsa [Fri, 11 Dec 2015 09:41:35 +0000 (10:41 +0100)]
Bug 4610 - Do not create duplicate declared statements

Fix of instantiation logic such that we do not produce duplicate instances
of declared statements in the same schema context.

Change-Id: If264811825760ebb39a7c911e4c68ae58cc673b5
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBUG-865: deprecate concepts 40/31140/2
Robert Varga [Thu, 10 Dec 2015 13:23:08 +0000 (14:23 +0100)]
BUG-865: deprecate concepts

Deprecate unused/unworkable concepts.

Change-Id: I93d6e12e9d997f0c829c39fa98a5478d2d782954
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4684: prune WRITE operation children when ready 65/30265/3
Robert Varga [Thu, 26 Nov 2015 15:02:59 +0000 (16:02 +0100)]
BUG-4684: prune WRITE operation children when ready

When a DataTreeModification is ready, as part of the seal operation, we
squash any child operations into the written value.

This shifts the cost of performing this operation from the commit path
to the user path. It also prevents interactions with child operations
blowing up in min/max validation.

The validation problem remains if the parent operation is MERGE, as that
case requires current data tree state to be present. A subsequent patch
will provide a complete fix there.

Change-Id: I9c96a10fdf5301fc72cd67cefe222fac527a5673
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake ForwardingNormalizedNodeStreamWriters public 14/30914/1
Tomas Cere [Mon, 7 Dec 2015 16:03:44 +0000 (17:03 +0100)]
Make ForwardingNormalizedNodeStreamWriters public

Change-Id: I71544f115efcf8b6ebdc729bfa2c28e405782aae
Signed-off-by: Tomas Cere <tcere@cisco.com>
8 years agoRemove the use of ObjectCache 95/30895/2
Robert Varga [Mon, 7 Dec 2015 09:24:40 +0000 (10:24 +0100)]
Remove the use of ObjectCache

Short-circuit to the internal interner to keep the caching instances
unified.

Change-Id: I1cac0ba24dab64dd750b1471fc8edbfce4470b93
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRevert "Revert "Bug 3874: Support of yang modeled AnyXML - API"" 89/30889/1
Robert Varga [Mon, 7 Dec 2015 08:46:42 +0000 (09:46 +0100)]
Revert "Revert "Bug 3874: Support of yang modeled AnyXML - API""

This reverts commit 73d49d0ace358adba79a2567acea14e4bb076003.

Change-Id: I53a6d6721dc3b1dcb873191c21834baa1dc64f05
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRevert "Bug 3874: Support of yang modeled AnyXML - API" 68/30868/1
Robert Varga [Sun, 6 Dec 2015 10:35:16 +0000 (10:35 +0000)]
Revert "Bug 3874: Support of yang modeled AnyXML - API"

This reverts commit 2c1d8cbaeacc2a688db2034329bd972a3ef69e48. Downstream projects are not ready to receive it.

Change-Id: Ib2dac95f895bfb3eae49d15f6558ba850a8c06fb
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 3874: Support of yang modeled AnyXML - API 31/29731/13
Peter Kajsa [Mon, 23 Nov 2015 11:36:35 +0000 (12:36 +0100)]
Bug 3874: Support of yang modeled AnyXML - API

- created API and object structures for representation of yang modeled anyXml.

Change-Id: I64e61cf058d052a72b75085d816ce33f9e5f72c0
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4656 - Yang parser does not determine configuration true or false properly 93/30193/7
Peter Kajsa [Wed, 25 Nov 2015 12:20:31 +0000 (13:20 +0100)]
Bug 4656 - Yang parser does not determine configuration true or false properly

Yang parser does not determine configuration true or false properly,
especially for ChoiceCaseNode.

Change-Id: I86ce4831865f76f0808d554c917094416d4b6338
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBUG-4623: YangSyntaxErrorException depending of the restictions/extensions order... 30/29930/4
icaro.damiani [Wed, 11 Nov 2015 15:12:26 +0000 (13:12 -0200)]
BUG-4623: YangSyntaxErrorException depending of the restictions/extensions order for the String type

* Modified the string_restriction rule on the YangParser.g4 to allow any order of restictions/extensions.

Change-Id: I31240adbe34e7d8f1afb93683713f75bbd4d1d57
Signed-off-by: icaro.damiani <icaro.damiani@datacom.ind.br>
8 years agoFix ModuleIdentiferImpl.toString() 58/29558/5
Robert Varga [Wed, 11 Nov 2015 17:33:58 +0000 (18:33 +0100)]
Fix ModuleIdentiferImpl.toString()

Use formatted revision of the string to prevent wrong expansion of Date.

Change-Id: Ia317863931fd261b21c9c6daa74da329f0b2083d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4638: Convert to using new types 95/29695/44
Robert Varga [Sat, 14 Nov 2015 00:03:19 +0000 (01:03 +0100)]
BUG-4638: Convert to using new types

This patch switches the Lithium parser to use yang.model.util.type as
the underlying implementation of TypeDefinitions.

Change-Id: Idf18a95f268b41b7a6832db74289fa7dcd86bf06
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4684: Add strict internal consistency checks for min/max 47/30247/3
Robert Varga [Thu, 26 Nov 2015 13:42:58 +0000 (14:42 +0100)]
BUG-4684: Add strict internal consistency checks for min/max

We are still seeing problems with validation. Add debugs and Verify
checks to catch negative values. This will dump current and modification
state should we encounter a negative value for current nodes.

Change-Id: I3ab46a8f9d1442f5ad4f50ae8bb6d2bc17525d9b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoAdd to TreeNode.toString() 49/30249/3
Robert Varga [Thu, 26 Nov 2015 14:13:17 +0000 (15:13 +0100)]
Add to TreeNode.toString()

Taking a peek at the data tree nodes is useful for state transitions.
Teach SPI classes about toString().

Change-Id: I000ecc5520d138748a198aa4a0bfbfc5dd8b04bc
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse a Guava interner instead of ObjectCache 21/30321/2
Robert Varga [Sun, 29 Nov 2015 00:04:44 +0000 (01:04 +0100)]
Use a Guava interner instead of ObjectCache

The use of ObjectCache is equivalent to the use of an Interner. The only
difference are soft references -- and we actually want to use weak
references instead, anyway.

Change-Id: Iee6efb2fdef0b22ec5bdc8c633b9535bf7c16a85
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoPartially revert d7b76c5423e3130047f21f1485faf5b0393b2d98 20/30320/1
Robert Varga [Sat, 28 Nov 2015 23:56:10 +0000 (00:56 +0100)]
Partially revert d7b76c5423e3130047f21f1485faf5b0393b2d98

Change https://git.opendaylight.org/gerrit/26841 introduced a potential
memory use regression, where the QNameModule passed from user was
retained instead of a cached one.

Change-Id: I8fcc402f127df06cd777447d4eda1ee4768cc5c6
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4456 - StackOverflowError on recursive extension definition 00/28300/20
Peter Kajsa [Mon, 12 Oct 2015 15:23:50 +0000 (17:23 +0200)]
Bug 4456 - StackOverflowError on recursive extension definition

Parsing of yang model with direct or indirect recursive extension definition
causes StackOverflowError by the build of effective statements.
-minor foo.yang fix

Change-Id: I3bf1f7cc308389e8f5bfa03c7bf7fd4734014b19
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Filip.Gregor <fgregor@cisco.com>
8 years agoBug 4410: Loop in typedefs causes stack overflow 55/28555/11
Peter Kajsa [Mon, 19 Oct 2015 13:22:42 +0000 (15:22 +0200)]
Bug 4410: Loop in typedefs causes stack overflow

The following kind of loop in the typedefs causes stack overflow error during the compilation of the yang file:

    typedef foo {
     type bar;
    }

    typedef bar {
     type foo;
    }

The compiler should provide descriptive error message instead.

Change-Id: Ia752a7de4a6e1ec1c7018fadc1428845d820e390
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoUpgrade upstream versions 79/27579/11
Stephen Kitt [Tue, 29 Sep 2015 11:45:13 +0000 (13:45 +0200)]
Upgrade upstream versions

Where possible rely on odlparent:
* maven.javadoc.version
* Jacoco configuration
* xmlunit
* javassist
* xml-apis
* osgi-core
* javax.ws.rs-api
* reporting configuration

Update the following dependencies:
* maven-verifier 1.5 -> 1.6
* groovy 2.1.6 -> 2.4.5
* maven-core, maven-plugin-api 3.1.1 -> 3.3.3
* xtend 2.7.3 -> 2.8.4
* jersey-client 2.0 -> 2.22
* argparse4j 0.4.3 -> 0.6.0
* maven-plugin-annotations 3.2 -> 3.4
* maven-artifact 2.0 -> 3.3.3
* build-helper-maven-plugin 1.8 -> 1.9.1

Drop the equinoxSDK381:org.eclipse.osgi which appears to no longer be
necessary.

Drop third-party which is no longer used.

Change-Id: Iaae8b41eba4dce31ed02ccd4bd5716d9f9db79a3
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4375: Bump ANTLR to 4.5 or higher 72/28272/7
Igor Foltin [Mon, 12 Oct 2015 08:46:44 +0000 (10:46 +0200)]
Bug 4375: Bump ANTLR to 4.5 or higher

- switched antlr4-runtime in project dependencies to version 4.5.1
- removed antlr4-runtime-osgi-nohead from project dependencies

Change-Id: Id4054b0c842372d03368e95d8b19273ee3c091cc
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3874: Support of yang modeled AnyXML - Javadoc 71/30071/7
Peter Kajsa [Mon, 23 Nov 2015 11:27:42 +0000 (12:27 +0100)]
Bug 3874: Support of yang modeled AnyXML - Javadoc

- javadoc fixs necessary to successful maven build (Java 8)

Change-Id: I97a7bae4e747f02d2413eb98f1f1cc8001e37f4b
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBUG-4638: introduce CompatUtils 87/30087/1
Robert Varga [Mon, 23 Nov 2015 17:39:25 +0000 (18:39 +0100)]
BUG-4638: introduce CompatUtils

Create a CompatUtils class for dealing with downstream users, who rely
on the parser not generating a type encapsulation for leaf types which
also define the default value.

Change-Id: Ifabf6dc5415e8598727b5e0ab86b7127efd96beb
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoSimplify check for tree/node match 72/28672/4
Robert Varga [Wed, 21 Oct 2015 23:16:18 +0000 (01:16 +0200)]
Simplify check for tree/node match

The check can be inverted to check for:

All nodes belong in TreeType.OPERATIONAL. Nodes which are in
TreeType.CONFIGURATION return this as a property.

Which can be written as a simple expression. Also expand javadoc a bit.

Change-Id: Ie10d9b4bc3f9f1e2d08f592cfec1bf4bc92ea21b
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4658: fix default value in BooleanType 42/30042/5
Robert Varga [Sat, 21 Nov 2015 20:08:36 +0000 (21:08 +0100)]
BUG-4658: fix default value in BooleanType

The default value should be null. Also fix up an ancient test case. Also
fix leafref and identityref.

Change-Id: Ib82952493360bf24ac9db41814094e879ecda0b0
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4638: rework getBaseType() for derived types 31/29831/3
Robert Varga [Tue, 17 Nov 2015 20:52:12 +0000 (21:52 +0100)]
BUG-4638: rework getBaseType() for derived types

Returning a restricted type will confuse users, who expect to follow
the YANG-implied derivation rules, which rely on type specification -- a
concept we do not have. Until we have proper mapping, hide the existence
restricted types.

Change-Id: I2980e617b168b9ce48a0e60cd7264d4a803ac627
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4648: Fixed binary default value in old parser. 71/29971/1
Tony Tkacik [Fri, 20 Nov 2015 10:06:28 +0000 (11:06 +0100)]
Bug 4648: Fixed binary default value in old parser.

Change-Id: I3d4401aaddf5445f463a34683681646edb3098e2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBUG-4638: rename LeafTypes to ConcreteTypes 74/29874/2
Robert Varga [Wed, 18 Nov 2015 17:14:49 +0000 (18:14 +0100)]
BUG-4638: rename LeafTypes to ConcreteTypes

This performs a rename to ConcreteTypes, addressing the FIXME left in
DerivedTypes.

Change-Id: I93f2a174e0cf554d192018fdf5c8a83b768cfcbe
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4638: add more type checking methods 73/29873/2
Robert Varga [Wed, 18 Nov 2015 17:08:49 +0000 (18:08 +0100)]
BUG-4638: add more type checking methods

Update the both BaseTypes and DerivedTypes should have the uint
checkers, with the difference being that BaseTypes do not perform a
recursive lookup. That means that BaseTypes#isInt8() will return true
only for 'type int8;', not derived types.

Change-Id: I9c391e1f63c661e65c2e5d3a241465f1c326878d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4638: Implement enum build validation 70/29870/3
Robert Varga [Wed, 18 Nov 2015 15:06:23 +0000 (16:06 +0100)]
BUG-4638: Implement enum build validation

EnumPairs need to be validated fro conflicting values. Also, the parser
integration code needs to assign th eproper value.

Change-Id: I28a57656231b110110dff58ba69c57ec6d76e3c7
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4638: implement bits validation 63/29863/4
Robert Varga [Wed, 18 Nov 2015 14:49:46 +0000 (15:49 +0100)]
BUG-4638: implement bits validation

BitsType needs to validate

Change-Id: Ib648b33302bef5e475f3b26edd9f242fbfdb4560
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-865: mark yang-model-util types as deprecated 24/29724/5
Robert Varga [Sun, 15 Nov 2015 11:47:51 +0000 (12:47 +0100)]
BUG-865: mark yang-model-util types as deprecated

Having these classes out in the open creates confusion in users.
Deprecate them in favor of util.type.{Base,Derived,Restricted}Types(),
which do not leak implementation details.

Change-Id: Ib690a43d7e956e5ed0cac13a6276cb03fd049843
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoFilter non-Yang files when loading a directory 72/29872/2
Robert Varga [Wed, 18 Nov 2015 16:43:37 +0000 (17:43 +0100)]
Filter non-Yang files when loading a directory

If we happen to have a file in the directory, such as a vim buffer, the
test will fail. Make sure we load only files with .yang extension.

Change-Id: I8e8b0df8b34b93e9f4a1e863f95eef4bc779ba84
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix EnumEffectiveStatementImpl#getStatus() 69/29869/2
Robert Varga [Wed, 18 Nov 2015 16:27:54 +0000 (17:27 +0100)]
Fix EnumEffectiveStatementImpl#getStatus()

Status should default to CURRENT, e.g. we should never report it as
null.

Change-Id: I5741e4f65c0c254239851c83d79f094c540abaa0
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4638: create a dedicated exception for range/length validation 59/29759/10
Robert Varga [Mon, 16 Nov 2015 15:37:37 +0000 (16:37 +0100)]
BUG-4638: create a dedicated exception for range/length validation

Having only an IllegalArgumentException is not sufficient, create a pair
of new ones.

Change-Id: I90ac46ac55d9745651a8408398330a2a337d3f9a
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4645: Fixed binary default value. 51/29851/2
Tony Tkacik [Wed, 18 Nov 2015 12:48:37 +0000 (13:48 +0100)]
Bug 4645: Fixed binary default value.

Change-Id: Ic98b42f9923505631a558ea3971cfbc7776eafad
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBUG-4638: add utility check methods for base types 92/29792/3
Robert Varga [Tue, 17 Nov 2015 00:08:39 +0000 (01:08 +0100)]
BUG-4638: add utility check methods for base types

Some users, like the java binding, need to distriguish the various
integer base types in order to produce the correct type specification.
Add utility methods which check the concrete integer base type
(uint{8,16,32,64} and int{8,16,32,64}.

Change-Id: Idf4c71be6b135d68715fe095e1cc1f5033c4824c
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4638: do not rely on yang.model.util Types 89/29789/4
Robert Varga [Mon, 16 Nov 2015 22:59:28 +0000 (23:59 +0100)]
BUG-4638: do not rely on yang.model.util Types

Implementation and tests should not rely on a specific base type, but
should rather check for TypeDefinition interface.

Change-Id: Icd99b3f1f2c703a124c92169dbe60cabe2d2b797
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBug 4645: Fixed code-implied defaults. 49/29849/4
Tony Tkacik [Wed, 18 Nov 2015 11:44:01 +0000 (12:44 +0100)]
Bug 4645: Fixed code-implied defaults.

As turned out in parser some YANG types default values
were incorrectly hard-coded in code since Hydrogen
and were unnoticed till automated addition of
 default values in MD-SAL.

Change-Id: I1be1b8ec2358d794fa3ff51a71f392326271b55c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBUG-865: deprecated DataNodeContainer.getDataChildByName(String) 98/29498/2
Robert Varga [Tue, 10 Nov 2015 13:51:08 +0000 (14:51 +0100)]
BUG-865: deprecated DataNodeContainer.getDataChildByName(String)

This method cannot be implemented in a predictable way and the caller
needs to deal with QName ambiguity. Deprecate it, scheduling it for
later removal.

Change-Id: I708dcecf80a5e735410f3bbf5cd604ebd054b51d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4369: remove dependency on MDSAL components 49/29649/2
Robert Varga [Fri, 13 Nov 2015 13:51:51 +0000 (14:51 +0100)]
BUG-4369: remove dependency on MDSAL components

This removes the single integration test which required the API plugin
and eradicates all mentions of the mdsal project in yangtools.

Change-Id: I04d9d864b6dd0da5e4dc7829d975cf73707b5605
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 2496: Implement parser support for parsing YIN input 09/23409/26
Martin Ciglan [Tue, 3 Nov 2015 13:00:48 +0000 (14:00 +0100)]
Bug 2496: Implement parser support for parsing YIN input
          instead of YANG input

- redundant casting deleted
- code refactoring at various places
- various bug fix in YIN/YANG mutual code
- extensions namespace sorted out/ code review comments done
- fixed wildcard imports in unit test classes
- added new unit tests
- code changes based on code review
- refactored code
- set of YIN modules added for test
- TestUtils methods for YIN added

- types fix (mostly union affected)
- various bugs fixed, based on testing with huge set of YIN files (those not commited yet)

Change-Id: I9ebb60ecf596efe92c31f2ccc6a884c32c4c0a82
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
8 years agoBUG-4638: Implement length restrictions 56/28856/13
Robert Varga [Wed, 21 Oct 2015 08:39:00 +0000 (10:39 +0200)]
BUG-4638: Implement length restrictions

Change-Id: I0cf0357a7bd44c825eb8c202cb649e009a3a74c3
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4638: Split out Number comparator 85/28585/13
Robert Varga [Tue, 20 Oct 2015 09:47:46 +0000 (11:47 +0200)]
BUG-4638: Split out Number comparator

Comapring two Numbers of the same class is useful also for comparing
lengths. Split it out into utility methods.

Change-Id: I0203d191a7849b7485419a5ef9e32c0fef442ed3
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4638: Emit a warning when units are redefined 21/29721/3
Robert Varga [Sun, 15 Nov 2015 10:14:55 +0000 (11:14 +0100)]
BUG-4638: Emit a warning when units are redefined

While RFC6020 does not define whether units can be redefined, they are
bound to the value, hence it makes sense to inherit them just as default
value is inherited.

Change-Id: I8e57d961ee1f7bf34ada817dd55f95045da4bc9a
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4638: Introduce LeafTypeBuilders 17/29717/5
Robert Varga [Sun, 15 Nov 2015 01:18:34 +0000 (02:18 +0100)]
BUG-4638: Introduce LeafTypeBuilders

Leaves need to override units/default value of their type, but unlike
typedefs do not need retain their SchemaPath.

Change-Id: I4c0539983b0f5023bd57a98c57aca75ebc9975fb
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoShorted Decimal64Specification 09/29709/5
Robert Varga [Sat, 14 Nov 2015 21:06:50 +0000 (22:06 +0100)]
Shorted Decimal64Specification

Import Decimal64Specification directly.

Change-Id: Icb3d442331784c6d9704c124b3cff562b350fb75
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4638: Fix BaseTypes and DerivedTypes 94/29694/11
Robert Varga [Sat, 14 Nov 2015 00:04:02 +0000 (01:04 +0100)]
BUG-4638: Fix BaseTypes and DerivedTypes

Generics prevent proper call when dealing with wildcard arguments,
remove them from DerivedTypes.

BaseTypeBuilders should not leak the base types, as these are
package-private, but rather return a proper type definition.

Change-Id: Iacd97acbaf63896e8d7cd493d6a199d9c42501c4
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4629: cleanup YinSchemaSource 67/29567/4
Robert Varga [Wed, 11 Nov 2015 21:34:53 +0000 (22:34 +0100)]
BUG-4629: cleanup YinSchemaSource

This patch introduces Yang/YinSchemaSourceRepresentation, which mark
YANG and YIN schema sources irrespective of the format in which they are
available.

It then adds YimXmlSchemaSource, which allows access to YIN
representation as a javax.xml.transform.Source. Finally it deprecates
YinSchemaSource and provides a utility YinDomSchemaSource, which can
translate a YinXmlSchemaSource in the DOM representation.

Change-Id: I832b2f14637eeb3183c6fe3254f8129bccc0a7ba
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoMake a method static 47/29647/1
Robert Varga [Fri, 13 Nov 2015 12:50:11 +0000 (13:50 +0100)]
Make a method static

Private method can be made static, make it so.

Change-Id: I21950b4acd92cce20b66a22360285c4c166f519c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-865: deprecate DataTreeFactor.create() 40/29640/1
Robert Varga [Fri, 13 Nov 2015 11:24:18 +0000 (12:24 +0100)]
BUG-865: deprecate DataTreeFactor.create()

This method is provided for compatibility only and should be deprecated,
as the users do not know that they need to specify proper DataTreeType
to get config node enforcement.

Change-Id: I880c75fec2e4a28ae090016229415d0a676a657b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoPreserve augmentation order in module. 96/29596/1
Tony Tkacik [Thu, 12 Nov 2015 13:34:46 +0000 (14:34 +0100)]
Preserve augmentation order in module.

Change-Id: I5a868b7f2fa9a411d66f978784b3fdae2b52fe28
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 4454: Write to datastore: elements count error 99/28599/7
Filip Gregor [Tue, 10 Nov 2015 13:03:32 +0000 (14:03 +0100)]
Bug 4454: Write to datastore: elements count error

added check for write
added aditional tests
added childrenBefore counter check

Change-Id: I970272520a2c97210cf10a7ff4aa92adc8dc6b27
Signed-off-by: Filip.Gregor <fgregor@cisco.com>
8 years agoMake InMemorySchemaSourceCache expire items 81/29481/1
Robert Varga [Tue, 10 Nov 2015 10:02:37 +0000 (11:02 +0100)]
Make InMemorySchemaSourceCache expire items

We use the class only for ASTs. Caching them is good for periods of
parsing churn, such as startup, but the items should expire after not
being used for some time.

Change-Id: I38d95b62fd823906b851466c39429aaab7a72b56
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoEliminate qname field 72/29472/4
Robert Varga [Mon, 9 Nov 2015 22:41:55 +0000 (23:41 +0100)]
Eliminate qname field

The QName always matches the last component of the SchemaPath, hence
eliminate the dedicated field and use SchemaPath#getLastComponent().
Reduces memory footprint of SchemaContext instances by about 1%.

Change-Id: I676b6ef8cd61737b60e7ef7edd86c8210645efd2
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoSplit off DeclaredEffectiveStatementBase 69/29469/3
Robert Varga [Mon, 9 Nov 2015 21:28:38 +0000 (22:28 +0100)]
Split off DeclaredEffectiveStatementBase

Since we are retaining declared statements, which already capture
details from StmtContext, let's specialize a
DesclaredEffectiveStatementBase, which forwards calls to argument and
co. to the declared statement. Reduces memory footprint of
EffectiveSchemaContexts by about 3%.

Change-Id: Icbfa99db841f850c1048fbfe06618613230c2503
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoShare MandatoryStatement instances 65/29465/3
Robert Varga [Mon, 9 Nov 2015 18:46:03 +0000 (19:46 +0100)]
Share MandatoryStatement instances

Heap dump analysis shows we are wasting memory on MandatoryStatementImpl
instances which are empty. Fix this by creating two dedicated classes
which handle the 'mandatory true' and 'mandatory false' cases.

Same goes for MandatoryEffectiveStatementImpl, for which we provide an
alternative implementation, requiring an MandatoryEffectiveStatement
interface, so that it can be looked up.

Change-Id: If126c3b8d81ad4a870088285ff8956724b199134
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoLower SchemaPath#getPath() memory overhead 57/29457/4
Robert Varga [Mon, 9 Nov 2015 17:44:52 +0000 (18:44 +0100)]
Lower SchemaPath#getPath() memory overhead

Acquiring forward path involves performing a reverse() on an
ImmutableList -- which results in an proxy object being created.
Each such object costs 24 bytes, leading to ~120K wasted memory on a
freshly-booted up BGP+OF instance.

Eliminate this overhead by instantiating a temporary ArrayList and
copying its reverse view. This way only a single object is retained.

Change-Id: If3b193e84f0f7ffc17997360ae5b02669c119321
Signed-off-by: Robert Varga <rovarga@cisco.com>