summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java15
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java62
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java2
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java7
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java2
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json41
18 files changed, 291 insertions, 53 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index eab0451aa6..df4229c985 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -108,7 +108,8 @@ public class CreateAAIInventory {
if (!CollectionUtils.isEmpty(oobMgtNetNames)) {
oobMgtNetIds = heatBridgeClient.extractNetworkIds(oobMgtNetNames);
}
- heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds);
+ heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds,
+ cloudInformation.getOwner());
logger.debug(
"Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
index d0ca87df95..9c098863f2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -134,8 +134,10 @@ public interface HeatBridgeApi {
*
* @param stackResources Openstack Heat stack resource list
* @param oobMgtNetIds List of OOB network IDs list
+ * @param cloudOwner
*/
- void buildAddVserverLInterfacesToAaiAction(List<Resource> stackResources, List<String> oobMgtNetIds);
+ void buildAddVserverLInterfacesToAaiAction(List<Resource> stackResources, List<String> oobMgtNetIds,
+ String cloudOwner);
/**
* Query and build AAI actions for Openstack Compute resources to AAI's pserver and pinterface objects
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 53736e912f..f37555392a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -79,6 +79,7 @@ import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl;
import org.onap.so.heatbridge.utils.HeatBridgeUtils;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
+import org.onap.so.spring.SpringContextHelper;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
import org.openstack4j.model.network.IP;
@@ -87,6 +88,7 @@ import org.openstack4j.model.network.NetworkType;
import org.openstack4j.model.network.Port;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.env.Environment;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
@@ -109,6 +111,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
private String tenantId;
private AaiHelper aaiHelper = new AaiHelper();
private CloudIdentity cloudIdentity;
+ private Environment env;
+
public HeatBridgeImpl(AAIResourcesClient resourcesClient, final CloudIdentity cloudIdentity,
@Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String regionId,
@@ -124,7 +128,10 @@ public class HeatBridgeImpl implements HeatBridgeApi {
this.regionId = regionId;
this.tenantId = tenantId;
this.resourcesClient = resourcesClient;
- this.transaction = resourcesClient.beginSingleTransaction();
+ if (resourcesClient != null)
+ this.transaction = resourcesClient.beginSingleTransaction();
+ if (SpringContextHelper.getAppContext() != null)
+ this.env = SpringContextHelper.getAppContext().getEnvironment();
}
public HeatBridgeImpl() {
@@ -253,7 +260,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
@Override
public void buildAddVserverLInterfacesToAaiAction(final List<Resource> stackResources,
- final List<String> oobMgtNetIds) {
+ final List<String> oobMgtNetIds, String cloudOwner) {
Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
List<String> portIds =
extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_PORT_RESOURCE_TYPE);
@@ -283,7 +290,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
lIf.setL2Multicasting(isL2Multicast);
updateLInterfaceIps(port, lIf);
- updateLInterfaceVlan(port, lIf);
+ if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
+ updateLInterfaceVlan(port, lIf);
+ }
// Update l-interface to the vserver
transaction.create(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner, cloudRegionId,
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 464a17d2a5..de40f1e6ba 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -42,6 +42,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.doReturn;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -58,7 +59,9 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.PInterface;
@@ -85,6 +88,7 @@ import org.openstack4j.model.network.NetworkType;
import org.openstack4j.model.network.Port;
import org.openstack4j.openstack.heat.domain.HeatResource;
import org.openstack4j.openstack.heat.domain.HeatResource.Resources;
+import org.springframework.core.env.Environment;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
@@ -104,16 +108,20 @@ public class HeatBridgeImplTest {
@Mock
private AAIResourcesClient resourcesClient;
+
@Mock
private AAISingleTransactionClient transaction;
- private HeatBridgeImpl heatbridge;
+ @Mock
+ private Environment env;
+
+ @InjectMocks
+ private HeatBridgeImpl heatbridge =
+ new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, REGION_ID, TENANT_ID);
@Before
public void setUp() throws HeatBridgeException, OpenstackClientException, BulkProcessFailed {
-
when(resourcesClient.beginSingleTransaction()).thenReturn(transaction);
- heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, REGION_ID, TENANT_ID);
}
@Ignore
@@ -396,7 +404,6 @@ public class HeatBridgeImplTest {
verify(transaction, times(2)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
- @Ignore
@Test
public void testUpdateVserverLInterfacesToAai() throws HeatBridgeException {
// Arrange
@@ -430,9 +437,10 @@ public class HeatBridgeImplTest {
PInterface pIf = mock(PInterface.class);
when(pIf.getInterfaceName()).thenReturn("test-port-id");
when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+ when(env.getProperty("mso.cloudOwner.included", "")).thenReturn("CloudOwner");
// Act
- heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"));
+ heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
// Assert
verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
@@ -440,6 +448,48 @@ public class HeatBridgeImplTest {
verify(osClient, times(5)).getNetworkById(anyString());
}
+ @Test
+ public void testUpdateVserverLInterfacesToAai_skipVlans() throws HeatBridgeException {
+ // Arrange
+ List<Resource> stackResources = (List<Resource>) extractTestStackResources();
+ Port port = mock(Port.class);
+ when(port.getId()).thenReturn("test-port-id");
+ when(port.getName()).thenReturn("test-port-name");
+ when(port.getvNicType()).thenReturn(HeatBridgeConstants.OS_SRIOV_PORT_TYPE);
+ when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78");
+ when(port.getNetworkId()).thenReturn("890a203a-23gg-56jh-df67-731656a8f13a");
+ when(port.getDeviceId()).thenReturn("test-device-id");
+ when(port.getVifDetails()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_VLAN_NETWORK_KEY, "2345"));
+ String pfPciId = "0000:08:00.0";
+ when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId,
+ HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id"));
+
+ Network network = mock(Network.class);
+ when(network.getId()).thenReturn("test-network-id");
+ when(network.getNetworkType()).thenReturn(NetworkType.VLAN);
+ when(network.getProviderSegID()).thenReturn("2345");
+
+ when(osClient.getPortById("212a203a-9764-4f42-84ea-731536a8f13a")).thenReturn(port);
+ when(osClient.getPortById("387e3904-8948-43d1-8635-b6c2042b54da")).thenReturn(port);
+ when(osClient.getPortById("70a09dfd-f1c5-4bc8-bd8f-dc539b8d662a")).thenReturn(port);
+ when(osClient.getPortById("12f88b4d-c8a4-4fbd-bcb4-7e36af02430b")).thenReturn(port);
+ when(osClient.getPortById("c54b9f45-b413-4937-bbe4-3c8a5689cfc9")).thenReturn(port);
+
+ SriovPf sriovPf = new SriovPf();
+ sriovPf.setPfPciId(pfPciId);
+ PInterface pIf = mock(PInterface.class);
+ when(pIf.getInterfaceName()).thenReturn("test-port-id");
+ when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+
+ // Act
+ heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
+
+ // Assert
+ verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
+ verify(osClient, times(5)).getPortById(anyString());
+ verify(osClient, times(0)).getNetworkById(anyString());
+ }
+
private List<? extends Resource> extractTestStackResources() {
List<HeatResource> stackResources = null;
try {
@@ -463,4 +513,6 @@ public class HeatBridgeImplTest {
}
return content;
}
+
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
index e867b670b7..e45811117c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
@@ -28,6 +28,7 @@ public class ExecuteBuildingBlock extends BuildingBlockBase<ExecuteBuildingBlock
private BuildingBlock buildingBlock;
private ConfigurationResourceKeys configurationResourceKeys;
private Boolean homing = false;
+ private String oldVolumeGroupName;
private static final long serialVersionUID = 3L;
public BuildingBlock getBuildingBlock() {
@@ -56,4 +57,13 @@ public class ExecuteBuildingBlock extends BuildingBlockBase<ExecuteBuildingBlock
this.configurationResourceKeys = configurationResourceKeys;
return this;
}
+
+ public String getOldVolumeGroupName() {
+ return oldVolumeGroupName;
+ }
+
+ public ExecuteBuildingBlock setOldVolumeGroupName(String oldVolumeGroupName) {
+ this.oldVolumeGroupName = oldVolumeGroupName;
+ return this;
+ }
}
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 fcc8484385..0cdf8a6e5d 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
@@ -750,6 +750,10 @@ public class BBInputSetup implements JavaDelegate {
parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams());
vnf.getVolumeGroups().add(volumeGroup);
if (parameter.getIsReplace()) {
+ if (parameter.getExecuteBB().getOldVolumeGroupName() != null
+ && !parameter.getExecuteBB().getOldVolumeGroupName().isEmpty()) {
+ volumeGroup.setVolumeGroupName(parameter.getExecuteBB().getOldVolumeGroupName());
+ }
mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(),
parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
} else {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 5a52e3a49d..4206596c94 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -104,7 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
handlingCode = "Abort";
} else {
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceType();
}
@@ -119,7 +119,7 @@ public class ExecuteBuildingBlockRainyDay {
String vnfType = ASTERISK;
String vnfName = ASTERISK;
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances()
.get(0).getVnfs()) {
if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
@@ -173,7 +173,7 @@ public class ExecuteBuildingBlockRainyDay {
String serviceRole = ASTERISK;
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceRole();
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
index e154375d3d..7f754e3f13 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlockBase;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
@@ -38,6 +37,7 @@ public class ConfigBuildingBlocksDataObject extends BuildingBlockBase<ConfigBuil
private List<OrchestrationFlow> orchFlows;
private Resource resourceKey;
private ServiceInstancesRequest sIRequest;
+ private ReplaceInstanceRelatedInformation replaceInformation;
public ServiceInstancesRequest getsIRequest() {
return sIRequest;
@@ -75,6 +75,15 @@ public class ConfigBuildingBlocksDataObject extends BuildingBlockBase<ConfigBuil
return this;
}
+ public ReplaceInstanceRelatedInformation getReplaceInformation() {
+ return replaceInformation;
+ }
+
+ public ConfigBuildingBlocksDataObject setReplaceInformation(ReplaceInstanceRelatedInformation replaceInformation) {
+ this.replaceInformation = replaceInformation;
+ return this;
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java
new file mode 100644
index 0000000000..d9e8fa55fa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java
@@ -0,0 +1,16 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+public class ReplaceInstanceRelatedInformation {
+
+ private String oldVolumeGroupName;
+
+ public String getOldVolumeGroupName() {
+ return oldVolumeGroupName;
+ }
+
+ public ReplaceInstanceRelatedInformation setOldVolumeGroupName(String oldVolumeGroupName) {
+ this.oldVolumeGroupName = oldVolumeGroupName;
+ return this;
+ }
+
+}
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 2921cada18..1a49e3af7f 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
@@ -222,16 +222,17 @@ public class WorkflowAction {
}
Resource resourceKey = getResourceKey(sIRequest, resourceType);
+ ReplaceInstanceRelatedInformation replaceInfo = new ReplaceInstanceRelatedInformation();
if ((requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS))
&& resourceType.equals(WorkflowType.VFMODULE)) {
logger.debug("Build a BB list for replacing BB modules");
- orchFlows = getVfModuleReplaceBuildingBlocks(
- new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
- .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
- .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
- .setRequestDetails(requestDetails).setExecution(execution));
+ orchFlows = getVfModuleReplaceBuildingBlocks(new ConfigBuildingBlocksDataObject()
+ .setsIRequest(sIRequest).setOrchFlows(orchFlows).setRequestId(requestId)
+ .setResourceKey(resourceKey).setApiVersion(apiVersion).setResourceId(resourceId)
+ .setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestDetails(requestDetails)
+ .setExecution(execution).setReplaceInformation(replaceInfo));
for (OrchestrationFlow orchFlow : orchFlows) {
if (orchFlow.getFlowName().contains(CONFIGURATION)) {
List<OrchestrationFlow> configOrchFlows = new ArrayList<>();
@@ -243,12 +244,13 @@ public class WorkflowAction {
.setApiVersion(apiVersion).setResourceId(resourceId)
.setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType)
.setWorkflowResourceIds(workflowResourceIds)
- .setRequestDetails(requestDetails).setExecution(execution));
+ .setRequestDetails(requestDetails).setExecution(execution)
+ .setReplaceInformation(replaceInfo));
flowsToExecute.addAll(configBuildingBlocks);
} else {
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
- requestDetails, false, null, null, false);
+ requestDetails, false, null, null, false, replaceInfo);
flowsToExecute.add(ebb);
}
}
@@ -271,7 +273,7 @@ public class WorkflowAction {
for (OrchestrationFlow orchFlow : orchFlows) {
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
- requestDetails, false, null, null, false);
+ requestDetails, false, null, null, false, replaceInfo);
flowsToExecute.add(ebb);
}
}
@@ -537,10 +539,11 @@ public class WorkflowAction {
+ ": VnfcName does not exist or is null while there is a configuration for the vfModule",
new Exception("Vnfc and Configuration do not match"));
}
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(),
- dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(),
- dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(),
- dataObj.getWorkflowResourceIds(), dataObj.getRequestDetails(), false, null, vnfcName, true);
+ ExecuteBuildingBlock ebb =
+ buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), dataObj.getResourceKey(),
+ dataObj.getApiVersion(), dataObj.getResourceId(), dataObj.getRequestAction(),
+ dataObj.isaLaCarte(), dataObj.getVnfType(), dataObj.getWorkflowResourceIds(),
+ dataObj.getRequestDetails(), false, null, vnfcName, true, null);
flowsToExecuteConfigs.add(ebb);
}
}
@@ -565,14 +568,16 @@ public class WorkflowAction {
&& dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups() != null) {
rebuildVolumeGroups = dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups();
}
-
+ String volumeGroupName = "";
Optional<VolumeGroup> volumeGroupFromVfModule =
bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, vfModuleId);
if (volumeGroupFromVfModule.isPresent()) {
String volumeGroupId = volumeGroupFromVfModule.get().getVolumeGroupId();
+ volumeGroupName = volumeGroupFromVfModule.get().getVolumeGroupName();
logger.debug("Volume group id of the existing volume group is: " + volumeGroupId);
volumeGroupExisted = true;
dataObj.getWorkflowResourceIds().setVolumeGroupId(volumeGroupId);
+ dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
}
List<OrchestrationFlow> orchFlows = dataObj.getOrchFlows();
@@ -585,6 +590,7 @@ public class WorkflowAction {
if (!volumeGroupExisted) {
String newVolumeGroupId = UUID.randomUUID().toString();
dataObj.getWorkflowResourceIds().setVolumeGroupId(newVolumeGroupId);
+ dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
logger.debug("newVolumeGroupId: " + newVolumeGroupId);
}
}
@@ -1386,7 +1392,7 @@ public class WorkflowAction {
resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType))
.forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource,
apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
- isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration)));
+ isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null)));
}
protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
@@ -1433,7 +1439,7 @@ public class WorkflowAction {
for (Resource resource : vfModuleResourcesSorted) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null,
- false));
+ false, null));
}
} else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
if (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
@@ -1453,8 +1459,9 @@ public class WorkflowAction {
requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
false, true);
} else {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
- requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, false));
+ flowsToExecute
+ .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction,
+ false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null));
}
}
return flowsToExecute;
@@ -1463,7 +1470,8 @@ public class WorkflowAction {
protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId,
Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte,
String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
- boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration) {
+ boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration,
+ ReplaceInstanceRelatedInformation replaceInfo) {
BuildingBlock buildingBlock =
new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString())
@@ -1471,7 +1479,10 @@ public class WorkflowAction {
.setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse(""));
Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction);
Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope);
-
+ String oldVolumeGroupName = "";
+ if (replaceInfo != null) {
+ oldVolumeGroupName = replaceInfo.getOldVolumeGroupName();
+ }
if (resource != null
&& (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) {
@@ -1482,7 +1493,7 @@ public class WorkflowAction {
ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion)
.setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType)
.setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock)
- .setRequestDetails(requestDetails);
+ .setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName);
if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) {
ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName);
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 cf8d98e86e..8f104566a4 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
@@ -3122,7 +3122,7 @@ public class WorkflowActionTest extends BaseTaskTest {
ExecuteBuildingBlock result = null;
try {
result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null,
- false, null, null, null, false, null, null, true);
+ false, null, null, null, false, null, null, true, null);
} catch (NullPointerException e) {
fail("NullPointerException should not be thrown when 'resource' is null");
}
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
index 23a1a812df..4a8b7d90c6 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
@@ -325,13 +325,8 @@ public class FluentGenerator {
String value;
String name;
- if (params.group(2) != null) {
- name = params.group(2);
- } else {
- name = params.group(1);
- }
value = params.group(1);
-
+ name = params.group(2);
name = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name);
classFields.add(FieldSpec.builder(String.class, name, Modifier.PUBLIC, Modifier.FINAL)
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
index 8be22e1dcc..d27794c127 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
@@ -7,5 +7,5 @@ public class Patterns {
public static final Pattern pluralPattern = Pattern.compile(".*(?<partial>/(?<name>[^{]*$))");
public static final Pattern singularPattern = Pattern.compile(".*(?<partial>/(?<name>[^/{}]*)/\\{.*$)");
public static final Pattern topLevelPattern = Pattern.compile("^/([^/]+)/.*");
- public static final Pattern urlTemplatePattern = Pattern.compile("\\{([^}.]+(?:\\.([^}]+))?)\\}");
+ public static final Pattern urlTemplatePattern = Pattern.compile("\\{((?:.+\\.)?([^}.]+))\\}");
}
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
index 42305488bc..ec09af8a4e 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
@@ -125,8 +125,6 @@ public class SwaggerConverter {
}
}
- log.debug(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(output));
-
for (Map.Entry<String, ObjectType> item : output.entrySet()) {
if (item.getValue().getType().equals("plural")) {
@@ -156,7 +154,7 @@ public class SwaggerConverter {
Matcher templates = Patterns.urlTemplatePattern.matcher(item.getValue().getPartialUri());
List<String> localFields = new ArrayList<>();
while (templates.find()) {
- localFields.add(templates.group(1));
+ localFields.add(templates.group(2));
}
item.getValue().setFields(item.getValue().getFields().stream()
.filter(f -> localFields.contains(f.getName())).collect(Collectors.toList()));
@@ -166,6 +164,8 @@ public class SwaggerConverter {
output.values().stream().filter(item -> item.getType().equals("plural"))
.forEach(item -> item.getChildren().clear());
+ log.debug(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(output));
+
return output;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index 357497591d..0f7cf5fc6a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -81,12 +81,13 @@ public class WorkflowSpecificationsHandler {
@Transactional
public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId,
- @QueryParam("pnfModelVersionId") String pnfModelVersionId, @PathParam("version") String version)
+ @QueryParam("pnfModelVersionId") String pnfModelVersionId,
+ @QueryParam("resourceTarget") String resourceTarget, @PathParam("version") String version)
throws Exception {
String apiVersion = version.substring(1);
List<Workflow> workflows = new ArrayList<>();
- if (vnfModelVersionId == null && pnfModelVersionId == null) {
+ if (vnfModelVersionId == null && pnfModelVersionId == null && resourceTarget == null) {
workflows.addAll(queryWorkflowSpecificationsForAll());
} else {
// 1. query workflow specifications for given vnfModelVersionId if need.
@@ -106,6 +107,16 @@ public class WorkflowSpecificationsHandler {
workflows.addAll(pnfWorkflows);
}
}
+
+ // 3. query workflow specifications for given resourceTarget
+ if (resourceTarget != null) {
+ List<Workflow> workflowsForResourceTarget = queryWorkflowsForResourceTarget(resourceTarget);
+ logger.debug(
+ "Retrieved " + workflowsForResourceTarget.size() + " workflows for given resource target.");
+ if (workflowsForResourceTarget.size() > 0) {
+ workflows.addAll(workflowsForResourceTarget);
+ }
+ }
}
// Deduplication
@@ -119,11 +130,16 @@ public class WorkflowSpecificationsHandler {
apiVersion);
}
+ /**
+ * @deprecated As of G release, workflows for all resource types (pnf,vnf,service) can be fetched using
+ * /workflowSpecifications/{version:[vV]1}/workflows?resourceTarget={resourceType} API
+ */
@Path("/{version:[vV]1}/pnfWorkflows")
@GET
@Operation(description = "Finds pnf workflow specifications", responses = @ApiResponse(
content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
+ @Deprecated
public Response getWorkflowsSpecForPnf(@PathParam("version") String version) throws Exception {
final String pnf_resource = "pnf";
@@ -132,7 +148,7 @@ public class WorkflowSpecificationsHandler {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- List<Workflow> workflows = catalogDbClient.findWorkflowByResourceTarget(pnf_resource);
+ List<Workflow> workflows = queryWorkflowsForResourceTarget(pnf_resource);
Optional<String> optional = getResponseByWorkflowSpec(workflows);
return builder.buildResponse(HttpStatus.SC_OK, "", optional.isPresent() ? optional.get() : EMPTY_BODY,
@@ -296,4 +312,11 @@ public class WorkflowSpecificationsHandler {
List<Workflow> workflows = catalogDbClient.findWorkflowByPnfModelUUID(pnfModelVersionId);
return workflows;
}
+
+ private List<Workflow> queryWorkflowsForResourceTarget(String resourceTarget) {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByResourceTarget(resourceTarget);
+ return workflows;
+ }
+
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
index 4ab88f40f6..1fa71cefc2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -58,6 +58,9 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
@Autowired
WorkflowSpecificationsHandler workflowSpecificationsHandler;
+ @Autowired
+ ObjectMapper mapper;
+
@Value("${wiremock.server.port}")
private String wiremockPort;
@@ -152,7 +155,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WorkflowSpecifications expectedResponse = mapper.readValue(
@@ -306,7 +308,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
WorkflowSpecifications workflowSpecifications =
workflowSpecificationsHandler.mapWorkflowsToWorkflowSpecifications(workflows);
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String workflowSpecificationsJson = mapper.writeValueAsString(workflowSpecifications);
@@ -349,7 +350,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WorkflowSpecifications expectedResponse = mapper.readValue(
@@ -367,6 +367,52 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
}
@Test
+ public void queryWorkflowSpecificationsByResourceTarget_Test_Success() throws JSONException, IOException {
+
+ String URL_PATH = basePath + "/v1/workflows";
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ String WORKFLOW_QUERY = "/workflow/search/findByResourceTarget[?]resourceTarget=service";
+ String WORKFLOW_SPEC_QUERY = "/workflow/5/workflowActivitySpecSequence";
+ String JSON_FILE_PATH = "src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json";
+ String MOCK_RESP_FILE = "WorkflowSpecificationsForServiceWorkflows_Response.json";
+ String MOCK_RESP_SPEC_FILE = "Empty_workflowActivitySpecSequence_Response.json";
+
+ wireMockServer.stubFor(get(urlMatching(WORKFLOW_QUERY))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(MOCK_RESP_FILE))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching(WORKFLOW_SPEC_QUERY))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(MOCK_RESP_SPEC_FILE))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(URL_PATH)).queryParam("resourceTarget", "service");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ WorkflowSpecifications expectedResponse = mapper
+ .readValue(new String(Files.readAllBytes(Paths.get(JSON_FILE_PATH))), WorkflowSpecifications.class);
+ WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(expectedResponse, sameBeanAs(realResponse));
+ 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("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+
+ @Test
public void testWorkflowSpecificationsForPnf_Success() throws JSONException, IOException {
final String urlPath = basePath + "/v1/pnfWorkflows";
@@ -397,7 +443,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WorkflowSpecifications expectedResponse = mapper.readValue(
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json
new file mode 100644
index 0000000000..aaaad17470
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json
@@ -0,0 +1,20 @@
+{
+ "workflowSpecificationList": [
+ {
+ "workflowSpecification": {
+ "artifactInfo": {
+ "artifactType": "workflow",
+ "artifactUuid": "a1fe8726-66d5-3e7f-2212-7e5h662e9255",
+ "artifactName": "DummyServiceWorkflow",
+ "artifactVersion": "1.0",
+ "artifactDescription": "Dummy Service Workflow to test custom Service workflow",
+ "workflowName": "Dummy Service Workflow",
+ "operationName": "DummyServiceWorkflow",
+ "workflowSource": "native",
+ "workflowResourceTarget": "service"
+ },
+ "workflowInputParameters": []
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json
new file mode 100644
index 0000000000..9a836e033b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json
@@ -0,0 +1,41 @@
+{
+ "_embedded": {
+ "workflow": [
+ {
+ "artifactChecksum": "MANUAL RECORD",
+ "artifactName": "DummyServiceWorkflow",
+ "artifactUUID": "a1fe8726-66d5-3e7f-2212-7e5h662e9255",
+ "body": null,
+ "created": "2020-06-29T08:28:15.000+0000",
+ "description": "Dummy Service Workflow to test custom Service workflow",
+ "id": 4,
+ "name": "Dummy Service Workflow",
+ "operationName": "DummyServiceWorkflow",
+ "pnfResourceWorkflow": null,
+ "resourceTarget": "service",
+ "source": "native",
+ "timeoutMinutes": null,
+ "version": 1.0,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findByResourceTarget?resourceTarget=service"
+ },
+ "workflow": {
+ "href": "http://localhost:8090/workflow/5"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/5/workflowActivitySpecSequence"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findByResourceTarget?resourceTarget=service"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/5/workflowActivitySpecSequence"
+ }
+ }
+} \ No newline at end of file