summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java33
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundException.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java31
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundExceptionTest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java103
-rw-r--r--common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java35
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java2
-rw-r--r--so-simulator/src/main/resources/openstack/gr_api/GetNeutronNetwork2.json4
-rw-r--r--so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json4
16 files changed, 446 insertions, 92 deletions
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 5987c5ad93..240bb83862 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
@@ -583,7 +583,7 @@ public class ToscaResourceInstaller {
String resourceSeqStr = resouceSequence.stream().collect(Collectors.joining(","));
service.setResourceOrder(resourceSeqStr);
- logger.debug(" resourceSeq for service uuid(" + service.getModelUUID() + ") : " + resourceSeqStr);
+ logger.debug(" resourceSeq for service uuid {}: {}", service.getModelUUID(), resourceSeqStr);
}
@@ -644,8 +644,7 @@ public class ToscaResourceInstaller {
String jsonStr = objectMapper.writeValueAsString(resouceRequest);
jsonStr = jsonStr.replace("\"", "\\\"");
- logger.debug(
- "resource request for resource customization id (" + resourceCustomizationUuid + ") : " + jsonStr);
+ logger.debug("resource request for resource customization id {}: {}", resourceCustomizationUuid, jsonStr);
return jsonStr;
} catch (JsonProcessingException e) {
logger.error("resource input could not be deserialized for resource customization id ("
@@ -688,8 +687,8 @@ public class ToscaResourceInstaller {
networkCustomization.setResourceInput(
getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID()));
service.getNetworkCustomizations().add(networkCustomization);
- logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
- + networkResourceModelName);
+ logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for {}",
+ networkResourceModelName);
}
}
@@ -1014,25 +1013,25 @@ public class ToscaResourceInstaller {
String vfCustomizationCategory =
vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
- logger.debug("VF Category is : " + vfCustomizationCategory);
+ logger.debug("VF Category is: {} ", vfCustomizationCategory);
String vfCustomizationUUID =
vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
+ logger.debug("VFCustomizationUUID= {}", vfCustomizationUUID);
IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
// Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before
// comparing their VF Modules UUID's
- logger.debug("Checking if Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: "
- + vfCustomizationUUID);
+ logger.debug(
+ "Checking if Notification VF ResourceCustomizationUUID: {} matches Tosca VF Customization UUID: {}",
+ vfNotificationResource.getResourceCustomizationUUID(), vfCustomizationUUID);
if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
- + " matches vfNotificationResource CustomizationUUID");
+ logger.debug("vfCustomizationUUID: {} matches vfNotificationResource CustomizationUUID ",
+ vfCustomizationUUID);
VnfResourceCustomization vnfResource = createVnfResource(vfEntityDetails, toscaResourceStruct, service);
@@ -1044,7 +1043,7 @@ public class ToscaResourceInstaller {
for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
- logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
+ logger.debug("vfModuleStructure: {}", vfModuleStructure);
List<IEntityDetails> vfModuleEntityList =
getEntityDetails(toscaResourceStruct,
@@ -1093,7 +1092,7 @@ public class ToscaResourceInstaller {
if (!CollectionUtils.isEmpty(seqResult)) {
String resultStr = seqResult.stream().collect(Collectors.joining(","));
vnfResource.setVnfcInstanceGroupOrder(resultStr);
- logger.debug("vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr);
+ logger.debug("vnfcGroupOrder result for service uuid {}: {}", service.getModelUUID(), resultStr);
}
// add this vnfResource with existing vnfResource for this service
addVnfCustomization(service, vnfResource);
@@ -1203,7 +1202,7 @@ public class ToscaResourceInstaller {
watchdogDistributionStatusRepository.saveAndFlush(distributionStatus);
} catch (ObjectOptimisticLockingFailureException e) {
- logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : " + e.toString());
+ logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : {} ", e);
throw e;
}
}
@@ -2037,8 +2036,8 @@ public class ToscaResourceInstaller {
ObjectMapper objectMapper = new ObjectMapper();
jsonStr = objectMapper.writeValueAsString(resouceRequest);
jsonStr = jsonStr.replace("\"", "\\\"");
- logger.debug("vfcResource request for resource customization id (" + resourceCustomizationUuid + ") : "
- + jsonStr);
+ logger.debug("vfcResource request for resource customization id {}: {}", resourceCustomizationUuid,
+ jsonStr);
} catch (JsonProcessingException e) {
logger.debug("Json Exception: {}", e.getMessage());
logger.error("Exception occurred", e);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index b4c5ca9a7e..7e982369bb 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -62,6 +62,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -253,41 +254,46 @@ public class BBInputSetup implements JavaDelegate {
String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
- if (serviceInstanceId != null) {
- aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
- }
Service service = null;
boolean isReplace = false;
- if (aaiServiceInstance != null) {
- if (requestAction.equalsIgnoreCase("replaceInstance")) {
- RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
- RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) {
- service = bbInputSetupUtils
- .getCatalogServiceByModelUUID(relatedInstance.getModelInfo().getModelVersionId());
- isReplace = true;
+ if (serviceInstanceId != null) {
+ aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+ if (aaiServiceInstance != null) {
+ if (requestAction.equalsIgnoreCase("replaceInstance")) {
+ RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) {
+ service = bbInputSetupUtils.getCatalogServiceByModelUUID(
+ relatedInstance.getModelInfo().getModelVersionId());
+ isReplace = true;
+ }
}
}
+ } else {
+ service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ }
+ if (service == null) {
+ String message = String.format(
+ "Related service instance model not found in MSO CatalogDB: model-version-id=%s",
+ aaiServiceInstance.getModelVersionId());
+ throw new ServiceModelNotFoundException(message);
}
} else {
- service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ String message = String.format("Related service instance from AAI not found: service-instance-id=%s",
+ serviceInstanceId);
+ throw new NoServiceInstanceFoundException(message);
}
}
- if (aaiServiceInstance != null && service != null) {
- ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
- serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
- this.populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), requestDetails, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, vnfType, executeBB.getBuildingBlock().getKey(),
- executeBB.getConfigurationResourceKeys(), isReplace);
- return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction,
- null);
- } else {
- logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
- logger.debug("Related Service Instance Model Info from AAI: {}", service);
- throw new Exception("Could not find relevant information for related Service Instance");
- }
+
+ ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
+ serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
+ this.populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), requestDetails, service, bbName,
+ serviceInstance, lookupKeyMap, resourceId, vnfType, executeBB.getBuildingBlock().getKey(),
+ executeBB.getConfigurationResourceKeys(), isReplace);
+ return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
+
}
protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB, RequestDetails requestDetails,
@@ -1285,24 +1291,30 @@ public class BBInputSetup implements JavaDelegate {
String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
RequestDetails requestDetails = executeBB.getRequestDetails();
GeneralBuildingBlock gBB = null;
+ Service service = null;
if (serviceInstanceId != null) {
aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+ if (aaiServiceInstance != null) {
+ service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ if (service == null) {
+ String message = String.format(
+ "Related service instance model not found in MSO CatalogDB: model-version-id=%s",
+ aaiServiceInstance.getModelVersionId());
+ throw new ServiceModelNotFoundException(message);
+ }
+ } else {
+ String message = String.format("Related service instance from AAI not found: service-instance-id=%s",
+ serviceInstanceId);
+ throw new NoServiceInstanceFoundException(message);
+ }
}
- Service service = null;
- if (aaiServiceInstance != null) {
- service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
- }
- if (aaiServiceInstance != null && service != null) {
- ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
- serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
- updateInstanceName(executeBB.getRequestId(), ModelType.service, serviceInstance.getServiceInstanceName());
- gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
- } else {
- logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
- logger.debug("Related Service Instance Model Info from AAI: {}", service);
- throw new Exception("Could not find relevant information for related Service Instance");
- }
- ServiceInstance serviceInstance = gBB.getServiceInstance();
+
+ ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
+ serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
+ updateInstanceName(executeBB.getRequestId(), ModelType.service, serviceInstance.getServiceInstanceName());
+ gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
+
+ serviceInstance = gBB.getServiceInstance();
CloudRegion cloudRegion = null;
if (cloudConfiguration == null) {
Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index fcac86b251..31275f7143 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -587,6 +587,24 @@ public class BBInputSetupUtils {
return aaiRC.exists(l3networkUri);
}
+ public boolean existsAAIVfModuleGloballyByName(String vfModuleName) {
+ AAIResourceUri vfModuleUri =
+ AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", vfModuleName);
+ return injectionHelper.getAaiClient().exists(vfModuleUri);
+ }
+
+ public boolean existsAAIConfigurationGloballyByName(String configurationName) {
+ AAIResourceUri configUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", configurationName);
+ return injectionHelper.getAaiClient().exists(configUri);
+ }
+
+ public boolean existsAAIVolumeGroupGloballyByName(String volumeGroupName) {
+ AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", volumeGroupName);
+ return injectionHelper.getAaiClient().exists(volumeGroupUri);
+ }
+
public GenericVnfs getAAIVnfsGloballyByName(String vnfName) {
return injectionHelper.getAaiClient()
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundException.java
new file mode 100644
index 0000000000..b9daad6626
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundException.java
@@ -0,0 +1,15 @@
+package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
+
+public class ServiceModelNotFoundException extends Exception {
+
+ private static final long serialVersionUID = -5551887892983898061L;
+
+ public ServiceModelNotFoundException() {
+ super();
+ }
+
+ public ServiceModelNotFoundException(String message) {
+ super(message);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 26e4771021..ffbf673cdb 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -46,7 +46,9 @@ import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
@@ -87,6 +89,8 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -149,6 +153,9 @@ public class BBInputSetupTest {
@Mock
private RequestsDbClient requestsDbClient;
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
@Before
public void setup() {
SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils);
@@ -462,19 +469,50 @@ public class BBInputSetupTest {
assertThat(actual, sameBeanAs(expected));
}
- @Test(expected = Exception.class)
+ @Test
public void testGetGBBALaCarteNonServiceWithoutServiceModelInfo() throws Exception {
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
RequestDetails requestDetails = mapper.readValue(
new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "si123");
String requestAction = "createInstance";
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
aaiServiceInstance.setModelVersionId("modelVersionId");
String resourceId = "123";
String vnfType = "vnfType";
+ doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("si123");
+ doReturn(null).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+
+ expectedException.expect(ServiceModelNotFoundException.class);
+ expectedException.expectMessage(
+ "Related service instance model not found in MSO CatalogDB: model-version-id=modelVersionId");
+
+ SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId,
+ vnfType);
+ }
+
+ @Test
+ public void testGetGBBALaCarteNonServiceServiceInstanceNotFoundInAAI() throws Exception {
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ RequestDetails requestDetails = mapper.readValue(
+ new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "si123");
+ String requestAction = "createInstance";
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setModelVersionId("modelVersionId");
+ String resourceId = "123";
+ String vnfType = "vnfType";
+
+ doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("si123");
+
+ expectedException.expect(NoServiceInstanceFoundException.class);
+ expectedException.expectMessage("Related service instance from AAI not found: service-instance-id=si123");
+
SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId,
vnfType);
}
@@ -2672,6 +2710,48 @@ public class BBInputSetupTest {
}
@Test
+ public void testGetGBBMacroExistingServiceServiceinstancenotFoundInAai() throws Exception {
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "si123");
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setLcpCloudRegionId("cloudRegionId");
+
+ doReturn(null).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("si123");
+
+ expectedException.expect(NoServiceInstanceFoundException.class);
+ expectedException.expectMessage("Related service instance from AAI not found: service-instance-id=si123");
+
+ SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, "AssignVnfBB", "assign",
+ cloudConfiguration);
+ }
+
+ @Test
+ public void testGetGBBMacroExistingServiceServiceModelNotFound() throws Exception {
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "si123");
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setModelVersionId("modelVersionId");
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setLcpCloudRegionId("cloudRegionId");
+
+ doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("si123");
+ doReturn(null).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+
+ expectedException.expect(ServiceModelNotFoundException.class);
+ expectedException.expectMessage(
+ "Related service instance model not found in MSO CatalogDB: model-version-id=modelVersionId");
+
+ SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, "AssignVnfBB", "assign",
+ cloudConfiguration);
+ }
+
+ @Test
public void testGetVnfId() {
String expected = "vnfId";
ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index 7780837714..53d167e4af 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -878,4 +878,35 @@ public class BBInputSetupUtilsTest {
assertEquals(actual.get().getConfigurationId(), expected.get().getConfiguration().get(0).getConfigurationId());
}
+ @Test
+ public void existsAAIVfModuleGloballyByNameTest() throws Exception {
+ AAIResourceUri expectedUri =
+ AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", "testVfModule");
+ bbInputSetupUtils.existsAAIVfModuleGloballyByName("testVfModule");
+ verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
+ }
+
+ @Test
+ public void existsAAIConfigurationGloballyByNameTest() throws Exception {
+ AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", "testConfig");
+ bbInputSetupUtils.existsAAIConfigurationGloballyByName("testConfig");
+ verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
+ }
+
+ @Test
+ public void existsAAINetworksGloballyByNameTest() throws Exception {
+ AAIResourceUri expectedUri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "testNetwork");
+ bbInputSetupUtils.existsAAINetworksGloballyByName("testNetwork");
+ verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
+ }
+
+ @Test
+ public void existsAAIVolumeGroupGloballyByNameTest() throws Exception {
+ AAIResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", "testVoumeGroup");
+ bbInputSetupUtils.existsAAIVolumeGroupGloballyByName("testVoumeGroup");
+ verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundExceptionTest.java
new file mode 100644
index 0000000000..1ab1d7aa9a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ServiceModelNotFoundExceptionTest.java
@@ -0,0 +1,19 @@
+package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+
+public class ServiceModelNotFoundExceptionTest {
+
+ @Test
+ public void testRequestValidationException() {
+
+ ServiceModelNotFoundException serviceModelNotFoundException = new ServiceModelNotFoundException();
+ Assert.assertNull(serviceModelNotFoundException.getMessage());
+
+ serviceModelNotFoundException = new ServiceModelNotFoundException("test message");
+ Assert.assertEquals("test message", serviceModelNotFoundException.getMessage());
+
+ }
+}
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 58bf17f08b..836648ca9c 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
@@ -62,6 +62,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
+import org.onap.so.client.orchestration.AAIEntityNotFoundException;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
@@ -184,7 +185,14 @@ public class WorkflowAction {
execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- execution.setVariable("suppressRollback", isSuppressRollback(requestDetails.getRequestInfo()));
+ boolean suppressRollback = false;
+ try {
+ suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
+ } catch (Exception ex) {
+ logger.error("Exception in getSuppressRollback", ex);
+ suppressRollback = false;
+ }
+ execution.setVariable("suppressRollback", suppressRollback);
boolean isResume = false;
if (isUriResume(uri)) {
isResume = true;
@@ -403,7 +411,7 @@ public class WorkflowAction {
execution.setVariable("isRollbackComplete", false);
} catch (Exception ex) {
- buildAndThrowException(execution, "Exception in create execution list. " + ex.getMessage(), ex);
+ buildAndThrowException(execution, "Exception in execution list. ", ex);
}
}
@@ -479,7 +487,8 @@ public class WorkflowAction {
return false;
}
- protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ConfigBuildingBlocksDataObject dataObj) {
+ protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ConfigBuildingBlocksDataObject dataObj)
+ throws Exception {
List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
List<OrchestrationFlow> result = dataObj.getOrchFlows().stream()
@@ -488,8 +497,17 @@ public class WorkflowAction {
String vfModuleId = dataObj.getWorkflowResourceIds().getVfModuleId();
String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
- String vfModuleCustomizationUUID =
- bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ String vfModuleCustomizationUUID = "";
+ org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
+
+ if (aaiVfModule == null) {
+ logger.error("No matching VfModule is found in Generic-Vnf in AAI for vnfId: {} and vfModuleId : {}", vnfId,
+ vfModuleId);
+ throw new AAIEntityNotFoundException("No matching VfModule is found in Generic-Vnf in AAI for vnfId: "
+ + vnfId + " and vfModuleId : " + vfModuleId);
+ } else {
+ vfModuleCustomizationUUID = aaiVfModule.getModelCustomizationId();
+ }
List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId,
org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
@@ -1268,12 +1286,15 @@ public class WorkflowAction {
}
}
}
+ if (bbInputSetupUtils.existsAAIVfModuleGloballyByName(instanceName)) {
+ throw new DuplicateNameException("vfModule", instanceName);
+ }
} else if ("VOLUMEGROUP".equalsIgnoreCase(type.toString())) {
GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId());
Optional<VolumeGroup> volumeGroup = bbInputSetupUtils
.getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName);
if (volumeGroup.isPresent()) {
- if (vnf.getModelCustomizationId()
+ if (volumeGroup.get().getVfModuleModelCustomizationId()
.equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
return volumeGroup.get().getVolumeGroupId();
} else {
@@ -1286,7 +1307,7 @@ public class WorkflowAction {
bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(),
vfModule.getVfModuleId(), instanceName);
if (volumeGroupFromVfModule.isPresent()) {
- if (vnf.getModelCustomizationId()
+ if (volumeGroupFromVfModule.get().getVfModuleModelCustomizationId()
.equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
return volumeGroupFromVfModule.get().getVolumeGroupId();
} else {
@@ -1297,6 +1318,9 @@ public class WorkflowAction {
}
}
}
+ if (bbInputSetupUtils.existsAAIVolumeGroupGloballyByName(instanceName)) {
+ throw new DuplicateNameException("volumeGroup", instanceName);
+ }
} else if ("CONFIGURATION".equalsIgnoreCase(type.toString())) {
Optional<org.onap.aai.domain.yang.Configuration> configuration =
bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance(
@@ -1311,6 +1335,9 @@ public class WorkflowAction {
configuration.get().getConfigurationId()));
}
}
+ if (bbInputSetupUtils.existsAAIConfigurationGloballyByName(instanceName)) {
+ throw new DuplicateNameException("configuration", instanceName);
+ }
}
return generatedResourceId;
} catch (DuplicateNameException dne) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 6c959703e4..80909851e3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -83,6 +83,7 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.orchestration.AAIEntityNotFoundException;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
@@ -1149,6 +1150,56 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void getConfigBuildingBlocksNoVfModuleFabricDeleteTest() throws Exception {
+ String gAction = "deleteInstance";
+ ObjectMapper mapper = new ObjectMapper();
+ WorkflowType resourceType = WorkflowType.VFMODULE;
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("vnfId", "1234");
+ execution.setVariable("vfModuleId", "vfModuleId1234");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ String requestAction = "deleteInstance";
+ String requestId = "9c944122-d161-4280-8594-48c06a9d96d5";
+ boolean aLaCarte = true;
+ String apiVersion = "7";
+ String vnfType = "vnfType";
+ String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
+ String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
+
+ thrown.expect(AAIEntityNotFoundException.class);
+ thrown.expectMessage(containsString(
+ "No matching VfModule is found in Generic-Vnf in AAI for vnfId: 1234 and vfModuleId : vfModuleId1234"));
+
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+
+ ConfigBuildingBlocksDataObject dataObj = new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest)
+ .setOrchFlows(orchFlows).setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestDetails(requestDetails).setExecution(execution);
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(anyObject())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(null);
+
+ SPY_workflowAction.getConfigBuildingBlocks(dataObj);
+ }
+
+ @Test
public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "VfModule";
@@ -1702,7 +1753,24 @@ public class WorkflowActionTest extends BaseTaskTest {
"vfModule with name (vFModName222), same parent and different customization id (1234567) already exists. The name must be unique."));
workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName222", reqDetails,
workflowResourceIds);
+ }
+ @Test
+ public void validateVfModuleResourceIdInAAINotGloballyUniqueTest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setVnfId("id111");
+
+ GenericVnf vnf1 = new GenericVnf();
+ workflowResourceIds.setVnfId("id111");
+ when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf1);
+
+ when(bbSetupUtils.existsAAIVfModuleGloballyByName("vFModName333")).thenReturn(true);
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(
+ containsString("vfModule with name vFModName333 already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName333", reqDetails,
+ workflowResourceIds);
}
@Test
@@ -1725,6 +1793,7 @@ public class WorkflowActionTest extends BaseTaskTest {
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
volumeGroup.setVolumeGroupName("name123");
+ volumeGroup.setVfModuleModelCustomizationId("1234567");
workflowResourceIds.setVnfId("id123");
Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup);
@@ -1747,6 +1816,24 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void validateVolumeGroupResourceIdInAAINotGloballyUniqueTest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setVnfId("id123");
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("id123");
+ when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf);
+ when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "testVolumeGroup")).thenReturn(Optional.empty());
+
+ when(bbSetupUtils.existsAAIVolumeGroupGloballyByName("testVolumeGroup")).thenReturn(true);
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(
+ containsString("volumeGroup with name testVolumeGroup already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "testVolumeGroup",
+ reqDetails, workflowResourceIds);
+ }
+
+ @Test
public void validateConfigurationResourceIdInAAITest() throws Exception {
RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
@@ -1789,6 +1876,22 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void validateConfigurationResourceIdInAAINotGloballyUniqueTest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+
+ when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "testConfig"))
+ .thenReturn(Optional.empty());
+ when(bbSetupUtils.existsAAIConfigurationGloballyByName("testConfig")).thenReturn(true);
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(
+ containsString("configuration with name testConfig already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "testConfig", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
public void validateServiceInstanceResourceIdInAAITest() throws Exception {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId("siId123");
diff --git a/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
index ccfd2f4de6..641bbb28c7 100644
--- a/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
+++ b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
@@ -21,5 +21,5 @@
package org.onap.so.constants;
public enum OrchestrationRequestFormat {
- DETAIL, STATUSDETAIL
+ DETAIL, STATUSDETAIL, SIMPLE
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
index fb7ab3a61e..e9f17c42d0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
@@ -61,7 +61,8 @@ public class CamundaRequestHandler {
if (context.getRetryCount() == 0) {
logger.info("Querying Camunda for process-instance history for requestId: {}", requestId);
} else {
- logger.info("Retry: Querying Camunda for process-instance history for requestId: {}",
+ logger.info(
+ "Retry: Querying Camunda for process-instance history for retryCount: {} and requestId: {}",
context.getRetryCount(), requestId);
}
return restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index 6ccef65e46..ab51d491eb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -130,25 +130,29 @@ public class OrchestrationRequests {
infraActiveRequest = infraActiveRequestLookup(requestId);
- try {
- requestProcessingData = requestsDbClient.getExternalRequestProcessingDataBySoRequestId(requestId);
- } catch (Exception e) {
- logger.error("Exception occurred while communicating with RequestDb during requestProcessingData lookup ",
- e);
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
+ if (isRequestProcessingDataRequired(format)) {
+ try {
+ requestProcessingData = requestsDbClient.getExternalRequestProcessingDataBySoRequestId(requestId);
+ } catch (Exception e) {
+ logger.error(
+ "Exception occurred while communicating with RequestDb during requestProcessingData lookup ",
+ e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError)
+ .build();
- ValidateException validateException = new ValidateException.Builder(
- "Exception occurred while communicating with RequestDb during requestProcessingData lookup",
- HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
- .errorInfo(errorLoggerInfo).build();
+ ValidateException validateException = new ValidateException.Builder(
+ "Exception occurred while communicating with RequestDb during requestProcessingData lookup",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
+ .errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw validateException;
+ }
}
Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, format);
- if (!requestProcessingData.isEmpty()) {
+ if (null != requestProcessingData && !requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
}
request.setRequestId(requestId);
@@ -196,15 +200,19 @@ public class OrchestrationRequests {
orchestrationList = new GetOrchestrationListResponse();
List<RequestList> requestLists = new ArrayList<>();
+
for (InfraActiveRequests infraActive : activeRequests) {
- List<RequestProcessingData> requestProcessingData =
- requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
RequestList requestList = new RequestList();
Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, format);
- if (!requestProcessingData.isEmpty()) {
- request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
+ if (isRequestProcessingDataRequired(format)) {
+ List<RequestProcessingData> requestProcessingData =
+ requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
+ if (null != requestProcessingData && !requestProcessingData.isEmpty()) {
+ request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
+ }
}
+
requestList.setRequest(request);
requestLists.add(requestList);
}
@@ -524,6 +532,14 @@ public class OrchestrationRequests {
return addedRequestProcessingData;
}
+ protected boolean isRequestProcessingDataRequired(String format) {
+ if (StringUtils.isNotEmpty(format) && format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
protected InfraActiveRequests infraActiveRequestLookup(String requestId) throws ApiException {
InfraActiveRequests infraActiveRequest = null;
try {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index e64f689624..23c2892c78 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -64,7 +64,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -163,6 +162,39 @@ public class OrchestrationRequestsTest extends BaseTest {
}
@Test
+ public void getOrchestrationRequestSimpleTest() throws Exception {
+ setupTestGetOrchestrationRequest();
+ // TEST VALID REQUEST
+ GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
+
+ Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
+ request.setRequestProcessingData(null);
+ testResponse.setRequest(request);
+
+ String testRequestId = request.getRequestId();
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId))
+ .queryParam("format", "simple");
+
+ ResponseEntity<GetOrchestrationResponse> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime")
+ .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp"));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ assertEquals("00032ab7-1a18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
+ assertNotNull(response.getBody().getRequest().getFinishTime());
+ }
+
+ @Test
public void testGetOrchestrationRequestInstanceGroup() throws Exception {
setupTestGetOrchestrationRequestInstanceGroup();
// TEST VALID REQUEST
@@ -448,6 +480,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertThat(actualProcessingData, sameBeanAs(expectedDataList));
}
+
public void setupTestGetOrchestrationRequest() throws Exception {
// For testGetOrchestrationRequest
wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018"))
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
index 1d90f7cffb..e061d2b79d 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
@@ -49,7 +49,7 @@ public class ProcessVnfc extends AbstractTestAction {
aaiResourceClient.create(vnfcURI, vnfc);
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE,
context.getVariable("vnfId"), context.getVariable("vfModuleId"));
- AAIResourceUri pserverURI = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "rdm52r19c001");
+ AAIResourceUri pserverURI = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test");
AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
context.getVariable("cloudOwner"), context.getVariable("cloudRegion"),
context.getVariable("tenant"), "d29f3151-592d-4011-9356-ad047794e236");
diff --git a/so-simulator/src/main/resources/openstack/gr_api/GetNeutronNetwork2.json b/so-simulator/src/main/resources/openstack/gr_api/GetNeutronNetwork2.json
index c66fecb8cd..725c896b8d 100644
--- a/so-simulator/src/main/resources/openstack/gr_api/GetNeutronNetwork2.json
+++ b/so-simulator/src/main/resources/openstack/gr_api/GetNeutronNetwork2.json
@@ -43,10 +43,10 @@
"port_filter": false,
"vlan": "181"
},
- "binding:vnic_type": "direct",
+ "binding:vnic_type": "normal",
"binding:vif_type": "hw_veb",
"mac_address": "fa:16:3e:0c:29:94",
"project_id": "872f331350c54e59991a8de2cbffb40c",
"created_at": "2019-02-11T19:11:39Z"
}
-} \ No newline at end of file
+}
diff --git a/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json b/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
index 82158772e4..622bf8e3ef 100644
--- a/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
+++ b/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
@@ -62,7 +62,7 @@
"status": "ACTIVE",
"updated": "2019-02-11T19:12:46Z",
"hostId": "50197c55fc934e7b3947e17db762f0839320f94983df774d84991ad2",
- "OS-EXT-SRV-ATTR:host": "rdm52r19c001",
+ "OS-EXT-SRV-ATTR:host": "test",
"OS-SRV-USG:terminated_at": null,
"key_name": null,
"OS-EXT-SRV-ATTR:hypervisor_hostname": "test.com",
@@ -72,4 +72,4 @@
"os-extended-volumes:volumes_attached": [],
"config_drive": "True"
}
-} \ No newline at end of file
+}