Thanh Ha [Tue, 9 Aug 2016 13:27:25 +0000 (09:27 -0400)]
Bump ietf versions to ...10-SNAPSHOT
Bumping according to:
https://lists.opendaylight.org/pipermail/release/2016-August/007731.html
Change-Id: I2fc611f84c056ddea4a531d9e9e976ace3d4b557
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Thanh Ha [Mon, 8 Aug 2016 21:50:16 +0000 (17:50 -0400)]
Bump versions by 0.1.0 for next dev cycle
Change-Id: I661f05513feb495a1f1a47ffaeeb7fc6630bcd33
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Vratko Polak [Mon, 1 Aug 2016 15:15:46 +0000 (17:15 +0200)]
Bug 6165: Do not omit java.lang prefix in various places
Yang expression "typedef String" leads to java class String,
creating potential naming conflict with java.lang.String.
Few places places in EnumTemplate are fixed by using «String.importedName».
Also, YangModuleInfoTemplate#getExplicitType
no longer removes java.lang unconditionally.
+ Ifs against void are re-ordered to occur sooner in getExplicitType.
Change-Id: If014aca30875589e361733317dfb47eaa07df031
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Robert Varga [Fri, 5 Aug 2016 15:07:13 +0000 (17:07 +0200)]
Add PMD configuration
PMD does not allow specifying wildcards, hence we have to enrich
its configuration here.
Change-Id: I45b7b8618950ec43f3c03cc9e4ee9d3b714d14ee
Signed-off-by: Robert Varga <rovarga@cisco.com>
Vratko Polak [Mon, 1 Aug 2016 14:31:34 +0000 (16:31 +0200)]
Bug 6126: Use importedName for java.lang types in ClassTemplate
There may be a type definition in Yang, which generates class name
which are the same as a class name in java.lang.
This patch fixes the conflict at defaultInstance(),
there may be other places which need fixing.
Change-Id: I3a73b5bb284db031dbfd45468cbbb8dd2a354737
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Robert Varga [Tue, 19 Jul 2016 18:02:39 +0000 (20:02 +0200)]
BUG-6238: Remove char[]-based union instantiation path
Since we are iterating over the constituent types,
there is no need to fall back to string-based instantiation.
Change-Id: Ief17f444816d78d4266e82be3e359a5918213e6d
Signed-off-by: Robert Varga <rovarga@cisco.com>
Peter Nosal [Mon, 25 Jul 2016 12:50:16 +0000 (14:50 +0200)]
Bug 5947: refactored common-api tests
Change-Id: I3b138c524094fcd6c63c46493c8af42c5d0c0d5a
Signed-off-by: Peter Nosal <peter.nosal@pantheon.tech>
Vratko Polak [Mon, 11 Jul 2016 16:47:46 +0000 (18:47 +0200)]
Bug 6184: Workaround for namespaces with URL with trailing slash
Change-Id: I76712209a8d42825d9e8f6d8042877cec486c53f
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Vratko Polak [Mon, 4 Jul 2016 13:33:22 +0000 (15:33 +0200)]
Bug 2332: BindingMapping to camel split also on forward slash
This is only a partial workaround, full fix for Bug 2332 needs binding v2.
Forward slash is a first character (not allowed in general yang identifiers)
that was encountered in enums from real world Yang models.
Possibly, other separators could get the same treatment,
acting the same way as dash and dot already do.
Change-Id: Ic62198a843747092113c1c7dffaff13d09e7f943
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Juraj Veverka [Wed, 20 Jul 2016 12:22:38 +0000 (14:22 +0200)]
implemented missing equals for InstanceIdentifierBuilderImpl with tests
Change-Id: I540a3f44f964de4c3f44281fb51d9a1404313ff7
Signed-off-by: Juraj Veverka <Juraj.Veverka@pantheon.tech>
Robert Varga [Wed, 27 Jul 2016 22:26:10 +0000 (00:26 +0200)]
Use TypedSchemaNode
Now that the getType() method is available through a unified
interface use it to simplify type checks.
Change-Id: I9538c3677daf4ac4e3eac080220403bf2f75adb8
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 27 Jul 2016 20:40:23 +0000 (22:40 +0200)]
Remove an unneeded type specifier
Optional.of() can be correctly inferred with Java 8,
remove the type argument.
Change-Id: Ie0826c03c964bb1bdfd7a070fa1bf80cef2ac3f0
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 27 Jul 2016 20:26:34 +0000 (22:26 +0200)]
Remove unneeded cast
Since we have corrected the getSchema() method, there is no need
to perform a cast.
Change-Id: Ib3c9b2d7dc3a15f2cb9e042055178106f6b33cae
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 27 Jul 2016 20:29:18 +0000 (22:29 +0200)]
Fix incorrect null check
Eliminate an Eclipse-generated warning, which actually shows a bug.
Calls to childNonNull() did not pass an actual instance, but rather
a 'obj != null' expression. That expression got evaluated to
a boolean, which got boxed. Hence childNonNull() could not observe
a null no matter what and we'd get a NPE on next use -- exactly where
Eclipse put a warning.
childNonNull() returns a correctly annotatad @Nonnull reference,
which can be used as a guard against this kind of mistake: if the
original code used that reference, compilation would fail,
as the checked object is a Boolean and does not have a get() method.
This patch eliminates the expression and uses the returned reference,
eliminating the possiblity of a NPE.
Change-Id: I706f077f90ea38d3a48125beeaf4711182c8b8d5
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 21 Jul 2016 09:11:42 +0000 (11:11 +0200)]
Use direct type checks
With the removal of old parser and ExtendedType each type
definition implements proper subtype, hence we do not have
to traverse the type tree up to root.
Change-Id: Ib7a6ffa5f221278547e27e37b19c14a1a3c26d8a
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 21 Jul 2016 09:08:41 +0000 (11:08 +0200)]
Use lambda for Codec.loader()s
Removes a bit of boiler-plate code.
Change-Id: Id0c7c8d16d374133d9439cd72587382e31252b80
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 21 Jul 2016 09:07:47 +0000 (11:07 +0200)]
Fix checkstyle errors
'if(' -> 'if ('
Change-Id: I4747befcf35724bc1f99346e0ae8ab3ee5b30254
Signed-off-by: Robert Varga <rovarga@cisco.com>
Michael Vorburger [Thu, 21 Jul 2016 01:39:34 +0000 (03:39 +0200)]
Checkstyle clean-up src/test/java
Required to be able to run (enforce) CS on src/test as well.
Change-Id: Ife78f9baf1fcb462d15ca59675e4116903048c6b
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Robert Varga [Tue, 19 Jul 2016 17:08:01 +0000 (19:08 +0200)]
BUG-6022: retain order of constituent types
In order to safely iterate over the types, we need
to retain their order from the SchemaNode. Use
a LinkedHashSet to achieve that.
Change-Id: I850f823a0b67dc9bc3e6b75f9a1c671e4bbf73d9
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 19 Jul 2016 14:58:25 +0000 (16:58 +0200)]
Add union deserialization debugs
We seem to be hitting the slow instantiation path for some
reason. Add more debugging in an effort to hunt them down.
Change-Id: I64c5630a819d46710f7957c3972a2ba305b21ac7
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 8 Jun 2016 16:31:40 +0000 (18:31 +0200)]
BUG-6028: iterate over component types to instantiate union
This reworks union instantiation to be on par with
https://tools.ietf.org/html/rfc6020#section-9.12. We iterate
over individual members and attempt to run deserialization.
If it succeeds instantiate the union using cached constructor
specifying that member. This side-steps the need to go through
serialization.
Change-Id: Ieec37da37a05c2b2a2f432778232e136c903f654
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Isaku Yamahata [Wed, 13 Jul 2016 00:04:41 +0000 (17:04 -0700)]
Bug 6112 - UnionTypeCodec fails to non-identityref value
When Non-identityref value is deserialized, ClassCastException exception occurs.
catch the exception and move to the next codec.
> java.lang.ClassCastException: java.lang.Short cannot be cast to org.opendaylight.yangtools.yang.common.QName
> at org.opendaylight.yangtools.binding.data.codec.impl.IdentityCodec.deserialize(IdentityCodec.java:17)
> at org.opendaylight.yangtools.binding.data.codec.impl.UnionTypeCodec.deserialize(UnionTypeCodec.java:103)
> at org.opendaylight.yangtools.binding.data.codec.impl.LeafNodeCodecContext.deserializeObject(LeafNodeCodecContext.java:199)
> at org.opendaylight.yangtools.binding.data.codec.impl.DataObjectCodecContext.getBindingChildValue(DataObjectCodecContext.java:328)
> at org.opendaylight.yangtools.binding.data.codec.impl.LazyDataObject.getBindingData(LazyDataObject.java:148)
> at org.opendaylight.yangtools.binding.data.codec.impl.LazyDataObject.invoke(LazyDataObject.java:71)
> at com.sun.proxy.$Proxy3.getValue(Unknown Source)
> at org.opendaylight.yangtools.binding.data.codec.test.UnionTypeWithIdentityrefTest.bug6112Test(UnionTypeWithIdentityrefTest.java:78)
Change-Id: If6d9bffbc8cecaca2894f889940c814919da6a4b
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Peter Nosal [Wed, 6 Jul 2016 13:08:57 +0000 (15:08 +0200)]
Bug 5947: Increasing code coverage - yang util
Change-Id: I7e2cc7590952e3de444e50f172fb4c68a84041dd
Signed-off-by: Peter Nosal <peter.nosal@pantheon.tech>
Ryan Goulding [Wed, 6 Jul 2016 19:26:19 +0000 (15:26 -0400)]
Bug 5151 Java binding missing @return
Adds @return functionality to interface accessors. The idea is to generate a
meaningful return label so that we don't get warnings during compilation for
missing return statements. A test is added to verify that the return statement
is formatted appropriately.
Change-Id: I01875b788622cab002653a03ea2d844d2c954b77
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
Ryan Goulding [Wed, 6 Jul 2016 15:56:11 +0000 (11:56 -0400)]
Fix a typo in the ClassTemplate API
Just fixes a typo in the ClassTemplate xtend template.
Change-Id: Ia9c888c29a7a929cfcb574d0d7fa9ac75f34926a
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
Ryan Goulding [Thu, 2 Jun 2016 18:01:19 +0000 (14:01 -0400)]
Bug 2872: Generated Java Enumerations should contain mapping to the string counter part
Changes the Enumeration API to expose the "getMappedName()" accessor, which exposes
the name that is used for the Java mapped enum name. The EnumTemplate.xtend template
was modified in the following way:
1) A field was added to track the "raw" enum name, the one parsed from the YANG file.
2) The constructor was modified to accept the raw enum name as a parameter, and store
the parameter value in the name instance variable.
3) An accessor was added called "getName()", which exposes the name instance variable.
A corresponding change in yangtools changes the EnumEffectiveStatementImpl.getName()
definition to expose the "raw" name attribute parsed from the yang file:
https://git.opendaylight.org/gerrit/#/c/39733/
Change-Id: If248039a2b10958ff563ee0799d7b13284570b3c
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
Filip Gregor [Thu, 16 Jun 2016 12:02:19 +0000 (14:02 +0200)]
LazyDataObject bindingEquals fix
added check for byte arrays
Change-Id: I238d92bc7a23ac0157ff66046e5d137d6e10582e
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Robert Varga [Wed, 8 Jun 2016 12:21:42 +0000 (14:21 +0200)]
Optimize BitsCodec
The codec was not using methodhandles and performed reflective
invocation. Fix that, amortizing invocation cost.
Change-Id: Ibe7b41b81ab248bfe0221083feb4c0bcd24cee4d
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 8 Jun 2016 11:59:17 +0000 (13:59 +0200)]
Optimize UnionTypeCodec
For some reason this codec was not using MethodHandle#invokeExact()
for instantiation. Fix this and remove static fields holding public
lookups.
Change-Id: I8b170ec850aa8182cbe8bf81a0fbbef796aad741
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 8 Jun 2016 17:05:56 +0000 (19:05 +0200)]
Enforce non-null class
Also hide the field and expose a getter.
Change-Id: Ic998b2726be93bf173525bdb6a394e438e3e330c
Signed-off-by: Robert Varga <rovarga@cisco.com>
Filip Gregor [Mon, 13 Jun 2016 11:09:55 +0000 (13:09 +0200)]
MDSAL clean-up
Follow usual naming conventions and
refactor utility class RetestUtils.
Change-Id: I655af10d6a90196ee16c9fe060279ea8cf57782c
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Robert Varga [Thu, 9 Jun 2016 08:49:19 +0000 (10:49 +0200)]
BUG-865: remove reference to SchemaAwareNormalizedNodeStreamWriter
All functionality has been integrated ito NormalizedNodeStreamWriter, hence
the two subclasses are no longer needed. Remove reference to the old type
so it can be removed.
Change-Id: I0e0ef84279b5504bb18bcf164ae3a5091fa04582
Signed-off-by: Robert Varga <rovarga@cisco.com>
Isaku Yamahata [Thu, 2 Jun 2016 00:40:34 +0000 (17:40 -0700)]
Bug 6006 - UnionTypeCodec fails to handle indentityref
UnionTypeCodec doesn't know that identityref requires special handling
because the actual derived identityref classes are determined at runtime.
Change-Id: I817190a380f0325b0bb8ee6f13a7d94cffc29113
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Robert Varga [Wed, 1 Jun 2016 14:47:47 +0000 (16:47 +0200)]
Cleanup code
Unused imports, static methods, missing generics.
Change-Id: I11ec7de37c5f57a5e0c5f28ae7a51b060012df59
Signed-off-by: Robert Varga <rovarga@cisco.com>
Peter Nosal [Fri, 20 May 2016 10:14:57 +0000 (12:14 +0200)]
Bug 5947: Increasing code coverage for mdsal project
- increasing coverage for module mdsal-dom
Change-Id: I768341d7a9eded8fb080de3b0d40e2b9e9f44b35
Signed-off-by: Peter Nosal <peter.nosal@pantheon.tech>
Robert Varga [Sat, 28 May 2016 10:17:22 +0000 (12:17 +0200)]
BUG-5970: do not add value to union hashCode/equals/toString
The value of a union is derived from its members and should not
be part of general Object methods, as the members are already
part of these methods.
Also override definition for getValue() and generate alternate
code to lazily fill _value. The output could use some visual
improvement, but that is something for another day.
It also fixes the copy constructor so it does not clone the
_value field unnecessarily.
Change-Id: Ibbbce99e1e84a0dfa55f70872fedad78e57e8f1e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Martin Ciglan [Mon, 30 May 2016 13:12:31 +0000 (15:12 +0200)]
Follow usual naming convention when old "retest" related stuff got deleted.
- import code style fix
Change-Id: Ieaf1d100e7c209d306eab747a2b445e08309d80c
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Michael Vorburger [Mon, 23 May 2016 16:18:29 +0000 (18:18 +0200)]
Add src/main/yang as source path in build-helper-maven-plugin
This is required by yangide so that in-workspace cross-project *.yang
references are correctly resolved; see
https://lists.opendaylight.org/pipermail/yangtools-dev/2016-May/001383.html
thread.
Change-Id: I81d07a94660bffea1953b949f507e62a7eaef4ee
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Isaku Yamahata [Tue, 10 May 2016 19:55:54 +0000 (12:55 -0700)]
Bug 5883 - no constructor for indentityref in union
The generated java code for union with identityref doens't include a
constructor for identityref.
module union-with-identityref {
yang-version 1;
namespace "urn:opendaylight:yang:union:test";
prefix "uniontest";
description "test union with identityref";
revision "2016-05-09";
identity ident-base;
identity ident-one {
base ident-base;
}
identity ident-two {
base ident-base;
}
typedef union-type {
type union {
type uint8;
type identityref {
base ident-base;
}
}
}
}
generated java code:
public class UnionType
implements Serializable {
private static final long serialVersionUID = 4724108168179933454L;
private final java.lang.Short _uint8;
private final char[] _value;
public UnionType(java.lang.Short _uint8) {
super();
this._uint8 = _uint8;
this._value = _uint8.toString().toCharArray();
}
Change-Id: Idf8f7df54afd0934e47b19c131ea41d046a7b5df
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Filip Gregor [Fri, 13 May 2016 09:42:05 +0000 (11:42 +0200)]
Bug 5882: Wrong placement of deprecated annotation
Removed @Deprecated from generated Yang in javadoc
added deprecated annotation for generated getters
and typedefs
Change-Id: I251faabd0cdc051a646ead6f4bf65a17509b90c5
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Filip Gregor [Fri, 13 May 2016 08:54:38 +0000 (10:54 +0200)]
Bug 5845: can not transform ba to bi, when keys contain boolean type
Reworked check for getter methods, added test method
for getting boolean key starts with is due to the fact
that it is a boolean.
As it turns out, LeafNodeCodecContext already gives us
a ready-made name via getGetter().getName(), so let's
use that.
Also take a moment to do some minor cleaups while we're
at it.
Change-Id: I36adc6ff37159dba257a6fa437ab55eb49ed1151
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
Peter Nosal [Tue, 17 May 2016 13:09:07 +0000 (15:09 +0200)]
Removed usage of deprecated YangParserImpl from tests in mdsal project
Change-Id: I0e5d5e565c97d1ecdc1f764609382be3dda2ef59
Signed-off-by: Peter Nosal <peter.nosal@pantheon.tech>
Michael Vorburger [Wed, 11 May 2016 10:46:05 +0000 (12:46 +0200)]
Remove @Deprecated ClassLoaderUtils as it's now in yangtools.util
Not sure what ODL policy is re. clean up of deprecated classes, so I'm
proposing to killing one, and see what happens... ;-)
https://twitter.com/drdeprecator
More seriously, it's probably safer if critical code such as ClassLoader
related stuff is maintained in a single place, not in two copy/pasted
classes. (If we have to keep this, perhaps it could delegate to the new
one instead of copy/paste?)
Change-Id: Icac8d4f81ba102bba37e11b611874db3dea49793
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Filip Gregor [Tue, 26 Apr 2016 08:54:54 +0000 (10:54 +0200)]
Bug 5788: enum used as a key does not work
fixed Qname check for enum as key from grouping in
bindingGeneratorImpl
Change-Id: Id6521d28a4b9aebcd1dfca2d33e8dfed68e9a269
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Peter Kajsa [Mon, 2 May 2016 12:07:26 +0000 (14:07 +0200)]
Bug 5446: toString() throws exception for 'type binary' binding
Binding UnionTypeCodec invokes toString method on byte[] array
by its deserialization which leads to undesirable results.
The same problem occurs also in generated java class of Union type.
Change-Id: I61b7500541a1dd86ba7c39377113a12eb270a274
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Filip Gregor [Fri, 11 Mar 2016 12:41:57 +0000 (13:41 +0100)]
Bug 5461: Augmenting a choice without a case from another module causes NPE
fixed case creation, added tests
Change-Id: Ida25d45893058f320c0373355d41cc8c4b981f84
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Maros Marsalek [Mon, 18 Apr 2016 07:58:58 +0000 (09:58 +0200)]
Check augments for equality in LazyDataObject
LazyDataObject did not check augments when performing equals()
returing true for un-equal augmentable dataObjects
Hashcode already includes augments in the calculation
Change-Id: Ic57c3c6f70eaea26de938ecb4e3ca67026e1965d
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
(cherry picked from commit
bf21871d32c3e3ee4b4272a24fd56401be2e8640)
Filip Gregor [Fri, 8 Apr 2016 07:39:44 +0000 (09:39 +0200)]
Bug 5524: NPE in BA->BI serialization
added check to RuntimeContext, tests
Change-Id: I5574469506cd6a7df5a54b47e3cdca34a68c7834
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Filip Gregor [Mon, 25 Jan 2016 15:15:39 +0000 (16:15 +0100)]
Bug 4760: YANG leaf named 'class' breaks write with netconf connector
added new method for changing "Class" to "XmlClass" to bindingmapping
added tests
Change-Id: I27503d5756259b61500e2eaf90cdfceba0ebbe80
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Filip Gregor [Fri, 5 Feb 2016 14:12:07 +0000 (15:12 +0100)]
Bug 4798: Can not define a list as a subordinate
added check for NodeIdentifierWithPredicates
Change-Id: If21b06a035232f04deda8369fb09b48d0fe45def
Signed-off-by: Filip Gregor <fgregor@cisco.com>
Robert Varga [Fri, 26 Feb 2016 12:46:51 +0000 (13:46 +0100)]
Do not hold cache values in soft references
This increases memory overhead of the cache for not good reason, fix
that.
Change-Id: Ib55a7eb2e0a2066a70fe9a7eefa90771e028e8da
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 26 Feb 2016 10:22:22 +0000 (11:22 +0100)]
Add field type check
Eagerly check if the field being accessed is in fact a Map, so we
prevent ClassCast exceptions.
Change-Id: I59322cbde9dfc6df8ab122b71e77644f64d5e302
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 26 Feb 2016 08:11:50 +0000 (09:11 +0100)]
Use MethodHandle to acquire augmentations
Binding a method handle results in faster execution speed than using a
reflective field getter.
Change-Id: Id82242dad28b788bb8c2063854b32a13db19bae1
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 25 Feb 2016 20:42:44 +0000 (21:42 +0100)]
BUG-2825: introduce Ipv4 prefix parser for short bytes
BGP uses a short encoding schema, where they have only partial byte
array. Add support for parsing such short byte arrays, padding the tail
with zeros.
Change-Id: Ib4ce202256d26b1cbee23e05320d8cef6f729257
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Robert Varga [Mon, 22 Feb 2016 18:08:34 +0000 (19:08 +0100)]
Fix same-package check
The check using getClass() is completely broken. Use getClassName() and
perform a string match.
Change-Id: I95187117119e949d2492725022825726bd4639a4
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 18 Feb 2016 00:49:05 +0000 (01:49 +0100)]
BUG-2825: add utility methods for instantiating DTOs
Change-Id: I9a98c55b850bf13695c8f581f8acee81705d570b
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Robert Varga [Fri, 19 Feb 2016 09:38:42 +0000 (10:38 +0100)]
Correct generator path
It should point to generated-sources, not to generated-classes.
Otherwise it is not correctly ignored by checkstyle.
Change-Id: Ic369d99ee063289fb529d4d63638d8206683bbf9
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 19 Feb 2016 08:39:09 +0000 (09:39 +0100)]
Fix checkstyle warnings
Wrong order of imports and braindead if(){.
Change-Id: Iedf8e712c350f373410a8c558b30792c9deda763
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 18 Feb 2016 09:48:48 +0000 (10:48 +0100)]
Remove use of QName.cachedReference()
This method in obsolete, use intern() instead.
Change-Id: Ib81bb55117138a697722dbf4ab2348a8a2643922
Signed-off-by: Robert Varga <rovarga@cisco.com>
Thanh Ha [Sat, 6 Feb 2016 04:52:59 +0000 (23:52 -0500)]
Enable site generation for mdsal
Change-Id: I9c01bd8ac2a4d3c011e271535e435ab2412b5445
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Igor Foltin [Thu, 21 Jan 2016 13:26:16 +0000 (14:26 +0100)]
Bug 1672: Generated javadoc contains symbols of javadoc comment tags
Angle brackets in javadoc comments generated from
yang statement descriptions are now properly encoded.
Change-Id: I9138c32cc912d2c4695da8e1d2e2e988f16194e1
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Robert Varga [Thu, 21 Jan 2016 17:34:03 +0000 (18:34 +0100)]
BUG-5019: adjust to changed NormalizedNodeStreamWriter API
This patch adds the required information for leafSetEntry() method.
Change-Id: I057d4d6f9ee6aaac1e6a1b0e5da27b8e92ced717
Signed-off-by: Robert Varga <rovarga@cisco.com>
Thanh Ha [Thu, 21 Jan 2016 21:03:37 +0000 (16:03 -0500)]
Bump yangtools to 1.0.0-SNAPSHOT
Change-Id: If0996a4bd580f7288ac53e4654b7d195ba89839f
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Robert Varga [Mon, 18 Jan 2016 21:50:52 +0000 (22:50 +0100)]
Emit schema nodes in BindingToNormalizedStreamWriter
ImmutableNormalizedNodeStreamWriter has memory optimizations based on
knowledge gleaned from a node's schema. More specifically it can reuse
instances of leaf and leafset entries if their value is known to have
low cardinality.
Change-Id: Ie3ef3489e12501b43341da0fc97994984fe5c625
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Igor Foltin [Tue, 12 Jan 2016 12:12:29 +0000 (13:12 +0100)]
Bug 4647: Binding Codec does not provide leaf default value for identityref
Fixed handling of leaf default value for identityref type
even when there is a prefix in the default value.
Also removed obsolete code.
Change-Id: I5a4e1bf67705538f95f001a6eee42926d20c64b4
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Martin Ciglan [Fri, 8 Jan 2016 16:03:44 +0000 (17:03 +0100)]
Bug 2784: status deprecated is not interpreted as annotation
Issues mentioned below have been fixed in this patch:
1. status deprecated is ignored for YANG elements in Javadocs
2. Annotation @deprecated is not provided in Javadocs
3. Annotation @Deprecated for compiler/developer purpose is not provided in generated Java structures
Change-Id: I5f3984d6810cd88a383a33f32b3b5d6a5072fd57
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Thanh Ha [Fri, 15 Jan 2016 00:57:35 +0000 (19:57 -0500)]
Bumping versions by 0.1.0 for next dev cycle
Change-Id: I2518103345525fa92072116fbb0123436b19384b
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Robert Varga [Fri, 8 Jan 2016 08:11:07 +0000 (09:11 +0100)]
BUG-2062: handle ordered leaf-lists
This is forward-port on the Lithium fix, migrated to the mdsal project.
Change-Id: I46d94c281b904125fecb9636e513daa0c65c93cf
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 4 Jan 2016 16:06:20 +0000 (16:06 +0000)]
Revert "Bug 4647: Binding Codec does not provide leaf default value for identityref"
This reverts commit
da4afea7aaa8845c80827a3eab032172c6971009.
With this change SFC fails, as the default value has to be resolved as a prefix.
Change-Id: I19a5bd258579eee400d9d8700563d69b7898d689
Signed-off-by: Robert Varga <rovarga@cisco.com>
Igor Foltin [Tue, 22 Dec 2015 07:25:29 +0000 (08:25 +0100)]
Bug 4647: Binding Codec does not provide leaf default value for identityref
Fixed handling of leaf default value for identityref type.
Also removed obsolete code.
Change-Id: Id442f25512f445e0fff5c9e9aef314813e2c35d4
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Robert Varga [Wed, 16 Dec 2015 15:08:50 +0000 (16:08 +0100)]
BUG-4764: resolve serializer body before javassist callout
This moves the body generation phase out of the javassist lock, so that
it can perform cache lookups without the risk of hitting an AB-BA
deadlock.
Change-Id: I40d0237fef100f90bed9e91e3825a4121e4c503d
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 9 Dec 2015 00:55:40 +0000 (01:55 +0100)]
BUG-4743: fix setters for generated classes
Generated classes enforce restrictions in their constructors. Builders
should not generate checkers which duplicates these while setting the
value.
Change-Id: I7467a91e5c229bccbac00950294576fc60ce2622
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Robert Varga [Tue, 8 Dec 2015 22:56:54 +0000 (23:56 +0100)]
Cleanup builder enforcement
A more natural place for generating these is with the setters which call
them. Move generation to generateSetters().
Also make setters' arguments final.
Also colocate length enforcement with range enforcement and eliminate a
superfluous empty if() block.
Change-Id: I0e844879f47527d692e148485157ef61db215862
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Robert Varga [Tue, 1 Dec 2015 14:43:48 +0000 (15:43 +0100)]
Switch from QName#cachedReference() to QName#intern()
cachedReference() has been deprecated, use intern() instead.
Change-Id: Ie38f30f528fbfc4119bc10637902f43db4c09da8
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sat, 21 Nov 2015 17:59:03 +0000 (18:59 +0100)]
BUG-4638: fix UnionTypeCodec
The codec should be checking for UnionTypeDefinition, not UnionType.
Change-Id: I6a4ca9070c068451d16008c6b258d212319d363e
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Tony Tkacik [Fri, 20 Nov 2015 10:05:15 +0000 (11:05 +0100)]
Bug 4648: Use interface instead of implementation class.
Change-Id: Ie38bf629d962e35df81fb831027e1341eaba61b2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Wed, 18 Nov 2015 15:01:36 +0000 (16:01 +0100)]
Fixed NPE in LeafNodeCodecContext.domValueFromString
Change-Id: I089efca778430fd04a53de6e5a025564317acd62
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Igor Foltin [Wed, 18 Nov 2015 09:54:26 +0000 (10:54 +0100)]
Bug 4322: return default valued-object
Fixed the problem with BitsCodec.deserialize
which was reported after merging following patch
https://git.opendaylight.org/gerrit/#/c/28251/
Fixed up tests to reflect fix of Bug 4645 in YangTools.
Change-Id: I59e76c82c1923f33caebf9b3dc7bbbff47505930
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Igor Foltin [Tue, 3 Nov 2015 07:17:56 +0000 (08:17 +0100)]
BUG-4322: return default valued-object
This patch modifies DataObjectCodecContext to return a default value
generated from the 'default' statement when a request is made for a
field which is not present in NormalizedNodes.
That has the effect of leaves with default value being seen as set to
the default value.
Added unit tests.
Change-Id: I99c97d796a9b32557955c4b0bd95d0051ab56f5c
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Tony Tkacik [Thu, 12 Nov 2015 14:21:48 +0000 (15:21 +0100)]
Bug 4360: Removed incorrect precondition for class nesting.
Change-Id: I665c89934872f0685d594631d0e81db4a4413284
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Wed, 23 Sep 2015 09:33:21 +0000 (11:33 +0200)]
Generate sources to target/generated-classes/mdsal-binding
Change-Id: Ibb49339b58d7fee5f2b301a2e71d9500d893d923
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Tue, 10 Nov 2015 18:19:50 +0000 (18:19 +0000)]
Revert "Bug 1672: Generated javadoc contains symbols of javadoc comment tags"
This reverts commit
ca10c625cb7c311ec957876218f10540875a9eea, as it looks like it broke controller.
Change-Id: I679ae4dac8bdf5a838ad8babfcf451958fbda904
Signed-off-by: Robert Varga <rovarga@cisco.com>
Igor Foltin [Mon, 28 Sep 2015 14:08:43 +0000 (16:08 +0200)]
Bug 1672: Generated javadoc contains
symbols of javadoc comment tags
Fixed encoding of html tags
and yang description in generated
javadoc comments.
Change-Id: Ic0512287345bc633c36325217e89aa9726a4056b
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
Martin Ciglan [Wed, 4 Nov 2015 10:36:18 +0000 (11:36 +0100)]
Fix for unknown statements used without prefix
in tested YANG models.
Change-Id: I4d40be3785320a7d1be66fb5b77f25171998fc89
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Stephen Kitt [Thu, 1 Oct 2015 08:06:17 +0000 (10:06 +0200)]
Upgrade upstream versions
Where possible rely on odlparent:
* maven.javadoc.version
* 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
* com.lmax:disruptor 3.3.0 -> 3.3.2
* build-helper-maven-plugin 1.8 -> 1.9.1
* plexus-container-default 1.5.6 -> 1.6
Drop equinoxSDK381:org.eclipse.osgi which appears to no longer be
necessary.
Change-Id: Ia97ee869f0018ea4c1a14352f11c8898fe0968eb
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Sat, 10 Oct 2015 13:22:12 +0000 (15:22 +0200)]
Use Objects.hashCode()/equals() in generated DTOs
Using java.util.Objects reduces complexity of generated code, leading to
leaner class files.
Change-Id: I941ede7cf9f60a9372864048bccdbb1650d2f5cf
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Robert Varga [Tue, 29 Sep 2015 18:57:43 +0000 (20:57 +0200)]
Remove default BindingGeneratorImpl constructor
The default verbose constructor has been deprecated in Lithium, remove
it.
Change-Id: Ib54981b117ea1557138ab1820f6f41b7766973cc
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 29 Sep 2015 19:07:48 +0000 (21:07 +0200)]
Fix various eclipse warnings
Raw types and method which could be static.
Change-Id: I19dcd742674944877f4b7b53d11068f630c826db
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sat, 10 Oct 2015 17:05:21 +0000 (19:05 +0200)]
Cleanup whitespace/formatting in codecs
This is a drive-by cleanup of whitespace.
Change-Id: Ib691ab3a04ee25938d4c1bd670ae62a01162565a
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
Tony Tkacik [Tue, 6 Oct 2015 16:19:21 +0000 (18:19 +0200)]
ModuleInfoBackedContext uses YangTextSchemaResolver.
This removes locking from ModuleInfoBackedContext
and improves perforamance characteristic during
access from multiple threads.
Change-Id: I8c6c3d228fcdb384761185f5347cde284490fbde
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Peter Kajsa [Mon, 21 Sep 2015 13:04:18 +0000 (15:04 +0200)]
Bug 3670 (part 4/5 - mdsal): Use of new statement parser in yang-maven-plugin
Parser switch in mdsal:
- parser switch in ModuleInfoBackedContext
Yangtools retest:
- BUG-1485: remove deprecated range methods
- Mockito bug fix
- binding-generator-impl unit test switch to new statement parser
- null pointer in BindingGeneratorImpl fix
Change-Id: Iab1e130f29b98db95f842b2628b2a280f3cf26e0
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Robert Varga [Mon, 28 Sep 2015 21:02:51 +0000 (23:02 +0200)]
Intern package names
Analysis of a heap dump has shown that we are ending up with a lot of
duplicate strings containing generate Java code package names.
Instantiate an interner which normalize these to a single instance.
Change-Id: Id6faa0474ee5fe9417732a08ba6027f7e68fb5d2
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 28 Sep 2015 20:29:22 +0000 (22:29 +0200)]
Do not store code snippets in BindingRuntimeContext
Analysis of a heap dump shows we retain a fair amount of strings which
represent the QNAME member of generated classes via ConstantImpl. This
should not be happening, as the logic to create QNames in generated
classes should be part of the templates and only emitted to source code.
Teach ClassTemplate how to generate QName constants and only store the
QName in the Constant, saving the overhead of Strings.
Change-Id: I41951f969e273bc2ef4527ef3d95d4bed45c1b7f
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 16:55:01 +0000 (18:55 +0200)]
Use Objects.equals()
This simplifies implementations of equals() method.
Change-Id: Ib58c7417607f85224ab6d452dab2a8aac604c055
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 27 Sep 2015 13:27:55 +0000 (15:27 +0200)]
Use Objects.hashCode()
Instead of open0-coded conditionals, use the utility method, hence
making our code more linear.
Change-Id: I2fcfef8982aebe8e2c81bf8145fb35255591d688
Signed-off-by: Robert Varga <rovarga@cisco.com>
Martin Ciglan [Tue, 22 Sep 2015 12:51:25 +0000 (14:51 +0200)]
Bug 4301: Incorrect union generated code when using decimal64
Binding Java API Generator shouldn't generate getValue() method
for java.math BigDecimal & BigInteger types, representing
YANG decimal64 & uint64 types.
This is just a port from yangtools.
Change-Id: I8f50003296d1004f9799c96950f49b4a38732137
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Robert Varga [Mon, 7 Sep 2015 12:17:27 +0000 (14:17 +0200)]
Fix duplicate artifact inclusion
Duplicate dependency is triggering a maven warning, remove it.
Change-Id: Ia38455e648f8fd8fc8eb98aec5e5313be11ebbdf
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sat, 5 Sep 2015 19:10:54 +0000 (21:10 +0200)]
BUG-4264: do not duplicate strings needlessly
This patch adds safeguards for string transformation methods to check if
the result is the same as input. This should address the string
duplication issues.
Change-Id: Ib225745ce35b492997edc60abd1abb3e41032795
Signed-off-by: Robert Varga <rovarga@cisco.com>
Florin Coras [Thu, 10 Sep 2015 16:33:44 +0000 (18:33 +0200)]
Add mdsal-model-artifacts to binding-parent
Given the migration to use the MD-SAL project, dependencies like
ietf-inet-types and ietf-yang-types are now imported via
org.opendaylight.mdsal.model instead of org.opendaylight.yangtools.model
groupId. However, the dependency management section of the
binding-parent does not include mdsal-model-artifacts, where the
previously mentioned artifacts are declared. This breaks imports in
bundles inheriting from binding-parent.
Change-Id: Id19c36862f8ab8bbfa70f8a538619070cf8814d7
Signed-off-by: Florin Coras <fcoras@cisco.com>
Robert Varga [Fri, 4 Sep 2015 00:01:38 +0000 (02:01 +0200)]
Use NodeIdentifier.create()
Using create() results in reused instances, thus lowering memory
footprint.
Change-Id: If1a1a3c3c74567374093a76df6e00ed7110b4f1c
Signed-off-by: Robert Varga <rovarga@cisco.com>