aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2020-03-25 16:04:41 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-03-26 11:44:39 -0400
commitcd4e5b408603a13dabc58f832e4aae4194e81995 (patch)
treea53701a308644c0469b5242f7f8370766bd5a453 /adapters/mso-openstack-adapters/src
parentf5420060c758308df18a0e316d6ae214ef9eb5c6 (diff)
convert openstack to external tasks
Use external tasks to communicate with openstack adapter Will be more resilient to failures Refactored all flows to use external tasks not REST calls Rollback is now an external task Ensured backwards compatibility Issue-ID: SO-2767 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I8afdb89c688d756aed0f25f7d9a7fb898142554d
Diffstat (limited to 'adapters/mso-openstack-adapters/src')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java91
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java132
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java)8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java)13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java)10
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java)9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java191
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java92
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java207
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java53
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java47
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java)8
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java)4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java)17
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java82
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java82
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java113
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml66
31 files changed, 1090 insertions, 220 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
deleted file mode 100644
index 7cc7c02f23..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 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.onap.so.adapters.audit;
-
-import javax.annotation.PostConstruct;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.onap.so.utils.ExternalTaskServiceUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-@Profile("!test")
-public class AuditStackService {
-
- private static final String MSO_AUDIT_LOCK_TIME = "mso.audit.lock-time";
-
- private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
-
- private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
-
- private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
-
-
- @Autowired
- public Environment env;
-
- @Autowired
- private AuditCreateStackService auditCreateStack;
-
- @Autowired
- private AuditDeleteStackService auditDeleteStack;
-
- @Autowired
- private AuditQueryStackService auditQueryStack;
-
- @Autowired
- private ExternalTaskServiceUtils externalTaskServiceUtils;
-
- @PostConstruct
- public void auditAddAAIInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryAddAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditCreateStack::executeExternalTask).open();
- }
- }
-
- @PostConstruct
- public void auditDeleteAAIInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryDeleteAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditDeleteStack::executeExternalTask).open();
- }
- }
-
- @PostConstruct
- public void auditQueryInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryQueryAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditQueryStack::executeExternalTask).open();
- }
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
deleted file mode 100644
index 4ab4d14dac..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 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.onap.so.adapters.inventory.create;
-
-import javax.annotation.PostConstruct;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.onap.so.utils.ExternalTaskServiceUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-@Profile("!test")
-public class CreateInventoryService {
-
- @Autowired
- public Environment env;
-
- @Autowired
- private CreateInventoryTask createInventory;
-
- @Autowired
- private ExternalTaskServiceUtils externalTaskServiceUtils;
-
- @PostConstruct
- public void auditAAIInventory() throws Exception {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryCreate")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
- .handler(createInventory::executeExternalTask).open();
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
new file mode 100644
index 0000000000..d282046b3f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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.onap.so.adapters.tasks;
+
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.onap.so.utils.ExternalTaskServiceUtils;
+import org.onap.so.adapters.tasks.audit.AuditCreateStackService;
+import org.onap.so.adapters.tasks.audit.AuditDeleteStackService;
+import org.onap.so.adapters.tasks.audit.AuditQueryStackService;
+import org.onap.so.adapters.tasks.inventory.CreateInventoryTask;
+import org.onap.so.adapters.tasks.orchestration.PollService;
+import org.onap.so.adapters.tasks.orchestration.RollbackService;
+import org.onap.so.adapters.tasks.orchestration.StackService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class TaskServices {
+
+ private static final Logger logger = LoggerFactory.getLogger(TaskServices.class);
+
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
+ @Autowired
+ private AuditCreateStackService auditCreateStack;
+
+ @Autowired
+ private AuditDeleteStackService auditDeleteStack;
+
+ @Autowired
+ private AuditQueryStackService auditQueryStack;
+
+ @Autowired
+ private CreateInventoryTask createInventory;
+
+ @Autowired
+ private StackService stackService;
+
+ @Autowired
+ private PollService pollService;
+
+ @Autowired
+ private RollbackService rollbackService;
+
+ @PostConstruct
+ public void auditAddAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryAddAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditCreateStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditDeleteAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryDeleteAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditDeleteStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditQueryInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryQueryAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditQueryStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryCreate").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(createInventory::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackInvoker() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterInvoke").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(stackService::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackPoller() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterPolling").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(pollService::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackRollback() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterRollback").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(rollbackService::executeExternalTask).open();
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
index ad28f0daeb..7622c1ba28 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
index ddd9fb1b5e..2f7155bffc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
@@ -19,14 +19,13 @@
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.Optional;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
-import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
index 8291fa9882..874823a7cd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -30,7 +30,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.RetrySequenceLevel;
import org.slf4j.Logger;
@@ -47,13 +47,13 @@ public class AuditCreateStackService extends AbstractAuditService {
public HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
+ public AuditMDCSetup mdcSetup;
public AuditCreateStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
index 1c707fe795..2c76acdb1b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.io.IOException;
import java.util.List;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
index cf077915c9..55cde4d174 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -28,7 +28,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,9 +45,6 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
-
- @Autowired
protected AuditVServer auditVservers;
@Autowired
@@ -56,11 +53,15 @@ public class AuditDeleteStackService extends AbstractAuditService {
@Autowired
protected Environment env;
+ @Autowired
+ public AuditMDCSetup mdcSetup;
+
public AuditDeleteStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
index 1c69a3e5e7..ebef4425eb 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -7,7 +7,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,16 +23,16 @@ public class AuditQueryStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
+ protected AuditDataService auditDataService;
@Autowired
- protected AuditDataService auditDataService;
+ public AuditMDCSetup mdcSetup;
public AuditQueryStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
boolean success = false;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
index 585e001f1a..63853c34fa 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.List;
import java.util.Optional;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
index ffa76cf8ee..1554881193 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.net.URI;
import java.util.Arrays;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index 69e16986da..a3cb99e3af 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import java.util.Optional;
import java.util.stream.Stream;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
index e02258c619..04dcd9ff61 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
@@ -20,13 +20,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
@@ -48,13 +48,14 @@ public class CreateInventoryTask extends ExternalTaskUtils {
CreateAAIInventory createInventory;
@Autowired
- private AuditMDCSetup mdcSetup;
+ public AuditMDCSetup mdcSetup;
public CreateInventoryTask() {
super(RetrySequenceLevel.SHORT);
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
boolean success = true;
boolean inventoryException = false;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java
index ed31c1c67e..7df3822961 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
public class InventoryException extends Exception {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
new file mode 100644
index 0000000000..6e181c4696
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
@@ -0,0 +1,191 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.onap.so.utils.RetrySequenceLevel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.heat.model.Stack;
+
+@Component
+public class PollService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(PollService.class);
+
+ @Autowired
+ private MsoHeatUtils msoHeatUtils;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public PollService() {
+ super(RetrySequenceLevel.SHORT);
+ }
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ logger.trace("Executing External Task Poll Service");
+ Map<String, Object> variables = new HashMap<>();
+ MutableBoolean success = new MutableBoolean();
+ String errorMessage = null;
+ try {
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ if (xmlRequest != null) {
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ determineCreateVolumeGroupStatus(xmlRequest, externalTask, success);
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ determineCreateVfModuleStatus(xmlRequest, externalTask, success);
+ } else if ("deleteVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Poll Service for Delete Vf Module");
+ DeleteVfModuleRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Poll Service for Delete Volume Group");
+ DeleteVolumeGroupRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Poll Service", e);
+ errorMessage = e.getMessage();
+ }
+
+ variables.put("OpenstackPollSuccess", success.booleanValue());
+ variables.put("openstackAdapterErrorMessage", errorMessage);
+ if (success.isTrue()) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ if (externalTask.getRetries() == null) {
+ logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
+ externalTask.getId(), getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, "errorMessage", "errorDetails",
+ getRetrySequence().length, 10000);
+ } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ } else {
+ logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: {}",
+ externalTask.getId(), externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ externalTaskService.handleFailure(externalTask, "errorMessage", "errorDetails",
+ externalTask.getRetries() - 1, calculateRetryDelay(externalTask.getRetries()));
+ }
+ }
+ }
+
+ private void determineCreateVolumeGroupStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
+ throws MsoException {
+ CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Volume Group");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+
+ private void determineCreateVfModuleStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
+ throws MsoException {
+ CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Vf Module");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ logger.debug("Executing External Task Poll Service for Create Vf Module");
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+
+ private void pollCreateResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack stack =
+ msoHeatUtils.pollStackForStatus(1, currentStack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
+ msoHeatUtils.postProcessStackCreate(stack, false, 0, false, cloudSiteId, tenantId, null);
+ success.setTrue();
+ }
+
+ private void pollDeleteResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack stack =
+ msoHeatUtils.pollStackForStatus(1, currentStack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId, true);
+ if (stack != null) { // if stack is null it was not found and no need to do post process
+ msoHeatUtils.postProcessStackDelete(stack);
+ }
+ success.setTrue();
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+
+ private Stack createCurrentStack(String canonicalStackId) {
+ Stack currentStack = new Stack();
+ String stackName = canonicalStackId;
+ if (canonicalStackId.contains("/")) {
+ String[] stacks = canonicalStackId.split("/");
+ stackName = stacks[0];
+ currentStack.setId(stacks[1]);
+ }
+ currentStack.setStackName(stackName);
+ return currentStack;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
new file mode 100644
index 0000000000..c302293169
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
@@ -0,0 +1,92 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RollbackService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(RollbackService.class);
+
+ @Autowired
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ logger.trace("Executing External Task Rollback Service");
+ Map<String, Object> variables = new HashMap<>();
+ boolean success = false;
+ boolean pollRollbackStatus = false;
+ try {
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ if (xmlRequest != null) {
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Rollback Service for Create Volume Group");
+ CreateVolumeGroupRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupName(), req.getMsoRequest(), false);
+ pollRollbackStatus = true;
+ success = true;
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Rollback Service for Create Vf Module");
+ CreateVfModuleRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleName(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
+ req.getMsoRequest(), new Holder<>());
+ pollRollbackStatus = true;
+ success = true;
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Rollback Service", e);
+ }
+ variables.put("OpenstackRollbackSuccess", success);
+ variables.put("rollbackPerformed", true);
+ variables.put("PollRollbackStatus", pollRollbackStatus);
+ if (success) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ logger.debug("The External Task Id: {} Failed. Not Retrying", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ }
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
new file mode 100644
index 0000000000..34952a056b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
@@ -0,0 +1,207 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.ws.Holder;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.VfModuleRollback;
+import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class StackService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(StackService.class);
+
+ @Autowired
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ Map<String, Object> variables = new HashMap<>();
+ mdcSetup.setupMDC(externalTask);
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ logger.debug("Executing External Task Stack Service. {}", xmlRequest);
+ MutableBoolean success = new MutableBoolean();
+ MutableBoolean backout = new MutableBoolean();
+ String response = "";
+ Holder<String> canonicalStackId = new Holder<>();
+ String errorMessage = "";
+ try {
+ if (xmlRequest != null) {
+ Holder<Map<String, String>> outputs = new Holder<>();
+ Holder<VnfRollback> vnfRollback = new Holder<>();
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Create Volume Group");
+ response = createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Create Vf Module");
+ response = createVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("deleteVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Delete Vf Module");
+ response = deleteVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Delete Volume Group");
+ response = deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Stack Service", e);
+ errorMessage = e.getMessage();
+ }
+ variables.put("backout", backout.booleanValue());
+ variables.put("WorkflowResponse", response);
+ variables.put("OpenstackInvokeSuccess", success.booleanValue());
+ variables.put("stackId", canonicalStackId.value);
+ variables.put("openstackAdapterErrorMessage", errorMessage);
+ variables.put("PollRollbackStatus", false);
+ variables.put("rollbackPerformed", false);
+ variables.put("OpenstackRollbackSuccess", false);
+ variables.put("OpenstackPollSuccess", false);
+
+ if (success.isTrue()) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ logger.debug("The External Task Id: {} Failed. Not Retrying", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ }
+ }
+
+ private String createVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ Holder<String> stackId = new Holder<>();
+ CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null, null,
+ req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true, req.getEnableBridge(),
+ req.getMsoRequest(), stackId, outputs, vnfRollback);
+ success.setTrue();
+ backout.setValue(!req.getSuppressBackout());
+ VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
+ vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
+ req.getMsoRequest(), req.getMessageId());
+ canonicalStackId.value = stackId.value;
+ CreateVolumeGroupResponse createResponse = new CreateVolumeGroupResponse(req.getVolumeGroupId(), stackId.value,
+ vnfRollback.value.getVnfCreated(), outputs.value, rb, req.getMessageId());
+ return createResponse.toXmlString();
+ }
+
+ private String createVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ Holder<String> stackId = new Holder<>();
+ CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
+ req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(),
+ req.getModelCustomizationUuid(), req.getVfModuleParams(), false, false, req.getEnableBridge(),
+ req.getMsoRequest(), stackId, outputs, vnfRollback);
+ success.setTrue();
+ backout.setValue(req.getBackout());
+ canonicalStackId.value = stackId.value;
+ VfModuleRollback modRollback =
+ new VfModuleRollback(vnfRollback.value, req.getVfModuleId(), stackId.value, req.getMessageId());
+ CreateVfModuleResponse createResponse = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
+ stackId.value, Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
+ return createResponse.toXmlString();
+ }
+
+ private String deleteVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ backout.setFalse();
+ DeleteVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
+ req.getMsoRequest(), outputs);
+ success.setTrue();
+ if (outputs != null && outputs.value != null) {
+ canonicalStackId.value = outputs.value.get("canonicalStackId");
+ } else {
+ canonicalStackId.value = req.getVfModuleStackId();
+ }
+ DeleteVfModuleResponse deleteResponse = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
+ Boolean.TRUE, req.getMessageId(), outputs.value);
+ return deleteResponse.toXmlString();
+ }
+
+ private String deleteVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ backout.setFalse();
+ DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
+
+ vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupStackId(), req.getMsoRequest(), false);
+ success.setTrue();
+ canonicalStackId.value = req.getVolumeGroupStackId();
+ DeleteVolumeGroupResponse deleteResponse = new DeleteVolumeGroupResponse(true, req.getMessageId());
+ return deleteResponse.toXmlString();
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 60c5a0ca2a..3a2d3bc5eb 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -323,6 +323,42 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
/**
+ * This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud
+ * and tenant.
+ *
+ * The method has no outputs.
+ *
+ * @param cloudSiteId CLLI code of the cloud site in which to delete
+ * @param cloudOwner cloud owner of the cloud region in which to delete
+ * @param tenantId Openstack tenant identifier
+ * @param vnfName VNF Name or Openstack ID
+ * @param msoRequest Request tracking information for logs
+ */
+ public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest,
+ boolean pollStackStatus) throws VnfException {
+
+ logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
+
+ try {
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, pollStackStatus, 118);
+ } catch (MsoException me) {
+ me.addContext(DELETE_VNF);
+ // Failed to query the Stack due to an openstack exception.
+ // Convert to a generic VnfException
+ String error =
+ "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
+ logger.debug(error);
+ throw new VnfException(me);
+ }
+
+ // On success, nothing is returned.
+ return;
+ }
+
+
+ /**
* This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
* client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
* to undo the creation.
@@ -536,6 +572,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge,
MsoRequest msoRequest, Holder<String> vnfId, Holder<Map<String, String>> outputs,
Holder<VnfRollback> rollback) throws VnfException {
+ boolean pollForCompletion = false;
String vfModuleName = vnfName;
String vfModuleType = vnfType;
String vfVersion = vnfVersion;
@@ -1050,8 +1087,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
if (msoHeatUtils != null) {
heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
- template, goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
- nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
+ template, goldenInputs, pollForCompletion, heatTemplate.getTimeoutMinutes(),
+ newEnvironmentString, nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(),
+ failIfExists);
if (msoRequest.getRequestId() != null) {
msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
heatStack.isOperationPerformed() ? VF_EXIST_STATUS_MESSAGE : VF_CREATED_STATUS_MESSAGE);
@@ -1135,10 +1173,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
try {
- StackInfo stackInfo =
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
+ StackInfo currentStack =
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, false, timeoutMinutes);
+ if (currentStack != null && outputs != null && outputs.value != null) {
+ logger.debug("Adding canonical stack id to outputs " + currentStack.getCanonicalName());
+ outputs.value.put("canonicalStackId", currentStack.getCanonicalName());
+ }
msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- stackInfo.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
+ currentStack.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
+
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index 0836f69ba7..5b78d2f066 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -78,6 +78,7 @@ import io.swagger.annotations.ApiResponses;
* can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. For testing, call
* with cloudSiteId = ___TESTING___ To test exceptions, also set tenantId = ___TESTING___
*/
+@Deprecated
@Path("/v1/vnfs")
@Api(value = "/v1/vnfs", description = "root of vnf adapters restful web service")
@Transactional
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index 18ed9872a0..63b4c5d0f3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -39,7 +39,6 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
@@ -56,6 +55,7 @@ import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.entity.MsoRequest;
import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
@@ -78,6 +78,7 @@ import io.swagger.annotations.ApiResponses;
*
* V2 incorporates run-time selection of sub-orchestrator implementation (Heat or Cloudify) based on the target cloud.
*/
+@Deprecated
@Path("/v2/vnfs")
@Api(value = "/v2/vnfs", description = "root of vnf adapters restful web service v2")
@Component
@@ -189,10 +190,7 @@ public class VnfAdapterRestV2 {
}
String cloudsite = req.getCloudSiteId();
Holder<Map<String, String>> outputs = new Holder<>();
- if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
- // vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
- // req.getMsoRequest());
- // Support different Adapter Implementations
+ if (cloudsite != null) {
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite);
adapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index cfddbba34e..a424fa92fd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -174,33 +174,26 @@ public class VolumeAdapterRestV2 {
logger.debug("in createVfModuleVolumes - completeVnfVfModuleType={}", completeVnfVfModuleType);
String cloudsiteId = req.getCloudSiteId();
- if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) {
- String tenant = req.getTenantId();
- if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- stackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
- outputs.value = testMap();
- } else {
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
- vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
- req.getCloudOwner(), // cloudOwner,
- req.getTenantId(), // tenantId,
- completeVnfVfModuleType, // vnfType,
- req.getVnfVersion(), // vnfVersion,
- "", // genericVnfId
- req.getVolumeGroupName(), // vnfName,
- "", // vfModuleId
- "VOLUME", // requestType,
- null, // volumeGroupHeatStackId,
- null, // baseVfHeatStackId,
- req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
- req.getFailIfExists(), // failIfExists,
- req.getSuppressBackout(), // backout,
- req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
- stackId, outputs, vnfRollback);
- }
+
+ // Support different Adapter Implementations
+ MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
+ vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
+ req.getCloudOwner(), // cloudOwner,
+ req.getTenantId(), // tenantId,
+ completeVnfVfModuleType, // vnfType,
+ req.getVnfVersion(), // vnfVersion,
+ "", // genericVnfId
+ req.getVolumeGroupName(), // vnfName,
+ "", // vfModuleId
+ "VOLUME", // requestType,
+ null, // volumeGroupHeatStackId,
+ null, // baseVfHeatStackId,
+ req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
+ req.getFailIfExists(), // failIfExists,
+ req.getSuppressBackout(), // backout,
+ req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
+ stackId, outputs, vnfRollback);
+
VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
index d3380a6a33..d5f8f865a8 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
@@ -13,6 +13,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditDataService;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.beans.RequestProcessingData;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
index cff4d5f994..a10ab4b7df 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -36,8 +36,12 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.audit.AuditCreateStackService;
+import org.onap.so.adapters.tasks.audit.AuditDataService;
+import org.onap.so.adapters.tasks.audit.AuditQueryStackService;
+import org.onap.so.adapters.tasks.audit.HeatStackAudit;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
index 8e71ec46b0..af4afd41a1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
@@ -41,6 +41,7 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditVServer;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
index c995064ab2..d1d0d96042 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -43,6 +43,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditVServer;
+import org.onap.so.adapters.tasks.audit.HeatStackAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
index 8226f4fed8..e822f65072 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -38,6 +38,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
index c4fa9ee2c5..fc2baefcd5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -30,8 +30,11 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
+import org.onap.so.adapters.tasks.inventory.CreateInventoryTask;
+import org.onap.so.adapters.tasks.inventory.InventoryException;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -47,12 +50,12 @@ public class CreateInventoryTaskTest {
@Mock
ExternalTaskService externalTaskService;
- @Mock
- private AuditMDCSetup mdcSetup;
-
@InjectMocks
CreateInventoryTask inventoryTask;
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
new file mode 100644
index 0000000000..b5b0f5a8ef
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
@@ -0,0 +1,82 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.PollService;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PollServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private PollService pollService;
+
+ @Test
+ public void testExecuteExternalTask() throws MsoException, IOException {
+ String xmlString =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false);
+ Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
+ Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(false))).thenReturn(new Stack());
+ // Mockito.doNothing().when(msoHeatUtils).postProcessStackCreate(Mockito.any(), Mockito.any(), Mockito.any(),
+ // Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+
+ pollService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(msoHeatUtils).pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"),
+ eq("regionOne"), eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(false));
+
+ }
+
+ @Test
+ public void testExecuteExternalTask_rollback() throws MsoException, IOException {
+ String xmlString =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(true);
+ Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
+ Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(true))).thenReturn(new Stack());
+ Mockito.doNothing().when(msoHeatUtils).postProcessStackDelete(Mockito.any());
+
+
+ pollService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(msoHeatUtils).pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(true));
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
new file mode 100644
index 0000000000..f7613909ec
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
@@ -0,0 +1,82 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.RollbackService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RollbackServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private RollbackService rollbackService;
+
+
+ @Test
+ public void findRequestTypeTest() throws IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Optional<String> actual = rollbackService.findRequestType(payload);
+
+ assertEquals("createVfModuleRequest", actual.get());
+ }
+
+ @Test
+ public void testExecuteExternalTask() throws VnfException, MsoException, IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Stack stack = new Stack();
+ stack.setId("heatId");
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
+
+ rollbackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(vnfAdapterImpl, Mockito.times(1)).deleteVfModule(Mockito.eq("regionOne"),
+ Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"), Mockito.eq("dummy_id"),
+ Mockito.any(String.class), Mockito.any(String.class), Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.any());
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
new file mode 100644
index 0000000000..2f583b30a2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
@@ -0,0 +1,113 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.StackService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class StackServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private StackService stackService;
+
+ @Test
+ public void findRequestTypeTest() throws IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Optional<String> actual = stackService.findRequestType(payload);
+
+ assertEquals("createVfModuleRequest", actual.get());
+ }
+
+ @Test
+ public void testExecuteExternalTask() throws VnfException, MsoException, IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Stack stack = new Stack();
+ stack.setId("heatId");
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
+
+ stackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Map<String, Object> paramsMap = new HashMap<String, Object>();
+ paramsMap.put("vf_module_id", "985a468b-328b-4c2b-ad0e-b8f1e19501c4");
+ paramsMap.put("vnf_id", "6640feba-55f6-4946-9694-4d9558c8870a");
+ paramsMap.put("vnf_name", "Robot_VNF_For_Volume_Group");
+ paramsMap.put("availability_zone_0", "AZ-MN02");
+ paramsMap.put("environment_context", "General_Revenue-Bearing");
+ paramsMap.put("user_directives", "{}");
+ paramsMap.put("workload_context", "");
+ paramsMap.put("vf_module_name", "dummy_id");
+ paramsMap.put("vf_module_index", "0");
+ paramsMap.put("sdnc_directives",
+ "{ \"attributes\": [ {\"attribute_name\": \"availability_zone_0\", \"attribute_value\": \"AZ-MN02\"}] }");
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("backout", true);
+ variables.put("WorkflowResponse", "");
+ variables.put("OpenstackInvokeSuccess", true);
+ variables.put("stackId", null);
+ variables.put("openstackAdapterErrorMessage", null);
+ variables.put("PollRollbackStatus", false);
+ variables.put("rollbackPerformed", false);
+ variables.put("OpenstackRollbackSuccess", false);
+ variables.put("OpenstackPollSuccess", false);
+
+ Mockito.verify(vnfAdapterImpl, Mockito.times(1)).createVfModule(Mockito.eq("regionOne"),
+ Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"),
+ Mockito.eq(
+ "Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0::VfZrdm5bpxmc02092017Vf..pxmc_base..module-0"),
+ Mockito.eq("1.0"), Mockito.eq("6640feba-55f6-4946-9694-4d9558c8870a"), Mockito.eq("dummy_id"),
+ Mockito.eq("985a468b-328b-4c2b-ad0e-b8f1e19501c4"), Mockito.eq(null), Mockito.eq(null),
+ Mockito.eq(null), Mockito.eq("074c64d0-7e13-4bcc-8bdb-ea922331102d"), Mockito.eq(paramsMap),
+ Mockito.eq(false), Mockito.eq(false), Mockito.eq(null), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any());
+ Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.eq(variables));
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml b/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml
new file mode 100644
index 0000000000..c7c880ed92
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<createVfModuleRequest>
+ <messageId>7f4557c8-c3b9-4743-8b88-9539f9ed7bea</messageId>
+ <notificationUrl>http://mso-bpmn-infra-svc:9200/mso/WorkflowMessage/VNFAResponse/7f4557c8-c3b9-4743-8b88-9539f9ed7bea
+ </notificationUrl>
+ <skipAAI>true</skipAAI>
+ <cloudSiteId>regionOne</cloudSiteId>
+ <cloudOwner>CloudOwner</cloudOwner>
+ <tenantId>0422ffb57ba042c0800a29dc85ca70f8</tenantId>
+ <vnfId>6640feba-55f6-4946-9694-4d9558c8870a</vnfId>
+ <vnfType>Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0</vnfType>
+ <vnfVersion>1.0</vnfVersion>
+ <vfModuleId>985a468b-328b-4c2b-ad0e-b8f1e19501c4</vfModuleId>
+ <vfModuleName>dummy_id</vfModuleName>
+ <vfModuleType>VfZrdm5bpxmc02092017Vf..pxmc_base..module-0</vfModuleType>
+ <baseVfModuleId>985a468b-328b-4c2b-ad0e-b8f1e19501c4</baseVfModuleId>
+ <modelCustomizationUuid>074c64d0-7e13-4bcc-8bdb-ea922331102d</modelCustomizationUuid>
+ <failIfExists>false</failIfExists>
+ <backout>true</backout>
+ <vfModuleParams>
+ <entry>
+ <key>vf_module_id</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">985a468b-328b-4c2b-ad0e-b8f1e19501c4</value>
+ </entry>
+ <entry>
+ <key>vnf_id</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">6640feba-55f6-4946-9694-4d9558c8870a</value>
+ </entry>
+ <entry>
+ <key>vnf_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">Robot_VNF_For_Volume_Group</value>
+ </entry>
+ <entry>
+ <key>availability_zone_0</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">AZ-MN02</value>
+ </entry>
+ <entry>
+ <key>environment_context</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">General_Revenue-Bearing</value>
+ </entry>
+ <entry>
+ <key>user_directives</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{}</value>
+ </entry>
+ <entry>
+ <key>workload_context</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"/>
+ </entry>
+ <entry>
+ <key>vf_module_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">dummy_id</value>
+ </entry>
+ <entry>
+ <key>vf_module_index</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">0</value>
+ </entry>
+ <entry>
+ <key>sdnc_directives</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{ "attributes": [ {"attribute_name": "availability_zone_0", "attribute_value": "AZ-MN02"}] }</value>
+ </entry>
+ </vfModuleParams>
+ <msoRequest>
+ <requestId>049abdd8-0e19-48b8-bd87-b18f8d49048c</requestId>
+ <serviceInstanceId>7dc4c4eb-b1d7-4aef-94d1-24e925d1210c</serviceInstanceId>
+ </msoRequest>
+</createVfModuleRequest>