- 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 <ajayl.bro@gmail.com>
private NodeId advertizingNode(final Attributes attrs) {
final CNextHop nh = attrs.getCNextHop();
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());
final Ipv4NextHop ipv4 = ((Ipv4NextHopCase) nh).getIpv4NextHop();
return new NodeId(ipv4.getGlobal().getValue());
@Override
protected final void createObject(final ReadWriteTransaction trans, final InstanceIdentifier<T> id, final T value) {
final NodeId ni = advertizingNode(getAttributes(value));
@Override
protected final void createObject(final ReadWriteTransaction trans, final InstanceIdentifier<T> id, final T value) {
final NodeId ni = advertizingNode(getAttributes(value));
+ if (ni == null) {
+ return;
+ }
final InstanceIdentifier<IgpNodeAttributes> nii = ensureNodePresent(trans, ni);
final IpPrefix prefix = getPrefix(value);
final InstanceIdentifier<IgpNodeAttributes> nii = ensureNodePresent(trans, ni);
final IpPrefix prefix = getPrefix(value);
@Override
protected final void removeObject(final ReadWriteTransaction trans, final InstanceIdentifier<T> id, final T value) {
final NodeId ni = advertizingNode(getAttributes(value));
@Override
protected final void removeObject(final ReadWriteTransaction trans, final InstanceIdentifier<T> 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);
final NodeUsage present = this.nodes.get(ni);
Preconditions.checkState(present != null, "Removing prefix from non-existent node %s", present);