diff options
author | 2017-11-09 08:08:23 +0800 | |
---|---|---|
committer | 2017-11-09 08:08:23 +0800 | |
commit | 356e70485879cf372051003c0c0a242dbe0bc8ae (patch) | |
tree | 7551ade641bbb660ca2a686e534c589de8bfefce /nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java | |
parent | 6ba81c29f8ee403b4ad9f976d1d6d14fbbd7664c (diff) |
update get job status partv1.0.1
Change-Id: I9e3e03f48d2682466faebd9240edf4ae3579e20c
Issue-ID: VFC-587
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java')
10 files changed, 110 insertions, 46 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java index 3358ce59..60671ad4 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java @@ -87,30 +87,42 @@ public class Cbam2DriverResponseConverter { response.setJobId(oper.getId()); ResponseDescriptor er = new ResponseDescriptor(); - // TODO er.setProgress(i); + er.setProgress("1"); + response.setProgress("1"); + if (oper.getStatus() == CommonEnum.OperationStatus.STARTED ) { er.setStatus("started"); + response.setStatus("started"); } else if (oper.getStatus() == CommonEnum.OperationStatus.FINISHED) { er.setStatus("finished"); + response.setStatus("finished"); } else if (oper.getStatus() == CommonEnum.OperationStatus.FAILED) { er.setStatus("error"); + response.setStatus("error"); } else if (oper.getStatus() == CommonEnum.OperationStatus.OTHER) { er.setStatus("processing"); + response.setStatus("processing"); } else { er.setStatus("error"); + response.setStatus("error"); } - er.setStatusDescription(""); - er.setErrorCode(null); - er.setResponseId(oper.getGrantId().hashCode()); - List<ResponseHistoryList> list = new ArrayList<ResponseHistoryList>(); - ResponseHistoryList relist = new ResponseHistoryList(); - // TODO relist.setProgress(i); - relist.setStatus(er.getStatus()); - relist.setStatusDescription(""); - relist.setErrorCode(null); - relist.setResponseId(er.getResponseId()); - list.add(relist); - er.setResponseHistoryList(list); + er.setStatusDescription(er.getStatus()); + er.setErrorCode("1"); + er.setResponseId("1"); + + response.setStatusDescription(er.getStatus()); + response.setErrorCode("1"); + response.setResponseId("1"); + +// List<ResponseHistoryList> list = new ArrayList<ResponseHistoryList>(); +// ResponseHistoryList relist = new ResponseHistoryList(); +// // TODO relist.setProgress(i); +// relist.setStatus(er.getStatus()); +// relist.setStatusDescription(""); +// relist.setErrorCode(null); +// relist.setResponseId(er.getResponseId()); +// list.add(relist); +// er.setResponseHistoryList(list); response.setResponseDescriptor(er); return response; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java index aebf122e..0035baff 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java @@ -71,7 +71,8 @@ public class Driver2CbamRequestConverter { public CBAMTerminateVnfRequest terminateReqConvert(TerminateVnfRequest driverRequest) { CBAMTerminateVnfRequest request = new CBAMTerminateVnfRequest(); - request.setTerminationType(driverRequest.getTerminationType()); +// request.setTerminationType(driverRequest.getTerminationType().toUpperCase()); + request.setTerminationType("GRACEFUL"); request.setGracefulTerminationTimeout(driverRequest.getGracefulTerminationTimeout()); return request; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java index 20c8bf50..3f7671f4 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java @@ -96,8 +96,10 @@ public class InstantiateVnfContinueRunnable implements Runnable { private void handleNotify(CBAMInstantiateVnfResponse cbamInstantiateResponse) { try { + logger.info("Start to notify LCM the instantiation result"); NslcmNotifyLCMEventsRequest nslcmNotifyReq = buildNslcmNotifyLCMEventsRequest(cbamInstantiateResponse); nslcmMgmr.notifyVnf(nslcmNotifyReq, vnfmId, vnfInstanceId); + logger.info("End to notify LCM the instantiation result"); } catch (Exception e) { logger.error("InstantiateVnfContinueRunnable --> handleNotify error.", e); } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java index a6bbb19b..eacfaeeb 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java @@ -228,14 +228,19 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ return driverResponse; } - public String buildVnfmHttpPathById(String vnfmId) throws ClientProtocolException, IOException, VnfmDriverException { - - return buildVnfmHttpPathByRealId(vnfmId); + public String buildVnfmHttpPathById(String vnfmId) { + String result = ""; + try { + result = buildVnfmHttpPathByRealId(vnfmId); + } catch (Exception e) { + logger.error("buildVnfmHttpPathById Error.", e); + } + return result; } public String buildVnfmHttpPathByRealId(String vnfmId) throws ClientProtocolException, IOException, VnfmDriverException { AaiVnfmInfo vnfmInfo = aaiMgmr.queryVnfm(vnfmId); - logger.info("vnfmInfo in AAI is {}", gson.toJson(vnfmInfo)); + logger.info("vnfmInfo in AAI is " + gson.toJson(vnfmInfo)); if(isVnfmInfoValid(vnfmId, vnfmInfo)) { throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java index 99fd8ac1..0c6636ac 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java @@ -17,8 +17,6 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.TerminationType; - import com.fasterxml.jackson.annotation.JsonProperty; public class CBAMTerminateVnfRequest { @@ -30,7 +28,7 @@ public class CBAMTerminateVnfRequest { private String description; @JsonProperty("terminationType") - private TerminationType terminationType; + private String terminationType; @JsonProperty("gracefulTerminationTimeout") private Integer gracefulTerminationTimeout; @@ -75,11 +73,11 @@ public class CBAMTerminateVnfRequest { this.additionalParams = additionalParams; } - public TerminationType getTerminationType() { + public String getTerminationType() { return terminationType; } - public void setTerminationType(TerminationType terminationType) { + public void setTerminationType(String terminationType) { this.terminationType = terminationType; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/TerminationType.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/TerminationType.java index 5e7fd911..c9dd3401 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/TerminationType.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/TerminationType.java @@ -16,5 +16,5 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.constant; public enum TerminationType { - GRACEFUL, FORCEFUL + graceful, forceful } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java index c553238b..0d472fcb 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java @@ -51,9 +51,9 @@ public class HttpRequestProcessor { httpRequest.setURI(URI.create(url)); HttpResponse response = httpClient.execute(httpRequest); + HttpResult httpResult = buildHttpResult(response); httpRequest.releaseConnection(); // httpClient.close(); - HttpResult httpResult = buildHttpResult(response); return httpResult; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/OperStatusVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/OperStatusVnfResponse.java index 9f96bd38..f47c4058 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/OperStatusVnfResponse.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/OperStatusVnfResponse.java @@ -22,7 +22,22 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class OperStatusVnfResponse { @JsonProperty("jobId") - private String jobId; + private String jobId; + + @JsonProperty("status") + private String status; + + @JsonProperty("progress") + private String progress; + + @JsonProperty("statusDescription") + private String statusDescription; + + @JsonProperty("errorCode") + private String errorCode; + + @JsonProperty("responseId") + private String responseId; @JsonProperty("responseDescriptor")//Including:vnfStatus��statusDescription��errorCode��progress��responseHistoryList��responseId private ResponseDescriptor responseDescriptor; @@ -42,10 +57,45 @@ public class OperStatusVnfResponse { public void setResponseDescriptor(ResponseDescriptor responseDescriptor) { this.responseDescriptor = responseDescriptor; } - - - - + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getProgress() { + return progress; + } + + public void setProgress(String progress) { + this.progress = progress; + } + + public String getStatusDescription() { + return statusDescription; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getResponseId() { + return responseId; + } + + public void setResponseId(String responseId) { + this.responseId = responseId; + } } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/TerminateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/TerminateVnfRequest.java index c4795d32..8bd31bc8 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/TerminateVnfRequest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/TerminateVnfRequest.java @@ -26,17 +26,17 @@ public class TerminateVnfRequest { private String vnfInstanceId; @JsonProperty("terminationType") - private TerminationType terminationType; + private String terminationType; @JsonProperty("gracefulTerminationTimeout") private Integer gracefulTerminationTimeout; - public TerminationType getTerminationType() { + public String getTerminationType() { return terminationType; } - public void setTerminationType(TerminationType terminationType) { + public void setTerminationType(String terminationType) { this.terminationType = terminationType; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseDescriptor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseDescriptor.java index e1b8f967..83aa8580 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseDescriptor.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseDescriptor.java @@ -27,16 +27,16 @@ public class ResponseDescriptor { private String status;//started;processing;finished;error @JsonProperty("progress") - private Integer progress;//progress (1-100) + private String progress;//progress (1-100) @JsonProperty("statusDescription") private String statusDescription; @JsonProperty("errorCode") - private Integer errorCode; + private String errorCode; @JsonProperty("responseId") - private Integer responseId; + private String responseId; @JsonProperty("responseHistoryList") private List<ResponseHistoryList> responseHistoryList; @@ -49,17 +49,13 @@ public class ResponseDescriptor { this.status = status; } - - - public Integer getProgress() { + public String getProgress() { return progress; } - public void setProgress(Integer progr) { - if(progr>0 && progr<100) { + public void setProgress(String progr) { progress = progr; - } } public String getStatusDescription() { @@ -70,19 +66,19 @@ public class ResponseDescriptor { this.statusDescription = statusDescription; } - public Integer getErrorCode() { + public String getErrorCode() { return errorCode; } - public void setErrorCode(Integer errorCode) { + public void setErrorCode(String errorCode) { this.errorCode = errorCode; } - public Integer getResponseId() { + public String getResponseId() { return responseId; } - public void setResponseId(Integer responseId) { + public void setResponseId(String responseId) { this.responseId = responseId; } |