summaryrefslogtreecommitdiffstats
path: root/lcm/lcm/nf/biz/terminate_vnf.py
diff options
context:
space:
mode:
authorlaili <lai.li@zte.com.cn>2018-09-13 10:54:16 +0800
committerLi Lai <lai.li@zte.com.cn>2018-09-13 02:55:31 +0000
commit9975ee2ab76998715538fa3aeee377b947125b7e (patch)
tree7a565b330664b3ce1a9149022297012ab6f9f668 /lcm/lcm/nf/biz/terminate_vnf.py
parent5729b6abb1a43319bfa419db6548ae8df6120479 (diff)
Notification stuffs.
- Send operation and terminate notification using notificationutil. Change-Id: Id32d6ed37cf8f09c836c90c03819b8125135e69a Issue-ID: VFC-1095 Signed-off-by: laili <lai.li@zte.com.cn>
Diffstat (limited to 'lcm/lcm/nf/biz/terminate_vnf.py')
-rw-r--r--lcm/lcm/nf/biz/terminate_vnf.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/lcm/lcm/nf/biz/terminate_vnf.py b/lcm/lcm/nf/biz/terminate_vnf.py
index 5b299f20..4f74f62d 100644
--- a/lcm/lcm/nf/biz/terminate_vnf.py
+++ b/lcm/lcm/nf/biz/terminate_vnf.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import json
+# import json
import logging
import traceback
from threading import Thread
@@ -24,13 +24,15 @@ from lcm.pub.database.models import (
FlavourInstModel, SubNetworkInstModel
)
from lcm.pub.exceptions import NFLCMException
-from lcm.pub.msapi.gvnfmdriver import prepare_notification_data, notify_lcm_to_nfvo
+from lcm.pub.msapi.gvnfmdriver import prepare_notification_data
+# from lcm.pub.msapi.gvnfmdriver import notify_lcm_to_nfvo
from lcm.pub.utils.jobutil import JobUtil
from lcm.pub.utils.timeutil import now_time
+from lcm.pub.utils.notificationsutil import NotificationsUtil
from lcm.pub.utils.values import ignore_case_get
from lcm.pub.vimapi import adaptor
from lcm.nf.biz.grant_vnf import grant_resource
-from lcm.nf.const import GRANT_TYPE
+from lcm.nf.const import CHANGE_TYPE, GRANT_TYPE, OPERATION_TYPE
logger = logging.getLogger(__name__)
@@ -98,7 +100,7 @@ class TerminateVnf(Thread):
}
def query_notify_data(self):
- self.notify_data = prepare_notification_data(self.nf_inst_id, self.job_id, "RMOVED")
+ self.notify_data = prepare_notification_data(self.nf_inst_id, self.job_id, CHANGE_TYPE.REMOVED, OPERATION_TYPE.TERMINATE)
NetworkInstModel.objects.filter(instid=self.nf_inst_id)
StorageInstModel.objects.filter(instid=self.nf_inst_id)
PortInstModel.objects.filter(instid=self.nf_inst_id)
@@ -120,8 +122,9 @@ class TerminateVnf(Thread):
def lcm_notify(self):
NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='NOT_INSTANTIATED', lastuptime=now_time())
logger.info('Send notify request to nfvo')
- resp = notify_lcm_to_nfvo(json.dumps(self.notify_data))
- logger.info('Lcm notify end, response: %s' % resp)
+ # resp = notify_lcm_to_nfvo(json.dumps(self.notify_data))
+ # logger.info('Lcm notify end, response: %s' % resp)
+ NotificationsUtil().send_notification(self.notify_data)
def vnf_term_failed_handle(self, error_msg):
logger.error('VNF termination failed, detail message: %s' % error_msg)