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;
}
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;
}
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);
}
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);
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 {
private String description;
@JsonProperty("terminationType")
- private TerminationType terminationType;
+ private String terminationType;
@JsonProperty("gracefulTerminationTimeout")
private Integer gracefulTerminationTimeout;
this.additionalParams = additionalParams;
}
- public TerminationType getTerminationType() {
+ public String getTerminationType() {
return terminationType;
}
- public void setTerminationType(TerminationType terminationType) {
+ public void setTerminationType(String terminationType) {
this.terminationType = terminationType;
}
package org.onap.vfc.nfvo.driver.vnfm.svnfm.constant;
public enum TerminationType {
- GRACEFUL, FORCEFUL
+ graceful, forceful
}
httpRequest.setURI(URI.create(url));
HttpResponse response = httpClient.execute(httpRequest);
+ HttpResult httpResult = buildHttpResult(response);
httpRequest.releaseConnection();
// httpClient.close();
- HttpResult httpResult = buildHttpResult(response);
return httpResult;
}
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;
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;
+ }
}
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;
}
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;
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() {
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;
}