diff options
author | Gao Weitao <victor.gao@huawei.com> | 2018-02-06 12:33:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-02-06 12:33:25 +0000 |
commit | edadfe8acb34d5caa651212fc0bb03e34245499f (patch) | |
tree | ba2fe3a664b09f4afd3ea2d879b5717fa2d511ff | |
parent | fefc5d626f39a11df049cbea557fad735ae54660 (diff) | |
parent | ab865b1b302a3c4d33073bcf09391d1057cbe438 (diff) |
Merge "Add query job status from vnfm"
-rw-r--r-- | huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java index d1508ba0..fae1e98d 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java @@ -19,6 +19,7 @@ package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.vnf; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.ResultRequestUtil; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.ParamConstants; +import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.UrlConstant; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.inf.InterfaceVnfMgr; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -265,4 +266,27 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { return restJson; } + + public JSONObject getJobFromVnfm(JSONObject vnfmObjcet, String jobId) { + LOG.warn("function=getJobFromVnfm, jobId: {}", jobId); + JSONObject restJson = new JSONObject(); + restJson.put(Constant.RETCODE, Constant.REST_FAIL); + + JSONObject queryResult = ResultRequestUtil.call(vnfmObjcet, String.format(UrlConstant.URL_JOBSTATUS_GET, jobId), + Constant.GET, null, Constant.CERTIFICATE); + + int statusCode = queryResult.getInt(Constant.RETCODE); + if(statusCode == Constant.HTTP_OK || statusCode == Constant.HTTP_CREATED) { + if((queryResult.get("data")) == null) { + LOG.warn("function=getJobFromVnfm, msg=query is null {}", queryResult.get("data")); + return restJson; + } + restJson.put(Constant.RETCODE, Constant.REST_SUCCESS); + restJson.put("data", JSONObject.fromObject(queryResult.getString("data"))); + } else { + LOG.error("function=getJobFromVnfm, msg=query job from vnfm wrong status: {}", statusCode); + } + + return restJson; + } } |