summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/subscription.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/subscription.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/subscription.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/subscription.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/subscription.py b/components/pm-subscription-handler/pmsh_service/mod/subscription.py
index 7a0b88c1..5449f420 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/subscription.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/subscription.py
@@ -43,25 +43,26 @@ class Subscription:
self.administrativeState = kwargs.get('administrativeState')
self.fileBasedGP = kwargs.get('fileBasedGP')
self.fileLocation = kwargs.get('fileLocation')
- self.nfTypeModelInvariantId = kwargs.get('nfTypeModelInvariantId')
self.nfFilter = kwargs.get('nfFilter')
self.measurementGroups = kwargs.get('measurementGroups')
- def prepare_subscription_event(self, xnf_name):
+ def prepare_subscription_event(self, xnf_name, app_conf):
"""Prepare the sub event for publishing
Args:
xnf_name: the AAI xnf name.
+ app_conf (AppConfig): the application configuration.
Returns:
dict: the Subscription event to be published.
"""
clean_sub = {k: v for k, v in self.__dict__.items() if k != 'nfFilter'}
- clean_sub.update({'nfName': xnf_name, 'policyName': f'OP-{self.subscriptionName}',
- 'changeType': 'DELETE'
- if self.administrativeState == AdministrativeState.LOCKED.value
- else 'CREATE'})
- return clean_sub
+ sub_event = {'nfName': xnf_name, 'policyName': app_conf.operational_policy_name,
+ 'changeType': 'DELETE'
+ if self.administrativeState == AdministrativeState.LOCKED.value
+ else 'CREATE', 'closedLoopControlName': app_conf.control_loop_name,
+ 'subscription': clean_sub}
+ return sub_event
def create(self):
""" Creates a subscription database entry
@@ -159,7 +160,7 @@ class Subscription:
@retry(wait=wait_exponential(multiplier=1, min=30, max=120), stop=stop_after_attempt(3),
retry=retry_if_exception_type(Exception))
- def process_subscription(self, nfs, mr_pub):
+ def process_subscription(self, nfs, mr_pub, app_conf):
action = 'Deactivate'
sub_nf_state = SubNfState.PENDING_DELETE.value
self.update_subscription_status()
@@ -170,7 +171,7 @@ class Subscription:
try:
for nf in nfs:
- mr_pub.publish_subscription_event_data(self, nf.nf_name)
+ mr_pub.publish_subscription_event_data(self, nf.nf_name, app_conf)
logger.debug(f'Publishing Event to {action} '
f'Sub: {self.subscriptionName} for the nf: {nf.nf_name}')
self.add_network_functions_to_subscription(nfs)