summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service
diff options
context:
space:
mode:
authorERIMROB <robertas.rimkus@est.tech>2020-04-01 17:54:19 +0100
committerERIMROB <robertas.rimkus@est.tech>2020-04-02 12:10:25 +0100
commite97cde0ff09bc602a1ff665f573786c4f5a746ba (patch)
treead7f9d6645903f9431eb8b5fe404dd7ccdc6c4bf /components/pm-subscription-handler/pmsh_service
parentc3ab68bdccbff73659ceb1fe196e2d53d141e38f (diff)
[PMSH] Fix bug of deactivation during undeploy1.0.3
Signed-off-by: ERIMROB <robertas.rimkus@est.tech> Issue-ID: DCAEGEN2-2175 Change-Id: I70998a0d643b899c1b4d3ba86346297271a9b276
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/exit_handler.py2
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/subscription.py26
2 files changed, 26 insertions, 2 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py b/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
index adc4941c..3cb05daa 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
@@ -42,7 +42,7 @@ class ExitHandler:
logger.debug(f'Cancelling periodic task with thread name: {thread.name}.')
thread.cancel()
current_sub.administrativeState = AdministrativeState.LOCKED.value
- current_sub.process_subscription(self.subscription_handler.current_nfs,
+ current_sub.process_subscription(current_sub.get_network_functions(),
self.subscription_handler.mr_pub,
self.subscription_handler.app_conf)
ExitHandler.shutdown_signal_received = True
diff --git a/components/pm-subscription-handler/pmsh_service/mod/subscription.py b/components/pm-subscription-handler/pmsh_service/mod/subscription.py
index 99a787da..3add7200 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/subscription.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/subscription.py
@@ -22,7 +22,8 @@ from tenacity import retry, retry_if_exception_type, wait_exponential, stop_afte
import mod.pmsh_logging as logger
from mod import db
-from mod.db_models import SubscriptionModel, NfSubRelationalModel
+from mod.db_models import SubscriptionModel, NfSubRelationalModel, NetworkFunctionModel
+from mod.network_function import NetworkFunction
class SubNfState(Enum):
@@ -218,3 +219,26 @@ class Subscription:
update({NfSubRelationalModel.nf_sub_status: status}, synchronize_session='evaluate')
db.session.commit()
+
+ def _get_nf_models(self):
+ nf_sub_relationships = NfSubRelationalModel.query.filter(
+ NfSubRelationalModel.subscription_name == self.subscriptionName)
+ nf_models = []
+ for nf_sub_entry in nf_sub_relationships:
+ nf_model_object = NetworkFunctionModel.query.filter(
+ NetworkFunctionModel.nf_name == nf_sub_entry.nf_name).one_or_none()
+ nf_models.append(nf_model_object)
+
+ return nf_models
+
+ def get_network_functions(self):
+ nfs = []
+ nf_models = self._get_nf_models()
+ for nf_model in nf_models:
+ nf = NetworkFunction(
+ nf_name=nf_model.nf_name,
+ orchestration_status=nf_model.orchestration_status
+ )
+ nfs.append(nf)
+
+ return nfs