summaryrefslogtreecommitdiffstats
path: root/extras/vpp_if_stats/vpp_if_stats.go
diff options
context:
space:
mode:
authorKoren Lev <korenlev@gmail.com>2018-12-06 10:51:18 +0200
committerOle Trøan <otroan@employees.org>2018-12-07 10:42:00 +0000
commitf3b7a5e47af2dbb6a49b53fef56bc73e41cbf431 (patch)
tree108831a321547d6395084fa05677b1e54b148366 /extras/vpp_if_stats/vpp_if_stats.go
parent9f6957d1a5b23d4bee9390da20537db6e93b3433 (diff)
vpp_if_stats: Fixing a bug in getting vpp interfaces indexes
Change-Id: I6290945a94b4f7878e9af94cc7daec455327482e Signed-off-by: Koren Lev <korenlev@gmail.com>
Diffstat (limited to 'extras/vpp_if_stats/vpp_if_stats.go')
-rw-r--r--[-rwxr-xr-x]extras/vpp_if_stats/vpp_if_stats.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/extras/vpp_if_stats/vpp_if_stats.go b/extras/vpp_if_stats/vpp_if_stats.go
index 48ce0853d1e..90c1700430c 100755..100644
--- a/extras/vpp_if_stats/vpp_if_stats.go
+++ b/extras/vpp_if_stats/vpp_if_stats.go
@@ -117,9 +117,9 @@ func (v *vppConnector) reduceCombinedCounters(stat *adapter.StatEntry) *[]adapte
counters := stat.Data.(adapter.CombinedCounterStat)
stats := make([]adapter.CombinedCounter, len(v.Interfaces))
for _, workerStats := range counters {
- for i, interfaceStats := range workerStats {
- stats[i].Bytes += interfaceStats.Bytes
- stats[i].Packets += interfaceStats.Packets
+ for i := 0; i < len(v.Interfaces); i++ {
+ stats[i].Bytes += workerStats[i].Bytes
+ stats[i].Packets += workerStats[i].Packets
}
}
return &stats
@@ -129,8 +129,8 @@ func (v *vppConnector) reduceSimpleCounters(stat *adapter.StatEntry) *[]adapter.
counters := stat.Data.(adapter.SimpleCounterStat)
stats := make([]adapter.Counter, len(v.Interfaces))
for _, workerStats := range counters {
- for i, interfaceStats := range workerStats {
- stats[i] += interfaceStats
+ for i := 0; i < len(v.Interfaces); i++ {
+ stats[i] += workerStats[i]
}
}
return &stats