class VfcManagerSol005 {

    public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException {

        ValidateUtil.assertObjectNotNull(jobId);
        // Step 1: query the current resource operation status
        ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(),
                nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
        // status = resourceOperationStatusRepository.findOne(Example.of(status))
        // .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status"));

        // Get NFVO details
        instanceNfvoMapping = instanceNfvoMappingRepository.findOneByJobId(jobId);

        // Step 2: start query
        LOGGER.info("SOL005 query ns status -> begin");
        String url = getUrl(jobId, CommonConstant.Step.QUERY);
        String methodType = CommonConstant.MethodType.GET;
        if (instanceNfvoMapping != null) {

            url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url;

        } else {
            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
        }

        // prepare restful parameters and options
        RestfulResponse rsp = restfulUtil.send(url, methodType, "");
        ValidateUtil.assertObjectNotNull(rsp);
        LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
        LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
        // Step 3:check the response staus
        if (!HttpCode.isSucess(rsp.getStatus())) {
            LOGGER.info("fail to query job status");
            ProblemDetails problemDetails = JsonUtil.unMarshal(rsp.getResponseContent(), ProblemDetails.class);
            status.setErrorCode(String.valueOf(rsp.getStatus()));
            status.setStatus(RequestsDbConstant.Status.ERROR);
            status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED + problemDetails.getDetail());
            resourceOperationStatusRepository.save(status);
            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
        }
        // Step 4: Process Network Service Instantiate Response
        NsLcmOpOcc nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsLcmOpOcc.class);
        if (CommonConstant.operationState.FAILED.equals(nsProgress.getOperationState())) {
            LOGGER.info("NS instantiate fails");
            status.setErrorCode(String.valueOf(rsp.getStatus()));
            status.setStatus(RequestsDbConstant.Status.ERROR);
            status.setStatusDescription(
                    CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED + nsProgress.getError().getDetail());
            resourceOperationStatusRepository.save(status);
            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
        }
        // Step 5: update segment operation progress

        if (nsProgress.getOperationState().equals(CommonConstant.operationState.PROCESSING)) {
            status.setProgress("40");
            status.setStatus(RequestsDbConstant.Status.PROCESSING);
            status.setStatusDescription("NS operation is in progress");
            resourceOperationStatusRepository.save(status);
            updateOperationStatusBasedOnResourceStatus(status);
        } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.PARTIALLY_COMPLETED)) {
            status.setProgress("60");
            status.setStatus(RequestsDbConstant.Status.PROCESSING);
            status.setStatusDescription("NS operation is partially completed");
            resourceOperationStatusRepository.save(status);
        } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.COMPLETED)) {
            status.setStatus(RequestsDbConstant.Status.FINISHED);
            status.setProgress("100");
            status.setStatusDescription("NS operation is Completed");
            resourceOperationStatusRepository.save(status);
            updateOperationStatusBasedOnResourceStatus(status);

        } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED)
                || nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED_TEMP)) {
            status.setStatus(RequestsDbConstant.Status.ERROR);
            status.setProgress("0");
            status.setStatusDescription("NS operation Failed");
            resourceOperationStatusRepository.save(status);
            updateOperationStatusBasedOnResourceStatus(status);
            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR);
        } else {
            LOGGER.error("unexcepted response status");

        }
        return rsp;
    }

    public  VfcManagerSol005();

}