When we fail to look up peer we should not be throwing a NPE, as we
will end up with inconsistent TransactionChain.
Change-Id: Ia662d4fcb777cce5323fbad820466c9350ec039b
JIRA: BGPCEP-863
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
*/
package org.opendaylight.protocol.bgp.mode.impl;
+import static java.util.Objects.requireNonNull;
+
import java.util.List;
import org.opendaylight.protocol.bgp.rib.spi.Peer;
import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters;
public BGPRouteEntryExportParametersImpl(final Peer fromPeer, final Peer toPeer,
final String routeKey, final RTCCache rtCache) {
- this.fromPeer = fromPeer;
- this.toPeer = toPeer;
+ this.fromPeer = requireNonNull(fromPeer);
+ this.toPeer = requireNonNull(toPeer);
this.routeKey = routeKey;
this.rtCache = rtCache;
}
final R route = initializingRoute.getRoute();
final Peer fromPeer = entryDep.getPeerTracker().getPeer(fromPeerId);
+ if (fromPeer == null) {
+ LOG.debug("Failed to acquire peer structure for {}, ignoring route {}", fromPeerId, initializingRoute);
+ continue;
+ }
+
final BGPRouteEntryExportParameters routeEntry = new BGPRouteEntryExportParametersImpl(fromPeer,
this, route.getRouteKey(), this.rtCache);