summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
diff options
context:
space:
mode:
authoremartin <ephraim.martin@est.tech>2020-02-27 13:56:52 +0000
committeremartin <ephraim.martin@est.tech>2020-02-28 11:24:53 +0000
commitc19a0a85bbbc8dcf0633a32d26f4128f6c8c4544 (patch)
tree234c14ca8729b852f0ea229483807890b8f96362 /components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
parent82a39f7da3177a9b9b700c7291ed5ea47c90e478 (diff)
Update PM subscription event for PMSH
* Add control loop name * Remove invariant id reference Issue-ID: DCAEGEN2-2100 Signed-off-by: emartin <ephraim.martin@est.tech> Change-Id: I6bbb757e07f3d930ecd28bd3106df307a264ff65
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py8
1 files changed, 6 insertions, 2 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 9ff0c653..c8b3bc77 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
@@ -37,6 +37,8 @@ class AppConfig:
self.key_path = kwargs.get('key_path')
self.streams_subscribes = kwargs.get('streams_subscribes')
self.streams_publishes = kwargs.get('streams_publishes')
+ self.operational_policy_name = kwargs.get('operational_policy_name')
+ self.control_loop_name = kwargs.get('control_loop_name')
def get_mr_sub(self, sub_name):
"""
@@ -127,16 +129,17 @@ class _MrPub(_DmaapMrClient):
logger.debug(e)
raise
- def publish_subscription_event_data(self, subscription, xnf_name):
+ def publish_subscription_event_data(self, subscription, xnf_name, app_conf):
"""
Update the Subscription dict with xnf and policy name then publish to DMaaP MR topic.
Args:
subscription: the `Subscription` <Subscription> object.
xnf_name: the xnf to include in the event.
+ app_conf (AppConfig): the application configuration.
"""
try:
- subscription_event = subscription.prepare_subscription_event(xnf_name)
+ subscription_event = subscription.prepare_subscription_event(xnf_name, app_conf)
self.publish_to_topic(subscription_event)
except Exception as e:
logger.debug(f'pmsh_utils.publish_subscription_event_data : {e}')
@@ -249,6 +252,7 @@ class PeriodicTask(Timer):
"""
See :class:`Timer`.
"""
+
def run(self):
while not self.finished.wait(self.interval):
self.function(*self.args, **self.kwargs)