# 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
)
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.utils.jobutil import JobUtil
from lcm.pub.utils.timeutil import now_time
from lcm.pub.utils.notificationsutil import NotificationsUtil
logger.info('Rollback resource complete')
def do_notify_delete(self, res_type, res_id):
- logger.error('Deleting [%s] resource, resourceid [%s]' % (res_type, res_id))
+ logger.debug('Deleting [%s] resource, resourceid [%s]' % (res_type, res_id))
resource_type = RESOURCE_MAP.keys()[RESOURCE_MAP.values().index(res_type)]
resource_table = globals().get(resource_type + 'InstModel')
resource_table.objects.filter(instid=self.nf_inst_id, resourceid=res_id).delete()
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)
+ try:
+ resp = notify_lcm_to_nfvo(json.dumps(self.notify_data))
+ logger.info('Lcm notify end, response: %s' % resp)
+ except Exception as e:
+ logger.error("Lcm terminate notify failed: %s", e.message)
NotificationsUtil().send_notification(self.notify_data)
def vnf_term_failed_handle(self, error_msg):
logger.error('VNF termination failed, detail message: %s' % error_msg)
- NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='failed', lastuptime=now_time())
+ NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(lastuptime=now_time())
JobUtil.add_job_status(self.job_id, 255, error_msg)