yangtools.git
9 years agoBUG-2512: get rid of commons-io 73/16473/2
Robert Varga [Fri, 13 Mar 2015 10:44:35 +0000 (11:44 +0100)]
BUG-2512: get rid of commons-io

Guava/JDK give us everything we need, no need to have yet another
library in the dependencies.

Change-Id: I3f5e21a3b41bee099a13cb21e972ee4ddb77b77e
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-2352: Remove RestMessageTools 75/16475/2
Robert Varga [Fri, 13 Mar 2015 11:03:35 +0000 (12:03 +0100)]
BUG-2352: Remove RestMessageTools

This is a prototype implementation, whose sole method never worked.

Change-Id: Id7fa10ac7e541bac80173c40af3fd2b00e1586ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAdd ietf-interfaces to model. 48/16248/5
Deepthi V V [Tue, 10 Mar 2015 10:46:23 +0000 (16:16 +0530)]
Add ietf-interfaces to model.

ietf-interfaces is a standard ietf yang model. This will be used by
vpnservice project.

Signed-off-by: Deepthi V V <deepthi.v.v@ericsson.com>
Change-Id: I787e945a39417cc85c79b11cb28264b82cd168e6
Signed-off-by: Deepthi V V <deepthi.v.v@ericsson.com>
9 years agoBug 2287 - TypeProviderImpl retains empty HashMaps 77/13477/7
Ladislav Borak [Tue, 9 Dec 2014 11:32:24 +0000 (12:32 +0100)]
Bug 2287 - TypeProviderImpl retains empty HashMaps

Allocating default HashMaps is wasteful, especially if we end up not
storing anything in them. This fixes that case by making sure we
allocate a map only after we are sure we are going to put something into
it. Also be conservative about the size, so we do not waste too much
space.

Change-Id: I85ad1506e732a5c3728ef3529e7e0b5b430d758a
Signed-off-by: Ladislav Borak <lborak@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 2818: Updated implementation of parser."
Robert Varga [Thu, 12 Mar 2015 21:20:01 +0000 (21:20 +0000)]
Merge "Bug 2818: Updated implementation of parser."

9 years agoBug 2818: Updated implementation of parser. 12/16412/1
Tony Tkacik [Thu, 12 Mar 2015 20:00:08 +0000 (21:00 +0100)]
Bug 2818: Updated implementation of parser.

Moved special-case handling from nested classes up
to main parse cycle, which simplifies code. Also
added additional test, which tests behaviour
according the draft-lhotka.

Change-Id: I79bfa62221a6bbe914158b0fae3f51f4571ff9dd
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Eliminate all trailing whitespace in xtend"
Tony Tkacik [Thu, 12 Mar 2015 17:10:46 +0000 (17:10 +0000)]
Merge "Eliminate all trailing whitespace in xtend"

9 years agoMerge "Make sure we do not generate trailing whitespace"
Tony Tkacik [Thu, 12 Mar 2015 17:10:41 +0000 (17:10 +0000)]
Merge "Make sure we do not generate trailing whitespace"

9 years agoMerge "Bug 2818: Introduced optional array for parsing root list items."
Robert Varga [Thu, 12 Mar 2015 17:10:21 +0000 (17:10 +0000)]
Merge "Bug 2818: Introduced optional array for parsing root list items."

9 years agoEliminate all trailing whitespace in xtend 03/16403/2
Robert Varga [Thu, 12 Mar 2015 16:44:31 +0000 (17:44 +0100)]
Eliminate all trailing whitespace in xtend

The API generator output should not contain trailing whitespace --
cleanup the templates to make sure we do not pollute output.

Change-Id: Ia312d1e2a0218a51eac42a62446bb6af63d69ee6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMake sure we do not generate trailing whitespace 02/16402/2
Robert Varga [Thu, 12 Mar 2015 16:42:08 +0000 (17:42 +0100)]
Make sure we do not generate trailing whitespace

If we get an empy line in description, it is possible for us to generate
trailing whitespace. Make sure we don't do that and also clean any
trailing whitespace from the source file itself.

Change-Id: I8ea20c92cce5a6dccc1c107af97b959af4264f84
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2818: Introduced optional array for parsing root list items. 05/16405/1
Tony Tkacik [Thu, 12 Mar 2015 16:44:21 +0000 (17:44 +0100)]
Bug 2818: Introduced optional array for parsing root list items.

Specification draft-lhotka-netmod-yang-json-02 clearly
specifies that list must be serialized as array of objects,
but currently only user of yang-json is
draft-bierman-netconf-restconf-02, which specifies
and provides example where such list exists are also used
without arrays when parsing.

Introduced support for this case (and unit test),
in order to interoperate with clients, which follows
serialization as was provided in examples of restconf.

Change-Id: I4ebf7cfba17752de2184e9b7ac1d18c1ecac6f80
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Bug 2248 - mvn clean install is failing due to checkstyle"
Robert Varga [Thu, 12 Mar 2015 14:50:26 +0000 (14:50 +0000)]
Merge "Bug 2248 - mvn clean install is failing due to checkstyle"

