From: Ajay Date: Sat, 4 Jun 2016 00:10:54 +0000 (+0000) Subject: Bug-6001: Injecting route with missing next-hop value causes exception in reachabilit... X-Git-Tag: release/boron~138 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=b68719f08f2e414794aa1494a770f440850d48c2;p=bgpcep.git Bug-6001: Injecting route with missing next-hop value causes exception in reachability topology builder - added check in reachability topology builder to handle scenario when next-hop value is null - entry will be skipped from topology processing in such cases Change-Id: I254666e1008f6f65e244e4cd93c3f77c8a7b58d7 Signed-off-by: Ajay --- diff --git a/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractReachabilityTopologyBuilder.java b/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractReachabilityTopologyBuilder.java index fd65369b90..f19261d42d 100644 --- a/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractReachabilityTopologyBuilder.java +++ b/bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractReachabilityTopologyBuilder.java @@ -68,7 +68,10 @@ abstract class AbstractReachabilityTopologyBuilder extends Abst private NodeId advertizingNode(final Attributes attrs) { final CNextHop nh = attrs.getCNextHop(); - if (nh instanceof Ipv4NextHopCase) { + if (nh == null) { + LOG.warn("Next hop value is null"); + return null; + } else if (nh instanceof Ipv4NextHopCase) { final Ipv4NextHop ipv4 = ((Ipv4NextHopCase) nh).getIpv4NextHop(); return new NodeId(ipv4.getGlobal().getValue()); @@ -122,6 +125,9 @@ abstract class AbstractReachabilityTopologyBuilder extends Abst @Override protected final void createObject(final ReadWriteTransaction trans, final InstanceIdentifier id, final T value) { final NodeId ni = advertizingNode(getAttributes(value)); + if (ni == null) { + return; + } final InstanceIdentifier nii = ensureNodePresent(trans, ni); final IpPrefix prefix = getPrefix(value); @@ -134,6 +140,9 @@ abstract class AbstractReachabilityTopologyBuilder extends Abst @Override protected final void removeObject(final ReadWriteTransaction trans, final InstanceIdentifier id, final T value) { final NodeId ni = advertizingNode(getAttributes(value)); + if (ni == null) { + return; + } final NodeUsage present = this.nodes.get(ni); Preconditions.checkState(present != null, "Removing prefix from non-existent node %s", present);