Thanh Ha [Thu, 6 Aug 2015 03:19:46 +0000 (23:19 -0400)]
Fix license header violations in binding-generator-impl
Change-Id: If155761c145d7b6db8c4378343733a7be256ba98
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Thanh Ha [Thu, 6 Aug 2015 03:11:52 +0000 (23:11 -0400)]
Fix license header violations in binding-type-provider
Change-Id: Ib00d5625f834a9de12d10f8c3d9cbaaa7e70eb05
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Thanh Ha [Thu, 6 Aug 2015 02:26:03 +0000 (22:26 -0400)]
Fix license header violations in yang-binding
Change-Id: I3c3fcd27c50ef3aa3c79ddaccddf8dfcf8bad4d8
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Robert Varga [Fri, 5 Jun 2015 21:20:55 +0000 (23:20 +0200)]
BUG-1485: remove deprecated range methods
This Be-cycle patch removes the methods which have been removed in
Lithium, improving class size and not leaking the enforcement details.
Change-Id: I629df675eecac10c0aad1ed212123dca0f6d81d8
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 29 Jun 2015 20:22:54 +0000 (22:22 +0200)]
Make more mathods static
Private methods not touching object state can be made static, make it
so. Also remove an open-coded version of Strings.isNullOrEmpty().
Change-Id: I6e62ce1a4eb4b1556654172554eb69542df60403
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sun, 21 Jun 2015 20:56:35 +0000 (22:56 +0200)]
Fix some minor sonar warnings
Mostly misplaced 'final' modifiers.
Change-Id: I5197b844e73db00467f7ebb852677c39176e5c94
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tony Tkacik [Fri, 19 Jun 2015 09:29:40 +0000 (11:29 +0200)]
Bug 3821 - Augmentation codecs may be loaded after codec creation.
In some scenarios - where schema context already contained
schema for introduced augmentation, but class was not known
at time codec creation was triggered - codec for augmenation
was not created and any subsequent uses of codec (class is
already known) failed with IncorrectNestingException.
This patch introduces
- new exception MissingClassInLoadingStrategy
which is subclass used by MD-SAL to retry after context update
or timeout
- supports loading of augmentation codec after parent codec
was created and augmentation is part of schema codec
Change-Id: If85f8e2be614a139947abc5daaa1e141b3c9b22c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit
acf8e80b0747bd0aa724e978288bb83f6ca338ad)
Robert Varga [Thu, 11 Jun 2015 11:15:54 +0000 (13:15 +0200)]
TypeDefinition is a generic type
Do not use it in raw format, eliminating warnings.
Change-Id: I6012f812ce7a5aba75f163a8910fb0583fefd6cc
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
35e731b1818688f2aee43f525873087aca25110e)
Peter Kajsa [Fri, 16 Jan 2015 12:48:44 +0000 (13:48 +0100)]
Bug 2583 - illegal escape character if generated files
When a module file name starts with 'u' character, YangTools generates
comments in file containing '\u...' character sequences which java compiler
interprets as illegal escape character.
Problem is related most probably to windows builds only.
Change-Id: I81329b754710a68ada4e9c034c8980a1acd8a1b7
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Martin Ciglan [Tue, 16 Jun 2015 14:12:51 +0000 (16:12 +0200)]
Bug 2721: StackOverflowError for leafref FIX
Leafref XPath needs to be checked whether it references itself
in order to detect incoming StackOverflowError
and throw appropriate exception if necessary.
Change-Id: Iacfa1a9f9d85f947e590b1d6412c9c482b417dbf
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
Robert Varga [Tue, 16 Jun 2015 18:59:27 +0000 (20:59 +0200)]
Sonar: remove unused modifiers
public/static/final modifies are implied by the context, e.g. by being
declared in an interface.
Change-Id: Ic2f97172595d7cdb2119510c077eabac55fa0798
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 11 Jun 2015 10:40:28 +0000 (12:40 +0200)]
Make methods static
All these can be made static, so improve their efficiency.
Change-Id: Ie6aa238eab7fef728dd22af12a64a155a9db776e
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
12beaed7c9f1953562f79ef9699273d0ea53926c)
Robert Varga [Thu, 11 Jun 2015 10:32:44 +0000 (12:32 +0200)]
Make BaseYangTypes.TYPE_MAP immutable
The lookup map is expected to be immutable.
Change-Id: I0ed6c263d34e585dcca2445ec963ea785c934ab8
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
c8e3e8de1506e8571651f430024c14157cdb61bb)
Robert Varga [Tue, 9 Jun 2015 22:58:12 +0000 (00:58 +0200)]
Throw an exception from private constructor
This is a utility class, it should never be instantiated.
Change-Id: Ic2edd90d0cf084a3a38e5a6c068172b9d774799e
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
2e0878d894f821db411c87f2ffff094e9b32b5ee)
Jan Hajnar [Mon, 1 Jun 2015 14:40:16 +0000 (16:40 +0200)]
Bug 3336 - Binding DTOs: fix binary-derived constructor
* added condition to only check for null in value assignmet if class has
one property (because then CheckNull is generated before assgnment)
Change-Id: I3bd18ec60347b3d1d5dec32e7bcafa432c56b5ad
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
(cherry picked from commit
0c58b4c45c1caedd1e3ecdfa056c0c4f98185c63)
Peter Kajsa [Mon, 15 Jun 2015 09:36:29 +0000 (11:36 +0200)]
Bug 3669 - ietf-restconf binding is incomplete
- added implementation of ModuleRevisionBuilder.java
Change-Id: If50041c1b0befcb5fb8678cf95f915ef4b079bfb
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Tony Tkacik [Fri, 12 Jun 2015 10:28:04 +0000 (12:28 +0200)]
Bug 3687 - StreamWriterGenerator emits UNKNOWN_SIZE
StreamWriterGenerator always emitted sizing hint
for fully-completed data and sometimes even
counting all availble augmentations, which actually
lead-up to larger sizes of collections then needed.
Fix changes the SIZE HINT for "constant" max-sized
types (containers, augmentations, list entries)
to -1 so underlaying implementation could size
them based on actual data.
Change-Id: Ibd446f71c4b066f4dab4a7d73b1bc851d9e62c99
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
b6fdf49d349662ffa82ae6477f99bac405799a3f)
Robert Varga [Sat, 6 Jun 2015 13:34:44 +0000 (15:34 +0200)]
Make methods static
These methods can be made static, make them such. Also fix raw types.
Change-Id: I4b697026857aae8579f0545e7e1284a7b8d00d04
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 9 Jun 2015 23:09:51 +0000 (01:09 +0200)]
BUG-3641: cache hashCode value
Builder-derived classes can be used as HashMap keys, which means they
can see their hashcode computed multiple times. Since this is a
recursive operation, the cost of it can be quite high, so dedicate two
fields for caching the hashcode result.
Change-Id: I0d95fd94187a421e4018b2f6992dfeaf2e126732
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
0158f45b9078cdb867d3ce3c44a4ed4746f311fe)
Tony Tkacik [Tue, 9 Jun 2015 12:59:25 +0000 (14:59 +0200)]
Bug 1485: Invoke lengthCheck only on non-null object.
Change-Id: Iec3cf2fe08fbdac4e5139acab7865cd4c4b6224f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit
8dfd02dec37d796ce7a51866416675b021e85b7c)
Maros Marsalek [Mon, 8 Jun 2015 12:39:02 +0000 (14:39 +0200)]
BUG-706 Ignore anyxml nodes in binding serializer
AnyXml is not supported on that level and currently leads to null pointer ex.
Change-Id: I5c2a64ab9502e4bba02efd822d2b5294ef456cef
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
(cherry picked from commit
8c4ddc66b0b1ef31a65b8cabf55173a16615bab2)
Robert Varga [Mon, 8 Jun 2015 16:43:05 +0000 (18:43 +0200)]
BUG-3051: Fix error reporting string
The exception thrown does not accurately describe what has happened. Be
more user-friendly and report the exact pattern which failed to match.
Change-Id: I0818c92c4a8cdf8c180234635c1efe059ff1c4e2
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
3680886f73ef87fb2818c57b12d3bc76525c3669)
Robert Varga [Sun, 31 May 2015 17:51:43 +0000 (19:51 +0200)]
BUG-1485: convert BuilderTemplate to use LengthGenerator
This converts BuilderTemplate to use the LengthGenerator class as
appropriate, speeding operations up. Also removes caching fields.
Change-Id: I1a0bfc56df8ab36880ae8e14c111cb9aca68c626
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
7998081d8e1761bf4798c1642e8e6107fc4666fc)
Robert Varga [Sun, 31 May 2015 12:05:02 +0000 (14:05 +0200)]
BUG-1485: Switch ClassTemplate length checker
Switch ClassTemplate to use LengthGenerator. Also removes the static field
used to hold ranges, as that is only used by deprecated length() method.
Change-Id: I2a084a71d21c8c63a2d9733fc767aa7ecd3cff67
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
65cf5ea01d87cbe65633a8e13fcbb6713e334ec2)
Robert Varga [Sun, 31 May 2015 11:33:03 +0000 (13:33 +0200)]
BUG-1485: Create LengthGenerator
LengthGenerator is akin to AbstractRangeGenerator, only simpler. Since
the type of the checked property can only be an integer, we can live
without subclasses. One weirdness is that it needs to support both
String and byte[] fields, but that is easily catered with two distinct
methods.
Change-Id: I6b714b4094c332c18ee210451b3bd1672ca74129
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
b8e6be6a350b8dd39de74ca33fa039e92b198b17)
Jan Hajnar [Thu, 7 May 2015 15:09:37 +0000 (17:09 +0200)]
Bug 3224 - Parsing data with choice in case via augmentation results in
incorrect parsing
* added tests for multiple choices from augmentation parsing
for json, xml and bindinging aware context
* modified json parsing tests
* fixed choice augmentation resolution in ChoiceNodeCodecContext
and CompositeNodeDataWithSchema
* moved findCorrespondingAugment to SchemaUtils since it is useful for
multiple Classes
* replaced getNodeIdentifierForAugmentation code in SchemaUtils with
the one from CompositeNodeDataWithSchema.
Change-Id: Ibf57a771b92de14ecb70dcbbe250d7c559066882
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
(cherry picked from commit
a8f512b80e661dac1ff85db6c16c72bfbf7f5891)
Robert Varga [Thu, 28 May 2015 20:34:01 +0000 (22:34 +0200)]
BUG-1485: remove holder for deprecated Class ranges
With the switchover to new range checks, the static caching field is not
needed. We still retain compatibility with possible users out there, but
they are now responsible for caching the result.
Change-Id: I119615255559263f98fc382b324026c4f5d35cfc
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
924235feb5540c5a453c522e85d13fbd1d140c5a)
Robert Varga [Thu, 28 May 2015 20:05:51 +0000 (22:05 +0200)]
BUG-1485: remove holder for deprecated Builder field ranges
Caching the result was important as long as ranges were used internally,
now that they are not, do not retain them and re-generate them on each
call. Any callers out there are now responsible for caching them
themselves.
Change-Id: Idcba7fe54c59e33d6eedb6b596a2bf4f4a5ca10c
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
8d510398ba320a17ba932d27b98423e8bcad1a10)
Robert Varga [Thu, 28 May 2015 19:33:18 +0000 (21:33 +0200)]
BUG-1485: switch BuilderTemplate to new range enforcement
This switches the template for builders to the new range enforcement
code.
Change-Id: I1368a6a6922b2e982b9f4274dca32cf73b888d4b
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
5b7dc4042d5827c60bf9ca9daaaf369242c931f9)
Robert Varga [Wed, 27 May 2015 20:00:18 +0000 (22:00 +0200)]
BUG-1485: switch ClassTemplate to new range enformcement
Switch range checks for simple classes (typedefs and similar) to the new
range checker. Also move printRangeConstraint() from BaseTemplate to
BuilderTemplate, as it ends up being used only there.
Change-Id: I16e4c1faf239d838ff415c0173ef3d06acc61701
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
02e503a09314f2e3192b85ed9fccaff5efb4942c)
Robert Varga [Thu, 28 May 2015 23:50:23 +0000 (01:50 +0200)]
BUG-1485: optimize primitive range checks
When we are dealing with a primitive type, we can force unboxing of the
type by declaring the range checker method's argument as the primitive
type. This will result in the stack not containing references for the
fast path (e.g. successful check) as well as reduce the number of
virtual calls to one. Checks will then be performed using primitive
manipulation instructions, which should result in better fast-path
execution.
The slow path will take a hit, as for throwing the exception, we will
end up re-boxing the primitive type.
Change-Id: I7e6b0e25790f9a43dc99f2fc7426bb9fe25c505c
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
9b5366d775b93f0e2a37f028cda11832ba65ce6d)
Robert Varga [Thu, 28 May 2015 14:57:20 +0000 (16:57 +0200)]
BUG-1485: make AbstractRangeGenerator deal with GTOs
For enforcement of ranges in builders, we will need to deal with types
other than ConcreteType. Also clean up internal interfaces, add some
javadocs and remove some trailing whitespace.
Also perform Number class conversion silently if it does not result in
loss of precision. Emit a warning if it does.
Change-Id: I8f3ba96c104fb28f6d2cfc4b05b5d24bb7f80aa1
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
d8f544b093f024ff156873c66eebf976f6738382)
Robert Varga [Thu, 28 May 2015 00:46:35 +0000 (02:46 +0200)]
BUG-1485: deprecate public static range/length methods
These methods are not efficient and expose implementation internals.
Mark them as deprecated for removal. This mirrors the deprecation in
ClassTemplate, which was not instantiated before due to how the code is
structured.
Change-Id: I7fcb831f00fd3baab02e1f25e10655c8288c6d4e
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
da603ecd3b0e093bf00ff75d80c0957196d9856d)
Robert Varga [Thu, 28 May 2015 00:26:42 +0000 (02:26 +0200)]
BUG-1485: move generateLengthMethod to BuilderTemplate
While it looks this method is shared, it is not, as ClassTemplate
defines its own. Move it to BuilderTemplate and make it private,
reducing confusion.
Change-Id: I998f200a963dea39b1e2fedaf7a9fd1e394db58d
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
c2bf3960924fd870b8d3183f396c5e43b84e0aa3)
Robert Varga [Thu, 28 May 2015 00:14:29 +0000 (02:14 +0200)]
BUG-1485: move *Range* methods to BuilderTemplate
printRangeConstraint and generateRangeMethod are used by BuilderTemplate
only, move them there to preserve locality and stop them from spreading.
Change-Id: I5d5421b50bd5e4ac65182ad1a11e7bfad199df51
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
c49ff3a94cc0b0f98dc73647a7fdc308fdaa3052)
Robert Varga [Wed, 27 May 2015 19:24:59 +0000 (21:24 +0200)]
BUG-1485: Move restriction generation
It is only used in the class template, so move it and make it private to
increase clarity.
Change-Id: I751c4a5a0af06dd89a79ce43546ec9c12490f166
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
76c57ce16f7b1b90325214e05f916bc486ad792d)
Robert Varga [Wed, 27 May 2015 23:06:14 +0000 (01:06 +0200)]
BUG-3399: fix BaseYangTypes' range constraints
Constraints Number type should match the Java type a particular type is
bound to. Users dealing with values trying to correlate it to the
metadata available can then rely on things like
value.getClass.cast(rangeMin) just working instead of concocting
conversions to deal with all possible combinations of types.
Also changes BaseConstraints to enforce the two components of a
constraint being the same type, preventing things like min being Integer
while max is a Long.
Change-Id: I38e646b4c08b032248349f3e618354aa2114efd3
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
af2244fc083e788645ac689b543af447efdf5b70)
Robert Varga [Tue, 26 May 2015 20:49:36 +0000 (22:49 +0200)]
BUG-1485: Introduce AbstractRangeGenerator and friends
Adds utility classes for dealing with various range constraints in
generated code. These classes are implemented in pure Java and attempt
to make sure generated code runs as efficiently as possible.
Change-Id: Ie1d05b514937507e225b9bc7559b1949a7e6eb76
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
c5e1800bc2851c90273b6218295ffe2e59fccf91)
Robert Varga [Tue, 26 May 2015 18:32:20 +0000 (20:32 +0200)]
BUG-1485: store patterns in an array
Internal compiled patters are only ever iterated over, hence there is no
need to store them in a list. Convert the field into an array, improving
both CPU and memory efficiency very slightly. Also saves instantiation
of a temporary list.
Change-Id: I5140bc81d0a78d4f91d4ad2d6f81cbd6ed1f6d55
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
29c2d3351bdf371274433e71909236f133130bfb)
Robert Varga [Thu, 28 May 2015 01:59:22 +0000 (03:59 +0200)]
Make test utilities static
These two can be static, make them static.
Change-Id: I3fe54607edbadea4250928e99260906cbaef4629
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
0341b340283af8efa8c7604c1d65ac87aaeecfd1)
Robert Varga [Tue, 26 May 2015 22:18:57 +0000 (00:18 +0200)]
Do not instantiate augmentation HashMap in DTO builders
Tracing has revealed that the OpenFlowPlugin creates a lot of builders,
instantiation a million HashMaps, which accounts for 1% of CPU time.
Most of these maps are never touched, so we can easily optimize this
away by lazily instantiating a HashMap when the first augmentation is
added. Also prevents copying of empty augmentation in the copy
constructor.
Change-Id: I592fe6af65c9f3b65038def8bb4069666bfdc375
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
2cb012f4e814859e10726d02cb1c073321316ab3)
Robert Varga [Thu, 28 May 2015 15:23:27 +0000 (17:23 +0200)]
Clarify GeneratedTransferObject.getSuperType()
The Javadoc for this method is confusing and actually misleading.
Clarify it a bit for future's sake.
Change-Id: I52f09e2e9cf864dc00fb4883099ca4df5219327f
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
a2a7dee2cc6a9e83f53acd08408b227416f29bff)
Robert Varga [Wed, 3 Jun 2015 17:32:11 +0000 (19:32 +0200)]
BindingReflections' cache should use cached references
Since we will be giving out these all over the place, it is a good idea
to make sure the returned reference is system-global.
Change-Id: I46c4f62c5ea8f8ee13e7745e6c9efd7d865bd6d4
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
47e801b7f26d9e8ce68738bdfd0d1b6e6c83ae0c)
Tomas Cere [Tue, 2 Jun 2015 12:03:58 +0000 (14:03 +0200)]
Stop calling get on a possible absent value.
Change-Id: I76cc4d6decd7cf65f988dcb87553b280aab21b24
Signed-off-by: Tomas Cere <tcere@cisco.com>
Robert Varga [Wed, 27 May 2015 10:54:03 +0000 (12:54 +0200)]
Allow instantiation of more efficient RpcServiceInvokers
Current invoker derived from binding class has the downside of
performing localName->methodName conversion on each invocation, which
costs us in the lookup path, as deriving the binding method name is a
costly operation.
Add a new static factory method for creating a RpcServiceInvoker
instance base on a QName->Method map. Provide two additional
implementations: a generic one, which performs a direct lookup in the
map and a specialized one, which performs lookup only on the localName
part of the qname. The latter is used after we have made sure all QNames
come from the same QNameModule.
Change-Id: I6a4b33f0487838b3ae6c15470823e4bc01114aa5
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
aab5a09be514bc7622416bf2a6d4d6a7465f9d7c)
Robert Varga [Tue, 26 May 2015 13:09:00 +0000 (15:09 +0200)]
Optimize binding InstanceIdentifier methods
Openflow traces show some overhead from UnmodifiableIterable. As it
turns out, we are instantiating them needlessly for internal iteration.
This stems from accessing getPathArguments() instead of pathArguments,
which are exposed precisely for this optimization.
Make sure to access pathArguments directly, eliminating this overhead.
Change-Id: I3ef053baa35c80f555b6b9f0b8813692236afa48
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
96639b4fd02beb3590f62fdfc096936e71ad4a32)
Maros Marsalek [Mon, 11 May 2015 14:40:26 +0000 (16:40 +0200)]
BUG-2453 Add enum yang <-> Java mapping to BindingRuntimeContext
BindingRuntimeContext already posses the information about all generated
classes from yang (also enums). This commit makes it public.
Change-Id: I638d73625bdc4720ee6427027246455c6c05aa03
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Peter Kajsa [Thu, 8 Jan 2015 12:50:02 +0000 (13:50 +0100)]
Bug 2528 - Binding Generator: Generated notification implements ChildOf
interface
Generated Notification interface implements ChildOf<DataObject> interface
which is incorrect. Generated Notification should not implement ChildOf
interface since it is not part of data tree. This could lead to use of
Notification in wrong context and may confuse consumers of APIs.
Notice: The solution replaces "implements ChildOf<DataObject>" with
"implements DataObject" in generated Notification interface. Notification
has structured content, so I think the generated Notification interface should
implements at least DataObject interface in order to be able to construct
InstanceIdentifier for the notification (analogously as it is by RPC's input
and output).
Change-Id: I55c7a8cc4ce450fd712c63f8e77881d4a18674e6
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Maros Marsalek [Thu, 7 May 2015 12:12:17 +0000 (14:12 +0200)]
BUG-2453 Remove custom hashcode/equals from Enum type
Custom hashcode and equals made it impossible to match Enum types based on
packageName and name.
Change-Id: Ib3eed1f0892234b44f8e3459e48f303732a86ffe
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Martin Bobak [Mon, 25 May 2015 13:09:01 +0000 (15:09 +0200)]
Bug 2988 - DTO equality appears to be broken by proxy
Change-Id: Ib068be34371e8863ef6f2ef8d936d3d6918aba37
Signed-off-by: Martin Bobak <mbobak@cisco.com>
Tony Tkacik [Wed, 29 Apr 2015 13:35:08 +0000 (15:35 +0200)]
Bug 3067: Improved error reporting in Binding Data Codec
Error reporting in Binding Data Codec was reworked
to throw three additional subclasses of IllegalArgumentException
for specific case of failure:
MissingSchema and MissingSchemaForClass - exception thrown
when schema context associated with codec does not contain
models for supplied class or DOM argument.
IncorrectNesting is thrown when schema is available an user
constructed data with invalid nesting (bypassed generic
compile-time checks).
The checks to determine type of exception are done only
if error condition is detected, so non-error fast path
should not be affected by advanced checks.
Added test which tests these types of exceptions.
Change-Id: Iad020a42317ab46df4d2240568fd6e8205383857
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit
3f754cccb393b989bafb8b194edf9da0ec3e9e8a)
Thomas Bachman [Thu, 7 May 2015 14:55:03 +0000 (10:55 -0400)]
Bug 3151: Fix Not a Proxy Instance Exception
This fixes a bug where a "Not a Proxy Instance"
exception (also IllegalArgumentException) is thrown
when hashCode is invoked in a yangtools generated
builder.
Change-Id: Iddc7ca6e4785e5ce11e41900a438dbb49baeaf6d
Signed-off-by: Thomas Bachman <tbachman@yahoo.com>
pkajsa [Thu, 13 Nov 2014 13:51:20 +0000 (14:51 +0100)]
Bug 2333 - Java code generation error, when yang model contains Choice node
in module body at top level
BindingGeneratorImpl fails (NoSuchElementException) during java source code
generation from yang model which contains Choice node directly in module body
at top level. The parent path of Choice node is empty (because the parent
is the module) and therefore iterator.next() on the path fails. For more
information see Bug 2333.
Change-Id: I6e617eca91bb5d8d2b91ad058a4df5c2793ec81d
Signed-off-by: pkajsa <pkajsa@cisco.com>
Tony Tkacik [Thu, 30 Apr 2015 13:37:48 +0000 (13:37 +0000)]
Merge "Add hooking into NormalizedNodeParsers."
Tomas Cere [Tue, 28 Apr 2015 12:35:13 +0000 (14:35 +0200)]
Add hooking into NormalizedNodeParsers.
Makes it possible to add a ParsingStrategy into the parsers,
to allow for callbacks/custom processing while parsing.
DefaultParsingStrategy has the same behaviour as the already present parsers.
Change-Id: I5998af4befaf31d3af3f4cf5e2f46ddc32b1e05b
Signed-off-by: Tomas Cere <tcere@cisco.com>
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Robert Varga [Fri, 24 Apr 2015 11:03:54 +0000 (11:03 +0000)]
Merge "Bug 3051: Fixed pattern checks in generated DTOs"
Tony Tkacik [Fri, 24 Apr 2015 08:37:21 +0000 (10:37 +0200)]
Bumped model versions to .8-SNAPSHOT
Change-Id: I1b1c6c3fcd875795f2b8cab1d4146b25c87ee7e7
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Thu, 23 Apr 2015 10:03:12 +0000 (10:03 +0000)]
Bumped Yangtools by minor version.
Change-Id: I0c357c757ed78607982abfbf788433e16c88835c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Thu, 23 Apr 2015 15:13:36 +0000 (17:13 +0200)]
Bug 3051: Fixed pattern checks in generated DTOs
Pattern checks in generated DTOs were generated as
OR checks in case model type specified multiple
patterns, but correct behaviour is to do AND.
So in order string needs to verified against
all patterns and match all of them.
Change-Id: If82e282312c82dd71de79534c7fa599fcdcefab4
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Tue, 21 Apr 2015 08:05:53 +0000 (08:05 +0000)]
Merge "change to interface"
Debalina Ghosh [Fri, 17 Apr 2015 17:47:06 +0000 (10:47 -0700)]
change to interface
Change-Id: Id16a68b5486e334c01341a646a9e83bb0407272c
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
Vishal Thapar [Tue, 14 Apr 2015 12:40:19 +0000 (18:10 +0530)]
workaround for BUG: 2974
Suggested workaround for bug2974 is to add
yang-types revision to ietf-interfaces.yang
This change imports latest revision as well as
changes the dependency to ietf-yang-type-
20130715
Change-Id: If0ad60b435ae311db656d1a7e49402bc3ef6bb2f
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
Tony Tkacik [Mon, 13 Apr 2015 09:27:14 +0000 (09:27 +0000)]
Merge "BUG-1485: deprecate length/range methods"
Robert Varga [Mon, 13 Apr 2015 09:18:48 +0000 (09:18 +0000)]
Merge "Bug 1260: Implemented Binding Caching Codec"
Robert Varga [Mon, 13 Apr 2015 08:40:23 +0000 (08:40 +0000)]
Merge "Bug 2374 - YANG Binding: Added support for AugmentationHolder interface"
Robert Varga [Wed, 18 Mar 2015 17:20:15 +0000 (18:20 +0100)]
BUG-1485: deprecate length/range methods
These methods leak the internals of how constraints are enforced. No
outside parties should rely on them, so lets mark them deprecated. If we
do not get reports of use, we should be removing them in a future
release.
Change-Id: I128c5abe5c894a4808ff30dcebd6af42d8f682cb
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tony Tkacik [Wed, 8 Apr 2015 17:41:05 +0000 (19:41 +0200)]
Bug 1260: Implemented Binding Caching Codec
Implemented Bidning Caching Codec which maintains
API-user configured cache of serialized data
from Bidning to NormalizedNode.
These cached data are used in subsequent serializations
in order to not allocate new NormalizedNodes for
logically equivalent data.
Change-Id: Iafaed957453569c3e8ecfbb2aed333f3a1fd418f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Sat, 11 Apr 2015 20:40:02 +0000 (22:40 +0200)]
Do not declare RuntimeExceptions as thrown
Fix a bunch of sonar warnings around declaring runtime exceptions.
Change-Id: I6e8267e29ef6c0d3f2d220531ca656ff564331ec
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Sat, 11 Apr 2015 15:03:58 +0000 (17:03 +0200)]
Fix constant names
Constants should have capitalized names. Fixes a few sonar warnings.
Change-Id: I600b482a817055784874e91f9cb8c5b06b948302
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tony Tkacik [Thu, 9 Apr 2015 12:33:42 +0000 (12:33 +0000)]
Merge "Make sure LOOKUP is a proper constant"
Tony Tkacik [Thu, 9 Apr 2015 12:32:56 +0000 (12:32 +0000)]
Merge "Fix modifier ordering"
Robert Varga [Thu, 9 Apr 2015 11:23:22 +0000 (13:23 +0200)]
Make sure LOOKUP is a proper constant
Change-Id: I684ead0df12bdc5c012f8a20e04f4508c5bbb429
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Thu, 9 Apr 2015 11:11:05 +0000 (13:11 +0200)]
Fix modifier ordering
JLS specifies annotations need to to come before other modifiers, of
which visbility should be first.
Change-Id: I754ef08c13256647d024c121e75fd3617ef6d064
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Wed, 8 Apr 2015 22:55:45 +0000 (22:55 +0000)]
Merge "Fixed incorrect signature in NotificationListenerInvoker"
Tony Tkacik [Wed, 8 Apr 2015 17:42:29 +0000 (19:42 +0200)]
Fixed incorrect signature in NotificationListenerInvoker
Change-Id: I01e54f6193e54b1488a506ae47d24ba8c808281a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Thu, 2 Apr 2015 14:21:46 +0000 (14:21 +0000)]
Merge "Fixed NPE in BindingCodecTree#getSubtreeCodec(YangInstanceIdentifier)"
Tony Tkacik [Thu, 2 Apr 2015 13:35:03 +0000 (15:35 +0200)]
Fixed NPE in BindingCodecTree#getSubtreeCodec(YangInstanceIdentifier)
Change-Id: If77807004779ce6ade106f1bacc9918f98f996ee
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Tue, 31 Mar 2015 21:11:08 +0000 (23:11 +0200)]
BUG-869: kill more sonar warnings
Empty statement, mis-ordered annotations and keywords, unneeded
keywords.
Change-Id: I88a7ba62b5fe22cda96a1b5243a2ae4968c31ab3
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Tue, 31 Mar 2015 20:55:31 +0000 (22:55 +0200)]
BUG-869: remove public modifier
Public is implied for all methods in an interface, do not specify it
explicitly.
Change-Id: Ic673b60111f9ecf62a6242d3bedf8607036a3403
Signed-off-by: Robert Varga <rovarga@cisco.com>
Tony Tkacik [Tue, 31 Mar 2015 12:57:44 +0000 (14:57 +0200)]
Bug 2374 - YANG Binding: Added support for AugmentationHolder interface
Binding specification v1 was originally designed and implemented
in only one implementation of interfaces in mind, which were generated one,
but during Helium additional implementation was introduced, but
specification and generated copy builder constructor did not accounted for
that change. Added additional interface which is implemented by LazyDataObject
that allow copy of augmenations.
Updated code generator to allow for that change and implementation of
LazyDataObject to support new interface contract.
Change-Id: I15aec38259f7f5e95301368d0264dfcf0571e2ba
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Tue, 31 Mar 2015 11:19:49 +0000 (11:19 +0000)]
Merge "Bug 2924: DataCodecTree expose (de)serialization methods for path arguments."
Tony Tkacik [Tue, 31 Mar 2015 08:39:37 +0000 (10:39 +0200)]
Bug 2924: DataCodecTree expose (de)serialization methods for path arguments.
Change-Id: I21129df70829a6b9a35af8350352907d46d27de2
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Mon, 30 Mar 2015 15:34:59 +0000 (17:34 +0200)]
BUG-869: remove unused assignment
This assignment in return does not make sense, remove it.
Change-Id: Ie999973df471af9f5364ddf2154a24ce237278dc
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 30 Mar 2015 15:33:17 +0000 (17:33 +0200)]
BUG-869: do not use StringBuffer
StringBuilder is the right one, so let's use that one.
Change-Id: Ic84383c05c3cd6bb0eacf9df0bbb3ed9ae46ee3f
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 30 Mar 2015 15:23:40 +0000 (17:23 +0200)]
BUG-869: remove public modifier
public is implied to all identifiers within the enclosing interface.
Change-Id: I43a50c7d51b73074df6d0456cf0d9d9aab24b819
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 30 Mar 2015 15:13:29 +0000 (17:13 +0200)]
BUG-869: remove empty statements
Sonar warnings point to semicolons after method definitions and ;;.
Remove all instances.
Change-Id: I1ba067720abd4c9df3a0c457b947736c9bc6313e
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Fri, 27 Mar 2015 10:52:48 +0000 (10:52 +0000)]
Merge "Bug 2906 - Added support of entering notification by #streamChild()"
Tony Tkacik [Fri, 27 Mar 2015 10:04:50 +0000 (11:04 +0100)]
Bug 2906 - Added support of entering notification by #streamChild()
Root Tree Node context did not allowed to enter notification
using binding classes by #streamChild method, since
notifications were cached in different collection.
Added support for entering notifications using such method.
Change-Id: I28779e763a81519d25d71e319776cdc6f179ef33
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Robert Varga [Wed, 25 Mar 2015 07:01:57 +0000 (08:01 +0100)]
Cleanup checkstyle warnings
We have various reported problems, from missing spaces, javadocs to
undocumented classes and parameters.
Change-Id: I38a15258ea5ba8eb8d97f257a36a4d890165b5a0
Signed-off-by: Robert Varga <rovarga@cisco.com>
Kinsey Nietzsche [Wed, 12 Nov 2014 13:47:30 +0000 (14:47 +0100)]
extended test coverage of InstanceIdentifier
Change-Id: Id18ae2ec969612e6c52a19449453f47e4e7e5fff
Signed-off-by: Kinsey Nietzsche <kinsey.nietzsche@pantheon.sk>
Robert Varga [Fri, 20 Mar 2015 07:17:23 +0000 (07:17 +0000)]
Merge "Bug 868: Removed Binding to Composite Node codecs."
Tony Tkacik [Thu, 19 Mar 2015 14:29:06 +0000 (15:29 +0100)]
Bug 868: Removed Binding to Composite Node codecs.
Change-Id: Ia54519c88870fada74bd2d7ce579c0e77d687157
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Vishal Thapar [Wed, 18 Mar 2015 13:49:13 +0000 (19:19 +0530)]
BUG 2868: Update iana-if-type with RFC 7224
Change-Id: Ide79db6c34fb23bd2c773a614c35d1e436b7d237
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
Robert Varga [Wed, 18 Mar 2015 09:34:56 +0000 (09:34 +0000)]
Merge "Bug 2857: Tied pre-existing implementation to BindingCodecTree."
Tony Tkacik [Thu, 12 Mar 2015 11:06:00 +0000 (12:06 +0100)]
Bug 2857: Tied pre-existing implementation to BindingCodecTree.
BindingCodecTree provides public view into backing structure
of binding-data-codec, which was designed and already implemented
as data tree.
By exposing these power-users could build their own
Binding to DOM adapters, where they could customize some aspects
of serialization or precache over-used codecs in order
to speed up performance.
Change-Id: I827eb6014b28d0b6d4256b677ee56d3081ff80b0
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Mon, 16 Mar 2015 13:31:50 +0000 (14:31 +0100)]
Bug 2859: Key generation when anonymous Enum was used.
Binding list key was generated with incorrect type,
when anonymous enumeration was defined in leaf in grouping
and that leaf was used for list.
Change-Id: Idcb114be49280f77af8054d8d83c5d8e6f453665
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Tony Tkacik [Mon, 16 Mar 2015 07:28:07 +0000 (07:28 +0000)]
Merge "Migrate from BindingGeneratorUtil"
Tony Tkacik [Mon, 16 Mar 2015 07:13:14 +0000 (07:13 +0000)]
Merge "BUG-2829: make static QName field hold a cached reference"
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>
Robert Varga [Thu, 12 Mar 2015 22:50:52 +0000 (23:50 +0100)]
Migrate from BindingGeneratorUtil
BindingMapping is the new home for mapping module namespaces to java
package names.
Change-Id: I61ecf91c2ffa78a6e62c00feaf5fd7879dd89cf9
Signed-off-by: Robert Varga <rovarga@cisco.com>