9 years agoMerge "Fixed generation of UnionBuilders for anonymous unions."
Robert Varga [Thu, 12 Mar 2015 14:47:15 +0000 (14:47 +0000)]
Merge "Fixed generation of UnionBuilders for anonymous unions."

9 years agoIntroduction of more powerful binding codec APIs 64/15964/6
Tony Tkacik [Tue, 3 Mar 2015 11:06:31 +0000 (12:06 +0100)]
Introduction of more powerful binding codec APIs

Introduces new more expresive APIs, which allows
user to customize serialization / deserialization.

Introduced new concepts:

 - Subtree codecs
    - Tree and cursor based APIs for locating subtree
 - Caching Codec - codec which uses cache for serialization

Change-Id: If4868c9cd20c56d2ce0498bd2ded90b1265f7b67
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoFixed generation of UnionBuilders for anonymous unions. 90/16390/2
Tony Tkacik [Thu, 12 Mar 2015 13:27:22 +0000 (14:27 +0100)]
Fixed generation of UnionBuilders for anonymous unions.

Change-Id: I18e90e7d7227efe31767734df1ce525df60104d5
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 2248 - mvn clean install is failing due to checkstyle 53/12953/13
Ladislav Borak [Thu, 11 Dec 2014 12:07:59 +0000 (13:07 +0100)]
Bug 2248 - mvn clean install is failing due to checkstyle

- added check in BaseTemplate.imports() if imported type has same package
  as generated type

Change-Id: Ifefb4be88c145aa222541cbb901aa9cab63b510d
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBUG-1513: make sure client code remains compatible 38/16338/1
Robert Varga [Wed, 11 Mar 2015 16:39:18 +0000 (17:39 +0100)]
BUG-1513: make sure client code remains compatible

This updates the single implementation of ChoiceNode so that it
implements the legacy interface, too -- thus instanceof checks will
continue to work.

Change-Id: Iea9938ac434d5a07891ab24cef0193b7261783ee
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1513: finish migration of ChoiceNodes 06/16306/1
Robert Varga [Wed, 11 Mar 2015 09:21:42 +0000 (10:21 +0100)]
BUG-1513: finish migration of ChoiceNodes

This migrates the leftover users to make them work correctly.

Change-Id: I134c82d29a6b192455f670d2f1a9477a688fff25
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1513: introduce ChoiceSchemaNode 70/16270/7
Robert Varga [Tue, 10 Mar 2015 12:03:32 +0000 (13:03 +0100)]
BUG-1513: introduce ChoiceSchemaNode

This introduces the alternative name, which does not clash with
yang-data-api. Also deprecated ChoiceNode.

Change-Id: I42e93c45804dc8e3952d08c697f772d776c303c3
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Migrate to BasicGenerator"
Tony Tkacik [Tue, 10 Mar 2015 19:50:08 +0000 (19:50 +0000)]
Merge "Migrate to BasicGenerator"

9 years agoMerge "BUG 2282 - JSON top level element without module name"
Tony Tkacik [Tue, 10 Mar 2015 19:30:59 +0000 (19:30 +0000)]
Merge "BUG 2282 - JSON top level element without module name"

9 years agoBUG 2282 - JSON top level element without module name 68/12668/9
Jozef Gloncak [Mon, 3 Nov 2014 15:02:54 +0000 (16:02 +0100)]
BUG 2282 - JSON top level element without module name

Json top level element now doesn't have to contain module name prefix.

If namespace of some child element was changed and only one child with
specified name exist in schema then its namespace is used by default.

If more then one potential child in various namespaces exists then
exception is raised. Exception is also raised if no such element as
specified in JSON input exists in YANG schema.

Change-Id: I8a38fde4f2e9b79562f6bf7c79acafd51c7bff32
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
(cherry picked from commit 6eee2a1ce9e69a7b653a7b4427573eff67588d1f)

9 years agoMigrate to BasicGenerator 80/16280/2
Robert Varga [Tue, 10 Mar 2015 16:33:49 +0000 (17:33 +0100)]
Migrate to BasicGenerator

This is just a documentation reference, so update it to the new
interface.

Change-Id: Ia21b0ea89f4fc478695555f65983b964ed908ba7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Remove unneeded annontation"
Tony Tkacik [Tue, 10 Mar 2015 15:27:32 +0000 (15:27 +0000)]
Merge "Remove unneeded annontation"

9 years agoMerge "Fix a generic warning"
Tony Tkacik [Tue, 10 Mar 2015 15:27:24 +0000 (15:27 +0000)]
Merge "Fix a generic warning"

9 years agoMerge "Execute yang-maven-plugin"
Tony Tkacik [Tue, 10 Mar 2015 15:27:17 +0000 (15:27 +0000)]
Merge "Execute yang-maven-plugin"

