summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main
diff options
context:
space:
mode:
authorAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
commitb8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch)
treef78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main
parent75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff)
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535 Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main')
-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.java122
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java23
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java2
4 files changed, 112 insertions, 66 deletions
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 3920cc28af..a5d1ac1ba2 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
@@ -21,9 +21,9 @@
package org.openecomp.sdc.enrichment.impl.external.artifact;
import org.openecomp.core.enrichment.types.ArtifactCategory;
-import org.openecomp.core.enrichment.types.ArtifactType;
-import org.openecomp.core.enrichment.types.ComponentMibInfo;
-import org.openecomp.core.enrichment.types.MibInfo;
+import org.openecomp.core.enrichment.types.ComponentMonitoringUploadInfo;
+import org.openecomp.core.enrichment.types.MonitoringArtifactInfo;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.core.model.dao.EnrichedServiceModelDao;
import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory;
import org.openecomp.core.model.types.ServiceArtifact;
@@ -35,12 +35,12 @@ 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.vendorsoftwareproduct.dao.MibDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.File;
@@ -56,7 +56,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
private EnrichedServiceModelDao enrichedServiceModelDao;
private ComponentDao componentDao;
- private MibDao mibDao;
+ private ComponentArtifactDao componentArtifactDao;
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
/**
@@ -86,65 +86,77 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
mdcDataDebugMessage.debugEntryMessage(null, null);
Map<String, List<ErrorMessage>> errors = new HashMap<>();
- ComponentMibInfo componentMibInfo =
+ ComponentMonitoringUploadInfo componentMonitoringUploadInfo =
extractComponentMibInfo(componentEntry, vspId, version, errors);
- enrichComponentMib(componentMibInfo, vspId, version, errors);
+ enrichComponentMib(componentMonitoringUploadInfo, vspId, version, errors);
mdcDataDebugMessage.debugExitMessage(null, null);
return errors;
}
- ComponentMibInfo extractComponentMibInfo(ComponentEntity componentEntity, String vspId,
- Version version,
- Map<String, List<ErrorMessage>> errors) {
+ private ComponentMonitoringUploadInfo extractComponentMibInfo(ComponentEntity componentEntity,
+ String vspId,
+ Version version,
+ Map<String, List<ErrorMessage>> errors) {
mdcDataDebugMessage.debugEntryMessage(null, null);
String componentId = componentEntity.getId();
- MibEntity entity = new MibEntity();
+ ComponentMonitoringUploadEntity entity = new ComponentMonitoringUploadEntity();
entity.setVspId(vspId);
entity.setVersion(version);
entity.setComponentId(componentId);
String componentName = componentEntity.getComponentCompositionData().getName();
- ComponentMibInfo componentMibInfo = new ComponentMibInfo();
- updComponentMibInfoByType(componentName, ArtifactType.SNMP_POLL, entity, componentMibInfo,
- errors);
- updComponentMibInfoByType(componentName, ArtifactType.SNMP_TRAP, entity, componentMibInfo,
- errors);
+ 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 componentMibInfo;
+ return componentMonitoringUploadInfo;
}
- void updComponentMibInfoByType(String componentName, ArtifactType type,
- MibEntity mibEntity,
- ComponentMibInfo componentMibInfo,
- Map<String, List<ErrorMessage>> errors) {
+ private void updComponentMibInfoByType(String componentName, MonitoringUploadType type,
+ ComponentMonitoringUploadEntity componentMonitoringUploadEntity,
+ ComponentMonitoringUploadInfo componentMonitoringUploadInfo,
+ Map<String, List<ErrorMessage>> errors) {
mdcDataDebugMessage.debugEntryMessage(null, null);
String path;
- mibEntity.setType(type);
- Optional<MibEntity> artifact =
- getMibDao().getByType(mibEntity);
+ componentMonitoringUploadEntity.setType(type);
+ Optional<ComponentMonitoringUploadEntity> artifact =
+ getComponentArtifactDao().getByType(componentMonitoringUploadEntity);
if (!artifact.isPresent()) {
return;
}
path = componentName + File.separator + ArtifactCategory.DEPLOYMENT.getDisplayName()
+ File.separator + type.name();
- MibInfo mibInfo = new MibInfo();
- mibInfo.setName(path);
- mibInfo.setContent(artifact.get().getArtifact().array());
- switch (type) {
+ MonitoringArtifactInfo monitoringArtifactInfo = new MonitoringArtifactInfo();
+ monitoringArtifactInfo.setName(path);
+ monitoringArtifactInfo.setContent(artifact.get().getArtifact().array());
+ switch (type) { //todo as part of ATTASDC-4503
case SNMP_POLL:
- componentMibInfo.setSnmpPoll(mibInfo);
+ componentMonitoringUploadInfo.setSnmpPoll(monitoringArtifactInfo);
break;
case SNMP_TRAP:
- componentMibInfo.setSnmpTrap(mibInfo);
+ componentMonitoringUploadInfo.setSnmpTrap(monitoringArtifactInfo);
+ break;
+ case VES_EVENTS:
+ componentMonitoringUploadInfo.setVesEvent(monitoringArtifactInfo);
break;
default:
break;
@@ -153,8 +165,10 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
mdcDataDebugMessage.debugExitMessage(null, null);
}
- void enrichComponentMib(ComponentMibInfo componentMibInfo, String vspId, Version version,
- Map<String, List<ErrorMessage>> errors) {
+ private void enrichComponentMib(ComponentMonitoringUploadInfo componentMonitoringUploadInfo,
+ String vspId,
+ Version version,
+ Map<String, List<ErrorMessage>> errors) {
mdcDataDebugMessage.debugEntryMessage(null, null);
@@ -162,40 +176,50 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
ServiceArtifact mibServiceArtifact = new ServiceArtifact();
mibServiceArtifact.setVspId(vspId);
mibServiceArtifact.setVersion(version);
- enrichMibFiles(mibServiceArtifact, componentMibInfo, errors);
+ enrichMibFiles(mibServiceArtifact, componentMonitoringUploadInfo, errors);
mdcDataDebugMessage.debugExitMessage(null, null);
}
- void enrichMibFiles(ServiceArtifact mibServiceArtifact, ComponentMibInfo componentMibInfo,
- Map<String, List<ErrorMessage>> errors) {
+ private void enrichMibFiles(ServiceArtifact monitoringArtifact,
+ ComponentMonitoringUploadInfo componentMonitoringUploadInfo,
+ Map<String, List<ErrorMessage>> errors) {
mdcDataDebugMessage.debugEntryMessage(null, null);
- if (componentMibInfo == null) {
+ if (componentMonitoringUploadInfo == null) {
return;
}
- enrichMibByType(componentMibInfo.getSnmpTrap(), ArtifactType.SNMP_TRAP, mibServiceArtifact,
+ //todo fix as part of ATTASDC-4503
+ enrichMibByType(componentMonitoringUploadInfo.getSnmpTrap(), MonitoringUploadType.SNMP_TRAP,
+ monitoringArtifact,
+ errors);
+ enrichMibByType(componentMonitoringUploadInfo.getSnmpPoll(), MonitoringUploadType.SNMP_POLL,
+ monitoringArtifact,
errors);
- enrichMibByType(componentMibInfo.getSnmpPoll(), ArtifactType.SNMP_POLL, mibServiceArtifact,
+ enrichMibByType(componentMonitoringUploadInfo.getVesEvent(), MonitoringUploadType.VES_EVENTS,
+ monitoringArtifact,
errors);
mdcDataDebugMessage.debugExitMessage(null, null);
}
- void enrichMibByType(MibInfo mibInfo, ArtifactType type, ServiceArtifact mibServiceArtifact,
- Map<String, List<ErrorMessage>> errors) {
+ private void enrichMibByType(MonitoringArtifactInfo monitoringArtifactInfo,
+ MonitoringUploadType type,
+ ServiceArtifact mibServiceArtifact,
+ Map<String, List<ErrorMessage>> errors) {
mdcDataDebugMessage.debugEntryMessage(null, null);
- if (mibInfo == null) {
+ if (monitoringArtifactInfo == null) {
return;
}
FileContentHandler mibs;
try {
- mibs = FileUtils.getFileContentMapFromZip(FileUtils.toByteArray(mibInfo.getContent()));
+ mibs = FileUtils
+ .getFileContentMapFromZip(FileUtils.toByteArray(monitoringArtifactInfo.getContent()));
} catch (IOException ioException) {
ErrorMessage.ErrorMessageUtil
.addMessage(mibServiceArtifact.getName() + "." + type.name(), errors)
@@ -205,7 +229,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
Set<String> fileList = mibs.getFileList();
for (String fileName : fileList) {
mibServiceArtifact.setContentData(FileUtils.toByteArray(mibs.getFileContent(fileName)));
- mibServiceArtifact.setName(mibInfo.getName() + File.separator + fileName);
+ mibServiceArtifact.setName(monitoringArtifactInfo.getName() + File.separator + fileName);
getEnrichedServiceModelDao().storeExternalArtifact(mibServiceArtifact);
}
@@ -226,11 +250,11 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface
return componentDao;
}
- private MibDao getMibDao() {
- if (mibDao == null) {
- mibDao = MibDaoFactory.getInstance().createInterface();
+ private ComponentArtifactDao getComponentArtifactDao() {
+ if (componentArtifactDao == null) {
+ componentArtifactDao = MonitoringUploadDaoFactory.getInstance().createInterface();
}
- return mibDao;
+ return componentArtifactDao;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java
index 93c4e67fc9..32df165eb3 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java
@@ -1,17 +1,5 @@
package org.openecomp.sdc.enrichment.impl.tosca;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AVAIL_MODE;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VM_TYPE_TAG;
-import static org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType.NATIVE_NODE;
-import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.VFC_ABSTRACT_SUBSTITUTE;
-import static org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType.NATIVE_DEPENDS_ON;
-import static org.openecomp.sdc.tosca.services.ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME;
-import static org.openecomp.sdc.translator.services.heattotosca.Constants.ABSTRACT_NODE_TEMPLATE_ID_PREFIX;
-
import org.apache.commons.lang3.StringUtils;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
@@ -29,6 +17,20 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AVAIL_MODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_CODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_FUNCTION;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VM_TYPE_TAG;
+import static org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType.NATIVE_NODE;
+import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.VFC_ABSTRACT_SUBSTITUTE;
+import static org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType.NATIVE_DEPENDS_ON;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME;
+import static org.openecomp.sdc.translator.services.heattotosca.Constants.ABSTRACT_NODE_TEMPLATE_ID_PREFIX;
+
public class AbstractSubstituteToscaEnricher {
private ToscaAnalyzerService toscaAnalyzerService ;
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
@@ -108,6 +110,11 @@ public class AbstractSubstituteToscaEnricher {
setProperty(nodeTemplate, VFC_NAMING_CODE, getValueFromQuestionnaireDetails
(componentProperties, componentDisplayName, VFC_NAMING_CODE));
+ setProperty(nodeTemplate, VFC_CODE, getValueFromQuestionnaireDetails
+ (componentProperties, componentDisplayName, VFC_CODE));
+
+ setProperty(nodeTemplate, VFC_FUNCTION, getValueFromQuestionnaireDetails
+ (componentProperties, componentDisplayName, VFC_FUNCTION));
if(componentProperties.get(componentDisplayName).get(MIN_INSTANCES) != null) {
nodeTemplate.getProperties().put(MIN_INSTANCES,
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
index 7457c36701..f49c53d79b 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
@@ -1,12 +1,8 @@
package org.openecomp.sdc.enrichment.impl.tosca;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AVAIL_MODE;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE;
import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
@@ -23,6 +19,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AVAIL_MODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE;
+
+
+
public class ComponentQuestionnaireData {
ComponentDao componentDao = ComponentDaoFactory.getInstance().createInterface();
@@ -64,6 +68,15 @@ public class ComponentQuestionnaireData {
String vfc_code = componentData != null ? componentData.getVfcCode() : null;
questionnaireParams.put(VFC_NAMING_CODE, vfc_code);
+ String nfcCode = componentData.getNfcCode() != null ? componentData.getNfcCode() : null;
+ questionnaireParams.put(EnrichmentConstants.VFC_CODE, nfcCode);
+
+ String vfcDescription =
+ componentData.getNfcFunction() != null ? componentData.getNfcFunction() :
+ null;
+ questionnaireParams.put(EnrichmentConstants.VFC_FUNCTION, vfcDescription);
+
+
if (componentQuestionnaire.getHighAvailabilityAndLoadBalancing() != null ) {
String mandatory = componentQuestionnaire.getHighAvailabilityAndLoadBalancing()
.getIsComponentMandatory();
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java
index e803d14b35..036d64014a 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java
@@ -8,5 +8,7 @@ public class EnrichmentConstants {
public static final String MIN_INSTANCES = "min_instances";
public static final String MAX_INSTANCES = "max_instances";
public static final String VM_TYPE_TAG = "vm_type_tag";
+ public static final String VFC_CODE = "nfc_code";
+ public static final String VFC_FUNCTION = "nfc_function";
}