[BGPCEP-305] Bgp linkstate fails in the isis persudondoe case。There comes a NullPointerException Created: 09/Nov/15  Updated: 03/Mar/19  Resolved: 10/Nov/15

Status: Resolved
Project: bgpcep
Component/s: BGP
Affects Version/s: Bugzilla Migration
Fix Version/s: Bugzilla Migration

Type: Bug
Reporter: Geng Xingyuan Assignee: Claudio David Gasparini
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 4594

 Description   

2015-10-29 18:54:38,110 | WARN | oupCloseable-3-1 | DefaultChannelPipeline | 110 - io.netty.common - 4.0.26.Final | An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.NullPointerException
at org.opendaylight.protocol.bgp.linkstate.nlri.NodeNlriParser.serializeRouterId(NodeNlriParser.java:203)[288:org.opendaylight.bgpcep.bgp-linkstate:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.linkstate.nlri.NodeNlriParser.serializeNodeDescriptors(NodeNlriParser.java:192)[288:org.opendaylight.bgpcep.bgp-linkstate:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.linkstate.nlri.LinkstateNlriParser.serializeNlri(LinkstateNlriParser.java:258)[288:org.opendaylight.bgpcep.bgp-linkstate:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.linkstate.LinkstateRIBSupport.createRouteKey(LinkstateRIBSupport.java:164)[288:org.opendaylight.bgpcep.bgp-linkstate:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.linkstate.LinkstateRIBSupport.processDestination(LinkstateRIBSupport.java:145)[288:org.opendaylight.bgpcep.bgp-linkstate:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.linkstate.LinkstateRIBSupport.putDestinationRoutes(LinkstateRIBSupport.java:158)[288:org.opendaylight.bgpcep.bgp-linkstate:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupport.putRoutes(AbstractRIBSupport.java:219)[283:org.opendaylight.bgpcep.bgp-rib-spi:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.impl.RIBSupportContextImpl.writeRoutes(RIBSupportContextImpl.java:137)[289:org.opendaylight.bgpcep.bgp-rib-impl:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.impl.TableContext.writeRoutes(TableContext.java:49)[289:org.opendaylight.bgpcep.bgp-rib-impl:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.updateRoutes(AdjRibInWriter.java:237)[289:org.opendaylight.bgpcep.bgp-rib-impl:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.impl.BGPPeer.onMessage(BGPPeer.java:123)[289:org.opendaylight.bgpcep.bgp-rib-impl:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.impl.BGPPeer.onMessage(BGPPeer.java:67)[289:org.opendaylight.bgpcep.bgp-rib-impl:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.impl.BGPSessionImpl.handleMessage(BGPSessionImpl.java:217)[289:org.opendaylight.bgpcep.bgp-rib-impl:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.bgp.rib.impl.BGPSessionImpl.handleMessage(BGPSessionImpl.java:53)[289:org.opendaylight.bgpcep.bgp-rib-impl:0.4.2.Lithium-SR2]
at org.opendaylight.protocol.framework.AbstractProtocolSession.channelRead0(AbstractProtocolSession.java:53)[112:org.opendaylight.controller.protocol-framework:0.6.2.Lithium-SR2]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)[109:io.netty.transport:4.0.26.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242)[135:io.netty.codec:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)[109:io.netty.transport:4.0.26.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242)[135:io.netty.codec:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)[109:io.netty.transport:4.0.26.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)[109:io.netty.transport:4.0.26.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)[110:io.netty.common:4.0.26.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)[110:io.netty.common:4.0.26.Final]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]

Reason:
There is a bug in the method below:

private static IsisPseudonodeCase serializeIsisPseudoNode(final ContainerNode pseudoIsisNode) {
final IsisPseudonodeCaseBuilder builder = new IsisPseudonodeCaseBuilder();
final IsisPseudonodeBuilder nodeBuilder = new IsisPseudonodeBuilder();
final IsIsRouterIdentifierBuilder isisRouterId = new IsIsRouterIdentifierBuilder();
if (pseudoIsisNode.getChild(ISO_SYSTEM_NID).isPresent())

{ isisRouterId.setIsoSystemId(new IsoSystemIdentifier((byte[]) pseudoIsisNode.getChild(ISO_SYSTEM_NID).get().getValue())); }

nodeBuilder.setIsIsRouterIdentifier(isisRouterId.build());

if (pseudoIsisNode.getChild(PSN_NID).isPresent())

{ nodeBuilder.setPsn((Short) pseudoIsisNode.getChild(PSN_NID).get().getValue()); } else { nodeBuilder.setPsn((short) 0); }
builder.setIsisPseudonode(nodeBuilder.build());
return builder.build();
}

Where the value of the input pseudoIsisNode is:

ImmutableContainerNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:bgp-linkstate?revision=2015-02-10)isis-pseudonode, value=[ImmutableLeafNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:bgp-linkstate?revision=2015-02-10)psn, value=3, attributes={}}, ImmutableContainerNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:bgp-linkstate?revision=2015-02-10)is-is-router-identifier, value=[ImmutableLeafNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:bgp-linkstate?revision=2015-02-10)iso-system-id, value=[B@5dbb291d, attributes={}}], attributes={}}], attributes={}}

At this time, we can’t get the value of ISO_SYSTEM_NID directly. We should first get “is-is-router-identifier”, and then get the value of ISO_SYSTEM_NID.

Modification:
private static IsisPseudonodeCase serializeIsisPseudoNode(final ContainerNode pseudoIsisNode) {
final IsisPseudonodeCaseBuilder builder = new IsisPseudonodeCaseBuilder();
final IsisPseudonodeBuilder nodeBuilder = new IsisPseudonodeBuilder();
final IsIsRouterIdentifierBuilder isisRouterId = new IsIsRouterIdentifierBuilder();
if (pseudoIsisNode.getChild(ISO_PSEUDONODE_SYSTEM_NID).isPresent()) {
ContainerNode isisPseudoId = (ContainerNode)pseudoIsisNode.getChild(ISO_PSEUDONODE_SYSTEM_NID).get();
if (isisPseudoId.getChild(ISO_SYSTEM_NID).isPresent()){ isisRouterId.setIsoSystemId(new IsoSystemIdentifier((byte[]) isisPseudoId.getChild(ISO_SYSTEM_NID).get().getValue())); }
}
nodeBuilder.setIsIsRouterIdentifier(isisRouterId.build());

if (pseudoIsisNode.getChild(PSN_NID).isPresent()) { nodeBuilder.setPsn((Short) pseudoIsisNode.getChild(PSN_NID).get().getValue()); }

else

{ nodeBuilder.setPsn((short) 0); }

builder.setIsisPseudonode(nodeBuilder.build());
return builder.build();
}

Where ISO_PSEUDONODE_SYSTEM_NID is:
@VisibleForTesting
public static final NodeIdentifier ISO_PSEUDONODE_SYSTEM_NID = new NodeIdentifier(QName.cachedReference(QName.create(NodeDescriptors.QNAME, "is-is-router-identifier")));



 Comments   
Comment by Claudio David Gasparini [ 09/Nov/15 ]

https://git.opendaylight.org/gerrit/#/c/29436/

Generated at Wed Feb 07 19:12:38 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.