summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/java/org')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java50
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java50
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java50
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java56
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java38
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java112
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java49
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java84
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java49
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java94
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java11
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java2
14 files changed, 642 insertions, 9 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java
new file mode 100644
index 0000000000..8ba4589ebc
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.AAITasks;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.client.orchestration.AAIOrchestrator;
+
+public class AAICreateOwningEntity implements JavaDelegate {
+ private static Logger LOGGER = Logger.getLogger("AAICreateOwningEntity");
+ AAIOrchestrator aaiO = new AAIOrchestrator();
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ public void execute(DelegateExecution execution) throws Exception {
+ LOGGER.info("**** Started AAICreateOwningEntity ****");
+ ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition");
+ if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) {
+ try {
+ aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp);
+ } catch (Exception ex) {
+ String msg = "Exception in AAICreateOwningEntity. " + ex.getMessage();
+ LOGGER.info(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+ LOGGER.info("**** Finished AAICreateOwningEntity ****");
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java
new file mode 100644
index 0000000000..fe7006f530
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.AAITasks;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.client.orchestration.AAIOrchestrator;
+
+public class AAICreateProject implements JavaDelegate {
+ private static Logger LOGGER = Logger.getLogger("AAICreateProject");
+ AAIOrchestrator aaiO = new AAIOrchestrator();
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ public void execute(DelegateExecution execution) throws Exception {
+ LOGGER.info("**** Started AAICreateProject ****");
+ ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition");
+ if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) {
+ try {
+ aaiO.createProjectandConnectServiceInstance(serviceDecomp);
+ } catch (Exception ex) {
+ String msg = "Exception in AAICreateProject. " + ex.getMessage();
+ LOGGER.info(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+ LOGGER.info("**** Finished AAICreateProject ****");
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java
new file mode 100644
index 0000000000..b76675d0fc
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.AAITasks;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.client.orchestration.AAIOrchestrator;
+
+public class AAICreateServiceInstance implements JavaDelegate {
+ private static Logger LOGGER = Logger.getLogger("AAICreateServiceInstance");
+ AAIOrchestrator aaiO = new AAIOrchestrator();
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ public void execute(DelegateExecution execution) throws Exception {
+ LOGGER.info("**** Started AAICreateServiceInstance ****");
+ ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition");
+ execution.setVariable("aaiServiceInstanceRollback", false);
+ try {
+ aaiO.createServiceInstance(serviceDecomp);
+ } catch (Exception ex) {
+ String msg = "Exception in AAICreateServiceInstance. " + ex.getMessage();
+ LOGGER.info(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ execution.setVariable("aaiServiceInstanceRollback", true);
+ LOGGER.info("**** Finished AAICreateServiceInstance ****");
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java
new file mode 100644
index 0000000000..496ad6a1ff
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.DoCreateServiceInstance;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.client.orchestration.AAIOrchestrator;
+
+public class RollbackAAIServiceInstance implements JavaDelegate {
+ private static Logger LOGGER = Logger.getLogger("RollbackAAIServiceInstance");
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ public void execute(DelegateExecution execution) throws Exception {
+ boolean aaiServiceInstanceRollback = (boolean) execution.getVariable("aaiServiceInstanceRollback");
+ if (aaiServiceInstanceRollback) {
+ LOGGER.info("**** Starting RollbackAAIServiceInstance ****");
+ try {
+ ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("ServiceDecomposition");
+ AAIOrchestrator aaiO = new AAIOrchestrator();
+ aaiO.deleteServiceInstance(serviceDecomp);
+ } catch (Exception ex) {
+ String msg = "Error Response from AAI for aaiServiceInstanceRollback";
+ execution.setVariable("rollbackError", msg);
+ LOGGER.info(msg);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ LOGGER.info("**** Finished RollbackAAIServiceInstance ****");
+ } else {
+ LOGGER.info("**** Skipping RollbackAAIServiceInstance ****");
+ }
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java
new file mode 100644
index 0000000000..68ea713963
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.DoCreateServiceInstance;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+
+public class RollbackError implements JavaDelegate {
+
+ private static Logger LOGGER = Logger.getLogger("RollbackError");
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ LOGGER.info("Caught an Exception in DoCreateServiceInstanceRollbackV3");
+ LOGGER.info("Unable to rollback DoCreateServiceInstanceV3");
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java
new file mode 100644
index 0000000000..4edb4058e8
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.DoCreateServiceInstance;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.json.JSONObject;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.bpmn.core.domain.Customer;
+import org.openecomp.mso.bpmn.core.domain.ModelInfo;
+import org.openecomp.mso.bpmn.core.domain.OwningEntity;
+import org.openecomp.mso.bpmn.core.domain.Project;
+import org.openecomp.mso.bpmn.core.domain.Request;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.bpmn.core.domain.ServiceInstance;
+
+public class SetupServiceDecomp implements JavaDelegate {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+ private static Logger LOGGER = Logger.getLogger("SetupServiceDecomp");
+
+ public void execute(DelegateExecution execution) throws Exception {
+ LOGGER.info("Starting SetupServiceDecomp");
+ try {
+ String json = (String) execution.getVariable("bpmnRequest");
+ JSONObject jsonObj = new JSONObject(json);
+ JSONObject jsonReq = jsonObj.getJSONObject("requestDetails");
+ JSONObject jsonServ = jsonReq.getJSONObject("serviceInstance");
+ String serviceInstanceId = jsonServ.getString("serviceInstanceId");
+ System.out.println("servInstId: "+serviceInstanceId);
+ String serviceInstanceName = jsonServ.getString("serviceInstanceName");
+ String serviceType = jsonServ.getString("serviceType");
+ String serviceRole = jsonServ.getString("serviceRole");
+ String modelInvariantUuid = jsonServ.getString("modelInvariantUuid");
+ String modelUuid = jsonServ.getString("modelUuid");
+ String modelVersion = jsonServ.getString("modelVersion");
+ String modelName = jsonServ.getString("modelName");
+ String environmentContext = jsonServ.getString("environmentContext");
+ String workloadContext = jsonServ.getString("workloadContext");
+ JSONObject jsonProject = jsonReq.getJSONObject("project");
+ String projectName = jsonProject.getString("projectName");
+ JSONObject jsonOwningEntity = jsonReq.getJSONObject("owningEntity");
+ String owningEntityId = jsonOwningEntity.getString("owningEntityId");
+ String owningEntityName = jsonOwningEntity.getString("owningEntityName");
+ JSONObject jsonCustomer = jsonReq.getJSONObject("customer");
+ String subscriptionServiceType = jsonCustomer.getString("subscriptionServiceType");
+ String globalSubscriberId = jsonCustomer.getString("globalSubscriberId");
+ JSONObject jsonRequest = jsonReq.getJSONObject("request");
+ String sdncRequestId = jsonRequest.getString("sdncRequestId");
+ String callbackURL = jsonRequest.getString("callbackURL");
+ String requestId = jsonRequest.getString("requestId");
+ String productFamilyId = jsonRequest.getString("productFamilyId");
+ ServiceDecomposition serviceDecomp = new ServiceDecomposition("{}");
+ serviceDecomp.setCallbackURN(callbackURL);
+ serviceDecomp.setServiceRole(serviceRole);
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantUuid(modelInvariantUuid);
+ modelInfo.setModelName(modelName);
+ modelInfo.setModelVersion(modelVersion);
+ modelInfo.setModelUuid(modelUuid);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setInstanceId(serviceInstanceId);
+ serviceInstance.setInstanceName(serviceInstanceName);
+ serviceInstance.setServiceType(serviceType);
+ serviceInstance.setModelInfo(modelInfo);
+ serviceInstance.setEnvironmentContext(environmentContext);
+ serviceInstance.setWorkloadContext(workloadContext);
+ Project project = new Project();
+ project.setProjectName(projectName);
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId(owningEntityId);
+ owningEntity.setOwningEntityName(owningEntityName);
+ Customer customer = new Customer();
+ customer.setGlobalSubscriberId(globalSubscriberId);
+ customer.setSubscriptionServiceType(subscriptionServiceType);
+ Request request = new Request();
+ request.setRequestId(requestId);
+ request.setSdncRequestId(sdncRequestId);
+ request.setProductFamilyId(productFamilyId);
+ serviceDecomp.setCustomer(customer);
+ serviceDecomp.setServiceInstance(serviceInstance);
+ serviceDecomp.setRequest(request);
+ serviceDecomp.setProject(project);
+ serviceDecomp.setOwningEntity(owningEntity);
+ execution.setVariable("ServiceDecomposition", serviceDecomp);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "ERROR IN SET UP SERVICE DECOMP");
+ }
+ LOGGER.info("Finished SetupServiceDecomp");
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java
index c7420c3a03..a4a7edefe7 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -35,7 +35,7 @@ import org.openecomp.mso.logger.MsoLogger;
* @since Version 1.0
*
*/
-@ProcessApplication("MSO Infrastructure Application")
+@ProcessApplication(name="MSO Infrastructure Application", deploymentDescriptors={"../processes.xml"})
public class MSOInfrastructureApplication extends ServletProcessApplication {
private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java
new file mode 100644
index 0000000000..549ae36612
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.SDNCTasks;
+
+import java.util.logging.Logger;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.client.orchestration.SDNCOrchestrator;
+
+public class SDNCCreateServiceInstance implements JavaDelegate {
+ private static Logger LOGGER = Logger.getLogger("SDNCCreateServiceInstance");
+ SDNCOrchestrator sdncO = new SDNCOrchestrator();
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ public void execute(DelegateExecution execution) throws Exception {
+ LOGGER.info("**** Started SDNCCreateServiceInstance ****");
+ ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition");
+ if (serviceDecomp != null) {
+ try {
+ sdncO.createServiceInstance(serviceDecomp);
+ } catch (Exception ex) {
+ String msg = "Exception in sdncCreateServiceInstance. " + ex.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+ LOGGER.info("**** Finished SDNCCreateServiceInstance ****");
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java
new file mode 100644
index 0000000000..93ba0ae5a4
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.aai;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.AAIResourcesClient;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+public class AAICreateResources {
+
+
+ public void createAAIProject (String projectName, String serviceInstance){
+ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
+
+ }
+
+ public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ Map<String, String> hashMap= new HashMap<>();
+ hashMap.put("owning-entity-name", owningEntityName);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI);
+ }
+
+ public boolean existsOwningEntity(String owningEntityId){
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ return aaiRC.exists(owningEntityURI);
+ }
+
+ public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.connect(owningEntityURI, serviceInstanceURI);
+ }
+
+ public void createAAIPlatform(String platformName,String vnfId){
+ AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
+ AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI);
+ }
+
+ public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){
+ AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
+ AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI);
+ }
+ public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty());
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
new file mode 100644
index 0000000000..483c057f3e
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.aai;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.AAIResourcesClient;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+public class AAIDeleteServiceInstance implements JavaDelegate{
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+ public void execute(DelegateExecution execution) throws Exception {
+ try{
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstanceId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.delete(serviceInstanceURI);
+ execution.setVariable("GENDS_SuccessIndicator",true);
+ } catch(Exception ex){
+ String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java
new file mode 100644
index 0000000000..7370208f5e
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.infrastructure.aai;
+
+public class AAIServiceInstance {
+ String serviceInstanceName;
+ String serviceType;
+ String serviceRole;
+ String orchestrationStatus;
+ String modelInvariantUuid;
+ String modelVersionId;
+ String environmentContext;
+ String workloadContext;
+ public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole,
+ String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext,
+ String workloadContext) {
+ this.serviceInstanceName = serviceInstanceName;
+ this.serviceType = serviceType;
+ this.serviceRole = serviceRole;
+ this.orchestrationStatus = orchestrationStatus;
+ this.modelInvariantUuid = modelInvariantUuid;
+ this.modelVersionId = modelVersionId;
+ this.environmentContext = environmentContext;
+ this.workloadContext = workloadContext;
+ }
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+ public String getServiceType() {
+ return serviceType;
+ }
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+ public String getServiceRole() {
+ return serviceRole;
+ }
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
index 25c85f7394..646ed92705 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
@@ -60,8 +60,8 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
if (!isSend2SdncDirectly()) {
outputEntity = genericResourceApiClient.postNetworkTopologyOperation
(HeaderUtil.DefaulAuth, inputEntity).execute().body();
- updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- saveOutput(execution, outputEntity);
+ updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
+ saveOutput(execution, outputEntity);
} else {
send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
index 130c97e273..dab96b0613 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
@@ -33,6 +33,7 @@ import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationOutputEntity;
import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.requestsdb.RequestsDbConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,16 +53,16 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
Map<String, String> inputs,
GenericResourceApi genericResourceApiClient) throws Exception {
sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
-// updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
+ updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder();
RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs);
-// updateProgress(execution, null, null, "50", "RequestBody build finished!");
+ updateProgress(execution, null, null, "50", "RequestBody build finished!");
RpcServiceTopologyOperationOutputEntity outputEntity;
if (!isSend2SdncDirectly()) {
outputEntity = genericResourceApiClient.postServiceTopologyOperation
(HeaderUtil.DefaulAuth, inputEntity).execute().body();
-// updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- saveOutput(execution, outputEntity);
+ updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
+ saveOutput(execution, outputEntity);
} else {
send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
}
@@ -92,7 +93,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
String errorMessage = output.getOutput().getResponseMessage();
WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("SDNCA_SuccessIndicator", workflowException);
-// updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage);
+ updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage);
sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!");
throw new RouteException();
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
index 869c7783ef..90effd39e3 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
@@ -43,7 +43,7 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask {
String serviceId = (String) execution.getVariable("serviceId");
serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId;
String operationId = (String) execution.getVariable("operationId");
- String resourceTemplateUUID = (String) execution.getVariable("resourceUUID");
+ String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID");
resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID;
ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
return resourceOperationStatus.getOperType();