aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java3
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java52
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java10
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql23
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java19
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql24
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java91
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java132
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java)8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java)13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java)10
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java)9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java191
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java92
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java207
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java59
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java47
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java)8
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java)4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java)17
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java82
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java82
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java113
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml66
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java21
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java2
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java9
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java33
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy676
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java56
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn336
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn67
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java54
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy851
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy978
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy854
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy (renamed from bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy75
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn9
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn9
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn6
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn7
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn7
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn68
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json13
-rw-r--r--common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java11
-rw-r--r--common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java (renamed from common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java)3
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java7
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java6
-rw-r--r--common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java (renamed from common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java)27
-rw-r--r--common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java38
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java73
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java88
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java69
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java12
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java9
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java11
-rw-r--r--releases/1.6.0.yaml33
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java52
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java16
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java32
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java15
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java16
-rw-r--r--version.properties2
110 files changed, 4415 insertions, 2234 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
index 47ba076e0e..1f6ff1408c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
@@ -58,7 +58,8 @@ public class MsoHeatEnvironmentEntry {
return;
byte[] b = this.rawEntry.toString().getBytes();
MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b);
- StringBuilder sb = null;
+ this.parameters = yaml.getParameterListFromEnvt();
+ StringBuilder sb = this.getResourceRegistryRawEntry();
if (yaml != null) {
this.parameters = yaml.getParameterListFromEnvt();
// this.resources = yaml.getResourceListFromEnvt();
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 97ba7828c0..62d9f068f9 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -132,7 +132,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
-
/**
* Create a new Stack in the specified cloud location and tenant. The Heat template and parameter map are passed in
* as arguments, along with the cloud access credentials. It is expected that parameters have been validated and
@@ -190,7 +189,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} else if (CREATE_FAILED.equals(currentStack.getStackStatus())
|| DELETE_FAILED.equals(currentStack.getStackStatus())) {
try {
- processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack, true);
+ if (pollForCompletion) {
+ processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack,
+ true);
+ }
} catch (MsoException e) {
if (e instanceof StackCreationException) {
logger.warn("Error during Stack will attempt to recreate stack");
@@ -199,9 +201,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (pollForCompletion) {
currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout,
currentStack, createStack, true);
- } else {
- currentStack = queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(),
- cloudSiteId, tenantId);
}
} else {
throw e;
@@ -214,9 +213,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (pollForCompletion) {
currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack,
createStack, true);
- } else {
- currentStack =
- queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
}
operationPerformed = true;
}
@@ -266,6 +262,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
Stack heatStack, CreateStackParam stackCreate, boolean keyPairCleanUp) throws MsoException {
Stack latestStack = null;
try {
+
latestStack =
pollStackForStatus(timeoutMinutes, heatStack, CREATE_IN_PROGRESS, cloudSiteId, tenantId, false);
} catch (MsoException me) {
@@ -275,7 +272,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
stackCreate);
}
- protected Stack postProcessStackCreate(Stack stack, boolean backout, int timeoutMinutes, boolean cleanUpKeyPair,
+ public Stack postProcessStackCreate(Stack stack, boolean backout, int timeoutMinutes, boolean cleanUpKeyPair,
String cloudSiteId, String tenantId, CreateStackParam stackCreate) throws MsoException {
boolean stackCreationFailed = false;
boolean stackRollbackFailed = false;
@@ -325,7 +322,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
- protected Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
+ public Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
String tenantId, boolean notFoundIsSuccess) throws MsoException {
int pollingFrequency =
Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
@@ -334,7 +331,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
Heat heatClient = getHeatClient(cloudSiteId, tenantId);
while (true) {
- Stack latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
+ String stackName = stack.getStackName() + "/" + stack.getId();
+ if (stack.getId() == null) {
+ stackName = stack.getStackName();
+ }
+ Stack latestStack = queryHeatStack(heatClient, stackName);
if (latestStack == null && notFoundIsSuccess) {
return null;
} else if (latestStack != null) {
@@ -385,27 +386,33 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
protected Stack handleUnknownCreateStackFailure(Stack stack, int timeoutMinutes, String cloudSiteId,
String tenantId) throws MsoException {
if (stack != null && !Strings.isNullOrEmpty(stack.getStackName()) && !Strings.isNullOrEmpty(stack.getId())) {
- return deleteStack(stack, timeoutMinutes, cloudSiteId, tenantId);
+ return deleteStack(stack, timeoutMinutes, cloudSiteId, tenantId, false);
} else {
throw new StackCreationException("Cannot Find Stack Name or Id");
}
}
- private Stack deleteStack(Stack stack, int timeoutMinutes, String cloudSiteId, String tenantId)
- throws MsoException {
+ private Stack deleteStack(Stack stack, int timeoutMinutes, String cloudSiteId, String tenantId,
+ boolean pollForCompletion) throws MsoException {
OpenStackRequest<Void> request = getHeatClient(cloudSiteId, tenantId).getStacks()
.deleteByName(stack.getStackName() + "/" + stack.getId());
executeAndRecordOpenstackRequest(request);
- Stack currentStack = pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId, true);
- if (currentStack == null) {
+ logger.debug("Completed Executing executeAndRecordOpenstackRequest");
+ if (pollForCompletion == true) {
+ Stack currentStack =
+ pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId, true);
+ if (currentStack == null) {
+ return currentStack;
+ }
+ postProcessStackDelete(currentStack);
return currentStack;
} else {
- postProcessStackDelete(currentStack);
+ logger.debug("Returning the stack");
+ return stack;
}
- return currentStack;
}
- protected void postProcessStackDelete(Stack stack) throws MsoException {
+ public void postProcessStackDelete(Stack stack) throws MsoException {
logger.info("Performing post processing on delete stack {}", stack);
if (stack != null && !Strings.isNullOrEmpty(stack.getStackStatus())) {
if (!DELETE_COMPLETE.equals(stack.getStackStatus()))
@@ -503,10 +510,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
stackInfo = new StackInfo(stackName, HeatStatus.NOTFOUND);
stackInfo.setOperationPerformed(false);
} else {
- currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId);
+ currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId, pollForCompletion);
stackInfo = new StackInfoMapper(currentStack).map();
stackInfo.setName(stackName);
stackInfo.setOperationPerformed(true);
+ if (currentStack != null) {
+ stackInfo.setCanonicalName(currentStack.getStackName() + "/" + currentStack.getId());
+ }
}
return stackInfo;
}
@@ -632,7 +642,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return queryHeatStack(getHeatClient(cloudSiteId, tenantId), stackName);
}
-
+ // TODO enhancement - just have this return the stack then we dont have to query again in deleteStack
public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner, String tenantId,
String stackName) throws MsoException {
logger.debug("MsoHeatUtils.queryStackForOutputs)");
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index 0f9f7a273e..4938bff748 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -264,9 +264,9 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
Mockito.verify(heatUtils, times(1)).executeAndRecordOpenstackRequest(mockDeleteStack);
- Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId,
+ Mockito.verify(heatUtils, times(0)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId,
true);
- Mockito.verify(heatUtils, times(1)).postProcessStackDelete(deletedStack);
+ Mockito.verify(heatUtils, times(0)).postProcessStackDelete(deletedStack);
}
@@ -324,8 +324,6 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
CreateStackParam createStackParam = new CreateStackParam();
createStackParam.setStackName("stackName");
- // doReturn(mockResources).when(heatUtils).queryStackResources(cloudSiteId, tenantId, "stackName", 2);
- // doNothing().when(novaClient).deleteKeyPair(cloudSiteId, tenantId, "KeypairName");
doReturn(null).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
doReturn(createdStack).when(heatUtils).createStack(createStackParam, cloudSiteId, tenantId);
doReturn(createdStack).when(heatUtils).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack,
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
index 5f93765688..5f4d9d3eab 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
@@ -44,15 +44,15 @@ public class VfModuleRollback {
public VfModuleRollback(VnfRollback vrb, String vfModuleId, String vfModuleStackId, String messageId) {
this.vnfId = vrb.getVnfId();
- this.vfModuleId = vfModuleId;
- this.vfModuleStackId = vfModuleStackId;
this.vfModuleCreated = vrb.getVnfCreated();
this.tenantId = vrb.getTenantId();
this.cloudOwner = vrb.getCloudOwner();
this.cloudSiteId = vrb.getCloudSiteId();
this.msoRequest = vrb.getMsoRequest();
- this.messageId = messageId;
this.mode = vrb.getMode();
+ this.vfModuleId = vfModuleId;
+ this.vfModuleStackId = vfModuleStackId;
+ this.messageId = messageId;
}
public VfModuleRollback(String vnfId, String vfModuleId, String vfModuleStackId, boolean vfModuleCreated,
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index e5daf24d6c..b70d409cd8 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -30,7 +30,8 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'),
('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'),
('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'DEFAULT', '*'),
-('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*');
+('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'),
+('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
@@ -198,9 +199,16 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
('VNF-InPlaceUpdate', '15', 'VNFResumeTrafficActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
('VNF-InPlaceUpdate', '16', 'VNFUnlockActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
('VNF-InPlaceUpdate', '17', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
-('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT'));
-
-
+('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '1', 'VNFCheckPserversLockedFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '2', 'VNFCheckInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '3', 'VNFSetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '4', 'VNFSetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '5', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '6', 'VNFConfigModifyActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '7', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '8', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '9', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT'));
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY)
VALUES
@@ -860,7 +868,8 @@ VALUES
('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'),
-('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM');
+('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'),
+('VNFConfigModifyActivity', 'NO_VALIDATE', 'CUSTOM');
UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE IS NULL;
@@ -881,6 +890,10 @@ UPDATE vnf_recipe
SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB'
WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'inPlaceSoftwareUpdate';
+UPDATE vnf_recipe
+SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB'
+WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig';
+
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
VALUES
('VNFCheckPserversLockedFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
index 440270e047..0ffc213a4e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
@@ -30,13 +30,13 @@ import java.util.List;
import javax.transaction.Transactional;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClientPortChanger;
@@ -44,9 +44,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTest {
@@ -149,4 +146,16 @@ public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTes
assertNotNull(collectionNetworkCust);
logger.debug(collectionNetworkCust.getModelCustomizationUUID());
}
+
+ @Test
+ public void getCvnfcCustomization() {
+ client.getServiceByID(serviceUUID);
+ String vfId = "cb82ffd8-252a-11e7-93ae-92361f002671";
+ String vnfId = "68dc9a92-214c-11e7-93ae-92361f002671";
+
+ CvnfcConfigurationCustomization fabricConfig =
+ client.getCvnfcCustomization(serviceUUID, vnfId, vfId, "dadc2c8c-2bab-11e9-b210-d663bd873d95");
+ assertEquals("386c9aa7-9318-48ee-a6d1-1bf0f85de385", fabricConfig.getModelCustomizationUUID());
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 32c51293c2..8fd171bf64 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -213,8 +213,30 @@ VALUES ( '1',
'testNfcFunction',
'testNfcNamingCode',
'2018-07-17 14:05:08',
+ '9bcce658-9b37-11e8-98d0-529269fb1459',1),
+ ( '2',
+ 'dadc2c8c-2bab-11e9-b210-d663bd873d95',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'testToscaNodeType',
+ 'testCvnfcCustomzationDescription',
+ 'testNfcFunction',
+ 'testNfcNamingCode',
+ '2018-07-17 14:05:08',
'9bcce658-9b37-11e8-98d0-529269fb1459',1);
+
+
+INSERT IGNORE INTO `configuration` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `TOSCA_NODE_TYPE`, `DESCRIPTION`, `CREATION_TIMESTAMP`) VALUES
+ ('d2195b0e-307a-4d30-b82f-9c82001d965e', '2f0a4b7a-dfdb-4f82-a2ab-b65d1ddd5e8e', '13.0', 'Fabric Configuration', 'org.openecomp.nodes.FabricConfiguration', 'A fabric Configuration object', '2019-06-04 20:12:20');
+
+INSERT IGNORE INTO `cvnfc_configuration_customization` (`MODEL_CUSTOMIZATION_UUID`, `MODEL_INSTANCE_NAME`, `CONFIGURATION_TYPE`, `CONFIGURATION_ROLE`, `CONFIGURATION_FUNCTION`, `POLICY_NAME`, `CREATION_TIMESTAMP`, `CONFIGURATION_MODEL_UUID`, `CVNFC_CUSTOMIZATION_ID`) VALUES
+ ('386c9aa7-9318-48ee-a6d1-1bf0f85de385', 'Fabric Configuration 0', '5G', 'Fabric Config', 'Network Cloud', 'Config_MS_fabric_configuration_FRWL.1.xml', '2019-06-04 20:12:20', 'd2195b0e-307a-4d30-b82f-9c82001d965e', '2');
+
+
insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen');
@@ -231,4 +253,4 @@ insert into workflow(artifact_uuid, artifact_name, name, operation_name, version
('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values
-('ff2ae348-214a-11e7-93ae-92361f002671', '1');
+('ff2ae348-214a-11e7-93ae-92361f002671', '1'); \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
deleted file mode 100644
index 7cc7c02f23..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.audit;
-
-import javax.annotation.PostConstruct;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.onap.so.utils.ExternalTaskServiceUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-@Profile("!test")
-public class AuditStackService {
-
- private static final String MSO_AUDIT_LOCK_TIME = "mso.audit.lock-time";
-
- private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
-
- private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
-
- private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
-
-
- @Autowired
- public Environment env;
-
- @Autowired
- private AuditCreateStackService auditCreateStack;
-
- @Autowired
- private AuditDeleteStackService auditDeleteStack;
-
- @Autowired
- private AuditQueryStackService auditQueryStack;
-
- @Autowired
- private ExternalTaskServiceUtils externalTaskServiceUtils;
-
- @PostConstruct
- public void auditAddAAIInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryAddAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditCreateStack::executeExternalTask).open();
- }
- }
-
- @PostConstruct
- public void auditDeleteAAIInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryDeleteAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditDeleteStack::executeExternalTask).open();
- }
- }
-
- @PostConstruct
- public void auditQueryInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryQueryAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditQueryStack::executeExternalTask).open();
- }
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
deleted file mode 100644
index 4ab4d14dac..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.inventory.create;
-
-import javax.annotation.PostConstruct;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.onap.so.utils.ExternalTaskServiceUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-@Profile("!test")
-public class CreateInventoryService {
-
- @Autowired
- public Environment env;
-
- @Autowired
- private CreateInventoryTask createInventory;
-
- @Autowired
- private ExternalTaskServiceUtils externalTaskServiceUtils;
-
- @PostConstruct
- public void auditAAIInventory() throws Exception {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryCreate")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
- .handler(createInventory::executeExternalTask).open();
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index 257374fdb2..4728effdca 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -97,7 +97,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_CREATED_STATUS_MESSAGE =
"The new network was successfully created in the cloud";
private static final String NETWORK_NOT_EXIST_STATUS_MESSAGE =
- "The network as not found, thus no network was deleted in the cloud via this request";
+ "The network was not found, thus no network was deleted in the cloud via this request";
private static final String NETWORK_DELETED_STATUS_MESSAGE = "The network was successfully deleted in the cloud";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
new file mode 100644
index 0000000000..d282046b3f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.tasks;
+
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.onap.so.utils.ExternalTaskServiceUtils;
+import org.onap.so.adapters.tasks.audit.AuditCreateStackService;
+import org.onap.so.adapters.tasks.audit.AuditDeleteStackService;
+import org.onap.so.adapters.tasks.audit.AuditQueryStackService;
+import org.onap.so.adapters.tasks.inventory.CreateInventoryTask;
+import org.onap.so.adapters.tasks.orchestration.PollService;
+import org.onap.so.adapters.tasks.orchestration.RollbackService;
+import org.onap.so.adapters.tasks.orchestration.StackService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class TaskServices {
+
+ private static final Logger logger = LoggerFactory.getLogger(TaskServices.class);
+
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
+ @Autowired
+ private AuditCreateStackService auditCreateStack;
+
+ @Autowired
+ private AuditDeleteStackService auditDeleteStack;
+
+ @Autowired
+ private AuditQueryStackService auditQueryStack;
+
+ @Autowired
+ private CreateInventoryTask createInventory;
+
+ @Autowired
+ private StackService stackService;
+
+ @Autowired
+ private PollService pollService;
+
+ @Autowired
+ private RollbackService rollbackService;
+
+ @PostConstruct
+ public void auditAddAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryAddAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditCreateStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditDeleteAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryDeleteAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditDeleteStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditQueryInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryQueryAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditQueryStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryCreate").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(createInventory::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackInvoker() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterInvoke").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(stackService::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackPoller() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterPolling").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(pollService::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackRollback() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterRollback").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(rollbackService::executeExternalTask).open();
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
index ad28f0daeb..7622c1ba28 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
index ddd9fb1b5e..2f7155bffc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
@@ -19,14 +19,13 @@
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.Optional;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
-import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
index 8291fa9882..874823a7cd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -30,7 +30,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.RetrySequenceLevel;
import org.slf4j.Logger;
@@ -47,13 +47,13 @@ public class AuditCreateStackService extends AbstractAuditService {
public HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
+ public AuditMDCSetup mdcSetup;
public AuditCreateStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
index 1c707fe795..2c76acdb1b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.io.IOException;
import java.util.List;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
index cf077915c9..55cde4d174 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -28,7 +28,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,9 +45,6 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
-
- @Autowired
protected AuditVServer auditVservers;
@Autowired
@@ -56,11 +53,15 @@ public class AuditDeleteStackService extends AbstractAuditService {
@Autowired
protected Environment env;
+ @Autowired
+ public AuditMDCSetup mdcSetup;
+
public AuditDeleteStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
index 1c69a3e5e7..ebef4425eb 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -7,7 +7,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,16 +23,16 @@ public class AuditQueryStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
+ protected AuditDataService auditDataService;
@Autowired
- protected AuditDataService auditDataService;
+ public AuditMDCSetup mdcSetup;
public AuditQueryStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
boolean success = false;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
index 585e001f1a..63853c34fa 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.List;
import java.util.Optional;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
index ffa76cf8ee..1554881193 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.net.URI;
import java.util.Arrays;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index 69e16986da..a3cb99e3af 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import java.util.Optional;
import java.util.stream.Stream;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
index e02258c619..04dcd9ff61 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
@@ -20,13 +20,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
@@ -48,13 +48,14 @@ public class CreateInventoryTask extends ExternalTaskUtils {
CreateAAIInventory createInventory;
@Autowired
- private AuditMDCSetup mdcSetup;
+ public AuditMDCSetup mdcSetup;
public CreateInventoryTask() {
super(RetrySequenceLevel.SHORT);
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
boolean success = true;
boolean inventoryException = false;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java
index ed31c1c67e..7df3822961 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
public class InventoryException extends Exception {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
new file mode 100644
index 0000000000..6e181c4696
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
@@ -0,0 +1,191 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.onap.so.utils.RetrySequenceLevel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.heat.model.Stack;
+
+@Component
+public class PollService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(PollService.class);
+
+ @Autowired
+ private MsoHeatUtils msoHeatUtils;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public PollService() {
+ super(RetrySequenceLevel.SHORT);
+ }
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ logger.trace("Executing External Task Poll Service");
+ Map<String, Object> variables = new HashMap<>();
+ MutableBoolean success = new MutableBoolean();
+ String errorMessage = null;
+ try {
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ if (xmlRequest != null) {
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ determineCreateVolumeGroupStatus(xmlRequest, externalTask, success);
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ determineCreateVfModuleStatus(xmlRequest, externalTask, success);
+ } else if ("deleteVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Poll Service for Delete Vf Module");
+ DeleteVfModuleRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Poll Service for Delete Volume Group");
+ DeleteVolumeGroupRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Poll Service", e);
+ errorMessage = e.getMessage();
+ }
+
+ variables.put("OpenstackPollSuccess", success.booleanValue());
+ variables.put("openstackAdapterErrorMessage", errorMessage);
+ if (success.isTrue()) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ if (externalTask.getRetries() == null) {
+ logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
+ externalTask.getId(), getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, "errorMessage", "errorDetails",
+ getRetrySequence().length, 10000);
+ } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ } else {
+ logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: {}",
+ externalTask.getId(), externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ externalTaskService.handleFailure(externalTask, "errorMessage", "errorDetails",
+ externalTask.getRetries() - 1, calculateRetryDelay(externalTask.getRetries()));
+ }
+ }
+ }
+
+ private void determineCreateVolumeGroupStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
+ throws MsoException {
+ CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Volume Group");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+
+ private void determineCreateVfModuleStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
+ throws MsoException {
+ CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Vf Module");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ logger.debug("Executing External Task Poll Service for Create Vf Module");
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+
+ private void pollCreateResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack stack =
+ msoHeatUtils.pollStackForStatus(1, currentStack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
+ msoHeatUtils.postProcessStackCreate(stack, false, 0, false, cloudSiteId, tenantId, null);
+ success.setTrue();
+ }
+
+ private void pollDeleteResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack stack =
+ msoHeatUtils.pollStackForStatus(1, currentStack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId, true);
+ if (stack != null) { // if stack is null it was not found and no need to do post process
+ msoHeatUtils.postProcessStackDelete(stack);
+ }
+ success.setTrue();
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+
+ private Stack createCurrentStack(String canonicalStackId) {
+ Stack currentStack = new Stack();
+ String stackName = canonicalStackId;
+ if (canonicalStackId.contains("/")) {
+ String[] stacks = canonicalStackId.split("/");
+ stackName = stacks[0];
+ currentStack.setId(stacks[1]);
+ }
+ currentStack.setStackName(stackName);
+ return currentStack;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
new file mode 100644
index 0000000000..c302293169
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
@@ -0,0 +1,92 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RollbackService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(RollbackService.class);
+
+ @Autowired
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ logger.trace("Executing External Task Rollback Service");
+ Map<String, Object> variables = new HashMap<>();
+ boolean success = false;
+ boolean pollRollbackStatus = false;
+ try {
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ if (xmlRequest != null) {
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Rollback Service for Create Volume Group");
+ CreateVolumeGroupRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupName(), req.getMsoRequest(), false);
+ pollRollbackStatus = true;
+ success = true;
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Rollback Service for Create Vf Module");
+ CreateVfModuleRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleName(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
+ req.getMsoRequest(), new Holder<>());
+ pollRollbackStatus = true;
+ success = true;
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Rollback Service", e);
+ }
+ variables.put("OpenstackRollbackSuccess", success);
+ variables.put("rollbackPerformed", true);
+ variables.put("PollRollbackStatus", pollRollbackStatus);
+ if (success) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ logger.debug("The External Task Id: {} Failed. Not Retrying", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ }
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
new file mode 100644
index 0000000000..34952a056b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
@@ -0,0 +1,207 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.ws.Holder;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.VfModuleRollback;
+import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class StackService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(StackService.class);
+
+ @Autowired
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ Map<String, Object> variables = new HashMap<>();
+ mdcSetup.setupMDC(externalTask);
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ logger.debug("Executing External Task Stack Service. {}", xmlRequest);
+ MutableBoolean success = new MutableBoolean();
+ MutableBoolean backout = new MutableBoolean();
+ String response = "";
+ Holder<String> canonicalStackId = new Holder<>();
+ String errorMessage = "";
+ try {
+ if (xmlRequest != null) {
+ Holder<Map<String, String>> outputs = new Holder<>();
+ Holder<VnfRollback> vnfRollback = new Holder<>();
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Create Volume Group");
+ response = createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Create Vf Module");
+ response = createVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("deleteVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Delete Vf Module");
+ response = deleteVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Delete Volume Group");
+ response = deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Stack Service", e);
+ errorMessage = e.getMessage();
+ }
+ variables.put("backout", backout.booleanValue());
+ variables.put("WorkflowResponse", response);
+ variables.put("OpenstackInvokeSuccess", success.booleanValue());
+ variables.put("stackId", canonicalStackId.value);
+ variables.put("openstackAdapterErrorMessage", errorMessage);
+ variables.put("PollRollbackStatus", false);
+ variables.put("rollbackPerformed", false);
+ variables.put("OpenstackRollbackSuccess", false);
+ variables.put("OpenstackPollSuccess", false);
+
+ if (success.isTrue()) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ logger.debug("The External Task Id: {} Failed. Not Retrying", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ }
+ }
+
+ private String createVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ Holder<String> stackId = new Holder<>();
+ CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null, null,
+ req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true, req.getEnableBridge(),
+ req.getMsoRequest(), stackId, outputs, vnfRollback);
+ success.setTrue();
+ backout.setValue(!req.getSuppressBackout());
+ VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
+ vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
+ req.getMsoRequest(), req.getMessageId());
+ canonicalStackId.value = stackId.value;
+ CreateVolumeGroupResponse createResponse = new CreateVolumeGroupResponse(req.getVolumeGroupId(), stackId.value,
+ vnfRollback.value.getVnfCreated(), outputs.value, rb, req.getMessageId());
+ return createResponse.toXmlString();
+ }
+
+ private String createVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ Holder<String> stackId = new Holder<>();
+ CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
+ req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(),
+ req.getModelCustomizationUuid(), req.getVfModuleParams(), false, false, req.getEnableBridge(),
+ req.getMsoRequest(), stackId, outputs, vnfRollback);
+ success.setTrue();
+ backout.setValue(req.getBackout());
+ canonicalStackId.value = stackId.value;
+ VfModuleRollback modRollback =
+ new VfModuleRollback(vnfRollback.value, req.getVfModuleId(), stackId.value, req.getMessageId());
+ CreateVfModuleResponse createResponse = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
+ stackId.value, Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
+ return createResponse.toXmlString();
+ }
+
+ private String deleteVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ backout.setFalse();
+ DeleteVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
+ req.getMsoRequest(), outputs);
+ success.setTrue();
+ if (outputs != null && outputs.value != null) {
+ canonicalStackId.value = outputs.value.get("canonicalStackId");
+ } else {
+ canonicalStackId.value = req.getVfModuleStackId();
+ }
+ DeleteVfModuleResponse deleteResponse = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
+ Boolean.TRUE, req.getMessageId(), outputs.value);
+ return deleteResponse.toXmlString();
+ }
+
+ private String deleteVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ backout.setFalse();
+ DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
+
+ vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupStackId(), req.getMsoRequest(), false);
+ success.setTrue();
+ canonicalStackId.value = req.getVolumeGroupStackId();
+ DeleteVolumeGroupResponse deleteResponse = new DeleteVolumeGroupResponse(true, req.getMessageId());
+ return deleteResponse.toXmlString();
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 60c5a0ca2a..5951fda16e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -104,8 +104,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String DELETE_VNF = "DeleteVNF";
private static final String QUERY_STACK = "QueryStack";
private static final String CREATE_VFM_MODULE = "CreateVFModule";
- private static final String CREATE_VF_STACK = "Create VF: Stack";
- private static final String STACK = "Stack";
private static final String USER_ERROR = "USER ERROR";
private static final String VERSION_MIN = "VersionMin";
private static final String VERSION_MAX = "VersionMax";
@@ -113,7 +111,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
"The vf module was found to already exist, thus no new vf module was created in the cloud via this request";
private static final String VF_CREATED_STATUS_MESSAGE = "The new vf module was successfully created in the cloud";
private static final String VF_NOT_EXIST_STATUS_MESSAGE =
- "The vf module was not, thus no vf module was deleted in the cloud via this request";
+ "The vf module was not found, thus no vf module was deleted in the cloud via this request";
private static final String VF_DELETED_STATUS_MESSAGE = "The vf module was successfully deleted in the cloud";
@Autowired
@@ -323,6 +321,42 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
/**
+ * This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud
+ * and tenant.
+ *
+ * The method has no outputs.
+ *
+ * @param cloudSiteId CLLI code of the cloud site in which to delete
+ * @param cloudOwner cloud owner of the cloud region in which to delete
+ * @param tenantId Openstack tenant identifier
+ * @param vnfName VNF Name or Openstack ID
+ * @param msoRequest Request tracking information for logs
+ */
+ public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest,
+ boolean pollStackStatus) throws VnfException {
+
+ logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
+
+ try {
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, pollStackStatus, 118);
+ } catch (MsoException me) {
+ me.addContext(DELETE_VNF);
+ // Failed to query the Stack due to an openstack exception.
+ // Convert to a generic VnfException
+ String error =
+ "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
+ logger.debug(error);
+ throw new VnfException(me);
+ }
+
+ // On success, nothing is returned.
+ return;
+ }
+
+
+ /**
* This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
* client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
* to undo the creation.
@@ -536,6 +570,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge,
MsoRequest msoRequest, Holder<String> vnfId, Holder<Map<String, String>> outputs,
Holder<VnfRollback> rollback) throws VnfException {
+ boolean pollForCompletion = false;
String vfModuleName = vnfName;
String vfModuleType = vnfType;
String vfVersion = vnfVersion;
@@ -1050,11 +1085,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
if (msoHeatUtils != null) {
heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
- template, goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
- nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
+ template, goldenInputs, pollForCompletion, heatTemplate.getTimeoutMinutes(),
+ newEnvironmentString, nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(),
+ failIfExists);
if (msoRequest.getRequestId() != null) {
msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- heatStack.isOperationPerformed() ? VF_EXIST_STATUS_MESSAGE : VF_CREATED_STATUS_MESSAGE);
+ heatStack.isOperationPerformed() ? VF_CREATED_STATUS_MESSAGE : VF_EXIST_STATUS_MESSAGE);
}
} else {
throw new MsoHeatNotFoundException();
@@ -1135,10 +1171,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
try {
- StackInfo stackInfo =
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
+ StackInfo currentStack =
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, false, timeoutMinutes);
+ if (currentStack != null && outputs != null && outputs.value != null) {
+ logger.debug("Adding canonical stack id to outputs " + currentStack.getCanonicalName());
+ outputs.value.put("canonicalStackId", currentStack.getCanonicalName());
+ }
msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- stackInfo.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
+ currentStack.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
+
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index 0836f69ba7..5b78d2f066 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -78,6 +78,7 @@ import io.swagger.annotations.ApiResponses;
* can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. For testing, call
* with cloudSiteId = ___TESTING___ To test exceptions, also set tenantId = ___TESTING___
*/
+@Deprecated
@Path("/v1/vnfs")
@Api(value = "/v1/vnfs", description = "root of vnf adapters restful web service")
@Transactional
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index 18ed9872a0..63b4c5d0f3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -39,7 +39,6 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
@@ -56,6 +55,7 @@ import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.entity.MsoRequest;
import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
@@ -78,6 +78,7 @@ import io.swagger.annotations.ApiResponses;
*
* V2 incorporates run-time selection of sub-orchestrator implementation (Heat or Cloudify) based on the target cloud.
*/
+@Deprecated
@Path("/v2/vnfs")
@Api(value = "/v2/vnfs", description = "root of vnf adapters restful web service v2")
@Component
@@ -189,10 +190,7 @@ public class VnfAdapterRestV2 {
}
String cloudsite = req.getCloudSiteId();
Holder<Map<String, String>> outputs = new Holder<>();
- if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
- // vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
- // req.getMsoRequest());
- // Support different Adapter Implementations
+ if (cloudsite != null) {
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite);
adapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index cfddbba34e..a424fa92fd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -174,33 +174,26 @@ public class VolumeAdapterRestV2 {
logger.debug("in createVfModuleVolumes - completeVnfVfModuleType={}", completeVnfVfModuleType);
String cloudsiteId = req.getCloudSiteId();
- if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) {
- String tenant = req.getTenantId();
- if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- stackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
- outputs.value = testMap();
- } else {
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
- vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
- req.getCloudOwner(), // cloudOwner,
- req.getTenantId(), // tenantId,
- completeVnfVfModuleType, // vnfType,
- req.getVnfVersion(), // vnfVersion,
- "", // genericVnfId
- req.getVolumeGroupName(), // vnfName,
- "", // vfModuleId
- "VOLUME", // requestType,
- null, // volumeGroupHeatStackId,
- null, // baseVfHeatStackId,
- req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
- req.getFailIfExists(), // failIfExists,
- req.getSuppressBackout(), // backout,
- req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
- stackId, outputs, vnfRollback);
- }
+
+ // Support different Adapter Implementations
+ MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
+ vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
+ req.getCloudOwner(), // cloudOwner,
+ req.getTenantId(), // tenantId,
+ completeVnfVfModuleType, // vnfType,
+ req.getVnfVersion(), // vnfVersion,
+ "", // genericVnfId
+ req.getVolumeGroupName(), // vnfName,
+ "", // vfModuleId
+ "VOLUME", // requestType,
+ null, // volumeGroupHeatStackId,
+ null, // baseVfHeatStackId,
+ req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
+ req.getFailIfExists(), // failIfExists,
+ req.getSuppressBackout(), // backout,
+ req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
+ stackId, outputs, vnfRollback);
+
VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
index d3380a6a33..d5f8f865a8 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
@@ -13,6 +13,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditDataService;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.beans.RequestProcessingData;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
index cff4d5f994..a10ab4b7df 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -36,8 +36,12 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.audit.AuditCreateStackService;
+import org.onap.so.adapters.tasks.audit.AuditDataService;
+import org.onap.so.adapters.tasks.audit.AuditQueryStackService;
+import org.onap.so.adapters.tasks.audit.HeatStackAudit;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
index 8e71ec46b0..af4afd41a1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
@@ -41,6 +41,7 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditVServer;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
index c995064ab2..d1d0d96042 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -43,6 +43,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditVServer;
+import org.onap.so.adapters.tasks.audit.HeatStackAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
index 8226f4fed8..e822f65072 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -38,6 +38,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
index c4fa9ee2c5..fc2baefcd5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -30,8 +30,11 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
+import org.onap.so.adapters.tasks.inventory.CreateInventoryTask;
+import org.onap.so.adapters.tasks.inventory.InventoryException;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -47,12 +50,12 @@ public class CreateInventoryTaskTest {
@Mock
ExternalTaskService externalTaskService;
- @Mock
- private AuditMDCSetup mdcSetup;
-
@InjectMocks
CreateInventoryTask inventoryTask;
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
new file mode 100644
index 0000000000..b5b0f5a8ef
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
@@ -0,0 +1,82 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.PollService;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PollServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private PollService pollService;
+
+ @Test
+ public void testExecuteExternalTask() throws MsoException, IOException {
+ String xmlString =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false);
+ Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
+ Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(false))).thenReturn(new Stack());
+ // Mockito.doNothing().when(msoHeatUtils).postProcessStackCreate(Mockito.any(), Mockito.any(), Mockito.any(),
+ // Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+
+ pollService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(msoHeatUtils).pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"),
+ eq("regionOne"), eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(false));
+
+ }
+
+ @Test
+ public void testExecuteExternalTask_rollback() throws MsoException, IOException {
+ String xmlString =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(true);
+ Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
+ Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(true))).thenReturn(new Stack());
+ Mockito.doNothing().when(msoHeatUtils).postProcessStackDelete(Mockito.any());
+
+
+ pollService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(msoHeatUtils).pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(true));
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
new file mode 100644
index 0000000000..f7613909ec
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
@@ -0,0 +1,82 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.RollbackService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RollbackServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private RollbackService rollbackService;
+
+
+ @Test
+ public void findRequestTypeTest() throws IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Optional<String> actual = rollbackService.findRequestType(payload);
+
+ assertEquals("createVfModuleRequest", actual.get());
+ }
+
+ @Test
+ public void testExecuteExternalTask() throws VnfException, MsoException, IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Stack stack = new Stack();
+ stack.setId("heatId");
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
+
+ rollbackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(vnfAdapterImpl, Mockito.times(1)).deleteVfModule(Mockito.eq("regionOne"),
+ Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"), Mockito.eq("dummy_id"),
+ Mockito.any(String.class), Mockito.any(String.class), Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.any());
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
new file mode 100644
index 0000000000..2f583b30a2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
@@ -0,0 +1,113 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.StackService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class StackServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private StackService stackService;
+
+ @Test
+ public void findRequestTypeTest() throws IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Optional<String> actual = stackService.findRequestType(payload);
+
+ assertEquals("createVfModuleRequest", actual.get());
+ }
+
+ @Test
+ public void testExecuteExternalTask() throws VnfException, MsoException, IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Stack stack = new Stack();
+ stack.setId("heatId");
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
+
+ stackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Map<String, Object> paramsMap = new HashMap<String, Object>();
+ paramsMap.put("vf_module_id", "985a468b-328b-4c2b-ad0e-b8f1e19501c4");
+ paramsMap.put("vnf_id", "6640feba-55f6-4946-9694-4d9558c8870a");
+ paramsMap.put("vnf_name", "Robot_VNF_For_Volume_Group");
+ paramsMap.put("availability_zone_0", "AZ-MN02");
+ paramsMap.put("environment_context", "General_Revenue-Bearing");
+ paramsMap.put("user_directives", "{}");
+ paramsMap.put("workload_context", "");
+ paramsMap.put("vf_module_name", "dummy_id");
+ paramsMap.put("vf_module_index", "0");
+ paramsMap.put("sdnc_directives",
+ "{ \"attributes\": [ {\"attribute_name\": \"availability_zone_0\", \"attribute_value\": \"AZ-MN02\"}] }");
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("backout", true);
+ variables.put("WorkflowResponse", "");
+ variables.put("OpenstackInvokeSuccess", true);
+ variables.put("stackId", null);
+ variables.put("openstackAdapterErrorMessage", null);
+ variables.put("PollRollbackStatus", false);
+ variables.put("rollbackPerformed", false);
+ variables.put("OpenstackRollbackSuccess", false);
+ variables.put("OpenstackPollSuccess", false);
+
+ Mockito.verify(vnfAdapterImpl, Mockito.times(1)).createVfModule(Mockito.eq("regionOne"),
+ Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"),
+ Mockito.eq(
+ "Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0::VfZrdm5bpxmc02092017Vf..pxmc_base..module-0"),
+ Mockito.eq("1.0"), Mockito.eq("6640feba-55f6-4946-9694-4d9558c8870a"), Mockito.eq("dummy_id"),
+ Mockito.eq("985a468b-328b-4c2b-ad0e-b8f1e19501c4"), Mockito.eq(null), Mockito.eq(null),
+ Mockito.eq(null), Mockito.eq("074c64d0-7e13-4bcc-8bdb-ea922331102d"), Mockito.eq(paramsMap),
+ Mockito.eq(false), Mockito.eq(false), Mockito.eq(null), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any());
+ Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.eq(variables));
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml b/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml
new file mode 100644
index 0000000000..c7c880ed92
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<createVfModuleRequest>
+ <messageId>7f4557c8-c3b9-4743-8b88-9539f9ed7bea</messageId>
+ <notificationUrl>http://mso-bpmn-infra-svc:9200/mso/WorkflowMessage/VNFAResponse/7f4557c8-c3b9-4743-8b88-9539f9ed7bea
+ </notificationUrl>
+ <skipAAI>true</skipAAI>
+ <cloudSiteId>regionOne</cloudSiteId>
+ <cloudOwner>CloudOwner</cloudOwner>
+ <tenantId>0422ffb57ba042c0800a29dc85ca70f8</tenantId>
+ <vnfId>6640feba-55f6-4946-9694-4d9558c8870a</vnfId>
+ <vnfType>Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0</vnfType>
+ <vnfVersion>1.0</vnfVersion>
+ <vfModuleId>985a468b-328b-4c2b-ad0e-b8f1e19501c4</vfModuleId>
+ <vfModuleName>dummy_id</vfModuleName>
+ <vfModuleType>VfZrdm5bpxmc02092017Vf..pxmc_base..module-0</vfModuleType>
+ <baseVfModuleId>985a468b-328b-4c2b-ad0e-b8f1e19501c4</baseVfModuleId>
+ <modelCustomizationUuid>074c64d0-7e13-4bcc-8bdb-ea922331102d</modelCustomizationUuid>
+ <failIfExists>false</failIfExists>
+ <backout>true</backout>
+ <vfModuleParams>
+ <entry>
+ <key>vf_module_id</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">985a468b-328b-4c2b-ad0e-b8f1e19501c4</value>
+ </entry>
+ <entry>
+ <key>vnf_id</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">6640feba-55f6-4946-9694-4d9558c8870a</value>
+ </entry>
+ <entry>
+ <key>vnf_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">Robot_VNF_For_Volume_Group</value>
+ </entry>
+ <entry>
+ <key>availability_zone_0</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">AZ-MN02</value>
+ </entry>
+ <entry>
+ <key>environment_context</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">General_Revenue-Bearing</value>
+ </entry>
+ <entry>
+ <key>user_directives</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{}</value>
+ </entry>
+ <entry>
+ <key>workload_context</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"/>
+ </entry>
+ <entry>
+ <key>vf_module_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">dummy_id</value>
+ </entry>
+ <entry>
+ <key>vf_module_index</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">0</value>
+ </entry>
+ <entry>
+ <key>sdnc_directives</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{ "attributes": [ {"attribute_name": "availability_zone_0", "attribute_value": "AZ-MN02"}] }</value>
+ </entry>
+ </vfModuleParams>
+ <msoRequest>
+ <requestId>049abdd8-0e19-48b8-bd87-b18f8d49048c</requestId>
+ <serviceInstanceId>7dc4c4eb-b1d7-4aef-94d1-24e925d1210c</serviceInstanceId>
+ </msoRequest>
+</createVfModuleRequest>
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
index b065e9a0c3..e5321067ac 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
@@ -1,5 +1,10 @@
package org.onap.so.adapters.appc.orchestrator.client.beans;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -14,6 +19,8 @@ public class ConfigurationParameters {
private String nodeList;
@JsonProperty("file_parameter_content")
private String fileParameterContent;
+ @JsonIgnore
+ private Map<String, String> additionalProperties = new HashMap<>();
@JsonProperty("vnf_name")
@@ -50,4 +57,18 @@ public class ConfigurationParameters {
this.fileParameterContent = fileParameterContent;
}
+ @JsonAnyGetter
+ public Map<String, String> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, String value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public void setAdditionalProperties(Map<String, String> map) {
+ this.additionalProperties = map;
+ }
+
}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
index db70a6b5cb..2b5e4b2553 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
@@ -6,7 +6,7 @@ import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerCallba
import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerSupport;
import org.onap.so.adapters.appc.orchestrator.client.StatusCategory;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.utils.ExternalTaskUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index a174ccb05a..99d6b4dc12 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -32,10 +32,10 @@ public class ApplicationControllerTaskImpl {
Optional<String> vserverId = Optional.empty();
Parameters parameters = new Parameters();
ConfigurationParameters configParams = new ConfigurationParameters();
+ RequestParameters requestParams = new RequestParameters();
switch (request.getAction()) {
case HealthCheck:
- RequestParameters requestParams = new RequestParameters();
requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
parameters.setRequestParameters(requestParams);
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
@@ -75,6 +75,12 @@ public class ApplicationControllerTaskImpl {
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
break;
case ConfigModify:
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ configParams.setAdditionalProperties(request.getConfigParams());
+ parameters.setRequestParameters(requestParams);
+ parameters.setConfigurationParameters(configParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
case ConfigScaleOut:
break;
case UpgradePreCheck:
@@ -97,6 +103,7 @@ public class ApplicationControllerTaskImpl {
vserverId = Optional
.of(request.getApplicationControllerVnf().getApplicationControllerVm().getVserverId());
}
+ break;
default:
// errorMessage = "Unable to idenify Action request for AppCClient";
break;
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index 640e2dbd6e..973430c37e 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -1,5 +1,7 @@
package org.onap.so.adapters.appc.orchestrator.service;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@@ -50,6 +52,10 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ Map<String, String> reqConfigParams = new HashMap<>();
+ reqConfigParams.put("name1", "value1");
+ reqConfigParams.put("name2", "value2");
+ request.setConfigParams(reqConfigParams);
ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf();
applicationControllerVnf.setVnfHostIpAddress("100.100");
applicationControllerVnf.setVnfId("testVnfId");
@@ -228,6 +234,33 @@ public class ApplicationControllerTaskImplTest {
}
@Test
+ public void testExcute_configModify() throws JsonProcessingException, ApplicationControllerOrchestratorException {
+ request.setAction(Action.ConfigModify);
+
+ Parameters parameters = new Parameters();
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ parameters.setRequestParameters(requestParams);
+ ConfigurationParameters configParams = new ConfigurationParameters();
+ Map<String, String> configParamMap = new HashMap<>();
+ configParamMap.put("name1", "value1");
+ configParamMap.put("name2", "value2");
+ configParams.setAdditionalProperties(configParamMap);
+ parameters.setConfigurationParameters(configParams);
+ Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+
+ Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener)).thenReturn(new Status());
+
+ Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
+
+ Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener);
+ }
+
+ @Test
public void testListener() throws Exception {
request.setAction(Action.QuiesceTraffic);
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java
index 228ee90107..179bdabc6b 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java
@@ -31,9 +31,9 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerCallback;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.appc.client.lcm.model.Status;
public class ApplicationControllerTaskTest extends ApplicationControllerTask {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index f524b96fa9..d023df3b79 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -2036,7 +2036,7 @@ public class ToscaResourceInstaller {
// ******************************************************************************************************************
List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>();
- Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<>();
+ List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<>();
Set<VnfcCustomization> vnfcCustomizations = new HashSet<>();
// Only set the CVNFC if this vfModule group is a member of it.
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index a6aacc7ea5..e8f842471c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -40,419 +40,419 @@ import java.util.UUID
import org.onap.so.utils.Components
-
+@Deprecated //Use vnfAdapterRestV2
class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class);
- ExceptionUtil exceptionUtil = new ExceptionUtil()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
- // VNF Response Processing
- public void preProcessRequest (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
+ // VNF Response Processing
+ public void preProcessRequest (DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
- def prefix="VNFREST_"
- execution.setVariable("prefix", prefix)
- setSuccessIndicator(execution, false)
+ def prefix="VNFREST_"
+ execution.setVariable("prefix", prefix)
+ setSuccessIndicator(execution, false)
- try {
- String request = validateRequest(execution, "mso-request-id")
+ try {
+ String request = validateRequest(execution, "mso-request-id")
- // Get the request type (the name of the root element) from the request
+ // Get the request type (the name of the root element) from the request
- Node root = new XmlParser().parseText(request)
- String requestType = root.name()
- execution.setVariable(prefix + 'requestType', requestType)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ Node root = new XmlParser().parseText(request)
+ String requestType = root.name()
+ execution.setVariable(prefix + 'requestType', requestType)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
- logger.debug('VnfAdapterRestV1, request: ' + request)
- // Get the messageId from the request
+ logger.debug('VnfAdapterRestV1, request: ' + request)
+ // Get the messageId from the request
- String messageId = getChildText(root, 'messageId')
+ String messageId = getChildText(root, 'messageId')
- if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- messageId = getMessageIdForVolumeGroupRollback(root)
- }
+ if ('rollbackVolumeGroupRequest'.equals(requestType)) {
+ messageId = getMessageIdForVolumeGroupRollback(root)
+ }
- if (messageId == null || messageId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no messageId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (messageId == null || messageId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no messageId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- execution.setVariable('VNFAResponse_CORRELATOR', messageId)
- logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
+ execution.setVariable('VNFAResponse_CORRELATOR', messageId)
+ logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
- // Get the notificationUrl from the request
+ // Get the notificationUrl from the request
- String notificationUrl = getChildText(root, 'notificationUrl')
+ String notificationUrl = getChildText(root, 'notificationUrl')
- if (notificationUrl == null || notificationUrl.isEmpty()) {
- String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (notificationUrl == null || notificationUrl.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- execution.setVariable(prefix + 'notificationUrl', notificationUrl)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
+ execution.setVariable(prefix + 'notificationUrl', notificationUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
- // Determine the VnfAdapter endpoint
+ // Determine the VnfAdapter endpoint
- String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution)
+ String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution)
- if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
- String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
+ String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- while (vnfAdapterEndpoint.endsWith('/')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1)
- }
+ while (vnfAdapterEndpoint.endsWith('/')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1)
+ }
- String vnfAdapterMethod = null
- String vnfAdapterUrl = null
- String vnfAdapterRequest = request
+ String vnfAdapterMethod = null
+ String vnfAdapterUrl = null
+ String vnfAdapterRequest = request
- if ('createVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
+ if ('createVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'POST'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules'
+ vnfAdapterMethod = 'POST'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules'
- } else if ('updateVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
+ } else if ('updateVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vfModuleId = getChildText(root, 'vfModuleId')
+ String vfModuleId = getChildText(root, 'vfModuleId')
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'PUT'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
+ vnfAdapterMethod = 'PUT'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
- } else if ('deleteVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
+ } else if ('deleteVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vfModuleId = getChildText(root, 'vfModuleId')
+ String vfModuleId = getChildText(root, 'vfModuleId')
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
+ vnfAdapterMethod = 'DELETE'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
- } else if ('rollbackVfModuleRequest'.equals(requestType)) {
- Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback')
+ } else if ('rollbackVfModuleRequest'.equals(requestType)) {
+ Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback')
- if (vfModuleRollbackNode == null) {
- String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleRollbackNode == null) {
+ String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
+ String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
+ String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback'
-
- } else if ('createVolumeGroupRequest'.equals(requestType)) {
- vnfAdapterMethod = 'POST'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups'
-
- } else if ('updateVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback'
+
+ } else if ('createVolumeGroupRequest'.equals(requestType)) {
+ vnfAdapterMethod = 'POST'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups'
+
+ } else if ('updateVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getChildText(root, 'volumeGroupId')
+
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'PUT'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
+ vnfAdapterMethod = 'PUT'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
- } else if ('deleteVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
+ } else if ('deleteVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getChildText(root, 'volumeGroupId')
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
+ vnfAdapterMethod = 'DELETE'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
- } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root)
+ } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root)
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback'
-
- } else {
- String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback'
+
+ } else {
+ String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
- execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
- execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
-
- // Get the Basic Auth credentials for the VnfAdapter
-
- String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
-
- if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- ErrorCode.UnknownError.getValue());
- } else {
- try {
- def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
- execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
- } catch (IOException ex) {
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
- "BPMN", ErrorCode.UnknownError.getValue(), ex);
- }
- }
-
- } catch (BpmnError e) {
- logger.debug(" Rethrowing MSOWorkflowException")
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
- logger.debug(msg)
+ }
+
+ execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
+ execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
+ execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
+
+ // Get the Basic Auth credentials for the VnfAdapter
+
+ String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+
+ if (basicAuthValue == null || basicAuthValue.isEmpty()) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ ErrorCode.UnknownError.getValue());
+ } else {
+ try {
+ def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
+ } catch (IOException ex) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ }
+ }
+
+ } catch (BpmnError e) {
+ logger.debug(" Rethrowing MSOWorkflowException")
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
- }
+ }
+ }
- public String getVolumeGroupIdFromRollbackRequest(Node root) {
- return root.'volumeGroupRollback'.'volumeGroupId'.text()
- }
+ public String getVolumeGroupIdFromRollbackRequest(Node root) {
+ return root.'volumeGroupRollback'.'volumeGroupId'.text()
+ }
- public String getMessageIdForVolumeGroupRollback(Node root) {
- return root.'volumeGroupRollback'.'messageId'.text()
- }
+ public String getMessageIdForVolumeGroupRollback(Node root) {
+ return root.'volumeGroupRollback'.'messageId'.text()
+ }
- /**
- * This method is used instead of an HTTP Connector task because the
- * connector does not allow DELETE with a body.
- */
- public void sendRequestToVnfAdapter(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
+ /**
+ * This method is used instead of an HTTP Connector task because the
+ * connector does not allow DELETE with a body.
+ */
+ public void sendRequestToVnfAdapter(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
- String prefix = execution.getVariable('prefix')
+ String prefix = execution.getVariable('prefix')
- try {
- String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod')
- String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl')
- String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest')
+ try {
+ String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod')
+ String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl')
+ String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest')
- URL url = new URL(vnfAdapterUrl);
+ URL url = new URL(vnfAdapterUrl);
HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER)
- httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
-
- httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
- httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
- httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter")
- Response response;
-
- if ("GET".equals(vnfAdapterMethod)) {
- response = httpClient.get()
- } else if ("PUT".equals(vnfAdapterMethod)) {
- response = httpClient.put(vnfAdapterRequest)
- } else if ("POST".equals(vnfAdapterMethod)) {
- response = httpClient.post(vnfAdapterRequest)
- } else if ("DELETE".equals(vnfAdapterMethod)) {
- response = httpClient.delete(vnfAdapterRequest)
- } else {
- String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
+
+ httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
+ httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
+ httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter")
+ Response response;
+
+ if ("GET".equals(vnfAdapterMethod)) {
+ response = httpClient.get()
+ } else if ("PUT".equals(vnfAdapterMethod)) {
+ response = httpClient.put(vnfAdapterRequest)
+ } else if ("POST".equals(vnfAdapterMethod)) {
+ response = httpClient.post(vnfAdapterRequest)
+ } else if ("DELETE".equals(vnfAdapterMethod)) {
+ response = httpClient.delete(vnfAdapterRequest)
+ } else {
+ String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
- if(response.hasEntity()){
- execution.setVariable(prefix + "vnfAdapterResponse", response.readEntity(String.class))
- }
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ }
+
+ execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
+ if(response.hasEntity()){
+ execution.setVariable(prefix + "vnfAdapterResponse", response.readEntity(String.class))
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
- }
-
- public void processCallback(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.processCallback(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- String callback = execution.getVariable('VNFAResponse_MESSAGE')
-
- try {
- logger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
-
- // The XML callback is available to the calling flow in any case,
- // even if a WorkflowException is generated.
- execution.setVariable(getProcessKey(execution) + 'Response', callback)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
- execution.setVariable("WorkflowResponse", callback)
-
- callback = utils.removeXmlPreamble(callback)
-
- Node root = new XmlParser().parseText(callback)
- if (root.name().endsWith('Exception')) {
- vnfAdapterWorkflowException(execution, callback)
- }
- } catch (Exception e) {
- logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
+ }
+ }
+
+ public void processCallback(DelegateExecution execution){
+ def method = getClass().getSimpleName() + '.processCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ String callback = execution.getVariable('VNFAResponse_MESSAGE')
+
+ try {
+ logger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
+
+ // The XML callback is available to the calling flow in any case,
+ // even if a WorkflowException is generated.
+ execution.setVariable(getProcessKey(execution) + 'Response', callback)
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
+ execution.setVariable("WorkflowResponse", callback)
+
+ callback = utils.removeXmlPreamble(callback)
+
+ Node root = new XmlParser().parseText(callback)
+ if (root.name().endsWith('Exception')) {
+ vnfAdapterWorkflowException(execution, callback)
+ }
+ } catch (Exception e) {
+ logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO)
- }
- }
-
- /**
- * Tries to parse the response as XML to extract the information to create
- * a WorkflowException. If the response cannot be parsed, a more generic
- * WorkflowException is created.
- */
- public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) {
- try {
- Node root = new XmlParser().parseText(response)
- String category = getChildText(root, "category")
- category = category == null || category.isEmpty() ? "" : " category='" + category + "'"
- String message = getChildText(root, "message")
- message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
- String rolledBack = getChildText(root, "rolledBack")
- rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
- exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
+ }
+ }
+
+ /**
+ * Tries to parse the response as XML to extract the information to create
+ * a WorkflowException. If the response cannot be parsed, a more generic
+ * WorkflowException is created.
+ */
+ public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) {
+ try {
+ Node root = new XmlParser().parseText(response)
+ String category = getChildText(root, "category")
+ category = category == null || category.isEmpty() ? "" : " category='" + category + "'"
+ String message = getChildText(root, "message")
+ message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
+ String rolledBack = getChildText(root, "rolledBack")
+ rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
" from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK);
- } catch (Exception e) {
- response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
+ } catch (Exception e) {
+ response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK)
- }
- }
-
- /**
- * Gets the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node, or null if no such child exists
- */
- private Node getChild(Node node, String name) {
- for (Node child : node.children()) {
- if (child.name() == name) {
- return child
- }
- }
- return null
- }
-
- /**
- * Gets the text of the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node text, or null if no such child exists
- */
- private String getChildText(Node node, String name) {
- Node child = getChild(node, name)
- return child == null ? null : child.text()
- }
-
- public Logger getLogger() {
- return logger;
- }
+ }
+ }
+
+ /**
+ * Gets the named child of the specified node.
+ * @param node the node
+ * @param name the child name
+ * @return the child node, or null if no such child exists
+ */
+ private Node getChild(Node node, String name) {
+ for (Node child : node.children()) {
+ if (child.name() == name) {
+ return child
+ }
+ }
+ return null
+ }
+
+ /**
+ * Gets the text of the named child of the specified node.
+ * @param node the node
+ * @param name the child name
+ * @return the child node text, or null if no such child exists
+ */
+ private String getChildText(Node node, String name) {
+ Node child = getChild(node, name)
+ return child == null ? null : child.text()
+ }
+
+ public Logger getLogger() {
+ return logger;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index 2e9d4b0117..30fd2c8770 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -45,6 +45,7 @@ import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.Components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -207,26 +208,26 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
+
+ buildWorkflowException(execution, errorCode, errorMessage);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
String processKey = getProcessKey(execution);
- logger.info("Building a WorkflowException for Subflow");
+ logger.info("Building a WorkflowException");
WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
- throw new BpmnError("MSOWorkflowException");
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
ONAPComponentsList extSystemErrorSource) {
- String processKey = getProcessKey(execution);
- logger.info("Building a WorkflowException for Subflow");
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource);
- execution.setVariable("WorkflowException", exception);
- execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
- logger.info("Outgoing WorkflowException is {}", exception);
+ buildWorkflowException(execution, errorCode, errorMessage, extSystemErrorSource);
logger.info("Throwing MSOWorkflowException");
throw new BpmnError("MSOWorkflowException");
}
@@ -313,7 +314,7 @@ public class ExceptionBuilder {
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
+ logger.info("Throwing AAIInventoryFailure");
throw new BpmnError("AAIInventoryFailure");
}
@@ -323,9 +324,42 @@ public class ExceptionBuilder {
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
+ logger.info("Throwing AAIInventoryFailure");
throw new BpmnError("AAIInventoryFailure");
}
}
+ public void processVnfAdapterException(DelegateExecution execution) {
+ StringBuilder workflowExceptionMessage = new StringBuilder();
+ logger.debug("Processing Vnf Adapter Exception");
+ try {
+ String errorMessage = (String) execution.getVariable("openstackAdapterErrorMessage");
+ boolean openstackRollbackPollSuccess = (boolean) execution.getVariable("OpenstackPollSuccess");
+ boolean rollbackPerformed = (boolean) execution.getVariable("rollbackPerformed");
+ boolean openstackRollbackSuccess = (boolean) execution.getVariable("OpenstackRollbackSuccess");
+ boolean pollRollbackStatus = (boolean) execution.getVariable("PollRollbackStatus");
+
+ workflowExceptionMessage.append("Exception occured during vnf adapter: " + errorMessage + ".");
+
+ boolean rollbackCompleted = false;
+ if (rollbackPerformed) {
+ if (openstackRollbackSuccess && !pollRollbackStatus) {
+ rollbackCompleted = true;
+ } else if (openstackRollbackSuccess && pollRollbackStatus) {
+ if (openstackRollbackPollSuccess) {
+ rollbackCompleted = true;
+ }
+ }
+ workflowExceptionMessage
+ .append(" The resource was rollbacked in openstack: " + rollbackCompleted + ".");
+ }
+ } catch (Exception e) {
+ logger.debug("Error while Processing Vnf Adapter Exception", e);
+ }
+ buildWorkflowException(execution, 500, workflowExceptionMessage.toString(), Components.OPENSTACK);
+ throw new BpmnError("MSOWorkflowException");
+
+
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn
new file mode 100644
index 0000000000..69b68e534e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn
@@ -0,0 +1,336 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+ <bpmn2:process id="vnfAdapterTask" name="vnfAdapterTask" isExecutable="true">
+ <bpmn2:endEvent id="EndEvent_6">
+ <bpmn2:incoming>SequenceFlow_13uy51h</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="executeOpenstackAction" />
+ <bpmn2:serviceTask id="executeOpenstackAction" name="&#10;Openstack&#10;Action&#10;(resource)&#10;" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterInvoke">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1ff2y8j</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1ff2y8j" sourceRef="executeOpenstackAction" targetRef="ExclusiveGateway_08a6you" />
+ <bpmn2:serviceTask id="ServiceTask_11iuzx9" name="&#10;Openstack&#10;Query&#10;(resource)&#10;" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterPolling">
+ <bpmn2:incoming>SequenceFlow_1p39f4r</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0ecut35</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_0ecut35" sourceRef="ServiceTask_11iuzx9" targetRef="ExclusiveGateway_1fn953y" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1fn953y" name="Success?">
+ <bpmn2:incoming>SequenceFlow_0ecut35</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_13uy51h</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0o8wnkx</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_13uy51h" name="Yes" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_6">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == true }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_0o8wnkx" name="No" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_1dt01ez">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == false }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_08a6you" name="Success?">
+ <bpmn2:incoming>SequenceFlow_1ff2y8j</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1p39f4r</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_007m32h</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_1p39f4r" name="Yes" sourceRef="ExclusiveGateway_08a6you" targetRef="ServiceTask_11iuzx9">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == true }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_007m32h" name="No" sourceRef="ExclusiveGateway_08a6you" targetRef="EndEvent_0rxprkw">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == false }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:subProcess id="SubProcess_0y17e8j" name="Error Handling" triggeredByEvent="true">
+ <bpmn2:startEvent id="StartEvent_17oglfe">
+ <bpmn2:outgoing>SequenceFlow_02rhau9</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition />
+ </bpmn2:startEvent>
+ <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_040yoan">
+ <bpmn2:incoming>SequenceFlow_0y1by9x</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_006myq9</bpmn2:outgoing>
+ <bpmn2:compensateEventDefinition waitForCompletion="true" activityRef="executeOpenstackAction" />
+ </bpmn2:intermediateThrowEvent>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_0qlnby0" name="Poll Rollback Status?" default="SequenceFlow_1piwh1c">
+ <bpmn2:incoming>SequenceFlow_006myq9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1ubla93</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1piwh1c</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_02rhau9" sourceRef="StartEvent_17oglfe" targetRef="ExclusiveGateway_18ndby1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_006myq9" sourceRef="IntermediateThrowEvent_040yoan" targetRef="ExclusiveGateway_0qlnby0" />
+ <bpmn2:serviceTask id="ServiceTask_120p27h" name="&#10;Openstack&#10;Query&#10;(resource)&#10;" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterPolling">
+ <bpmn2:incoming>SequenceFlow_1ubla93</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1nku4uk</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_0tuxj9l">
+ <bpmn2:incoming>SequenceFlow_1piwh1c</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1nku4uk</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1yx80cq</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:serviceTask id="buildError" name="&#10;Process&#10;Exception&#10;" camunda:expression="${ExceptionBuilder.processVnfAdapterException(execution)}">
+ <bpmn2:incoming>SequenceFlow_1yx80cq</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1az3a2q</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0bnzfqb</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1ubla93" name="Yes" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ServiceTask_120p27h">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("PollRollbackStatus") == true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_1piwh1c" name="No" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ExclusiveGateway_0tuxj9l" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1nku4uk" sourceRef="ServiceTask_120p27h" targetRef="ExclusiveGateway_0tuxj9l" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1yx80cq" sourceRef="ExclusiveGateway_0tuxj9l" targetRef="buildError" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0bnzfqb" sourceRef="buildError" targetRef="EndEvent_1yiy2fi" />
+ <bpmn2:endEvent id="EndEvent_1yiy2fi">
+ <bpmn2:incoming>SequenceFlow_0bnzfqb</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition />
+ </bpmn2:endEvent>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_18ndby1" name="Rollback Resource?" default="SequenceFlow_1az3a2q">
+ <bpmn2:incoming>SequenceFlow_02rhau9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0y1by9x</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1az3a2q</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_0y1by9x" name="Yes" sourceRef="ExclusiveGateway_18ndby1" targetRef="IntermediateThrowEvent_040yoan">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("backout") == true }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_1az3a2q" name="No" sourceRef="ExclusiveGateway_18ndby1" targetRef="buildError" />
+ </bpmn2:subProcess>
+ <bpmn2:boundaryEvent id="BoundaryEvent_1ysr7mk" attachedToRef="executeOpenstackAction">
+ <bpmn2:compensateEventDefinition />
+ </bpmn2:boundaryEvent>
+ <bpmn2:serviceTask id="Task_0zbd85n" name="&#10;Openstack&#10;Rollback&#10;(resource)&#10;" isForCompensation="true" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterRollback" />
+ <bpmn2:endEvent id="EndEvent_0rxprkw">
+ <bpmn2:incoming>SequenceFlow_007m32h</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:endEvent id="EndEvent_1dt01ez">
+ <bpmn2:incoming>SequenceFlow_0o8wnkx</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:association id="Association_1cnlu6p" associationDirection="One" sourceRef="BoundaryEvent_1ysr7mk" targetRef="Task_0zbd85n" />
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmn2:message id="Message_1" name="WorkflowMessage" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterTask">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1">
+ <dc:Bounds x="110" y="146" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="116" y="187" width="24" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="ServiceTask_0rcy900_di">
+ <di:waypoint xsi:type="dc:Point" x="146" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="253" y="163" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="154.5" y="145.5" width="90" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6">
+ <dc:Bounds x="929" y="146" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="924" y="187" width="46" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0rcy900_di" bpmnElement="executeOpenstackAction">
+ <dc:Bounds x="253" y="124" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ff2y8j_di" bpmnElement="SequenceFlow_1ff2y8j">
+ <di:waypoint xsi:type="dc:Point" x="353" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="404" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="333.5" y="139" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_11iuzx9_di" bpmnElement="ServiceTask_11iuzx9">
+ <dc:Bounds x="541" y="124" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ecut35_di" bpmnElement="SequenceFlow_0ecut35">
+ <di:waypoint xsi:type="dc:Point" x="641" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="676" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="613.5" y="139" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1fn953y_di" bpmnElement="ExclusiveGateway_1fn953y" isMarkerVisible="true">
+ <dc:Bounds x="676" y="139" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="676" y="119" width="49" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_13uy51h_di" bpmnElement="SequenceFlow_13uy51h">
+ <di:waypoint xsi:type="dc:Point" x="726" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="929" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="746.6875" y="166" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0o8wnkx_di" bpmnElement="SequenceFlow_0o8wnkx">
+ <di:waypoint xsi:type="dc:Point" x="701" y="189" />
+ <di:waypoint xsi:type="dc:Point" x="701" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="706" y="198" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_120p27h_di" bpmnElement="ServiceTask_120p27h">
+ <dc:Bounds x="496" y="443" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_08a6you_di" bpmnElement="ExclusiveGateway_08a6you" isMarkerVisible="true">
+ <dc:Bounds x="404" y="139" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="409" y="117" width="49" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1p39f4r_di" bpmnElement="SequenceFlow_1p39f4r">
+ <di:waypoint xsi:type="dc:Point" x="454" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="541" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="472" y="168" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_007m32h_di" bpmnElement="SequenceFlow_007m32h">
+ <di:waypoint xsi:type="dc:Point" x="429" y="189" />
+ <di:waypoint xsi:type="dc:Point" x="429" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="435" y="198" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_09bkjg0_di" bpmnElement="SubProcess_0y17e8j" isExpanded="true">
+ <dc:Bounds x="151" y="404" width="787" height="344" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BoundaryEvent_04c5efr_di" bpmnElement="BoundaryEvent_1ysr7mk">
+ <dc:Bounds x="335" y="186" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="353" y="226" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Association_1cnlu6p_di" bpmnElement="Association_1cnlu6p">
+ <di:waypoint xsi:type="dc:Point" x="353" y="222" />
+ <di:waypoint xsi:type="dc:Point" x="353" y="267" />
+ <di:waypoint xsi:type="dc:Point" x="321" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0vacscp_di" bpmnElement="Task_0zbd85n">
+ <dc:Bounds x="221" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0lzcn0v_di" bpmnElement="EndEvent_0rxprkw">
+ <dc:Bounds x="411" y="249" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="429" y="288.658" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_14424k5_di" bpmnElement="EndEvent_1dt01ez">
+ <dc:Bounds x="683" y="249" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="701" y="288.658" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1wrpebh_di" bpmnElement="StartEvent_17oglfe">
+ <dc:Bounds x="181" y="599" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="198.35199999999998" y="638.658" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_0gltuh4_di" bpmnElement="IntermediateThrowEvent_040yoan">
+ <dc:Bounds x="365" y="529" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="382.352" y="569" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0qlnby0_di" bpmnElement="ExclusiveGateway_0qlnby0" isMarkerVisible="true">
+ <dc:Bounds x="429.352" y="522" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="484" y="535" width="62" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_02rhau9_di" bpmnElement="SequenceFlow_02rhau9">
+ <di:waypoint xsi:type="dc:Point" x="217" y="617" />
+ <di:waypoint xsi:type="dc:Point" x="284" y="617" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="250.5" y="596" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_006myq9_di" bpmnElement="SequenceFlow_006myq9">
+ <di:waypoint xsi:type="dc:Point" x="401" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="429" y="547" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="415" y="526" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0tuxj9l_di" bpmnElement="ExclusiveGateway_0tuxj9l" isMarkerVisible="true">
+ <dc:Bounds x="608.352" y="522" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="633.352" y="576" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_108cgfw_di" bpmnElement="buildError">
+ <dc:Bounds x="695" y="577" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ubla93_di" bpmnElement="SequenceFlow_1ubla93">
+ <di:waypoint xsi:type="dc:Point" x="454" y="522" />
+ <di:waypoint xsi:type="dc:Point" x="454" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="496" y="483" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="461" y="489" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1piwh1c_di" bpmnElement="SequenceFlow_1piwh1c">
+ <di:waypoint xsi:type="dc:Point" x="454" y="572" />
+ <di:waypoint xsi:type="dc:Point" x="454" y="603" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="603" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="572" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="460" y="576.85" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1nku4uk_di" bpmnElement="SequenceFlow_1nku4uk">
+ <di:waypoint xsi:type="dc:Point" x="596" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="522" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="614.5" y="462" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yx80cq_di" bpmnElement="SequenceFlow_1yx80cq">
+ <di:waypoint xsi:type="dc:Point" x="658" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="577" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="656.5" y="526" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0bnzfqb_di" bpmnElement="SequenceFlow_0bnzfqb">
+ <di:waypoint xsi:type="dc:Point" x="795" y="617" />
+ <di:waypoint xsi:type="dc:Point" x="870" y="617" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="787.5" y="596" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1l1f6zj_di" bpmnElement="EndEvent_1yiy2fi">
+ <dc:Bounds x="870" y="599" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="887.352" y="639" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_18ndby1_di" bpmnElement="ExclusiveGateway_18ndby1" isMarkerVisible="true">
+ <dc:Bounds x="284.352" y="592" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="605" width="54" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0y1by9x_di" bpmnElement="SequenceFlow_0y1by9x">
+ <di:waypoint xsi:type="dc:Point" x="309" y="592" />
+ <di:waypoint xsi:type="dc:Point" x="309" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="365" y="547" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="315" y="558" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1az3a2q_di" bpmnElement="SequenceFlow_1az3a2q">
+ <di:waypoint xsi:type="dc:Point" x="309" y="642" />
+ <di:waypoint xsi:type="dc:Point" x="309" y="686" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="686" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="657" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="318" y="657" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 506088eb15..477dce1072 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn
new file mode 100644
index 0000000000..d77b1cebb1
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn
@@ -0,0 +1,67 @@
+<?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="1.9.0">
+ <bpmn:process id="VNFConfigModifyActivity" name="VNFConfigModifyActivity" isExecutable="true">
+ <bpmn:startEvent id="Start_VNFConfigModifyActivity" name="Start">
+ <bpmn:outgoing>SequenceFlow_0d87xrn</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="ConfigModify" name="VNF Config Modify&#10;" camunda:type="external" camunda:topic="AppcService">
+ <bpmn:incoming>SequenceFlow_05oatn2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1pg83wr</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0d87xrn" sourceRef="Start_VNFConfigModifyActivity" targetRef="PreProcessActivity" />
+ <bpmn:endEvent id="End_VNFConfigModifyActivity" name="End">
+ <bpmn:incoming>SequenceFlow_1pg83wr</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1pg83wr" sourceRef="ConfigModify" targetRef="End_VNFConfigModifyActivity" />
+ <bpmn:serviceTask id="PreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcOrchestratorPreProcessor.buildAppcTaskRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),&#34;ConfigModify&#34;)}">
+ <bpmn:incoming>SequenceFlow_0d87xrn</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05oatn2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05oatn2" sourceRef="PreProcessActivity" targetRef="ConfigModify" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFConfigModifyActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_VNFConfigModifyActivity">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="179" y="138" width="25" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1q3bjtz_di" bpmnElement="ConfigModify">
+ <dc:Bounds x="532" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0d87xrn_di" bpmnElement="SequenceFlow_0d87xrn">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="257" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="257" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="304" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="272" y="114" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_15t8iwk_di" bpmnElement="End_VNFConfigModifyActivity">
+ <dc:Bounds x="756" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="764" y="142" width="20" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pg83wr_di" bpmnElement="SequenceFlow_1pg83wr">
+ <di:waypoint xsi:type="dc:Point" x="632" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="756" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="694" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0h60lbz_di" bpmnElement="PreProcessActivity">
+ <dc:Bounds x="308" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05oatn2_di" bpmnElement="SequenceFlow_05oatn2">
+ <di:waypoint xsi:type="dc:Point" x="408" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="532" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="470" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn
index 30a95eb81f..e139e94660 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn
@@ -27,92 +27,91 @@
<bpmn:outgoing>SequenceFlow_1ivhukd</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1ivhukd" sourceRef="PostProcessResponse" targetRef="VnfAdapter_End" />
- <bpmn:callActivity id="Call_vnfAdapterRestV1" name="Call vnfAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn:callActivity id="Call_vnfAdapterTask" name="&#10;Cloud&#10;Create&#10;(vnf)&#10;" calledElement="vnfAdapterTask">
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="VNFREST_Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="vnfAdapterRestV1Response" />
+ <camunda:in source="VNFREST_Request" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="WorkflowResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0qaaf5k</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0j1zvis</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_0qaaf5k" sourceRef="PreProcessRequest" targetRef="Call_vnfAdapterRestV1" />
- <bpmn:sequenceFlow id="SequenceFlow_0j1zvis" sourceRef="Call_vnfAdapterRestV1" targetRef="PostProcessResponse" />
+ <bpmn:sequenceFlow id="SequenceFlow_0qaaf5k" sourceRef="PreProcessRequest" targetRef="Call_vnfAdapterTask" />
+ <bpmn:sequenceFlow id="SequenceFlow_0j1zvis" sourceRef="Call_vnfAdapterTask" targetRef="PostProcessResponse" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VnfAdapter">
<bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="VnfAdapter_Start">
- <dc:Bounds x="213" y="357" width="36" height="36" />
+ <dc:Bounds x="156" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="219" y="393" width="24" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_17szae7_di" bpmnElement="VnfAdapter_Error" isExpanded="true">
- <dc:Bounds x="453" y="529" width="233" height="135" />
+ <dc:Bounds x="396" y="275" width="233" height="135" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl">
- <di:waypoint xsi:type="dc:Point" x="249" y="375" />
- <di:waypoint xsi:type="dc:Point" x="329" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="272" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="244" y="360" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_16vfqpk_di" bpmnElement="Error_End">
- <dc:Bounds x="606" y="573" width="36" height="36" />
+ <dc:Bounds x="549" y="319" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="615" y="613" width="19" height="12" />
+ <dc:Bounds x="558" y="359" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_1t3ep1m_di" bpmnElement="Error_Start">
- <dc:Bounds x="491" y="573" width="36" height="36" />
+ <dc:Bounds x="434" y="319" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="498" y="613" width="24" height="12" />
+ <dc:Bounds x="441" y="359" width="24" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1abat8l_di" bpmnElement="SequenceFlow_1abat8l">
- <di:waypoint xsi:type="dc:Point" x="527" y="591" />
- <di:waypoint xsi:type="dc:Point" x="566" y="591" />
- <di:waypoint xsi:type="dc:Point" x="566" y="591" />
- <di:waypoint xsi:type="dc:Point" x="606" y="591" />
+ <di:waypoint xsi:type="dc:Point" x="470" y="337" />
+ <di:waypoint xsi:type="dc:Point" x="509" y="337" />
+ <di:waypoint xsi:type="dc:Point" x="509" y="337" />
+ <di:waypoint xsi:type="dc:Point" x="549" y="337" />
<bpmndi:BPMNLabel>
<dc:Bounds x="536" y="591" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="VnfAdapter_End">
- <dc:Bounds x="894" y="357" width="36" height="36" />
+ <dc:Bounds x="837" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="902" y="397" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1frb5h2_di" bpmnElement="PreProcessRequest">
- <dc:Bounds x="329" y="335" width="100" height="80" />
+ <dc:Bounds x="272" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1yomr79_di" bpmnElement="PostProcessResponse">
- <dc:Bounds x="714" y="335" width="100" height="80" />
+ <dc:Bounds x="657" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1ivhukd_di" bpmnElement="SequenceFlow_1ivhukd">
- <di:waypoint xsi:type="dc:Point" x="814" y="375" />
- <di:waypoint xsi:type="dc:Point" x="894" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="757" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="837" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="809" y="354" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="CallActivity_0n6wnin_di" bpmnElement="Call_vnfAdapterRestV1">
- <dc:Bounds x="520" y="335" width="100" height="80" />
+ <bpmndi:BPMNShape id="CallActivity_0n6wnin_di" bpmnElement="Call_vnfAdapterTask">
+ <dc:Bounds x="463" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0qaaf5k_di" bpmnElement="SequenceFlow_0qaaf5k">
- <di:waypoint xsi:type="dc:Point" x="429" y="375" />
- <di:waypoint xsi:type="dc:Point" x="520" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="372" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="463" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="429.5" y="354" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0j1zvis_di" bpmnElement="SequenceFlow_0j1zvis">
- <di:waypoint xsi:type="dc:Point" x="620" y="375" />
- <di:waypoint xsi:type="dc:Point" x="714" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="563" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="657" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="622" y="354" width="90" height="12" />
</bpmndi:BPMNLabel>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java
new file mode 100644
index 0000000000..99ee8d9fcb
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.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.doThrow;
+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.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFConfigModifyActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFConfigModifyActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables);
+ assertThat(pi).isNotNull();
+ processExternalTasks(pi, "ConfigModify");
+ assertThat(pi).isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity",
+ "ConfigModify", "End_VNFConfigModifyActivity");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFConfigModifyActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcOrchestratorPreProcessor)
+ .buildAppcTaskRequest(any(BuildingBlockExecution.class), any(String.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity")
+ .hasNotPassed("ConfigModify", "End_VNFConfigModifyActivity");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java
index 8ad4e0f07f..4dbf4d46ff 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,11 +32,11 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
public class VnfAdapterTest extends BaseBPMNTest {
@Test
public void vnfAdapterCreatedTest() {
- mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub");
+ mockSubprocess("vnfAdapterTask", "Mocked vnfAdapterTask", "GenericStub");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterRestV1",
+ assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterTask",
"PostProcessResponse", "VnfAdapter_End");
assertThat(pi).isEnded();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
index a77f6f0628..a505aa1a34 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
@@ -50,164 +50,164 @@ import javax.ws.rs.NotFoundException
public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleRollback.class);
- def Prefix="DCVFMR_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- }
-
- // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
- // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
- public void preProcessRequest(DelegateExecution execution) {
-
-
- initProcessVariables(execution)
-
- try {
-
- execution.setVariable("rolledBack", null)
- execution.setVariable("rollbackError", null)
-
- def rollbackData = execution.getVariable("rollbackData")
- logger.debug("RollbackData:" + rollbackData)
-
- if (rollbackData != null) {
- String vnfId = rollbackData.get("VFMODULE", "vnfid")
- execution.setVariable("DCVFMR_vnfId", vnfId)
- String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid")
- execution.setVariable("DCVFMR_vfModuleId", vfModuleId)
- String source = rollbackData.get("VFMODULE", "source")
- execution.setVariable("DCVFMR_source", source)
- String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId")
- execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
- String serviceId = rollbackData.get("VFMODULE", "service-id")
- execution.setVariable("DCVFMR_serviceId", serviceId)
- String vnfType = rollbackData.get("VFMODULE", "vnftype")
- execution.setVariable("DCVFMR_vnfType", vnfType)
- String vnfName = rollbackData.get("VFMODULE", "vnfname")
- execution.setVariable("DCVFMR_vnfName", vnfName)
- String tenantId = rollbackData.get("VFMODULE", "tenantid")
- execution.setVariable("DCVFMR_tenantId", tenantId)
- String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename")
- execution.setVariable("DCVFMR_vfModuleName", vfModuleName)
- String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname")
- execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName)
- String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion")
- execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId)
- String cloudOwner = rollbackData.get("VFMODULE", "cloudowner")
- execution.setVariable("DCVFMR_cloudOwner", cloudOwner)
- String heatStackId = rollbackData.get("VFMODULE", "heatstackid")
- execution.setVariable("DCVFMR_heatStackId", heatStackId)
- String requestId = rollbackData.get("VFMODULE", "msorequestid")
- execution.setVariable("DCVFMR_requestId", requestId)
- // Set mso-request-id to request-id for VNF Adapter interface
- execution.setVariable("mso-request-id", requestId)
- List createdNetworkPolicyFqdnList = []
- int i = 0
- while (i < 100) {
- String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i)
- if (fqdn == null) {
- break
- }
- createdNetworkPolicyFqdnList.add(fqdn)
- logger.debug("got fqdn # " + i + ": " + fqdn)
- i = i + 1
-
- }
-
- execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList)
- String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address")
- execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address)
- String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address")
- execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address)
- //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid")
- //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
- execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule"))
- execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule"))
- execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate"))
- execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign"))
- execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate"))
- execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule"))
- execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI"))
- execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI"))
-
- // formulate the request for PrepareUpdateAAIVfModule
- String request = """<PrepareUpdateAAIVfModuleRequest>
+ def Prefix="DCVFMR_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ public void initProcessVariables(DelegateExecution execution) {
+ execution.setVariable("prefix",Prefix)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
+ // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
+ public void preProcessRequest(DelegateExecution execution) {
+
+
+ initProcessVariables(execution)
+
+ try {
+
+ execution.setVariable("rolledBack", null)
+ execution.setVariable("rollbackError", null)
+
+ def rollbackData = execution.getVariable("rollbackData")
+ logger.debug("RollbackData:" + rollbackData)
+
+ if (rollbackData != null) {
+ String vnfId = rollbackData.get("VFMODULE", "vnfid")
+ execution.setVariable("DCVFMR_vnfId", vnfId)
+ String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid")
+ execution.setVariable("DCVFMR_vfModuleId", vfModuleId)
+ String source = rollbackData.get("VFMODULE", "source")
+ execution.setVariable("DCVFMR_source", source)
+ String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId")
+ execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
+ String serviceId = rollbackData.get("VFMODULE", "service-id")
+ execution.setVariable("DCVFMR_serviceId", serviceId)
+ String vnfType = rollbackData.get("VFMODULE", "vnftype")
+ execution.setVariable("DCVFMR_vnfType", vnfType)
+ String vnfName = rollbackData.get("VFMODULE", "vnfname")
+ execution.setVariable("DCVFMR_vnfName", vnfName)
+ String tenantId = rollbackData.get("VFMODULE", "tenantid")
+ execution.setVariable("DCVFMR_tenantId", tenantId)
+ String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename")
+ execution.setVariable("DCVFMR_vfModuleName", vfModuleName)
+ String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname")
+ execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName)
+ String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion")
+ execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId)
+ String cloudOwner = rollbackData.get("VFMODULE", "cloudowner")
+ execution.setVariable("DCVFMR_cloudOwner", cloudOwner)
+ String heatStackId = rollbackData.get("VFMODULE", "heatstackid")
+ execution.setVariable("DCVFMR_heatStackId", heatStackId)
+ String requestId = rollbackData.get("VFMODULE", "msorequestid")
+ execution.setVariable("DCVFMR_requestId", requestId)
+ // Set mso-request-id to request-id for VNF Adapter interface
+ execution.setVariable("mso-request-id", requestId)
+ List createdNetworkPolicyFqdnList = []
+ int i = 0
+ while (i < 100) {
+ String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i)
+ if (fqdn == null) {
+ break
+ }
+ createdNetworkPolicyFqdnList.add(fqdn)
+ logger.debug("got fqdn # " + i + ": " + fqdn)
+ i = i + 1
+
+ }
+
+ execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList)
+ String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address")
+ execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address)
+ String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address")
+ execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address)
+ //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid")
+ //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
+ execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule"))
+ execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule"))
+ execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate"))
+ execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign"))
+ execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate"))
+ execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule"))
+ execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI"))
+ execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI"))
+
+ // formulate the request for PrepareUpdateAAIVfModule
+ String request = """<PrepareUpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<orchestration-status>pending-delete</orchestration-status>
</PrepareUpdateAAIVfModuleRequest>""" as String
- logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
- execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
- } else {
- execution.setVariable("skipRollback", true)
- }
-
- if (execution.getVariable("disableRollback").equals("true" )) {
- execution.setVariable("skipRollback", true)
- }
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex){
- def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- }
-
- // build a SDNC vnf-topology-operation request for the specified action
- // (note: the action passed is expected to be 'changedelete' or 'delete')
- public void prepSDNCAdapterRequest(DelegateExecution execution) {
-
- String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
- }
-
- def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
-
- String source = execution.getVariable("DCVFMR_source")
- String serviceId = execution.getVariable("DCVFMR_serviceId")
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vnfType = execution.getVariable("DCVFMR_vnfType")
- String vnfName = execution.getVariable("DCVFMR_vnfName")
- String tenantId = execution.getVariable("DCVFMR_tenantId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- String vfModuleName = execution.getVariable("DCVFMR_vfModuleName")
- String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName")
- String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId")
- String requestId = execution.getVariable("DCVFMR_requestId")
-
- String serviceInstanceIdToSdnc = ""
- if (srvInstId != null && !srvInstId.isEmpty()) {
- serviceInstanceIdToSdnc = srvInstId
- } else {
- serviceInstanceIdToSdnc = vfModuleId
- }
-
- def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate")
- def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign")
-
- def action = ""
- def requestAction = ""
-
- if (doSDNCActivateRollback.equals("true")) {
- action = "delete"
- requestAction = "DisconnectVNFRequest"
- }
- else if (doSDNCAssignRollback.equals("true")) {
- action = "rollback"
- requestAction = "VNFActivateRequest"
- }
- else
- return
-
-
- String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
+ execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
+ } else {
+ execution.setVariable("skipRollback", true)
+ }
+
+ if (execution.getVariable("disableRollback").equals("true" )) {
+ execution.setVariable("skipRollback", true)
+ }
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ // build a SDNC vnf-topology-operation request for the specified action
+ // (note: the action passed is expected to be 'changedelete' or 'delete')
+ public void prepSDNCAdapterRequest(DelegateExecution execution) {
+
+ String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
+ }
+
+ def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+
+ String source = execution.getVariable("DCVFMR_source")
+ String serviceId = execution.getVariable("DCVFMR_serviceId")
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vnfType = execution.getVariable("DCVFMR_vnfType")
+ String vnfName = execution.getVariable("DCVFMR_vnfName")
+ String tenantId = execution.getVariable("DCVFMR_tenantId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ String vfModuleName = execution.getVariable("DCVFMR_vfModuleName")
+ String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName")
+ String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId")
+ String requestId = execution.getVariable("DCVFMR_requestId")
+
+ String serviceInstanceIdToSdnc = ""
+ if (srvInstId != null && !srvInstId.isEmpty()) {
+ serviceInstanceIdToSdnc = srvInstId
+ } else {
+ serviceInstanceIdToSdnc = vfModuleId
+ }
+
+ def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate")
+ def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign")
+
+ def action = ""
+ def requestAction = ""
+
+ if (doSDNCActivateRollback.equals("true")) {
+ action = "delete"
+ requestAction = "DisconnectVNFRequest"
+ }
+ else if (doSDNCAssignRollback.equals("true")) {
+ action = "rollback"
+ requestAction = "VNFActivateRequest"
+ }
+ else
+ return
+
+
+ String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -245,76 +245,76 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- logger.debug("sdncAdapterWorkflowRequest: " + request)
- execution.setVariable("sdncAdapterWorkflowRequest", request)
- }
-
- public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCDeactivateRequest")
-
- def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
-
- try{
- //Build SDNC Request
-
- String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
-
- deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
- execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest)
- logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
- }
-
- public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCUnassignRequest Process")
- try{
- String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
-
- String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
-
- execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest)
- logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
-
- }catch(Exception e){
- logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
- }
-
- public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
- }
- def callbackURL = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
- def requestId = execution.getVariable("DCVFMR_requestId")
- def serviceId = execution.getVariable("DCVFMR_serviceId")
- def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
- def vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- def source = execution.getVariable("DCVFMR_source")
- def vnfId = execution.getVariable("DCVFMR_vnfId")
-
- def sdncVersion = execution.getVariable("sdncVersion")
-
- String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ logger.debug("sdncAdapterWorkflowRequest: " + request)
+ execution.setVariable("sdncAdapterWorkflowRequest", request)
+ }
+
+ public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCDeactivateRequest")
+
+ def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
+
+ try{
+ //Build SDNC Request
+
+ String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
+
+ deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
+ execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
+ }
+
+ public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process")
+ try{
+ String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
+
+ String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
+
+ execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+
+ }catch(Exception e){
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
+ }
+
+ public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
+ }
+ def callbackURL = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+ def requestId = execution.getVariable("DCVFMR_requestId")
+ def serviceId = execution.getVariable("DCVFMR_serviceId")
+ def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
+ def vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ def source = execution.getVariable("DCVFMR_source")
+ def vnfId = execution.getVariable("DCVFMR_vnfId")
+
+ def sdncVersion = execution.getVariable("sdncVersion")
+
+ String sdncRequest =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -351,32 +351,32 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- logger.debug("sdncRequest: " + sdncRequest)
- return sdncRequest
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing VnfAdapterDeleteV1 request
- public void prepVNFAdapterRequest(DelegateExecution execution) {
-
- String requestId = UUID.randomUUID().toString()
- String origRequestId = execution.getVariable("DCVFMR_requestId")
- String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
- String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId")
- String cloudOwner = execution.getVariable("DCVFMR_cloudOwner")
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId")
- String tenantId = execution.getVariable("DCVFMR_tenantId")
- def messageId = execution.getVariable('mso-request-id') + '-' +
- System.currentTimeMillis()
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
-
- String request = """
+ logger.debug("sdncRequest: " + sdncRequest)
+ return sdncRequest
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing VnfAdapterDeleteV1 request
+ public void prepVNFAdapterRequest(DelegateExecution execution) {
+
+ String requestId = UUID.randomUUID().toString()
+ String origRequestId = execution.getVariable("DCVFMR_requestId")
+ String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
+ String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId")
+ String cloudOwner = execution.getVariable("DCVFMR_cloudOwner")
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId")
+ String tenantId = execution.getVariable("DCVFMR_tenantId")
+ def messageId = execution.getVariable('mso-request-id') + '-' +
+ System.currentTimeMillis()
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+
+ String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
<cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
@@ -394,117 +394,116 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</deleteVfModuleRequest>
""" as String
- logger.debug("vnfAdapterRestV1Request: " + request)
- execution.setVariable("vnfAdapterRestV1Request", request)
- }
+ execution.setVariable("vnfAdapterTaskRequest", request)
+ }
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing UpdateAAIVfModuleRequest request
- public void prepUpdateAAIVfModule(DelegateExecution execution) {
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing UpdateAAIVfModuleRequest request
+ public void prepUpdateAAIVfModule(DelegateExecution execution) {
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<UpdateAAIVfModuleRequest>
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<UpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<heat-stack-id>DELETE</heat-stack-id>
<orchestration-status>deleted</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- logger.debug("UpdateAAIVfModuleRequest :" + request)
- execution.setVariable("UpdateAAIVfModuleRequest", request)
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing UpdateAAIVfModuleRequest request
- public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) {
-
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<UpdateAAIVfModuleRequest>
+ logger.debug("UpdateAAIVfModuleRequest :" + request)
+ execution.setVariable("UpdateAAIVfModuleRequest", request)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing UpdateAAIVfModuleRequest request
+ public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) {
+
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<UpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<heat-stack-id></heat-stack-id>
<orchestration-status>Assigned</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- logger.debug("UpdateAAIVfModuleRequest :" + request)
- execution.setVariable("UpdateAAIVfModuleRequest", request)
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing DeleteAAIVfModuleRequest request
- public void prepDeleteAAIVfModule(DelegateExecution execution) {
-
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<DeleteAAIVfModuleRequest>
+ logger.debug("UpdateAAIVfModuleRequest :" + request)
+ execution.setVariable("UpdateAAIVfModuleRequest", request)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing DeleteAAIVfModuleRequest request
+ public void prepDeleteAAIVfModule(DelegateExecution execution) {
+
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<DeleteAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- logger.debug("DeleteAAIVfModuleRequest :" + request)
- execution.setVariable("DeleteAAIVfModuleRequest", request)
- }
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
+ execution.setVariable("DeleteAAIVfModuleRequest", request)
+ }
- // generates a WorkflowException if
- // -
- public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
+ // generates a WorkflowException if
+ // -
+ public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
- "BPMN", ErrorCode.UnknownError.getValue());
- String processKey = getProcessKey(execution);
- exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule")
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
+ "BPMN", ErrorCode.UnknownError.getValue());
+ String processKey = getProcessKey(execution);
+ exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule")
- }
+ }
- public void sdncValidateResponse(DelegateExecution execution, String response){
+ public void sdncValidateResponse(DelegateExecution execution, String response){
- execution.setVariable("prefix",Prefix)
+ execution.setVariable("prefix",Prefix)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
- sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
- if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- logger.debug("Successfully Validated SDNC Response")
- }else{
- throw new BpmnError("MSOWorkflowException")
- }
- }
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
+ logger.debug("Successfully Validated SDNC Response")
+ }else{
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }
- public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED deleteNetworkPoliciesFromAAI")
+ public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI")
- try {
- // get variables
- List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList")
- if (fqdnList == null) {
- logger.debug("No network policies to delete")
- return
- }
- int fqdnCount = fqdnList.size()
+ try {
+ // get variables
+ List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList")
+ if (fqdnList == null) {
+ logger.debug("No network policies to delete")
+ return
+ }
+ int fqdnCount = fqdnList.size()
- execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount)
- logger.debug("networkPolicyFqdnCount - " + fqdnCount)
+ execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount)
+ logger.debug("networkPolicyFqdnCount - " + fqdnCount)
- AaiUtil aaiUriUtil = new AaiUtil(this)
+ AaiUtil aaiUriUtil = new AaiUtil(this)
- if (fqdnCount > 0) {
- // AII loop call over contrail network policy fqdn list
- for (i in 0..fqdnCount-1) {
+ if (fqdnCount > 0) {
+ // AII loop call over contrail network policy fqdn list
+ for (i in 0..fqdnCount-1) {
- int counting = i+1
- String fqdn = fqdnList[i]
+ int counting = i+1
+ String fqdn = fqdnList[i]
try {
// Query AAI for this network policy FQDN
@@ -517,10 +516,10 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0)
try{
- AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
- getAAIClient().delete(delUri)
- execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200)
- logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
+ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
+ getAAIClient().delete(delUri)
+ execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200)
+ logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
logger.debug("The return code from deleting network policy is: " + 200)
// This network policy was deleted from AAI successfully
logger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ")
@@ -548,113 +547,113 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
- } // end loop
+ } // end loop
- } else {
- logger.debug("No contrail network policies to query/create")
+ } else {
+ logger.debug("No contrail network policies to query/create")
- }
+ }
- } catch (BpmnError e) {
- throw e;
+ } catch (BpmnError e) {
+ throw e;
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- logger.debug(exceptionMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
- }
+ }
- /**
- * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
+ /**
+ * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
- try {
- def vnfId = execution.getVariable('DCVFMR_vnfId')
- def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
- def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
- def ipv4OamAddressElement = ''
- def managementV6AddressElement = ''
+ try {
+ def vnfId = execution.getVariable('DCVFMR_vnfId')
+ def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
+ def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
+ def ipv4OamAddressElement = ''
+ def managementV6AddressElement = ''
- if (oamManagementV4Address != null) {
- ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
- }
+ if (oamManagementV4Address != null) {
+ ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
+ }
- if (oamManagementV6Address != null) {
- managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
- }
+ if (oamManagementV6Address != null) {
+ managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
+ }
- String updateAAIGenericVnfRequest = """
+ String updateAAIGenericVnfRequest = """
<UpdateAAIGenericVnfRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
${ipv4OamAddressElement}
${managementV6AddressElement}
</UpdateAAIGenericVnfRequest>
"""
- updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
- execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
-
-
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage())
- }
- }
-
- public void setSuccessfulRollbackStatus (DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED setSuccessfulRollbackStatus")
-
- try{
- // Set rolledBack to true, rollbackError to null
- execution.setVariable("rolledBack", true)
- execution.setVariable("rollbackError", null)
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED setSuccessfulRollbackStatus")
- }
-
- public void setFailedRollbackStatus (DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED setFailedRollbackStatus")
-
- try{
- // Set rolledBack to false, rollbackError to actual value, rollbackData to null
- execution.setVariable("rolledBack", false)
- execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback')
- execution.setVariable("rollbackData", null)
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing setFailedRollbackStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED setFailedRollbackStatus")
- }
+ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
+ execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+
+
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage())
+ }
+ }
+
+ public void setSuccessfulRollbackStatus (DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED setSuccessfulRollbackStatus")
+
+ try{
+ // Set rolledBack to true, rollbackError to null
+ execution.setVariable("rolledBack", true)
+ execution.setVariable("rollbackError", null)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED setSuccessfulRollbackStatus")
+ }
+
+ public void setFailedRollbackStatus (DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED setFailedRollbackStatus")
+
+ try{
+ // Set rolledBack to false, rollbackError to actual value, rollbackData to null
+ execution.setVariable("rolledBack", false)
+ execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback')
+ execution.setVariable("rollbackData", null)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing setFailedRollbackStatus.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED setFailedRollbackStatus")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index 002e283790..e776eaf422 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -55,187 +55,185 @@ import org.xml.sax.InputSource
/* Subflow for Delete VF Module. When no DoDeleteVfModuleRequest is specified on input,
* functions as a building block subflow
-
-* Inputs for building block interface:
-* @param - requestId
-* @param - isDebugLogEnabled
-* @param - vnfId
-* @param - vfModuleId
-* @param - serviceInstanceId
-* @param - vfModuleName O
-* @param - vfModuleModelInfo
-* @param - cloudConfiguration*
-* @param - sdncVersion ("1610")
-* @param - retainResources
-* @param - aLaCarte
-*
-* Outputs:
-* @param - WorkflowException
-*
-*/
+ * Inputs for building block interface:
+ * @param - requestId
+ * @param - isDebugLogEnabled
+ * @param - vnfId
+ * @param - vfModuleId
+ * @param - serviceInstanceId
+ * @param - vfModuleName O
+ * @param - vfModuleModelInfo
+ * @param - cloudConfiguration*
+ * @param - sdncVersion ("1610")
+ * @param - retainResources
+ * @param - aLaCarte
+ *
+ * Outputs:
+ * @param - WorkflowException
+ *
+ */
public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModule.class);
- def Prefix="DoDVfMod_"
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null)
- execution.setVariable("DoDVfMod_oamManagementV4Address", null)
- execution.setVariable("DoDVfMod_oamManagementV6Address", null)
-
- }
-
- // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
- // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
- public void preProcessRequest(DelegateExecution execution) {
-
- initProcessVariables(execution)
-
- try {
- def xml = execution.getVariable("DoDeleteVfModuleRequest")
- String vnfId = ""
- String vfModuleId = ""
-
- if (xml == null || xml.isEmpty()) {
- // Building Block-type request
-
- // Set mso-request-id to request-id for VNF Adapter interface
- String requestId = execution.getVariable("requestId")
- execution.setVariable("mso-request-id", requestId)
-
- String cloudConfiguration = execution.getVariable("cloudConfiguration")
- String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
- String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
- execution.setVariable("tenantId", tenantId)
- String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
- execution.setVariable("cloudSiteId", cloudSiteId)
- String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
- execution.setVariable("cloudOwner", cloudOwner)
- // Source is HARDCODED
- String source = "VID"
- execution.setVariable("source", source)
- // SrvInstId is hardcoded to empty
- execution.setVariable("srvInstId", "")
- // ServiceId is hardcoded to empty
- execution.setVariable("serviceId", "")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- vnfId = execution.getVariable("vnfId")
- vfModuleId = execution.getVariable("vfModuleId")
- if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
- }
- else {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
- }
- //vfModuleModelName
- def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
- execution.setVariable("vfModuleModelName", vfModuleModelName)
- // retainResources
- def retainResources = execution.getVariable("retainResources")
- if (retainResources == null) {
- retainResources = false
- }
- execution.setVariable("retainResources", retainResources)
- }
- else {
-
- logger.debug("DoDeleteVfModule Request: " + xml)
-
- logger.debug("input request xml: " + xml)
-
- vnfId = utils.getNodeText(xml,"vnf-id")
- execution.setVariable("vnfId", vnfId)
- vfModuleId = utils.getNodeText(xml,"vf-module-id")
- execution.setVariable("vfModuleId", vfModuleId)
- def srvInstId = execution.getVariable("mso-service-instance-id")
- execution.setVariable("srvInstId", srvInstId)
- String requestId = ""
- try {
- requestId = execution.getVariable("mso-request-id")
- } catch (Exception ex) {
- requestId = utils.getNodeText(xml, "request-id")
- }
- execution.setVariable("requestId", requestId)
- String source = utils.getNodeText(xml, "source")
- execution.setVariable("source", source)
- String serviceId = utils.getNodeText(xml, "service-id")
- execution.setVariable("serviceId", serviceId)
- String tenantId = utils.getNodeText(xml, "tenant-id")
- execution.setVariable("tenantId", tenantId)
-
- String serviceInstanceIdToSdnc = ""
- if (xml.contains("service-instance-id")) {
- serviceInstanceIdToSdnc = utils.getNodeText(xml, "service-instance-id")
- } else {
- serviceInstanceIdToSdnc = vfModuleId
- }
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc)
- String vfModuleName = utils.getNodeText(xml, "vf-module-name")
- execution.setVariable("vfModuleName", vfModuleName)
- String vfModuleModelName = utils.getNodeText(xml, "vf-module-model-name")
- execution.setVariable("vfModuleModelName", vfModuleModelName)
- String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region")
- execution.setVariable("cloudSiteId", cloudSiteId)
- String cloudOwner = utils.getNodeText(xml, "cloud-owner")
- execution.setVariable("cloudOwner", cloudOwner)
- }
-
- // formulate the request for PrepareUpdateAAIVfModule
- String request = """<PrepareUpdateAAIVfModuleRequest>
+ def Prefix="DoDVfMod_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void initProcessVariables(DelegateExecution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null)
+ execution.setVariable("DoDVfMod_oamManagementV4Address", null)
+ execution.setVariable("DoDVfMod_oamManagementV6Address", null)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
+ // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
+ public void preProcessRequest(DelegateExecution execution) {
+
+ initProcessVariables(execution)
+
+ try {
+ def xml = execution.getVariable("DoDeleteVfModuleRequest")
+ String vnfId = ""
+ String vfModuleId = ""
+
+ if (xml == null || xml.isEmpty()) {
+ // Building Block-type request
+
+ // Set mso-request-id to request-id for VNF Adapter interface
+ String requestId = execution.getVariable("requestId")
+ execution.setVariable("mso-request-id", requestId)
+
+ String cloudConfiguration = execution.getVariable("cloudConfiguration")
+ String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
+ String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
+ execution.setVariable("tenantId", tenantId)
+ String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
+ execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ // Source is HARDCODED
+ String source = "VID"
+ execution.setVariable("source", source)
+ // SrvInstId is hardcoded to empty
+ execution.setVariable("srvInstId", "")
+ // ServiceId is hardcoded to empty
+ execution.setVariable("serviceId", "")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ vnfId = execution.getVariable("vnfId")
+ vfModuleId = execution.getVariable("vfModuleId")
+ if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
+ }
+ else {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
+ }
+ //vfModuleModelName
+ def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
+ execution.setVariable("vfModuleModelName", vfModuleModelName)
+ // retainResources
+ def retainResources = execution.getVariable("retainResources")
+ if (retainResources == null) {
+ retainResources = false
+ }
+ execution.setVariable("retainResources", retainResources)
+ }
+ else {
+
+ logger.debug("DoDeleteVfModule Request: " + xml)
+
+ logger.debug("input request xml: " + xml)
+
+ vnfId = utils.getNodeText(xml,"vnf-id")
+ execution.setVariable("vnfId", vnfId)
+ vfModuleId = utils.getNodeText(xml,"vf-module-id")
+ execution.setVariable("vfModuleId", vfModuleId)
+ def srvInstId = execution.getVariable("mso-service-instance-id")
+ execution.setVariable("srvInstId", srvInstId)
+ String requestId = ""
+ try {
+ requestId = execution.getVariable("mso-request-id")
+ } catch (Exception ex) {
+ requestId = utils.getNodeText(xml, "request-id")
+ }
+ execution.setVariable("requestId", requestId)
+ String source = utils.getNodeText(xml, "source")
+ execution.setVariable("source", source)
+ String serviceId = utils.getNodeText(xml, "service-id")
+ execution.setVariable("serviceId", serviceId)
+ String tenantId = utils.getNodeText(xml, "tenant-id")
+ execution.setVariable("tenantId", tenantId)
+
+ String serviceInstanceIdToSdnc = ""
+ if (xml.contains("service-instance-id")) {
+ serviceInstanceIdToSdnc = utils.getNodeText(xml, "service-instance-id")
+ } else {
+ serviceInstanceIdToSdnc = vfModuleId
+ }
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc)
+ String vfModuleName = utils.getNodeText(xml, "vf-module-name")
+ execution.setVariable("vfModuleName", vfModuleName)
+ String vfModuleModelName = utils.getNodeText(xml, "vf-module-model-name")
+ execution.setVariable("vfModuleModelName", vfModuleModelName)
+ String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region")
+ execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = utils.getNodeText(xml, "cloud-owner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ }
+
+ // formulate the request for PrepareUpdateAAIVfModule
+ String request = """<PrepareUpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<orchestration-status>pending-delete</orchestration-status>
</PrepareUpdateAAIVfModuleRequest>""" as String
- logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
- logger.debug("UpdateAAIVfModule Request: " + request)
- execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
- execution.setVariable("vfModuleFromAAI", null)
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
- }
- }
-
- // build a SDNC vnf-topology-operation request for the specified action
- // (note: the action passed is expected to be 'changedelete' or 'delete')
- public void prepSDNCAdapterRequest(DelegateExecution execution, String action) {
-
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis()
- }
-
- def srvInstId = execution.getVariable("srvInstId")
- def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
- String requestId = execution.getVariable("requestId")
- String source = execution.getVariable("source")
- String serviceId = execution.getVariable("serviceId")
- String vnfId = execution.getVariable("vnfId")
- String tenantId = execution.getVariable("tenantId")
- String vfModuleId = execution.getVariable("vfModuleId")
- String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc")
- String vfModuleName = execution.getVariable("vfModuleName")
- // Get vfModuleName from AAI response if it was not specified on the request
- if (vfModuleName == null || vfModuleName.isEmpty()) {
- if (execution.getVariable("vfModuleFromAAI") != null) {
- org.onap.aai.domain.yang.VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI")
- vfModuleName = vfModuleFromAAI.getVfModuleName()
- }
- }
- String vfModuleModelName = execution.getVariable("vfModuleModelName")
- String cloudSiteId = execution.getVariable("cloudSiteId")
- boolean retainResources = execution.getVariable("retainResources")
- String requestSubActionString = ""
- if (retainResources) {
- requestSubActionString = "<request-sub-action>RetainResource</request-sub-action>"
- }
- String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
+ logger.debug("UpdateAAIVfModule Request: " + request)
+ execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
+ execution.setVariable("vfModuleFromAAI", null)
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
+ }
+ }
+
+ // build a SDNC vnf-topology-operation request for the specified action
+ // (note: the action passed is expected to be 'changedelete' or 'delete')
+ public void prepSDNCAdapterRequest(DelegateExecution execution, String action) {
+
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis()
+ }
+
+ def srvInstId = execution.getVariable("srvInstId")
+ def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+ String requestId = execution.getVariable("requestId")
+ String source = execution.getVariable("source")
+ String serviceId = execution.getVariable("serviceId")
+ String vnfId = execution.getVariable("vnfId")
+ String tenantId = execution.getVariable("tenantId")
+ String vfModuleId = execution.getVariable("vfModuleId")
+ String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc")
+ String vfModuleName = execution.getVariable("vfModuleName")
+ // Get vfModuleName from AAI response if it was not specified on the request
+ if (vfModuleName == null || vfModuleName.isEmpty()) {
+ if (execution.getVariable("vfModuleFromAAI") != null) {
+ org.onap.aai.domain.yang.VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI")
+ vfModuleName = vfModuleFromAAI.getVfModuleName()
+ }
+ }
+ String vfModuleModelName = execution.getVariable("vfModuleModelName")
+ String cloudSiteId = execution.getVariable("cloudSiteId")
+ boolean retainResources = execution.getVariable("retainResources")
+ String requestSubActionString = ""
+ if (retainResources) {
+ requestSubActionString = "<request-sub-action>RetainResource</request-sub-action>"
+ }
+ String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -274,33 +272,33 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- logger.debug("sdncAdapterWorkflowRequest: " + request)
- logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request)
- execution.setVariable("sdncAdapterWorkflowRequest", request)
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing VnfAdapterDeleteV1 request
- public void prepVNFAdapterRequest(DelegateExecution execution) {
-
- def requestId = UUID.randomUUID().toString()
- def origRequestId = execution.getVariable('requestId')
- def srvInstId = execution.getVariable("serviceInstanceId")
- def aicCloudRegion = execution.getVariable("cloudSiteId")
- def cloudOwner = execution.getVariable("cloudOwner")
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId')
- def tenantId = execution.getVariable("tenantId")
- def messageId = execution.getVariable('requestId') + '-' +
- System.currentTimeMillis()
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
-
- String request = """
+ logger.debug("sdncAdapterWorkflowRequest: " + request)
+ logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request)
+ execution.setVariable("sdncAdapterWorkflowRequest", request)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing VnfAdapterDeleteV1 request
+ public void prepVNFAdapterRequest(DelegateExecution execution) {
+
+ def requestId = UUID.randomUUID().toString()
+ def origRequestId = execution.getVariable('requestId')
+ def srvInstId = execution.getVariable("serviceInstanceId")
+ def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId')
+ def tenantId = execution.getVariable("tenantId")
+ def messageId = execution.getVariable('requestId') + '-' +
+ System.currentTimeMillis()
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+
+ String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
<cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
@@ -318,303 +316,301 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
</deleteVfModuleRequest>
""" as String
- logger.debug("vnfAdapterRestV1Request: " + request)
- logger.debug("deleteVfModuleRequest: " + request)
- execution.setVariable("vnfAdapterRestV1Request", request)
- }
+ logger.debug("deleteVfModuleRequest: " + request)
+ execution.setVariable("vnfAdapterTaskRequest", request)
+ }
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing UpdateAAIVfModuleRequest request
- public void prepUpdateAAIVfModule(DelegateExecution execution) {
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing UpdateAAIVfModuleRequest request
+ public void prepUpdateAAIVfModule(DelegateExecution execution) {
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<UpdateAAIVfModuleRequest>
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<UpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<heat-stack-id>DELETE</heat-stack-id>
<orchestration-status>deleted</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- logger.debug("UpdateAAIVfModuleRequest :" + request)
- logger.debug("UpdateAAIVfModuleRequest: " + request)
- execution.setVariable("UpdateAAIVfModuleRequest", request)
- }
+ logger.debug("UpdateAAIVfModuleRequest: " + request)
+ execution.setVariable("UpdateAAIVfModuleRequest", request)
+ }
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing DeleteAAIVfModuleRequest request
- public void prepDeleteAAIVfModule(DelegateExecution execution) {
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing DeleteAAIVfModuleRequest request
+ public void prepDeleteAAIVfModule(DelegateExecution execution) {
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<DeleteAAIVfModuleRequest>
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<DeleteAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- logger.debug("DeleteAAIVfModuleRequest :" + request)
- logger.debug("DeleteAAIVfModuleRequest: " + request)
- execution.setVariable("DeleteAAIVfModuleRequest", request)
- }
-
- // generates a WorkflowException if
- // -
- public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
- "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable("DoDVfMod_deleteGenericVnfResponse"))
- execution.setVariable("WorkflowException", exception)
- }
-
- public void sdncValidateResponse(DelegateExecution execution, String response){
-
- execution.setVariable("prefix",Prefix)
-
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
-
- SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
- sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
-
- if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- logger.debug("Successfully Validated SDNC Response")
- }else{
- throw new BpmnError("MSOWorkflowException")
- }
- }
-
- public void postProcessVNFAdapterRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix",Prefix)
- try{
- logger.trace("STARTED postProcessVNFAdapterRequest Process")
-
- String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse")
- logger.debug("VNF Adapter Response is: " + vnfResponse)
- logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
-
- if(vnfResponse != null){
-
- if(vnfResponse.contains("deleteVfModuleResponse")){
- logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
- execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true)
-
- // Parse vnfOutputs for contrail network polcy FQDNs
- if (vnfResponse.contains("vfModuleOutputs")) {
- def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
- InputSource source = new InputSource(new StringReader(vfModuleOutputsXml));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document outputsXml = docBuilder.parse(source)
-
- NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry")
- List contrailNetworkPolicyFqdnList = []
- for (int i = 0; i< entries.getLength(); i++) {
- Node node = entries.item(i)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element) node
- String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent()
- if (key.endsWith("contrail_network_policy_fqdn")) {
- String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
- contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
- }
- else if (key.equals("oam_management_v4_address")) {
- String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
- execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
- }
- else if (key.equals("oam_management_v6_address")) {
- String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
- execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
- }
-
- }
- }
- if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- logger.debug("Setting the fqdn list")
- execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
- }
- }
- }else{
- logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
- }
- }else{
- logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
- }
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Internal Error Occured in PostProcess Method")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
- }
- logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
- }
-
- public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
-
- try {
- // get variables
- List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList")
- if (fqdnList == null) {
- logger.debug("No network policies to delete")
- return
- }
- int fqdnCount = fqdnList.size()
-
- execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount)
- logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount)
-
- if (fqdnCount > 0) {
- // AII loop call over contrail network policy fqdn list
- for (i in 0..fqdnCount-1) {
- String fqdn = fqdnList[i]
- // Query AAI for this network policy FQDN
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
+ logger.debug("DeleteAAIVfModuleRequest: " + request)
+ execution.setVariable("DeleteAAIVfModuleRequest", request)
+ }
+
+ // generates a WorkflowException if
+ // -
+ public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
+ "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable("DoDVfMod_deleteGenericVnfResponse"))
+ execution.setVariable("WorkflowException", exception)
+ }
+
+ public void sdncValidateResponse(DelegateExecution execution, String response){
+
+ execution.setVariable("prefix",Prefix)
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
+ logger.debug("Successfully Validated SDNC Response")
+ }else{
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }
+
+ public void postProcessVNFAdapterRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix",Prefix)
+ try{
+ logger.trace("STARTED postProcessVNFAdapterRequest Process")
+
+ String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse")
+ logger.debug("VNF Adapter Response is: " + vnfResponse)
+ logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
+
+ if(vnfResponse != null){
+
+ if(vnfResponse.contains("deleteVfModuleResponse")){
+ logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true)
+
+ // Parse vnfOutputs for contrail network polcy FQDNs
+ if (vnfResponse.contains("vfModuleOutputs")) {
+ def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
+ InputSource source = new InputSource(new StringReader(vfModuleOutputsXml));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document outputsXml = docBuilder.parse(source)
+
+ NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry")
+ List contrailNetworkPolicyFqdnList = []
+ for (int i = 0; i< entries.getLength(); i++) {
+ Node node = entries.item(i)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node
+ String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent()
+ if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
+ logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
+ }
+ else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
+ logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
+ execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
+ }
+ else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
+ logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
+ execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
+ }
+
+ }
+ }
+ if (!contrailNetworkPolicyFqdnList.isEmpty()) {
+ logger.debug("Setting the fqdn list")
+ execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
+ }
+ }
+ }else{
+ logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
+ }
+ }else{
+ logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
+ }
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Internal Error Occured in PostProcess Method")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
+ }
+ logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
+ }
+
+ public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
+
+ try {
+ // get variables
+ List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList")
+ if (fqdnList == null) {
+ logger.debug("No network policies to delete")
+ return
+ }
+ int fqdnCount = fqdnList.size()
+
+ execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount)
+ logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount)
+
+ if (fqdnCount > 0) {
+ // AII loop call over contrail network policy fqdn list
+ for (i in 0..fqdnCount-1) {
+ String fqdn = fqdnList[i]
+ // Query AAI for this network policy FQDN
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
- uri.queryParam("network-policy-fqdn", fqdn)
- try {
- Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
- if (networkPolicies.isPresent() && !networkPolicies.get().getNetworkPolicy().isEmpty()) {
- // This network policy FQDN exists in AAI - need to delete it now
- NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0)
- execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200)
- // Retrieve the network policy id for this FQDN
- def networkPolicyId = networkPolicy.getNetworkPolicyId()
- logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
- try {
- AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
- getAAIClient().delete(delUri)
- execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200)
- } catch (Exception e) {
- execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500)
- String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage()
- logger.debug(delErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage)
- }
- } else {
- execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404)
- // This network policy FQDN is not in AAI. No need to delete.
- logger.debug("The return code is: " + 404)
- logger.debug("This network policy FQDN is not in AAI: " + fqdn)
- logger.debug("Network policy FQDN is not in AAI")
- }
- }catch(Exception e ) {
- // aai all errors
- String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage()
- logger.debug(dataErrorMessage)
- }
- } // end loop
- } else {
- logger.debug("No contrail network policies to query/create")
- }
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- logger.debug(exceptionMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
-
- }
-
- /**
- * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
- *
- * @param execution The flow's execution instance.
- */
- public void prepUpdateAAIGenericVnf(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
-
- try {
- def vnfId = execution.getVariable('vnfId')
- def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
- def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
- def ipv4OamAddressElement = ''
- def managementV6AddressElement = ''
-
- if (oamManagementV4Address != null) {
- ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
- }
-
- if (oamManagementV6Address != null) {
- managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
- }
-
-
- String updateAAIGenericVnfRequest = """
+ uri.queryParam("network-policy-fqdn", fqdn)
+ try {
+ Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
+ if (networkPolicies.isPresent() && !networkPolicies.get().getNetworkPolicy().isEmpty()) {
+ // This network policy FQDN exists in AAI - need to delete it now
+ NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0)
+ execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200)
+ // Retrieve the network policy id for this FQDN
+ def networkPolicyId = networkPolicy.getNetworkPolicyId()
+ logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
+ try {
+ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+ getAAIClient().delete(delUri)
+ execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200)
+ } catch (Exception e) {
+ execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500)
+ String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage()
+ logger.debug(delErrorMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage)
+ }
+ } else {
+ execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404)
+ // This network policy FQDN is not in AAI. No need to delete.
+ logger.debug("The return code is: " + 404)
+ logger.debug("This network policy FQDN is not in AAI: " + fqdn)
+ logger.debug("Network policy FQDN is not in AAI")
+ }
+ }catch(Exception e ) {
+ // aai all errors
+ String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage()
+ logger.debug(dataErrorMessage)
+ }
+ } // end loop
+ } else {
+ logger.debug("No contrail network policies to query/create")
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+
+ }
+
+ /**
+ * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void prepUpdateAAIGenericVnf(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+
+ try {
+ def vnfId = execution.getVariable('vnfId')
+ def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
+ def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
+ def ipv4OamAddressElement = ''
+ def managementV6AddressElement = ''
+
+ if (oamManagementV4Address != null) {
+ ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
+ }
+
+ if (oamManagementV6Address != null) {
+ managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
+ }
+
+
+ String updateAAIGenericVnfRequest = """
<UpdateAAIGenericVnfRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
${ipv4OamAddressElement}
${managementV6AddressElement}
</UpdateAAIGenericVnfRequest>
"""
- updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
- execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
- logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
-
-
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the vnfId and vfModuleId provided in the inputs,
- * query AAI to get the corresponding VF Module info.
- * A 200 response is expected with the VF Module info in the response body,
- * Will determine VF Module's orchestration status if one exists
- *
- * @param execution The flow's execution instance.
- */
- public void queryAAIVfModuleForStatus(DelegateExecution execution) {
-
- def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- execution.setVariable(Prefix + 'orchestrationStatus', '')
-
- try {
- def vnfId = execution.getVariable('vnfId')
- def vfModuleId = execution.getVariable('vfModuleId')
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
-
- try {
+ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
+ execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
+ logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+
+
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Using the vnfId and vfModuleId provided in the inputs,
+ * query AAI to get the corresponding VF Module info.
+ * A 200 response is expected with the VF Module info in the response body,
+ * Will determine VF Module's orchestration status if one exists
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void queryAAIVfModuleForStatus(DelegateExecution execution) {
+
+ def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ execution.setVariable(Prefix + 'orchestrationStatus', '')
+
+ try {
+ def vnfId = execution.getVariable('vnfId')
+ def vfModuleId = execution.getVariable('vfModuleId')
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+
+ try {
Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, uri);
- // Retrieve VF Module info and its orchestration status; if not found, do nothing
+ // Retrieve VF Module info and its orchestration status; if not found, do nothing
if (vfModule.isPresent()) {
execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponseCode', 200)
execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', vfModule.get())
@@ -622,20 +618,20 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus)
logger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
}
- } catch (Exception ex) {
- logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
- }
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
- }
- }
+ } catch (Exception ex) {
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
+ }
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
+ }
+ }
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index 34a210364a..350de4a03d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,244 +53,244 @@ import org.slf4j.LoggerFactory
public class DoDeleteVfModuleFromVnf extends VfModuleBase {
private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class);
- def Prefix="DDVFMV_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null)
- }
-
- // parse the incoming request
- public void preProcessRequest(DelegateExecution execution) {
-
- initProcessVariables(execution)
-
- try {
-
- // Building Block-type request
-
- // Set mso-request-id to request-id for VNF Adapter interface
- String requestId = execution.getVariable("msoRequestId")
- execution.setVariable("mso-request-id", requestId)
- execution.setVariable("requestId", requestId)
- logger.debug("msoRequestId: " + requestId)
- String tenantId = execution.getVariable("tenantId")
- logger.debug("tenantId: " + tenantId)
- String cloudSiteId = execution.getVariable("lcpCloudRegionId")
- execution.setVariable("cloudSiteId", cloudSiteId)
- logger.debug("cloudSiteId: " + cloudSiteId)
- String cloudOwner = execution.getVariable("cloudOwner")
- execution.setVariable("cloudOwner", cloudOwner)
- logger.debug("cloudOwner: " + cloudOwner)
- // Source is HARDCODED
- String source = "VID"
- execution.setVariable("source", source)
- // isVidRequest is hardcoded to "true"
- execution.setVariable("isVidRequest", "true")
- // SrvInstId is hardcoded to empty
- execution.setVariable("srvInstId", "")
- // ServiceId is hardcoded to empty
- execution.setVariable("serviceId", "")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- logger.debug("serviceInstanceId: " + serviceInstanceId)
- String vnfId = execution.getVariable("vnfId")
- logger.debug("vnfId: " + vnfId)
- String vfModuleId = execution.getVariable("vfModuleId")
- logger.debug("vfModuleId: " + vfModuleId)
- if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
- }
- else {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
- }
-
- String sdncVersion = execution.getVariable("sdncVersion")
- if (sdncVersion == null) {
- sdncVersion = "1707"
- }
- execution.setVariable(Prefix + "sdncVersion", sdncVersion)
- logger.debug("Incoming Sdnc Version is: " + sdncVersion)
-
- String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
- if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
- def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception");
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
- logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Exception is: " + e.getMessage())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
- }
- }
-
- public void queryAAIForVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.queryAAIForVfModule(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
-
- try {
- def vnfId = execution.getVariable('vnfId')
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
- try {
- Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri)
-
- if(genericVnf.isPresent()){
- execution.setVariable('DDVMFV_getVnfResponseCode', 200)
- execution.setVariable('DDVMFV_getVnfResponse', genericVnf.get())
- }else{
- execution.setVariable('DDVMFV_getVnfResponseCode', 404)
- execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!")
- }
- } catch (Exception ex) {
- logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
- execution.setVariable('DDVMFV_getVnfResponseCode', 500)
- execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
- * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
- * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not
- * attempting to delete it.
- *
- * @param execution The flow's execution instance.
- */
- public void validateVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.validateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
-
- try {
- GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse')
- def vnfId = execution.getVariable('_vnfId')
- def vfModuleId = execution.getVariable('vfModuleId')
+ def Prefix="DDVFMV_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void initProcessVariables(DelegateExecution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null)
+ }
+
+ // parse the incoming request
+ public void preProcessRequest(DelegateExecution execution) {
+
+ initProcessVariables(execution)
+
+ try {
+
+ // Building Block-type request
+
+ // Set mso-request-id to request-id for VNF Adapter interface
+ String requestId = execution.getVariable("msoRequestId")
+ execution.setVariable("mso-request-id", requestId)
+ execution.setVariable("requestId", requestId)
+ logger.debug("msoRequestId: " + requestId)
+ String tenantId = execution.getVariable("tenantId")
+ logger.debug("tenantId: " + tenantId)
+ String cloudSiteId = execution.getVariable("lcpCloudRegionId")
+ execution.setVariable("cloudSiteId", cloudSiteId)
+ logger.debug("cloudSiteId: " + cloudSiteId)
+ String cloudOwner = execution.getVariable("cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
+ // Source is HARDCODED
+ String source = "VID"
+ execution.setVariable("source", source)
+ // isVidRequest is hardcoded to "true"
+ execution.setVariable("isVidRequest", "true")
+ // SrvInstId is hardcoded to empty
+ execution.setVariable("srvInstId", "")
+ // ServiceId is hardcoded to empty
+ execution.setVariable("serviceId", "")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
+ String vnfId = execution.getVariable("vnfId")
+ logger.debug("vnfId: " + vnfId)
+ String vfModuleId = execution.getVariable("vfModuleId")
+ logger.debug("vfModuleId: " + vfModuleId)
+ if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
+ }
+ else {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
+ }
+
+ String sdncVersion = execution.getVariable("sdncVersion")
+ if (sdncVersion == null) {
+ sdncVersion = "1707"
+ }
+ execution.setVariable(Prefix + "sdncVersion", sdncVersion)
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
+
+ String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+ if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
+ def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Exception is: " + e.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
+ }
+ }
+
+ public void queryAAIForVfModule(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.queryAAIForVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+
+ try {
+ def vnfId = execution.getVariable('vnfId')
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ try {
+ Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri)
+
+ if(genericVnf.isPresent()){
+ execution.setVariable('DDVMFV_getVnfResponseCode', 200)
+ execution.setVariable('DDVMFV_getVnfResponse', genericVnf.get())
+ }else{
+ execution.setVariable('DDVMFV_getVnfResponseCode', 404)
+ execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!")
+ }
+ } catch (Exception ex) {
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
+ execution.setVariable('DDVMFV_getVnfResponseCode', 500)
+ execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
+ }
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
+ * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
+ * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not
+ * attempting to delete it.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void validateVfModule(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.validateVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ try {
+ GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse')
+ def vnfId = execution.getVariable('_vnfId')
+ def vfModuleId = execution.getVariable('vfModuleId')
Optional<VfModule> vfModule = Optional.empty()
if(genericVnf.getVfModules()!=null && ! genericVnf.getVfModules().getVfModule().isEmpty()) {
vfModule = genericVnf.getVfModules().getVfModule().stream().filter { v -> v.getVfModuleId().equals(vfModuleId) }.findFirst()
}
- if (!vfModule.isPresent()) {
- String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg)
- } else {
+ if (!vfModule.isPresent()) {
+ String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg)
+ } else {
Boolean isOnlyVfModule = (genericVnf.getVfModules().getVfModule().size() == 1)
- if (isDebugLogEnabled) {
- logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule)
- }
- if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) {
+ if (isDebugLogEnabled) {
+ logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule)
+ }
+ if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) {
String msg = 'Cannot delete VF Module \'' + vfModuleId +
'\'since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\''
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002,msg)
- }
- def heatStackId = vfModule.get().getHeatStackId()
- execution.setVariable('DDVMFV_heatStackId', heatStackId)
- logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId)
- }
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
- }
- }
-
-
- public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCDeactivateRequest ")
-
- def serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- try{
- //Build SDNC Request
-
- String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
-
- deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
- execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest)
- logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
-
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
- }
-
- public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCUnassignRequest Process ")
- try{
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
-
- execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest)
- logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
-
-
- }catch(Exception e){
- logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
- }
-
- public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
- }
- def callbackURL = execution.getVariable("sdncCallbackUrl")
- def requestId = execution.getVariable("msoRequestId")
- def serviceId = execution.getVariable("serviceId")
- def serviceInstanceId = execution.getVariable("serviceInstanceId")
- def vfModuleId = execution.getVariable("vfModuleId")
- def source = execution.getVariable("source")
- def vnfId = execution.getVariable("vnfId")
-
- def sdncVersion = execution.getVariable(Prefix + "sdncVersion")
-
- String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ }
+ def heatStackId = vfModule.get().getHeatStackId()
+ execution.setVariable('DDVMFV_heatStackId', heatStackId)
+ logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId)
+ }
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
+ }
+ }
+
+
+ public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCDeactivateRequest ")
+
+ def serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ try{
+ //Build SDNC Request
+
+ String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
+
+ deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
+ execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
+ }
+
+ public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process ")
+ try{
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
+
+ execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+
+
+ }catch(Exception e){
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
+ }
+
+ public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
+ }
+ def callbackURL = execution.getVariable("sdncCallbackUrl")
+ def requestId = execution.getVariable("msoRequestId")
+ def serviceId = execution.getVariable("serviceId")
+ def serviceInstanceId = execution.getVariable("serviceInstanceId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ def source = execution.getVariable("source")
+ def vnfId = execution.getVariable("vnfId")
+
+ def sdncVersion = execution.getVariable(Prefix + "sdncVersion")
+
+ String sdncRequest =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -312,73 +312,73 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
</request-information>
<service-information>
<service-id/>
- <subscription-service-type/>
+ <subscription-service-type/>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
<global-customer-id/>
</service-information>
<vnf-information>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
- <vnf-type/>
+ <vnf-type/>
</vnf-information>
<vf-module-information>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</vf-module-information>
- <vf-module-request-input/>
+ <vf-module-request-input/>
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
-
- logger.debug("sdncRequest: " + sdncRequest)
- return sdncRequest
- }
-
- public void validateSDNCResponse(DelegateExecution execution, String response, String method){
-
- execution.setVariable("prefix",Prefix)
- logger.trace("STARTED ValidateSDNCResponse Process")
-
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
-
- logger.debug("workflowException: " + workflowException)
-
- SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
- sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
-
- logger.debug("SDNCResponse: " + response)
-
- String sdncResponse = response
- if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
- }else{
- logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
- throw new BpmnError("MSOWorkflowException")
- }
- logger.trace("COMPLETED ValidateSDNCResponse Process")
- }
-
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing VnfAdapterDeleteV1 request
- public void prepVNFAdapterRequest(DelegateExecution execution) {
-
- def requestId = UUID.randomUUID().toString()
- def origRequestId = execution.getVariable('requestId')
- def srvInstId = execution.getVariable("serviceInstanceId")
- def aicCloudRegion = execution.getVariable("cloudSiteId")
- def cloudOwner = execution.getVariable("cloudOwner")
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId')
- def tenantId = execution.getVariable("tenantId")
- def messageId = execution.getVariable('requestId') + '-' +
- System.currentTimeMillis()
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
-
- String request = """
+
+ logger.debug("sdncRequest: " + sdncRequest)
+ return sdncRequest
+ }
+
+ public void validateSDNCResponse(DelegateExecution execution, String response, String method){
+
+ execution.setVariable("prefix",Prefix)
+ logger.trace("STARTED ValidateSDNCResponse Process")
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+ logger.debug("workflowException: " + workflowException)
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+ logger.debug("SDNCResponse: " + response)
+
+ String sdncResponse = response
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ }else{
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ throw new BpmnError("MSOWorkflowException")
+ }
+ logger.trace("COMPLETED ValidateSDNCResponse Process")
+ }
+
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing VnfAdapterDeleteV1 request
+ public void prepVNFAdapterRequest(DelegateExecution execution) {
+
+ def requestId = UUID.randomUUID().toString()
+ def origRequestId = execution.getVariable('requestId')
+ def srvInstId = execution.getVariable("serviceInstanceId")
+ def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId')
+ def tenantId = execution.getVariable("tenantId")
+ def messageId = execution.getVariable('requestId') + '-' +
+ System.currentTimeMillis()
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+
+ String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
<cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
@@ -396,126 +396,126 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
</deleteVfModuleRequest>
""" as String
- logger.debug("vnfAdapterRestV1Request: " + request)
- logger.debug("deleteVfModuleRequest: " + request)
- execution.setVariable("vnfAdapterRestV1Request", request)
- }
-
-
- // generates a WorkflowException if
- // -
- public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"),
- "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable("DDVFMV_deleteGenericVnfResponse"))
- execution.setVariable("WorkflowException", exception)
- }
-
- public void postProcessVNFAdapterRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix",Prefix)
- try{
- logger.trace("STARTED postProcessVNFAdapterRequest Process")
-
- String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse")
- logger.debug("VNF Adapter Response is: " + vnfResponse)
- logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
-
- if(vnfResponse != null){
-
- if(vnfResponse.contains("deleteVfModuleResponse")){
- logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
- execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true)
-
- // Parse vnfOutputs for contrail network polcy FQDNs
- def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
- if(!isBlank(vfModuleOutputsXml)) {
- vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml)
- List contrailNetworkPolicyFqdnList = []
- for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) {
- String key = utils.getChildNodeText(node, "key")
- if(key == null) {
-
- } else if (key.endsWith("contrail_network_policy_fqdn")) {
- String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value")
- logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
- contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
- }
- else if (key.equals("oam_management_v4_address")) {
- String oamManagementV4Address = utils.getChildNodeText(node, "value")
- logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
- execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
- }
- else if (key.equals("oam_management_v6_address")) {
- String oamManagementV6Address = utils.getChildNodeText(node, "value")
- logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
- execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
- }
- }
- if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- logger.debug("Setting the fqdn list")
- execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
- }
- }
- }else{
- logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
- }
- }else{
- logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
- }
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Internal Error Occured in PostProcess Method")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
- }
- logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
- }
-
- public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
-
- try {
- // get variables
- List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")
- if (fqdnList == null) {
- logger.debug("No network policies to delete")
- return
- }
- int fqdnCount = fqdnList.size()
-
- execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount)
- logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- if (fqdnCount > 0) {
- // AII loop call over contrail network policy fqdn list
- for (i in 0..fqdnCount-1) {
-
- int counting = i+1
- String fqdn = fqdnList[i]
-
- // Query AAI for this network policy FQDN
+
+ logger.debug("deleteVfModuleRequest: " + request)
+ execution.setVariable("vnfAdapterTaskRequest", request)
+ }
+
+
+ // generates a WorkflowException if
+ // -
+ public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"),
+ "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable("DDVFMV_deleteGenericVnfResponse"))
+ execution.setVariable("WorkflowException", exception)
+ }
+
+ public void postProcessVNFAdapterRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix",Prefix)
+ try{
+ logger.trace("STARTED postProcessVNFAdapterRequest Process")
+
+ String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse")
+ logger.debug("VNF Adapter Response is: " + vnfResponse)
+ logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
+
+ if(vnfResponse != null){
+
+ if(vnfResponse.contains("deleteVfModuleResponse")){
+ logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true)
+
+ // Parse vnfOutputs for contrail network polcy FQDNs
+ def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
+ if(!isBlank(vfModuleOutputsXml)) {
+ vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml)
+ List contrailNetworkPolicyFqdnList = []
+ for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) {
+ String key = utils.getChildNodeText(node, "key")
+ if(key == null) {
+
+ } else if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value")
+ logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
+ }
+ else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = utils.getChildNodeText(node, "value")
+ logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
+ execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
+ }
+ else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = utils.getChildNodeText(node, "value")
+ logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
+ execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
+ }
+ }
+ if (!contrailNetworkPolicyFqdnList.isEmpty()) {
+ logger.debug("Setting the fqdn list")
+ execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
+ }
+ }
+ }else{
+ logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
+ }
+ }else{
+ logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
+ }
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Internal Error Occured in PostProcess Method")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
+ }
+ logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
+ }
+
+ public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
+
+ try {
+ // get variables
+ List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")
+ if (fqdnList == null) {
+ logger.debug("No network policies to delete")
+ return
+ }
+ int fqdnCount = fqdnList.size()
+
+ execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount)
+ logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ if (fqdnCount > 0) {
+ // AII loop call over contrail network policy fqdn list
+ for (i in 0..fqdnCount-1) {
+
+ int counting = i+1
+ String fqdn = fqdnList[i]
+
+ // Query AAI for this network policy FQDN
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
- uri.queryParam("network-policy-fqdn", fqdn)
+ uri.queryParam("network-policy-fqdn", fqdn)
try {
Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
@@ -555,35 +555,35 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} // end loop
- } else {
- logger.debug("No contrail network policies to query/create")
+ } else {
+ logger.debug("No contrail network policies to query/create")
- }
+ }
+
+ } catch (BpmnError e) {
+ throw e;
- } catch (BpmnError e) {
- throw e;
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- logger.debug(exceptionMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
+ }
- }
-
- // and formulate the outgoing DeleteAAIVfModuleRequest request
- public void prepDeleteAAIVfModule(DelegateExecution execution) {
+ // and formulate the outgoing DeleteAAIVfModuleRequest request
+ public void prepDeleteAAIVfModule(DelegateExecution execution) {
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<DeleteAAIVfModuleRequest>
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<DeleteAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- logger.debug("DeleteAAIVfModuleRequest :" + request)
-
- execution.setVariable("DeleteAAIVfModuleRequest", request)
- }
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
+
+ execution.setVariable("DeleteAAIVfModuleRequest", request)
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy
index 89490ff620..89490ff620 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
index 6b7944cc6e..46f061d89c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
@@ -159,4 +159,79 @@ class CreateSliceServiceTest extends MsoGroovyTest {
assertNotNull(values)
}
+ @Test
+ void testPrepareDecomposeService() {
+ when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest)
+ when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.prepareDecomposeService(mockExecution)
+
+ String serviceModelInfoExcept = """{
+ "modelInvariantUuid":"123456",
+ "modelUuid":"123456",
+ "modelVersion":""
+ }"""
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("ssServiceModelInfo"), captor.capture())
+ String serviceModelInfo = captor.getValue()
+ assertEquals(serviceModelInfoExcept.replaceAll("\\s+", ""),
+ serviceModelInfo.replaceAll("\\s+", ""))
+ }
+
+ @Test
+ void testProcessDecomposition() {
+ when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest)
+ when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
+ when(mockExecution.getVariable("nstSolution")).thenReturn(nstSolution)
+
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.processDecomposition(mockExecution)
+
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("subscriptionServiceType"), captor.capture())
+ assertEquals(captor.getValue(), "5G")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("serviceType"), captor.capture())
+ assertEquals(captor.getValue(), "embb")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("resourceSharingLevel"), captor.capture())
+ assertEquals(captor.getValue(), "shared")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelUuid"), captor.capture())
+ assertEquals(captor.getValue(), "aaaaaa")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelInvariantUuid"), captor.capture())
+ assertEquals(captor.getValue(), "bbbbbb")
+ }
+
+ @Test
+ void testPrepareCreateOrchestrationTask() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("test")
+ when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
+
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.prepareCreateOrchestrationTask(mockExecution)
+
+ SliceTaskParams sliceTaskParamsExpect = new SliceTaskParams()
+ sliceTaskParamsExpect.setServiceId("123456")
+ sliceTaskParamsExpect.setServiceName("test")
+ sliceTaskParamsExpect.setServiceProfile(serviceProfile)
+ String paramJsonExpect = sliceTaskParamsExpect.convertToJson()
+
+ Mockito.verify(mockExecution, times(2)).setVariable(eq("subscriptionServiceType"), captor.capture())
+ List allValues = captor.getAllValues()
+ SliceTaskParams sliceTaskParams = allValues.get(0)
+ String paramJson = allValues.get(1)
+ assertEquals(sliceTaskParams.getServiceId(), sliceTaskParams.getServiceId())
+ assertEquals(sliceTaskParams.getServiceName(), sliceTaskParams.getServiceName())
+ assertEquals(sliceTaskParams.getServiceProfile(), sliceTaskParams.getServiceProfile())
+ assertEquals(paramJsonExpect, paramJson)
+ }
+
+ @Test
+ void testSendSyncResponse() {
+ when(mockExecution.getVariable("operationId")).thenReturn("123456")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.sendSyncResponse(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+ def catchSyncResponse = captor.getValue()
+ assertEquals(catchSyncResponse, true)
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn
index b7ce608090..2e5d2e30b1 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DeleteVfModuleVolumeInfraV1" name="DeleteVfModuleVolumeInfraV1" isExecutable="true">
<bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
@@ -51,13 +51,12 @@ deleteVfMod.executeMethod('prepareVnfAdapterDeleteRequest', execution, isDebugLo
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DELVfModVol_tenantId") == execution.getVariable("DELVfModVol_volumeGroupTenantId")}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="SequenceFlow_21" name="" sourceRef="ExclusiveGateway_3" targetRef="ScriptTask_2" />
- <bpmn2:callActivity id="callVnfAdapterDeleteSubflow_CallActivity" name="Call Vnf Adapter Delete subflow" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="callVnfAdapterDeleteSubflow_CallActivity" name="Call Vnf Adapter Delete subflow" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DELVfModVol_deleteVnfARequest" target="vnfAdapterRestV1Request" />
- <camunda:out source="vnfAdapterRestV1Response" target="DELVfModVol_deleteVnfAResponse" />
+ <camunda:in source="DELVfModVol_deleteVnfARequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DELVfModVol_deleteVnfAResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in variables="all" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" />
</bpmn2:extensionElements>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn
index 078d72a1d8..ce346e13b3 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_ZBLUcCkQEeaY6ZhIaNLwzg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_ZBLUcCkQEeaY6ZhIaNLwzg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="UpdateVfModuleVolumeInfraV1" name="UpdateVfModuleVolumeInfraV1" isExecutable="true">
<bpmn2:endEvent id="EndEvent_4" name="TheEnd">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
@@ -56,14 +56,13 @@ def uvmv = new UpdateVfModuleVolumeInfraV1()
uvmv.executeMethod('prepCompletionHandlerRequest', execution, UPDVfModVol_requestId, 'UPDATE', UPDVfModVol_source, isDebugLogEnabled)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ScriptTask_prepCompletionHandlerRequest" targetRef="CallActivity_completionHandler" />
- <bpmn2:callActivity id="CallActivity_callVNFAdapterRest" name="VNFAdapterRest" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="CallActivity_callVNFAdapterRest" name="VNFAdapterRest" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:in source="mso-request-id" target="mso-request-id" />
- <camunda:out source="vnfAdapterRestV1Response" target="UPDVfModVol_vnfAdapterRestResponse" />
+ <camunda:out source="WorkflowResponse" target="UPDVfModVol_vnfAdapterRestResponse" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in source="UPDVfModVol_vnfAdapterRestRequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="UPDVfModVol_vnfAdapterRestRequest" target="vnfAdapterTaskRequest" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_21</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_19</bpmn2:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn
index c16061edb2..0d1b970c62 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn
@@ -224,10 +224,10 @@ doCreateVfModule.prepareCreateAAIVfModuleVolumeGroupRequest(execution)]]></bpmn2
def doCreateVfModule = new DoCreateVfModule()
doCreateVfModule.preProcessVNFAdapterRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:callActivity id="CallVNFAdapterVFModuleCreate" name="Call VNF Adapter to create VF Module" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="CallVNFAdapterVFModuleCreate" name="Call VNF Adapter to create VF Module" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DCVFM_createVnfARequest" target="vnfAdapterRestV1Request" />
- <camunda:out source="vnfAdapterRestV1Response" target="DCVFM_createVnfAResponse" />
+ <camunda:in source="DCVFM_createVnfARequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DCVFM_createVnfAResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
<camunda:in variables="all" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn
index 2508b31f01..e9675b89f8 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateVfModuleRollback" name="DoCreateVfModuleRollback" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
@@ -38,13 +38,12 @@
def dcvfmr = new DoCreateVfModuleRollback()
dcvfmr.prepVNFAdapterRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" />
- <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke&#10;VNFAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapter" />
+ <bpmn2:callActivity id="InvokeVNFAdapter" name="Invoke&#10;VNFAdapterTask" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="DoDVfMod_DoCreateVfModuleRollbackResponse" />
+ <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DoDVfMod_DoCreateVfModuleRollbackResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn2:extensionElements>
@@ -375,7 +374,7 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]></bpmn2:script>
def dcvfmr = new DoCreateVfModuleRollback()
dcvfmr.prepUpdateAAIVfModuleToAssigned(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_08aruzz" sourceRef="InvokeVNFAdapterRestV1" targetRef="ExclusiveGateway_0ahc44p" />
+ <bpmn2:sequenceFlow id="SequenceFlow_08aruzz" sourceRef="InvokeVNFAdapter" targetRef="ExclusiveGateway_0ahc44p" />
</bpmn2:process>
<bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
<bpmn2:message id="Message_1" name="DoCreateVfModuleRollbackRequest" />
@@ -403,7 +402,7 @@ dcvfmr.prepUpdateAAIVfModuleToAssigned(execution)]]></bpmn2:script>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep">
<dc:Bounds x="104" y="763" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapter">
<dc:Bounds x="262" y="763" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_ScriptTask_170" targetElement="_BPMNShape_CallActivity_13">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn
index a762b7ecd7..6f3dceda84 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="DoCreateVfModuleVolumeRollback" name="DoCreateVfModuleVolumeRollback" isExecutable="true">
<bpmn:subProcess id="SubProcess_1p4663w" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
<bpmn:scriptTask id="ScriptTask_0by1uwk" name="Log / Print Unexpected Error" scriptFormat="groovy">
@@ -33,10 +33,9 @@ doCreateVfModuleVolumeRollback.processJavaException(execution)]]></bpmn:script>
<bpmn:outgoing>SequenceFlow_0h7k68j</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_10dawse</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:callActivity id="CallActivity_03pmk7v" name="Call VNF Adapter Rollback" calledElement="vnfAdapterRestV1">
+ <bpmn:callActivity id="CallActivity_03pmk7v" name="Call VNF Adapter Rollback" calledElement="vnfAdapterTask">
<bpmn:extensionElements>
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:in source="DCVFMODVOLRBK_rollbackVnfARequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DCVFMODVOLRBK_rollbackVnfARequest" target="vnfAdapterTaskRequest" />
<camunda:out source="workflowException" target="workflowException" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn
index 26a4112d59..58ea0c4951 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn
@@ -63,15 +63,14 @@ def doCreateVfModuleVolumeV2 = new DoCreateVfModuleVolumeV2()
doCreateVfModuleVolumeV2.executeMethod('callRESTCreateAAIVolGrpName', execution, isDebugLogEnabled)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ScriptTask_callRestAaiCreateVolumeGrp" targetRef="ScriptTask_prepareVnfAdapterCreate" />
- <bpmn2:callActivity id="CallActivity_callVnfAdapterCreate" name="Call VNF Adapter Create" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="CallActivity_callVnfAdapterCreate" name="Call VNF Adapter Create" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DCVFMODVOLV2_createVnfARequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DCVFMODVOLV2_createVnfARequest" target="vnfAdapterTaskRequest" />
<camunda:in source="msoRequestId" target="mso-request-id" />
<camunda:in source="serviceInstanceId" target="mso-service-instance-id" />
- <camunda:out source="vnfAdapterRestV1Response" target="DCVFMODVOLV2_createVnfAResponse" />
+ <camunda:out source="WorkflowResponse" target="DCVFMODVOLV2_createVnfAResponse" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="VNFREST_vnfAdapterStatusCode" target="DCVFMODVOLV2_createVnfAReturnCode" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn
index 848796c0b6..6026fc84b3 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoDeleteVfModule" name="DoDeleteVfModule" isExecutable="true">
<bpmn2:scriptTask id="UpdateAAIVfModulePrep" name="UpdateAAIVfModule &#10;Prep" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0fp1wqz</bpmn2:incoming>
@@ -30,7 +30,7 @@ dvm.prepUpdateAAIVfModule(execution)]]></bpmn2:script>
<bpmn2:incoming>SequenceFlow_029ioyr</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14xn858</bpmn2:outgoing>
</bpmn2:callActivity>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterTask" />
<bpmn2:callActivity id="InvokeSDNCAdapterV1_2" name="Invoke &#10;SDNCAdapterV1" calledElement="sdncAdapter">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
@@ -60,12 +60,11 @@ def dvm = new DoDeleteVfModule()
dvm.prepSDNCAdapterRequest(execution, "delete")]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="SDNCAdapterPrep2" targetRef="InvokeSDNCAdapterV1_2" />
- <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke &#10;VNFAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="InvokeVNFAdapterTask" name="Invoke&#10;VNFAdapterTask" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="DoDVfMod_doDeleteVfModuleResponse" />
+ <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DoDVfMod_doDeleteVfModuleResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn2:extensionElements>
@@ -182,7 +181,7 @@ doDeleteVfModule.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script>
def dvm = new DoDeleteVfModule()
dvm.queryAAIVfModuleForStatus(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1xruki1" sourceRef="InvokeVNFAdapterRestV1" targetRef="PostProcessVNFAdapterRequest" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1xruki1" sourceRef="InvokeVNFAdapterTask" targetRef="PostProcessVNFAdapterRequest" />
<bpmn2:sequenceFlow id="SequenceFlow_14xn858" sourceRef="InvokePrepareUpdateAAIVfModule" targetRef="VNFAdapterPrep" />
</bpmn2:process>
<bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
@@ -221,7 +220,7 @@ dvm.queryAAIVfModuleForStatus(execution)]]></bpmn2:script>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep">
<dc:Bounds x="193" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterTask">
<dc:Bounds x="404" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_171" bpmnElement="UpdateAAIVfModulePrep">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn
index b7a1373fe9..918964f8f8 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoDeleteVfModuleFromVnf" name="DoDeleteVfModuleFromVnf" isExecutable="true">
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapter" />
<bpmn2:callActivity id="callSDNCAdapterTopologyUnassign" name="Call SDNC Adapter Topology Unassign" calledElement="sdncAdapter">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
@@ -31,12 +31,11 @@ def ddvmfv = new DoDeleteVfModuleFromVnf()
ddvmfv.preProcessSDNCUnassignRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="SDNCAdapterPrep2" targetRef="callSDNCAdapterTopologyUnassign" />
- <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke &#10;&#10;VNFAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="InvokeVNFAdapter" name="Invoke&#10;&#10;VNFAdapter" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="DDVMFV_doDeleteVfModuleResponse" />
+ <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DDVMFV_doDeleteVfModuleResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn2:extensionElements>
@@ -83,7 +82,7 @@ ddvmfv.postProcessVNFAdapterRequest(execution)]]></bpmn2:script>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_0y4td40" sourceRef="preProcessSDNCDeactivateRequest" targetRef="callSDNCAdapterTopologyDeactivate" />
<bpmn2:sequenceFlow id="SequenceFlow_12q2r4i" sourceRef="callSDNCAdapterTopologyDeactivate" targetRef="postProcessSDNCDeactivateRequest" />
- <bpmn2:sequenceFlow id="SequenceFlow_0hia88a" sourceRef="InvokeVNFAdapterRestV1" targetRef="PostProcessVNFAdapterRequest" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0hia88a" sourceRef="InvokeVNFAdapter" targetRef="PostProcessVNFAdapterRequest" />
<bpmn2:sequenceFlow id="SequenceFlow_0kx9e3s" sourceRef="postProcessSDNCDeactivateRequest" targetRef="VNFAdapterPrep" />
<bpmn2:sequenceFlow id="SequenceFlow_0ltm4jt" sourceRef="DeleteNetworkPoliciesFromAAI" targetRef="SDNCAdapterPrep2" />
<bpmn2:scriptTask id="preProcessSDNCDeactivateRequest" name="PreProcess SDNC Deactivate Request" scriptFormat="groovy">
@@ -187,7 +186,7 @@ ddvmfv.prepDeleteAAIVfModule(execution)]]></bpmn2:script>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep">
<dc:Bounds x="125" y="330" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapter">
<dc:Bounds x="281" y="330" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_172" bpmnElement="SDNCAdapterPrep2">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn
index 4409f2a0dc..e7706c20e6 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn
@@ -1,5 +1,5 @@
<?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="1.4.0">
+<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="1.10.0">
<bpmn:process id="DoDeleteVfModuleVolumeV2" name="DoDeleteVfModuleVolumeV2" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="Start">
<bpmn:outgoing>SequenceFlow_1gvfdp4</bpmn:outgoing>
@@ -25,21 +25,20 @@ deleteVfMod.executeMethod('callRESTQueryAAIForVolumeGroup', execution, isDebugLo
def deleteVfMod = new DoDeleteVfModuleVolumeV2()
deleteVfMod.executeMethod('prepareVnfAdapterDeleteRequest', execution, isDebugLogEnabled)]]></bpmn:script>
</bpmn:scriptTask>
- <bpmn:callActivity id="Task_14fsstq" name="Call REST VNF Adapter Delete" calledElement="vnfAdapterRestV1">
+ <bpmn:callActivity id="Task_14fsstq" name="Call REST VNF Adapter Delete" calledElement="vnfAdapterTask">
<bpmn:extensionElements>
- <camunda:in source="DDVMV_deleteVnfARequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DDVMV_deleteVnfARequest" target="vnfAdapterTaskRequest" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in variables="all" />
- <camunda:out source="vnfAdapterRestV1Response" target="DDVMV_deleteVnfAResponse" />
+ <camunda:out source="WorkflowResponse" target="DDVMV_deleteVnfAResponse" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1tgngf7</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1x3luyj</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_04zsr0f</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:scriptTask id="Task_17q1roq" name="Call REST AAI Delete Volume Group" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0cy0y9t</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_04zsr0f</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_13c3cv2</bpmn:outgoing>
<bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
def deleteVfMod = new DoDeleteVfModuleVolumeV2()
@@ -61,20 +60,6 @@ deleteVfMod.executeMethod('preProcessRequest', execution, isDebugLogEnabled)
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_1gvfdp4" sourceRef="StartEvent_1" targetRef="Task_1i432ud" />
<bpmn:sequenceFlow id="SequenceFlow_1vy2ojp" sourceRef="Task_1i432ud" targetRef="Task_06u1lr0" />
- <bpmn:exclusiveGateway id="ExclusiveGateway_0o3lxtf" name="VNF Adapter REST call success?">
- <bpmn:incoming>SequenceFlow_1x3luyj</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0cy0y9t</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1rgd8dg</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_1x3luyj" sourceRef="Task_14fsstq" targetRef="ExclusiveGateway_0o3lxtf" />
- <bpmn:sequenceFlow id="SequenceFlow_0cy0y9t" name="Yes" sourceRef="ExclusiveGateway_0o3lxtf" targetRef="Task_17q1roq">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{VNFREST_SuccessIndicator == true}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:endEvent id="EndEvent_00cohim" name="throw MSOException">
- <bpmn:incoming>SequenceFlow_1rgd8dg</bpmn:incoming>
- <bpmn:errorEventDefinition errorRef="Error_0fa7ks7" />
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1rgd8dg" sourceRef="ExclusiveGateway_0o3lxtf" targetRef="EndEvent_00cohim" />
<bpmn:scriptTask id="Task_018w43g" name="Post Process" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_13c3cv2</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1sgtwr2</bpmn:outgoing>
@@ -84,6 +69,7 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn:
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_13c3cv2" sourceRef="Task_17q1roq" targetRef="Task_018w43g" />
<bpmn:sequenceFlow id="SequenceFlow_1sgtwr2" sourceRef="Task_018w43g" targetRef="EndEvent_0fw1gkf" />
+ <bpmn:sequenceFlow id="SequenceFlow_04zsr0f" sourceRef="Task_14fsstq" targetRef="Task_17q1roq" />
</bpmn:process>
<bpmn:error id="Error_0fa7ks7" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -153,39 +139,6 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn:
<dc:Bounds x="377" y="95" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ExclusiveGateway_0o3lxtf_di" bpmnElement="ExclusiveGateway_0o3lxtf" isMarkerVisible="true">
- <dc:Bounds x="1028" y="95" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1020" y="145" width="66" height="36" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1x3luyj_di" bpmnElement="SequenceFlow_1x3luyj">
- <di:waypoint xsi:type="dc:Point" x="965" y="120" />
- <di:waypoint xsi:type="dc:Point" x="1028" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="997" y="95" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0cy0y9t_di" bpmnElement="SequenceFlow_0cy0y9t">
- <di:waypoint xsi:type="dc:Point" x="1078" y="120" />
- <di:waypoint xsi:type="dc:Point" x="1151" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1106" y="95" width="18" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="EndEvent_0zln0ww_di" bpmnElement="EndEvent_00cohim">
- <dc:Bounds x="1035" y="274" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1016" y="310" width="73" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1rgd8dg_di" bpmnElement="SequenceFlow_1rgd8dg">
- <di:waypoint xsi:type="dc:Point" x="1053" y="145" />
- <di:waypoint xsi:type="dc:Point" x="1053" y="274" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1068" y="199.5" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1ilduoy_di" bpmnElement="Task_018w43g">
<dc:Bounds x="1298" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -203,6 +156,13 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn:
<dc:Bounds x="1431" y="95" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_04zsr0f_di" bpmnElement="SequenceFlow_04zsr0f">
+ <di:waypoint xsi:type="dc:Point" x="965" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="1151" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1058" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn
index 46e7ddcbe6..cfda2ad73c 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoUpdateVfModule" name="DoUpdateVfModule" isExecutable="true">
<bpmn2:documentation><![CDATA[This flow expects its incoming request to be in the variable 'DoUpdateVfModuleRequest'. This flow produces no output.]]></bpmn2:documentation>
<bpmn2:scriptTask id="PrepareUpdateAAIVfModule_prep" name="Prepare Update AAI Vf Module (prep)" scriptFormat="groovy">
@@ -121,8 +121,7 @@ duvm.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script>
<bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="CallActivity_1" targetRef="ScriptTask_10" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Skip Update
-&#10;Generic Vnf?" default="SequenceFlow_14">
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Skip Update &#10;&#10;Generic Vnf?" default="SequenceFlow_14">
<bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
@@ -157,14 +156,13 @@ duvm.prepSDNCTopologyChg(execution)]]></bpmn2:script>
<bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
</bpmn2:callActivity>
- <bpmn2:callActivity id="ScriptTask_9" name="VnfAdapterRest" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="ScriptTask_9" name="VnfAdapterRest" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DOUPVfMod_vnfAdapterRestRequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DOUPVfMod_vnfAdapterRestRequest" target="vnfAdapterTaskRequest" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:out source="vnfAdapterRestV1Response" target="DOUPVfMod_vnfAdapterRestResponse" />
+ <camunda:out source="WorkflowResponse" target="DOUPVfMod_vnfAdapterRestResponse" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_21</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
@@ -248,8 +246,7 @@ def duvm = new DoUpdateVfModule()
duvm.prepConfirmVolumeGroupTenant(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ScriptTask_2" targetRef="ScriptTask_3" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="VolumeGroupId
-&#10;present?" default="SequenceFlow_16">
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="VolumeGroupId &#10;&#10;present?" default="SequenceFlow_16">
<bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_16</bpmn2:outgoing>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index 8b78560521..97d78b5ee8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -91,7 +91,7 @@ public class VnfAdapterImpl {
public void postProcessVnfAdapter(BuildingBlockExecution execution) {
try {
- String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
+ String vnfAdapterResponse = execution.getVariable("WorkflowResponse");
if (!StringUtils.isEmpty(vnfAdapterResponse)) {
Object vnfRestResponse = unMarshal(vnfAdapterResponse);
if (vnfRestResponse instanceof CreateVfModuleResponse) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index 9697246b03..9c55d0a922 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -1,7 +1,9 @@
package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
@@ -29,6 +31,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class AppcOrchestratorPreProcessor {
@@ -84,8 +88,16 @@ public class AppcOrchestratorPreProcessor {
appcTaskRequest.setNewSoftwareVersion(newSoftwareVersion);
String operationsTimeout = JsonUtils.getJsonValue(payload, "operations_timeout");
appcTaskRequest.setOperationsTimeout(operationsTimeout);
- }
+ Map<String, String> configMap = new HashMap<>();
+ ObjectMapper objectMapper = new ObjectMapper();
+ String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters");
+ if (configParamsStr != null) {
+ configMap =
+ objectMapper.readValue(configParamsStr, new TypeReference<HashMap<String, String>>() {});
+ }
+ appcTaskRequest.setConfigParams(configMap);
+ }
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
String controllerType = null;
@@ -229,8 +241,13 @@ public class AppcOrchestratorPreProcessor {
.isEmpty()) {
errorMessage = "APPC action Snapshot is missing vserverId parameter. ";
}
- break;
}
+ break;
+ case ConfigModify:
+ if (appcTaskRequest.getConfigParams().isEmpty() || appcTaskRequest.getConfigParams() == null) {
+ errorMessage = "APPC action ConfigModify is missing Configuration parameters. ";
+ }
+ break;
default:
break;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index eead1761ea..e01149f981 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -83,7 +83,6 @@ import org.onap.so.serviceinstancebeans.Networks;
import org.onap.so.serviceinstancebeans.Pnfs;
import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RequestDetails;
-import org.onap.so.serviceinstancebeans.RequestInfo;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.VfModules;
@@ -169,18 +168,6 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
- final String vnfType = (String) execution.getVariable(VNF_TYPE);
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- final String createInstanceAction = "createInstance";
- final String serviceType =
- Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
-
- List<OrchestrationFlow> orchFlows =
- (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
- WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
@@ -205,8 +192,9 @@ public class WorkflowAction {
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
- final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
- if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
+ String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+ WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
+ if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance")
&& sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
@@ -214,6 +202,7 @@ public class WorkflowAction {
} else {
resourceId = resource.getResourceId();
}
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) {
serviceInstanceId = resourceId;
}
@@ -232,10 +221,16 @@ public class WorkflowAction {
"Could not resume request with request Id: " + requestId + ". No flowsToExecute was found");
}
} else {
+ String vnfType = (String) execution.getVariable(VNF_TYPE);
String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration());
+ List<OrchestrationFlow> orchFlows =
+ (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
+ final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
+ final String serviceType =
+ Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true,
cloudOwner, serviceType);
}
String key = "";
@@ -248,12 +243,12 @@ public class WorkflowAction {
}
}
boolean isConfiguration = isConfiguration(orchFlows);
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ Resource resourceKey = new Resource(resourceType, key, true);
if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
.setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
.setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
.setRequestDetails(requestDetails).setExecution(execution));
@@ -269,19 +264,21 @@ public class WorkflowAction {
orchFlows = getVfModuleReplaceBuildingBlocks(
new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
.setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
.setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
.setRequestDetails(requestDetails).setExecution(execution));
}
for (OrchestrationFlow orchFlow : orchFlows) {
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
- apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
requestDetails, false, null, null, false);
flowsToExecute.add(ebb);
}
} else {
boolean foundRelated = false;
boolean containsService = false;
+ List<Resource> resourceList = new ArrayList<>();
+ List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
// SERVICE-MACRO-ASSIGN will always get user params with a
// service.
@@ -440,13 +437,6 @@ public class WorkflowAction {
return environment.getProperty(defaultCloudOwner);
}
- private boolean isSuppressRollback(RequestInfo requestInfo) {
- if (requestInfo != null) {
- return requestInfo.getSuppressRollback();
- }
- return false;
- }
-
protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
AAIObjectType type) {
List<T> vnfcs = new ArrayList<>();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
index 97a9388f8d..16e8c2de7d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -103,7 +103,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest() {
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn());
@@ -119,20 +119,20 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>");
+ execution.setVariable("WorkflowResponse", "<vfModuleStackId></vfModuleStackId>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() {
- execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>");
+ execution.setVariable("WorkflowResponse", "<createVfModuleResponse></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -140,7 +140,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -156,7 +156,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
assertEquals(vfModule.getContrailServiceInstanceFqdn(), "");
@@ -170,7 +170,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -183,14 +183,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_ResponseNullTest() {
- execution.setVariable("vnfAdapterRestV1Response", null);
+ execution.setVariable("WorkflowResponse", null);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@Test
public void postProcessVnfAdapter_ResponseEmptyTest() {
- execution.setVariable("vnfAdapterRestV1Response", "");
+ execution.setVariable("WorkflowResponse", "");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@@ -198,7 +198,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
@@ -207,14 +207,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>");
+ execution.setVariable("WorkflowResponse", "<vfModuleDeleted></vfModuleDeleted>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>");
+ execution.setVariable("WorkflowResponse", "<deleteVfModuleResponse></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
}
@@ -230,7 +230,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateVolumeResponseTest() {
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_CREATE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
}
@@ -238,7 +238,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>");
+ execution.setVariable("WorkflowResponse", "<createVolumeGroupResponse></createVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(volumeGroup.getHeatStackId());
}
@@ -246,7 +246,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(volumeGroup.getHeatStackId());
}
@@ -255,7 +255,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
@@ -264,14 +264,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>");
+ execution.setVariable("WorkflowResponse", "<volumeGroupDeleted></volumeGroupDeleted>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
+ execution.setVariable("WorkflowResponse", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
}
@@ -281,7 +281,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE);
expectedException.expect(BpmnError.class);
vnfAdapterImpl.postProcessVnfAdapter(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index c78b652bd0..ea1f7b47ad 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
@@ -163,4 +164,46 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
genericVnf.setIpv4OamAddress("127.0.0.1");
return genericVnf;
}
+
+ @Test
+ public void buildAppcTaskRequestConfigModifyTest() throws Exception {
+ final String expectedRequestJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "appcTaskRequestConfigModify.json")));
+ ApplicationControllerTaskRequest expectedTaskRequest =
+ mapper.readValue(expectedRequestJson, ApplicationControllerTaskRequest.class);
+ execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "-TEST");
+ fillRequiredAppcExecutionFieldsConfigModify();
+ GenericVnf genericVnf = getTestGenericVnf();
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ mockReferenceResponseForConfigModify();
+ execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("VF-MODULE-ID");
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ appcOrchestratorPreProcessor.buildAppcTaskRequest(execution, "ConfigModify");
+ ApplicationControllerTaskRequest actualTaskRequest = execution.getVariable("appcOrchestratorRequest");
+ assertThat(actualTaskRequest, sameBeanAs(expectedTaskRequest));
+ }
+
+ private void fillRequiredAppcExecutionFieldsConfigModify() {
+ RequestContext context = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setPayload(
+ "{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
+ context.setRequestParameters(requestParameters);
+ context.setMsoRequestId("TEST-MSO-ID");
+ execution.setVariable("aicIdentity", "AIC-TEST");
+ execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
+ execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
+ execution.setVariable("identityUrl", "IDENTITY-URL-TEST");
+ execution.getGeneralBuildingBlock().setRequestContext(context);
+ }
+
+ private void mockReferenceResponseForConfigModify() {
+ ControllerSelectionReference reference = new ControllerSelectionReference();
+ reference.setControllerName("APPC");
+ when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"),
+ eq(Action.ConfigModify.toString()))).thenReturn(reference);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index 109dc55294..ccd4376a10 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
index a482da5158..9dfc245f68 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
index 19d42dddb9..4c97dbc53c 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
@@ -19,7 +19,7 @@
"allocationPools": [{
"start": "107.244.64.2",
"end": "107.244.64.16"
- }]
+ }]
}
],
"providerVlanNetwork": {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
index b57c8341f1..3ba5627b38 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
@@ -14,13 +14,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"vnf_id": "vnfId",
"vnf_name": "vnfName",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
index da826b8a89..3fbf026176 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
@@ -12,13 +12,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"environment_context": "environmentContext",
"key1": "value1",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
index 54f6e403ed..9f554490bd 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
@@ -14,13 +14,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"vnf_id": "vnfId",
"vnf_name": "vnfName",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
new file mode 100644
index 0000000000..040c680d1c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -0,0 +1,13 @@
+{
+ "ApplicationControllerTaskRequest": {
+ "controllerType": "APPC",
+ "action": "ConfigModify",
+ "identityUrl": "IDENTITY-URL-TEST",
+ "applicationControllerVnf": {
+ "vnfId": "TEST-VNF-ID",
+ "vnfName": "TEST-VNF-NAME",
+ "vnfHostIpAddress": "127.0.0.1"
+ },
+ "configParams": {"name1":"value1", "name2":"value2"}
+}
+}
diff --git a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
index 3811b52551..c240957ae9 100644
--- a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
+++ b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
@@ -1,6 +1,8 @@
package org.onap.so.appc.orchestrator.service.beans;
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf;
@@ -18,6 +20,15 @@ public class ApplicationControllerTaskRequest implements Serializable {
private String existingSoftwareVersion;
private String newSoftwareVersion;
private ApplicationControllerVnf applicationControllerVnf;
+ private Map<String, String> configParams = new HashMap<String, String>();
+
+ public Map<String, String> getConfigParams() {
+ return configParams;
+ }
+
+ public void setConfigParams(Map<String, String> configParams) {
+ this.configParams = configParams;
+ }
public Action getAction() {
return action;
diff --git a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
index 9f71e61e1f..8d98307a43 100644
--- a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
+++ b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
@@ -1,4 +1,4 @@
-package org.onap.so.externaltasks.logging;
+package org.onap.so.logging.tasks;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
@@ -53,4 +53,5 @@ public class AuditMDCSetup {
MDC.remove(ONAPLogConstants.MDCs.ELAPSED_TIME);
MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
}
+
}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
index 035ad1dc81..840a978a61 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -51,7 +51,12 @@ public class ExternalTaskServiceUtils {
}
public int getMaxClients() {
- return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3"));
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10"));
+ }
+
+ public Long getLockDuration() {
+ Long lockDuration = Long.parseLong(env.getProperty("mso.audit.lock-time", "60000"));
+ return lockDuration;
}
@ScheduledLogging
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
index 9488187003..d414135570 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
@@ -9,11 +9,11 @@ import org.springframework.stereotype.Component;
@Component
public abstract class ExternalTaskUtils {
+ private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
+
@Autowired
Environment env;
- private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
-
private final RetrySequenceLevel retrySequenceLevel;
public ExternalTaskUtils() {
@@ -49,7 +49,7 @@ public abstract class ExternalTaskUtils {
return seqInter;
case LONG:
String[] seqLong = {"1", "1", "2", "3", "5", "8", "13", "20"};
- if (env.getProperty("mso.workflow.topics.retrySequence") != null) {
+ if (env.getProperty("mso.workflow.topics.retrySequence.long") != null) {
seqLong = env.getProperty("mso.workflow.topics.retrySequence", String[].class);
}
return seqLong;
diff --git a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java b/common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java
index c4609f0336..929db79910 100644
--- a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
+++ b/common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java
@@ -1,4 +1,4 @@
-package org.onap.so.externaltasks.logging;
+package org.onap.so.logging.tasks;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -11,28 +11,27 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.MdcConstants;
import org.slf4j.MDC;
+import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
-public class AuditMDCSetupTest {
+public class MDCSetupTest {
@Mock
- private ExternalTask externalTask;
+ private org.onap.logging.filter.base.MDCSetup mdcSet;
@Mock
- private MDCSetup mdcSet;
-
- @Spy
- @InjectMocks
- private AuditMDCSetup mdcSetup;
+ private ExternalTask externalTask;
private String requestId = "9bb86b8d-a02f-4a0b-81a9-2eb963850009";
private String serviceName = "testServiceName";
+ @Spy
+ @InjectMocks
+ AuditMDCSetup setup = new AuditMDCSetup();
+
@After
public void tearDown() {
MDC.clear();
@@ -43,7 +42,7 @@ public class AuditMDCSetupTest {
doReturn(requestId).when(externalTask).getVariable("mso-request-id");
doReturn(serviceName).when(externalTask).getTopicName();
- mdcSetup.setupMDC(externalTask);
+ setup.setupMDC(externalTask);
assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertEquals(requestId, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
@@ -57,14 +56,14 @@ public class AuditMDCSetupTest {
public void setElapsedTimeTest() {
MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z");
- mdcSetup.setElapsedTime();
+ setup.setElapsedTime();
assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
}
@Test
public void setResponseCodeTest() {
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ setup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
@@ -80,7 +79,7 @@ public class AuditMDCSetupTest {
MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, "318");
MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, "SO.OPENSTACK_ADAPTER");
- mdcSetup.clearClientMDCs();
+ setup.clearClientMDCs();
assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
assertNull(MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
index e27caa6458..6c2dbb666c 100644
--- a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
+++ b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
@@ -1,11 +1,13 @@
package org.onap.so.utils;
import static org.junit.Assert.assertEquals;
+import org.camunda.bpm.client.task.ExternalTask;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.env.Environment;
@@ -13,6 +15,9 @@ import org.springframework.core.env.Environment;
public class ExternalTaskUtilsTest {
@Mock
+ private ExternalTask externalTask;
+
+ @Mock
private Environment mockenv;
@InjectMocks
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index f1e8e711c4..418ba05abf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -40,6 +40,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.apihandler.common.CommonConstants;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClientParameter;
@@ -56,7 +57,6 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -823,7 +823,7 @@ public class ServiceInstances extends AbstractRestHandler {
sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
action = handleReplaceInstance(action, sir);
- requestValidatorListenerRunner.runValidations(requestUri, instanceIdMap, sir, queryParams);
+ requestValidatorListenerRunner.runValidations(requestUri, instanceIdMap, sir, queryParams, action);
String requestScope = requestHandlerUtils.deriveRequestScope(action, sir, requestUri);
InfraActiveRequests currentActiveReq =
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index fee7a3a8f4..4e3d8736c2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -9,6 +9,7 @@ import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -76,6 +77,40 @@ public class AAIDataRetrieval {
});
}
+
+ public boolean isVolumeGroupRelatedToVFModule(String volumeGroupId) {
+ return this.getAaiResourcesClient().exists(AAIUriFactory
+ .createResourceUri(AAIObjectType.VOLUME_GROUP, volumeGroupId).relatedTo(AAIObjectPlurals.VF_MODULE));
+ }
+
+ public boolean isVnfRelatedToVolumes(String vnfId) {
+ return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+ }
+
+ public boolean isNetworkRelatedToModules(String networkId) {
+ return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ .relatedTo(AAIObjectPlurals.VF_MODULE));
+ }
+
+ public boolean isServiceRelatedToNetworks(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.L3_NETWORK));
+ }
+
+ public boolean isServiceRelatedToGenericVnf(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.GENERIC_VNF));
+ }
+
+ public boolean isServiceRelatedToConfiguration(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.CONFIGURATION));
+ }
+
public Service getService(String serviceId) {
return this.getAaiResourcesClient()
.get(Service.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE, serviceId)).orElseGet(() -> {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java
new file mode 100644
index 0000000000..f75897dda1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java
@@ -0,0 +1,34 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class NetworkDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+/networks/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isNetworkRelatedToModules(instanceIdMap.get("networkInstanceId"))) {
+ return Optional.of("Cannot delete network it is still related to existing vf-modules");
+ } else {
+ return Optional.empty();
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
index 4aa60152dd..1dea57ad9c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
@@ -22,6 +22,7 @@ package org.onap.so.apihandlerinfra.infra.rest.validators;
import java.util.Map;
import java.util.Optional;
+import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
public interface RequestValidator {
@@ -32,7 +33,7 @@ public interface RequestValidator {
*
* @return
*/
- public boolean shouldRunFor(String uri, ServiceInstancesRequest request);
+ public boolean shouldRunFor(String uri, ServiceInstancesRequest request, Actions action);
public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
index d689c6b7a5..3aba39b501 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
@@ -28,6 +28,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.javatuples.Pair;
+import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.listener.ListenerRunner;
@@ -50,10 +51,10 @@ public class RequestValidatorListenerRunner extends ListenerRunner {
}
public boolean runValidations(String requestURI, Map<String, String> instanceIdMap, ServiceInstancesRequest request,
- Map<String, String> queryParams) throws ApiException {
+ Map<String, String> queryParams, Actions action) throws ApiException {
logger.info("Running local validations");
List<Pair<String, Optional<String>>> results =
- runValidations(requestValidators, instanceIdMap, request, queryParams, requestURI);
+ runValidations(requestValidators, instanceIdMap, request, queryParams, requestURI, action);
if (!results.isEmpty()) {
throw new ValidateException("Failed Validations:\n"
+ results.stream().map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get()))
@@ -66,10 +67,10 @@ public class RequestValidatorListenerRunner extends ListenerRunner {
protected List<Pair<String, Optional<String>>> runValidations(List<? extends RequestValidator> validators,
Map<String, String> instanceIdMap, ServiceInstancesRequest request, Map<String, String> queryParams,
- String requestURI) {
+ String requestURI, Actions action) {
List<? extends RequestValidator> filtered =
- filterListeners(validators, (item -> item.shouldRunFor(requestURI, request)));
+ filterListeners(validators, (item -> item.shouldRunFor(requestURI, request, action)));
List<Pair<String, Optional<String>>> results = new ArrayList<>();
filtered.forEach(item -> results
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
new file mode 100644
index 0000000000..0c7ba65cf4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
@@ -0,0 +1,38 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.listener.Skip;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@Skip
+public class ServiceInstanceDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isServiceRelatedToGenericVnf(instanceIdMap.get("serviceInstanceId"))) {
+ return Optional.of("Cannot delete service it is still related to existing vf-modules");
+ } else if (aaiDataRetrieval.isServiceRelatedToNetworks(instanceIdMap.get("serviceInstanceId"))) {
+ return Optional.of("Cannot delete service it is still related to existing networks");
+ } else if (aaiDataRetrieval.isServiceRelatedToConfiguration(instanceIdMap.get("serviceInstanceId"))) {
+ return Optional.of("Cannot delete service it is still related to existing configurations");
+ } else {
+ return Optional.empty();
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
new file mode 100644
index 0000000000..d54e60d153
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
@@ -0,0 +1,34 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class VnfDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+/vnfs/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isVnfRelatedToVolumes(instanceIdMap.get("vnfInstanceId"))) {
+ return Optional.of("Cannot delete vnf it is still related to existing volume groups");
+ } else {
+ return Optional.empty();
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
new file mode 100644
index 0000000000..f010d47f70
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
@@ -0,0 +1,33 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class VolumeGroupDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+/volumeGroups/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isVolumeGroupRelatedToVFModule(instanceIdMap.get("volumeGroupInstanceId"))) {
+ return Optional.of("Cannot delete volume group it is related to existing vf-modules");
+ } else {
+ return Optional.empty();
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java
new file mode 100644
index 0000000000..7780f0ee2b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java
@@ -0,0 +1,73 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.NetworkDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class NetworkDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private NetworkDeleteValidator networkValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/networks/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/networks/asdfasdf/update",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchActionTest() {
+ assertEquals(false, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/networks/asdfasdf",
+ new ServiceInstancesRequest(), Action.createInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("networkInstanceId", "1");
+ when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(false);
+ Optional<String> result = networkValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureTest() {
+ instanceIdMap.put("networkInstanceId", "1");
+ when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(true);
+ Optional<String> result = networkValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java
new file mode 100644
index 0000000000..c334d522b6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java
@@ -0,0 +1,88 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.ServiceInstanceDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class ServiceInstanceDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private ServiceInstanceDeleteValidator serviceValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf", new ServiceInstancesRequest(),
+ Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/update",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(false);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureVnfTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(true);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureNetworksTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(true);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureConfigurationTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(true);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java
new file mode 100644
index 0000000000..d4f57d3146
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java
@@ -0,0 +1,67 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.VnfDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private VnfDeleteValidator vnfValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, vnfValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false, vnfValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf/replace",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, vnfValidator.shouldRunFor("v8/serviceInstances/uasdfasdf", new ServiceInstancesRequest(),
+ Action.deleteInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("vnfInstanceId", "1");
+ when(aaiDataRetrieval.isVnfRelatedToVolumes("1")).thenReturn(false);
+ Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureVnfTest() {
+ instanceIdMap.put("vnfInstanceId", "1");
+ when(aaiDataRetrieval.isVnfRelatedToVolumes("1")).thenReturn(true);
+ Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
new file mode 100644
index 0000000000..3d81ee66c9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
@@ -0,0 +1,69 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.VolumeGroupDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class VolumeGroupDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private VolumeGroupDeleteValidator volumeGroupDeleteValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, volumeGroupDeleteValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/volumeGroups/uuid",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false,
+ volumeGroupDeleteValidator.shouldRunFor(
+ "v8/serviceInstances/uasdfasdf/vnfs/asdfasdf/volumeGroups/uuid/replace",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, volumeGroupDeleteValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/uuid",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("volumeGroupInstanceId", "1");
+ when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(false);
+ Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureVnfTest() {
+ instanceIdMap.put("volumeGroupInstanceId", "1");
+ when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(true);
+ Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java
index 05d43d093c..33994bae8b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java
@@ -78,11 +78,11 @@ public class CvnfcConfigurationCustomization implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date created;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "CONFIGURATION_MODEL_UUID")
private ConfigurationResource configurationResource;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "CVNFC_CUSTOMIZATION_ID")
private CvnfcCustomization cvnfcCustomization;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
index 7fb328fdb5..9bf0cdd6a7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
@@ -92,11 +92,11 @@ public class CvnfcCustomization implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date created;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "VF_MODULE_CUSTOMIZATION_ID")
private VfModuleCustomization vfModuleCustomization;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "VNFC_CUST_MODEL_CUSTOMIZATION_UUID")
private VnfcCustomization vnfcCustomization;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
index 3420682900..83de95874c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
@@ -21,10 +21,9 @@
package org.onap.so.db.catalog.beans;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -41,7 +40,6 @@ import javax.persistence.TemporalType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.openpojo.business.annotation.BusinessKey;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
@@ -98,7 +96,7 @@ public class VfModuleCustomization implements Serializable {
private VnfResourceCustomization vnfCustomization;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization")
- private Set<CvnfcCustomization> cvnfcCustomization;
+ private List<CvnfcCustomization> cvnfcCustomization;
@Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
private Boolean skipPostInstConf;
@@ -233,13 +231,13 @@ public class VfModuleCustomization implements Serializable {
}
@LinkedResource
- public Set<CvnfcCustomization> getCvnfcCustomization() {
+ public List<CvnfcCustomization> getCvnfcCustomization() {
if (cvnfcCustomization == null)
- cvnfcCustomization = new HashSet<>();
+ cvnfcCustomization = new ArrayList<>();
return cvnfcCustomization;
}
- public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) {
+ public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
this.cvnfcCustomization = cvnfcCustomization;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 26c33941ed..b130835062 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -915,7 +915,7 @@ public class CatalogDbClient {
findVnfResourceCustomizationInList(vnfCustomizationUUID, service.getVnfCustomizations());
VfModuleCustomization vfModuleCust =
findVfModuleCustomizationInList(vfModuleCustomizationUUID, vnfResourceCust.getVfModuleCustomizations());
- return vfModuleCust.getCvnfcCustomization().stream().collect(Collectors.toList());
+ return vfModuleCust.getCvnfcCustomization();
}
public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID,
@@ -971,10 +971,9 @@ public class CatalogDbClient {
List<CvnfcCustomization> cvnfcCustomization =
getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid, vfModuleCustomizationUuid);
CvnfcCustomization cvnfc = findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcCustomization);
- List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc
- .getCvnfcConfigurationCustomization().stream().filter(cvnfcCustom -> cvnfcCustom
- .getConfigurationResource().getToscaNodeType().contains("FabricConfiguration"))
- .collect(Collectors.toList());
+ List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc.getCvnfcConfigurationCustomization();
+ fabricConfigs.stream().filter(cvnfcCustom -> cvnfcCustom.getConfigurationResource().getToscaNodeType()
+ .contains("FabricConfiguration")).collect(Collectors.toList());
if (fabricConfigs != null && !fabricConfigs.isEmpty() && fabricConfigs.size() == 1) {
logger.debug("Found Fabric Configuration: {}", fabricConfigs.get(0));
return fabricConfigs.get(0);
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
index e8addc4aa8..a13deae159 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
@@ -23,14 +23,10 @@ package org.onap.so.db.catalog.data.repository;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
-import org.onap.so.db.catalog.beans.ConfigurationResource;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
@@ -45,6 +41,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
@Autowired
private CvnfcCustomizationRepository cvnfcCustomizationRepository;
+
@Test
public void findAllTest() throws Exception {
List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findAll();
@@ -125,14 +122,12 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
vnfResourceCustomization.setVnfResources(vnfResource);
-
VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
-
-
cvnfcCustomizationRepository.save(cvnfcCustomization);
+
List<CvnfcCustomization> cvnfcCustomizationList =
cvnfcCustomizationRepository.findByModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
boolean matchFound = false;
@@ -173,7 +168,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
- List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
vnfResourceCustomizations.add(vnfResourceCustomization);
vnfResourceCustomization.setVnfResources(vnfResource);
diff --git a/releases/1.6.0.yaml b/releases/1.6.0.yaml
new file mode 100644
index 0000000000..8e1e371e5b
--- /dev/null
+++ b/releases/1.6.0.yaml
@@ -0,0 +1,33 @@
+---
+distribution_type: 'container'
+container_release_tag: '1.6.0'
+project: 'so'
+log_dir: 'so-maven-docker-stage-elalto/2/'
+ref: '3c1f70e434b23e8bda331837c1e4ed8506f0166d'
+containers:
+ - name: 'so/vnfm-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/catalog-db-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/request-db-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/openstack-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/sdnc-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/vfc-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/sdc-controller'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/bpmn-infra'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/so-monitoring'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/api-handler-infra'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/so-appc-orchestrator'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/nssmf-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/ve-vnfm-adapter'
+ version: '1.6.0-20200326T0421' \ No newline at end of file
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
index 2311c4c44e..2fa8725d56 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
@@ -17,10 +17,11 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
- // Get to see if stack exists
+ // Create Poll Service
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
- scenario.echo("${correlationId}");
+ scenario.echo("${correlationId}"); // step 2
scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"${correlationId}");
@@ -30,20 +31,63 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario {
scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c");
scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236");
scenario.variable("stack_failure_message", "The Flavor ID (nd.c6r16d20) could not be found.");
+ scenario.http().send().response(HttpStatus.OK) // step 4
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Create Poll Retry
+ scenario.http().receive().get(); // step 5
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Delete of the stack
+ scenario.http().receive().delete(); // step 7
+ scenario.action(new DeleteVServers());
+ scenario.http().send().response(HttpStatus.NO_CONTENT);
+
+ // Rollback Poll
+ scenario.http().receive().get(); // step 10
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Rollback Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Create Poll
+ scenario.http().receive().get(); // step 14
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
- // Delete of the stack
+ // Create Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Delete
scenario.http().receive().delete();
scenario.action(new DeleteVServers());
scenario.http().send().response(HttpStatus.NO_CONTENT);
- // Poll Deletion of stack for status
+ // Rollback Poll
+ scenario.http().receive().get(); // step 18
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Poll Retry
scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Delete
+ scenario.http().receive().delete();
+ scenario.http().send().response(HttpStatus.NO_CONTENT);
+
+ // Delete Poll
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+
}
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
index 4d0d578831..7f995f2930 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
@@ -3,8 +3,6 @@ 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 org.onap.so.simulator.actions.aai.DeleteVServers;
import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver;
import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
@@ -17,7 +15,9 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
- // Get to see if stack exists
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Create Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -33,13 +33,13 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Create Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
- // Delete of the stack
- scenario.http().receive().delete();
- scenario.action(new DeleteVServers());
- scenario.http().send().response(HttpStatus.NO_CONTENT);
- // Poll Deletion of stack for status
+ // Rollback Poll
scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
index ba6a1a1185..c8c81ebecf 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro1")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_1/*", method = RequestMethod.GET)
public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
@@ -16,6 +20,9 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -27,8 +34,33 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ // Create (module_2)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Create (module_3)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Create (module_2 recreate)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Delete
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+
+ // Delete
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
index efd420486d..aca5fe8194 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro2")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_2/*", method = RequestMethod.GET)
public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
@@ -16,6 +20,9 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -27,11 +34,19 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ // Delete
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
}
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
index 4d3ba8697a..9fc6fafdb3 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro3")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_3/*", method = RequestMethod.GET)
public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
@@ -16,6 +20,8 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -24,11 +30,21 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
scenario.variable("stackName", "macro_module_3");
+ // Poll
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Delete
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
diff --git a/version.properties b/version.properties
index a0756adf2b..922c4fa961 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=6
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}