9 years agoRemove unneeded annontation 69/16269/1
Robert Varga [Tue, 10 Mar 2015 14:49:27 +0000 (15:49 +0100)]
Remove unneeded annontation

Change-Id: I7886d28fcaee4e7e8563dc8f9f15a92bd7054b06
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix a generic warning 68/16268/1
Robert Varga [Tue, 10 Mar 2015 14:47:32 +0000 (15:47 +0100)]
Fix a generic warning

Add generic arguments to fix a warning.

Change-Id: I249258370efe32d26189cf236818c483b8f0d915
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAdd support for attributes int NN stream writer(list entry) 58/16258/1
Maros Marsalek [Tue, 10 Mar 2015 10:50:10 +0000 (11:50 +0100)]
Add support for attributes int NN stream writer(list entry)

Change-Id: I2191ea7809c5b914b982f8514eda5952b3659e7d
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoExecute yang-maven-plugin 67/16267/1
Robert Varga [Tue, 10 Mar 2015 12:06:03 +0000 (13:06 +0100)]
Execute yang-maven-plugin

This eases integration with eclipse, as we should be interacting with it
well now.

Change-Id: I31832abf40e6965b846beaa762a91c2a888c5b57
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAnyXml NormalizedNode wraps a DOMSource value 51/16251/2
Maros Marsalek [Thu, 5 Mar 2015 14:07:27 +0000 (15:07 +0100)]
AnyXml NormalizedNode wraps a DOMSource value

Instead of wrapping a CompositeNode, a DOM source is used as inner value for
AnyXml. XML -> NormalizedNode parser was updated as well as NormalizedNode ->
XML stream writer.

Change-Id: Ide51b2a08969a65d492c18f4b594e7559fee5844
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoAdd support for attributes int NN stream writer 50/16250/2
Maros Marsalek [Tue, 10 Mar 2015 10:50:10 +0000 (11:50 +0100)]
Add support for attributes int NN stream writer

Change-Id: I51dc747763a65dee5145a33657eaf7223945d096
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoMerge "Bug 2766: Fixed parsing and serializing XPath Instance Identifiers"
Robert Varga [Mon, 9 Mar 2015 09:18:02 +0000 (09:18 +0000)]
Merge "Bug 2766: Fixed parsing and serializing XPath Instance Identifiers"

9 years agoIntroduced MethodHandle based invokers for Notification and RPCs 93/16093/3
Tony Tkacik [Thu, 5 Mar 2015 21:04:43 +0000 (22:04 +0100)]
Introduced MethodHandle based invokers for Notification and RPCs

This invokers are used to provide genereralized access to any
generated callback / rpc method using one approach for
any RPC.

Change-Id: I4d6ce7c71f658b5e2c6e805479aa47a8f09fb989
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 2766: Fixed parsing and serializing XPath Instance Identifiers 00/15900/8
Tony Tkacik [Mon, 2 Mar 2015 13:39:49 +0000 (14:39 +0100)]
Bug 2766: Fixed parsing and serializing XPath Instance Identifiers

Original implementation of Instance Identifier codec used
Splitters which did not have enough information to determine
that '/' is used in string literals.

Fortunatelly Instance Identifier is only very constrained
subset of XPath, so it was still possible to reimplement
correct token-based parser using Guava.

Other problem fixed with  parsing instance identifiers was
that YangInstanceIdentifier also contained components,
which are not present in XML / JSON serialization.

Change-Id: I4186f59f8e16c92eb2e0ca2bc0a6c12e7215a3be
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Revert "AnyXml NormalizedNode wraps a DOMResult value""
Tony Tkacik [Sun, 8 Mar 2015 11:53:14 +0000 (11:53 +0000)]
Merge "Revert "AnyXml NormalizedNode wraps a DOMResult value""

9 years agoRevert "AnyXml NormalizedNode wraps a DOMResult value" 69/16169/1
Tony Tkacik [Sun, 8 Mar 2015 11:39:33 +0000 (11:39 +0000)]
Revert "AnyXml NormalizedNode wraps a DOMResult value"

This reverts commit c5bde84eced27e2d073554420c3f47eca85af32c.

Commit was merged before clients were able to migrate.

Change-Id: I7ab48a36f5dbbd52e8b91be8ea049b72a776ea15
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Make sure maven artifacts are provided"
Tony Tkacik [Sun, 8 Mar 2015 10:37:21 +0000 (10:37 +0000)]
Merge "Make sure maven artifacts are provided"

9 years agoMerge "Remove unnecessary casts"
Tony Tkacik [Sun, 8 Mar 2015 10:37:07 +0000 (10:37 +0000)]
Merge "Remove unnecessary casts"

9 years agoMerge "Remove unnecessary casts"
Tony Tkacik [Sun, 8 Mar 2015 10:36:48 +0000 (10:36 +0000)]
Merge "Remove unnecessary casts"

