From 80bbc754e4daa985bc4c2041c3c749ba90684e80 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 5 Sep 2021 15:47:15 +0000 Subject: [PATCH] Consistently clear ifstat members --- vpp-snmp-agent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vpp-snmp-agent.py b/vpp-snmp-agent.py index cd391d1..a709c65 100755 --- a/vpp-snmp-agent.py +++ b/vpp-snmp-agent.py @@ -46,7 +46,7 @@ def vppstat_update(): logger.info("Fetching interface data from VPP") vppstat = VPPStats(socketname='/run/vpp/stats.sock', timeout=2) vppstat.connect() - vppstat_ifstat['ifNames'] = vppstat['/if/names'] + vppstat_ifstat['ifNames'].clear() vppstat_ifstat['ifHCInOctets'].clear() vppstat_ifstat['ifHCInUcastPkts'].clear() vppstat_ifstat['ifHCInMulticastPkts'].clear() @@ -57,6 +57,7 @@ def vppstat_update(): vppstat_ifstat['ifHCOutBroadcastPkts'].clear() vppstat_ifstat['ifHighSpeed'].clear() + vppstat_ifstat['ifNames'] = vppstat['/if/names'] for i in range(len(vppstat_ifstat['ifNames'])): vppstat_ifstat['ifHCInOctets'].append( vppstat['/if/rx'][:, i].sum_octets())