diff options
author | Gao Weitao <victor.gao@huawei.com> | 2018-02-07 04:07:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-02-07 04:07:10 +0000 |
commit | bbe27313fe3e97e4106051e2dade049eb59f8239 (patch) | |
tree | 3901d651b0a7e3865e84bda93f3cbcb3e40c68e1 | |
parent | 14b94e7f5f473bb303ac950d14666f42e427d15f (diff) | |
parent | 9e52c23ed5acc5f081f2fb289405be08e976a2a2 (diff) |
Merge "Transfer data to nfv-lcm"
-rw-r--r-- | huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java | 27 |
1 files changed, 27 insertions, 0 deletions
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(); + } } |