[BGPCEP-550] bgp:show-stats Karaf CLI causes NPE Created: 17/Sep/16  Updated: 03/Mar/19  Resolved: 24/Oct/16

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

Type: Bug
Reporter: Ajay L Assignee: Ajay L
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: 6737

 Description   

Seen when controller has 2 peers, one connected, one not

opendaylight-user@root>
opendaylight-user@root>bgp:show-stats
Attribute | Value
---------------------------------------------------------------------------------------------------------------------------------------------------------
Object Name | org.opendaylight.controller:instanceName=example-bgp-peer-2,moduleFactoryName=bgp-peer,type=RuntimeBean
HoldtimeCurrent | 180
KeepaliveCurrent | 60
SessionDuration | 0:00:39:10
SessionState | UP
MessagesStats.ErrorMsgsSent | 0
MessagesStats.ErrorMsgsReceived | 0
MessagesStats.KeepAliveMsgsSent | Counter32 [_value=37]
MessagesStats.KeepAliveMsgsReceived | Counter32 [_value=38]
MessagesStats.TotalMsgsSent | Counter32 [_value=39]
MessagesStats.TotalMsgsReceived | Counter32 [_value=42]
MessagesStats.UpdateMsgsSent | Counter32 [_value=0]
MessagesStats.UpdateMsgsReceived | Counter32 [_value=4]
PeerPreferences.AddPathCapability | false
PeerPreferences.AS | AsNumber [_value=64496]
PeerPreferences.BgpExtendedMessageCapability | false
PeerPreferences.BgpId | Ipv4Address [_value=192.168.2.1]
PeerPreferences.FourOctetAsCapability | true
PeerPreferences.GrCapability | false
PeerPreferences.Port | PortNumber [_value=34820]
PeerPreferences.RouteRefreshCapability | true
SpeakerPreferences.AddPathCapability | true
SpeakerPreferences.AS | AsNumber [_value=64496]
SpeakerPreferences.BgpExtendedMessageCapability | true
SpeakerPreferences.BgpId | Ipv4Address [_value=10.18.162.90]
SpeakerPreferences.FourOctetAsCapability | true
SpeakerPreferences.GrCapability | false
SpeakerPreferences.Port | PortNumber [_value=1790]
SpeakerPreferences.RouteRefreshCapability | true
Error executing command: java.lang.NullPointerException
opendaylight-user@root>

2016-09-16 22:14:56,888 | ERROR | l for user karaf | ShellUtil | 27 - org.apache.karaf.shell.console - 3.0.7 | Exception caught while executing command
java.lang.NullPointerException
at org.opendaylight.protocol.bgp.cli.utils.BgpCliUtils.displayAll(BgpCliUtils.java:40)
at org.opendaylight.protocol.bgp.cli.ShowBGPStatsCommandProvider.onExecution(ShowBGPStatsCommandProvider.java:26)
at org.opendaylight.protocol.bgp.cli.AbstractStatsCommandProvider.lambda$doExecute$0(AbstractStatsCommandProvider.java:33)
at java.lang.Iterable.forEach(Iterable.java:75)[:1.8.0_72-internal]
at org.opendaylight.protocol.bgp.cli.AbstractStatsCommandProvider.doExecute(AbstractStatsCommandProvider.java:32)
at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33)[27:org.apache.karaf.shell.console:3.0.7]
at Proxy68cf3053_ba0f_432d_a37c_2ad89a476d87.execute(Unknown Source)[:]
at Proxy68cf3053_ba0f_432d_a37c_2ad89a476d87.execute(Unknown Source)[:]
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[27:org.apache.karaf.shell.console:3.0.7]
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
at org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:210)
at org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1$1.run(LocalConsoleManager.java:109)
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_72-internal]
at org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:57)[28:org.apache.karaf.jaas.modules:3.0.7]
at org.apache.karaf.shell.console.impl.jline.LocalConsoleManager$2$1.run(LocalConsoleManager.java:102)[27:org.apache.karaf.shell.console:3.0.7]



 Comments   
Comment by Kevin Wang [ 27/Sep/16 ]

The root cause is in Boron, we have refactored the statistic API of BGP. However, the BGP karaf CLI is still using the old API which was used in Beryllium.

Right now, the BGP karaf CLI 1. is still using the API that has been deleted 2. is not using the new API we introduced in Boron.

Comment by Ajay L [ 21/Oct/16 ]

Kevin - on stable/boron, if bgp-peer is configured using OpenConfig API as opposed to modifying 41-bgp-example.xml config file, bgp:show-stats command is not displaying any output. So looks like the BGP CLI impl needs to be updated quite a bit to match stuff in Boron. Lets just fix the NPE issue using this bug and open a new bug to track the changes required to make the CLI compatible with latest code

Comment by Ajay L [ 21/Oct/16 ]

stable/boron: https://git.opendaylight.org/gerrit/47374

Comment by Kevin Wang [ 21/Oct/16 ]

Thanks for the help. I noticed the problem as well. I will spend some time refactoring the cli feature after SR1. It is missing some new BGP stat change I added to Boron anyway.

Comment by Milos Fabian [ 24/Oct/16 ]

master: https://git.opendaylight.org/gerrit/#/c/47400/

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