9 years agoMerge "Remove unnecessary casts"
Tony Tkacik [Sun, 8 Mar 2015 10:36:37 +0000 (10:36 +0000)]
Merge "Remove unnecessary casts"

9 years agoMerge "Do not rely on transitive dependencies"
Tony Tkacik [Sun, 8 Mar 2015 10:36:28 +0000 (10:36 +0000)]
Merge "Do not rely on transitive dependencies"

9 years agoAnyXml NormalizedNode wraps a DOMResult value 84/16084/4
Maros Marsalek [Thu, 5 Mar 2015 14:07:27 +0000 (15:07 +0100)]
AnyXml NormalizedNode wraps a DOMResult value

Instead of wrapping a CompositeNode, a DOM result is used as inner value for
AnyXml. XML -> NormalizedNode parser was updated as well as NormalizedNode ->
XML stream writer.

Change-Id: I8cb6875bf395385d0f10d16d5e9d7361e9172e5a
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoPreserve backwards compatibility in DomToNormalizedNodeParserFactory 29/16129/2
Maros Marsalek [Fri, 6 Mar 2015 08:21:57 +0000 (09:21 +0100)]
Preserve backwards compatibility in DomToNormalizedNodeParserFactory

Restore the former constructor with only CodecProvider but make it deprecated

Change-Id: I1cd9c9af4ac16baa228503fb125a587614a52d2e
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoMake sure maven artifacts are provided 79/16079/1
Robert Varga [Thu, 5 Mar 2015 13:38:46 +0000 (14:38 +0100)]
Make sure maven artifacts are provided

We expect these to be provided, not brought in explicitly.

Change-Id: I36d86f4c8beea33d6f279ba8986d1e987efe514d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove unnecessary casts 78/16078/1
Robert Varga [Thu, 5 Mar 2015 13:30:24 +0000 (14:30 +0100)]
Remove unnecessary casts

xtend 2.7.x makes instanceof check an implicit cast for subsequent
variable usage, so these generate warnings. Also remove use of
deprecated types and speed up stringuilder usage by passing characters
instead of strings where possible.

Change-Id: I3131166a2fedf09743e6baf4159ba15357a37993
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove unnecessary casts 77/16077/1
Robert Varga [Thu, 5 Mar 2015 13:30:02 +0000 (14:30 +0100)]
Remove unnecessary casts

xtend 2.7.x makes instanceof check an implicit cast for subsequent
variable usage, so these generate warnings.

Change-Id: I88f7b68cd2fdddf0bb39c2bbc8f2c8533de22006
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove unnecessary casts 76/16076/1
Robert Varga [Thu, 5 Mar 2015 13:28:51 +0000 (14:28 +0100)]
Remove unnecessary casts

xtend 2.7.x makes instanceof check an implicit cast for subsequent
variable usage, so these generate warnings.

Change-Id: Ic28a868eeef8167a1f7e8b3946c2ea13526818dc
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDo not rely on transitive dependencies 75/16075/1
Robert Varga [Thu, 5 Mar 2015 13:00:23 +0000 (14:00 +0100)]
Do not rely on transitive dependencies

Maven core and build API should have scope=provided.

Change-Id: Id34b075fb92247507a61b79daee6c4ab73647f53
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoXML -> NormalizedNodes parser identity-ref/instance-id/leafref support 21/16021/2
Maros Marsalek [Wed, 4 Mar 2015 14:08:33 +0000 (15:08 +0100)]
XML -> NormalizedNodes parser identity-ref/instance-id/leafref support

The parsers now pars leaves of mentioned types properly.

Change-Id: I73e07079e27005dd2c22c239da6f81bdd2ef43a1
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoAdd AnyXml support to NormalizedNode parser 77/15977/2
Maros Marsalek [Tue, 3 Mar 2015 15:37:40 +0000 (16:37 +0100)]
Add AnyXml support to NormalizedNode parser

Change-Id: Iea8d1f8ba29788118a4fc44f8ed71fd759373e49
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoMerge "Remove unneeded build declarations in features"
Tony Tkacik [Wed, 4 Mar 2015 11:00:12 +0000 (11:00 +0000)]
Merge "Remove unneeded build declarations in features"

9 years agoAdd rpc support to NormalizedNode writers 76/15976/1
Maros Marsalek [Tue, 3 Mar 2015 15:37:19 +0000 (16:37 +0100)]
Add rpc support to NormalizedNode writers

Change-Id: Id306a397351e35ff8b86d967d219ed37f98a3648
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoRemove unneeded build declarations in features 58/15858/2
Robert Varga [Sun, 1 Mar 2015 09:03:54 +0000 (10:03 +0100)]
Remove unneeded build declarations in features

features-parent defines all the things we need, so the entire build
section can go.

Change-Id: I90f061cd2b01471714738166d5d4c3662513a8a7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAdd more NormalizedNodes.findNode() alternatives 91/15891/4
Robert Varga [Mon, 2 Mar 2015 10:17:05 +0000 (11:17 +0100)]
Add more NormalizedNodes.findNode() alternatives

