diff options
26 files changed, 1601 insertions, 297 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml index 24c8546b8d..d57b1cfd7c 100644 --- a/bpmn/MSOInfrastructureBPMN/pom.xml +++ b/bpmn/MSOInfrastructureBPMN/pom.xml @@ -406,5 +406,24 @@ <artifactId>resteasy-jackson2-provider</artifactId>
<version>3.0.11.Final</version>
</dependency>
+
+ <dependency>
+ <groupId>org.onap.msb.java-sdk</groupId>
+ <artifactId>msb-java-sdk</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <!--for yang tools-->
+<!-- <dependency>
+ <groupId>org.openecomp.so</groupId>
+ <artifactId>common</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>-->
+
+ <dependency>
+ <groupId>org.onap.sdnc.northbound</groupId>
+ <artifactId>generic-resource-api.model</artifactId>
+ <version>1.2.0</version>
+ </dependency>
</dependencies>
</project>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncVlOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncVlOperationTask.java new file mode 100644 index 0000000000..8b26d01432 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncVlOperationTask.java @@ -0,0 +1,114 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask; + +import org.apache.commons.lang3.StringUtils; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.msb.sdk.httpclient.RestServiceCreater; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.openecomp.mso.bpmn.core.BaseTask; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.requestsdb.RequestsDatabase; +import org.openecomp.mso.requestsdb.RequestsDbConstant; +import org.openecomp.mso.requestsdb.ResourceOperationStatus; + +import java.util.Map; + +/** + * Created by 10112215 on 2017/9/16. + */ +public abstract class AbstractSdncVlOperationTask extends BaseTask { + + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + private static final int DEFAULT_MSB_Port = 10081; + private static final String SDCADAPTOR_INPUTS = "SDCADAPTOR_INPUTS"; + private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); + + + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + + @Override + public void execute(DelegateExecution execution) { + GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(execution); + updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); + Map<String, String> inputs = (Map<String, String>) execution.getVariable(SDCADAPTOR_INPUTS); + updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!"); + try { + sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient); + execution.setVariable("SDNCA_SuccessIndicator", true); + updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + } catch (Exception e) { + e.printStackTrace(); + execution.setVariable("SDNCA_SuccessIndicator", false); + } + } + + public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map<String, String> inputs, + GenericResourceApi genericResourceApiClient) throws Exception; + + public void updateProgress(DelegateExecution execution, + String status, + String errorCode, + String progress, + String statusDescription) { + String serviceId = (String) execution.getVariable("serviceId"); + String operationId = (String) execution.getVariable("operationId"); + String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); + ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + if (!StringUtils.isBlank(status)) { + resourceOperationStatus.setStatus(status); + } + if (!StringUtils.isBlank(errorCode)) { + resourceOperationStatus.setErrorCode(errorCode); + } + if (!StringUtils.isBlank(progress)) { + resourceOperationStatus.setProgress(progress); + } + if (!StringUtils.isBlank(statusDescription)) { + resourceOperationStatus.setStatusDescription(statusDescription); + } + requestsDB.updateResOperStatus(resourceOperationStatus); + } + + private GenericResourceApi getGenericResourceApiClient(DelegateExecution execution) { + updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!"); + String msbIp = getString(execution, "MSB_IP", DEFAULT_MSB_IP); + int msbPort = getInteger(execution, "MSB_Port", DEFAULT_MSB_Port); + MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); + RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); + return restServiceCreater.createService(GenericResourceApi.class); + } + + private String getString(DelegateExecution execution, String name, String defaultValue) { + String vlaue = (String) execution.getVariable(name); + try { + if (!StringUtils.isBlank(vlaue)) { + return vlaue; + } + } catch (Exception e) { + System.out.println(e); + logger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); + } finally { + return defaultValue; + } + } + + private Integer getInteger(DelegateExecution execution, String name, Integer defaultValue) { + Integer vlaue = (Integer) execution.getVariable(name); + try { + if (vlaue != null && vlaue instanceof Integer) { + return vlaue; + } + } catch (Exception e) { + System.out.println(e); + logger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); + } finally { + return defaultValue; + } + } + + public String getProcessKey(DelegateExecution execution) { + return execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java new file mode 100644 index 0000000000..1a7f9dcec4 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -0,0 +1,101 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask; + +import org.apache.commons.lang3.StringUtils; +import org.onap.msb.sdk.httpclient.RestServiceCreater; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRpcInputEntity; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRpcOutputEntity; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.requestsdb.RequestsDatabase; +import org.openecomp.mso.requestsdb.RequestsDbConstant; +import org.openecomp.mso.requestsdb.ResourceOperationStatus; + +import java.util.Map; + +/** + * Created by 10112215 on 2017/9/21. + */ +public class SdncUnderlayVpnOperationClient { + + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + private static final int DEFAULT_MSB_Port = 10081; + private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); + + private String serviceId; + private String operationId; + private String resourceTemplateUUID; + + + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + + public boolean excute(String msbIp, + int msbPort, + Map<String, String> inputs, + String serviceId_i, + String operationId_i, + String resourceTemplateUUID_i){ + serviceId = serviceId_i; + operationId = operationId_i; + resourceTemplateUUID = resourceTemplateUUID_i; + GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(msbIp, msbPort); + updateProgress(RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); + return sendRestrequestAndHandleResponse(inputs, genericResourceApiClient); + } + + public boolean sendRestrequestAndHandleResponse(Map<String, String> inputs, GenericResourceApi genericResourceApiClient){ + updateProgress(null, null, "40", "sendRestrequestAndHandleResponse begin!"); + NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); + NetworkRpcInputEntity body = builder.build(inputs); + updateProgress(null, null, "50", "RequestBody build finished!"); + NetworkRpcOutputEntity networkRpcOutputEntiy = null; + try { + networkRpcOutputEntiy = genericResourceApiClient.postNetworkTopologyPeration(body).execute().body(); + } catch (Exception e) { + e.printStackTrace(); + updateProgress(RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage()); + return false; + } + updateProgress(null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(networkRpcOutputEntiy); + updateProgress(RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + return true; + } + + private GenericResourceApi getGenericResourceApiClient(String msbIp, int msbPort) { + if (StringUtils.isBlank(msbIp)) { + msbIp = DEFAULT_MSB_IP; + } + if (msbPort <= 0) { + msbPort = DEFAULT_MSB_Port; + } + MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); + RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); + return restServiceCreater.createService(GenericResourceApi.class); + } + + public void updateProgress(String status, + String errorCode, + String progress, + String statusDescription) { + ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + if (!StringUtils.isBlank(status)) { + resourceOperationStatus.setStatus(status); + } + if (!StringUtils.isBlank(errorCode)) { + resourceOperationStatus.setErrorCode(errorCode); + } + if (!StringUtils.isBlank(progress)) { + resourceOperationStatus.setProgress(progress); + } + if (!StringUtils.isBlank(statusDescription)) { + resourceOperationStatus.setStatusDescription(statusDescription); + } + requestsDB.updateResOperStatus(resourceOperationStatus); + } + + private void saveOutput(NetworkRpcOutputEntity output) { + + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncVlOperationTaskEntityImpl.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncVlOperationTaskEntityImpl.java new file mode 100644 index 0000000000..a387756d7c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncVlOperationTaskEntityImpl.java @@ -0,0 +1,43 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.openecomp.mso.bpmn.core.WorkflowException; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRpcInputEntity; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRpcOutputEntity; +import org.openecomp.mso.requestsdb.RequestsDbConstant; + +import java.util.Map; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class SdncVlOperationTaskEntityImpl extends AbstractSdncVlOperationTask { + @Override + public void sendRestrequestAndHandleResponse(DelegateExecution execution, + Map<String, String> inputs, + GenericResourceApi genericResourceApiClient) throws Exception { + updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); + NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); + NetworkRpcInputEntity body = builder.build(inputs); + updateProgress(execution, null, null, "50", "RequestBody build finished!"); + NetworkRpcOutputEntity networkRpcOutputEntiy = genericResourceApiClient.postNetworkTopologyPeration(body).execute().body(); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, networkRpcOutputEntiy); + } + + private void saveOutput(DelegateExecution execution, NetworkRpcOutputEntity output) throws Exception { + String responseCode = output.getOutput().getResponseCode(); + if (!responseCode.equals("200")) { + String processKey = getProcessKey(execution); + int errorCode = Integer.valueOf(responseCode); + String errorMessage = output.getOutput().getEsponseMessage(); + WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("SDNCA_SuccessIndicator", workflowException); + updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); + throw new Exception(""); + } + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java new file mode 100644 index 0000000000..91142a041e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java @@ -0,0 +1,25 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import org.onap.msb.sdk.httpclient.annotaion.ServiceHttpEndPoint; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRpcInputEntity; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRpcOutputEntity; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.POST; + +/** + * Created by 10112215 on 2017/9/16. + */ +@ServiceHttpEndPoint(serviceName = "sdnc", serviceVersion = "v1") +public interface GenericResourceApi { + + @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") + Call<ResponseBody> postNetworkTopologyPeration(@Body RequestBody input); + + @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") + Call<NetworkRpcOutputEntity> postNetworkTopologyPeration(@Body NetworkRpcInputEntity input); + +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java new file mode 100644 index 0000000000..2075de9f75 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -0,0 +1,8 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder; + +/** + * Created by 10112215 on 2017/9/20. + */ +public interface AbstractBuilder<IN, OUT> { + OUT build(IN input) throws Exception; +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java new file mode 100644 index 0000000000..bcac56a518 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java @@ -0,0 +1,95 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder; + +import org.apache.commons.lang3.StringUtils; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader; +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class NetworkRpcInputEntityBuilder implements AbstractBuilder<Map<String, String>, NetworkRpcInputEntity> { + + public static final String SVC_REQUEST_ID = "MSO"; + public static final String SDC_ACTION = "SDC_ACTION"; + public static final RequestInformation.RequestAction REQUEST_ACTION = RequestInformation.RequestAction.CreateNetworkInstance; + + protected NetworkRpcInputEntity getSdncEntityInput(Map<String, String> inputs) { + NetworkRpcInputEntity networkRpcInputEntity = new NetworkRpcInputEntity(); + InputEntity inputEntity = new InputEntity(); + { + loadSdncRequestHeaderEntity(inputs, inputEntity); + loadRequestInformationEntity(inputEntity); + + ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity(); + String serviceId = inputs.get("serviceId"); + serviceInformationEntity.setServiceId(serviceId); + + + loadNetwrokRequestInputEntity(inputs, inputEntity); + } + networkRpcInputEntity.setInput(inputEntity); + return networkRpcInputEntity; + } + + private void loadNetwrokRequestInputEntity(Map<String, String> inputs, InputEntity inputEntity) { + NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity(); + { + NetworkInputPaarametersEntity networkInputPaarametersEntity = new NetworkInputPaarametersEntity(); + { + List<ParamEntity> paramEntityList = getParamEntities(inputs); + networkInputPaarametersEntity.setParamList(paramEntityList); + } + + } + inputEntity.setNetworkRequestInput(networkRequestInputEntity); + } + + private List<ParamEntity> getParamEntities(Map<String, String> inputs) { + List<ParamEntity> paramEntityList = new ArrayList<>(); + if (inputs != null && !inputs.isEmpty()) { + inputs.keySet().forEach(key -> { + ParamEntity paramEntity = new ParamEntity(); + paramEntity.setName(key); + paramEntity.setValue(inputs.get(key)); + paramEntityList.add(paramEntity); + }); + } + return paramEntityList; + } + + private void loadRequestInformationEntity(InputEntity inputEntity) { + RequestInformationEntity requestInformationEntity = new RequestInformationEntity(); + { + requestInformationEntity.setRequestId(SVC_REQUEST_ID); + requestInformationEntity.setRequestAction(REQUEST_ACTION.name()); + } + inputEntity.setRequestInformation(requestInformationEntity); + } + + private void loadSdncRequestHeaderEntity(Map<String, String> inputs, InputEntity inputEntity) { + SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); + { + sdncRequestHeaderEntity.setSvcRequestId(SVC_REQUEST_ID); + String action = inputs.get(SDC_ACTION); + if (!StringUtils.isBlank(action)) { + if (action.toLowerCase().contains("delete")) { + action = SdncRequestHeader.SvcAction.Delete.name(); + } else if (action.toLowerCase().contains("create")) { + action = SdncRequestHeader.SvcAction.Create.name(); + } + } + sdncRequestHeaderEntity.setSvcAction(action); + } + inputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); + } + + @Override + public NetworkRpcInputEntity build(Map<String, String> input) { + return null; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/EcompModelInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/EcompModelInformationEntity.java new file mode 100644 index 0000000000..20e6eb19e5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/EcompModelInformationEntity.java @@ -0,0 +1,63 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class EcompModelInformationEntity { + @JsonProperty("model-invariant-uuid") + private String modelInvariantUuid; + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUuid; + + @JsonProperty("model-uuid") + private String modelUuid; + + @JsonProperty("model-version") + private String modelVersion; + + @JsonProperty("model-name") + private String modelName; + + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelUuid() { + return modelUuid; + } + + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/InputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/InputEntity.java new file mode 100644 index 0000000000..71cb2685ce --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/InputEntity.java @@ -0,0 +1,63 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class InputEntity { + @JsonProperty("sdnc-request-header") + private SdncRequestHeaderEntity sdncRequestHeader; + + @JsonProperty("request-information") + private RequestInformationEntity requestInformation; + + @JsonProperty("service-information") + private ServiceInformationEntity serviceInformation; + + @JsonProperty("network-information") + private NetworkInformationEntity networkInformation; + + @JsonProperty("network-request-input") + private NetworkRequestInputEntity networkRequestInput; + + public SdncRequestHeaderEntity getSdncRequestHeader() { + return sdncRequestHeader; + } + + public void setSdncRequestHeader(SdncRequestHeaderEntity sdncRequestHeader) { + this.sdncRequestHeader = sdncRequestHeader; + } + + public RequestInformationEntity getRequestInformation() { + return requestInformation; + } + + public void setRequestInformation(RequestInformationEntity requestInformation) { + this.requestInformation = requestInformation; + } + + public ServiceInformationEntity getServiceInformation() { + return serviceInformation; + } + + public void setServiceInformation(ServiceInformationEntity serviceInformation) { + this.serviceInformation = serviceInformation; + } + + public NetworkInformationEntity getNetworkInformation() { + return networkInformation; + } + + public void setNetworkInformation(NetworkInformationEntity networkInformation) { + this.networkInformation = networkInformation; + } + + public NetworkRequestInputEntity getNetworkRequestInput() { + return networkRequestInput; + } + + public void setNetworkRequestInput(NetworkRequestInputEntity networkRequestInput) { + this.networkRequestInput = networkRequestInput; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java new file mode 100644 index 0000000000..ea4715de63 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java @@ -0,0 +1,41 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class NetworkInformationEntity { + @JsonProperty("network-id") + private String networkId; + + @JsonProperty("network-type") + private String networkType; + + @JsonProperty("ecomp-model-information") + private EcompModelInformationEntity ecompModelInformation; + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkType() { + return networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public EcompModelInformationEntity getEcompModelInformation() { + return ecompModelInformation; + } + + public void setEcompModelInformation(EcompModelInformationEntity ecompModelInformation) { + this.ecompModelInformation = ecompModelInformation; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java new file mode 100644 index 0000000000..c70980d068 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java @@ -0,0 +1,21 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class NetworkInputPaarametersEntity { + public List<ParamEntity> getParamList() { + return paramList; + } + + public void setParamList(List<ParamEntity> paramList) { + this.paramList = paramList; + } + + @JsonProperty("param") + private List<ParamEntity> paramList; +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java new file mode 100644 index 0000000000..19b64c2c95 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java @@ -0,0 +1,63 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class NetworkRequestInputEntity { + @JsonProperty("network-name") + private String networkName; + + @JsonProperty("tenant") + private String tenant; + + @JsonProperty("aic-cloud-region") + private String aicCloudRegion; + + @JsonProperty("aic-clli") + private String aicClli; + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + public String getAicCloudRegion() { + return aicCloudRegion; + } + + public void setAicCloudRegion(String aicCloudRegion) { + this.aicCloudRegion = aicCloudRegion; + } + + public String getAicClli() { + return aicClli; + } + + public void setAicClli(String aicClli) { + this.aicClli = aicClli; + } + + public NetworkInputPaarametersEntity getNetworkInputPaarameters() { + return networkInputPaarameters; + } + + public void setNetworkInputPaarameters(NetworkInputPaarametersEntity networkInputPaarameters) { + this.networkInputPaarameters = networkInputPaarameters; + } + + @JsonProperty("network-input-parameters") + private NetworkInputPaarametersEntity networkInputPaarameters; +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java new file mode 100644 index 0000000000..c7ebf7dd10 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java @@ -0,0 +1,30 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/22. + */ +public class NetworkResponseInformationEntity { + @JsonProperty("instance-id") + private String instanceId; + + @JsonProperty("object-path") + private String objectPath; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getObjectPath() { + return objectPath; + } + + public void setObjectPath(String objectPath) { + this.objectPath = objectPath; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRpcInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRpcInputEntity.java new file mode 100644 index 0000000000..045392489b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRpcInputEntity.java @@ -0,0 +1,19 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class NetworkRpcInputEntity { + public InputEntity getInput() { + return input; + } + + public void setInput(InputEntity input) { + this.input = input; + } + + @JsonProperty("input") + private InputEntity input = null; +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRpcOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRpcOutputEntity.java new file mode 100644 index 0000000000..fa29ec9434 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRpcOutputEntity.java @@ -0,0 +1,19 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class NetworkRpcOutputEntity { + public OutputEntity getOutput() { + return output; + } + + public void setOutput(OutputEntity output) { + this.output = output; + } + + @JsonProperty("output") + private OutputEntity output; +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OutputEntity.java new file mode 100644 index 0000000000..48fb9f1594 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OutputEntity.java @@ -0,0 +1,74 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/22. + */ +public class OutputEntity { + @JsonProperty("svc-request-id") + private String svcRequestId; + + @JsonProperty("response-code") + private String responseCode; + + @JsonProperty("esponse-message") + private String esponseMessage; + + @JsonProperty("ack-final-indicator") + private String ackFinalIndicator; + + @JsonProperty("network-response-information") + private NetworkResponseInformationEntity networkResponseInformation; + + @JsonProperty("service-response-information") + private ServiceResponseInformationEntity serviceResponseInformation; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getResponseCode() { + return responseCode; + } + + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + public String getEsponseMessage() { + return esponseMessage; + } + + public void setEsponseMessage(String esponseMessage) { + this.esponseMessage = esponseMessage; + } + + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public NetworkResponseInformationEntity getNetworkResponseInformation() { + return networkResponseInformation; + } + + public void setNetworkResponseInformation(NetworkResponseInformationEntity networkResponseInformation) { + this.networkResponseInformation = networkResponseInformation; + } + + public ServiceResponseInformationEntity getServiceResponseInformation() { + return serviceResponseInformation; + } + + public void setServiceResponseInformation(ServiceResponseInformationEntity serviceResponseInformation) { + this.serviceResponseInformation = serviceResponseInformation; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java new file mode 100644 index 0000000000..5188be7221 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java @@ -0,0 +1,30 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class ParamEntity { + @JsonProperty("name") + private String name; + + @JsonProperty("value") + private String value; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java new file mode 100644 index 0000000000..38f2291bef --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java @@ -0,0 +1,74 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class RequestInformationEntity { + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getNotificationUrl() { + return notificationUrl; + } + + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + } + + public String getOrderUnmber() { + return orderUnmber; + } + + public void setOrderUnmber(String orderUnmber) { + this.orderUnmber = orderUnmber; + } + + public String getOrerVersion() { + return orerVersion; + } + + public void setOrerVersion(String orerVersion) { + this.orerVersion = orerVersion; + } + + @JsonProperty("request-id") + private String requestId; + + @JsonProperty("request-action") + private String requestAction; + + @JsonProperty("source") + private String source; + + @JsonProperty("notification-url") + private String notificationUrl; + + @JsonProperty("order-number") + private String orderUnmber; + + @JsonProperty("order-version") + private String orerVersion; +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java new file mode 100644 index 0000000000..6c64b769bf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java @@ -0,0 +1,42 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class SdncRequestHeaderEntity { + @JsonProperty("svc-request-id") + private String svcRequestId; + + @JsonProperty("svc-action") + private String svcAction; + + @JsonProperty("svc-notification-url") + private String svcNotificationUrl; + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getSvcAction() { + return svcAction; + } + + public void setSvcAction(String svcAction) { + this.svcAction = svcAction; + } + + public String getSvcNotificationUrl() { + return svcNotificationUrl; + } + + public void setSvcNotificationUrl(String svcNotificationUrl) { + this.svcNotificationUrl = svcNotificationUrl; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java new file mode 100644 index 0000000000..1ae78f27bc --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java @@ -0,0 +1,74 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/20. + */ +public class ServiceInformationEntity { + @JsonProperty("service-id") + private String serviceId; + + @JsonProperty("subscription-service-type") + private String subscriptionServiceType; + + @JsonProperty("ecomp-model-information") + private EcompModelInformationEntity ecompModelInformation; + + @JsonProperty("service-instance-id") + private String serviceInstanceId; + + @JsonProperty("global-customer-id") + private String globalCustomerId; + + @JsonProperty("subscriber-name") + private String subscriberName; + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public EcompModelInformationEntity getEcompModelInformation() { + return ecompModelInformation; + } + + public void setEcompModelInformation(EcompModelInformationEntity ecompModelInformation) { + this.ecompModelInformation = ecompModelInformation; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getGlobalCustomerId() { + return globalCustomerId; + } + + public void setGlobalCustomerId(String globalCustomerId) { + this.globalCustomerId = globalCustomerId; + } + + public String getSubscriberName() { + return subscriberName; + } + + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java new file mode 100644 index 0000000000..de028d694a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java @@ -0,0 +1,30 @@ +package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by 10112215 on 2017/9/22. + */ +public class ServiceResponseInformationEntity { + @JsonProperty("instance-id") + private String instanceId; + + @JsonProperty("object-path") + private String objectPath; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getObjectPath() { + return objectPath; + } + + public void setObjectPath(String objectPath) { + this.objectPath = objectPath; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 2b3cfa6a8b..758de28d36 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -128,7 +128,7 @@ ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1dd86x8" sourceRef="ScriptTask_0q37vn9" targetRef="ExclusiveGateway_1nk6aol" /> <bpmn2:scriptTask id="ScriptTask_0081lne" name="Prepare SDN-C Adaptor Data Request" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0mcyg0e</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0k4q7jm</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0ofqw6v</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() @@ -147,20 +147,10 @@ csi.preVFCRequest(execution)]]></bpmn2:script> </bpmn2:callActivity> <bpmn2:callActivity id="CallActivity_0uwm4l1" name="Call DoCreateVFCNetworkServiceInstance" calledElement="DoCreateVFCNetworkServiceInstance"> <bpmn2:incoming>SequenceFlow_15zgrcq</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1x8vphc</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0k4q7jm</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:exclusiveGateway id="ExclusiveGateway_0lczgac" name="Sueecss?" default="SequenceFlow_1yv1kef"> - <bpmn2:incoming>SequenceFlow_1vvdkcs</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1yv1kef</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_1d4wn2y</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:exclusiveGateway id="ExclusiveGateway_0cdz77v" name="Success?" default="SequenceFlow_0ou0spo"> - <bpmn2:incoming>SequenceFlow_1x8vphc</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0ou0spo</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_0mcyg0e</bpmn2:outgoing> - </bpmn2:exclusiveGateway> <bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1d4wn2y</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1vvdkcs</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_092ghvu</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() @@ -168,25 +158,13 @@ csi.postConfigRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0ofqw6v" sourceRef="ScriptTask_0081lne" targetRef="CallActivity_09c3ajg" /> <bpmn2:sequenceFlow id="SequenceFlow_15zgrcq" sourceRef="ScriptTask_0wvq4t8" targetRef="CallActivity_0uwm4l1" /> - <bpmn2:sequenceFlow id="SequenceFlow_1vvdkcs" sourceRef="CallActivity_09c3ajg" targetRef="ExclusiveGateway_0lczgac" /> - <bpmn2:sequenceFlow id="SequenceFlow_1x8vphc" sourceRef="CallActivity_0uwm4l1" targetRef="ExclusiveGateway_0cdz77v" /> - <bpmn2:sequenceFlow id="SequenceFlow_1yv1kef" name="No" sourceRef="ExclusiveGateway_0lczgac" targetRef="EndEvent_11lmyvs" /> - <bpmn2:sequenceFlow id="SequenceFlow_1d4wn2y" name="Yes" sourceRef="ExclusiveGateway_0lczgac" targetRef="ScriptTask_1xdjlzm"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_0ou0spo" name="No" sourceRef="ExclusiveGateway_0cdz77v" targetRef="EndEvent_01h4q8z" /> + <bpmn2:sequenceFlow id="SequenceFlow_1vvdkcs" sourceRef="CallActivity_09c3ajg" targetRef="ScriptTask_1xdjlzm" /> <bpmn2:sequenceFlow id="SequenceFlow_092ghvu" sourceRef="ScriptTask_1xdjlzm" targetRef="EndEvent_0kbbt94" /> - <bpmn2:sequenceFlow id="SequenceFlow_0mcyg0e" sourceRef="ExclusiveGateway_0cdz77v" targetRef="ScriptTask_0081lne" /> <bpmn2:sequenceFlow id="SequenceFlow_1170ztf" sourceRef="ExclusiveGateway_1nk6aol" targetRef="ScriptTask_0wvq4t8" /> - <bpmn2:endEvent id="EndEvent_11lmyvs"> - <bpmn2:incoming>SequenceFlow_1yv1kef</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:endEvent id="EndEvent_01h4q8z"> - <bpmn2:incoming>SequenceFlow_0ou0spo</bpmn2:incoming> - </bpmn2:endEvent> <bpmn2:endEvent id="EndEvent_0kbbt94"> <bpmn2:incoming>SequenceFlow_092ghvu</bpmn2:incoming> </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0k4q7jm" sourceRef="CallActivity_0uwm4l1" targetRef="ScriptTask_0081lne" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -362,37 +340,25 @@ csi.postConfigRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0081lne_di" bpmnElement="ScriptTask_0081lne"> - <dc:Bounds x="786" y="818" width="100" height="80" /> + <dc:Bounds x="850" y="819" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0wvq4t8_di" bpmnElement="ScriptTask_0wvq4t8"> <dc:Bounds x="972" y="564" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_09c3ajg_di" bpmnElement="CallActivity_09c3ajg"> - <dc:Bounds x="573" y="819" width="100" height="80" /> + <dc:Bounds x="601" y="819" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0uwm4l1_di" bpmnElement="CallActivity_0uwm4l1"> <dc:Bounds x="972" y="690" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0lczgac_di" bpmnElement="ExclusiveGateway_0lczgac" isMarkerVisible="true"> - <dc:Bounds x="402" y="833" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="402" y="808" width="49" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0cdz77v_di" bpmnElement="ExclusiveGateway_0cdz77v" isMarkerVisible="true"> - <dc:Bounds x="997" y="833" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="998" y="808" width="49" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1xdjlzm_di" bpmnElement="ScriptTask_1xdjlzm"> - <dc:Bounds x="218" y="818" width="100" height="80" /> + <dc:Bounds x="372" y="819" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ofqw6v_di" bpmnElement="SequenceFlow_0ofqw6v"> - <di:waypoint xsi:type="dc:Point" x="786" y="858" /> - <di:waypoint xsi:type="dc:Point" x="673" y="859" /> + <di:waypoint xsi:type="dc:Point" x="850" y="859" /> + <di:waypoint xsi:type="dc:Point" x="701" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="684.5" y="837.5" width="90" height="12" /> + <dc:Bounds x="730.5" y="838" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_15zgrcq_di" bpmnElement="SequenceFlow_15zgrcq"> @@ -403,54 +369,17 @@ csi.postConfigRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1vvdkcs_di" bpmnElement="SequenceFlow_1vvdkcs"> - <di:waypoint xsi:type="dc:Point" x="573" y="859" /> - <di:waypoint xsi:type="dc:Point" x="452" y="858" /> + <di:waypoint xsi:type="dc:Point" x="601" y="859" /> + <di:waypoint xsi:type="dc:Point" x="472" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="467.5" y="837.5" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1x8vphc_di" bpmnElement="SequenceFlow_1x8vphc"> - <di:waypoint xsi:type="dc:Point" x="1022" y="770" /> - <di:waypoint xsi:type="dc:Point" x="1022" y="833" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="992" y="795.5" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1yv1kef_di" bpmnElement="SequenceFlow_1yv1kef"> - <di:waypoint xsi:type="dc:Point" x="427" y="883" /> - <di:waypoint xsi:type="dc:Point" x="427" y="962" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="455" y="892" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1d4wn2y_di" bpmnElement="SequenceFlow_1d4wn2y"> - <di:waypoint xsi:type="dc:Point" x="402" y="858" /> - <di:waypoint xsi:type="dc:Point" x="318" y="858" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="823.2259872894327" y="883.5416267409498" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ou0spo_di" bpmnElement="SequenceFlow_0ou0spo"> - <di:waypoint xsi:type="dc:Point" x="1022" y="883" /> - <di:waypoint xsi:type="dc:Point" x="1022" y="962" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1045" y="895" width="14" height="12" /> + <dc:Bounds x="491.5" y="838" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_092ghvu_di" bpmnElement="SequenceFlow_092ghvu"> - <di:waypoint xsi:type="dc:Point" x="218" y="858" /> - <di:waypoint xsi:type="dc:Point" x="182" y="858" /> - <di:waypoint xsi:type="dc:Point" x="182" y="858" /> - <di:waypoint xsi:type="dc:Point" x="137" y="858" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="152" y="852" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0mcyg0e_di" bpmnElement="SequenceFlow_0mcyg0e"> - <di:waypoint xsi:type="dc:Point" x="997" y="858" /> - <di:waypoint xsi:type="dc:Point" x="886" y="858" /> + <di:waypoint xsi:type="dc:Point" x="372" y="859" /> + <di:waypoint xsi:type="dc:Point" x="222" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="896.5" y="837" width="90" height="12" /> + <dc:Bounds x="252" y="838" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1170ztf_di" bpmnElement="SequenceFlow_1170ztf"> @@ -460,24 +389,20 @@ csi.postConfigRequest(execution)]]></bpmn2:script> <dc:Bounds x="992" y="531" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0g2btws_di" bpmnElement="EndEvent_11lmyvs"> - <dc:Bounds x="409" y="962" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="292" y="1001" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0y0wvdf_di" bpmnElement="EndEvent_01h4q8z"> - <dc:Bounds x="1004" y="962" width="36" height="36" /> + <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94"> + <dc:Bounds x="186" y="841" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="887" y="1001" width="90" height="12" /> + <dc:Bounds x="68" y="881" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94"> - <dc:Bounds x="101" y="840" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_0k4q7jm_di" bpmnElement="SequenceFlow_0k4q7jm"> + <di:waypoint xsi:type="dc:Point" x="1022" y="770" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="859" /> + <di:waypoint xsi:type="dc:Point" x="950" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="28" y="880" width="0" height="12" /> + <dc:Bounds x="1037" y="808.5" width="0" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUnderVpnOperation_java.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUnderVpnOperation_java.bpmn new file mode 100644 index 0000000000..b8e79a2508 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUnderVpnOperation_java.bpmn @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="Process_1" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1"> + <bpmn:outgoing>SequenceFlow_0trm4dk</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:exclusiveGateway id="ExclusiveGateway_0vvnd7x" name="is response ok?" default="SequenceFlow_083crve"> + <bpmn:incoming>SequenceFlow_11dtpnr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1amfirn</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_083crve</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_14p1b2x"> + <bpmn:incoming>SequenceFlow_1amfirn</bpmn:incoming> + </bpmn:endEvent> + <bpmn:endEvent id="EndEvent_0urwhzh"> + <bpmn:incoming>SequenceFlow_083crve</bpmn:incoming> + <bpmn:errorEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0trm4dk" sourceRef="StartEvent_1" targetRef="Task_0brg0a4" /> + <bpmn:sequenceFlow id="SequenceFlow_11dtpnr" sourceRef="Task_0brg0a4" targetRef="ExclusiveGateway_0vvnd7x" /> + <bpmn:sequenceFlow id="SequenceFlow_1amfirn" name="ok" sourceRef="ExclusiveGateway_0vvnd7x" targetRef="EndEvent_14p1b2x"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("SendSdncResult")=='ok'}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_083crve" name="error" sourceRef="ExclusiveGateway_0vvnd7x" targetRef="EndEvent_0urwhzh" /> + <bpmn:serviceTask id="Task_0brg0a4" name="call sdnc network operation" camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncVlOperationTaskEntityImpl"> + <bpmn:incoming>SequenceFlow_0trm4dk</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11dtpnr</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="175" y="193" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="148" y="229" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0vvnd7x_di" bpmnElement="ExclusiveGateway_0vvnd7x" isMarkerVisible="true"> + <dc:Bounds x="561" y="186" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="546" y="240" width="80" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_14p1b2x_di" bpmnElement="EndEvent_14p1b2x"> + <dc:Bounds x="740" y="193" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="758" y="233" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0d0rf7s_di" bpmnElement="EndEvent_0urwhzh"> + <dc:Bounds x="740" y="347" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="758" y="387" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0trm4dk_di" bpmnElement="SequenceFlow_0trm4dk"> + <di:waypoint xsi:type="dc:Point" x="211" y="211" /> + <di:waypoint xsi:type="dc:Point" x="340" y="211" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="275.5" y="190" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_11dtpnr_di" bpmnElement="SequenceFlow_11dtpnr"> + <di:waypoint xsi:type="dc:Point" x="440" y="211" /> + <di:waypoint xsi:type="dc:Point" x="561" y="211" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="500.5" y="190" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1amfirn_di" bpmnElement="SequenceFlow_1amfirn"> + <di:waypoint xsi:type="dc:Point" x="611" y="211" /> + <di:waypoint xsi:type="dc:Point" x="740" y="211" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="669" y="190" width="13" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_083crve_di" bpmnElement="SequenceFlow_083crve"> + <di:waypoint xsi:type="dc:Point" x="586" y="236" /> + <di:waypoint xsi:type="dc:Point" x="586" y="365" /> + <di:waypoint xsi:type="dc:Point" x="740" y="365" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="588" y="295" width="26" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_035xqek_di" bpmnElement="Task_0brg0a4"> + <dc:Bounds x="340" y="171" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java index 26fdba47c4..fb507a69cf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java @@ -40,6 +40,8 @@ import javax.ws.rs.core.UriInfo; import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; import org.openecomp.mso.apihandler.common.ErrorNumbers; +import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2ERequest; +import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences; @@ -57,18 +59,18 @@ import org.openecomp.mso.requestsdb.RequestsDatabase; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; -@Path("/orchestrationRequests") -@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests") +@Path("/") +@Api(value = "/", description = "API Requests for Orchestration requests") public class OrchestrationRequests { - public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + + private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - /** * */ @@ -77,66 +79,122 @@ public class OrchestrationRequests { } @GET - @Path("/{version:[vV][2-5]}/{requestId}") - @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class) + @Path("orchestrationRequests/{version:[vV][2-5]}/{requestId}") + @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class) @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) { + public Response getOrchestrationRequest(@PathParam("requestId") String requestId, + @PathParam("version") String version) { GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); - MsoRequest msoRequest = new MsoRequest (requestId); + MsoRequest msoRequest = new MsoRequest(requestId); - long startTime = System.currentTimeMillis (); + long startTime = System.currentTimeMillis(); InfraActiveRequests requestDB = null; - try { - requestDB = requestsDB.getRequestFromInfraActive(requestId); - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - - } - - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - - } - - Request request = mapInfraActiveRequestToRequest(requestDB); - - orchestrationResponse.setRequest(request); - - return Response.status(200).entity(orchestrationResponse).build(); + try { + requestDB = requestsDB.getRequestFromInfraActive(requestId); + + } catch (Exception e) { + msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.AvailabilityError, + "Exception while communciate with Request DB - Infra Request Lookup", e); + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); + alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, + Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, + "Exception while communciate with Request DB"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); + return response; + + } + + if (requestDB == null) { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT, + MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, + "Null response from RequestDB when searching by RequestId"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, + "Null response from RequestDB when searching by RequestId"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); + return resp; + + } + + Request request = mapInfraActiveRequestToRequest(requestDB); + + orchestrationResponse.setRequest(request); + + return Response.status(200).entity(orchestrationResponse).build(); + } + + @GET + @Path("e2eServiceInstances/{version:[vV][3-5]}/{serviceId}/operations/{operationId}") + @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class) + @Produces(MediaType.APPLICATION_JSON) + public Response getE2EServiceInstances(@PathParam("serviceId") String serviceId, + @PathParam("version") String version, @PathParam("operationId") String operationId) { + + GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse(); + + MsoRequest msoRequest = new MsoRequest(serviceId); + + long startTime = System.currentTimeMillis(); + + InfraActiveRequests requestDB = null; + + try { + requestDB = requestsDB.getRequestFromInfraActive(serviceId); + + } catch (Exception e) { + msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.AvailabilityError, + "Exception while communciate with Request DB - Infra Request Lookup", e); + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); + alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, + Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, + "Exception while communciate with Request DB"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); + return response; + + } + + if (requestDB == null) { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT, + MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, + "Null response from RequestDB when searching by serviceId"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, + "Null response from RequestDB when searching by serviceId"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); + return resp; + + } + + E2ERequest e2erequest = mapInfraActiveRequestToE2ERequest(requestDB); + + e2eServiceResponse.setE2eRequest(e2erequest); + + return Response.status(200).entity(e2eServiceResponse).build(); } @GET - @Path("/{version:[vV][2-5]}") - @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class) + @Path("orchestrationRequests/{version:[vV][2-5]}") + @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class) @Produces(MediaType.APPLICATION_JSON) public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) { - long startTime = System.currentTimeMillis (); + long startTime = System.currentTimeMillis(); MsoRequest msoRequest = new MsoRequest(); @@ -146,8 +204,7 @@ public class OrchestrationRequests { GetOrchestrationListResponse orchestrationList = null; - - try{ + try { Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams); @@ -157,7 +214,7 @@ public class OrchestrationRequests { List<RequestList> requestLists = new ArrayList<RequestList>(); - for(InfraActiveRequests infraActive : activeRequests){ + for (InfraActiveRequests infraActive : activeRequests) { Request request = mapInfraActiveRequestToRequest(infraActive); RequestList requestList = new RequestList(); @@ -169,209 +226,241 @@ public class OrchestrationRequests { orchestrationList.setRequestList(requestLists); - }catch(Exception e){ - msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - "Get Orchestration Request with Filters Failed. " + e.getMessage(), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; + } catch (Exception e) { + msoLogger.debug("Get Orchestration Request with Filters Failed : ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, + MsoException.ServiceException, "Get Orchestration Request with Filters Failed. " + e.getMessage(), + ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, + "Get Orchestration Request with Filters Failed"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); + return response; } - - return Response.status(200).entity(orchestrationList).build(); + return Response.status(200).entity(orchestrationList).build(); } - @POST @Path("/{version: [vV][3-5]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class) - public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) { + @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class) + public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, + @PathParam("version") String version) { - MsoRequest msoRequest = new MsoRequest (requestId); + MsoRequest msoRequest = new MsoRequest(requestId); - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); + long startTime = System.currentTimeMillis(); + msoLogger.debug("requestId is: " + requestId); InfraActiveRequests requestDB = null; Request request = null; - msoLogger.debug ("requestId is: " + requestId); + msoLogger.debug("requestId is: " + requestId); ServiceInstancesRequest sir = null; - try{ + try { ObjectMapper mapper = new ObjectMapper(); sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), + } catch (Exception e) { + msoLogger.debug("Mapping of request to JSON object failed : ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, + MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); + if (msoRequest.getRequestId() != null) { + msoLogger.debug("Mapping of request to JSON object failed"); } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, + "Mapping of request to JSON object failed"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); return response; } - - try{ + try { msoRequest.parseOrchestration(sir); } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), + msoLogger.debug("Validation failed: ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, + MsoException.ServiceException, "Error parsing request. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); + if (msoRequest.getRequestId() != null) { + msoLogger.debug("Logging failed message to the database"); } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, + "Validation of the input request failed"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); return response; } try { requestDB = requestsDB.getRequestFromInfraActive(requestId); - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + if (requestDB == null) { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, + "Null response from RequestDB when searching by RequestId"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, + "Null response from RequestDB when searching by RequestId"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); return resp; - }else{ + } else { request = mapInfraActiveRequestToRequest(requestDB); RequestStatus reqStatus = request.getRequestStatus(); Status status = Status.valueOf(reqStatus.getRequestState()); - if(status == Status.IN_PROGRESS || status == Status.PENDING){ - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); - reqStatus.setRequestState(Status.UNLOCKED.toString ()); - requestsDB.updateInfraStatus (requestId, - Status.UNLOCKED.toString (), + if (status == Status.IN_PROGRESS || status == Status.PENDING) { + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); + reqStatus.setRequestState(Status.UNLOCKED.toString()); + requestsDB.updateInfraStatus(requestId, Status.UNLOCKED.toString(), Constants.MODIFIED_BY_APIHANDLER); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked"); - - }else{ - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "RequestId " + requestId + " has been unlocked"); + + } else { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, + MsoException.ServiceException, "Orchestration RequestId " + requestId + " has a status of " + + status + " and can not be unlocked", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + + status + " and can not be unlocked"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, + "Orchestration RequestId " + requestId + " has a status of " + status + + " and can not be unlocked"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); return resp; } } } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.AvailabilityError, + "Exception while communciate with Request DB - Infra Request Lookup", e); + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); + alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, + Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, + "Exception while communciate with Request DB"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); return response; } - return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); + return Response.status(HttpStatus.SC_NO_CONTENT).entity("").build(); } - private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { - - - Request request = new Request(); - - ObjectMapper mapper = new ObjectMapper(); - // mapper.configure(Feature.WRAP_ROOT_VALUE, true); - - request.setRequestId(requestDB.getRequestId()); - request.setRequestScope(requestDB.getRequestScope()); - request.setRequestType(requestDB.getRequestAction()); - - InstanceReferences ir = new InstanceReferences(); - if(requestDB.getNetworkId() != null) - ir.setNetworkInstanceId(requestDB.getNetworkId()); - if(requestDB.getNetworkName() != null) - ir.setNetworkInstanceName(requestDB.getNetworkName()); - if(requestDB.getServiceInstanceId() != null) - ir.setServiceInstanceId(requestDB.getServiceInstanceId()); - if(requestDB.getServiceInstanceName() != null) - ir.setServiceInstanceName(requestDB.getServiceInstanceName()); - if(requestDB.getVfModuleId() != null) - ir.setVfModuleInstanceId(requestDB.getVfModuleId()); - if(requestDB.getVfModuleName() != null) - ir.setVfModuleInstanceName(requestDB.getVfModuleName()); - if(requestDB.getVnfId() != null) - ir.setVnfInstanceId(requestDB.getVnfId()); - if(requestDB.getVnfName() != null) - ir.setVnfInstanceName(requestDB.getVnfName()); - if(requestDB.getVolumeGroupId() != null) - ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId()); - if(requestDB.getVolumeGroupName() != null) - ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName()); - if(requestDB.getRequestorId() != null) + private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { + + Request request = new Request(); + + ObjectMapper mapper = new ObjectMapper(); + // mapper.configure(Feature.WRAP_ROOT_VALUE, true); + + request.setRequestId(requestDB.getRequestId()); + request.setRequestScope(requestDB.getRequestScope()); + request.setRequestType(requestDB.getRequestAction()); + + InstanceReferences ir = new InstanceReferences(); + if (requestDB.getNetworkId() != null) + ir.setNetworkInstanceId(requestDB.getNetworkId()); + if (requestDB.getNetworkName() != null) + ir.setNetworkInstanceName(requestDB.getNetworkName()); + if (requestDB.getServiceInstanceId() != null) + ir.setServiceInstanceId(requestDB.getServiceInstanceId()); + if (requestDB.getServiceInstanceName() != null) + ir.setServiceInstanceName(requestDB.getServiceInstanceName()); + if (requestDB.getVfModuleId() != null) + ir.setVfModuleInstanceId(requestDB.getVfModuleId()); + if (requestDB.getVfModuleName() != null) + ir.setVfModuleInstanceName(requestDB.getVfModuleName()); + if (requestDB.getVnfId() != null) + ir.setVnfInstanceId(requestDB.getVnfId()); + if (requestDB.getVnfName() != null) + ir.setVnfInstanceName(requestDB.getVnfName()); + if (requestDB.getVolumeGroupId() != null) + ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId()); + if (requestDB.getVolumeGroupName() != null) + ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName()); + if (requestDB.getRequestorId() != null) ir.setRequestorId(requestDB.getRequestorId()); - request.setInstanceReferences(ir); - String requestBody = requestDB.getRequestBody(); + String requestBody = requestDB.getRequestBody(); - RequestDetails requestDetails = null; + RequestDetails requestDetails = null; - try{ - requestDetails = mapper.readValue(requestBody, RequestDetails.class); + try { + requestDetails = mapper.readValue(requestBody, RequestDetails.class); - }catch(Exception e){ - msoLogger.debug("Exception caught mapping requestBody to RequestDetails",e); - } + } catch (Exception e) { + msoLogger.debug("Exception caught mapping requestBody to RequestDetails", e); + } - request.setRequestDetails(requestDetails); - String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT"; - request.setStartTime(startTimeStamp); + request.setRequestDetails(requestDetails); + String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + + " GMT"; + request.setStartTime(startTimeStamp); - RequestStatus status = new RequestStatus(); - if(requestDB.getStatusMessage() != null){ - status.setStatusMessage(requestDB.getStatusMessage()); - } + RequestStatus status = new RequestStatus(); + if (requestDB.getStatusMessage() != null) { + status.setStatusMessage(requestDB.getStatusMessage()); + } - if(requestDB.getEndTime() != null){ - String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT"; - status.setFinishTime(endTimeStamp); - } + if (requestDB.getEndTime() != null) { + String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + + " GMT"; + status.setFinishTime(endTimeStamp); + } + if (requestDB.getRequestStatus() != null) { + status.setRequestState(requestDB.getRequestStatus()); + } - if(requestDB.getRequestStatus() != null){ - status.setRequestState(requestDB.getRequestStatus()); - } + if (requestDB.getProgress() != null) { + status.setPercentProgress(requestDB.getProgress().intValue()); + } - if(requestDB.getProgress() != null){ - status.setPercentProgress(requestDB.getProgress().intValue()); - } + request.setRequestStatus(status); - request.setRequestStatus(status); + return request; + } - return request; - } - } + private E2ERequest mapInfraActiveRequestToE2ERequest(InfraActiveRequests requestDB) { + + E2ERequest e2erequest = new E2ERequest(); + + e2erequest.setOperationId(requestDB.getRequestId()); + // e2erequest.setRequestScope(requestDB.getRequestScope()); + e2erequest.setOperation(requestDB.getRequestAction()); + e2erequest.setResult(requestDB.getRequestStatus()); + e2erequest.setReason(requestDB.getStatusMessage()); + e2erequest.setUserId(requestDB.getRequestorId()); + e2erequest.setOperationContent(requestDB.getStatusMessage()); + e2erequest.setProgress(requestDB.getProgress()); + + String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + + " GMT"; + e2erequest.setOperateAt(startTimeStamp); + + if (requestDB.getEndTime() != null) { + String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + + " GMT"; + e2erequest.setFinishedAt(endTimeStamp); + } + + return e2erequest; + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java new file mode 100644 index 0000000000..e7ff2f611d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java @@ -0,0 +1,113 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.sql.Timestamp;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
+public class E2ERequest {
+
+ protected String operationId;
+ protected String operation;
+ protected String result;
+ protected String reason;
+ protected String userId;
+ protected String operationContent;
+ protected long progress;
+ protected String operateAt;
+ protected String finishedAt;
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getOperationContent() {
+ return operationContent;
+ }
+
+ public void setOperationContent(String operationContent) {
+ this.operationContent = operationContent;
+ }
+
+ public long getProgress() {
+ return progress;
+ }
+
+ public void setProgress(long progress) {
+ this.progress = progress;
+ }
+
+ public String getOperateAt() {
+ return operateAt;
+ }
+
+ public void setOperateAt(String operateAt) {
+ this.operateAt = operateAt;
+ }
+
+ public String getFinishedAt() {
+ return finishedAt;
+ }
+
+ public void setFinishedAt(String finishedAt) {
+ this.finishedAt = finishedAt;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java new file mode 100644 index 0000000000..8145afca6d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java @@ -0,0 +1,39 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class GetE2EServiceInstanceResponse {
+
+ protected E2ERequest e2eRequest;
+
+ public E2ERequest getE2eRequest() {
+ return e2eRequest;
+ }
+
+ public void setE2eRequest(E2ERequest e2eRequest) {
+ this.e2eRequest = e2eRequest;
+ }
+
+}
|