summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-enrichment-lib
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-12-28 18:33:00 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-01-02 15:20:27 +0000
commit9d79007d2b36d5ae4a03581eeca1fcf6232b3b09 (patch)
tree0638ab46c050e901995e03dcefe5d4c0314ec95d /openecomp-be/lib/openecomp-sdc-enrichment-lib
parentb38f18bb99a603012ec406053531c45fb4643d62 (diff)
fix MIB assignment
Assign mib file to all of the components from the same VFC type Change-Id: Ia6a1a5a08b7383ec64ace085193b0c8daa399c7f Issue-ID: SDC-811 Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java15
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java236
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java117
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/MainServiceTemplate.yaml39
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_1serverServiceTemplate.yaml20
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_serverServiceTemplate.yaml20
10 files changed, 352 insertions, 135 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java
index a3a76a561b..34177bbcff 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java
@@ -31,30 +31,21 @@ public class ComponentMonitoringUploadInfo {
private Map<MonitoringUploadType, MonitoringArtifactInfo> infoByType = new HashMap<>();
- //todo as part of ATTASDC-4503
-
public MonitoringArtifactInfo getSnmpTrap() {
return infoByType.get(SNMP_TRAP);
}
- public void setSnmpTrap(MonitoringArtifactInfo snmpTrapInfo) {
- infoByType.put(SNMP_TRAP, snmpTrapInfo);
- }
-
public MonitoringArtifactInfo getSnmpPoll() {
return infoByType.get(SNMP_POLL);
}
- public void setSnmpPoll(MonitoringArtifactInfo snmpPollInfo) {
- infoByType.put(SNMP_POLL, snmpPollInfo);
- }
-
public MonitoringArtifactInfo getVesEvent() {
return infoByType.get(VES_EVENTS);
}
- public void setVesEvent(MonitoringArtifactInfo snmpPollInfo) {
- infoByType.put(VES_EVENTS, snmpPollInfo);
+ public void setMonitoringArtifactFile(MonitoringUploadType type,
+ MonitoringArtifactInfo monitoringArtifactInfo) {
+ infoByType.put(type, monitoringArtifactInfo);
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java
index 57c1d19f03..e55ad880e9 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java
@@ -28,6 +28,7 @@ import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import java.lang.reflect.Constructor;
import java.util.Collection;
@@ -38,9 +39,6 @@ import java.util.Map;
public class ExternalArtifactEnricher extends Enricher {
private MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private static String EXTERNAL_ARTIFACT_ENRICH_CONF_FILE = "ExternalArtifactConfiguration.json";
- private static final String EXTERNAL_ARTIFACT_ENRICH_ERROR = "ERROR_CREATING_EXTERNAL_ARTIFACTS";
- private static final String EXTERNAL_ARTIFACT_ENRICH_ERROR_MSG =
- "An Error has occured during enrichment of external artifacts ";
private static Collection<String> implementingClasses =
getExternalArtifactEnrichedImplClassesList();
private static Logger logger = LoggerFactory.getLogger(ExternalArtifactEnricher.class);
@@ -57,21 +55,21 @@ public class ExternalArtifactEnricher extends Enricher {
public Map<String, List<ErrorMessage>> enrich() {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
Map<String, List<ErrorMessage>> errors = new HashMap<>();
try {
for (String implementingClassName : implementingClasses) {
ExternalArtifactEnricherInterface externalArtifactEnricherInstance = getExternalArtifactEnricherInstance(implementingClassName);
- externalArtifactEnricherInstance.enrich(this.data);
+ externalArtifactEnricherInstance.enrich(this.data, (ToscaServiceModel) this.model);
}
} catch (Exception e) {
logger.debug("",e);
logger.error(e.getMessage());
}
- mdcDataDebugMessage.debugExitMessage(null, null);
+ mdcDataDebugMessage.debugExitMessage(null);
return errors;
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java
index ff0e9b4838..f15d83cd55 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java
@@ -37,7 +37,10 @@ import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
-import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.Directive;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.sdc.tosca.services.DataModelUtil;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
@@ -49,28 +52,37 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME;
+
public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface {
private EnrichedServiceModelDao enrichedServiceModelDao;
private ComponentDao componentDao;
private ComponentArtifactDao componentArtifactDao;
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private static final String COMPONENT_PREFIX = "org.openecomp.resource.vfc.";
+
+ private final Logger LOG = LoggerFactory.getLogger(this.getClass().getName());
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
/**
* Enrich map.
*
* @param enrichmentInfo the enrichmentInfo
* @return the map
*/
- public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo) {
+ public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo,
+ ToscaServiceModel serviceModel) {
Map<String, List<ErrorMessage>> errors = new HashMap<>();
String vspId = enrichmentInfo.getKey();
@@ -79,33 +91,115 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
Collection<ComponentEntity> components =
getComponentDao().list(new ComponentEntity(vspId, version, null));
components
- .forEach(componentEntry -> errors.putAll(enrichComponent(componentEntry, vspId, version)));
+ .forEach(componentEntry -> errors.putAll(enrichComponent(vspId, version, componentEntry,
+ serviceModel)));
return errors;
}
- Map<String, List<ErrorMessage>> enrichComponent(ComponentEntity componentEntry, String vspId,
- Version version) {
+ private Map<String, List<ErrorMessage>> enrichComponent(String vspId,
+ Version version,
+ ComponentEntity component,
+ ToscaServiceModel serviceModel) {
+ Set<String> abstractNodeTypes =
+ extractAbstractTypesFromSameTypeFromServiceModel(component, serviceModel);
+ return enrichComponent(vspId, version, component, abstractNodeTypes);
+ }
+
+ private Set<String> extractAbstractTypesFromSameTypeFromServiceModel(ComponentEntity component,
+ ToscaServiceModel serviceModel) {
+ Set<String> abstractNodeTypes = new HashSet<>();
+ Map<String, ServiceTemplate> serviceTemplates = serviceModel.getServiceTemplates();
+ String typeToCheck =
+ getComponentVfcTypeToCheck(component.getComponentCompositionData().getName());
+
+ for (ServiceTemplate serviceTemplate : serviceTemplates.values()) {
+ collectAllAbstractNodeTypesPointingToType(
+ typeToCheck, serviceTemplate, serviceTemplates, abstractNodeTypes);
+ }
+
+ return abstractNodeTypes;
+ }
+
+ private String getComponentVfcTypeToCheck(String type) {
+ return Objects.isNull(type) ? ""
+ : type.replace(COMPONENT_PREFIX, COMPONENT_PREFIX + "compute.");
+ }
+
+ private void collectAllAbstractNodeTypesPointingToType(String typeToCheck,
+ ServiceTemplate serviceTemplate,
+ Map<String, ServiceTemplate> serviceTemplates,
+ Set<String> abstractNodeTypes) {
+ Map<String, NodeTemplate> nodeTemplates =
+ DataModelUtil.getNodeTemplates(serviceTemplate);
+
+ for (Map.Entry<String, NodeTemplate> nodeTemplateEntry : nodeTemplates.entrySet()) {
+ handleNodeTemplate(nodeTemplateEntry.getValue(), typeToCheck,
+ serviceTemplates, abstractNodeTypes);
+ }
+ }
+
+ private void handleNodeTemplate(NodeTemplate nodeTemplate,
+ String typeToCheck,
+ Map<String, ServiceTemplate> serviceTemplates,
+ Set<String> abstractNodeTypes) {
+ List<String> directives = DataModelUtil.getDirectives(nodeTemplate);
+ if (directives.contains(Directive.SUBSTITUTABLE.getDisplayName())) {
+ handleSubstitutionServiceTemplate(typeToCheck, nodeTemplate, serviceTemplates,
+ abstractNodeTypes);
+ }
+ }
+
+ private void handleSubstitutionServiceTemplate(String typeToCheck,
+ NodeTemplate nodeTemplate,
+ Map<String, ServiceTemplate> serviceTemplates,
+ Set<String> abstractNodeTypes) {
+ Object serviceTemplateFilter =
+ DataModelUtil.getPropertyValue(nodeTemplate, SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
+ if (Objects.nonNull(serviceTemplateFilter) && serviceTemplateFilter instanceof Map) {
+ String substituteServiceTemplateName =
+ (String) ((Map<String, Object>) serviceTemplateFilter)
+ .get(SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME);
+ ServiceTemplate substituteServiceTemplate =
+ serviceTemplates.get(substituteServiceTemplateName);
+ if (doesNodeTypeExistInSubServiceTemplate(typeToCheck, substituteServiceTemplate)) {
+ abstractNodeTypes.add(nodeTemplate.getType());
+ }
+ }
+ }
+
+ private boolean doesNodeTypeExistInSubServiceTemplate(String nodeTypeId,
+ ServiceTemplate substituteServiceTemplate) {
+ return Objects
+ .nonNull(DataModelUtil.getNodeType(substituteServiceTemplate, nodeTypeId));
+ }
+
+ Map<String, List<ErrorMessage>> enrichComponent(String vspId,
+ Version version,
+ ComponentEntity componentEntry,
+ Set<String> abstractNodeTypes) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
Map<String, List<ErrorMessage>> errors = new HashMap<>();
- ComponentMonitoringUploadInfo componentMonitoringUploadInfo =
- extractComponentMibInfo(componentEntry, vspId, version, errors);
- enrichComponentMib(componentMonitoringUploadInfo, vspId, version, errors);
- mdcDataDebugMessage.debugExitMessage(null, null);
+ List<ComponentMonitoringUploadInfo> componentMonitoringUploadInfoList =
+ extractComponentMibInfo(vspId, version, componentEntry, abstractNodeTypes);
+
+ componentMonitoringUploadInfoList.forEach(
+ componentUploadInfo -> enrichComponentMib(vspId, version, componentUploadInfo, errors));
+
+ mdcDataDebugMessage.debugExitMessage(null);
return errors;
}
- private ComponentMonitoringUploadInfo extractComponentMibInfo(ComponentEntity componentEntity,
- String vspId,
- Version version,
- Map<String, List<ErrorMessage>> errors) {
+ private List<ComponentMonitoringUploadInfo> extractComponentMibInfo(String vspId, Version version,
+ ComponentEntity componentEntity,
+ Set<String> abstractNodeTypes) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
String componentId = componentEntity.getId();
ComponentMonitoringUploadEntity entity = new ComponentMonitoringUploadEntity();
@@ -113,79 +207,70 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
entity.setVspId(vspId);
entity.setVersion(version);
entity.setComponentId(componentId);
- String componentName = componentEntity.getComponentCompositionData().getName();
- ComponentMonitoringUploadInfo componentMonitoringUploadInfo =
- new ComponentMonitoringUploadInfo();
- for (MonitoringUploadType monitoringUploadType : MonitoringUploadType.values()) {
- updComponentMibInfoByType(componentName, monitoringUploadType, entity,
- componentMonitoringUploadInfo,
- errors);
- }
-// updComponentMibInfoByType(componentName, MonitoringUploadType.SNMP_POLL, entity,
-// componentMonitoringUploadInfo,
-// errors);
-// updComponentMibInfoByType(componentName, MonitoringUploadType.SNMP_TRAP, entity,
-// componentMonitoringUploadInfo,
-// errors);
-
- mdcDataDebugMessage.debugExitMessage(null, null);
- return componentMonitoringUploadInfo;
+ List<ComponentMonitoringUploadInfo> componentMonitoringUploadInfoList = new ArrayList<>();
+
+ abstractNodeTypes.forEach(unifiedComponentNodeType -> componentMonitoringUploadInfoList
+ .add(updComponentMibInfoByType(unifiedComponentNodeType, entity)));
+
+ mdcDataDebugMessage.debugExitMessage(null);
+ return componentMonitoringUploadInfoList;
}
- private void updComponentMibInfoByType(String componentName, MonitoringUploadType type,
- ComponentMonitoringUploadEntity componentMonitoringUploadEntity,
- ComponentMonitoringUploadInfo componentMonitoringUploadInfo,
- Map<String, List<ErrorMessage>> errors) {
+ private ComponentMonitoringUploadInfo updComponentMibInfoByType(String componentName,
+ ComponentMonitoringUploadEntity componentMonitoringUploadEntity) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
- String path;
- componentMonitoringUploadEntity.setType(type);
- Optional<ComponentMonitoringUploadEntity> artifact =
- getComponentArtifactDao().getByType(componentMonitoringUploadEntity);
+ ComponentMonitoringUploadInfo componentMonitoringUploadInfo =
+ new ComponentMonitoringUploadInfo();
- if (!artifact.isPresent()) {
- return;
+ for (MonitoringUploadType type : MonitoringUploadType.values()) {
+ componentMonitoringUploadEntity.setType(type);
+ Optional<ComponentMonitoringUploadEntity> artifact =
+ getComponentArtifactDao().getByType(componentMonitoringUploadEntity);
+
+ if (!artifact.isPresent()) {
+ continue;
+ }
+ ComponentMonitoringUploadEntity mibArtifact = artifact.get();
+ updateComponentMonitoringUploadInfoWithMib(getArtifactPath(type, componentName), type,
+ mibArtifact,
+ componentMonitoringUploadInfo);
}
- String unifiedComponentNodeType =
- ToscaNodeType.ABSTRACT_NODE_TYPE_PREFIX + DataModelUtil.getNamespaceSuffix(componentName);
- path = unifiedComponentNodeType + File.separator + ArtifactCategory.DEPLOYMENT.getDisplayName()
+
+ mdcDataDebugMessage.debugExitMessage(null);
+ return componentMonitoringUploadInfo;
+ }
+
+ private String getArtifactPath(MonitoringUploadType type, String unifiedComponentNodeType) {
+ return unifiedComponentNodeType + File.separator + ArtifactCategory.DEPLOYMENT.getDisplayName()
+ File.separator + type.name();
+ }
+
+ private void updateComponentMonitoringUploadInfoWithMib(String path,
+ MonitoringUploadType type,
+ ComponentMonitoringUploadEntity mibArtifact,
+ ComponentMonitoringUploadInfo componentMonitoringUploadInfo) {
MonitoringArtifactInfo monitoringArtifactInfo = new MonitoringArtifactInfo();
monitoringArtifactInfo.setName(path);
- monitoringArtifactInfo.setContent(artifact.get().getArtifact().array());
- switch (type) { //todo as part of ATTASDC-4503
- case SNMP_POLL:
- componentMonitoringUploadInfo.setSnmpPoll(monitoringArtifactInfo);
- break;
- case SNMP_TRAP:
- componentMonitoringUploadInfo.setSnmpTrap(monitoringArtifactInfo);
- break;
- case VES_EVENTS:
- componentMonitoringUploadInfo.setVesEvent(monitoringArtifactInfo);
- break;
- default:
- break;
- }
-
- mdcDataDebugMessage.debugExitMessage(null, null);
+ monitoringArtifactInfo.setContent(mibArtifact.getArtifact().array());
+ componentMonitoringUploadInfo.setMonitoringArtifactFile(type, monitoringArtifactInfo);
}
- private void enrichComponentMib(ComponentMonitoringUploadInfo componentMonitoringUploadInfo,
- String vspId,
+ private void enrichComponentMib(String vspId,
Version version,
+ ComponentMonitoringUploadInfo componentUploadInfo,
Map<String, List<ErrorMessage>> errors) {
-
-
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
ServiceArtifact mibServiceArtifact = new ServiceArtifact();
mibServiceArtifact.setVspId(vspId);
mibServiceArtifact.setVersion(version);
- enrichMibFiles(mibServiceArtifact, componentMonitoringUploadInfo, errors);
+ enrichMibFiles(mibServiceArtifact, componentUploadInfo, errors);
+
- mdcDataDebugMessage.debugExitMessage(null, null);
+ mdcDataDebugMessage.debugExitMessage(null);
}
private void enrichMibFiles(ServiceArtifact monitoringArtifact,
@@ -193,12 +278,11 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
Map<String, List<ErrorMessage>> errors) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
if (componentMonitoringUploadInfo == null) {
return;
}
- //todo fix as part of ATTASDC-4503
enrichMibByType(componentMonitoringUploadInfo.getSnmpTrap(), MonitoringUploadType.SNMP_TRAP,
monitoringArtifact,
errors);
@@ -209,7 +293,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
monitoringArtifact,
errors);
- mdcDataDebugMessage.debugExitMessage(null, null);
+ mdcDataDebugMessage.debugExitMessage(null);
}
private void enrichMibByType(MonitoringArtifactInfo monitoringArtifactInfo,
@@ -218,7 +302,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
Map<String, List<ErrorMessage>> errors) {
- mdcDataDebugMessage.debugEntryMessage(null, null);
+ mdcDataDebugMessage.debugEntryMessage(null);
if (monitoringArtifactInfo == null) {
return;
@@ -228,7 +312,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
mibs = FileUtils
.getFileContentMapFromZip(FileUtils.toByteArray(monitoringArtifactInfo.getContent()));
} catch (IOException ioException) {
- log.debug("",ioException);
+ LOG.debug("", ioException);
ErrorMessage.ErrorMessageUtil
.addMessage(mibServiceArtifact.getName() + "." + type.name(), errors)
.add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
@@ -241,7 +325,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
getEnrichedServiceModelDao().storeExternalArtifact(mibServiceArtifact);
}
- mdcDataDebugMessage.debugExitMessage(null, null);
+ mdcDataDebugMessage.debugExitMessage(null);
}
private EnrichedServiceModelDao getEnrichedServiceModelDao() {
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java
index 828de7244c..089cfe7a82 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java
@@ -10,6 +10,7 @@ import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.enrichment.EnrichmentInfo;
import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
@@ -29,13 +30,13 @@ import java.util.Map;
public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterface {
private ComponentDao componentDao;
- //private ProcessArtifactDao processArtifactDao;
private ProcessDao processDao;
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private EnrichedServiceModelDao enrichedServiceModelDao;
@Override
- public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo) throws IOException {
+ public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo,
+ ToscaServiceModel serviceModel) throws IOException {
Map<String, List<ErrorMessage>> errors = new HashMap<>();
String vspId = enrichmentInfo.getKey();
Version version = enrichmentInfo.getVersion();
@@ -72,18 +73,11 @@ public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterfac
ProcessEntity processEntity = new ProcessEntity(vspId, version, componentId, null);
final Collection<ProcessEntity> processes = getProcessDao().list(processEntity);
- /*processes.stream()
- .filter(entity -> entity.getType().equals(ProcessType.Lifecycle_Operations))
- .forEach(entity -> {
- ProcessArtifactEntity artifactEntity = new ProcessArtifactEntity(vspId, version,
- componentId, entity.getId());*/
-
processes.forEach(entity -> {
ProcessEntity artifactEntity = new ProcessEntity(vspId, version,
componentId, entity.getId());
ProcessEntity artifactProcessEntity = getProcessDao().get(artifactEntity);
- //ProcessArtifactEntity artifact = getProcessArtifactDao().get(artifactEntity);
if (artifactProcessEntity != null && ProcessType.Lifecycle_Operations.equals(
artifactProcessEntity.getType())
&& artifactProcessEntity.getArtifactName() != null ) {
@@ -99,7 +93,7 @@ public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterfac
ServiceArtifact processServiceArtifact = new ServiceArtifact();
processServiceArtifact.setVspId(vspId);
processServiceArtifact.setVersion(version);
- enrichServiceArtifact(componentProcessInfo, processServiceArtifact, errors);
+ enrichServiceArtifact(componentProcessInfo, processServiceArtifact);
}
});
@@ -107,8 +101,7 @@ public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterfac
}
void enrichServiceArtifact(ComponentProcessInfo componentProcessInfo,
- ServiceArtifact processServiceArtifact,
- Map<String, List<ErrorMessage>> errors) {
+ ServiceArtifact processServiceArtifact) {
mdcDataDebugMessage.debugEntryMessage(null);
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java
index 9e46a5c33d..3836796420 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java
@@ -31,6 +31,7 @@ import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.enrichment.EnrichmentInfo;
import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
@@ -63,14 +64,13 @@ public class VspInformationArtifactEnricher implements ExternalArtifactEnricherI
public VspInformationArtifactEnricher() {
}
- public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo)
+ public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo,
+ ToscaServiceModel serviceModel)
throws IOException {
String vspId = enrichmentInfo.getKey();
Version version = enrichmentInfo.getVersion();
- Map<String, List<ErrorMessage>> errors = enrichInformationArtifact(vspId, version);
-
- return errors;
+ return enrichInformationArtifact(vspId, version);
}
private Map<String, List<ErrorMessage>> enrichInformationArtifact(String vspId, Version version)
@@ -88,7 +88,6 @@ public class VspInformationArtifactEnricher implements ExternalArtifactEnricherI
errorList.add(new ErrorMessage(ErrorLevel.ERROR, String.format(
"Cannot enrich information artifact for vendor software product with id %s and version %s",
vspId, version.toString())));
- //TODO: add error to map (what is the key?)
mdcDataDebugMessage.debugExitMessage(null);
return errors;
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java
index bd250bb8f4..dd1f13d034 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.enrichment.inter;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.enrichment.EnrichmentInfo;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import java.io.IOException;
import java.util.List;
@@ -32,5 +33,6 @@ import java.util.Map;
* Created by Talio on 11/24/2016.
*/
public interface ExternalArtifactEnricherInterface {
- Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo) throws IOException;
+ Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo,
+ ToscaServiceModel serviceModel) throws IOException;
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java
index c01f986ab1..65444b9c46 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.enrichment.impl.external.artifact;
+import org.apache.commons.collections4.CollectionUtils;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
@@ -32,7 +33,11 @@ import org.openecomp.core.model.types.ServiceArtifact;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.enrichment.EnrichmentInfo;
import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.sdc.tosca.services.DataModelUtil;
+import org.openecomp.sdc.tosca.services.ToscaUtil;
+import org.openecomp.sdc.tosca.services.YamlUtil;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
@@ -43,10 +48,18 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
+import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
import java.util.Optional;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.atLeastOnce;
@@ -73,20 +86,23 @@ public class MonitoringMibEnricherTest {
@Test
public void testEnrichComponent() throws Exception {
String vspId = "123";
- String componentId = "1111111111";
+ String componentId = "1";
Version version = new Version();
version.setMajor(1);
version.setMinor(0);
- ComponentEntity componentEntity = getComponentEntity(vspId, version, componentId);
- setMockToEnrichComponent(vspId, componentId, version);
- monitoringMibEnricher.enrichComponent(componentEntity, vspId, version);
-
+ ComponentEntity componentEntity = getComponentEntity(vspId, version, componentId, vspId +
+ "enrichMib_server");
+ setMockToEnrichComponent(vspId, version, componentId);
String componentName = componentEntity.getComponentCompositionData().getName();
String unifiedComponentName =
ToscaNodeType.ABSTRACT_NODE_TYPE_PREFIX + DataModelUtil.getNamespaceSuffix(componentName);
+
ArgumentCaptor<ServiceArtifact> expectedServiceArtifact =
ArgumentCaptor.forClass(ServiceArtifact.class);
+ monitoringMibEnricher.enrichComponent(vspId, version, componentEntity,
+ Stream.of(unifiedComponentName).collect(Collectors.toSet()));
+
Mockito.verify(enrichedServiceModelDaoMock, atLeastOnce())
.storeExternalArtifact(expectedServiceArtifact.capture());
Assert.assertEquals(expectedServiceArtifact.getValue().getName()
@@ -98,7 +114,7 @@ public class MonitoringMibEnricherTest {
}
@Test
- public void testEnrich() throws Exception {
+ public void testEnrichmentOfTwoComponentsFromSameType() throws IOException {
EnrichmentInfo enrichmentInfo = new EnrichmentInfo();
Version version = new Version();
version.setMajor(1);
@@ -106,24 +122,43 @@ public class MonitoringMibEnricherTest {
String vspId = "123";
enrichmentInfo.setKey(vspId);
enrichmentInfo.setVersion(version);
- String componentId1 = "1111111111";
- String componentId2 = "2222222222";
+ String componentId1 = "1";
+ String componentId2 = "2";
+ String abstType = "org.openecomp.resource.abstract.nodes.pd_server";
+ String abstType1 = "org.openecomp.resource.abstract.nodes.pd_server_1";
+
+ List<ComponentEntity> returnedComponents = new ArrayList<>();
+ returnedComponents.add(getComponentEntity(vspId, version, componentId1,
+ "pd_server"));
+ returnedComponents.add(getComponentEntity(vspId, version, componentId2,
+ "pd_server"));
+ Mockito.when(componentDaoMock.list(anyObject()))
+ .thenReturn(returnedComponents);
+ setMockToEnrichComponent(vspId, version, componentId1);
+ ToscaServiceModel mockServiceModel =
+ getMockServiceModel("/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType");
- Collection<ComponentEntity> returnedComponents = new ArrayList<>();
- returnedComponents.add(getComponentEntity(vspId, version, componentId1));
- returnedComponents.add(getComponentEntity(vspId, version, componentId2));
+ ArgumentCaptor<ServiceArtifact> expectedServiceArtifact =
+ ArgumentCaptor.forClass(ServiceArtifact.class);
+ monitoringMibEnricher.enrich(enrichmentInfo, mockServiceModel);
- Mockito.when(componentDaoMock.list(anyObject()))
- .thenReturn(returnedComponents);
- setMockToEnrichComponent(vspId, componentId1, version);
+ Mockito.verify(enrichedServiceModelDaoMock, times(24))
+ .storeExternalArtifact(expectedServiceArtifact.capture());
+
+ Set<String> prefixes = getAllMibDirectoryPrefixes(expectedServiceArtifact.getAllValues());
- monitoringMibEnricher.enrich(enrichmentInfo);
- Mockito.verify(enrichedServiceModelDaoMock, times(12)).storeExternalArtifact(anyObject());
+ validateExpectedAbstractTypes(Stream.of(abstType, abstType1).collect(Collectors.toSet()), prefixes);
+ }
+ private void validateExpectedAbstractTypes(Set<String> expectedAbstractTypes,
+ Set<String> prefixes) {
+ for(String abstType : expectedAbstractTypes){
+ Assert.assertTrue(prefixes.contains(abstType));
+ }
}
- private void setMockToEnrichComponent(String vspId, String componentId, Version version) {
+ private void setMockToEnrichComponent(String vspId, Version version, String componentId) {
ComponentMonitoringUploadEntity returnedArtifact = new ComponentMonitoringUploadEntity();
returnedArtifact.setVspId(vspId);
returnedArtifact.setVersion(version);
@@ -137,16 +172,18 @@ public class MonitoringMibEnricherTest {
Mockito.doNothing().when(enrichedServiceModelDaoMock).storeExternalArtifact(anyObject());
}
- private ComponentEntity getComponentEntity(String vspId, Version version, String componentId) {
+ private ComponentEntity getComponentEntity(String vspId,
+ Version version,
+ String componentId,
+ String componentNameSuffix) {
ComponentEntity componentEntity = new ComponentEntity();
componentEntity.setId(componentId);
componentEntity.setVspId(vspId);
componentEntity.setVersion(version);
- String componentName = vspId + "enrichMib_server";
String compositionData = "{\n" +
- " \"name\": \"org.openecomp.resource.vfc.nodes.heat." + componentName + "\",\n" +
- " \"displayName\": \"" + componentName + "\"\n" +
+ " \"name\": \"org.openecomp.resource.vfc.nodes.heat." + componentNameSuffix + "\",\n" +
+ " \"displayName\": \"" + componentNameSuffix + "\"\n" +
"}";
componentEntity.setCompositionData(compositionData);
return componentEntity;
@@ -154,8 +191,42 @@ public class MonitoringMibEnricherTest {
private ByteBuffer getMibByteBuffer(String fileName) {
byte[] mibBytes = FileUtils.readViaInputStream(this.getClass().getResource(fileName),
- stream -> FileUtils.toByteArray(stream));
+ FileUtils::toByteArray);
return ByteBuffer.wrap(mibBytes);
}
+ private ToscaServiceModel getMockServiceModel(String serviceTemplatesDirectory)
+ throws IOException {
+ File directory = new File(this.getClass().getResource(serviceTemplatesDirectory).getFile());
+ ToscaServiceModel serviceModel = new ToscaServiceModel();
+ Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
+
+ for (final File serviceTemplateFile : directory.listFiles()) {
+ byte[] content = FileUtils
+ .readViaInputStream(this.getClass().getResource(serviceTemplatesDirectory + File
+ .separator + serviceTemplateFile.getName()),
+ FileUtils::toByteArray);
+ ServiceTemplate serviceTemplate =
+ new YamlUtil().yamlToObject(new String(content), ServiceTemplate.class);
+ serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), serviceTemplate);
+ }
+
+ serviceModel.setServiceTemplates(serviceTemplates);
+ return serviceModel;
+ }
+
+ private Set<String> getAllMibDirectoryPrefixes(List<ServiceArtifact> serviceArtifacts) {
+ if(CollectionUtils.isEmpty(serviceArtifacts)){
+ return new HashSet<>();
+ }
+
+ Set<String> prefixes = new HashSet<>();
+ for(ServiceArtifact serviceArtifact : serviceArtifacts){
+ String absolutePath = serviceArtifact.getName();
+ prefixes.add(absolutePath.split(Pattern.quote(File.separator))[0]);
+ }
+
+ return prefixes;
+ }
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/MainServiceTemplate.yaml
new file mode 100644
index 0000000000..afd5b4afd0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/MainServiceTemplate.yaml
@@ -0,0 +1,39 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Main
+imports:
+- openecomp_heat_index:
+ file: openecomp-heat/_index.yml
+- GlobalSubstitutionTypes:
+ file: GlobalSubstitutionTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.pd_server:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+topology_template:
+ inputs:
+ pd_flavor_name:
+ type: string
+ description: flavor name of PD instance
+ default: m3.xlarge
+ availabilityzone_name:
+ type: string
+ description: availabilityzone name
+ default: nova
+
+ node_templates:
+ abstract_pd_server_0:
+ type: org.openecomp.resource.abstract.nodes.pd_server
+ directives:
+ - substitutable
+ properties:
+ service_template_filter:
+ substitute_service_template: Nested_pd_serverServiceTemplate.yaml
+ count: 1
+ abstract_pd_server_1:
+ type: org.openecomp.resource.abstract.nodes.pd_server_1
+ directives:
+ - substitutable
+ properties:
+ service_template_filter:
+ substitute_service_template: Nested_pd_1serverServiceTemplate.yaml
+ count: 1
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_1serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_1serverServiceTemplate.yaml
new file mode 100644
index 0000000000..1b8f9636ec
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_1serverServiceTemplate.yaml
@@ -0,0 +1,20 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Nested_pd_1server
+imports:
+- openecomp_heat_index:
+ file: openecomp-heat/_index.yml
+- GlobalSubstitutionTypes:
+ file: GlobalSubstitutionTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vfc.compute.nodes.heat.pd_server:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+topology_template:
+ inputs:
+ index_value:
+ type: integer
+ description: Index value of this substitution service template runtime instance
+ required: false
+ default: 0
+ constraints:
+ - greater_or_equal: 0
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_serverServiceTemplate.yaml
new file mode 100644
index 0000000000..61dae4b1fa
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichMib/toscaModel/twoAbstractNodesFromSameType/Nested_pd_serverServiceTemplate.yaml
@@ -0,0 +1,20 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Nested_pd_server
+imports:
+- openecomp_heat_index:
+ file: openecomp-heat/_index.yml
+- GlobalSubstitutionTypes:
+ file: GlobalSubstitutionTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vfc.compute.nodes.heat.pd_server:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+topology_template:
+ inputs:
+ index_value:
+ type: integer
+ description: Index value of this substitution service template runtime instance
+ required: false
+ default: 0
+ constraints:
+ - greater_or_equal: 0