diff options
author | luxin <luxin7@huawei.com> | 2018-02-07 10:51:10 +0800 |
---|---|---|
committer | luxin <luxin7@huawei.com> | 2018-02-07 10:51:10 +0800 |
commit | 9e52c23ed5acc5f081f2fb289405be08e976a2a2 (patch) | |
tree | 1daf8711f572b6d15e199d70a4c80560d1fe3fd7 /huawei/vnfmadapter/VnfmadapterService | |
parent | 46e585ee8f5cd85926f84e143036d9de350c9e3b (diff) |
Transfer data to nfv-lcm
Change-Id: I548c892e850dbaf57d8ba902367c68c434e5a04f
Issue-ID: VFC-749
Signed-off-by: luxin <luxin7@huawei.com>
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService')
-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(); + } } |