In some calling contexts we already have an optional and/or do not have
the path encapsulated in YangInstanceIdentifier.

Change-Id: I87ddbefb2e8c36ccff26a35c24d0b01644a2d1e9
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoUse Collection.size() instead of Iterables.size() 53/15853/2
Robert Varga [Sat, 28 Feb 2015 21:03:00 +0000 (22:03 +0100)]
Use Collection.size() instead of Iterables.size()

Now that NormalizedNodeContainer returns a Collection of children, we
can use its size() method directly, speeding things up just a little
bit.

Change-Id: I7b336d0029084140ea853716a38f8abb87da7c26
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Make sure NormalizedNodeContainer uses Collection"
Tony Tkacik [Mon, 2 Mar 2015 14:28:45 +0000 (14:28 +0000)]
Merge "Make sure NormalizedNodeContainer uses Collection"

9 years agoMerge "DataContainerNodeBuilder should take a Collection"
Tony Tkacik [Mon, 2 Mar 2015 14:28:35 +0000 (14:28 +0000)]
Merge "DataContainerNodeBuilder should take a Collection"

9 years agoMerge changes Ie600f25f,I99deeb57,I63bddcfe
Tony Tkacik [Sun, 1 Mar 2015 14:52:29 +0000 (14:52 +0000)]
Merge changes Ie600f25f,I99deeb57,I63bddcfe

* changes:
  Cap LazyCollections list
  Introduce UnmodifiableCollection
  Expand known immutables

9 years agoMerge topic 'stable/helium'
Tony Tkacik [Sun, 1 Mar 2015 14:52:03 +0000 (14:52 +0000)]
Merge topic 'stable/helium'

* changes:
  Optimize getChild()
  Fix OrderedNodeContainer javadoc
  Fix ImmutableOrderedLeafSetNode.size()
  Fix EmptyImmutableUnkeyedListNode.getChild()

9 years agoMake sure NormalizedNodeContainer uses Collection 52/15852/1
Robert Varga [Sat, 28 Feb 2015 09:01:11 +0000 (10:01 +0100)]
Make sure NormalizedNodeContainer uses Collection

Instead of an Iterable, specify a collection, as that makes the number
of elements known.

Change-Id: Ifa6260ebe157c9afde49bbb58043d6ec2fecd189
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDataContainerNodeBuilder should take a Collection 31/15831/2
Robert Varga [Fri, 27 Feb 2015 18:17:57 +0000 (19:17 +0100)]
DataContainerNodeBuilder should take a Collection

List is too specific a collection to pass down into the builder. We care
only for it be Iterable, so a Collection is a reasonable middle ground.

Change-Id: Ifa3b455df76e7abd4ede387f67d2d8fcabd41545
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoCap LazyCollections list 51/15851/1
Robert Varga [Sat, 28 Feb 2015 08:58:57 +0000 (09:58 +0100)]
Cap LazyCollections list

When we move from a singleton to an ArrayList, specify the size as 2, as
the arraylist can grow beyond that, but will not waste space if it
remains at two elements.

Change-Id: Ie600f25f9e59aa5321f335b380d6d6930e4492ee
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoIntroduce UnmodifiableCollection 50/15850/1
Robert Varga [Sat, 28 Feb 2015 17:51:29 +0000 (18:51 +0100)]
Introduce UnmodifiableCollection

This is a utility class which recognizes itself and Guava's
ImmutableCollection subclasses during contruction, preventing unneeded
encapsulation.

Change-Id: I99deeb570a74ecee5f0bb8a89c25b363284e5f6e
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoExpand known immutables 49/15849/1
Robert Varga [Sat, 28 Feb 2015 09:00:23 +0000 (10:00 +0100)]
Expand known immutables

Void and Boolean are immutable types, too. Also use ImmutableSet instead
of a hown-grown utility.

Change-Id: I63bddcfe5a8538065378a2259bf8bdc58f76d620
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoOptimize getChild() 48/15848/1
Robert Varga [Sat, 28 Feb 2015 20:22:00 +0000 (21:22 +0100)]
Optimize getChild()

The classes are so they can access children directly. This saves
instantiation of unmodifiable view and checks related to that.

Change-Id: Ia16373c92401c4b9d0dca61a0b5c5b491fc3f2e1
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix OrderedNodeContainer javadoc 47/15847/1
Robert Varga [Sat, 28 Feb 2015 20:27:59 +0000 (21:27 +0100)]
Fix OrderedNodeContainer javadoc

Documents the generic argument and fixes a typo.

Change-Id: Ibd00a95df9ea86acfd0d67f57d8adfca6f611f27
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix ImmutableOrderedLeafSetNode.size() 46/15846/1
Robert Varga [Sat, 28 Feb 2015 20:29:22 +0000 (21:29 +0100)]
Fix ImmutableOrderedLeafSetNode.size()

The method always returned 0, which seems to have been missed.

