diff options
author | emartin <ephraim.martin@est.tech> | 2020-02-24 14:13:03 +0000 |
---|---|---|
committer | emartin <ephraim.martin@est.tech> | 2020-02-26 15:25:50 +0000 |
commit | e7f6914ca5397987eddc6788a6e378c51b12ce52 (patch) | |
tree | 1c4a1015afa1030ee3e75fdf78c282a2ce994433 /components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py | |
parent | de549f5f1bb3e0a6f94e9755ae0800b469114113 (diff) |
Handle AAI Update and Delete events for PMSH
Change-Id: I7f84e4429011bbaea4de23077ce23629b897fd7d
Issue-ID: DCAEGEN2-1846
Signed-off-by: emartin <ephraim.martin@est.tech>
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py')
-rwxr-xr-x | components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py index 4a77543b..9ff0c653 100755 --- a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py +++ b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py @@ -18,14 +18,15 @@ import json import threading import uuid +from threading import Timer import requests from requests.auth import HTTPBasicAuth from tenacity import retry, wait_fixed, retry_if_exception_type import mod.pmsh_logging as logger -from mod.subscription import Subscription, SubNfState, AdministrativeState from mod.network_function import NetworkFunction +from mod.subscription import Subscription, SubNfState, AdministrativeState class AppConfig: @@ -163,6 +164,7 @@ class _MrSub(_DmaapMrClient): try: session = requests.Session() headers = {'accept': 'application/json', 'content-type': 'application/json'} + logger.debug(f'Request sent to MR topic: {self.topic_url}') response = session.get(f'{self.topic_url}/{consumer_group}/{consumer_id}' f'?timeout={timeout}', auth=HTTPBasicAuth(self.aaf_id, self.aaf_pass), headers=headers, @@ -241,3 +243,12 @@ policy_response_handle_functions = { 'failed': Subscription.update_sub_nf_status } } + + +class PeriodicTask(Timer): + """ + See :class:`Timer`. + """ + def run(self): + while not self.finished.wait(self.interval): + self.function(*self.args, **self.kwargs) |