summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/lcm/nf/biz/create_subscription.py17
-rw-r--r--lcm/lcm/nf/biz/terminate_vnf.py4
-rw-r--r--lcm/lcm/pub/utils/notificationsutil.py3
-rw-r--r--lcm/tox.ini2
4 files changed, 14 insertions, 12 deletions
diff --git a/lcm/lcm/nf/biz/create_subscription.py b/lcm/lcm/nf/biz/create_subscription.py
index 2b1f6064..5f981d0a 100644
--- a/lcm/lcm/nf/biz/create_subscription.py
+++ b/lcm/lcm/nf/biz/create_subscription.py
@@ -53,14 +53,15 @@ class CreateSubscription:
def check_callbackuri_connection(self):
logger.debug("SubscribeNotification-post::> Sending GET request "
"to %s" % self.callback_uri)
- try:
- response = requests.get(self.callback_uri, timeout=2)
- if response.status_code != status.HTTP_204_NO_CONTENT:
- raise NFLCMException("callbackUri %s returns %s status "
- "code." % (self.callback_uri, response.status_code))
- except Exception:
- raise NFLCMException("callbackUri %s didn't return 204 status"
- "code." % self.callback_uri)
+ retry_count = 3
+ while retry_count > 0:
+ response = requests.get(self.callback_uri, timeout=10)
+ if response.status_code == status.HTTP_204_NO_CONTENT:
+ return
+ logger.debug("callbackUri %s returns %s status code." % (self.callback_uri, response.status_code))
+ retry_count = - 1
+
+ raise NFLCMException("callbackUri %s didn't return 204 status." % self.callback_uri)
def do_biz(self):
self.subscription_id = str(uuid.uuid4())
diff --git a/lcm/lcm/nf/biz/terminate_vnf.py b/lcm/lcm/nf/biz/terminate_vnf.py
index 2b04dc96..e18fad90 100644
--- a/lcm/lcm/nf/biz/terminate_vnf.py
+++ b/lcm/lcm/nf/biz/terminate_vnf.py
@@ -66,8 +66,8 @@ class TerminateVnf(Thread):
self.lcm_op_occ = VnfLcmOpOcc(
vnf_inst_id=nf_inst_id,
lcm_op_id=job_id,
- operation=OPERATION_TYPE.SCALE,
- task=OPERATION_TASK.SCALE
+ operation=OPERATION_TYPE.TERMINATE,
+ task=OPERATION_TASK.TERMINATE
)
def run(self):
diff --git a/lcm/lcm/pub/utils/notificationsutil.py b/lcm/lcm/pub/utils/notificationsutil.py
index fd4efa36..b57b470c 100644
--- a/lcm/lcm/pub/utils/notificationsutil.py
+++ b/lcm/lcm/pub/utils/notificationsutil.py
@@ -52,7 +52,8 @@ class NotificationsUtil(object):
logger.info("Send Notifications to the callbackUri")
filters = {
"operationState": "operation_states",
- "operation": "operation_types"
+ "operation": "operation_types",
+ "vnfInstanceId": "vnf_instance_filter"
}
subscriptions_filter = {v + "__contains": notification[k] for k, v in list(filters.items())}
diff --git a/lcm/tox.ini b/lcm/tox.ini
index 54f7ae87..6f61451f 100644
--- a/lcm/tox.ini
+++ b/lcm/tox.ini
@@ -23,5 +23,5 @@ commands =
{[testenv]commands}
[testenv:cov]
-deps = coverage
+deps = coverage==4.2
commands = coverage xml --omit="*test*,*__init__.py,*site-packages*"