Change-Id: Icdc8ec423aabd3cf7dc163670de6929d63bff3be
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix EmptyImmutableUnkeyedListNode.getChild() 45/15845/1
Robert Varga [Sat, 28 Feb 2015 20:47:24 +0000 (21:47 +0100)]
Fix EmptyImmutableUnkeyedListNode.getChild()

The interface contract states that we should throw
IndexOutOfBoundsException rather than returning null.

Change-Id: Ia1186a925dfe2b4e7bc89b92be4239f10b693f4e
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove unneeded dependencies 39/15539/5
Robert Varga [Fri, 20 Feb 2015 11:34:41 +0000 (12:34 +0100)]
Remove unneeded dependencies

slf4j bridge should no longer be necessary, so remove it, along with
dependencyManagement override.

Change-Id: Ia8035c7167a46c30142a643d094b3a6a1f19ee03
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoIntroduce ImmutableNodes.choiceNode() 21/15821/1
Robert Varga [Fri, 27 Feb 2015 12:04:22 +0000 (13:04 +0100)]
Introduce ImmutableNodes.choiceNode()

This is a convenience method, just like containerNode().

Change-Id: I984e31b56b2d8faaeab6db0634f34583434e294f
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 2539: Properly report incorrect Instance Identifiers"
Tony Tkacik [Thu, 26 Feb 2015 15:36:36 +0000 (15:36 +0000)]
Merge "Bug 2539: Properly report incorrect Instance Identifiers"

9 years agoMerge "Fix ImmutableNodes.containerNode()"
Tony Tkacik [Thu, 26 Feb 2015 15:34:55 +0000 (15:34 +0000)]
Merge "Fix ImmutableNodes.containerNode()"

9 years agoBug 2539: Properly report incorrect Instance Identifiers 82/15782/1
Tony Tkacik [Mon, 19 Jan 2015 14:24:12 +0000 (15:24 +0100)]
Bug 2539: Properly report incorrect Instance Identifiers

Binding Data Codec throws IllegalArgumentException
with description for incorrect instance identifiers
instead of generic NullPointerExceptions.

Change-Id: Ia47c83925a18f029c70b2816e2fcb58632027e3c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG 1975 - yang unkeyed list is transformed to map node 89/11489/13
Jozef Gloncak [Tue, 23 Sep 2014 13:21:21 +0000 (15:21 +0200)]
BUG 1975 - yang unkeyed list is transformed to map node

Parsers and serializer for base, for concrete DOM type and
for composite node structure to normalized node conversion
were added/modified to make it possible parse|serialize
unkeyed list to|from UnkeyedListNode and parse
OrderedListNode.

yang-data-operations artifact - was added UnkeyedListNodeModification
class to handle cases when unkeyed list is loaded
from input stream

Change-Id: Ia3a9554dea00bb9d424495a2b6ed1f96765be738
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
(cherry picked from commit 13b0a924410d92a6d49182161d54cf2cdc50ad56)

9 years agoFix ImmutableNodes.containerNode() 78/15778/1
Robert Varga [Thu, 26 Feb 2015 14:04:15 +0000 (15:04 +0100)]
Fix ImmutableNodes.containerNode()

Down-casting to a NormalizedNode<?, ?> prevents the resulting container
from being useful as a child.

Change-Id: Ie426685091a55eb6d3770c127d8685c74f66d045
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge changes I4f081454,Ibe6f283d,I83acfee3,If7a08ff1,Ia0f847dd, ...
Tony Tkacik [Thu, 26 Feb 2015 08:29:44 +0000 (08:29 +0000)]
Merge changes I4f081454,Ibe6f283d,I83acfee3,If7a08ff1,Ia0f847dd, ...

* changes:
  Spellcheck AugmentableDataNodeContainerEmitterSource
  Use simple string concat in DataObjectSerializerSource
  Fix BindingNormalizedNodeCodecRegistry thread safety
  Compact BitsCodec
  Do not declare Exception as thrown
  DataContainerCodecPrototype should be final
  Fix code alignment

9 years agoFix array validation 63/15763/3
Robert Varga [Thu, 26 Feb 2015 06:12:03 +0000 (07:12 +0100)]
Fix array validation

BGP unit tests show up a failure involving byte[] keys:

