summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py
diff options
context:
space:
mode:
authorefiacor <fiachra.corcoran@est.tech>2020-06-09 19:20:22 +0100
committerefiacor <fiachra.corcoran@est.tech>2020-06-17 14:57:29 +0100
commit80ff14860e3b8a7a2c29272c2c10c1e830c2141d (patch)
tree7e97d2b90e1dd5b6765e0bc88932c53197a107cf /components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py
parent2760519436f78975f16f26c412e842e34b28d624 (diff)
[PMSH] Improve CBS data handling
# AppConfog object fetch priodically # AAI client to only fetch AAI data Signed-off-by: efiacor <fiachra.corcoran@est.tech> Change-Id: I78315f141c3bb7e8b0d9efa818d294415fa79918 Issue-ID: DCAEGEN2-2146
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py')
-rw-r--r--components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py b/components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py
index 5ce03691..2b917cec 100644
--- a/components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/policy_response_handler.py
@@ -37,9 +37,9 @@ policy_response_handle_functions = {
class PolicyResponseHandler:
- def __init__(self, mr_sub, subscription_name, app):
+ def __init__(self, mr_sub, app_conf, app):
self.mr_sub = mr_sub
- self.subscription_name = subscription_name
+ self.app_conf = app_conf
self.app = app
@retry(wait=wait_fixed(5), retry=retry_if_exception_type(Exception))
@@ -48,18 +48,19 @@ class PolicyResponseHandler:
This method polls MR for response from policy. It checks whether the message is for the
relevant subscription and then handles the response
"""
- logger.info('Polling MR started for XNF activation/deactivation policy response events.')
self.app.app_context().push()
- administrative_state = Subscription.get(self.subscription_name).status
+ administrative_state = self.app_conf.subscription.administrativeState
+ logger.info('Polling MR started for XNF activation/deactivation policy response events.')
try:
response_data = self.mr_sub.get_from_topic('policy_response_consumer')
for data in response_data:
data = json.loads(data)
- if data['status']['subscriptionName'] == self.subscription_name:
+ if data['status']['subscriptionName'] \
+ == self.app_conf.subscription.subscriptionName:
nf_name = data['status']['nfName']
response_message = data['status']['message']
- self._handle_response(self.subscription_name, administrative_state,
- nf_name, response_message)
+ self._handle_response(self.app_conf.subscription.subscriptionName,
+ administrative_state, nf_name, response_message)
except Exception as err:
raise Exception(f'Error trying to poll policy response topic on MR: {err}')