[MDSAL-269] Error occurs when mdsal binding v1 codec a "union" type Created: 09/Jun/17 Updated: 09/Mar/18 Resolved: 05/Mar/18 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | Binding codegen, Binding V2 codegen |
| Affects Version/s: | None |
| Fix Version/s: | Oxygen, Nitrogen SR2 |
| Type: | Bug | ||
| Reporter: | GU Min | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| External issue ID: | 8644 | ||||||||||||||||||||||||
| Description |
|
When I put data to datastore , using this ietf-routing-types@2017-02-27.yang(in the attchment), an error occurs : testWriteLabelRangeAdd(test.org.opendaylight.bier.driver.configuration.te.label.BierTeLabelRangeConfigWriterImplTest) Time elapsed: 4.561 sec <<< ERROR! |
| Comments |
| Comment by GU Min [ 09/Jun/17 ] |
|
Attachment ietf-routing-types@2017-02-27.yang has been added with description: yang file |
| Comment by Peter Kajsa [ 09/Jun/17 ] |
|
This issue is related to binding generator and binding codecs, which are parts of mdsal project, therefore I move this bug to mdsal.. |
| Comment by Martin Ciglan [ 12/Jun/17 ] |
|
is this master and/or stable/carbon? |
| Comment by GU Min [ 12/Jun/17 ] |
|
I use 0.11.0-SNAPSHOT <parent> |
| Comment by Marek Gradzki [ 27/Oct/17 ] |
|
I have similar issue with Carbon-SR2. I noticed that but mpls-label defines it: typedef mpls-label { This causes similar failure when we try to configure labels in Honeycoimb via restconf. |
| Comment by Robert Varga [ 30/Jan/18 ] |
|
The problem is located in TypeProviderImpl.resolveExtendedSubtypeAsUnion(), where we ignore the union type as it is derived from an IdentityRef and there is no case statement to assign it. |
| Comment by Robert Varga [ 30/Jan/18 ] |
|
Actually, for some reason we do not generate a type for 'typedef mpls-label-special-purpose', which means the union cannot find the type and fails to add the union member. |
| Comment by Robert Varga [ 30/Jan/18 ] |
|
Oxygen: https://git.opendaylight.org/gerrit/67757 This also affects binding-v2, but that needs to be addressed separately. |
| Comment by Robert Varga [ 30/Jan/18 ] |
|
LeafrefTypeDefinition was fixed previously in |
| Comment by Robert Varga [ 31/Jan/18 ] |
|
Root Cause Analysis: This issue comes from the decision to not change generated identityref leaf method signature, which means we cannot provide typedef-mandated encapsulation of the identity reference. Hence no encapsulation is done for both identityref and leafref nodes. While The fix makes unions aware of identityref and wires them to the leafref case, which produces expected results. |
| Comment by Robert Varga [ 02/Feb/18 ] |
|
The patch actually does not fix anything. I can now see the problem, codec expects: Caused by: java.lang.NoSuchMethodException: org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev170227.MplsLabel.getMplsLabelSpecialPurpose() while codegen generates: public java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev170227.MplsLabelSpecialPurposeValue> getClassMplsLabelValue() { return _classMplsLabelValue; }e.g. codegen does not take the typedef into account at all, while it should for naming purposes – the method name is derived from the identity name, not the type name of the identityref. That actually should be simpler to fix (I hope). |
| Comment by Robert Varga [ 02/Feb/18 ] |
|
Updated patch generates the property correctly. |
| Comment by Marek Gradzki [ 02/Feb/18 ] |
|
Property generation works indeed, but now I get some run time issues during deserialization, that look similar to Stack trace: Caused by: java.lang.IllegalArgumentException: Failed to construct instance of class org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev170227.MplsLabel for input (urn:ietf:params:xml:ns:yang:ietf-mpls-static?revision=2017-03-10)111
|
| Comment by Robert Varga [ 02/Feb/18 ] |
|
This exception is thrown when no member codec accepts the incoming value. Enable debug on UnionValueOptionContext to see what went down. Judging from the value it should have been intercepted by mpls-label-general-use... Please file a separate issue. |
| Comment by Marek Gradzki [ 05/Feb/18 ] |
|
DOne: |