summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/network_function.py
diff options
context:
space:
mode:
authorefiacor <fiachra.corcoran@est.tech>2020-12-11 16:19:47 +0000
committerefiacor <fiachra.corcoran@est.tech>2021-01-12 11:35:09 +0000
commit5e0e87f7e86f511511d37f90242300296e7b5dc4 (patch)
treed8ed3fc96a28cbdcd347565837e8a3fb6bcf2742 /components/pm-subscription-handler/pmsh_service/mod/network_function.py
parent1e6f4d9c7ea75302f4b902dbbe13642b6d20d716 (diff)
[PMSH] Add retry mech for DELETE_FAILED NFs
Signed-off-by: efiacor <fiachra.corcoran@est.tech> Change-Id: I3980f0bb43c67e192828172dafe4e7be102dcc98 Issue-ID: DCAEGEN2-2152
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/network_function.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/network_function.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/network_function.py b/components/pm-subscription-handler/pmsh_service/mod/network_function.py
index a6d2164f..02656356 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/network_function.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/network_function.py
@@ -105,6 +105,19 @@ class NetworkFunction:
exc_info=True)
return not params_set
+ def increment_retry_count(self):
+ try:
+ NetworkFunctionModel.query.filter(
+ NetworkFunctionModel.nf_name == self.nf_name)\
+ .update({'retry_count': NetworkFunctionModel.retry_count + 1},
+ synchronize_session='evaluate')
+ db.session.commit()
+ except Exception as e:
+ logger.error(f'Failed to update retry_count of NetworkFunction: {self.nf_name}: {e}',
+ exc_info=True)
+ finally:
+ db.session.remove()
+
@staticmethod
def get(nf_name):
""" Retrieves a network function