aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java88
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java55
-rw-r--r--common/pom.xml2
4 files changed, 28 insertions, 150 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index f2e0762a79..fca1d3a45e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -46,32 +46,8 @@ import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceMacroHolder;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceNetworks;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
-import org.onap.so.db.catalog.beans.AllottedResource;
-import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
-import org.onap.so.db.catalog.beans.InstanceGroup;
-import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.Recipe;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ToscaCsar;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfRecipe;
-import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
-import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
-import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
-import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
-import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
-import org.onap.so.db.catalog.data.repository.ServiceRepository;
-import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
-import org.onap.so.db.catalog.data.repository.VFModuleRepository;
-import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
-import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.db.catalog.beans.*;
+import org.onap.so.db.catalog.data.repository.*;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -126,6 +102,9 @@ public class CatalogDbAdapterRest {
@Autowired
private InstanceGroupRepository instanceGroupRepository;
+ @Autowired
+ private ServiceInfoRepository serviceInfoRepository;
+
private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
@@ -328,6 +307,8 @@ public class CatalogDbAdapterRest {
respStatus = HttpStatus.SC_NOT_FOUND;
qryResp = new QueryServiceMacroHolder();
} else {
+ ServiceInfo serviceInfo = serviceInfoRepository.findByService(ret.getService());
+ ret.setServiceInfo(serviceInfo);
qryResp = new QueryServiceMacroHolder(ret);
logger.debug("serviceMacroHolder qryResp= {}", qryResp);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index a162088cb2..7e5cf19b21 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -45,9 +45,7 @@ import java.util.Map;
@Component
public class AAIUpdateTasks {
private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class);
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
+
@Autowired
private AAIServiceInstanceResources aaiServiceInstanceResources;
@Autowired
@@ -149,8 +147,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update HeatStackId and VolumeGroup in AAI
- *
- * @param execution
*/
public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
try {
@@ -172,87 +168,27 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of VfModule to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ASSIGNED);
}
/**
* BPMN access method to update status of VfModule to PendingActivation in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update status of VfModule to AssignedOrPendingActivation in AAI
- *
- * @param execution
- */
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (vnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
- if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- } else {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
- }
- } catch (Exception ex) {
- logger.error(
- "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule",
- ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.PENDING_ACTIVATION);
}
/**
* BPMN access method to update status of VfModule to Created in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.CREATED);
}
/**
* BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
- *
- * @param execution
*/
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeactivateVfModuleRollback", false);
@@ -800,4 +736,20 @@ public class AAIUpdateTasks {
}
}
+ private void updateOrchestrationStatusForVfModule(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ if (status.equals(OrchestrationStatus.ASSIGNED)) {
+ vfModule.setHeatStackId("");
+ }
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status);
+ } catch (Exception ex) {
+ logger.error(
+ "Exception occurred in AAIUpdateTasks during update orchestration status to {} for " + "vf module",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index e26009a1de..e5b003a437 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import java.util.HashMap;
@@ -258,60 +257,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
}
@Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("false");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest()
- throws Exception {
- execution.setVariable("aLaCarte", false);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
- genericVnf, OrchestrationStatus.ASSIGNED);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- }
-
- @Test
public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CREATED);
diff --git a/common/pom.xml b/common/pom.xml
index e36001833d..d373d620cd 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -59,7 +59,7 @@
<dependency>
<groupId>org.onap.aai.schema-service</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.6.4-SNAPSHOT</version>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>