From 9e52c23ed5acc5f081f2fb289405be08e976a2a2 Mon Sep 17 00:00:00 2001 From: luxin Date: Wed, 7 Feb 2018 10:51:10 +0800 Subject: Transfer data to nfv-lcm Change-Id: I548c892e850dbaf57d8ba902367c68c434e5a04f Issue-ID: VFC-749 Signed-off-by: luxin --- .../svnfm/vnfmadapter/service/process/VnfMgr.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java index 9e58d6bb..a4f0a697 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java @@ -319,4 +319,31 @@ public class VnfMgr { restJson = (new VnfMgrVnfm()).healVnf(jsonObject, vnfmObjcet, vnfmId, vnfInstanceId); return restJson; } + + public JSONObject getJobFromVnfm(String jobId, String vnfmId) { + LOG.warn("function=getJobFromVnfm, jobId:{}, vnfmId:{}", jobId, vnfmId); + JSONObject restJson = new JSONObject(); + JSONObject vnfmObjcet = VnfmUtil.getVnfmById(vnfmId); + if(vnfmObjcet.isNullObject()) { + LOG.error("function=getJobFromVnfm, msg=vnfm not exists, vnfmId: {}", vnfmId); + return restJson; + } + restJson = (new VnfMgrVnfm()).getJobFromVnfm(vnfmObjcet, jobId); + return restJson; + } + + public String transferToLcm(JSONObject restJson) { + LOG.warn("function=transferToLcm, restJson: {}", restJson); + JSONObject responseJson = new JSONObject(); + JSONObject jobInfoJson = new JSONObject(); + JSONObject jobInfo = restJson.getJSONObject("data").getJSONObject("job_info"); + jobInfoJson.put("jobId", jobInfo.getString("job_id")); + responseJson.put("progress", jobInfo.getString("task_progress_rate")); + responseJson.put("status", jobInfo.getString("task_status")); + responseJson.put("errorCode", jobInfo.getString("error_code")); + responseJson.put("responseId", jobInfo.getString("task_progress_rate")); + jobInfoJson.put("responsedescriptor", responseJson); + LOG.warn("function=getJobBody, jobInfoJson: {}", jobInfoJson); + return jobInfoJson.toString(); + } } -- cgit 1.2.3-korg