예제 #1
0
    def terminate_vnf(self, context, vnf_instance, terminate_vnf_req):

        vim_info = vnflcm_utils._get_vim(context,
                                         vnf_instance.vim_connection_info)

        vim_connection_info = objects.VimConnectionInfo.obj_from_primitive(
            vim_info, context)

        LOG.info("Terminating vnf %s", vnf_instance.id)
        try:
            self._delete_vnf_instance_resources(
                context,
                vnf_instance,
                vim_connection_info,
                terminate_vnf_req=terminate_vnf_req)

            vnf_instance.instantiated_vnf_info.reinitialize()
            self._vnf_instance_update(context,
                                      vnf_instance,
                                      vim_connection_info=[],
                                      task_state=None)

            LOG.info("Vnf terminated %s successfully", vnf_instance.id)
        except Exception as exp:
            with excutils.save_and_reraise_exception():
                LOG.error(
                    "Unable to terminate vnf '%s' instance. "
                    "Error: %s", vnf_instance.id,
                    encodeutils.exception_to_unicode(exp))
예제 #2
0
    def heal_vnf(self, context, vnf_instance, heal_vnf_request):
        LOG.info("Request received for healing vnf '%s'", vnf_instance.id)
        vim_info = vnflcm_utils._get_vim(context,
            vnf_instance.vim_connection_info)

        vim_connection_info = objects.VimConnectionInfo.obj_from_primitive(
            vim_info, context)

        if not heal_vnf_request.vnfc_instance_id:
            self._respawn_vnf(context, vnf_instance, vim_connection_info,
                         heal_vnf_request)
        else:
            self._heal_vnf(context, vnf_instance, vim_connection_info,
                      heal_vnf_request)

        LOG.info("Request received for healing vnf '%s' is completed "
                 "successfully", vnf_instance.id)
예제 #3
0
    def instantiate_vnf(self, context, vnf_instance, instantiate_vnf_req):

        vim_connection_info_list = vnflcm_utils.\
            _get_vim_connection_info_from_vnf_req(vnf_instance,
                    instantiate_vnf_req)

        self._vnf_instance_update(context, vnf_instance,
                vim_connection_info=vim_connection_info_list)

        vim_info = vnflcm_utils._get_vim(context,
                instantiate_vnf_req.vim_connection_info)

        vim_connection_info = objects.VimConnectionInfo.obj_from_primitive(
            vim_info, context)

        self._instantiate_vnf(context, vnf_instance, vim_connection_info,
                              instantiate_vnf_req)

        self._vnf_instance_update(context, vnf_instance,
                    instantiation_state=fields.VnfInstanceState.INSTANTIATED,
                    task_state=None)
예제 #4
0
    def _rollback_vnf(vnflcm_driver, context, vnf_instance):
        vim_info = vnflcm_utils._get_vim(context,
                vnf_instance.vim_connection_info)

        vim_connection_info = objects.VimConnectionInfo.obj_from_primitive(
            vim_info, context)

        LOG.info("Rollback vnf %s", vnf_instance.id)
        try:
            vnflcm_driver._delete_vnf_instance_resources(context, vnf_instance,
                    vim_connection_info)

            if vnf_instance.instantiated_vnf_info:
                vnf_instance.instantiated_vnf_info.reinitialize()

            vnflcm_driver._vnf_instance_update(context, vnf_instance,
                    vim_connection_info=[], task_state=None)

            LOG.info("Vnf %s rollback completed successfully", vnf_instance.id)
        except Exception as ex:
            LOG.error("Unable to rollback vnf instance "
                      "%s due to error: %s", vnf_instance.id, ex)