diff options
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/subscription.py')
-rwxr-xr-x | components/pm-subscription-handler/pmsh_service/mod/subscription.py | 19 |
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) |