org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.valid.DataValidationException$IllegalListKeyException: Illegal value for key: (urn:opendaylight:params:xml:ns:yang:bgp-linkstate?revision=2015-02-10)route-key, in: (urn:opendaylight:params:xml:ns:yang:bgp-linkstate?revision=2015-02-10)linkstate-route[{(urn:opendaylight:params:xml:ns:yang:bgp-linkstate?revision=2015-02-10)route-key=[B@6e685e6c}], actual value: [B@5b0902b4, expected value from key: [B@6e685e6c
        at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.valid.DataValidationException.checkListKey(DataValidationException.java:60)
        at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder.checkKeys(ImmutableMapEntryNodeBuilder.java:101)
        at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder.build(ImmutableMapEntryNodeBuilder.java:94)
        at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder.build(ImmutableMapEntryNodeBuilder.java:22)
        at org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter.endNode(ImmutableNormalizedNodeStreamWriter.java:129)
        at org.opendaylight.yangtools.binding.data.codec.impl.BindingToNormalizedStreamWriter.endNode(BindingToNormalizedStreamWriter.java:89)
        at org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.linkstate.routes.linkstate.routes.LinkstateRoute$StreamWriter.serialize(DataObjectSerializerPrototype.java)
        at org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry$DataObjectSerializerProxy.serialize(BindingNormalizedNodeCodecRegistry.java:273)
        at org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry.toNormalizedNode(BindingNormalizedNodeCodecRegistry.java:99)
        at org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec.toNormalizedNode(BindingToNormalizedNodeCodec.java:56)

This boils down to how we compare the objects. Using Objects.equals() does
not cover arrays. Switching to deepEquals() solves the problem.

Change-Id: I725dbfca2af11e5b7c6213a8f650109383f13af8
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSpellcheck AugmentableDataNodeContainerEmitterSource 55/15755/2
Robert Varga [Wed, 25 Feb 2015 22:34:26 +0000 (23:34 +0100)]
Spellcheck AugmentableDataNodeContainerEmitterSource

Simple rename of an internal class to fix a typo.

Change-Id: I4f081454b5612d2960ff85158ca5cdf2adf17519
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoUse simple string concat in DataObjectSerializerSource 54/15754/2
Robert Varga [Wed, 25 Feb 2015 22:32:40 +0000 (23:32 +0100)]
Use simple string concat in DataObjectSerializerSource

Allocating a default-sized StringBuilder is not optimal, we'd really
want to preallocate it with the initial string, at which point it
becomes not much more than a simple concat.

Change-Id: Ibe6f283dccebb347982561c4acacf615a8fff4cf
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix BindingNormalizedNodeCodecRegistry thread safety 38/15738/2
Robert Varga [Wed, 25 Feb 2015 16:16:36 +0000 (17:16 +0100)]
Fix BindingNormalizedNodeCodecRegistry thread safety

Registry has a codecContext, which can be asynchronously updated. Make
sure it is volatile, so that any changes are guaranteed to propagate.

Change-Id: I83acfee3bb5f3bf3de6873161dd491e7d5882988
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoCompact BitsCodec 37/15737/2
Robert Varga [Wed, 25 Feb 2015 16:19:56 +0000 (17:19 +0100)]
Compact BitsCodec

Instead of an if/else block, just use the result and store it directly
into array.

Change-Id: If7a08ff1a644b8bfbf023d8e5393896eb4e9b643
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDo not declare Exception as thrown 36/15736/2
Robert Varga [Wed, 25 Feb 2015 16:28:42 +0000 (17:28 +0100)]
Do not declare Exception as thrown

This Callable never throws, so do not declare the exception, fixing a
sonar warning.

Change-Id: Ia0f847dd31ebc09d91993ded5e5bb2fc6486b7d6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoDataContainerCodecPrototype should be final 35/15735/2
Robert Varga [Wed, 25 Feb 2015 16:19:01 +0000 (17:19 +0100)]
DataContainerCodecPrototype should be final

Let's help the runtime by declaring the class final, as it is
package-private and does not have descendants.

Change-Id: I8d994dc307c0d831b92a95775fd21e39f3ef1fd0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFix code alignment 34/15734/2
Robert Varga [Wed, 25 Feb 2015 16:18:13 +0000 (17:18 +0100)]
Fix code alignment

Declaration and comment missed one leading space, fix that.

Change-Id: I198a96668ec0ad94b1b1118949988e88321f8b43
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoYANG JSON codec can be used inside other JSON stream. 19/15719/3
Tony Tkacik [Wed, 25 Feb 2015 12:44:22 +0000 (13:44 +0100)]
YANG JSON codec can be used inside other JSON stream.

This is useful for emitting root element, which is
not present in YANG schema.

This also allows to introduce special support of
emitting get-config and get RPC bodies, which
are using data tree schema for anyxml, and
emitted stream is still considered valid YANG JSON
according to specification.

Change-Id: Ie01afc93834bf4e9ee4981a71413ae477dee0766
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Fix checkListKey not checking actual/expected values"
Tony Tkacik [Wed, 25 Feb 2015 15:27:51 +0000 (15:27 +0000)]
Merge "Fix checkListKey not checking actual/expected values"

9 years agoMark classes/fields as final 21/15721/1
Robert Varga [Wed, 25 Feb 2015 13:43:26 +0000 (14:43 +0100)]
Mark classes/fields as final

Making sure that we follow coding patterns, will actually improve what
the JIT can do for us.

Change-Id: I125a6c058ea603d2e9545c42ff8ab969372c371d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoSkip ArrayList instantiation during deserialization 16/15716/2
Robert Varga [Wed, 25 Feb 2015 11:24:36 +0000 (12:24 +0100)]
Skip ArrayList instantiation during deserialization

We use the ArrayList just as an index holder, after which we just
extract the underlying array. The libraries by default perform a copy
and then JIT has to prove what is going on to remove that overhead.

Let's make it super-easy instead by filling the array ourselves.

Change-Id: Ib48992538b3cd8a9a0c11011fe444e24b23dc825
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-2689: Cast exception when serializing L3Address from groupbasedpolicy policy... 58/15558/3
Martin Ciglan [Fri, 20 Feb 2015 15:10:15 +0000 (16:10 +0100)]
BUG-2689: Cast exception when serializing L3Address from groupbasedpolicy policy.yang

When deserializing L3AddressKey, alphabetical order of key arguments
didn't match with order of related QNames as defined in yang model.

The binding-independent world retains the ordering specified in model,
while the binding-aware world requires constructor arguments to be
alpha-sorted.

Change-Id: Icb277fed97d0984ca1a60aa7add7817db727facc
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Updated Json Stream Writer to use gson JsonWriter."
Tony Tkacik [Wed, 25 Feb 2015 08:04:59 +0000 (08:04 +0000)]
Merge "Updated Json Stream Writer to use gson JsonWriter."

9 years agoMerge "Fix supporting-node in topology model so it can actually be used."
Robert Varga [Wed, 25 Feb 2015 06:07:52 +0000 (06:07 +0000)]
Merge "Fix supporting-node in topology model so it can actually be used."

9 years agoFix supporting-node in topology model so it can actually be used. 75/15475/2
Ed Warnicke [Wed, 18 Feb 2015 19:09:39 +0000 (12:09 -0700)]
Fix supporting-node in topology model so it can actually be used.

supporting-node in the topology model *only* has a node-ref
The node-ref is a leafref, which only provides the node-id
for the node.  Since we have no notion of what topology the supporting node
is in, we can't find it.

Change-Id: Ibc5829a45d97bb5a95abee07b397447a4cd509e0
Signed-off-by: Ed Warnicke <eaw@cisco.com>
9 years agoBug 2361: Added meta-level SPI for building any statement-based models. 66/15166/12
Tony Tkacik [Wed, 11 Feb 2015 20:28:37 +0000 (21:28 +0100)]
Bug 2361: Added meta-level SPI for building any statement-based models.

This meta-level SPI is designed for components, which introduces
support for conrete statements, identifier namespaces or effective
model inference to the YANG parser.

Change-Id: Iff35085fa5a44568c449a5e1e34ee371768dd88b
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 2497: Added YIN Export for Effective Schema Context. 58/15258/7
Tony Tkacik [Thu, 29 Jan 2015 17:16:53 +0000 (18:16 +0100)]
Bug 2497: Added YIN Export for Effective Schema Context.

Added initial implementation of YIN schema export,
which uses current Schema Context and effective API
to infer model.

Once the parser will be updated to preserve declared model,
this implementation will be hugely simplified only to subset
of current implemention - which is implementation
of StatementTextWriter interface.

Change-Id: I2c57ab90b6cb9f42c6156253c8600709c19b349e
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Bug 2444: Added concrete API definitions for YANG statements."
Robert Varga [Wed, 18 Feb 2015 13:45:38 +0000 (13:45 +0000)]
Merge "Bug 2444: Added concrete API definitions for YANG statements."

9 years agoFix maven plugin not recognizing transitive interfaces 59/15459/1
Robert Varga [Wed, 18 Feb 2015 10:46:51 +0000 (11:46 +0100)]
Fix maven plugin not recognizing transitive interfaces

An implenter does not need to directly implement the interface, but can
rely on it being captured somewhere else. Instead of custom magic, use
Class.isAssignableFrom() to check for compatibility.

Change-Id: I1e21b9880eb0a48bbe6027518cea39fef13b6ec6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2444: Added concrete API definitions for YANG statements. 78/14678/12
Tony Tkacik [Thu, 29 Jan 2015 16:39:25 +0000 (17:39 +0100)]
Bug 2444: Added concrete API definitions for YANG statements.

Introduced type captures of DeclaredStatement for RFC6020 statments
along with some convenience getters to decrease need of users
to look up statements in collections.

This getters conveys RFC6020 semantic, but does not prevent
access to any statements which may be introduced in later
versions of YANG.

Change-Id: I7ca3265aa7fc141446515e27f02c37ff3b5903dc
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBUG-2179: split logging out of CodeGenerator 88/15388/5
Robert Varga [Mon, 16 Feb 2015 22:10:12 +0000 (23:10 +0100)]
BUG-2179: split logging out of CodeGenerator

Currently SPI requires downstream users to import maven infrastructure
even if they are not using it. Split the two maven-related injection
methods into dedicated interfaces.

MavenLogAware is automatically deprecated, as maven 3.1+ works with
slf4j out of the box, hence Log injection is no longer needed.

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