Clamp all COUNTER32 at mod 2^32

This commit is contained in:
Pim van Pelt
2021-09-05 20:15:06 +00:00
parent 7dec1329d2
commit 9b39aa61c2

View File

@ -167,8 +167,9 @@ class ifInMulticastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), self.set_COUNTER32(
vppstat['/if/rx-multicast'][:, i].sum_packets()) str(i + 1),
vppstat['/if/rx-multicast'][:, i].sum_packets() % 2**32)
class ifInBroadcastPkts(pyagentx.Updater): class ifInBroadcastPkts(pyagentx.Updater):
@ -177,8 +178,9 @@ class ifInBroadcastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), self.set_COUNTER32(
vppstat['/if/rx-broadcast'][:, i].sum_packets()) str(i + 1),
vppstat['/if/rx-broadcast'][:, i].sum_packets() % 2**32)
class ifOutMulticastPkts(pyagentx.Updater): class ifOutMulticastPkts(pyagentx.Updater):
@ -187,8 +189,9 @@ class ifOutMulticastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), self.set_COUNTER32(
vppstat['/if/tx-multicast'][:, i].sum_packets()) str(i + 1),
vppstat['/if/tx-multicast'][:, i].sum_packets() % 2**32)
class ifOutBroadcastPkts(pyagentx.Updater): class ifOutBroadcastPkts(pyagentx.Updater):
@ -197,8 +200,9 @@ class ifOutBroadcastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), self.set_COUNTER32(
vppstat['/if/tx-broadcast'][:, i].sum_packets()) str(i + 1),
vppstat['/if/tx-broadcast'][:, i].sum_packets() % 2**32)
class ifHCInOctets(pyagentx.Updater): class ifHCInOctets(pyagentx.Updater):
@ -338,8 +342,8 @@ class ifInOctets(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/rx'][:, self.set_COUNTER32(str(i + 1),
i].sum_octets()) vppstat['/if/rx'][:, i].sum_octets() % 2**32)
class ifInUcastPkts(pyagentx.Updater): class ifInUcastPkts(pyagentx.Updater):
@ -348,8 +352,8 @@ class ifInUcastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/rx'][:, self.set_COUNTER32(str(i + 1),
i].sum_packets()) vppstat['/if/rx'][:, i].sum_packets() % 2**32)
class ifInNUcastPkts(pyagentx.Updater): class ifInNUcastPkts(pyagentx.Updater):
@ -358,8 +362,9 @@ class ifInNUcastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), self.set_COUNTER32(
vppstat['/if/rx-multicast'][:, i].sum_packets()) str(i + 1),
vppstat['/if/rx-multicast'][:, i].sum_packets() % 2**32)
class ifInDiscards(pyagentx.Updater): class ifInDiscards(pyagentx.Updater):
@ -368,8 +373,8 @@ class ifInDiscards(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/rx-no-buf'][:, self.set_COUNTER32(str(i + 1),
i].sum()) vppstat['/if/rx-no-buf'][:, i].sum() % 2**32)
class ifInErrors(pyagentx.Updater): class ifInErrors(pyagentx.Updater):
@ -378,7 +383,8 @@ class ifInErrors(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/rx-error'][:, i].sum()) self.set_COUNTER32(str(i + 1),
vppstat['/if/rx-error'][:, i].sum() % 2**32)
class ifOutOctets(pyagentx.Updater): class ifOutOctets(pyagentx.Updater):
@ -387,8 +393,8 @@ class ifOutOctets(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/tx'][:, self.set_COUNTER32(str(i + 1),
i].sum_octets()) vppstat['/if/tx'][:, i].sum_octets() % 2**32)
class ifOutUcastPkts(pyagentx.Updater): class ifOutUcastPkts(pyagentx.Updater):
@ -397,8 +403,8 @@ class ifOutUcastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/tx'][:, self.set_COUNTER32(str(i + 1),
i].sum_packets()) vppstat['/if/tx'][:, i].sum_packets() % 2**32)
class ifOutNUcastPkts(pyagentx.Updater): class ifOutNUcastPkts(pyagentx.Updater):
@ -407,8 +413,9 @@ class ifOutNUcastPkts(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), self.set_COUNTER32(
vppstat['/if/tx-multicast'][:, i].sum_packets()) str(i + 1),
vppstat['/if/tx-multicast'][:, i].sum_packets() % 2**32)
class ifOutDiscards(pyagentx.Updater): class ifOutDiscards(pyagentx.Updater):
@ -417,7 +424,8 @@ class ifOutDiscards(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/drops'][:, i].sum()) self.set_COUNTER32(str(i + 1),
vppstat['/if/drops'][:, i].sum() % 2**32)
class ifOutErrors(pyagentx.Updater): class ifOutErrors(pyagentx.Updater):
@ -426,7 +434,8 @@ class ifOutErrors(pyagentx.Updater):
vppstat.connect() vppstat.connect()
for i in range(len(vppstat['/if/names'])): for i in range(len(vppstat['/if/names'])):
self.set_COUNTER32(str(i + 1), vppstat['/if/tx-error'][:, i].sum()) self.set_COUNTER32(str(i + 1),
vppstat['/if/tx-error'][:, i].sum() % 2**32)
class MyAgent(pyagentx.Agent): class MyAgent(pyagentx.Agent):