[MDSAL-194] exception while configuring bgp peer (boron and carbon) Created: 22/Aug/16  Updated: 06/Aug/18  Resolved: 04/Aug/18

Status: Resolved
Project: mdsal
Component/s: Binding codegen, Binding runtime
Affects Version/s: None
Fix Version/s: Fluorine, Oxygen SR3

Type: Bug
Reporter: Peter Gubka Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: File karaf.log.gz    
Issue Links:
Duplicate
duplicates YANGTOOLS-883 YANG parser fails to detect duplicate... Resolved
is duplicated by BGPCEP-528 BGP peer configuration in 41-bgp-exam... Resolved
is duplicated by BGPCEP-537 Wrong augmentations usage in BGP Resolved
External issue ID: 6497

 Description   

Boron:
https://jenkins.opendaylight.org/releng/view/bgpcep/job/bgpcep-csit-1node-userfeatures-only-boron/904/

Carbon:
https://jenkins.opendaylight.org/releng/view/bgpcep/job/bgpcep-csit-1node-userfeatures-only-carbon/30/

sandbox replication to have less logs with just 1 suite:
https://jenkins.opendaylight.org/sandbox/job/bgpcep-csit-1node-userfeatures-only-boron/2/

exception:

2016-08-22 12:02:56,916 | ERROR | on-dispatcher-63 | DataTreeChangeListenerActor | 172 - org.opendaylight.controller.sal-distributed-datastore - 1.4.0.SNAPSHOT | Error notifying listener org.opendaylight.controller.md.sal.binding.impl.BindingClusteredDOMDataTreeChangeListenerAdapter@154bfb5a
java.lang.ClassCastException: com.sun.proxy.$Proxy204 cannot be cast to org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2
at org.opendaylight.protocol.bgp.openconfig.impl.BGPOpenConfigMappingServiceImpl.toAddPathCapability(BGPOpenConfigMappingServiceImpl.java:124)[213:org.opendaylight.bgpcep.bgp-openconfig-impl:0.6.0.SNAPSHOT]
at Proxye8c70dbd_9d3b_44cb_8805_66bfff157211.toAddPathCapability(Unknown Source)[:]
at Proxyc915a486_1205_4d5f_9f62_be2b4720a69f.toAddPathCapability(Unknown Source)[:]



 Comments   
Comment by Peter Gubka [ 22/Aug/16 ]

Attachment karaf.log.gz has been added with description: karaf log

Comment by Milos Fabian [ 26/Aug/16 ]

Possibly yangtools/mdsal bug - problem addresses via email - https://lists.opendaylight.org/pipermail/yangtools-dev/2016-August/001549.html

A temporary workaround should be possible in BGP code.

Comment by Robert Varga [ 31/Aug/16 ]

master: https://git.opendaylight.org/gerrit/44875

Comment by Vratko Polak [ 31/Aug/16 ]

https://git.opendaylight.org/gerrit/#/c/44875/1
Attempted fix in Yangtools shows another exception:

2016-08-31 10:08:47,083 | ERROR | on-dispatcher-65 | DataTreeChangeListenerActor | 200 - org.opendaylight.controller.sal-distributed-datastore - 1.5.0.SNAPSHOT | Error notifying listener org.opendaylight.controller.md.sal.binding.impl.BindingClusteredDOMDataTreeChangeListenerAdapter@69f546e2
java.lang.ClassCastException: com.sun.proxy.$Proxy210 cannot be cast to org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2
at org.opendaylight.protocol.bgp.openconfig.impl.BGPOpenConfigMappingServiceImpl.toAddPathCapability(BGPOpenConfigMappingServiceImpl.java:125)[334:org.opendaylight.bgpcep.bgp-openconfig-impl:0.7.0.SNAPSHOT]
at Proxy580841b1_fd76_4386_a70a_c33a64826007.toAddPathCapability(Unknown Source)[:]
at Proxydb312b39_aa4c_4eac_bc86_1129d5460378.toAddPathCapability(Unknown Source)[:]
at org.opendaylight.protocol.bgp.rib.impl.config.BgpPeer.getBgpParameters(BgpPeer.java:141)[307:org.opendaylight.bgpcep.bgp-rib-impl:0.7.0.SNAPSHOT]

Comment by Vratko Polak [ 31/Aug/16 ]

> another exception

Well, it is basically the same one.

Comment by Robert Varga [ 31/Aug/16 ]

There are two augmentations in play here, AfiSafi1 and AfiSafi2, which are really completely equivalent, as they end up targeting instantiations of the same grouping:

package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighborAddPathsConfig;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;

public interface AfiSafi1
extends
DataObject,
Augmentation<AfiSafi>,
BgpNeighborAddPathsConfig

AfiSafi2 looks exactly the same. Note that we are looking for AfiSafi2 here. Based on the model (bgp-openconfig-extensions) and the call trace, we should be looking up AfiSafi1 (as that augments neighbor, AfiSafi2 augments global). This is something yangtools probably confused and should be rectified by the proposed patch.

Now when DTCL is being invoked, we go through LazyDataObject and since we have not touched getAugmentations(), but are targeting a single one, we end up calling through DataObjectCodecContext.streamChild() and after some mucking around in augmentationByClassOrEquivalentClass().

We then proceed to scan all real augmentations and check if any of them are equivalent using BindingReflections.isSubstitutionFor() – which returns true, as the classes are really equivalent. Hence we instantiate a proxy for AfiSafi1, thinking it is a valid replacement for AfiSafi2 and return that – leading to ClassCastException.

So aside from bgpcep fix, https://git.opendaylight.org/gerrit/44961, which should rectify the lookup and ClassCastException, we need to solve the problem in mdsal. I can think of two avenues:

  • teach BindingReflections to detect this problem (though it is not clear what check can be done at the class level).
  • teach code generator to not emit both AfiSafi1 and AfiSafi2 – they can be safely squashed since their targets are already squashed by the binding spec

I think we should implement the second option, as it lowers the number of classes and prevents this sort of confusion.

Comment by Robert Varga [ 01/Sep/16 ]

The ClassCastException has disappeared, but the confusion about AfiSafi1/AfiSafi2 needs to be cleaned up in MD-SAL. Reducing severity and dropping target release.

Comment by Vratko Polak [ 06/Aug/18 ]

> the confusion about AfiSafi1/AfiSafi2 needs to be cleaned up in MD-SAL

Do we have a unit test proving the confusion has been cleaned up indeed (or another Bug tracking it if not)?

Comment by Robert Varga [ 06/Aug/18 ]

Of course we do. MDSAL-328.

Comment by Vratko Polak [ 06/Aug/18 ]

Oh, Now I see the fix: https://git.opendaylight.org/gerrit/72961

It seems that in order for Jira to show the link to a related Change, the issue name has to be written in the first line of the commit message.

Comment by Vratko Polak [ 06/Aug/18 ]

> in order for Jira to show the link to a related Change

And now I see the gerrit links in MDSAL-328.
Not sure why I did not see them before, I recall the link to related Openflowplugin bug...

Generated at Wed Feb 07 20:08:58 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.