From b8e2faf476202b6ffe61bc3a9a37df1304881d40 Mon Sep 17 00:00:00 2001 From: Avi Ziv Date: Tue, 18 Jul 2017 19:45:38 +0300 Subject: [SDC] Onboarding 1710 rebase. Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535 Signed-off-by: Avi Ziv --- .../pom.xml.versionsBackup | 45 ++++++++ .../core/enrichment/types/ArtifactType.java | 30 ----- .../core/enrichment/types/ComponentMibInfo.java | 45 -------- .../types/ComponentMonitoringUploadInfo.java | 60 ++++++++++ .../openecomp/core/enrichment/types/MibInfo.java | 45 -------- .../enrichment/types/MonitoringArtifactInfo.java | 45 ++++++++ .../enrichment/types/MonitoringUploadType.java | 29 +++++ .../openecomp-sdc-enrichment-core/pom.xml | 5 + .../pom.xml.versionsBackup | 94 +++++++++++++++ .../enrichment/impl/EnrichmentManagerImplTest.java | 2 +- .../openecomp-sdc-enrichment-impl/pom.xml | 6 + .../pom.xml.versionsBackup | 127 +++++++++++++++++++++ .../external/artifact/MonitoringMibEnricher.java | 122 ++++++++++++-------- .../tosca/AbstractSubstituteToscaEnricher.java | 31 +++-- .../impl/tosca/ComponentQuestionnaireData.java | 23 +++- .../enrichment/impl/util/EnrichmentConstants.java | 2 + .../artifact/MonitoringMibEnricherTest.java | 18 +-- .../tosca/AbstractSubstituteToscaEnricherTest.java | 24 ++-- .../impl/tosca/BaseToscaEnrichmentTest.java | 2 +- .../impl/tosca/ComponentQuestionnaireDataTest.java | 28 +++-- .../src/test/resources/logback.xml | 13 +++ .../mock/enrichHA/out/MainServiceTemplate.yaml | 2 + .../out/MainServiceTemplate.yaml | 2 + .../pom.xml.versionsBackup | 44 +++++++ 24 files changed, 628 insertions(+), 216 deletions(-) create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ArtifactType.java delete mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMibInfo.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java delete mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MibInfo.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringArtifactInfo.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringUploadType.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/logback.xml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib') diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup new file mode 100644 index 0000000000..493e4256a3 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup @@ -0,0 +1,45 @@ + + 4.0.0 + + openecomp-sdc-enrichment-api + openecomp-sdc-enrichment-api + + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0-SNAPSHOT + ../.. + + + + + org.openecomp.core + openecomp-facade-core + ${project.version} + + + io.swagger + swagger-annotations + 1.5.3 + + + org.openecomp.sdc + openecomp-sdc-datatypes-lib + 1.0-SNAPSHOT + + + ch.qos.logback + logback-classic + ${logback.version} + + + org.openecomp.sdc + openecomp-sdc-versioning-api + 1.0-SNAPSHOT + + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ArtifactType.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ArtifactType.java deleted file mode 100644 index 48805d7ca5..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ArtifactType.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.core.enrichment.types; - -public enum ArtifactType { - SNMP_POLL, - SNMP_TRAP; - - -} - - diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMibInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMibInfo.java deleted file mode 100644 index 88dbedc136..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMibInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.core.enrichment.types; - -public class ComponentMibInfo { - private MibInfo snmpTrap; - private MibInfo snmpPoll; - - - public MibInfo getSnmpTrap() { - return snmpTrap; - } - - public void setSnmpTrap(MibInfo snmpTrap) { - this.snmpTrap = snmpTrap; - } - - public MibInfo getSnmpPoll() { - return snmpPoll; - } - - public void setSnmpPoll(MibInfo snmpPoll) { - this.snmpPoll = snmpPoll; - } - - -} 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 new file mode 100644 index 0000000000..a3a76a561b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.core.enrichment.types; + +import java.util.HashMap; +import java.util.Map; + +import static org.openecomp.core.enrichment.types.MonitoringUploadType.SNMP_POLL; +import static org.openecomp.core.enrichment.types.MonitoringUploadType.SNMP_TRAP; +import static org.openecomp.core.enrichment.types.MonitoringUploadType.VES_EVENTS; + +public class ComponentMonitoringUploadInfo { + + + private Map 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); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MibInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MibInfo.java deleted file mode 100644 index f5d2fcb90d..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MibInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.core.enrichment.types; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -public class MibInfo { - private String name; - private byte[] content; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public InputStream getContent() { - return new ByteArrayInputStream(this.content); - } - - public void setContent(byte[] content) { - this.content = content; - } -} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringArtifactInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringArtifactInfo.java new file mode 100644 index 0000000000..27a0d83069 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringArtifactInfo.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.core.enrichment.types; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +public class MonitoringArtifactInfo { + private String name; + private byte[] content; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public InputStream getContent() { + return new ByteArrayInputStream(this.content); + } + + public void setContent(byte[] content) { + this.content = content; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringUploadType.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringUploadType.java new file mode 100644 index 0000000000..077480f95f --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MonitoringUploadType.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.core.enrichment.types; + +public enum MonitoringUploadType { + SNMP_POLL, + SNMP_TRAP, + VES_EVENTS +} + + diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml index ab0cafb879..9fe0f49387 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml @@ -19,6 +19,11 @@ logback-classic ${logback.version} + + org.openecomp.sdc.common + openecomp-tosca-datatype + ${openecomp.sdc.common.version} + org.testng testng diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup new file mode 100644 index 0000000000..d8f63f10e9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup @@ -0,0 +1,94 @@ + + 4.0.0 + + openecomp-sdc-enrichment-core + openecomp-sdc-enrichment-core + + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0-SNAPSHOT + ../.. + + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + org.testng + testng + test + 6.8.5 + + + snakeyaml + org.yaml + + + + + junit + junit + RELEASE + test + + + org.openecomp.core + openecomp-utilities-lib + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-enrichment-api + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-enrichment-impl + ${project.version} + + + + org.openecomp.sdc + openecomp-sdc-datatypes-lib + ${project.version} + + + org.mockito + mockito-all + test + 1.10.19 + + + org.openecomp.sdc + openecomp-sdc-model-impl + 1.0-SNAPSHOT + test + + + org.openecomp.core + openecomp-tosca-lib + 1.0-SNAPSHOT + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + false + true + + + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java index dfdbaef896..293e4dec2a 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java @@ -29,7 +29,7 @@ import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.ToscaFileOutputService; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; -import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil; +import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; import org.openecomp.sdc.versioning.dao.types.Version; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml index b5014fd4b1..cfc824bc5e 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml @@ -19,6 +19,12 @@ logback-classic ${logback.version} + + org.openecomp.sdc.common + openecomp-tosca-datatype + ${openecomp.sdc.common.version} + + org.testng testng diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup new file mode 100644 index 0000000000..65e84d88dc --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup @@ -0,0 +1,127 @@ + + 4.0.0 + + openecomp-sdc-enrichment-impl + openecomp-sdc-enrichment-impl + + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0-SNAPSHOT + ../.. + + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + + org.testng + testng + test + 6.8.5 + + + snakeyaml + org.yaml + + + + + junit + junit + RELEASE + test + + + org.openecomp.core + openecomp-utilities-lib + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-enrichment-api + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-model-core + ${project.version} + + + org.openecomp.core + openecomp-common-lib + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-core + ${project.version} + + + org.mockito + mockito-all + test + 1.10.19 + + + org.openecomp.core + openecomp-heat-lib + ${project.version} + + + org.openecomp.core + openecomp-tosca-lib + 1.0-SNAPSHOT + + + org.openecomp.sdc + openecomp-sdc-translator-core + 1.0-SNAPSHOT + + + org.openecomp.core + openecomp-config-lib + 1.0-SNAPSHOT + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-api + 1.0-SNAPSHOT + + + runtime + org.openecomp.sdc + openecomp-sdc-vendor-software-product-core + 1.0-SNAPSHOT + + + test + org.openecomp.sdc + openecomp-sdc-model-impl + 1.0-SNAPSHOT + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + false + true + + + + + + \ No newline at end of file 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> 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> errors) { + private ComponentMonitoringUploadInfo extractComponentMibInfo(ComponentEntity componentEntity, + String vspId, + Version version, + Map> 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> errors) { + private void updComponentMibInfoByType(String componentName, MonitoringUploadType type, + ComponentMonitoringUploadEntity componentMonitoringUploadEntity, + ComponentMonitoringUploadInfo componentMonitoringUploadInfo, + Map> errors) { mdcDataDebugMessage.debugEntryMessage(null, null); String path; - mibEntity.setType(type); - Optional artifact = - getMibDao().getByType(mibEntity); + componentMonitoringUploadEntity.setType(type); + Optional 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> errors) { + private void enrichComponentMib(ComponentMonitoringUploadInfo componentMonitoringUploadInfo, + String vspId, + Version version, + Map> 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> errors) { + private void enrichMibFiles(ServiceArtifact monitoringArtifact, + ComponentMonitoringUploadInfo componentMonitoringUploadInfo, + Map> 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> errors) { + private void enrichMibByType(MonitoringArtifactInfo monitoringArtifactInfo, + MonitoringUploadType type, + ServiceArtifact mibServiceArtifact, + Map> 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 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"; } 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 7a16b6945d..38f7a1c56e 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 @@ -26,16 +26,16 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.core.enrichment.types.ArtifactCategory; -import org.openecomp.core.enrichment.types.ArtifactType; +import org.openecomp.core.enrichment.types.MonitoringUploadType; import org.openecomp.core.model.dao.EnrichedServiceModelDao; import org.openecomp.core.model.types.ServiceArtifact; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.enrichment.EnrichmentInfo; -import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity; 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 org.testng.Assert; import org.testng.annotations.BeforeMethod; @@ -60,7 +60,7 @@ import static org.mockito.Mockito.times; public class MonitoringMibEnricherTest { @Mock - private MibDao mibDaoMock; + private ComponentArtifactDao componentArtifactDaoMock; @Mock private EnrichedServiceModelDao enrichedServiceModelDaoMock; @Mock @@ -99,7 +99,7 @@ public class MonitoringMibEnricherTest { .assertEquals(expectedServiceArtifact.getValue().getName().startsWith(componentName), true); Assert.assertEquals(expectedServiceArtifact.getValue().getName(), componentName + File.separator + ArtifactCategory.DEPLOYMENT.getDisplayName() + - File.separator + ArtifactType.SNMP_POLL + File.separator + "mib1.yml"); + File.separator + MonitoringUploadType.VES_EVENTS + File.separator + "mib1.yml"); } @@ -125,20 +125,20 @@ public class MonitoringMibEnricherTest { setMockToEnrichComponent(vspId, componentId1, version); monitoringMibEnricher.enrich(enrichmentInfo); - Mockito.verify(enrichedServiceModelDaoMock, times(8)).storeExternalArtifact(anyObject()); + Mockito.verify(enrichedServiceModelDaoMock, times(12)).storeExternalArtifact(anyObject()); } private void setMockToEnrichComponent(String vspId, String componentId, Version version) { - MibEntity returnedArtifact = new MibEntity(); + ComponentMonitoringUploadEntity returnedArtifact = new ComponentMonitoringUploadEntity(); returnedArtifact.setVspId(vspId); returnedArtifact.setVersion(version); returnedArtifact.setComponentId(componentId); - returnedArtifact.setType(ArtifactType.SNMP_POLL); + returnedArtifact.setType(MonitoringUploadType.SNMP_POLL); returnedArtifact.setArtifactName("mib.zip"); returnedArtifact.setArtifact(getMibByteBuffer("/mock/enrichMib/MIB.zip")); - Mockito.when(mibDaoMock.getByType(anyObject())) + Mockito.when(componentArtifactDaoMock.getByType(anyObject())) .thenReturn(Optional.of(returnedArtifact)); Mockito.doNothing().when(enrichedServiceModelDaoMock).storeExternalArtifact(anyObject()); } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java index ae1b613f75..ca116a9ae3 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java @@ -1,13 +1,6 @@ package org.openecomp.sdc.enrichment.impl.tosca; -import static org.mockito.Mockito.when; -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.apache.commons.collections.map.HashedMap; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -24,6 +17,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static org.mockito.Mockito.when; +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; + public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest { @Mock @@ -51,11 +53,13 @@ public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest loadToscaServiceModel("/mock/enrichHA/in/", "/mock/toscaGlobalServiceTemplates/", "MainServiceTemplate.yaml"); - Map> componentTypetoParams = new HashMap(); - Map innerProps = new HashedMap(); + Map> componentTypetoParams = new HashMap<>(); + Map innerProps = new HashMap<>(); innerProps.put(MANDATORY, "YES"); innerProps.put(HIGH_AVAIL_MODE, "geo-activestandby"); innerProps.put(VFC_NAMING_CODE, "Code1"); + innerProps.put(VFC_CODE, "pd_server_code"); + innerProps.put(VFC_FUNCTION, "pd_server_description"); innerProps.put(MIN_INSTANCES, 1); innerProps.put(MAX_INSTANCES, 2); @@ -96,6 +100,8 @@ public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest innerProps.put(MANDATORY, "NO"); innerProps.put(HIGH_AVAIL_MODE, ""); innerProps.put(VFC_NAMING_CODE, "pd_server_code1"); + innerProps.put(VFC_CODE, "pd_server_code"); + innerProps.put(VFC_FUNCTION, "pd_server_description"); innerProps.put(MIN_INSTANCES, null); innerProps.put(MAX_INSTANCES, null); diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java index 366bd82eab..4196168b2c 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java @@ -26,7 +26,7 @@ import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.ToscaFileOutputService; import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; -import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil; +import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; import java.io.*; import java.net.URL; diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java index d281604227..d825504d81 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java @@ -1,12 +1,5 @@ package org.openecomp.sdc.enrichment.impl.tosca; -import static org.mockito.Mockito.doReturn; -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.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -14,7 +7,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; -import org.openecomp.sdc.versioning.VersioningManager; import org.openecomp.sdc.versioning.dao.types.Version; import org.testng.Assert; import org.testng.annotations.BeforeMethod; @@ -25,6 +17,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static org.mockito.Mockito.doReturn; +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; + public class ComponentQuestionnaireDataTest { private static String VSP_ID = "vspId"; public static final Version VERSION01 = new Version(0, 1); @@ -47,8 +48,13 @@ public class ComponentQuestionnaireDataTest { @Test public void testGetData() { ComponentEntity componentEntity = new ComponentEntity(VSP_ID, VERSION01,"ID1" ); - componentEntity.setCompositionData("{\"name\": \"org.openecomp.resource.vfc.nodes.heat.be\"," + - "\"displayName\": \"be\", \"vfcCode\": \"be_1\"}"); + componentEntity.setCompositionData("{\n" + + " \"name\": \"org.openecomp.resource.vfc.nodes.heat.be\",\n" + + " \"displayName\": \"be\",\n" + + " \"vfcCode\": \"be_1\",\n" + + " \"nfcCode\": \"code\",\n" + + " \"nfcFunction\": \"desc\"\n" + + "}"); componentEntity.setQuestionnaireData ("{\"highAvailabilityAndLoadBalancing\":{\"isComponentMandatory\" : \"NO\"," + "\"highAvailabilityMode\":\"geo-activeactive\"},\"compute\":{\"numOfVMs\" " + @@ -64,6 +70,8 @@ public class ComponentQuestionnaireDataTest { final Map be = propertiesfromCompQuestionnaire.get("be"); Assert.assertEquals(be.get(VFC_NAMING_CODE) , "be_1"); + Assert.assertEquals(be.get(VFC_CODE), "code"); + Assert.assertEquals(be.get(VFC_FUNCTION), "desc"); Assert.assertEquals(be.get(MANDATORY) ,"NO"); Assert.assertEquals(be.get(HIGH_AVAIL_MODE) ,"geo-activeactive"); Assert.assertEquals(be.get(MIN_INSTANCES) ,null); diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/logback.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/logback.xml new file mode 100644 index 0000000000..31672ca4d9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + + + + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHA/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHA/out/MainServiceTemplate.yaml index 0570cebdc2..18fb820678 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHA/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHA/out/MainServiceTemplate.yaml @@ -471,6 +471,8 @@ topology_template: vm_type_tag: pd_server high_availablity: geo-activestandby nfc_naming_code: Code1 + nfc_code: pd_server_code + nfc_function: pd_server_description min_instances: 1 max_instances: 2 groups: diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHANoServiceTemplateFilter/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHANoServiceTemplateFilter/out/MainServiceTemplate.yaml index 3d8cacd11e..9c23c1036c 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHANoServiceTemplateFilter/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichHANoServiceTemplateFilter/out/MainServiceTemplate.yaml @@ -468,6 +468,8 @@ topology_template: service_template_filter: mandatory: false nfc_naming_code: pd_server_code1 + nfc_code: pd_server_code + nfc_function: pd_server_description groups: hot-mog-0108-bs1271_group: type: org.openecomp.groups.heat.HeatStack diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup new file mode 100644 index 0000000000..b6e0173b77 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup @@ -0,0 +1,44 @@ + + 4.0.0 + + openecomp-sdc-enrichment-lib + openecomp-sdc-enrichment-lib + + pom + + openecomp-sdc-lib + org.openecomp.sdc + 1.0-SNAPSHOT + + + + openecomp-sdc-enrichment-api + openecomp-sdc-enrichment-core + openecomp-sdc-enrichment-impl + + + + + org.openecomp.sdc + openecomp-sdc-enrichment-api + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-enrichment-core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-core + ${project.version} + + + + \ No newline at end of file -- cgit 1.2.3-korg