BUG-3186 : fixed MPReachCodec not found 85/21085/1
authorDana Kutenicsova <dkutenic@cisco.com>
Fri, 22 May 2015 14:06:32 +0000 (16:06 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 26 May 2015 01:33:00 +0000 (01:33 +0000)
Turns out, one import problem can cause the whole
codec hierarchy to fail. Also make sure we can
troubleshoot such bugs easier in the future by
catching Exceptions from codec creation per RIB.

Change-Id: I675b70f6b8079d2a5a2eb7ded64be76d16f9e468
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
(cherry picked from commit 5b0977ebafc17c294b5455a29eed535eb917cf61)

bgp/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/FlowspecRIBSupport.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBSupportContextRegistryImpl.java

index 6d554a049ffc7ecd0bc6c822c01e359269d1f471..c740f7741f852237bebda534cac91297a0a4b15f 100644 (file)
@@ -16,10 +16,10 @@ import java.util.List;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupport;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.FlowspecRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.FlowspecSubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.bgp.rib.rib.loc.rib.tables.routes.FlowspecRoutesCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.flowspec.destination.Flowspec;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.flowspec.routes.FlowspecRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.flowspec.routes.flowspec.routes.FlowspecRoute;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150114.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.flowspec._case.DestinationFlowspec;
index 486264d046c4a073d0f338dc1bb9a1e1d5d5ff4a..eb99e69160d3cdebb40420768440ca04c8b3e3a8 100644 (file)
@@ -22,9 +22,12 @@ import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadi
 import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 final class RIBSupportContextRegistryImpl implements RIBSupportContextRegistry {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RIBSupportContextRegistryImpl.class);
     private final LoadingCache<RIBSupport, RIBSupportContextImpl> contexts = CacheBuilder.newBuilder()
             .build(new CacheLoader<RIBSupport, RIBSupportContextImpl>(){
 
@@ -83,8 +86,11 @@ final class RIBSupportContextRegistryImpl implements RIBSupportContextRegistry {
         final BindingRuntimeContext runtimeContext = BindingRuntimeContext.create(this.classContext, context);
         this.latestCodecTree  = this.codecFactory.create(runtimeContext);
         for(final RIBSupportContextImpl rib : this.contexts.asMap().values()) {
-            rib.onCodecTreeUpdated(this.latestCodecTree);
+            try {
+                rib.onCodecTreeUpdated(this.latestCodecTree);
+            } catch (final Exception e) {
+                LOG.error("Codec creation threw {}", e.getMessage(), e);
+            }
         }
     }
-
 }