Add lcm notify call in vnf inst and term
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / biz / instantiate_vnf.py
index 203a12b..101c96f 100644 (file)
@@ -20,7 +20,7 @@ from threading import Thread
 from lcm.pub.database.models import NfInstModel
 from lcm.pub.exceptions import NFLCMException
 from lcm.pub.msapi.gvnfmdriver import prepare_notification_data
-from lcm.pub.msapi.gvnfmdriver import notify_lcm_to_nfvo
+from lcm.pub.msapi.gvnfmdriver import notify_lcm_to_nfvo
 from lcm.pub.msapi.sdc_run_catalog import query_vnfpackage_by_id
 from lcm.pub.utils.jobutil import JobUtil
 from lcm.pub.utils.timeutil import now_time
@@ -136,8 +136,11 @@ class InstantiateVnf(Thread):
     def lcm_notify(self):
         notification_content = prepare_notification_data(self.nf_inst_id, self.job_id, CHANGE_TYPE.ADDED, OPERATION_TYPE.INSTANTIATE)
         logger.info('Notify request data = %s' % notification_content)
-        # resp = notify_lcm_to_nfvo(json.dumps(notification_content))
-        # logger.info('Lcm notify end, response %s' % resp)
+        try:
+            resp = notify_lcm_to_nfvo(json.dumps(notification_content))
+            logger.info('Lcm notify end, response %s' % resp)
+        except Exception as e:
+            logger.error("Lcm instantiate notify failed: %s", e.message)
         NotificationsUtil().send_notification(notification_content)
 
     def vnf_inst_failed_handle(self, error_msg):