From 2d2a6f517caa65aa906bb9d92cc4736abdecaa0d Mon Sep 17 00:00:00 2001 From: David Schmitz <schmitz@lrz.de> Date: Fri, 1 Mar 2024 12:48:36 +0000 Subject: [PATCH] rule_editing: remove synthetic adding of a zero stat count when a rule is edited on a router, as actually no reset of the statistic values happen on the router --- flowspec/tasks.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/flowspec/tasks.py b/flowspec/tasks.py index 19aa8905..7947c307 100644 --- a/flowspec/tasks.py +++ b/flowspec/tasks.py @@ -82,11 +82,12 @@ def edit(routepk, callback=None): route.status = "ACTIVE" route.response = response route.save() # save() has to be called before snmp_add_initial_zero_value, as last_updated DB filed is updated now on every call of save() and last db_measurement time must become >= this new last_updated value - try: - #snmp_add_initial_zero_value.delay(str(route.id), True) - snmp_add_initial_zero_value(routepk, route.id, True) - except Exception as e: - logger.error("tasks::edit(): route="+str(route)+", ACTIVE, add_initial_zero_value failed: "+str(e)) + if False: # actually wrong to use it for an edited active rule, as the stats values do not drop to zero on the JUNOS router + try: + #snmp_add_initial_zero_value.delay(str(route.id), True) + snmp_add_initial_zero_value(routepk, route.id, True) + except Exception as e: + logger.error("tasks::edit(): route="+str(route)+", ACTIVE, add_initial_zero_value failed: "+str(e)) elif response=="Task timeout": if deactivate_route.request.retries < settings.NETCONF_MAX_RETRY_BEFORE_ERROR: # repeat the action -- GitLab