summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java46
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java39
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java87
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java110
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java78
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java122
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java85
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java173
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java330
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java132
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteAAIInventory.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java)29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteInventoryTask.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java)8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java39
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java51
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java113
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java191
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java444
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java298
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn208
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn455
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java6
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java15
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplace.java25
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplaceVolume.java26
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java6
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java6
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java6
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java6
-rw-r--r--so-simulator/src/main/resources/openstack/gr_api/zrdm52emccr01_base_resources.json122
33 files changed, 410 insertions, 2947 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java
deleted file mode 100644
index 4e5e880f80..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.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.delete;
-
-import javax.annotation.PostConstruct;
-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 DeleteInventoryService {
-
- @Autowired
- public Environment env;
-
- @Autowired
- private DeleteInventoryTask deleteInventory;
-
- @Autowired
- private ExternalTaskServiceUtils externalTaskServiceUtils;
-
- @PostConstruct
- public void auditAAIInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- externalTaskServiceUtils.createExternalTaskClient().subscribe("InventoryDelete")
- .lockDuration(externalTaskServiceUtils.getLockDurationMedium())
- .handler(deleteInventory::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
index d4a4bb792f..b176892192 100644
--- 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
@@ -22,10 +22,8 @@ package org.onap.so.adapters.tasks;
import javax.annotation.PostConstruct;
import org.camunda.bpm.client.ExternalTaskClient;
-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.inventory.DeleteInventoryTask;
import org.onap.so.adapters.tasks.orchestration.PollService;
import org.onap.so.adapters.tasks.orchestration.RollbackService;
import org.onap.so.adapters.tasks.orchestration.StackService;
@@ -46,15 +44,6 @@ public class TaskServices {
private ExternalTaskServiceUtils externalTaskServiceUtils;
@Autowired
- private AuditCreateStackService auditCreateStack;
-
- @Autowired
- private AuditDeleteStackService auditDeleteStack;
-
- @Autowired
- private AuditQueryStackService auditQueryStack;
-
- @Autowired
private CreateInventoryTask createInventory;
@Autowired
@@ -66,39 +55,24 @@ public class TaskServices {
@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.getLockDurationLong())
- .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.getLockDurationLong())
- .handler(auditDeleteStack::executeExternalTask).open();
- }
- }
+ @Autowired
+ private DeleteInventoryTask deleteInventory;
@PostConstruct
- public void auditQueryInventory() throws Exception {
+ public void createtAAIInventory() throws Exception {
for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryQueryAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
- .handler(auditQueryStack::executeExternalTask).open();
+ client.subscribe("InventoryCreate").lockDuration(externalTaskServiceUtils.getLongLockDuration())
+ .handler(createInventory::executeExternalTask).open();
}
}
@PostConstruct
- public void createtAAIInventory() throws Exception {
+ public void auditAAIInventory() throws Exception {
for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryCreate").lockDuration(externalTaskServiceUtils.getLongLockDuration())
- .handler(createInventory::executeExternalTask).open();
+ externalTaskServiceUtils.createExternalTaskClient().subscribe("InventoryDelete")
+ .lockDuration(externalTaskServiceUtils.getLockDurationMedium())
+ .handler(deleteInventory::executeExternalTask).open();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
deleted file mode 100644
index 0c6bb6f387..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
+++ /dev/null
@@ -1,39 +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.tasks.audit;
-
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-
-public class AbstractAudit {
-
- private AAIResourcesClient aaiClient;
-
- protected AAIResourcesClient getAaiClient() {
- if (aaiClient == null)
- return new AAIResourcesClient();
- else
- return aaiClient;
- }
-
- protected void setAaiClient(AAIResourcesClient aaiResource) {
- aaiClient = aaiResource;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
deleted file mode 100644
index 8cdd37d43f..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
+++ /dev/null
@@ -1,87 +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.tasks.audit;
-
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-public abstract class AbstractAuditService extends ExternalTaskUtils {
-
- private static final Logger logger = LoggerFactory.getLogger(AbstractAuditService.class);
-
- protected static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI =
- "Unable to find all VServers and L-Interaces in A&AI";
-
- protected static final String UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK = "Unable to find VServers in Openstack";
-
- @Autowired
- public Environment env;
-
- public AbstractAuditService() {
- super(RetrySequenceLevel.LONG);
- }
-
- /**
- * @param auditList
- * @return
- */
- protected boolean didCreateAuditFail(AAIObjectAuditList auditList) {
- if (isAuditListNotNullAndNotEmpty(auditList)) {
- if (logger.isInfoEnabled()) {
- logger.info("Audit Results: {}", auditList.toString());
- }
- return auditList.getAuditList().stream().filter(auditObject -> !auditObject.isDoesObjectExist()).findFirst()
- .map(v -> true).orElse(false);
- } else {
- return false;
- }
- }
-
- /**
- * @param auditList
- * @return
- */
- protected boolean didDeleteAuditFail(AAIObjectAuditList auditList) {
- if (isAuditListNotNullAndNotEmpty(auditList)) {
- if (logger.isInfoEnabled()) {
- logger.info("Audit Results: {}", auditList.toString());
- }
- return auditList.getAuditList().stream().filter(AAIObjectAudit::isDoesObjectExist).findFirst()
- .map(v -> true).orElse(false);
- } else {
- return false;
- }
- }
-
- private boolean isAuditListNotNullAndNotEmpty(AAIObjectAuditList auditList) {
- return auditList != null && auditList.getAuditList() != null && !auditList.getAuditList().isEmpty();
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
deleted file mode 100644
index a4afcf1378..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============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.audit;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-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.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.logging.tasks.AuditMDCSetup;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AuditCreateStackService extends AbstractAuditService {
-
- private static final Logger logger = LoggerFactory.getLogger(AuditCreateStackService.class);
-
- @Autowired
- public HeatStackAudit heatStackAudit;
-
- @Autowired
- public AuditMDCSetup mdcSetup;
-
- public AuditCreateStackService() {
- super();
- }
-
- public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- mdcSetup.setupMDC(externalTask);
- AuditInventory auditInventory = externalTask.getVariable("auditInventory");
- Map<String, Object> variables = new HashMap<>();
- boolean success = false;
- try {
- Integer retryCount = externalTask.getRetries();
- logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", retryCount, auditInventory);
- Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
- auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
- if (auditListOpt.isPresent()) {
- auditListOpt.get().setAuditType("create");
- auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
- success = !didCreateAuditFail(auditListOpt.get());
- }
- } catch (Exception e) {
- logger.error("Error during audit of stack", e);
- }
- variables.put("auditIsSuccessful", success);
- mdcSetup.setElapsedTime();
- String externalTaskId = externalTask.getId();
- if (success) {
- externalTaskService.complete(externalTask, variables);
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
- logger.debug("The External Task Id: {} Successful", externalTaskId);
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
- mdcSetup.clearClientMDCs();
- } else {
- Integer retryCount = externalTask.getRetries();
- if (retryCount == null) {
- logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTaskId, getRetrySequence().length);
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
- } else if (retryCount == 1) {
- externalTaskService.complete(externalTask, variables);
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
- mdcSetup.clearClientMDCs();
- } else {
- logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1,
- calculateRetryDelay(retryCount));
- }
- logger.debug("The External Task Id: {} Failed", externalTaskId);
- }
- }
-
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
deleted file mode 100644
index 200f6375ea..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.onap.so.adapters.tasks.audit;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Optional;
-import org.onap.so.audit.beans.AuditInventory;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.db.request.beans.RequestProcessingData;
-import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-
-@Component
-public class AuditDataService {
-
- private static final String AUDIT_STACK_DATA = "AuditStackData";
-
- @Autowired
- private RequestsDbClient requestsDbClient;
-
- /**
- * Checks to see if an entry already exist for the given heat stack and writes audit stack data to the request
- * database if it doesn't.
- *
- * @throws JsonProcessingException
- */
- public void writeStackDataToRequestDb(AuditInventory auditInventory, AAIObjectAuditList auditList)
- throws JsonProcessingException {
- List<RequestProcessingData> requestProcessingDataList =
- requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
- auditInventory.getHeatStackName(), AUDIT_STACK_DATA);
- if (requestProcessingDataList.isEmpty()) {
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
-
- RequestProcessingData requestProcessingData = new RequestProcessingData();
- requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
- requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
- requestProcessingData.setName(auditInventory.getHeatStackName());
- requestProcessingData.setTag(AUDIT_STACK_DATA);
- requestProcessingData.setValue(auditListString);
-
- requestsDbClient.saveRequestProcessingData(requestProcessingData);
- }
- }
-
- /**
- * Retrieves audit stack data from the request database.
- *
- * @throws IOException
- * @throws JsonMappingException
- * @throws JsonParseException
- */
- public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory) throws IOException {
-
- List<RequestProcessingData> requestProcessingDataList =
- requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
- auditInventory.getHeatStackName(), AUDIT_STACK_DATA);
- if (!requestProcessingDataList.isEmpty()) {
- RequestProcessingData requestProcessingData = requestProcessingDataList.get(0);
- String auditListString = requestProcessingData.getValue();
-
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- AAIObjectAuditList auditList =
- objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class);
-
- return Optional.of(auditList);
- } else {
- return Optional.empty();
- }
- }
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
deleted file mode 100644
index a7fdc352cd..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017-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.audit;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-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.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.logging.tasks.AuditMDCSetup;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AuditDeleteStackService extends AbstractAuditService {
-
- private static final Logger logger = LoggerFactory.getLogger(AuditDeleteStackService.class);
-
- @Autowired
- protected HeatStackAudit heatStackAudit;
-
- @Autowired
- protected AuditVServer auditVservers;
-
- @Autowired
- protected AuditDataService auditDataService;
-
- @Autowired
- protected Environment env;
-
- @Autowired
- public AuditMDCSetup mdcSetup;
-
- public AuditDeleteStackService() {
- super();
- }
-
- public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
-
- mdcSetup.setupMDC(externalTask);
- AuditInventory auditInventory = externalTask.getVariable("auditInventory");
- Map<String, Object> variables = new HashMap<>();
- boolean success = false;
- try {
- Integer retryCount = externalTask.getRetries();
- logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", retryCount);
- Optional<AAIObjectAuditList> auditListOpt = auditDataService.getStackDataFromRequestDb(auditInventory);
- if (auditListOpt.isPresent()) {
- auditVservers.auditVservers(auditListOpt.get());
- } else {
- logger.debug("Auditing Vservers based on vf module relationships");
- auditListOpt = auditVservers.auditVserversThroughRelationships(auditInventory.getGenericVnfId(),
- auditInventory.getHeatStackName());
- }
- auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
- auditListOpt.get().setAuditType("delete");
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
- success = !didDeleteAuditFail(auditListOpt.get());
-
- } catch (Exception e) {
- logger.error("Error during audit of stack", e);
- }
- variables.put("auditIsSuccessful", success);
- mdcSetup.setElapsedTime();
- String externalTaskId = externalTask.getId();
- if (success) {
- externalTaskService.complete(externalTask, variables);
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
- logger.debug("The External Task Id: {} Successful", externalTaskId);
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
- mdcSetup.clearClientMDCs();
- } else {
- Integer retryCount = externalTask.getRetries();
- if (retryCount == null) {
- logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTaskId, getRetrySequence().length);
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
- } else if (retryCount == 1) {
- externalTaskService.complete(externalTask, variables);
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
- mdcSetup.clearClientMDCs();
- } else {
- logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1,
- calculateRetryDelay(retryCount));
- }
- logger.debug("The External Task Id: {} Failed", externalTaskId);
- }
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
deleted file mode 100644
index ebef4425eb..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.onap.so.adapters.tasks.audit;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-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.logging.tasks.AuditMDCSetup;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AuditQueryStackService extends AbstractAuditService {
-
- private static final Logger logger = LoggerFactory.getLogger(AuditQueryStackService.class);
-
- @Autowired
- protected HeatStackAudit heatStackAudit;
-
- @Autowired
- protected AuditDataService auditDataService;
-
- @Autowired
- public AuditMDCSetup mdcSetup;
-
- public AuditQueryStackService() {
- super();
- }
-
- public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- mdcSetup.setupMDC(externalTask);
- AuditInventory auditInventory = externalTask.getVariable("auditInventory");
- boolean success = false;
- Map<String, Object> variables = new HashMap<>();
- try {
- Integer retryCount = externalTask.getRetries();
- logger.info("Executing External Task Query Audit Inventory. Audit Inventory: {} \n Retry Number: {}",
- auditInventory.toString(), retryCount);
-
- Optional<AAIObjectAuditList> auditList = heatStackAudit.queryHeatStack(auditInventory.getCloudOwner(),
- auditInventory.getCloudRegion(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
-
- if (auditList.isPresent()) {
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
- success = true;
- auditDataService.writeStackDataToRequestDb(auditInventory, auditList.get());
- }
- mdcSetup.setElapsedTime();
- String externalTaskId = externalTask.getId();
- if (success) {
- externalTaskService.complete(externalTask, variables);
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
- logger.debug("The External Task {} was Successful", externalTaskId);
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
- mdcSetup.clearClientMDCs();
- } else {
- if (retryCount == null) {
- logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}",
- externalTaskId, getRetrySequence().length);
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
- UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, getRetrySequence().length, 10000);
- } else if (retryCount == 1) {
- externalTaskService.complete(externalTask, variables);
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.debug("The External Task {} Failed. All Retries Exhausted", externalTaskId);
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
- mdcSetup.clearClientMDCs();
- } else {
- logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ",
- externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
- UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, retryCount - 1, calculateRetryDelay(retryCount));
- }
- logger.debug("The External Task {} Failed", externalTaskId);
- }
- } catch (Exception e) {
- logger.error("Error during audit query of stack", e);
- }
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
deleted file mode 100644
index 6f87b6b309..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
+++ /dev/null
@@ -1,173 +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.tasks.audit;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import org.onap.aai.domain.yang.LInterface;
-import org.onap.aai.domain.yang.VfModule;
-import org.onap.aai.domain.yang.VfModules;
-import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.objects.audit.AAIObjectAudit;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-@Component
-public class AuditVServer extends AbstractAudit {
- private static final Logger logger = LoggerFactory.getLogger(AuditVServer.class);
-
- public void auditVservers(AAIObjectAuditList aaiObjectAuditList) {
-
- aaiObjectAuditList.getAuditList().forEach(aaiObjectAudit -> {
- boolean vserverExist = getAaiClient().exists(
- AAIUriFactory.createResourceFromExistingURI(Types.VSERVER, aaiObjectAudit.getResourceURI()));
- aaiObjectAudit.setDoesObjectExist(vserverExist);
- });
- }
-
- public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
- AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModules())
- .queryParam("vf-module-name", vfModuleName);
- Optional<AAIResultWrapper> wrapper = getAaiClient().getFirstWrapper(VfModules.class, VfModule.class, uri);
- if (wrapper.isPresent() && wrapper.get().getRelationships().isPresent()) {
- List<AAIResourceUri> relatedVservers = wrapper.get().getRelationships().get().getRelatedUris(Types.VSERVER);
- if (!relatedVservers.isEmpty()) {
- relatedVservers.forEach(vserverUri -> {
- Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
- Vserver vServerShallow = new Vserver();
- BeanUtils.copyProperties(vserver, vServerShallow);
- AAIObjectAudit vServerAudit = new AAIObjectAudit();
- vServerAudit.setAaiObject(vServerShallow);
- vServerAudit.setAaiObjectType(Types.VSERVER.typeName());
- vServerAudit.setDoesObjectExist(true);
- auditList.getAuditList().add(vServerAudit);
- });
- }
- }
- return Optional.of(auditList);
- }
-
- public Optional<AAIObjectAuditList> auditVservers(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner,
- String cloudRegion) {
- if (vServersToAudit == null || vServersToAudit.isEmpty()) {
- return Optional.empty();
- }
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- vServersToAudit.stream().forEach(vserver -> {
- try {
- logger.debug("Vserver to Audit: {}", objectMapper.getMapper().writeValueAsString(vserver));
- } catch (JsonProcessingException e) {
- logger.error("Json parse exception: ", e);
- }
-
- });
- AAIObjectAuditList auditList = new AAIObjectAuditList();
- vServersToAudit.stream().forEach(vServer -> auditList.getAuditList()
- .addAll(doesVServerExistInAAI(vServer, tenantId, cloudOwner, cloudRegion).getAuditList()));
- return Optional.of(auditList);
- }
-
- private AAIObjectAuditList doesVServerExistInAAI(Vserver vServer, String tenantId, String cloudOwner,
- String cloudRegion) {
- AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIObjectAudit vServerAudit = new AAIObjectAudit();
- AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver(vServer.getVserverId()));
- Vserver vServerShallow = new Vserver();
- BeanUtils.copyProperties(vServer, vServerShallow, "LInterfaces");
- boolean vServerExists = getAaiClient().exists(vserverURI);
- logger.info("v-server {} exists: {}", vServer.getVserverId(), vServerExists);
- vServerAudit.setAaiObject(vServerShallow);
- vServerAudit.setDoesObjectExist(vServerExists);
- vServerAudit.setResourceURI(vserverURI.build());
- vServerAudit.setAaiObjectType(Types.VSERVER.typeName());
- auditList.getAuditList().add(vServerAudit);
- if (vServer.getLInterfaces() != null) {
- vServer.getLInterfaces().getLInterface().stream().forEach(lInterface -> auditList.getAuditList().addAll(
- doesLinterfaceExistinAAI(lInterface, vServer.getVserverId(), tenantId, cloudOwner, cloudRegion)
- .getAuditList()));
- }
- return auditList;
- }
-
- private AAIObjectAuditList doesLinterfaceExistinAAI(LInterface lInterface, String vServerId, String tenantId,
- String cloudOwner, String cloudRegion) {
- AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIObjectAudit lInterfaceAudit = new AAIObjectAudit();
- AAIResourceUri linterfaceURI = AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
- .tenant(tenantId).vserver(vServerId).lInterface(lInterface.getInterfaceName()));
- Optional<LInterface> queriedLInterface = getAaiClient().get(LInterface.class, linterfaceURI);
- if (queriedLInterface.isPresent()) {
- lInterfaceAudit.setDoesObjectExist(true);
- lInterface.setInterfaceName(lInterface.getInterfaceName());
- }
- lInterfaceAudit.setAaiObject(lInterface);
- lInterfaceAudit.setResourceURI(linterfaceURI.build());
- lInterfaceAudit.setAaiObjectType(Types.L_INTERFACE.typeName());
- auditList.getAuditList().add(lInterfaceAudit);
- logger.info("l-interface id:{} name: {} exists: {} ", lInterface.getInterfaceId(),
- lInterface.getInterfaceName(), lInterfaceAudit.isDoesObjectExist());
-
- if (lInterface.getLInterfaces() != null) {
- lInterface.getLInterfaces().getLInterface().stream()
- .forEach(subInterface -> auditList.getAuditList().add(doesSubInterfaceExistinAAI(subInterface,
- lInterface.getInterfaceName(), vServerId, tenantId, cloudOwner, cloudRegion)));
- }
- logger.debug("l-interface {} does not contain any sub-iterfaces, skipping audit of sub-interfaces",
- lInterface.getInterfaceId());
-
- return auditList;
- }
-
- private AAIObjectAudit doesSubInterfaceExistinAAI(LInterface subInterface, String linterfaceName, String vServerId,
- String tenantId, String cloudOwner, String cloudRegion) {
- logger.info("checking if sub-l-interface {} , linterfaceName: {} vserverId: {} exists",
- subInterface.getInterfaceName(), linterfaceName, vServerId);
- AAIObjectAudit subInterfaceAudit = new AAIObjectAudit();
-
-
- AAIResourceUri subInterfaceURI = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, vServerId, linterfaceName, subInterface.getInterfaceName());
- subInterfaceAudit.setResourceURI(subInterfaceURI.build());
- boolean doesExist = getAaiClient().exists(subInterfaceURI);
- logger.info("sub-l-interface-id:{} exists: {}", subInterface.getInterfaceId(), doesExist);
- subInterfaceAudit.setAaiObject(subInterface);
- subInterfaceAudit.setDoesObjectExist(doesExist);
- subInterfaceAudit.setAaiObjectType(AAIObjectType.SUB_L_INTERFACE.typeName());
- return subInterfaceAudit;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
deleted file mode 100644
index c58e568ea4..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- *
- * Modifications Copyright (C) 2019 IBM.
- * ================================================================================
- * 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.audit;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.onap.aai.domain.yang.LInterface;
-import org.onap.aai.domain.yang.LInterfaces;
-import org.onap.aai.domain.yang.Vlan;
-import org.onap.aai.domain.yang.Vlans;
-import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
-import org.onap.so.objects.audit.AAIObjectAudit;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.onap.so.openstack.utils.MsoHeatUtils;
-import org.onap.so.openstack.utils.MsoNeutronUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import com.woorea.openstack.heat.model.Link;
-import com.woorea.openstack.heat.model.Resource;
-import com.woorea.openstack.heat.model.Resources;
-import com.woorea.openstack.heat.model.Stack;
-import com.woorea.openstack.quantum.model.Port;
-
-@Component
-public class HeatStackAudit {
-
- private static final String RESOURCES = "/resources";
-
- protected static final Logger logger = LoggerFactory.getLogger(HeatStackAudit.class);
-
- private static final String EXCEPTION_MSG = "Error finding Path from Self Link";
-
- @Autowired
- protected MsoHeatUtils heat;
-
- @Autowired
- protected MsoNeutronUtils neutron;
-
- @Autowired
- protected AuditVServer auditVservers;
-
- public Optional<AAIObjectAuditList> queryHeatStack(String cloudOwner, String cloudRegion, String tenantId,
- String heatStackName) {
- try {
- logger.debug("Fetching Top Level Stack Information");
- Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName, 3);
- List<Resource> novaResources = resources.getList().stream()
- .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
- if (novaResources.isEmpty())
- return Optional.of(new AAIObjectAuditList());
- else {
- Set<Vserver> vserversToAudit = createVserverSet(novaResources);
- AAIObjectAuditList aaiObjectAuditList = new AAIObjectAuditList();
- vserversToAudit.stream().forEach(vServer -> aaiObjectAuditList.getAuditList()
- .add(createAAIObjectAudit(cloudOwner, cloudRegion, tenantId, vServer)));
- return Optional.of(aaiObjectAuditList);
- }
- } catch (Exception e) {
- logger.error("Error during query stack resources", e);
- return Optional.of(new AAIObjectAuditList());
- }
- }
-
- public Optional<AAIObjectAuditList> auditHeatStack(String cloudRegion, String cloudOwner, String tenantId,
- String heatStackName) {
- try {
- logger.debug("Fetching Top Level Stack Information");
- Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName, 3);
- List<Resource> novaResources = resources.getList().stream()
- .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
- List<Resource> resourceGroups = resources.getList().stream()
- .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType()) && p.getName().contains("subinterfaces"))
- .collect(Collectors.toList());
- List<Optional<Port>> neutronPortDetails = retrieveNeutronPortDetails(resources, cloudRegion, tenantId);
- if (novaResources.isEmpty())
- return Optional.of(new AAIObjectAuditList());
- else {
- Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources, neutronPortDetails);
- Set<Vserver> vserversWithSubInterfaces =
- processSubInterfaces(cloudRegion, tenantId, resourceGroups, vserversToAudit);
- return auditVservers.auditVservers(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion);
- }
- } catch (Exception e) {
- logger.error("Error during auditing stack resources", e);
- return Optional.empty();
- }
- }
-
- protected Set<Vserver> processSubInterfaces(String cloudRegion, String tenantId, List<Resource> resourceGroups,
- Set<Vserver> vServersToAudit) throws Exception {
- for (Resource resourceGroup : resourceGroups) {
- processResourceGroups(cloudRegion, tenantId, vServersToAudit, resourceGroup);
- }
- return vServersToAudit;
- }
-
- protected void processResourceGroups(String cloudRegion, String tenantId, Set<Vserver> vServersWithLInterface,
- Resource resourceGroup) throws Exception {
- Optional<Link> stackLink =
- resourceGroup.getLinks().stream().filter(link -> "nested".equals(link.getRel())).findAny();
- if (stackLink.isPresent()) {
- try {
- Optional<String> path = extractResourcePathFromHref(stackLink.get().getHref());
- if (path.isPresent()) {
- logger.debug("Fetching nested Resource Stack Information");
- Resources nestedResourceGroupResources =
- heat.executeHeatClientRequest(path.get(), cloudRegion, tenantId, Resources.class);
- processNestedResourceGroup(cloudRegion, tenantId, vServersWithLInterface,
- nestedResourceGroupResources);
- } else
- throw new Exception(EXCEPTION_MSG);
- } catch (Exception e) {
- logger.error("Error Parsing Link to obtain Path", e);
- throw new Exception(EXCEPTION_MSG);
- }
- }
- }
-
- protected void processNestedResourceGroup(String cloudRegion, String tenantId, Set<Vserver> vServersWithLInterface,
- Resources nestedResourceGroupResources) throws Exception {
- for (Resource resourceGroupNested : nestedResourceGroupResources) {
- Optional<Link> subInterfaceStackLink =
- resourceGroupNested.getLinks().stream().filter(link -> "nested".equals(link.getRel())).findAny();
- if (subInterfaceStackLink.isPresent()) {
- addSubInterface(cloudRegion, tenantId, vServersWithLInterface, subInterfaceStackLink.get());
- }
- }
- }
-
- protected void addSubInterface(String cloudRegion, String tenantId, Set<Vserver> vServersWithLInterface,
- Link subInterfaceStackLink) throws Exception {
- Optional<String> resourcePath = extractResourcePathFromHref(subInterfaceStackLink.getHref());
- Optional<String> stackPath = extractStackPathFromHref(subInterfaceStackLink.getHref());
- if (resourcePath.isPresent() && stackPath.isPresent()) {
- logger.debug("Fetching nested Sub-Interface Stack Information");
- Stack subinterfaceStack =
- heat.executeHeatClientRequest(stackPath.get(), cloudRegion, tenantId, Stack.class);
- Resources subinterfaceResources =
- heat.executeHeatClientRequest(resourcePath.get(), cloudRegion, tenantId, Resources.class);
- if (subinterfaceStack != null) {
- addSubInterfaceToVserver(vServersWithLInterface, subinterfaceStack, subinterfaceResources);
- }
- } else
- throw new Exception(EXCEPTION_MSG);
-
- }
-
- protected void addSubInterfaceToVserver(Set<Vserver> vServersWithLInterface, Stack subinterfaceStack,
- Resources subinterfaceResources) throws Exception {
- String parentNeutronPortId = (String) subinterfaceStack.getParameters().get("port_interface");
- logger.debug("Parent neutron Port: {} on SubInterface: {}", parentNeutronPortId, subinterfaceStack.getId());
- for (Vserver auditVserver : vServersWithLInterface)
- for (LInterface lInterface : auditVserver.getLInterfaces().getLInterface())
-
- if (parentNeutronPortId.equals(lInterface.getInterfaceId())) {
- logger.debug("Found Parent Port on VServer: {} on Port: {}", auditVserver.getVserverId(),
- lInterface.getInterfaceId());
- Resource contrailVm = subinterfaceResources.getList().stream()
- .filter(resource -> "OS::ContrailV2::VirtualMachineInterface".equals(resource.getType()))
- .findAny().orElse(null);
- if (contrailVm == null) {
- throw new Exception("Cannnot find Contrail Virtual Machine Interface on Stack: "
- + subinterfaceStack.getId());
- }
- LInterface subInterface = new LInterface();
- subInterface.setInterfaceId(contrailVm.getPhysicalResourceId());
- subInterface.setIsPortMirrored(false);
- subInterface.setInMaint(false);
- subInterface.setIsIpUnnumbered(false);
- String macAddr = (String) subinterfaceStack.getParameters().get("mac_address");
- subInterface.setMacaddr(macAddr);
-
- String namePrefix = (String) subinterfaceStack.getParameters().get("subinterface_name_prefix");
- Integer vlanIndex = Integer.parseInt((String) subinterfaceStack.getParameters().get("counter"));
- String vlanTagList = (String) subinterfaceStack.getParameters().get("vlan_tag");
- List<String> subInterfaceVlanTagList = Arrays.asList(vlanTagList.split(","));
- subInterface.setInterfaceName(namePrefix + "_" + subInterfaceVlanTagList.get(vlanIndex));
- subInterface.setVlans(new Vlans());
- Vlan vlan = new Vlan();
- vlan.setInMaint(false);
- vlan.setIsIpUnnumbered(false);
- vlan.setVlanIdInner(Long.parseLong(subInterfaceVlanTagList.get(vlanIndex)));
- vlan.setVlanInterface(namePrefix + "_" + subInterfaceVlanTagList.get(vlanIndex));
- subInterface.getVlans().getVlan().add(vlan);
- if (lInterface.getLInterfaces() == null)
- lInterface.setLInterfaces(new LInterfaces());
-
- lInterface.getLInterfaces().getLInterface().add(subInterface);
- } else
- logger.debug("Did Not Find Parent Port on VServer: {} Parent Port: SubInterface: {}",
- auditVserver.getVserverId(), lInterface.getInterfaceId(), subinterfaceStack.getId());
- }
-
- protected Set<Vserver> createVserverSet(Resources resources, List<Resource> novaResources,
- List<Optional<Port>> neutronPortDetails) {
- Set<Vserver> vserversToAudit = new HashSet<>();
- for (Resource novaResource : novaResources) {
- Vserver auditVserver = new Vserver();
- auditVserver.setLInterfaces(new LInterfaces());
- auditVserver.setVserverId(novaResource.getPhysicalResourceId());
- Stream<Port> filteredNeutronPorts = filterNeutronPorts(novaResource, neutronPortDetails);
- filteredNeutronPorts.forEach(port -> {
- LInterface lInterface = new LInterface();
- lInterface.setInterfaceId(port.getId());
- lInterface.setInterfaceName(port.getName());
- auditVserver.getLInterfaces().getLInterface().add(lInterface);
- });
- vserversToAudit.add(auditVserver);
- }
- return vserversToAudit;
- }
-
- protected Set<Vserver> createVserverSet(List<Resource> novaResources) {
- Set<Vserver> vserversToAudit = new HashSet<>();
- for (Resource novaResource : novaResources) {
- Vserver auditVserver = new Vserver();
- auditVserver.setLInterfaces(new LInterfaces());
- auditVserver.setVserverId(novaResource.getPhysicalResourceId());
- vserversToAudit.add(auditVserver);
- }
- return vserversToAudit;
- }
-
- protected AAIObjectAudit createAAIObjectAudit(String cloudOwner, String cloudRegion, String tenantId,
- Vserver vServer) {
- AAIObjectAudit aaiObjectAudit = new AAIObjectAudit();
- Vserver vServerShallow = new Vserver();
- BeanUtils.copyProperties(vServer, vServerShallow);
- aaiObjectAudit.setAaiObject(vServerShallow);
- aaiObjectAudit.setAaiObjectType(Types.VSERVER.typeName());
- aaiObjectAudit
- .setResourceURI(AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver(vServer.getVserverId()))
- .build());
-
- return aaiObjectAudit;
- }
-
- /**
- * @param novaResource Single openstack resource that is of type Nova
- * @param neutronPorts List of Neutron ports created within the stack
- * @return Filtered list of neutron ports taht relate to the nova server in openstack
- */
- protected Stream<Port> filterNeutronPorts(Resource novaResource, List<Optional<Port>> neutronPorts) {
- List<Port> filteredNeutronPorts =
- neutronPorts.stream().filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
- return filteredNeutronPorts.stream()
- .filter(port -> port.getDeviceId().equalsIgnoreCase(novaResource.getPhysicalResourceId()));
- }
-
- /**
- * @param resources Resource stream created by the stack in openstack
- * @param cloudSiteId Unique site id to identify which openstack we talk to
- * @param tenantId The tenant within the cloud we are talking to where resouces exist
- * @return List of optional neutron ports found within the cloud site and tenant
- */
- protected List<Optional<Port>> retrieveNeutronPortDetails(Resources resources, String cloudSiteId,
- String tenantId) {
- return resources.getList().stream().filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
- .map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(), tenantId, cloudSiteId))
- .collect(Collectors.toList());
-
- }
-
- protected Optional<String> extractResourcePathFromHref(String href) {
- try {
- Optional<String> stackPath = extractStackPathFromHref(href);
- if (stackPath.isPresent()) {
- return Optional.of(stackPath.get() + RESOURCES);
- } else
- return Optional.empty();
- } catch (Exception e) {
- logger.error("Error parsing URI", e);
- }
- return Optional.empty();
- }
-
- protected Optional<String> extractStackPathFromHref(String href) {
- try {
- URI uri = new URI(href);
- Pattern p = Pattern.compile("/stacks.*");
- Matcher m = p.matcher(uri.getPath());
- if (m.find()) {
- return Optional.of(m.group());
- } else
- return Optional.empty();
- } catch (Exception e) {
- logger.error("Error parsing URI", e);
- }
- return Optional.empty();
- }
-
-
-}
-
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index 3f79c43bf8..a6194517c2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -29,6 +29,7 @@ import org.onap.so.cloud.resource.beans.CloudInformation;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.heatbridge.HeatBridgeApi;
+import org.onap.so.heatbridge.HeatBridgeException;
import org.onap.so.heatbridge.HeatBridgeImpl;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.openstack4j.model.compute.Flavor;
@@ -55,75 +56,70 @@ public class CreateAAIInventory {
@Autowired
protected Environment env;
- public void heatbridge(CloudInformation cloudInformation) {
- try {
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
- .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- String heatStackId = cloudInformation.getTemplateInstanceId().split("/")[1];
-
- List<String> oobMgtNetNames = new ArrayList<>();
-
- HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
- cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
- cloudInformation.getTenantId(), cloudInformation.getNodeType());
-
- heatBridgeClient.authenticate();
-
- List<Resource> stackResources =
- heatBridgeClient.queryNestedHeatStackResources(cloudInformation.getTemplateInstanceId());
-
- List<Network> osNetworks = heatBridgeClient.getAllOpenstackProviderNetworks(stackResources);
- heatBridgeClient.buildAddNetworksToAaiAction(cloudInformation.getVnfId(), cloudInformation.getVfModuleId(),
- osNetworks);
-
- List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
-
- heatBridgeClient.createPserversAndPinterfacesIfNotPresentInAai(stackResources);
-
- List<Image> osImages = heatBridgeClient.extractOpenstackImagesFromServers(osServers);
-
- List<Flavor> osFlavors = heatBridgeClient.extractOpenstackFlavorsFromServers(osServers);
-
- logger.debug("Successfully queried heat stack{} for resources.", heatStackId);
- // os images
- if (osImages != null && !osImages.isEmpty()) {
- heatBridgeClient.buildAddImagesToAaiAction(osImages);
- logger.debug("Successfully built AAI actions to add images.");
- } else {
- logger.debug("No images to update to AAI.");
- }
- // flavors
- if (osFlavors != null && !osFlavors.isEmpty()) {
- heatBridgeClient.buildAddFlavorsToAaiAction(osFlavors);
- logger.debug("Successfully built AAI actions to add flavors.");
- } else {
- logger.debug("No flavors to update to AAI.");
- }
-
- // compute resources
- heatBridgeClient.buildAddVserversToAaiAction(cloudInformation.getVnfId(), cloudInformation.getVfModuleId(),
- osServers);
- logger.debug("Successfully queried compute resources and built AAI vserver actions.");
-
- // neutron resources
- List<String> oobMgtNetIds = new ArrayList<>();
-
- // if no network-id list is provided, however network-name list is
- if (!CollectionUtils.isEmpty(oobMgtNetNames)) {
- oobMgtNetIds = heatBridgeClient.extractNetworkIds(oobMgtNetNames);
- }
- heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds,
- cloudInformation.getOwner());
- logger.debug(
- "Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
-
- // Update AAI
- logger.debug("Current Dry Run Value: {}", env.getProperty("heatBridgeDryrun", Boolean.class, false));
- heatBridgeClient.submitToAai(env.getProperty("heatBridgeDryrun", Boolean.class, false));
- } catch (Exception ex) {
- logger.debug("Heatbrige failed for stackId: " + cloudInformation.getTemplateInstanceId(), ex);
+ public void heatbridge(CloudInformation cloudInformation) throws HeatBridgeException, MsoCloudSiteNotFound {
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
+ .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+ String heatStackId = cloudInformation.getTemplateInstanceId().split("/")[1];
+
+ List<String> oobMgtNetNames = new ArrayList<>();
+
+ HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
+ cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
+ cloudInformation.getTenantId(), cloudInformation.getNodeType());
+
+ heatBridgeClient.authenticate();
+
+ List<Resource> stackResources =
+ heatBridgeClient.queryNestedHeatStackResources(cloudInformation.getTemplateInstanceId());
+
+ List<Network> osNetworks = heatBridgeClient.getAllOpenstackProviderNetworks(stackResources);
+ heatBridgeClient.buildAddNetworksToAaiAction(cloudInformation.getVnfId(), cloudInformation.getVfModuleId(),
+ osNetworks);
+
+ List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
+
+ heatBridgeClient.createPserversAndPinterfacesIfNotPresentInAai(stackResources);
+
+ List<Image> osImages = heatBridgeClient.extractOpenstackImagesFromServers(osServers);
+
+ List<Flavor> osFlavors = heatBridgeClient.extractOpenstackFlavorsFromServers(osServers);
+
+ logger.debug("Successfully queried heat stack{} for resources.", heatStackId);
+ // os images
+ if (osImages != null && !osImages.isEmpty()) {
+ heatBridgeClient.buildAddImagesToAaiAction(osImages);
+ logger.debug("Successfully built AAI actions to add images.");
+ } else {
+ logger.debug("No images to update to AAI.");
+ }
+ // flavors
+ if (osFlavors != null && !osFlavors.isEmpty()) {
+ heatBridgeClient.buildAddFlavorsToAaiAction(osFlavors);
+ logger.debug("Successfully built AAI actions to add flavors.");
+ } else {
+ logger.debug("No flavors to update to AAI.");
+ }
+
+ // compute resources
+ heatBridgeClient.buildAddVserversToAaiAction(cloudInformation.getVnfId(), cloudInformation.getVfModuleId(),
+ osServers);
+ logger.debug("Successfully queried compute resources and built AAI vserver actions.");
+
+ // neutron resources
+ List<String> oobMgtNetIds = new ArrayList<>();
+
+ // if no network-id list is provided, however network-name list is
+ if (!CollectionUtils.isEmpty(oobMgtNetNames)) {
+ oobMgtNetIds = heatBridgeClient.extractNetworkIds(oobMgtNetNames);
}
+ heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds,
+ cloudInformation.getOwner());
+ logger.debug("Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
+
+ // Update AAI
+ logger.debug("Current Dry Run Value: {}", env.getProperty("heatBridgeDryrun", Boolean.class, false));
+ heatBridgeClient.submitToAai(env.getProperty("heatBridgeDryrun", Boolean.class, false));
}
protected AAIResourcesClient getAaiClient() {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
index 2202e97e71..3c9a4833ae 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
@@ -57,7 +57,6 @@ public class CreateInventoryTask extends ExternalTaskUtils {
public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
- boolean inventoryException = false;
String externalTaskId = externalTask.getId();
CloudInformation cloudInformation = externalTask.getVariable("cloudInformation");
boolean success = true;
@@ -75,30 +74,29 @@ public class CreateInventoryTask extends ExternalTaskUtils {
if (success) {
externalTaskService.complete(externalTask);
mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
- logger.debug("The External Task Id: {} Successful", externalTaskId);
+ logger.debug("The External Task {} was successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
mdcSetup.clearClientMDCs();
} else {
if (retryCount == null) {
- logger.error("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
+ logger.error("The External Task {} Failed, Setting Retries to Default Start Value: {}",
externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
} else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.error("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
+ logger.error("The External Task {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
- logger.error("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
+ logger.error("The External Task {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, retryCount - 1, calculateRetryDelay(retryCount));
}
- logger.error("The External Task Id: {} Failed", externalTaskId);
}
} else {
- logger.error("The External Task Id: {} Failed, No Cloud Information Provided", externalTaskId);
+ logger.error("The External Task {} Failed, No Cloud Information Provided", externalTaskId);
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteAAIInventory.java
index 22e6b1fc22..f5a6355529 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteAAIInventory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.delete;
+package org.onap.so.adapters.tasks.inventory;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.so.cloud.CloudConfig;
@@ -26,6 +26,7 @@ import org.onap.so.cloud.resource.beans.CloudInformation;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.heatbridge.HeatBridgeApi;
+import org.onap.so.heatbridge.HeatBridgeException;
import org.onap.so.heatbridge.HeatBridgeImpl;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.slf4j.Logger;
@@ -47,22 +48,16 @@ public class DeleteAAIInventory {
@Autowired
protected Environment env;
- public void heatbridge(CloudInformation cloudInformation) {
- try {
- logger.debug("Heatbridge delete executing");
-
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
- .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
- cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
- cloudInformation.getTenantId(), cloudInformation.getNodeType());
- heatBridgeClient.authenticate();
- heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId());
-
- } catch (Exception ex) {
- logger.debug("Heatbrige failed for stackId: " + cloudInformation.getTemplateInstanceId(), ex);
- }
+ public void heatbridge(CloudInformation cloudInformation) throws MsoCloudSiteNotFound, HeatBridgeException {
+ logger.debug("Heatbridge delete executing");
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
+ .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+ HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
+ cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
+ cloudInformation.getTenantId(), cloudInformation.getNodeType());
+ heatBridgeClient.authenticate();
+ heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId());
}
protected AAIResourcesClient getAaiClient() {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteInventoryTask.java
index 10faa2b08f..08361bdbbf 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/DeleteInventoryTask.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.delete;
+package org.onap.so.adapters.tasks.inventory;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
@@ -32,7 +32,6 @@ import org.onap.so.utils.RetrySequenceLevel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -49,16 +48,13 @@ public class DeleteInventoryTask extends ExternalTaskUtils {
private DeleteAAIInventory deleteInventory;
@Autowired
- private Environment env;
-
- @Autowired
private AuditMDCSetup mdcSetup;
public DeleteInventoryTask() {
super(RetrySequenceLevel.SHORT);
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
String externalTaskId = externalTask.getId();
CloudInformation cloudInformation = externalTask.getVariable("cloudInformation");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 45b29244d1..c8cb8d9731 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -324,10 +324,28 @@ public class HeatBridgeImpl implements HeatBridgeApi {
// Build vserver relationships to: image, flavor, pserver, vf-module
vserver.setRelationshipList(
aaiHelper.getVserverRelationshipList(cloudOwner, cloudRegionId, genericVnfId, vfModuleId, server));
- transaction.createIfNotExists(
- AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(vserver.getVserverId())),
- Optional.of(vserver));
+ AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(vserver.getVserverId()));
+ if (resourcesClient.exists(vserverUri)) {
+ AAIResultWrapper existingVserver = resourcesClient.get(vserverUri);
+ if (!existingVserver.hasRelationshipsTo(Types.VNFC)) {
+ AAIResourceUri vnfcUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(server.getName()));
+ transaction.connect(vserverUri, vnfcUri);
+ }
+ if (!existingVserver.hasRelationshipsTo(Types.VF_MODULE)) {
+ AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModule(vfModuleId));
+ transaction.connect(vserverUri, vfModuleUri);
+ }
+ if (!existingVserver.hasRelationshipsTo(Types.PSERVER)) {
+ AAIResourceUri pServerUri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.cloudInfrastructure().pserver(server.getHypervisorHostname()));
+ transaction.connect(vserverUri, pServerUri);
+ }
+ } else {
+ transaction.create(vserverUri, vserver);
+ }
});
}
@@ -380,10 +398,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
Server server = getOpenstackServerById(port.getDeviceId());
- updateLInterfaceVlan(port, lIf, server.getHypervisorHostname());
+ createVlanAndSriovVF(port, lIf, server.getHypervisorHostname());
+ updateSriovPfToSriovVF(port, lIf);
}
-
- updateSriovPfToPserver(port, lIf);
}
}
@@ -464,7 +481,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
resourcesClient.createIfNotExists(uri, Optional.of(pInterface));
}
- protected void updateLInterfaceVlan(final Port port, final LInterface lIf, final String hostName)
+ protected void createVlanAndSriovVF(final Port port, final LInterface lIf, final String hostName)
throws HeatBridgeException {
// add back all vlan logic
Vlan vlan = new Vlan();
@@ -582,7 +599,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
* @param lIf AAI l-interface object
* @throws HeatBridgeException
*/
- protected void updateSriovPfToPserver(final Port port, final LInterface lIf) throws HeatBridgeException {
+ protected void updateSriovPfToSriovVF(final Port port, final LInterface lIf) throws HeatBridgeException {
if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
AAIResourceUri sriovVfUri = AAIUriFactory
@@ -606,7 +623,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
DSLQueryBuilder<Start, Node> builder = TraversalBuilder
.fragment(new DSLStartNode(Types.PSERVER, __.key("hostname", pserverHostName)))
.to(__.node(Types.P_INTERFACE)
- .to(__.node(Types.SRIOV_PF, __.key("pf-pci-id", pfPciId)).output()));
+ .to(__.node(Types.SRIOV_PF,
+ __.key(HeatBridgeConstants.OS_PF_PCI_SLOT_KEY.toString(), pfPciId))
+ .output()));
List<Pathed> results = getAAIDSLClient().queryPathed(new DSLQuery(builder.build()));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java
deleted file mode 100644
index c70e60e9d3..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.onap.so.adapters.tasks.audit;
-
-import org.junit.Test;
-import org.onap.so.objects.audit.AAIObjectAudit;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class AbstractAuditServiceTest extends AbstractAuditService {
-
- private AAIObjectAuditList getAuditListWithObjectWithExistenceStateOf(boolean existenceState) {
- AAIObjectAudit auditObject = new AAIObjectAudit();
- AAIObjectAuditList auditList = new AAIObjectAuditList();
-
- auditObject.setDoesObjectExist(existenceState);
- auditList.getAuditList().add(auditObject);
-
- return auditList;
- }
-
- @Test
- public void didCreateAuditFail_shouldReturnFalse_whenGivenNull() {
- assertFalse(didCreateAuditFail(null));
- }
-
- @Test
- public void didCreateAuditFail_shouldReturnTrue_whenGivenNotExistingObject() {
- assertTrue(didCreateAuditFail(getAuditListWithObjectWithExistenceStateOf(false)));
- }
-
- @Test
- public void didCreateAuditFail_shouldReturnFalse_whenGivenExistingObject() {
- assertFalse(didCreateAuditFail(getAuditListWithObjectWithExistenceStateOf(true)));
- }
-
- @Test
- public void didDeleteAuditFail_shouldReturnFalse_whenGivenNull() {
- assertFalse(didDeleteAuditFail(null));
- }
-
- @Test
- public void didDeleteAuditFail_shouldReturnTrue_whenGivenExistingObject() {
- assertTrue(didDeleteAuditFail(getAuditListWithObjectWithExistenceStateOf(true)));
- }
-
- @Test
- public void didDeleteAuditFail_shouldReturnFalse_whenGivenNotExistingObject() {
- assertFalse(didDeleteAuditFail(getAuditListWithObjectWithExistenceStateOf(false)));
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
deleted file mode 100644
index 76e5bbc47f..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.onap.so.adapters.tasks.audit;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import org.junit.Before;
-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.aai.domain.yang.Vserver;
-import org.onap.so.audit.beans.AuditInventory;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.db.request.beans.RequestProcessingData;
-import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.objects.audit.AAIObjectAudit;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-
-@RunWith(MockitoJUnitRunner.Silent.class)
-public class AuditDataServiceTest {
-
- @InjectMocks
- AuditDataService auditDataService = new AuditDataService();
-
- @Mock
- protected RequestsDbClient requestsDbClient;
-
- AuditInventory auditInventory = new AuditInventory();
-
- @Before
- public void before() throws JsonProcessingException {
- auditInventory.setCloudOwner("testCloudOwner");
- auditInventory.setCloudRegion("testLcpCloudRegionId");
- auditInventory.setHeatStackName("testVfModuleName1");
- auditInventory.setVfModuleId("testVnfModuleId");
- auditInventory.setTenantId("testTenantId");
- auditInventory.setGenericVnfId("testVnfId1");
- }
-
- @Test
- public void testWriteStackDataToRequestDb() throws Exception {
- Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient)
- .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any());
- Mockito.doNothing().when(requestsDbClient).saveRequestProcessingData(Mockito.any());
-
- AAIObjectAuditList auditList = new AAIObjectAuditList();
- auditList.setHeatStackName("testHeatStackName");
- AAIObjectAudit audit = new AAIObjectAudit();
- Vserver vserver = new Vserver();
- vserver.setVserverId("testVserverId");
- audit.setAaiObject(vserver);
- auditList.getAuditList().add(audit);
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- String auditListString = objectMapper.getMapper().writeValueAsString(auditList);
-
- RequestProcessingData requestProcessingData = new RequestProcessingData();
- requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
- requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
- requestProcessingData.setName(auditInventory.getHeatStackName());
- requestProcessingData.setTag("AuditStackData");
- requestProcessingData.setValue(auditListString);
-
- auditDataService.writeStackDataToRequestDb(auditInventory, auditList);
- Mockito.verify(requestsDbClient, Mockito.times(1)).saveRequestProcessingData(requestProcessingData);
- }
-
- @Test
- public void testGetStackDataToRequestDb() throws Exception {
- AAIObjectAuditList auditList = new AAIObjectAuditList();
- auditList.setHeatStackName("testHeatStackName");
- AAIObjectAudit audit = new AAIObjectAudit();
- Vserver vserver = new Vserver();
- vserver.setVserverId("testVserverId");
- audit.setAaiObject(vserver);
- auditList.getAuditList().add(audit);
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- String auditListString = objectMapper.getMapper().writeValueAsString(audit);
-
- List<RequestProcessingData> list = new ArrayList();
- RequestProcessingData requestProcessingData = new RequestProcessingData();
- requestProcessingData.setId(234321432);
- requestProcessingData.setGroupingId("testVfModuleId");
- requestProcessingData.setName("heatStackName");
- requestProcessingData.setTag("AuditStackData");
- requestProcessingData.setValue(auditListString);
- list.add(requestProcessingData);
-
- Mockito.doReturn(list).when(requestsDbClient).getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(),
- Mockito.any(), Mockito.any());
- auditDataService.getStackDataFromRequestDb(auditInventory);
- Mockito.verify(requestsDbClient, Mockito.times(1)).getRequestProcessingDataByGroupingIdAndNameAndTag(
- "testVnfModuleId", "testVfModuleName1", "AuditStackData");
- }
-
- @Test
- public void testGetStackDataToRequestDbWhenRequestProcessingDataListIsEmpty() throws Exception {
-
- Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient)
- .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any());
- Optional<AAIObjectAuditList> result = auditDataService.getStackDataFromRequestDb(auditInventory);
- Mockito.verify(requestsDbClient, Mockito.times(1)).getRequestProcessingDataByGroupingIdAndNameAndTag(
- "testVnfModuleId", "testVfModuleName1", "AuditStackData");
- assertThat(result).isEmpty();
-
- }
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
deleted file mode 100644
index 78dbcd94c2..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017-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.audit;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.doReturn;
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Optional;
-import org.camunda.bpm.client.task.ExternalTask;
-import org.camunda.bpm.client.task.ExternalTaskService;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-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.logging.tasks.AuditMDCSetup;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.springframework.core.env.Environment;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class AuditStackServiceDataTest extends AuditCreateStackService {
-
- @InjectMocks
- private AuditCreateStackService auditStackService = new AuditCreateStackService();
-
- @InjectMocks
- private AuditQueryStackService auditQueryStackService = new AuditQueryStackService();
-
- @Mock
- private HeatStackAudit heatStackAuditMock;
-
- @Mock
- private Environment mockEnv;
-
- @Mock
- private ExternalTask mockExternalTask;
-
- @Mock
- private ExternalTaskService mockExternalTaskService;
-
- @Mock
- private AuditDataService auditDataService;
-
- @Mock
- private AuditMDCSetup mdcSetup;
-
- private ObjectMapper objectMapper = new ObjectMapper();
-
- private AuditInventory auditInventory = new AuditInventory();
-
- Optional<AAIObjectAuditList> auditListOptSuccess;
-
- Optional<AAIObjectAuditList> auditListOptFailure;
-
- @Before
- public void setup() throws JsonParseException, JsonMappingException, IOException {
- auditInventory.setCloudOwner("cloudOwner");
- auditInventory.setCloudRegion("cloudRegion");
- auditInventory.setTenantId("tenantId");
- auditInventory.setHeatStackName("stackName");
- MockitoAnnotations.initMocks(this);
-
- AAIObjectAuditList auditListSuccess = objectMapper
- .readValue(new File("src/test/resources/ExpectedVServerFound.json"), AAIObjectAuditList.class);
- auditListOptSuccess = Optional.of(auditListSuccess);
-
- AAIObjectAuditList auditListFailure = objectMapper.readValue(
- new File("src/test/resources/Vserver2_Found_VServer1_Not_Found.json"), AAIObjectAuditList.class);
- auditListOptFailure = Optional.of(auditListFailure);
- String[] retrySequence = new String[8];
- retrySequence[0] = "1";
- retrySequence[1] = "1";
- retrySequence[2] = "2";
- retrySequence[3] = "3";
- retrySequence[4] = "5";
- retrySequence[5] = "8";
- retrySequence[6] = "13";
- retrySequence[7] = "20";
- doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory");
- doReturn("6000").when(mockEnv).getProperty("mso.workflow.topics.retryMultiplier", "6000");
- doReturn(retrySequence).when(mockEnv).getProperty("mso.workflow.topics.retrySequence", String[].class);
- doReturn("aasdfasdf").when(mockExternalTask).getId();
- }
-
- @Test
- public void execute_external_task_audit_success_Test() {
- doReturn(auditListOptSuccess).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId",
- "stackName");
- auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
- ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
- ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class);
- Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture());
- Map actualMap = captor.getValue();
- assertEquals(true, actualMap.get("auditIsSuccessful"));
- assertNotNull(actualMap.get("auditInventoryResult"));
- }
-
- @Test
- public void executeExternalTaskQueryAuditTest() throws JsonProcessingException {
- doReturn(auditListOptSuccess).when(heatStackAuditMock).queryHeatStack("cloudOwner", "cloudRegion", "tenantId",
- "stackName");
- Mockito.doNothing().when(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class),
- Mockito.any(AAIObjectAuditList.class));
- auditQueryStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
- ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
- ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class);
- Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture());
- Mockito.verify(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class),
- Mockito.any(AAIObjectAuditList.class));
- }
-
- @Test
- public void execute_external_task_audit_first_failure_Test() {
- doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId",
- "stackName");
- doReturn(null).when(mockExternalTask).getRetries();
- auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
- Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask,
- "Unable to find all VServers and L-Interaces in A&AI",
- "Unable to find all VServers and L-Interaces in A&AI", 8, 10000L);
- }
-
- @Test
- public void execute_external_task_audit_intermediate_failure_Test() {
- doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId",
- "stackName");
- doReturn(6).when(mockExternalTask).getRetries();
- auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
- Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask,
- "Unable to find all VServers and L-Interaces in A&AI",
- "Unable to find all VServers and L-Interaces in A&AI", 5, 12000L);
-
- }
-
- @Test
- public void execute_external_task_audit_final_failure_Test() {
- doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId",
- "stackName");
- doReturn(1).when(mockExternalTask).getRetries();
- auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
- ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
- ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class);
- Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture());
- Map actualMap = captor.getValue();
- assertEquals(false, actualMap.get("auditIsSuccessful"));
- assertNotNull(actualMap.get("auditInventoryResult"));
- }
-
- @Test
- public void determineAuditResult_Test() throws Exception {
- boolean actual = auditStackService.didCreateAuditFail(auditListOptSuccess.get());
- assertEquals(false, actual);
- }
-
- @Test
- public void determineAuditResult_Failure_Test() throws Exception {
- boolean actual = auditStackService.didCreateAuditFail(auditListOptFailure.get());
- assertEquals(true, actual);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
deleted file mode 100644
index 2e496c50cd..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017-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 perservice2sions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.tasks.audit;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.HashSet;
-import java.util.Optional;
-import java.util.Set;
-import org.junit.Assert;
-import org.junit.Before;
-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.aai.domain.yang.LInterface;
-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.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
-import org.onap.so.objects.audit.AAIObjectAudit;
-import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.skyscreamer.jsonassert.JSONAssert;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@RunWith(MockitoJUnitRunner.Silent.class)
-public class AuditVServerTest extends AuditVServer {
-
- private ObjectMapper objectMapper = new ObjectMapper();
-
- @InjectMocks
- private AuditVServer auditNova = new AuditVServer();
-
- @Mock
- private AAIResourcesClient aaiResourcesMock;
-
- private String cloudOwner = "cloudOwner";
- private String cloudRegion = "cloudRegion";
- private String tenantId = "tenantId";
-
- private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db"));
-
- private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"));
-
- private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
- .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_trusted_port_0"));
-
- private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
- .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service1_port_0"));
-
- private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
- .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_1"));
-
- private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
- .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_0"));
-
- private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
- .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service2_port_0"));
-
- private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
- .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_int_ha_port_0"));
-
- private AAIResourceUri test_port_1_uri = AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
- .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_1"));
-
- private AAIResourceUri test_port_2_uri = AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
- .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_2"));
-
- private AAIResourceUri service2_sub_1_uri =
- AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId,
- "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service2_port_0", "service2_sub_interface_1");
-
- private AAIResourceUri service1_sub_0_uri =
- AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId,
- "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0", "service1_sub_interface_1");
-
- private AAIResourceUri service1_sub_1_uri =
- AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId,
- "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0", "service1_sub_interface_2");
-
-
-
- private Set<Vserver> vserversToAudit = new HashSet<>();
-
- LInterface test_port_1 = new LInterface();
- LInterface test_port_2 = new LInterface();
- LInterface ssc_1_int_ha_port_0 = new LInterface();
- LInterface service2_sub_interface_1 = new LInterface();
- LInterface ssc_1_service2_port_0 = new LInterface();
- LInterface ssc_1_mgmt_port_0 = new LInterface();
- LInterface ssc_1_mgmt_port_1 = new LInterface();
- LInterface service1_sub_interface_2 = new LInterface();
- LInterface service1_sub_interface_1 = new LInterface();
- LInterface ssc_1_service1_port_0 = new LInterface();
- LInterface ssc_1_trusted_port_0 = new LInterface();
-
-
-
- @Before
- public void setup() {
- objectMapper.setSerializationInclusion(Include.NON_NULL);
- auditNova.setAaiClient(aaiResourcesMock);
-
- Vserver vServer1 = new Vserver();
- vServer1.setVserverId("3a4c2ca5-27b3-4ecc-98c5-06804867c4db");
- LInterfaces vServer1Linterfaces = new LInterfaces();
- vServer1.setLInterfaces(vServer1Linterfaces);
-
- ssc_1_trusted_port_0.setInterfaceId("dec8bdc7-5718-41dc-bfbb-561ff6eeb81c");
- ssc_1_trusted_port_0.setInterfaceName("ssc_1_trusted_port_0");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
-
-
- ssc_1_service1_port_0.setInterfaceId("1c56a24b-5f03-435a-850d-31cd4252de56");
- ssc_1_service1_port_0.setInterfaceName("ssc_1_service1_port_0");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
- ssc_1_service1_port_0.setLInterfaces(new LInterfaces());
-
-
- service1_sub_interface_1.setInterfaceId("0d9cd813-2ae1-46c0-9ebb-48081f6cffbb");
- service1_sub_interface_1.setInterfaceName("service1_sub_interface_1");
- ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1);
-
-
- service1_sub_interface_2.setInterfaceId("b7019dd0-2ee9-4447-bdef-ac25676b205a");
- service1_sub_interface_2.setInterfaceName("service1_sub_interface_2");
- ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2);
-
-
- ssc_1_mgmt_port_1.setInterfaceId("12afcd28-929f-4d80-8a5a-0833bfd5e20b");
- ssc_1_mgmt_port_1.setInterfaceName("ssc_1_mgmt_port_1");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
-
- ssc_1_mgmt_port_0.setInterfaceId("80baec42-ffae-425f-ad8c-3f7b2c24bfff");
- ssc_1_mgmt_port_0.setInterfaceName("ssc_1_mgmt_port_0");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
-
-
- ssc_1_service2_port_0.setLInterfaces(new LInterfaces());
- ssc_1_service2_port_0.setInterfaceId("13eddf95-4cf3-45f2-823a-2d890a6549b4");
- ssc_1_service2_port_0.setInterfaceName("ssc_1_service2_port_0");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0);
-
-
- service2_sub_interface_1.setInterfaceId("f711be16-2654-4a09-b89d-0511fda20e81");
- service2_sub_interface_1.setInterfaceName("service2_sub_interface_1");
- ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1);
-
-
- ssc_1_int_ha_port_0.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adb8");
- ssc_1_int_ha_port_0.setInterfaceName("ssc_1_int_ha_port_0");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0);
-
- Vserver vServer2 = new Vserver();
- vServer2.setVserverId("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz");
- LInterfaces vServer2Linterfaces = new LInterfaces();
- vServer2.setLInterfaces(vServer2Linterfaces);
-
- test_port_1.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz1");
- test_port_1.setInterfaceName("test_port_1");
-
-
- test_port_2.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz2");
- test_port_2.setInterfaceName("test_port_2");
-
- vServer2.getLInterfaces().getLInterface().add(test_port_1);
- vServer2.getLInterfaces().getLInterface().add(test_port_2);
-
- vserversToAudit.add(vServer1);
- vserversToAudit.add(vServer2);
- }
-
- @Test
- public void audit_Vserver_Empty_HashSet() throws JsonParseException, JsonMappingException, IOException {
- Optional<AAIObjectAuditList> actual =
- auditNova.auditVservers(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);
- assertEquals(Optional.empty(), actual);
- }
-
- @Test
- public void audit_Vserver_Found_Test() throws JsonParseException, JsonMappingException, IOException {
- doReturn(true).when(aaiResourcesMock).exists(vserverURI);
- doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service2_port_0_uri);
- doReturn(Optional.of(service2_sub_interface_1)).when(aaiResourcesMock).get(LInterface.class,
- service1_sub_1_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_int_ha_port_0_uri);
- doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri);
- doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri);
-
- doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
-
- Optional<AAIObjectAuditList> actual =
- auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- String actualString = objectMapper.writeValueAsString(actual.get());
- String expected = getJson("ExpectedVServerFound.json");
- JSONAssert.assertEquals(expected, actualString, false);
- }
-
- @Test
- public void audit_Vserver_Found_Test_Network_Not_Found()
- throws JsonParseException, JsonMappingException, IOException {
- doReturn(true).when(aaiResourcesMock).exists(vserverURI);
- doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri);
- doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service2_port_0_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_int_ha_port_0_uri);
- doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri);
- doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri);
-
- doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
-
- Optional<AAIObjectAuditList> actual =
- auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- String actualString = objectMapper.writeValueAsString(actual.get());
- String expected = getJson("VServer_Found_network_Not_Found.json");
- JSONAssert.assertEquals(expected, actualString, false);
- }
-
- @Test
- public void audit_Vserver_Found_Test_Network_Not_Found_Second_Server()
- throws JsonParseException, JsonMappingException, IOException {
- doReturn(true).when(aaiResourcesMock).exists(vserverURI);
- doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service2_port_0_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_int_ha_port_0_uri);
- doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri);
- doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri);
- doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
- Optional<AAIObjectAuditList> actual =
- auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- String actualString = objectMapper.writeValueAsString(actual.get());
- String expected = getJson("VServer_Found_Network_Sec_Server_Not_Found.json");
- JSONAssert.assertEquals(expected, actualString, false);
- }
-
- @Test
- public void audit_Vserver_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
- doReturn(false).when(aaiResourcesMock).exists(vserverURI);
- doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
- Optional<AAIObjectAuditList> actual =
- auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- String actualString = objectMapper.writeValueAsString(actual.get());
- String expected = getJson("Vservers_Not_Found.json");
- JSONAssert.assertEquals(expected, actualString, false);
- }
-
- @Test
- public void audit_Vserver_first_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
- doReturn(false).when(aaiResourcesMock).exists(vserverURI);
- doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri);
- doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri);
- Optional<AAIObjectAuditList> actual =
- auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- String actualString = objectMapper.writeValueAsString(actual.get());
- String expected = getJson("Vserver2_Found_VServer1_Not_Found.json");
- JSONAssert.assertEquals(expected, actualString, false);
- }
-
-
- @Test
- public void doesSubInterfaceExistinAAI_Test() {
- AAIResourceUri subInterfaceURI = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, "vserverId", "l-interface", "sub-interface");
-
- assertEquals(
- "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/vserverId/l-interfaces/l-interface/l-interface/l-interfaces/l-interface/sub-interface",
- subInterfaceURI.build().toString());
- }
-
- @Test
- public void audit_Vserver_Second_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
- doReturn(true).when(aaiResourcesMock).exists(vserverURI);
- doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_service2_port_0_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,
- ssc_1_int_ha_port_0_uri);
- doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri);
- doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri);
- doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
-
- doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
- Optional<AAIObjectAuditList> actual =
- auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- String actualString = objectMapper.writeValueAsString(actual.get());
- String expected = getJson("VServer_Found_Sec_Server_Not_Found2.json");
-
- JSONAssert.assertEquals(expected, actualString, false);
- }
-
- @Test
- public void testAuditVserversWithList() {
-
- AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIObjectAudit obj1 = new AAIObjectAudit();
- Vserver vserver = new Vserver();
- vserver.setVserverId("testVserverId");
- obj1.setAaiObject(vserver);
- obj1.setResourceURI(
- AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId"))
- .build());
- auditList.getAuditList().add(obj1);
-
- doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
- .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
-
- auditNova.auditVservers(auditList);
-
- Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
- .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
-
- Assert.assertEquals(false, auditList.getAuditList().get(0).isDoesObjectExist());
- }
-
- @Test
- public void testAuditVserversThroughRelationships() {
-
- VfModule vfModule = new VfModule();
- vfModule.setVfModuleId("id");
-
- AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
-
- doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
- AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
- .queryParam("vf-module-name", "vfModuleName"));
-
- Optional<AAIObjectAuditList> auditList =
- auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
-
- Assert.assertTrue(auditList.get().getAuditList().isEmpty());
- }
-
- @Test
- public void testAuditVserversThroughRelationships_exists() throws IOException {
-
- String vfModule = getJson("vfModule.json");
-
- AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
- AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
-
- doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
- AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
- .queryParam("vf-module-name", "vfModuleName"));
-
- doReturn(vserverWrapper).when(aaiResourcesMock)
- .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .cloudRegion("cloud-owner", "cloud-region-id").tenant("tenant-id").vserver("VUSCHGA1")));
-
- Optional<AAIObjectAuditList> auditList =
- auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
-
- Assert.assertFalse(auditList.get().getAuditList().isEmpty());
- }
-
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
- }
-
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
deleted file mode 100644
index d1d0d96042..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017-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.audit;
-
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-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;
-import org.skyscreamer.jsonassert.JSONAssert;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.heat.model.Resource;
-import com.woorea.openstack.heat.model.Resources;
-import com.woorea.openstack.heat.model.Stack;
-import com.woorea.openstack.quantum.model.Port;
-
-
-@RunWith(MockitoJUnitRunner.Silent.class)
-public class HeatStackAuditTest extends HeatStackAudit {
-
- @InjectMocks
- private HeatStackAudit heatStackAudit = new HeatStackAudit();
-
- @Mock
- private MsoHeatUtils msoHeatUtilsMock;
-
- @Mock
- private MsoNeutronUtils neutronUtilsMock;
-
- @Mock
- private AuditVServer auditVserver;
-
- private static final String cloudRegion = "cloudRegion";
- private static final String tenantId = "tenantId";
-
- private Resources resources = new Resources();
-
- private ObjectMapper objectMapper =
- new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
- .setSerializationInclusion(Include.NON_NULL);
-
- private ObjectMapper stackObjectMapper = new ObjectMapper()
- .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true).setSerializationInclusion(Include.NON_NULL);
-
- private List<Optional<Port>> portList = new ArrayList<>();
-
- @Before
- public void setup() throws Exception {
- resources = objectMapper.readValue(new File("src/test/resources/GetResources.json"), Resources.class);
- Port neutronPort1 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort1.json"), Port.class);
- doReturn(Optional.of(neutronPort1)).when(neutronUtilsMock)
- .getNeutronPort("7ee06d9d-3d18-411c-9d3e-aec930f70413", cloudRegion, tenantId);
- Port neutronPort2 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort2.json"), Port.class);
- doReturn(Optional.of(neutronPort2)).when(neutronUtilsMock)
- .getNeutronPort("27391d94-33af-474a-927d-d409249e8fd3", cloudRegion, tenantId);
- Port neutronPort3 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort3.json"), Port.class);
- doReturn(Optional.of(neutronPort3)).when(neutronUtilsMock)
- .getNeutronPort("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", cloudRegion, tenantId);
- Port neutronPort4 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort4.json"), Port.class);
- doReturn(Optional.of(neutronPort4)).when(neutronUtilsMock)
- .getNeutronPort("8d93f63e-e972-48c7-ad98-b2122da47315", cloudRegion, tenantId);
- Port neutronPort5 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort5.json"), Port.class);
- doReturn(Optional.of(neutronPort5)).when(neutronUtilsMock)
- .getNeutronPort("0594a2f2-7ea4-42eb-abc2-48ea49677fca", cloudRegion, tenantId);
- Port neutronPort6 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort6.json"), Port.class);
- doReturn(Optional.of(neutronPort6)).when(neutronUtilsMock)
- .getNeutronPort("00bb8407-650e-48b5-b919-33b88d6f8fe3", cloudRegion, tenantId);
-
-
- portList.add(Optional.empty());
- portList.add(Optional.of(neutronPort1));
- portList.add(Optional.of(neutronPort2));
- portList.add(Optional.of(neutronPort3));
- portList.add(Optional.of(neutronPort4));
- portList.add(Optional.of(neutronPort5));
- portList.add(Optional.of(neutronPort6));
- }
-
- @Test
- public void extract_proper_path_Test() {
- Optional<String> actualResult = extractStackPathFromHref(
- "https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
- assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81", actualResult.get());
- }
-
- @Test
- public void extract_proper_resources_path_Test() {
- Optional<String> actualResult = extractResourcePathFromHref(
- "https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
- assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81/resources", actualResult.get());
- }
-
- @Test
- public void extract_invalid_uri_Test() {
- Optional<String> actualResult = extractStackPathFromHref(
- "orchestrn.com:8004/v18b44d60a6f94bdcb2738f9e//stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
- assertEquals(false, actualResult.isPresent());
- }
-
- @Test
- public void createVserverSet_Test() throws Exception {
- List<Resource> novaResources = resources.getList().stream().filter(p -> "OS::Nova::Server".equals(p.getType()))
- .collect(Collectors.toList());
-
- List<Resource> resourceGroups = resources.getList().stream()
- .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType())).collect(Collectors.toList());
-
- Resources service1QueryResponse = objectMapper
- .readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class);
- doReturn(service1QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources",
- cloudRegion, tenantId, Resources.class);
-
- Resources service2QueryResponse = objectMapper
- .readValue(new File("src/test/resources/Service2ResourceGroupResponse.json"), Resources.class);
- doReturn(service2QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources",
- cloudRegion, tenantId, Resources.class);
-
-
- Stack service2StackQuerySubInt =
- stackObjectMapper.readValue(new File("src/test/resources/Service2SubInterface0.json"), Stack.class);
- doReturn(service2StackQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
- cloudRegion, tenantId, Stack.class);
- Resources service2ResourceQuerySubInt = objectMapper
- .readValue(new File("src/test/resources/Service2SubInterface1Resources.json"), Resources.class);
- doReturn(service2ResourceQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources",
- cloudRegion, tenantId, Resources.class);
-
- Stack service1StackQuerySubInt1 =
- stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface0.json"), Stack.class);
- doReturn(service1StackQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
- cloudRegion, tenantId, Stack.class);
- Resources service1ResourceQuerySubInt1 = objectMapper
- .readValue(new File("src/test/resources/Service1SubInterface0Resources.json"), Resources.class);
- doReturn(service1ResourceQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb/resources",
- cloudRegion, tenantId, Resources.class);
-
-
- Stack service1StackQuerySubInt2 =
- stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface1.json"), Stack.class);
- doReturn(service1StackQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a",
- cloudRegion, tenantId, Stack.class);
- Resources service1ResourceQuerySubInt2 = objectMapper
- .readValue(new File("src/test/resources/Service1SubInterface1Resources.json"), Resources.class);
- doReturn(service1ResourceQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a/resources",
- cloudRegion, tenantId, Resources.class);
-
- Stack service1StackQuerySubInt3 =
- stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface2.json"), Stack.class);
- doReturn(service1StackQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c",
- cloudRegion, tenantId, Stack.class);
- Resources service1ResourceQuerySubInt3 = objectMapper
- .readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class);
- doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest(
- "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources",
- cloudRegion, tenantId, Resources.class);
-
- Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources, portList);
- Set<Vserver> vserversWithSubInterfaces =
- heatStackAudit.processSubInterfaces(cloudRegion, tenantId, resourceGroups, vServersToAudit);
-
- String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces);
- String expectedValue = getJson("ExpectedVserversToAudit.json");
- JSONAssert.assertEquals(expectedValue, actualValue, false);
- }
-
- @Test
- public void auditHeatStackNoServers_Test() throws Exception {
- Resources getResource = objectMapper
- .readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class);
- doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName", 3);
-
- Optional<AAIObjectAuditList> actual =
- heatStackAudit.auditHeatStack(cloudRegion, "cloudOwner", tenantId, "heatStackName");
- assertEquals(true, actual.get().getAuditList().isEmpty());
- }
-
- @Test
- public void auditHeatStackNestedServers_Test() throws Exception {
- Resources getResource =
- objectMapper.readValue(new File("src/test/resources/GetNestedResources.json"), Resources.class);
- List<Resource> novaResources = getResource.getList().stream()
- .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
- List<Resource> resourceGroups = getResource.getList().stream()
- .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType())).collect(Collectors.toList());
-
- doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName", 3);
- Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources, portList);
- Set<Vserver> vserversWithSubInterfaces =
- heatStackAudit.processSubInterfaces(cloudRegion, tenantId, resourceGroups, vServersToAudit);
- String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces);
- String expectedValue = getJson("NestedExpectedValue.json");
- JSONAssert.assertEquals(expectedValue, actualValue, false);
- }
-
-
- @Test
- public void findInterfaceInformation_Test() {
- List<Resource> novaResources = resources.getList().stream().filter(p -> "OS::Nova::Server".equals(p.getType()))
- .collect(Collectors.toList());
- Set<Vserver> expectedVservers = new HashSet<>();
- Vserver vServer1 = new Vserver();
- vServer1.setVserverId("92272b67-d23f-42ca-87fa-7b06a9ec81f3");
- LInterfaces vServer1Linterfaces = new LInterfaces();
- vServer1.setLInterfaces(vServer1Linterfaces);
-
- LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
- ssc_1_trusted_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
-
- LInterface ssc_1_svc2_port_0 = new LInterface();
- ssc_1_svc2_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
- ssc_1_svc2_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_svc2_port_0);
-
- LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
- ssc_1_mgmt_port_1.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
-
- LInterface ssc_1_mgmt_port_0 = new LInterface();
- ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315");
- ssc_1_mgmt_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
-
- LInterface ssc_1_svc1_port_0 = new LInterface();
- ssc_1_svc1_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
- ssc_1_svc1_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_svc1_port_0);
-
- LInterface ssc_1_int_ha_port_0 = new LInterface();
- ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3");
- ssc_1_int_ha_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0);
-
- expectedVservers.add(vServer1);
-
- Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources, portList);
-
- assertThat(actualVservers, sameBeanAs(expectedVservers));
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index ebc7c3a81e..309a143e32 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -215,7 +215,7 @@ public class HeatBridgeImplTest {
// Assert
ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class);
- verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
+ verify(transaction, times(2)).create(captor.capture(), any());
List<AAIResourceUri> uris = captor.getAllValues();
assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
@@ -259,7 +259,7 @@ public class HeatBridgeImplTest {
// Assert
ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class);
- verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
+ verify(transaction, times(2)).create(captor.capture(), any());
List<AAIResourceUri> uris = captor.getAllValues();
assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
@@ -539,7 +539,7 @@ public class HeatBridgeImplTest {
when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
// Act
- heatbridge.updateLInterfaceVlan(port, lIf, "hostname");
+ heatbridge.createVlanAndSriovVF(port, lIf, "hostname");
// Assert
verify(transaction, times(2)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
@@ -625,7 +625,7 @@ public class HeatBridgeImplTest {
PInterface pIf = mock(PInterface.class);
when(pIf.getInterfaceName()).thenReturn("test-port-id");
- doNothing().when(heatbridge).updateSriovPfToPserver(any(), any());
+ doNothing().when(heatbridge).updateSriovPfToSriovVF(any(), any());
// Act
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
index 01caf38610..383fd27b56 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
@@ -2,14 +2,13 @@
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0">
<bpmn:process id="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true">
<bpmn:startEvent id="ActivateVfModuleBB_Start">
- <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1hz7ga1</bpmn:outgoing>
</bpmn:startEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0ieafii" sourceRef="ActivateVfModuleBB_Start" targetRef="CheckAuditVariable" />
<bpmn:endEvent id="ActivateVfModuleBB_End">
<bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming>
</bpmn:endEvent>
<bpmn:serviceTask id="ActivateVfModule" name="&#10;SDNC&#10;Activate&#10;(vf module)&#10;" camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_1b63lv4</bpmn:incoming>
+ <bpmn:incoming>Flow_1hz7ga1</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="UpdateVfModuleActiveStatus" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
@@ -29,64 +28,7 @@
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_1a495wm" sourceRef="ActivateVfModule" targetRef="CallActivity_sdncHandler" />
<bpmn:sequenceFlow id="SequenceFlow_1j4x1ej" sourceRef="CallActivity_sdncHandler" targetRef="UpdateVfModuleActiveStatus" />
- <bpmn:sequenceFlow id="SequenceFlow_0xndboi" sourceRef="Setup_AAI_Inventory_Audit" targetRef="Audit_AAI_Inventory" />
- <bpmn:serviceTask id="Setup_AAI_Inventory_Audit" name="Setup Inventory Audit Variable" camunda:expression="${AuditTasks.setupAuditVariable(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_0ghzwlo</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0xndboi</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:serviceTask id="Audit_AAI_Inventory" name="Validate A&#38;AI Inventory" camunda:type="external" camunda:topic="InventoryAddAudit">
- <bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0l8684g</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_07ybdik" name="No" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ExclusiveGateway_0sqvzll" />
- <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" name="Yes" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("auditInventoryNeeded") == true}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:serviceTask id="CheckAuditVariable" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1xqyur9</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1xqyur9" sourceRef="CheckAuditVariable" targetRef="ExclusiveGateway_1v8bmbu" />
- <bpmn:sequenceFlow id="SequenceFlow_1b63lv4" sourceRef="ExclusiveGateway_0sqvzll" targetRef="ActivateVfModule" />
- <bpmn:subProcess id="SubProcess_0bpsptg" name="Audit Exception Sub Process" triggeredByEvent="true">
- <bpmn:startEvent id="catchInventoryException">
- <bpmn:outgoing>SequenceFlow_19gbhlj</bpmn:outgoing>
- <bpmn:errorEventDefinition errorRef="Error_1s3kxze" />
- </bpmn:startEvent>
- <bpmn:endEvent id="EndEvent_067jv1n">
- <bpmn:incoming>SequenceFlow_0l4jzc5</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_19gbhlj" sourceRef="catchInventoryException" targetRef="processAuditException" />
- <bpmn:sequenceFlow id="SequenceFlow_0l4jzc5" sourceRef="processAuditException" targetRef="EndEvent_067jv1n" />
- <bpmn:serviceTask id="processAuditException" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), false)}">
- <bpmn:incoming>SequenceFlow_19gbhlj</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0l4jzc5</bpmn:outgoing>
- </bpmn:serviceTask>
- </bpmn:subProcess>
- <bpmn:inclusiveGateway id="ExclusiveGateway_1v8bmbu" name="Audit Enabled?" default="SequenceFlow_07ybdik">
- <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing>
- </bpmn:inclusiveGateway>
- <bpmn:inclusiveGateway id="ExclusiveGateway_0sqvzll">
- <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming>
- <bpmn:incoming>Flow_1c5mrjc</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1b63lv4</bpmn:outgoing>
- </bpmn:inclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_0l8684g" sourceRef="Audit_AAI_Inventory" targetRef="Gateway_1518atw" />
- <bpmn:exclusiveGateway id="Gateway_1518atw" name="Audit Failed?" default="Flow_1c5mrjc">
- <bpmn:incoming>SequenceFlow_0l8684g</bpmn:incoming>
- <bpmn:outgoing>Flow_1c5mrjc</bpmn:outgoing>
- <bpmn:outgoing>Flow_02xnvmz</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="Flow_1c5mrjc" sourceRef="Gateway_1518atw" targetRef="ExclusiveGateway_0sqvzll" />
- <bpmn:sequenceFlow id="Flow_02xnvmz" sourceRef="Gateway_1518atw" targetRef="Event_1ubxkat">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("auditIsSuccessful") == false}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:endEvent id="Event_1ubxkat">
- <bpmn:incoming>Flow_02xnvmz</bpmn:incoming>
- <bpmn:errorEventDefinition id="ErrorEventDefinition_0qq1s4r" errorRef="Error_1s3kxze" />
- </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_1hz7ga1" sourceRef="ActivateVfModuleBB_Start" targetRef="ActivateVfModule" />
</bpmn:process>
<bpmn:error id="Error_0q258vt" errorCode="7000" />
<bpmn:error id="Error_0zgccif" name="org.onap.so.adapters.inventory.create.InventoryException" errorCode="org.onap.so.adapters.inventory.create.InventoryException" />
@@ -94,167 +36,51 @@
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateVfModuleBB">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="ActivateVfModuleBB_Start">
- <dc:Bounds x="156" y="260" width="36" height="36" />
+ <dc:Bounds x="156" y="100" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="58" y="270" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii">
- <di:waypoint x="192" y="278" />
- <di:waypoint x="272" y="278" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="116" y="231" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End">
- <dc:Bounds x="1475" y="261" width="36" height="36" />
+ <dc:Bounds x="736" y="101" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1235" y="275" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule">
- <dc:Bounds x="1029" y="238" width="100" height="80" />
+ <dc:Bounds x="290" y="78" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus">
- <dc:Bounds x="1285" y="238" width="100" height="80" />
+ <dc:Bounds x="546" y="78" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv">
- <di:waypoint x="1385" y="278" />
- <di:waypoint x="1475" y="279" />
+ <di:waypoint x="646" y="118" />
+ <di:waypoint x="736" y="119" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1314" y="231.5" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_03jkesd_di" bpmnElement="CallActivity_sdncHandler">
- <dc:Bounds x="1157" y="238" width="100" height="80" />
+ <dc:Bounds x="418" y="78" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm">
- <di:waypoint x="1129" y="278" />
- <di:waypoint x="1157" y="278" />
+ <di:waypoint x="390" y="118" />
+ <di:waypoint x="418" y="118" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1027" y="231" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej">
- <di:waypoint x="1257" y="278" />
- <di:waypoint x="1285" y="278" />
+ <di:waypoint x="518" y="118" />
+ <di:waypoint x="546" y="118" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1155" y="231" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0xndboi_di" bpmnElement="SequenceFlow_0xndboi">
- <di:waypoint x="589" y="201" />
- <di:waypoint x="630" y="201" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="457" y="153.5" width="90" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0krf1ur_di" bpmnElement="Setup_AAI_Inventory_Audit">
- <dc:Bounds x="489" y="161" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_08rxjeb_di" bpmnElement="Audit_AAI_Inventory">
- <dc:Bounds x="630" y="161" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_07ybdik_di" bpmnElement="SequenceFlow_07ybdik">
- <di:waypoint x="426" y="303" />
- <di:waypoint x="426" y="341" />
- <di:waypoint x="952" y="341" />
- <di:waypoint x="952" y="303" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="435" y="320" width="15" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0ghzwlo_di" bpmnElement="SequenceFlow_0ghzwlo">
- <di:waypoint x="426" y="253" />
- <di:waypoint x="426" y="201" />
- <di:waypoint x="489" y="201" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="434" y="211" width="18" height="14" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNEdge id="Flow_1hz7ga1_di" bpmnElement="Flow_1hz7ga1">
+ <di:waypoint x="192" y="118" />
+ <di:waypoint x="290" y="118" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1eg5ryx_di" bpmnElement="CheckAuditVariable">
- <dc:Bounds x="272" y="238" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1xqyur9_di" bpmnElement="SequenceFlow_1xqyur9">
- <di:waypoint x="372" y="278" />
- <di:waypoint x="401" y="278" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="270.5" y="230.5" width="90" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1b63lv4_di" bpmnElement="SequenceFlow_1b63lv4">
- <di:waypoint x="977" y="278" />
- <di:waypoint x="1029" y="278" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="887" y="231" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="SubProcess_0mbkb7v_di" bpmnElement="SubProcess_0bpsptg" isExpanded="true">
- <dc:Bounds x="364" y="475" width="350" height="200" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="StartEvent_12r96di_di" bpmnElement="catchInventoryException">
- <dc:Bounds x="395" y="558" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="341.15269461077844" y="571.6127744510978" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_067jv1n_di" bpmnElement="EndEvent_067jv1n">
- <dc:Bounds x="643" y="558" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="590.1526946107784" y="572" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_19gbhlj_di" bpmnElement="SequenceFlow_19gbhlj">
- <di:waypoint x="431" y="576" />
- <di:waypoint x="486" y="576" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="387.5" y="529" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0l4jzc5_di" bpmnElement="SequenceFlow_0l4jzc5">
- <di:waypoint x="586" y="576" />
- <di:waypoint x="643" y="576" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="543.5" y="529" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_08xffml_di" bpmnElement="processAuditException">
- <dc:Bounds x="486" y="536" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="InclusiveGateway_03pi9y4_di" bpmnElement="ExclusiveGateway_1v8bmbu">
- <dc:Bounds x="401" y="253" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="454" y="272" width="74" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="InclusiveGateway_16ap4e3_di" bpmnElement="ExclusiveGateway_0sqvzll">
- <dc:Bounds x="927" y="253" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="836" y="281" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0l8684g_di" bpmnElement="SequenceFlow_0l8684g">
- <di:waypoint x="730" y="201" />
- <di:waypoint x="785" y="201" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="Gateway_1518atw_di" bpmnElement="Gateway_1518atw" isMarkerVisible="true">
- <dc:Bounds x="785" y="176" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="780" y="233" width="64" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="Flow_1c5mrjc_di" bpmnElement="Flow_1c5mrjc">
- <di:waypoint x="835" y="201" />
- <di:waypoint x="952" y="201" />
- <di:waypoint x="952" y="253" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_02xnvmz_di" bpmnElement="Flow_02xnvmz">
- <di:waypoint x="810" y="176" />
- <di:waypoint x="810" y="118" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="Event_133vsyh_di" bpmnElement="Event_1ubxkat">
- <dc:Bounds x="792" y="82" width="36" height="36" />
- </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
index 87e0b883a9..9a33a3e4bf 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0">
<bpmn:process id="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true">
<bpmn:startEvent id="DeleteVfModuleBB_Start">
- <bpmn:outgoing>SequenceFlow_1oeootm</bpmn:outgoing>
+ <bpmn:outgoing>Flow_02lmh6f</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Prepare Request" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_028rmiu</bpmn:incoming>
+ <bpmn:incoming>Flow_02lmh6f</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_08tvhtf</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name="&#10;AAI &#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
@@ -29,9 +29,8 @@
<camunda:out source="contrailServiceInstanceFqdn" target="contrailServiceInstanceFqdn" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0hlvlw2</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="ExclusiveGateway_1yvh16a" />
<bpmn:subProcess id="SubProcess_11p7mrh" name="Error Handling&#10;&#10;" triggeredByEvent="true">
<bpmn:startEvent id="StartEvent_1xp6ewt">
<bpmn:outgoing>SequenceFlow_0h607z0</bpmn:outgoing>
@@ -51,7 +50,7 @@
<bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" />
<bpmn:sequenceFlow id="SequenceFlow_0xyu3pk" sourceRef="DeleteNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" />
<bpmn:serviceTask id="DeleteNetworkPolicies" name="&#10;AAI&#10;Delete&#10;(net policies)&#10;" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_0sy2nky</bpmn:incoming>
+ <bpmn:incoming>Flow_0n2pqrr</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0xyu3pk</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="UpdateVnfManagementV6Address" name="&#10;AAI &#10;Update&#10;(vnf)&#10;" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
@@ -69,496 +68,176 @@
<bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_032jv5j" name="Yes&#10;" sourceRef="auditEnabledCheck" targetRef="Setup_Audit_Variable">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("auditInventoryNeeded") == true}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="ServiceTask_08ulmzc" />
- <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isDeleteAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_1oeootm</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_10af0fk</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:serviceTask id="Audit_Inventory" name="&#10;AAI&#10;Audit&#10;(vservers)&#10;" camunda:type="external" camunda:topic="InventoryDeleteAudit">
- <bpmn:incoming>SequenceFlow_0f5ljoh</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0hpj2mm</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:serviceTask id="Setup_Audit_Variable" name="Setup Audit Variable" camunda:expression="${AuditTasks.setupAuditVariable(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_032jv5j</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1iulltd</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:subProcess id="SubProcess_0grvkj2" name="Audit Exception Sub Process" triggeredByEvent="true">
- <bpmn:endEvent id="EndEvent_1gzq57j">
- <bpmn:incoming>SequenceFlow_1fhst92</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:serviceTask id="ServiceTask_1isbxvo" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), true)}">
- <bpmn:incoming>SequenceFlow_0xuodpy</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1fhst92</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_0xuodpy" sourceRef="StartEvent_1euiddy" targetRef="ServiceTask_1isbxvo" />
- <bpmn:sequenceFlow id="SequenceFlow_1fhst92" sourceRef="ServiceTask_1isbxvo" targetRef="EndEvent_1gzq57j" />
- <bpmn:startEvent id="StartEvent_1euiddy" isInterrupting="false">
- <bpmn:outgoing>SequenceFlow_0xuodpy</bpmn:outgoing>
- <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" camunda:escalationCodeVariable="auditCode" />
- </bpmn:startEvent>
- </bpmn:subProcess>
- <bpmn:sequenceFlow id="SequenceFlow_179btn2" sourceRef="aaiCatch" targetRef="ServiceTask_0itw3by" />
<bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI">
- <bpmn:incoming>SequenceFlow_1i9ft2r</bpmn:incoming>
+ <bpmn:incoming>Flow_0plbl7p</bpmn:incoming>
<bpmn:linkEventDefinition name="AAI" />
</bpmn:intermediateThrowEvent>
<bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI">
- <bpmn:outgoing>SequenceFlow_179btn2</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0n2pqrr</bpmn:outgoing>
<bpmn:linkEventDefinition name="AAI" />
</bpmn:intermediateCatchEvent>
- <bpmn:sequenceFlow id="SequenceFlow_17cd9e2" name="Yes/No" sourceRef="auditSuccessfulCheck" targetRef="ExclusiveGateway_01wvywu">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("auditIsSuccessful") == false || execution.getVariable("auditIsSuccessful") == true}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_1gdyk9j" name="No" sourceRef="auditSuccessfulCheck" targetRef="EndEvent_0b0ocu0">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("auditIsSuccessful") == false}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:inclusiveGateway id="auditSuccessfulCheck" name="Audit&#10; Successful?">
- <bpmn:incoming>SequenceFlow_0hpj2mm</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_17cd9e2</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1gdyk9j</bpmn:outgoing>
- </bpmn:inclusiveGateway>
- <bpmn:endEvent id="EndEvent_0b0ocu0">
- <bpmn:incoming>SequenceFlow_1gdyk9j</bpmn:incoming>
- <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" />
- </bpmn:endEvent>
- <bpmn:exclusiveGateway id="auditEnabledCheck" name="Audit&#10; Enabled?" default="SequenceFlow_1bt1p2u">
- <bpmn:incoming>SequenceFlow_10af0fk</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_032jv5j</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1bt1p2u</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:exclusiveGateway id="ExclusiveGateway_1t9q2jl">
- <bpmn:incoming>SequenceFlow_1bt1p2u</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_0dzf7hz</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1bq9g02</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_1bt1p2u" name="No" sourceRef="auditEnabledCheck" targetRef="ExclusiveGateway_1t9q2jl" />
- <bpmn:sequenceFlow id="SequenceFlow_1oeootm" sourceRef="DeleteVfModuleBB_Start" targetRef="Check_Audit" />
- <bpmn:sequenceFlow id="SequenceFlow_10af0fk" sourceRef="Check_Audit" targetRef="auditEnabledCheck" />
- <bpmn:serviceTask id="aicQueryStack" name="&#10;AIC&#10;Query&#10;(stack)&#10;" camunda:type="external" camunda:topic="InventoryQueryAudit">
- <bpmn:incoming>SequenceFlow_1iulltd</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0dzf7hz</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1iulltd" sourceRef="Setup_Audit_Variable" targetRef="aicQueryStack" />
- <bpmn:sequenceFlow id="SequenceFlow_0dzf7hz" sourceRef="aicQueryStack" targetRef="ExclusiveGateway_1t9q2jl" />
- <bpmn:sequenceFlow id="SequenceFlow_1bq9g02" sourceRef="ExclusiveGateway_1t9q2jl" targetRef="ExclusiveGateway_1naduhl" />
- <bpmn:sequenceFlow id="SequenceFlow_0mtzl4z" sourceRef="ExclusiveGateway_1naduhl" targetRef="ExclusiveGateway_13fhmpf" />
- <bpmn:sequenceFlow id="SequenceFlow_028rmiu" sourceRef="ExclusiveGateway_1naduhl" targetRef="DeleteVfModuleVnfAdapter" />
- <bpmn:parallelGateway id="ExclusiveGateway_1naduhl">
- <bpmn:incoming>SequenceFlow_1bq9g02</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0mtzl4z</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_028rmiu</bpmn:outgoing>
- </bpmn:parallelGateway>
- <bpmn:inclusiveGateway id="ExclusiveGateway_1yvh16a">
- <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_13mlz57</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing>
- </bpmn:inclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_0hpj2mm" sourceRef="Audit_Inventory" targetRef="auditSuccessfulCheck" />
- <bpmn:exclusiveGateway id="ExclusiveGateway_13fhmpf" name="Audit&#10; Enabled?" default="SequenceFlow_1gjwivp">
- <bpmn:incoming>SequenceFlow_0mtzl4z</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0f5ljoh</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1gjwivp</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_0f5ljoh" name="Yes" sourceRef="ExclusiveGateway_13fhmpf" targetRef="Audit_Inventory">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("auditInventoryNeeded") == true}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:exclusiveGateway id="ExclusiveGateway_01wvywu">
- <bpmn:incoming>SequenceFlow_17cd9e2</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1gjwivp</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_13mlz57</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_1gjwivp" name="No" sourceRef="ExclusiveGateway_13fhmpf" targetRef="ExclusiveGateway_01wvywu" />
- <bpmn:sequenceFlow id="SequenceFlow_13mlz57" sourceRef="ExclusiveGateway_01wvywu" targetRef="ExclusiveGateway_1yvh16a" />
<bpmn:serviceTask id="ServiceTask_0itw3by" name="&#10;AAI&#10;Delete&#10;(inventory)&#10;" camunda:type="external" camunda:topic="InventoryDelete">
- <bpmn:incoming>SequenceFlow_179btn2</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0sy2nky</bpmn:outgoing>
+ <bpmn:incoming>SequenceFlow_1i9ft2r</bpmn:incoming>
+ <bpmn:outgoing>Flow_0plbl7p</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_0sy2nky" sourceRef="ServiceTask_0itw3by" targetRef="DeleteNetworkPolicies" />
<bpmn:serviceTask id="ServiceTask_08ulmzc" name="&#10;Create&#10;Cloud&#10;Variable&#10;" camunda:expression="${DeleteVFModule.createInventoryVariable(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming>
+ <bpmn:incoming>Flow_0hlvlw2</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1i9ft2r</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1i9ft2r" sourceRef="ServiceTask_08ulmzc" targetRef="aaiThrow" />
+ <bpmn:sequenceFlow id="SequenceFlow_1i9ft2r" sourceRef="ServiceTask_08ulmzc" targetRef="ServiceTask_0itw3by" />
+ <bpmn:sequenceFlow id="Flow_0n2pqrr" sourceRef="aaiCatch" targetRef="DeleteNetworkPolicies" />
+ <bpmn:sequenceFlow id="Flow_0plbl7p" sourceRef="ServiceTask_0itw3by" targetRef="aaiThrow" />
+ <bpmn:sequenceFlow id="Flow_0hlvlw2" sourceRef="VnfAdapter" targetRef="ServiceTask_08ulmzc" />
+ <bpmn:sequenceFlow id="Flow_02lmh6f" sourceRef="DeleteVfModuleBB_Start" targetRef="DeleteVfModuleVnfAdapter" />
</bpmn:process>
<bpmn:error id="Error_0jjnve8" name="Error_3k24na6" errorCode="AAIInventoryFailure" />
<bpmn:escalation id="Escalation_130je8j" name="audit" escalationCode="audit1" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start">
- <dc:Bounds x="159" y="266" width="36" height="36" />
+ <dc:Bounds x="159" y="106" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="132" y="302" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter">
- <dc:Bounds x="888" y="312" width="100" height="80" />
+ <dc:Bounds x="290" y="84" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus">
- <dc:Bounds x="1136" y="468" width="100" height="80" />
+ <dc:Bounds x="930" y="308" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf">
- <di:waypoint x="988" y="352" />
- <di:waypoint x="1020" y="352" />
+ <di:waypoint x="390" y="124" />
+ <di:waypoint x="435" y="124" />
<bpmndi:BPMNLabel>
<dc:Bounds x="959" y="331" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End">
- <dc:Bounds x="1268" y="490" width="36" height="36" />
+ <dc:Bounds x="1142" y="330" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1241" y="530" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter">
- <dc:Bounds x="1020" y="312" width="100" height="80" />
+ <dc:Bounds x="435" y="84" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87">
- <di:waypoint x="1120" y="352" />
- <di:waypoint x="1203" y="352" />
- <di:waypoint x="1203" y="309" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1116.5" y="337" width="90" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true">
- <dc:Bounds x="290" y="878" width="231" height="135" />
+ <dc:Bounds x="304" y="500" width="231" height="135" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt">
- <dc:Bounds x="333" y="940" width="36" height="36" />
+ <dc:Bounds x="347" y="562" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="261" y="976" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau">
- <dc:Bounds x="462" y="940" width="36" height="36" />
+ <dc:Bounds x="476" y="562" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="390" y="976" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0">
- <di:waypoint x="369" y="958" />
- <di:waypoint x="462" y="958" />
+ <di:waypoint x="383" y="580" />
+ <di:waypoint x="476" y="580" />
<bpmndi:BPMNLabel>
<dc:Bounds x="371" y="937" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId">
- <dc:Bounds x="969" y="468" width="100" height="80" />
+ <dc:Bounds x="800" y="308" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp">
- <di:waypoint x="1069" y="508" />
- <di:waypoint x="1136" y="508" />
+ <di:waypoint x="900" y="348" />
+ <di:waypoint x="930" y="348" />
<bpmndi:BPMNLabel>
<dc:Bounds x="848" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg">
- <di:waypoint x="1236" y="508" />
- <di:waypoint x="1268" y="508" />
+ <di:waypoint x="1030" y="348" />
+ <di:waypoint x="1142" y="348" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1092.5" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk">
- <di:waypoint x="420" y="468" />
- <di:waypoint x="420" y="448" />
- <di:waypoint x="443" y="409" />
- <di:waypoint x="497" y="468" />
+ <di:waypoint x="370" y="348" />
+ <di:waypoint x="400" y="348" />
<bpmndi:BPMNLabel>
<dc:Bounds x="345" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies">
- <dc:Bounds x="370" y="468" width="100" height="80" />
+ <dc:Bounds x="270" y="308" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address">
- <dc:Bounds x="642" y="468" width="100" height="80" />
+ <dc:Bounds x="540" y="308" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b">
- <di:waypoint x="533" y="468" />
- <di:waypoint x="533" y="448" />
- <di:waypoint x="619" y="387" />
- <di:waypoint x="692" y="448" />
- <di:waypoint x="692" y="468" />
+ <di:waypoint x="500" y="348" />
+ <di:waypoint x="540" y="348" />
<bpmndi:BPMNLabel>
<dc:Bounds x="473" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress">
- <dc:Bounds x="483" y="468" width="100" height="80" />
+ <dc:Bounds x="400" y="308" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc">
- <di:waypoint x="742" y="493" />
- <di:waypoint x="891" y="448" />
- <di:waypoint x="891" y="468" />
+ <di:waypoint x="640" y="348" />
+ <di:waypoint x="670" y="348" />
<bpmndi:BPMNLabel>
<dc:Bounds x="598" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z">
- <di:waypoint x="941" y="508" />
- <di:waypoint x="969" y="508" />
+ <di:waypoint x="770" y="348" />
+ <di:waypoint x="800" y="348" />
<bpmndi:BPMNLabel>
<dc:Bounds x="722" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn">
- <dc:Bounds x="841" y="468" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_032jv5j_di" bpmnElement="SequenceFlow_032jv5j">
- <di:waypoint x="397" y="259" />
- <di:waypoint x="397" y="214" />
- <di:waypoint x="444" y="214" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="405.5348837209302" y="217.95121951219514" width="19" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_14bu4ys_di" bpmnElement="SequenceFlow_14bu4ys">
- <di:waypoint x="1228" y="284" />
- <di:waypoint x="1284" y="284" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1230.5" y="262.5" width="90" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1vmz3zo_di" bpmnElement="Check_Audit">
- <dc:Bounds x="244" y="244" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1l8r2a6_di" bpmnElement="Audit_Inventory">
- <dc:Bounds x="930" y="117" width="100" height="80" />
+ <dc:Bounds x="670" y="308" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1gttdjr_di" bpmnElement="Setup_Audit_Variable">
- <dc:Bounds x="444" y="174" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="SubProcess_0grvkj2_di" bpmnElement="SubProcess_0grvkj2" isExpanded="true">
- <dc:Bounds x="231" y="642" width="350" height="200" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_1gzq57j_di" bpmnElement="EndEvent_1gzq57j">
- <dc:Bounds x="510" y="725" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="438" y="765" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1isbxvo_di" bpmnElement="ServiceTask_1isbxvo">
- <dc:Bounds x="353" y="703" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0xuodpy_di" bpmnElement="SequenceFlow_0xuodpy">
- <di:waypoint x="298" y="743" />
- <di:waypoint x="353" y="743" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="280.5" y="722" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1fhst92_di" bpmnElement="SequenceFlow_1fhst92">
- <di:waypoint x="453" y="743" />
- <di:waypoint x="510" y="743" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="393" y="722" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_179btn2_di" bpmnElement="SequenceFlow_179btn2">
- <di:waypoint x="195" y="508" />
- <di:waypoint x="225" y="508" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="191" y="487" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_1sftyjz_di" bpmnElement="aaiThrow">
- <dc:Bounds x="1481" y="266" width="36" height="36" />
+ <dc:Bounds x="1062" y="106" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1472" y="305" width="57" height="14" />
+ <dc:Bounds x="1053" y="145" width="57" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_13y483m_di" bpmnElement="aaiCatch">
- <dc:Bounds x="159" y="490" width="36" height="36" />
+ <dc:Bounds x="159" y="330" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="150" y="530" width="55" height="12" />
+ <dc:Bounds x="149" y="370" width="57" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_17cd9e2_di" bpmnElement="SequenceFlow_17cd9e2">
- <di:waypoint x="1108" y="157" />
- <di:waypoint x="1156" y="157" />
- <di:waypoint x="1156" y="189" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1111.0434782608695" y="137" width="36" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1gdyk9j_di" bpmnElement="SequenceFlow_1gdyk9j">
- <di:waypoint x="1083" y="132" />
- <di:waypoint x="1083" y="109" />
- <di:waypoint x="1083" y="109" />
- <di:waypoint x="1083" y="84" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1083" y="110.74468085106383" width="14" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="InclusiveGateway_0i6rdd1_di" bpmnElement="auditSuccessfulCheck">
- <dc:Bounds x="1058" y="132" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1053" y="186" width="60" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="StartEvent_04qhoba_di" bpmnElement="StartEvent_1euiddy">
- <dc:Bounds x="262" y="725" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="189" y="765" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_1onxfk1_di" bpmnElement="EndEvent_0b0ocu0">
- <dc:Bounds x="1065" y="48" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1024" y="87" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_05scr6c_di" bpmnElement="auditEnabledCheck" isMarkerVisible="true">
- <dc:Bounds x="371.6051332675222" y="259" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="421" y="272" width="45" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_1t9q2jl_di" bpmnElement="ExclusiveGateway_1t9q2jl" isMarkerVisible="true">
- <dc:Bounds x="697" y="259" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="677" y="313" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1bt1p2u_di" bpmnElement="SequenceFlow_1bt1p2u">
- <di:waypoint x="397" y="309" />
- <di:waypoint x="397" y="352" />
- <di:waypoint x="722" y="352" />
- <di:waypoint x="722" y="309" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="407" y="326" width="14" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1oeootm_di" bpmnElement="SequenceFlow_1oeootm">
- <di:waypoint x="195" y="284" />
- <di:waypoint x="244" y="284" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="219.5" y="263" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_10af0fk_di" bpmnElement="SequenceFlow_10af0fk">
- <di:waypoint x="344" y="284" />
- <di:waypoint x="372" y="284" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="358" y="263" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1l7z1c0_di" bpmnElement="aicQueryStack">
- <dc:Bounds x="571" y="174" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1iulltd_di" bpmnElement="SequenceFlow_1iulltd">
- <di:waypoint x="544" y="214" />
- <di:waypoint x="571" y="214" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="557.5" y="193" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0dzf7hz_di" bpmnElement="SequenceFlow_0dzf7hz">
- <di:waypoint x="671" y="214" />
- <di:waypoint x="722" y="214" />
- <di:waypoint x="722" y="259" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="651.5" y="193" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1bq9g02_di" bpmnElement="SequenceFlow_1bq9g02">
- <di:waypoint x="747" y="284" />
- <di:waypoint x="796" y="284" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="726.5" y="263" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0mtzl4z_di" bpmnElement="SequenceFlow_0mtzl4z">
- <di:waypoint x="821" y="259" />
- <di:waypoint x="821" y="214" />
- <di:waypoint x="846" y="214" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="791" y="231" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_028rmiu_di" bpmnElement="SequenceFlow_028rmiu">
- <di:waypoint x="821" y="309" />
- <di:waypoint x="821" y="352" />
- <di:waypoint x="888" y="352" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="791" y="324.5" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ParallelGateway_1we1ooj_di" bpmnElement="ExclusiveGateway_1naduhl">
- <dc:Bounds x="796" y="259" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="775" y="313" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="InclusiveGateway_07wvmp4_di" bpmnElement="ExclusiveGateway_1yvh16a">
- <dc:Bounds x="1178" y="259" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1067" y="312" width="90" height="12" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNShape id="ServiceTask_0itw3by_di" bpmnElement="ServiceTask_0itw3by">
+ <dc:Bounds x="740" y="84" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0hpj2mm_di" bpmnElement="SequenceFlow_0hpj2mm">
- <di:waypoint x="1030" y="157" />
- <di:waypoint x="1058" y="157" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="999" y="136" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ExclusiveGateway_13fhmpf_di" bpmnElement="ExclusiveGateway_13fhmpf" isMarkerVisible="true">
- <dc:Bounds x="846" y="189" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="898" y="202" width="45" height="24" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNShape id="ServiceTask_08ulmzc_di" bpmnElement="ServiceTask_08ulmzc">
+ <dc:Bounds x="590" y="84" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0f5ljoh_di" bpmnElement="SequenceFlow_0f5ljoh">
- <di:waypoint x="871" y="189" />
- <di:waypoint x="871" y="157" />
- <di:waypoint x="930" y="157" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="877.601615925754" y="162.89580806038546" width="19" height="12" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNEdge id="SequenceFlow_1i9ft2r_di" bpmnElement="SequenceFlow_1i9ft2r">
+ <di:waypoint x="690" y="124" />
+ <di:waypoint x="740" y="124" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ExclusiveGateway_01wvywu_di" bpmnElement="ExclusiveGateway_01wvywu" isMarkerVisible="true">
- <dc:Bounds x="1131" y="189" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1111" y="243" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1gjwivp_di" bpmnElement="SequenceFlow_1gjwivp">
- <di:waypoint x="871" y="239" />
- <di:waypoint x="871" y="266" />
- <di:waypoint x="1156" y="266" />
- <di:waypoint x="1156" y="239" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="879" y="244" width="14" height="12" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNEdge id="Flow_0n2pqrr_di" bpmnElement="Flow_0n2pqrr">
+ <di:waypoint x="195" y="348" />
+ <di:waypoint x="270" y="348" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_13mlz57_di" bpmnElement="SequenceFlow_13mlz57">
- <di:waypoint x="1181" y="214" />
- <di:waypoint x="1203" y="214" />
- <di:waypoint x="1203" y="259" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1147" y="193" width="90" height="12" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNEdge id="Flow_0plbl7p_di" bpmnElement="Flow_0plbl7p">
+ <di:waypoint x="840" y="124" />
+ <di:waypoint x="1062" y="124" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0itw3by_di" bpmnElement="ServiceTask_0itw3by">
- <dc:Bounds x="225" y="468" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0sy2nky_di" bpmnElement="SequenceFlow_0sy2nky">
- <di:waypoint x="325" y="508" />
- <di:waypoint x="370" y="508" />
+ <bpmndi:BPMNEdge id="Flow_0hlvlw2_di" bpmnElement="Flow_0hlvlw2">
+ <di:waypoint x="535" y="124" />
+ <di:waypoint x="590" y="124" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_08ulmzc_di" bpmnElement="ServiceTask_08ulmzc">
- <dc:Bounds x="1284" y="244" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1i9ft2r_di" bpmnElement="SequenceFlow_1i9ft2r">
- <di:waypoint x="1384" y="276" />
- <di:waypoint x="1433" y="276" />
- <di:waypoint x="1433" y="284" />
- <di:waypoint x="1481" y="284" />
+ <bpmndi:BPMNEdge id="Flow_02lmh6f_di" bpmnElement="Flow_02lmh6f">
+ <di:waypoint x="195" y="124" />
+ <di:waypoint x="290" y="124" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
index 6f89f3c738..558e785e94 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
@@ -22,12 +22,9 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import java.io.IOException;
-import java.util.List;
import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.externaltask.LockedExternalTask;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Test;
@@ -47,20 +44,10 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest {
public void sunnyDay() throws InterruptedException, IOException {
mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
- List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryAddAudit", 60L * 1000L).execute();
- while (!tasks.isEmpty()) {
- for (LockedExternalTask task : tasks) {
- externalTaskService.complete(task.getId(), "externalWorkerId");
- }
- tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryAddAudit", 60L * 1000L)
- .execute();
- }
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ExclusiveGateway_1v8bmbu",
- "Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "CallActivity_sdncHandler",
- "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End");
+ assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule",
+ "CallActivity_sdncHandler", "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End");
assertThat(pi).isEnded();
}
@@ -70,19 +57,9 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest {
doThrow(BpmnError.class).when(aaiUpdateTasks)
.updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
- List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryAddAudit", 60L * 1000L).execute();
- while (!tasks.isEmpty()) {
- for (LockedExternalTask task : tasks) {
- externalTaskService.complete(task.getId(), "externalWorkerId");
- }
- tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryAddAudit", 60L * 1000L)
- .execute();
- }
assertThat(pi).isNotNull().isStarted()
- .hasPassedInOrder("ActivateVfModuleBB_Start", "ExclusiveGateway_1v8bmbu", "Setup_AAI_Inventory_Audit",
- "Audit_AAI_Inventory", "ActivateVfModule", "UpdateVfModuleActiveStatus")
+ .hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "UpdateVfModuleActiveStatus")
.hasNotPassed("ActivateVfModuleBB_End");
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java
index f7c42b97e9..b706be92cb 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java
@@ -44,7 +44,11 @@ public class CreateVFModule {
CloudInformation cloudInformation = new CloudInformation();
cloudInformation.setOwner(gBBInput.getCloudRegion().getCloudOwner());
cloudInformation.setRegionId(gBBInput.getCloudRegion().getLcpCloudRegionId());
- cloudInformation.setTenantId(gBBInput.getTenant().getTenantId());
+ String tenantId = gBBInput.getTenant().getTenantId();
+ if (tenantId == null) {
+ tenantId = gBBInput.getCloudRegion().getTenantId();
+ }
+ cloudInformation.setTenantId(tenantId);
cloudInformation.setTenantName(gBBInput.getTenant().getTenantName());
cloudInformation.setTenantContext(gBBInput.getTenant().getTenantContext());
cloudInformation.setTemplateInstanceId(execution.getVariable("heatStackId"));
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
index edf212429c..d8d62d99bc 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
@@ -29,8 +29,7 @@ public class ProcessVnfc extends AbstractTestAction {
AAIResourcesClient aaiResourceClient = new AAIResourcesClient();
if (context.getVariable("requestAction").equals("CreateVfModuleInstance")
- && context.getVariable("serviceAction").equals("assign")
- && context.getVariable("vfModuleName").equals("nc_dummy_id")) {
+ && context.getVariable("serviceAction").equals("assign")) {
AAIResourceUri vnfcURI =
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc("ssc_server_1"));
@@ -47,14 +46,14 @@ public class ProcessVnfc extends AbstractTestAction {
vnfc.setModelVersionId("9e314c37-2258-4572-a399-c0dd7d5f1aec");
vnfc.setModelCustomizationId("2bd95cd4-d7ff-4af0-985d-2adea0339921");
- if (!aaiResourceClient.exists(vnfcURI)) {
- logger.debug("creating VNFC");
- aaiResourceClient.create(vnfcURI, vnfc);
+ if (aaiResourceClient.exists(vnfcURI)) {
+ logger.debug("cleaning up VNFC");
+ aaiResourceClient.delete(vnfcURI);
+ }
+ logger.debug("creating new VNFC");
+ aaiResourceClient.create(vnfcURI, vnfc);
- } else {
- aaiResourceClient.get(vnfcURI);
- }
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network()
.genericVnf(context.getVariable("vnfId")).vfModule(context.getVariable("vfModuleId")));
logger.debug("creating VNFC edge to vf module");
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplace.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplace.java
new file mode 100644
index 0000000000..f4ac519f7a
--- /dev/null
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplace.java
@@ -0,0 +1,25 @@
+package org.onap.so.simulator.scenarios.openstack;
+
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
+import com.consol.citrus.simulator.scenario.Scenario;
+import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+
+@Scenario("Query-Replace-ID-Name-Resources")
+@RequestMapping(value = "/sim/v1/tenantOne/stacks/replace_module/stackId/resources", method = RequestMethod.GET)
+public class QueryResourcesByStackNameModuleReplace extends AbstractSimulatorScenario {
+
+ @Override
+ public void run(ScenarioDesigner scenario) {
+ scenario.http().receive().get();
+
+ scenario.variable("stackName", "replace_module");
+
+ scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json")
+ .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json"));
+
+ }
+}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplaceVolume.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplaceVolume.java
new file mode 100644
index 0000000000..f6eebeb09e
--- /dev/null
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryResourcesByStackNameModuleReplaceVolume.java
@@ -0,0 +1,26 @@
+package org.onap.so.simulator.scenarios.openstack;
+
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
+import com.consol.citrus.simulator.scenario.Scenario;
+import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+
+@Scenario("Query-Replace-Volume-ID-Name-Resources")
+@RequestMapping(value = "/sim/v1/tenantOne/stacks/replace_module_volume_id/stackId/resources",
+ method = RequestMethod.GET)
+public class QueryResourcesByStackNameModuleReplaceVolume extends AbstractSimulatorScenario {
+
+ @Override
+ public void run(ScenarioDesigner scenario) {
+ scenario.http().receive().get();
+
+ scenario.variable("stackName", "replace_module_volume_id");
+
+ scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json")
+ .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json"));
+
+ }
+}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java
index e13a23f397..eb306ccd6f 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro1.java
@@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
@Scenario("Openstack-Query-Stack-Resources-Macro1")
-@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_1/resources", method = RequestMethod.GET)
+@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_1/stackId/resources", method = RequestMethod.GET)
public class QueryResourcesByStackNameMacro1 extends AbstractSimulatorScenario {
@@ -17,8 +17,8 @@ public class QueryResourcesByStackNameMacro1 extends AbstractSimulatorScenario {
public void run(ScenarioDesigner scenario) {
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json"));
+ scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json")
+ .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json"));
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java
index 580714ded2..d2551a2fb3 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro2.java
@@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
@Scenario("Openstack-Query-Stack-Resources-Macro2")
-@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_2/resources", method = RequestMethod.GET)
+@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_2/stackId/resources", method = RequestMethod.GET)
public class QueryResourcesByStackNameMacro2 extends AbstractSimulatorScenario {
@@ -17,8 +17,8 @@ public class QueryResourcesByStackNameMacro2 extends AbstractSimulatorScenario {
public void run(ScenarioDesigner scenario) {
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json"));
+ scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json")
+ .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json"));
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java
index 096d2aa312..bb33f2c718 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryResourcesByStackNameMacro3.java
@@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
@Scenario("Openstack-Query-Stack-Resources-Macro3")
-@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_3/resources", method = RequestMethod.GET)
+@RequestMapping(value = "/sim/v1/tenantOne/stacks/macro_module_3/stackId/resources", method = RequestMethod.GET)
public class QueryResourcesByStackNameMacro3 extends AbstractSimulatorScenario {
@@ -17,8 +17,8 @@ public class QueryResourcesByStackNameMacro3 extends AbstractSimulatorScenario {
public void run(ScenarioDesigner scenario) {
scenario.http().receive().get();
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/GetStackResourcesMacro.json"));
+ scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json")
+ .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json"));
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java
index b590966e2f..77cc0054cc 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/resources/QueryResourcesByBaseStackName.java
@@ -9,7 +9,7 @@ import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
@Scenario("Openstack-Query-Base-Stack-Resources")
-@RequestMapping(value = "/sim/v1/tenantOne/stacks/base_module_id/resources", method = RequestMethod.GET)
+@RequestMapping(value = "/sim/v1/tenantOne/stacks/base_module_id/stackId/resources", method = RequestMethod.GET)
public class QueryResourcesByBaseStackName extends AbstractSimulatorScenario {
@@ -19,8 +19,8 @@ public class QueryResourcesByBaseStackName extends AbstractSimulatorScenario {
scenario.variable("stackName", "dummy_id");
- scenario.http().send().response(HttpStatus.OK)
- .payload(new ClassPathResource("openstack/gr_api/GetStackResources.json"));
+ scenario.http().send().response(HttpStatus.OK).header("ContentType", "application/json")
+ .payload(new ClassPathResource("openstack/gr_api/zrdm52emccr01_base_resources.json"));
}
diff --git a/so-simulator/src/main/resources/openstack/gr_api/zrdm52emccr01_base_resources.json b/so-simulator/src/main/resources/openstack/gr_api/zrdm52emccr01_base_resources.json
new file mode 100644
index 0000000000..0a47889c33
--- /dev/null
+++ b/so-simulator/src/main/resources/openstack/gr_api/zrdm52emccr01_base_resources.json
@@ -0,0 +1,122 @@
+{
+ "resources" : [ {
+ "resource_name" : "oam_security_group",
+ "links" : [ {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e/resources/oam_security_group",
+ "rel" : "self"
+ }, {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e",
+ "rel" : "stack"
+ } ],
+ "resource_status" : "CREATE_COMPLETE",
+ "physical_resource_id" : "f83b7f23-ce5e-41bf-8dbf-ae53e905db7c",
+ "logical_resource_id" : "oam_security_group",
+ "required_by" : [ "cpm_0_oam_protected1_port_0" ],
+ "updated_time" : "2019-05-28T15:19:10Z",
+ "creation_time" : "2019-05-28T15:19:10Z",
+ "resource_type" : "OS::Neutron::SecurityGroup",
+ "resource_status_reason" : "state changed"
+ }, {
+ "resource_name" : "cpm_0_sd_base2_port_0",
+ "links" : [ {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e/resources/cpm_0_sd_base2_port_0",
+ "rel" : "self"
+ }, {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e",
+ "rel" : "stack"
+ } ],
+ "resource_status" : "CREATE_COMPLETE",
+ "physical_resource_id" : "803b18b6-e9ba-4fe8-93eb-4a68832b2869",
+ "logical_resource_id" : "cpm_0_sd_base2_port_0",
+ "required_by" : [ "cpm_server_0" ],
+ "updated_time" : "2019-05-28T15:19:10Z",
+ "creation_time" : "2019-05-28T15:19:10Z",
+ "resource_type" : "OS::Neutron::Port",
+ "resource_status_reason" : "state changed"
+ }, {
+ "resource_name" : "cpm_0_sd_base1_port_0",
+ "links" : [ {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e/resources/cpm_0_sd_base1_port_0",
+ "rel" : "self"
+ }, {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e",
+ "rel" : "stack"
+ } ],
+ "resource_status" : "CREATE_COMPLETE",
+ "physical_resource_id" : "56610b2d-6e58-451b-9eb7-5f516f85a458",
+ "logical_resource_id" : "cpm_0_sd_base1_port_0",
+ "required_by" : [ "cpm_server_0" ],
+ "updated_time" : "2019-05-28T15:19:10Z",
+ "creation_time" : "2019-05-28T15:19:10Z",
+ "resource_type" : "OS::Neutron::Port",
+ "resource_status_reason" : "state changed"
+ }, {
+ "resource_name" : "cpm_0_sd_eastwest2_port_0",
+ "links" : [ {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e/resources/cpm_0_sd_eastwest2_port_0",
+ "rel" : "self"
+ }, {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e",
+ "rel" : "stack"
+ } ],
+ "resource_status" : "CREATE_COMPLETE",
+ "physical_resource_id" : "67aaf2a1-2ada-4322-8603-dceec9b456a6",
+ "logical_resource_id" : "cpm_0_sd_eastwest2_port_0",
+ "required_by" : [ "cpm_server_0" ],
+ "updated_time" : "2019-05-28T15:19:10Z",
+ "creation_time" : "2019-05-28T15:19:10Z",
+ "resource_type" : "OS::Neutron::Port",
+ "resource_status_reason" : "state changed"
+ }, {
+ "resource_name" : "cpm_0_sd_eastwest1_port_0",
+ "links" : [ {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e/resources/cpm_0_sd_eastwest1_port_0",
+ "rel" : "self"
+ }, {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e",
+ "rel" : "stack"
+ } ],
+ "resource_status" : "CREATE_COMPLETE",
+ "physical_resource_id" : "8b5392c9-d3aa-41f4-85ee-a3223182e455",
+ "logical_resource_id" : "cpm_0_sd_eastwest1_port_0",
+ "required_by" : [ "cpm_server_0" ],
+ "updated_time" : "2019-05-28T15:19:10Z",
+ "creation_time" : "2019-05-28T15:19:10Z",
+ "resource_type" : "OS::Neutron::Port",
+ "resource_status_reason" : "state changed"
+ }, {
+ "resource_name" : "cpm_0_oam_protected1_port_0",
+ "links" : [ {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e/resources/cpm_0_oam_protected1_port_0",
+ "rel" : "self"
+ }, {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e",
+ "rel" : "stack"
+ } ],
+ "resource_status" : "CREATE_COMPLETE",
+ "physical_resource_id" : "4eec349e-be73-41ae-9457-69d31f3a9305",
+ "logical_resource_id" : "cpm_0_oam_protected1_port_0",
+ "required_by" : [ "cpm_server_0" ],
+ "updated_time" : "2019-05-28T15:19:10Z",
+ "creation_time" : "2019-05-28T15:19:10Z",
+ "resource_type" : "OS::Neutron::Port",
+ "resource_status_reason" : "state changed"
+ }, {
+ "resource_name" : "cpm_server_0",
+ "links" : [ {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e/resources/cpm_server_0",
+ "rel" : "self"
+ }, {
+ "href" : "https://test.onap.org/v1/c162d85d27d54186b699935fd535c57a/stacks/stack_name/cb5e288d-e21f-49ee-87d0-5a2bd6be446e",
+ "rel" : "stack"
+ } ],
+ "resource_status" : "CREATE_COMPLETE",
+ "physical_resource_id" : "635a609d-bb2b-446c-b955-8fc5a4ba4b8d",
+ "logical_resource_id" : "cpm_server_0",
+ "required_by" : [ ],
+ "updated_time" : "2019-05-28T15:19:10Z",
+ "creation_time" : "2019-05-28T15:19:10Z",
+ "resource_type" : "OS::Nova::Server",
+ "resource_status_reason" : "state changed"
+ } ]
+} \ No newline at end of file