From f5f13c4f6b6fe3b4d98e349dfd7db59339803436 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 19 Feb 2017 12:35:04 +0200 Subject: push addional code Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74 Signed-off-by: Michael Lando --- .../openecomp-sdc-enrichment-api/pom.xml | 46 ++ .../EnrichmentArtifactsServiceFactory.java | 33 ++ .../core/enrichment/EnrichmentConstants.java | 29 ++ .../core/enrichment/api/EnrichmentManager.java | 43 ++ .../EnrichmentArtifactsService.java | 29 ++ .../factory/EnrichmentManagerFactory.java | 32 ++ .../core/enrichment/types/CeilometerInfo.java | 71 +++ .../enrichment/types/ComponentArtifactType.java | 34 ++ .../enrichment/types/ComponentCeilometerInfo.java | 36 ++ .../core/enrichment/types/ComponentMibInfo.java | 45 ++ .../core/enrichment/types/EntityInfo.java | 27 + .../openecomp/core/enrichment/types/MibInfo.java | 45 ++ .../src/main/resources/factoryConfiguration.json | 4 + .../openecomp-sdc-enrichment-core/pom.xml | 90 ++++ .../EnrichmentArtifactsServiceFactoryImpl.java | 34 ++ .../EnrichmentArtifactsServiceImpl.java | 61 +++ .../impl/EnrichmentManagerFactoryImpl.java | 34 ++ .../sdc/enrichment/impl/EnrichmentManagerImpl.java | 84 ++++ .../enrichment/impl/EnrichmentManagerImplTest.java | 245 +++++++++ .../all/OnlyComponentsST.yaml | 350 +++++++++++++ .../all/OnlyComponentsST_01.yaml | 350 +++++++++++++ .../extractServiceComposition/all/VariouseST.yaml | 363 ++++++++++++++ .../all/expectedOutput/OnlyComponentsST.yaml | 550 +++++++++++++++++++++ .../all/expectedOutput/OnlyComponentsST_01.yaml | 550 +++++++++++++++++++++ .../all/expectedOutput/VariouseST.yaml | 363 ++++++++++++++ .../onlyComponents/OnlyComponentsST.yaml | 350 +++++++++++++ .../onlyComponents/OnlyComponentsST_01.yaml | 350 +++++++++++++ .../expectedOutput/OnlyComponentsST.yaml | 550 +++++++++++++++++++++ .../expectedOutput/OnlyComponentsST_01.yaml | 550 +++++++++++++++++++++ ...stractSubstituteGlobalTypesServiceTemplate.yaml | 47 ++ .../CinderVolumeGlobalTypesServiceTemplate.yaml | 176 +++++++ .../CommonGlobalTypesServiceTemplate.yaml | 213 ++++++++ ...ntrailNetworkRuleGlobalTypeServiceTemplate.yaml | 117 +++++ ...ailVirtualNetworkGlobalTypeServiceTemplate.yaml | 71 +++ .../GlobalSubstitutionTypesServiceTemplate.yaml | 93 ++++ .../NativeTypesServiceTemplateServiceTemplate.yaml | 194 ++++++++ .../NeutronNetGlobalTypesServiceTemplate.yaml | 97 ++++ .../NeutronPortGlobalTypesServiceTemplate.yaml | 151 ++++++ ...ronSecurityRulesGlobalTypesServiceTemplate.yaml | 116 +++++ .../NovaServerGlobalTypesServiceTemplate.yaml | 249 ++++++++++ .../openecomp-sdc-enrichment-impl/pom.xml | 102 ++++ .../openecomp/sdc/enrichment/EnrichmentInfo.java | 63 +++ .../enrichment/factory/EnricherHandlerFactory.java | 32 ++ .../impl/EnricherHandlerFactoryImpl.java | 33 ++ .../sdc/enrichment/impl/EnricherHandlerImpl.java | 89 ++++ .../artifact/ExternalArtifactEnricher.java | 106 ++++ .../enrichment/impl/tosca/CeilometerEnricher.java | 112 +++++ .../sdc/enrichment/impl/tosca/ComponentInfo.java | 47 ++ .../sdc/enrichment/impl/tosca/SnmpEnricher.java | 38 ++ .../sdc/enrichment/impl/tosca/ToscaEnricher.java | 73 +++ .../openecomp/sdc/enrichment/inter/Enricher.java | 45 ++ .../sdc/enrichment/inter/EnricherHandler.java | 41 ++ .../src/main/resources/factoryConfiguration.json | 3 + .../lib/openecomp-sdc-enrichment-lib/pom.xml | 41 ++ 54 files changed, 7697 insertions(+) create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/EnrichmentArtifactsServiceFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/EnrichmentConstants.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/api/EnrichmentManager.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/enrichmentartifacts/EnrichmentArtifactsService.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/factory/EnrichmentManagerFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/CeilometerInfo.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentArtifactType.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentCeilometerInfo.java create 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/EntityInfo.java create 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/resources/factoryConfiguration.json create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/EnrichmentArtifactsServiceFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/enrichmentartifacts/EnrichmentArtifactsServiceImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST_01.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/VariouseST.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST_01.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/VariouseST.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST_01.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST_01.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/EnrichmentInfo.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/factory/EnricherHandlerFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/CeilometerEnricher.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentInfo.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/SnmpEnricher.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/EnricherHandler.java create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/resources/factoryConfiguration.json create mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml (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 b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml new file mode 100644 index 0000000000..a2038a212e --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + + + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0.0-SNAPSHOT + ../.. + + + openecomp-sdc-enrichment-api + openecomp-sdc-enrichment-api + + + + + org.openecomp.core + openecomp-facade-core + ${project.version} + + + io.swagger + swagger-annotations + 1.5.3 + + + org.openecomp.sdc + openecomp-sdc-datatypes-lib + ${project.version} + + + ch.qos.logback + logback-classic + 1.1.2 + + + org.openecomp.sdc + openecomp-sdc-versioning-api + ${project.version} + + + + \ 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/EnrichmentArtifactsServiceFactory.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/EnrichmentArtifactsServiceFactory.java new file mode 100644 index 0000000000..63daa03f15 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/EnrichmentArtifactsServiceFactory.java @@ -0,0 +1,33 @@ +/*- + * ============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; + +import org.openecomp.core.enrichment.enrichmentartifacts.EnrichmentArtifactsService; +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class EnrichmentArtifactsServiceFactory + extends AbstractComponentFactory { + + public static EnrichmentArtifactsServiceFactory getInstance() { + return AbstractFactory.getInstance(EnrichmentArtifactsServiceFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/EnrichmentConstants.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/EnrichmentConstants.java new file mode 100644 index 0000000000..c3726aa4e9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/EnrichmentConstants.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; + +import java.io.File; + +public final class EnrichmentConstants { + public static final String EXTERNAL_ARTIFACTS_DIR = + "Artifacts" + File.separator + "ExternalArtifacts"; + //public static final String HEAT_META_FILNAME = "HEAT.meta"; +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/api/EnrichmentManager.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/api/EnrichmentManager.java new file mode 100644 index 0000000000..2ddde6001b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/api/EnrichmentManager.java @@ -0,0 +1,43 @@ +/*- + * ============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.api; + +import org.openecomp.core.enrichment.types.EntityInfo; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.List; +import java.util.Map; + +public interface EnrichmentManager { + + + Map> enrich(); + + void addEntityInput(String type, EntityInfo info); + + void initInput(String key, Version version); + + void addModel(T model); + + T getModel(); + +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/enrichmentartifacts/EnrichmentArtifactsService.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/enrichmentartifacts/EnrichmentArtifactsService.java new file mode 100644 index 0000000000..0eab0a916c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/enrichmentartifacts/EnrichmentArtifactsService.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.enrichmentartifacts; + +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.sdc.versioning.dao.types.Version; + +public interface EnrichmentArtifactsService { + + FileContentHandler addMibs(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/factory/EnrichmentManagerFactory.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/factory/EnrichmentManagerFactory.java new file mode 100644 index 0000000000..9199aeff6c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/factory/EnrichmentManagerFactory.java @@ -0,0 +1,32 @@ +/*- + * ============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.factory; + +import org.openecomp.core.enrichment.api.EnrichmentManager; +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class EnrichmentManagerFactory extends AbstractComponentFactory { + + public static EnrichmentManagerFactory getInstance() { + return AbstractFactory.getInstance(EnrichmentManagerFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/CeilometerInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/CeilometerInfo.java new file mode 100644 index 0000000000..71c1ff5cec --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/CeilometerInfo.java @@ -0,0 +1,71 @@ +/*- + * ============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 CeilometerInfo { + + private String name; + private String type; + private String unit; + private String category; + private String description; + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentArtifactType.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentArtifactType.java new file mode 100644 index 0000000000..c91cff0e1e --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentArtifactType.java @@ -0,0 +1,34 @@ +/*- + * ============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 ComponentArtifactType { + SNMP_POLL, + SNMP_TRAP; + + + public static ComponentArtifactType getComponentArtifactType(boolean isTrap) { + return isTrap ? SNMP_TRAP : SNMP_POLL; + } + +} + + diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentCeilometerInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentCeilometerInfo.java new file mode 100644 index 0000000000..a0c1be51e9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentCeilometerInfo.java @@ -0,0 +1,36 @@ +/*- + * ============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.List; + +public class ComponentCeilometerInfo { + + private List ceilometerInfoList; + + public List getCeilometerInfoList() { + return ceilometerInfoList; + } + + public void setCeilometerInfoList(List ceilometerInfoList) { + this.ceilometerInfoList = ceilometerInfoList; + } +} 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 new file mode 100644 index 0000000000..88dbedc136 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMibInfo.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; + +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/EntityInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/EntityInfo.java new file mode 100644 index 0000000000..ac80eb9d03 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/EntityInfo.java @@ -0,0 +1,27 @@ +/*- + * ============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 interface EntityInfo { + + +} 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 new file mode 100644 index 0000000000..f5d2fcb90d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/MibInfo.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 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/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/resources/factoryConfiguration.json new file mode 100644 index 0000000000..d22184e3da --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/resources/factoryConfiguration.json @@ -0,0 +1,4 @@ +{ + "org.openecomp.core.enrichment.factory.EnrichmentManagerFactory": "org.openecomp.sdc.enrichment.impl.EnrichmentManagerFactoryImpl", + "org.openecomp.core.enrichment.EnrichmentArtifactsServiceFactory": "org.openecomp.sdc.enrichment.EnrichmentArtifactsServiceFactoryImpl" +} \ No newline at end of file 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 new file mode 100644 index 0000000000..1f0452cdfb --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml @@ -0,0 +1,90 @@ + + 4.0.0 + + + + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0.0-SNAPSHOT + ../.. + + + openecomp-sdc-enrichment-core + openecomp-sdc-enrichment-core + + + + org.slf4j + slf4j-api + 1.7.10 + + + + + + ch.qos.logback + logback-classic + 1.1.2 + + + + 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 + + + com.google.guava + guava + 19.0 + + + org.openecomp.sdc + openecomp-sdc-model-impl + ${project.version} + test + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/EnrichmentArtifactsServiceFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/EnrichmentArtifactsServiceFactoryImpl.java new file mode 100644 index 0000000000..1075b07a49 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/EnrichmentArtifactsServiceFactoryImpl.java @@ -0,0 +1,34 @@ +/*- + * ============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.sdc.enrichment; + +import org.openecomp.core.enrichment.EnrichmentArtifactsServiceFactory; +import org.openecomp.core.enrichment.enrichmentartifacts.EnrichmentArtifactsService; +import org.openecomp.sdc.enrichment.enrichmentartifacts.EnrichmentArtifactsServiceImpl; + +public class EnrichmentArtifactsServiceFactoryImpl extends EnrichmentArtifactsServiceFactory { + private static EnrichmentArtifactsService INSTANCE = new EnrichmentArtifactsServiceImpl(); + + @Override + public EnrichmentArtifactsService createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/enrichmentartifacts/EnrichmentArtifactsServiceImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/enrichmentartifacts/EnrichmentArtifactsServiceImpl.java new file mode 100644 index 0000000000..2b7fef1e6b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/enrichmentartifacts/EnrichmentArtifactsServiceImpl.java @@ -0,0 +1,61 @@ +/*- + * ============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.sdc.enrichment.enrichmentartifacts; + +import org.openecomp.core.enrichment.enrichmentartifacts.EnrichmentArtifactsService; +import org.openecomp.core.model.dao.EnrichedServiceModelDao; +import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory; +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.core.model.types.ServiceElement; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.sdc.common.utils.AsdcCommon; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.List; + +public class EnrichmentArtifactsServiceImpl implements EnrichmentArtifactsService { + EnrichedServiceModelDao enrichedServiceModelDao = + EnrichedServiceModelDaoFactory.getInstance().createInterface(); + + @Override + public FileContentHandler addMibs(String vspId, Version version) { + FileContentHandler externalArtifacts = new FileContentHandler(); + List mibsList = enrichedServiceModelDao.getExternalArtifacts(vspId, version); + addMibsToFileContentHandler(mibsList, externalArtifacts); + + return externalArtifacts; + } + + + private void addMibsToFileContentHandler(List mibsList, + FileContentHandler externalArtifacts) { + for (ServiceArtifact serviceArtifact : mibsList) { + String filename = serviceArtifact.getName(); + externalArtifacts.addFile(filename, serviceArtifact.getContent()); + } + } + + + private boolean isFileArtifact(String filename) { + return !filename.contains(AsdcCommon.HEAT_META) && !filename.contains(AsdcCommon.MANIFEST_NAME); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerFactoryImpl.java new file mode 100644 index 0000000000..abbb577075 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerFactoryImpl.java @@ -0,0 +1,34 @@ +/*- + * ============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.sdc.enrichment.impl; + + +import org.openecomp.core.enrichment.api.EnrichmentManager; +import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory; + + +public class EnrichmentManagerFactoryImpl extends EnrichmentManagerFactory { + + @Override + public EnrichmentManager createInterface() { + return new EnrichmentManagerImpl(); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java new file mode 100644 index 0000000000..ef29108402 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java @@ -0,0 +1,84 @@ +/*- + * ============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.sdc.enrichment.impl; + +import org.openecomp.core.enrichment.api.EnrichmentManager; +import org.openecomp.core.enrichment.types.EntityInfo; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.enrichment.EnrichmentInfo; +import org.openecomp.sdc.enrichment.factory.EnricherHandlerFactory; +import org.openecomp.sdc.enrichment.inter.Enricher; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.Map; + +public class EnrichmentManagerImpl implements EnrichmentManager { + + private static Logger logger = LoggerFactory.getLogger(EnrichmentManagerImpl.class); + + private EnrichmentInfo input = null; + private ToscaServiceModel model; + + + @Override + public Map> enrich() { + List enricherList = + EnricherHandlerFactory.getInstance().createInterface().getEnrichers(); + for (Enricher enricher : enricherList) { + enricher.setInput(input); + enricher.setModel(model); + enricher.enrich(); + } + + return null; + } + + @Override + public void addEntityInput(String type, EntityInfo info) { + this.input.addEntityInfo(type, info); + } + + + @Override + public void initInput(String key, Version version) { + input = new EnrichmentInfo(); + input.setKey(key); + input.setVersion(version); + } + + @Override + public void addModel(ToscaServiceModel model) { + + this.model = model; + } + + + @Override + public ToscaServiceModel getModel() { + return this.model; + } + + +} 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 new file mode 100644 index 0000000000..6bc5a0e864 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java @@ -0,0 +1,245 @@ +package org.openecomp.sdc.enrichment.impl; + +import org.openecomp.sdc.enrichment.impl.tosca.ComponentInfo; +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.versioning.dao.types.Version; +import org.openecomp.core.enrichment.api.EnrichmentManager; +import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory; + +import org.openecomp.core.enrichment.types.CeilometerInfo; +import org.openecomp.core.enrichment.types.ComponentCeilometerInfo; +import org.openecomp.core.utilities.file.FileUtils; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.*; +import java.net.URL; +import java.nio.file.NotDirectoryException; +import java.util.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import static org.junit.Assert.assertEquals; + + +public class EnrichmentManagerImplTest { + + + private static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath, + String globalServiceTemplatesPath, + String entryDefinitionServiceTemplate) + throws IOException { + ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); + Map serviceTemplates = new HashMap<>(); + if (entryDefinitionServiceTemplate == null) { + entryDefinitionServiceTemplate = "MainServiceTemplate.yaml"; + } + + loadServiceTemplates(serviceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates); + if (globalServiceTemplatesPath != null) { + loadServiceTemplates(globalServiceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates); + } + + return new ToscaServiceModel(null, serviceTemplates, entryDefinitionServiceTemplate); + } + + private static void loadServiceTemplates(String serviceTemplatesPath, + ToscaExtensionYamlUtil toscaExtensionYamlUtil, + Map serviceTemplates) + throws IOException { + URL urlFile = EnrichmentManagerImplTest.class.getResource(serviceTemplatesPath); + if (urlFile != null) { + File pathFile = new File(urlFile.getFile()); + File[] files = pathFile.listFiles(); + if (files != null) { + addServiceTemplateFiles(serviceTemplates, files, toscaExtensionYamlUtil); + } else { + throw new NotDirectoryException(serviceTemplatesPath); + } + } else { + throw new NotDirectoryException(serviceTemplatesPath); + } + } + + private static void addServiceTemplateFiles(Map serviceTemplates, + File[] files, + ToscaExtensionYamlUtil toscaExtensionYamlUtil) + throws IOException { + for (File file : files) { + if (!file.getName().equals("CSR.zip") && !file.isDirectory()) { + try (InputStream yamlFile = new FileInputStream(file)) { + ServiceTemplate serviceTemplateFromYaml = + toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class); + serviceTemplates.put(file.getName(), serviceTemplateFromYaml); + try { + yamlFile.close(); + } catch (IOException ignore) { + } + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + throw e; + } + } + } + } + +// @Test + public void testEnrichmentManagerImpl() throws Exception { + Assert.assertTrue( + EnrichmentManagerFactory.getInstance().createInterface() instanceof EnrichmentManagerImpl); + } + +// @Test + public void testEnrichModel() throws Exception { + ToscaServiceModel toscaServiceModel = + loadToscaServiceModel("/extractServiceComposition/onlyComponents/", + "/extractServiceComposition/toscaGlobalServiceTemplates/", "OnlyComponentsST.yaml"); + EnrichmentManager enrichmentManager = EnrichmentManagerFactory.getInstance().createInterface(); + enrichmentManager.initInput("vsp_enrich", new Version(0, 1)); + enrichmentManager.addModel(toscaServiceModel); + + String[] componentNames = new String[]{"org.openecomp.resource.vfc.nodes.heat.pcrf_psm", + "org.openecomp.resource.vfc.nodes.heat.pcm"}; + ComponentInfo componentInfo = new ComponentInfo(); + + CeilometerInfo ceilometerInfo; + ComponentCeilometerInfo componentCeilometerInfo = new ComponentCeilometerInfo(); + componentCeilometerInfo.setCeilometerInfoList(new ArrayList<>()); + componentInfo.setCeilometerInfo(componentCeilometerInfo); + + for (String componentName : componentNames) { + ceilometerInfo = + getCeilometerInfo("instance", "Gauge", "instance", "compute", "Existence of instance"); + componentInfo.getCeilometerInfo().getCeilometerInfoList().add(ceilometerInfo); + ceilometerInfo = getCeilometerInfo("memory", "Gauge", "MB", "compute", + "Volume of RAM allocated to the instance"); + componentInfo.getCeilometerInfo().getCeilometerInfoList().add(ceilometerInfo); + ceilometerInfo = getCeilometerInfo("cpu", "Cumulative", "ns", "compute", "CPU time used"); + componentInfo.getCeilometerInfo().getCeilometerInfoList().add(ceilometerInfo); + enrichmentManager.addEntityInput(componentName, componentInfo); + } + + enrichmentManager.enrich(); + + File csrFile = getToscaModelAsFile(toscaServiceModel); + compareActualAndExpected(csrFile); + + } + +// @Test + public void testAllEnrichModel() throws Exception { + ToscaServiceModel toscaServiceModel = loadToscaServiceModel("/extractServiceComposition/all/", + "/extractServiceComposition/toscaGlobalServiceTemplates/", "OnlyComponentsST.yaml"); + EnrichmentManager enrichmentManager = EnrichmentManagerFactory.getInstance().createInterface(); + enrichmentManager.initInput("vsp_enrich", new Version(0, 1)); + enrichmentManager.addModel(toscaServiceModel); + + String[] componentNames = new String[]{"org.openecomp.resource.vfc.nodes.heat.pcrf_psm", + "org.openecomp.resource.vfc.nodes.heat.pcm"}; + ComponentInfo componentInfo = new ComponentInfo(); + + CeilometerInfo ceilometerInfo; + ComponentCeilometerInfo componentCeilometerInfo = new ComponentCeilometerInfo(); + componentCeilometerInfo.setCeilometerInfoList(new ArrayList<>()); + componentInfo.setCeilometerInfo(componentCeilometerInfo); + + for (String componentName : componentNames) { + ceilometerInfo = + getCeilometerInfo("instance", "Gauge", "instance", "compute", "Existence of instance"); + componentInfo.getCeilometerInfo().getCeilometerInfoList().add(ceilometerInfo); + ceilometerInfo = getCeilometerInfo("memory", "Gauge", "MB", "compute", + "Volume of RAM allocated to the instance"); + componentInfo.getCeilometerInfo().getCeilometerInfoList().add(ceilometerInfo); + ceilometerInfo = getCeilometerInfo("cpu", "Cumulative", "ns", "compute", "CPU time used"); + componentInfo.getCeilometerInfo().getCeilometerInfoList().add(ceilometerInfo); + enrichmentManager.addEntityInput(componentName, componentInfo); + } + + enrichmentManager.enrich(); + + File csrFile = getToscaModelAsFile(toscaServiceModel); + compareActualAndExpected(csrFile); + + } + + private CeilometerInfo getCeilometerInfo(String name, String type, String unit, String category, + String description) { + CeilometerInfo ceilometerInfo = new CeilometerInfo(); + ceilometerInfo.setName(name); + ceilometerInfo.setType(type); + ceilometerInfo.setUnit(unit); + ceilometerInfo.setCategory(category); + ceilometerInfo.setDescription(description); + return ceilometerInfo; + } + + private File getToscaModelAsFile(ToscaServiceModel toscaServiceModel) throws IOException { + + URL inputFilesUrl = + EnrichmentManagerImplTest.class.getResource("/extractServiceComposition/onlyComponents"); + String path = inputFilesUrl.getPath(); + + + File file = new File(path + "/" + "CSR.zip"); + file.createNewFile(); + + try (FileOutputStream fos = new FileOutputStream(file)) + + { + ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl(); + fos.write(toscaFileOutputService.createOutputFile(toscaServiceModel, null)); + } + + return file; + } + + protected void compareActualAndExpected(File actualFile) throws IOException { + + URL url = EnrichmentManagerImplTest.class + .getResource("/extractServiceComposition/onlyComponents/expectedOutput"); + Set expectedResultFileNameSet = new HashSet<>(); + Map expectedResultMap = new HashMap<>(); + String path = url.getPath(); + File pathFile = new File(path); + File[] files = pathFile.listFiles(); + org.junit.Assert.assertNotNull("manifest files is empty", files); + for (File expectedFile : files) { + expectedResultFileNameSet.add(expectedFile.getName()); + try (FileInputStream input = new FileInputStream(expectedFile)) { + expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input)); + } + } + + try (FileInputStream fis = new FileInputStream(actualFile); + ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis))) { + ZipEntry entry; + String name; + String expected; + String actual; + + while ((entry = zis.getNextEntry()) != null) { + + name = entry.getName() + .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); + if (expectedResultFileNameSet.contains(name)) { + expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); + actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); + assertEquals("difference in file: " + name, expected, actual); + + expectedResultFileNameSet.remove(name); + } + } + if (expectedResultFileNameSet.isEmpty()) { + expectedResultFileNameSet.forEach(System.out::println); + } + } + assertEquals(0, expectedResultFileNameSet.size()); + } + + +} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST.yaml new file mode 100644 index 0000000000..54f39e4219 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST.yaml @@ -0,0 +1,350 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST_01.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST_01.yaml new file mode 100644 index 0000000000..54f39e4219 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/OnlyComponentsST_01.yaml @@ -0,0 +1,350 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/VariouseST.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/VariouseST.yaml new file mode 100644 index 0000000000..1f39bfb314 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/VariouseST.yaml @@ -0,0 +1,363 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + + jsa_net: + type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net + properties: + shared: true + network_name: + get_input: jsa_net_name + jsa_net1: + type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net + properties: + shared: true + network_name: + get_input: jsa_net_name + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST.yaml new file mode 100644 index 0000000000..9ec1aa2a8d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST.yaml @@ -0,0 +1,550 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST_01.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST_01.yaml new file mode 100644 index 0000000000..9ec1aa2a8d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/OnlyComponentsST_01.yaml @@ -0,0 +1,550 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/VariouseST.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/VariouseST.yaml new file mode 100644 index 0000000000..1f39bfb314 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/all/expectedOutput/VariouseST.yaml @@ -0,0 +1,363 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + + jsa_net: + type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net + properties: + shared: true + network_name: + get_input: jsa_net_name + jsa_net1: + type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net + properties: + shared: true + network_name: + get_input: jsa_net_name + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST.yaml new file mode 100644 index 0000000000..54f39e4219 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST.yaml @@ -0,0 +1,350 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST_01.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST_01.yaml new file mode 100644 index 0000000000..54f39e4219 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST_01.yaml @@ -0,0 +1,350 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST.yaml new file mode 100644 index 0000000000..9ec1aa2a8d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST.yaml @@ -0,0 +1,550 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST_01.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST_01.yaml new file mode 100644 index 0000000000..9ec1aa2a8d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/onlyComponents/expectedOutput/OnlyComponentsST_01.yaml @@ -0,0 +1,550 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + capabilities: + instance: + type: org.openecomp.capabilities.metric.Ceilometer + description: Existence of instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: instance + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: instance + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + memory: + type: org.openecomp.capabilities.metric.Ceilometer + description: Volume of RAM allocated to the instance + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: memory + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: MB + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Gauge + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED + cpu: + type: org.openecomp.capabilities.metric.Ceilometer + description: CPU time used + properties: + name: + type: string + description: Ceilometer metric type name to monitor. (The name ceilometer is using) + required: true + default: cpu + status: SUPPORTED + description: + type: string + description: Description of the metric + required: false + status: SUPPORTED + unit: + type: string + description: Unit of the metric value + required: true + default: ns + status: SUPPORTED + type: + type: string + description: Type of the metric value, for an example, Cumulative, Delta, Gauge and etc. + required: true + default: Cumulative + status: SUPPORTED + category: + type: string + description: Category of the metric, for an example, compute, disk, network, storage and etc. + required: false + default: compute + status: SUPPORTED +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..8813b0abf6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml @@ -0,0 +1,47 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: AbstractSubstituteGlobalTypes + template_version: 1.0.0 +description: Abstract Substitute Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.substitution.SubstitutionFilter: + derived_from: tosca.datatypes.Root + description: Substitution Filter + properties: + substitute_service_template: + type: string + description: Substitute Service Template + required: true + status: SUPPORTED + index_variable: + type: string + description: Index variable + required: false + default: '%index%' + status: SUPPORTED + constraints: + - min_length: 3 + count: + type: string + description: Count + required: false + default: 1 + status: SUPPORTED + mandatory: + type: boolean + description: Mandatory + required: false + default: true + status: SUPPORTED +node_types: + org.openecomp.resource.abstract.nodes.AbstractSubstitute: + derived_from: tosca.nodes.Root + properties: + service_template_filter: + type: org.openecomp.datatypes.heat.substitution.SubstitutionFilter + description: Substitution Filter + required: true + status: SUPPORTED \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..3ef94f22e7 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml @@ -0,0 +1,176 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: CinderVolumeGlobalTypes + template_version: 1.0.0 +description: Cinder Volume TOSCA Global Types +relationship_types: + org.openecomp.relationships.heat.cinder.VolumeAttachesTo: + derived_from: tosca.relationships.AttachesTo + description: This type represents an attachment relationship for associating volume + properties: + volume_id: + type: string + description: The ID of the volume to be attached + required: true + status: SUPPORTED + location: + type: string + description: The location where the volume is exposed on the instance, mountpoint + required: false + status: SUPPORTED + instance_uuid: + type: string + description: The ID of the server to which the volume attaches + required: true + status: SUPPORTED + attributes: + show: + type: string + description: Detailed information about resource + status: SUPPORTED +node_types: + org.openecomp.resource.vfc.nodes.heat.cinder.Volume: + derived_from: tosca.nodes.BlockStorage + properties: + availability_zone: + type: string + description: The availability zone in which the volume will be created + required: false + status: SUPPORTED + image: + type: string + description: If specified, the name or ID of the image to create the volume from + required: false + status: SUPPORTED + metadata: + type: map + description: Key/value pairs to associate with the volume + required: false + status: SUPPORTED + entry_schema: + type: string + volume_type: + type: string + description: If specified, the type of volume to use, mapping to a specific backend + required: false + status: SUPPORTED + description: + type: string + description: A description of the volume + required: false + status: SUPPORTED + device_type: + type: string + description: Device type + required: false + status: SUPPORTED + constraints: + - valid_values: + - cdrom + - disk + disk_bus: + type: string + description: 'Bus of the device: hypervisor driver chooses a suitable default + if omitted' + required: false + status: SUPPORTED + constraints: + - valid_values: + - ide + - lame_bus + - scsi + - usb + - virtio + backup_id: + type: string + description: If specified, the backup to create the volume from + required: false + status: SUPPORTED + source_volid: + type: string + description: If specified, the volume to use as source + required: false + status: SUPPORTED + boot_index: + type: integer + description: Integer used for ordering the boot disks + required: false + status: SUPPORTED + size: + type: scalar-unit.size + description: The requested storage size (default unit is MB) + required: false + status: SUPPORTED + constraints: + - greater_or_equal: 1 GB + read_only: + type: boolean + description: Enables or disables read-only access mode of volume + required: false + status: SUPPORTED + name: + type: string + description: A name used to distinguish the volume + required: false + status: SUPPORTED + scheduler_hints: + type: map + description: Arbitrary key-value pairs specified by the client to help the Cinder scheduler creating a volume + required: false + status: SUPPORTED + entry_schema: + type: string + swap_size: + type: scalar-unit.size + description: The size of the swap, in MB + required: false + status: SUPPORTED + delete_on_termination: + type: boolean + description: Indicate whether the volume should be deleted when the server is terminated + required: false + status: SUPPORTED + multiattach: + type: boolean + description: Whether allow the volume to be attached more than once + required: false + status: SUPPORTED + attributes: + display_description: + type: string + description: Description of the volume + status: SUPPORTED + attachments: + type: string + description: The list of attachments of the volume + status: SUPPORTED + entry_schema: + type: string + encrypted: + type: boolean + description: Boolean indicating if the volume is encrypted or not + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + created_at: + type: timestamp + description: The timestamp indicating volume creation + status: SUPPORTED + display_name: + type: string + description: Name of the volume + status: SUPPORTED + metadata_values: + type: map + description: Key/value pairs associated with the volume in raw dict form + status: SUPPORTED + bootable: + type: boolean + description: Boolean indicating if the volume can be booted or not + status: SUPPORTED + status: + type: string + description: The current status of the volume + status: SUPPORTED diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..3388d5a89b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml @@ -0,0 +1,213 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: CommonGlobalTypes + template_version: 1.0.0 +description: TOSCA Global Types +imports: + NativeTypesServiceTemplate: + file: NativeTypesServiceTemplateServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.network.AddressPair: + derived_from: tosca.datatypes.Root + description: MAC/IP address pairs + properties: + mac_address: + type: string + description: MAC address + required: false + status: SUPPORTED + ip_address: + type: string + description: IP address + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.network.subnet.HostRoute: + derived_from: tosca.datatypes.Root + description: Host route info for the subnet + properties: + destination: + type: string + description: The destination for static route + required: false + status: SUPPORTED + nexthop: + type: string + description: The next hop for the destination + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.network.neutron.Subnet: + derived_from: tosca.datatypes.Root + description: A subnet represents an IP address block that can be used for assigning IP addresses to virtual instances + properties: + tenant_id: + type: string + description: The ID of the tenant who owns the network + required: false + status: SUPPORTED + enable_dhcp: + type: boolean + description: Set to true if DHCP is enabled and false if DHCP is disabled + required: false + default: true + status: SUPPORTED + ipv6_address_mode: + type: string + description: IPv6 address mode + required: false + status: SUPPORTED + constraints: + - valid_values: + - dhcpv6-stateful + - dhcpv6-stateless + - slaac + ipv6_ra_mode: + type: string + description: IPv6 RA (Router Advertisement) mode + required: false + status: SUPPORTED + constraints: + - valid_values: + - dhcpv6-stateful + - dhcpv6-stateless + - slaac + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + allocation_pools: + type: list + description: The start and end addresses for the allocation pools + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.AllocationPool + subnetpool: + type: string + description: The name or ID of the subnet pool + required: false + status: SUPPORTED + dns_nameservers: + type: list + description: A specified set of DNS name servers to be used + required: false + default: [ + ] + status: SUPPORTED + entry_schema: + type: string + host_routes: + type: list + description: The gateway IP address + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.subnet.HostRoute + ip_version: + type: integer + description: The gateway IP address + required: false + default: 4 + status: SUPPORTED + constraints: + - valid_values: + - '4' + - '6' + name: + type: string + description: The name of the subnet + required: false + status: SUPPORTED + prefixlen: + type: integer + description: Prefix length for subnet allocation from subnet pool + required: false + status: SUPPORTED + constraints: + - greater_or_equal: 0 + cidr: + type: string + description: The CIDR + required: false + status: SUPPORTED + gateway_ip: + type: string + description: The gateway IP address + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.network.AllocationPool: + derived_from: tosca.datatypes.Root + description: The start and end addresses for the allocation pool + properties: + start: + type: string + description: Start address for the allocation pool + required: false + status: SUPPORTED + end: + type: string + description: End address for the allocation pool + required: false + status: SUPPORTED +relationship_types: + org.openecomp.relationships.AttachesTo: + derived_from: tosca.relationships.Root + description: This type represents an attachment relationship +group_types: + org.openecomp.groups.heat.HeatStack: + derived_from: tosca.groups.Root + description: Grouped all heat resources which are in the same heat stack + properties: + heat_file: + type: string + description: Heat file which associate to this group/heat stack + required: true + status: SUPPORTED + description: + type: string + description: Heat file description + required: false + status: SUPPORTED +policy_types: + org.openecomp.policies.placement.Colocate: + derived_from: tosca.policy.placement + description: Keep associated nodes (groups of nodes) based upon affinity value + properties: + name: + type: string + description: The name of the policy + required: false + status: SUPPORTED + affinity: + type: string + description: affinity + required: true + status: SUPPORTED + constraints: + - valid_values: + - host + - region + - compute + org.openecomp.policies.placement.Antilocate: + derived_from: tosca.policy.placement + description: My placement policy for separation based upon container type value + properties: + name: + type: string + description: The name of the policy + required: false + status: SUPPORTED + container_type: + type: string + description: container type + required: false + status: SUPPORTED + constraints: + - valid_values: + - host + - region + - compute diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml new file mode 100644 index 0000000000..98317310fa --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml @@ -0,0 +1,117 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailNetworkRuleGlobalType + template_version: 1.0.0 +description: Contrail Network Rule Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.contrail.network.rule.PortPairs: + derived_from: tosca.datatypes.Root + description: source and destination port pairs + properties: + start_port: + type: string + description: Start port + required: false + status: SUPPORTED + end_port: + type: string + description: End port + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.contrail.network.rule.Rule: + derived_from: tosca.datatypes.Root + description: policy rule + properties: + src_ports: + type: list + description: Source ports + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.PortPairs + protocol: + type: string + description: Protocol + required: false + status: SUPPORTED + dst_addresses: + type: list + description: Destination addresses + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork + apply_service: + type: string + description: Service to apply + required: false + status: SUPPORTED + dst_ports: + type: list + description: Destination ports + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.PortPairs + src_addresses: + type: list + description: Source addresses + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork + direction: + type: string + description: Direction + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.contrail.network.rule.RuleList: + derived_from: tosca.datatypes.Root + description: list of policy rules + properties: + policy_rule: + type: list + description: Contrail network rule + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.Rule + org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork: + derived_from: tosca.datatypes.Root + description: source and destination addresses + properties: + virtual_network: + type: string + description: Virtual network + required: false + status: SUPPORTED +node_types: + org.openecomp.resource.nodes.heat.network.contrail.NetworkRules: + derived_from: tosca.nodes.Root + properties: + entries: + type: org.openecomp.datatypes.heat.contrail.network.rule.RuleList + description: A symbolic name for this contrail network rule + required: false + status: SUPPORTED + name: + type: string + description: A symbolic name for this contrail network rule + required: false + status: SUPPORTED + attributes: + fq_name: + type: string + description: fq_name + status: SUPPORTED + requirements: + - network: + capability: tosca.capabilities.Attachment + node: tosca.nodes.network.Network + relationship: org.openecomp.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml new file mode 100644 index 0000000000..0927e3dd0e --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml @@ -0,0 +1,71 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailVirtualNetworkGlobalType + template_version: 1.0.0 +description: Contrail Virtual Network Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork: + derived_from: tosca.nodes.network.Network + properties: + shared: + type: string + description: Is virtual network shared + required: false + status: SUPPORTED + forwarding_mode: + type: string + description: forwarding mode of the virtual network + required: false + status: SUPPORTED + external: + type: string + description: Is virtual network external + required: false + status: SUPPORTED + flood_unknown_unicast: + type: string + description: flood L2 packets on network + required: false + status: SUPPORTED + route_targets: + type: list + description: route targets associated with the virtual network + required: false + status: SUPPORTED + entry_schema: + type: string + subnets: + type: map + description: Network related subnets + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + attributes: + subnets_name: + type: list + description: Subnets name of this network + status: SUPPORTED + entry_schema: + type: string + subnets_show: + type: map + description: Detailed information about each subnet + status: SUPPORTED + entry_schema: + type: string + subnets: + type: map + description: Network related subnets + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml new file mode 100644 index 0000000000..08c47bc646 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml @@ -0,0 +1,93 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: GlobalSubstitutionTypes +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.abstract.nodes.heat.nested: + derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute + properties: + cmaui_names: + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + p1: + type: string + description: UID of OAM network + cmaui_image: + type: string + description: Image for CMAUI server + cmaui_flavor: + type: string + description: Flavor for CMAUI server + security_group_name: + description: not impotrtant + availability_zone_0: + type: string + description: availabilityzone name + requirements: + - local_storage_server_cmaui: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED + - link_cmaui_port_0: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + occurrences: + - 1 + - 1 + capabilities: + host_server_cmaui: + type: tosca.capabilities.Container + valid_source_types: + - tosca.nodes.SoftwareComponent + occurrences: + - 1 + - UNBOUNDED + os_server_cmaui: + type: tosca.capabilities.OperatingSystem + occurrences: + - 1 + - UNBOUNDED + endpoint_server_cmaui: + type: tosca.capabilities.Endpoint.Admin + occurrences: + - 1 + - UNBOUNDED + binding_server_cmaui: + type: tosca.capabilities.network.Bindable + occurrences: + - 1 + - UNBOUNDED + scalable_server_cmaui: + type: tosca.capabilities.Scalable + occurrences: + - 1 + - UNBOUNDED + attachment_cmaui_port_0: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml new file mode 100644 index 0000000000..e7dfd49ed9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml @@ -0,0 +1,194 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NativeTypesServiceTemplate + template_version: 1.0.0 +description: TOSCA Native Node Types +node_types: + tosca.nodes.Compute: + derived_from: tosca.nodes.Root + attributes: + private_address: + type: string + description: private address + status: SUPPORTED + public_address: + type: string + description: public_address + status: SUPPORTED + networks: + type: map + description: networks + status: SUPPORTED + entry_schema: + type: tosca.datatypes.network.NetworkInfo + ports: + type: map + description: ports + status: SUPPORTED + entry_schema: + type: tosca.datatypes.network.PortInfo + requirements: + - local_storage: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED + capabilities: + scalable: + type: tosca.capabilities.Scalable + occurrences: + - 1 + - UNBOUNDED + endpoint: + type: tosca.capabilities.Endpoint.Admin + occurrences: + - 1 + - UNBOUNDED + os: + type: tosca.capabilities.OperatingSystem + occurrences: + - 1 + - UNBOUNDED + host: + type: tosca.capabilities.Container + valid_source_types: + - tosca.nodes.SoftwareComponent + occurrences: + - 1 + - UNBOUNDED + binding: + type: tosca.capabilities.network.Bindable + occurrences: + - 1 + - UNBOUNDED + tosca.nodes.network.Port: + derived_from: tosca.nodes.Root + properties: + ip_range_end: + type: string + required: false + status: SUPPORTED + ip_range_start: + type: string + required: false + status: SUPPORTED + ip_address: + type: string + required: false + status: SUPPORTED + is_default: + type: boolean + required: false + default: false + status: SUPPORTED + order: + type: integer + required: true + default: 0 + status: SUPPORTED + constraints: + - greater_or_equal: 0 + requirements: + - link: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + - binding: + capability: tosca.capabilities.network.Bindable + node: tosca.nodes.Root + relationship: tosca.relationships.network.BindsTo + tosca.nodes.Root: + attributes: + tosca_name: + type: string + description: tosca name + status: SUPPORTED + state: + type: string + description: state + status: SUPPORTED + tosca_id: + type: string + description: tosca id + status: SUPPORTED + interfaces: { + } + tosca.nodes.network.Network: + derived_from: tosca.nodes.Root + properties: + physical_network: + type: string + required: false + status: SUPPORTED + segmentation_id: + type: string + required: false + status: SUPPORTED + network_id: + type: string + required: false + status: SUPPORTED + ip_version: + type: integer + required: false + default: 4 + status: SUPPORTED + constraints: + - valid_values: + - 4 + - 6 + start_ip: + type: string + required: false + status: SUPPORTED + network_name: + type: string + required: false + status: SUPPORTED + cidr: + type: string + required: false + status: SUPPORTED + gateway_ip: + type: string + required: false + status: SUPPORTED + network_type: + type: string + required: false + status: SUPPORTED + end_ip: + type: string + required: false + status: SUPPORTED + capabilities: + link: + type: tosca.capabilities.network.Linkable + occurrences: + - 1 + - UNBOUNDED + tosca.nodes.BlockStorage: + derived_from: tosca.nodes.Root + properties: + size: + type: scalar-unit.size + required: false + status: SUPPORTED + constraints: + - greater_or_equal: 1 MB + volume_id: + type: string + required: false + status: SUPPORTED + snapshot_id: + type: string + required: false + status: SUPPORTED + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..e80e2727c7 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml @@ -0,0 +1,97 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronNetGlobalTypes + template_version: 1.0.0 +description: Neutron Network TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vl.nodes.heat.network.neutron.Net: + derived_from: tosca.nodes.network.Network + properties: + dhcp_agent_ids: + type: list + description: The IDs of the DHCP agent to schedule the network + required: false + status: SUPPORTED + entry_schema: + type: string + tenant_id: + type: string + description: The ID of the tenant which will own the network + required: false + status: SUPPORTED + port_security_enabled: + type: boolean + description: Flag to enable/disable port security on the network + required: false + status: SUPPORTED + shared: + type: boolean + description: Whether this network should be shared across all tenants + required: false + default: false + status: SUPPORTED + admin_state_up: + type: boolean + description: A boolean value specifying the administrative status of the network + required: false + default: true + status: SUPPORTED + qos_policy: + type: string + description: The name or ID of QoS policy to attach to this network + required: false + status: SUPPORTED + subnets: + type: map + description: Network related subnets + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + attributes: + qos_policy_id: + type: string + description: The QoS policy ID attached to this network + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + subnets_name: + type: list + description: Subnets name of this network + status: SUPPORTED + entry_schema: + type: string + subnets: + type: map + description: Network related subnets + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + mtu: + type: scalar-unit.size + description: The maximum transmission unit size(in bytes) for the network + status: SUPPORTED + status: + type: string + description: The status of the network + status: SUPPORTED + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..a337d6ed18 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml @@ -0,0 +1,151 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronPortGlobalTypes + template_version: 1.0.0 +description: Neutron Port TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.neutron.port.FixedIps: + derived_from: tosca.datatypes.Root + description: subnet/ip_address + properties: + subnet: + type: string + description: Subnet in which to allocate the IP address for this port + required: false + status: SUPPORTED + ip_address: + type: string + description: IP address desired in the subnet for this port + required: false + status: SUPPORTED +node_types: + org.openecomp.resource.cp.nodes.heat.network.neutron.Port: + derived_from: tosca.nodes.network.Port + properties: + port_security_enabled: + type: boolean + description: Flag to enable/disable port security on the network + required: false + status: SUPPORTED + device_id: + type: string + description: Device ID of this port + required: false + status: SUPPORTED + qos_policy: + type: string + description: The name or ID of QoS policy to attach to this network + required: false + status: SUPPORTED + allowed_address_pairs: + type: list + description: Additional MAC/IP address pairs allowed to pass through the port + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.AddressPair + binding:vnic_type: + type: string + description: The vnic type to be bound on the neutron port + required: false + status: SUPPORTED + constraints: + - valid_values: + - macvtap + - direct + - normal + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + device_owner: + type: string + description: Name of the network owning the port + required: false + status: SUPPORTED + network: + type: string + description: Network this port belongs to + required: false + status: SUPPORTED + replacement_policy: + type: string + description: Policy on how to respond to a stack-update for this resource + required: false + default: AUTO + status: SUPPORTED + constraints: + - valid_values: + - REPLACE_ALWAYS + - AUTO + security_groups: + type: list + description: List of security group names or IDs + required: false + status: SUPPORTED + entry_schema: + type: string + fixed_ips: + type: list + description: Desired IPs for this port + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.neutron.port.FixedIps + mac_address: + type: string + description: MAC address to give to this port + required: false + status: SUPPORTED + admin_state_up: + type: boolean + description: A boolean value specifying the administrative status of the network + required: false + default: true + status: SUPPORTED + name: + type: string + description: A symbolic name for this port + required: false + status: SUPPORTED + attributes: + tenant_id: + type: string + description: Tenant owning the port + status: SUPPORTED + network_id: + type: string + description: Unique identifier for the network owning the port + status: SUPPORTED + qos_policy_id: + type: string + description: The QoS policy ID attached to this network + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + subnets: + type: list + description: Subnets of this network + status: SUPPORTED + entry_schema: + type: string + status: + type: string + description: The status of the network + status: SUPPORTED + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..49c9a102c8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml @@ -0,0 +1,116 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronSecurityRulesGlobalTypes + template_version: 1.0.0 +description: Neutron Security Rules TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.network.neutron.SecurityRules.Rule: + derived_from: tosca.datatypes.Root + description: Rules Pairs + properties: + remote_group_id: + type: string + description: The remote group ID to be associated with this security group rule + required: false + status: SUPPORTED + protocol: + type: string + description: The protocol that is matched by the security group rule + required: false + status: SUPPORTED + constraints: + - valid_values: + - tcp + - udp + - icmp + ethertype: + type: string + description: Ethertype of the traffic + required: false + default: IPv4 + status: SUPPORTED + constraints: + - valid_values: + - IPv4 + - IPv6 + port_range_max: + type: integer + description: 'The maximum port number in the range that is matched by the + security group rule. ' + required: false + status: SUPPORTED + constraints: + - in_range: + - 0 + - 65535 + remote_ip_prefix: + type: string + description: The remote IP prefix (CIDR) to be associated with this security group rule + required: false + status: SUPPORTED + remote_mode: + type: string + description: Whether to specify a remote group or a remote IP prefix + required: false + default: remote_ip_prefix + status: SUPPORTED + constraints: + - valid_values: + - remote_ip_prefix + - remote_group_id + direction: + type: string + description: The direction in which the security group rule is applied + required: false + default: ingress + status: SUPPORTED + constraints: + - valid_values: + - egress + - ingress + port_range_min: + type: integer + description: The minimum port number in the range that is matched by the security group rule. + required: false + status: SUPPORTED + constraints: + - in_range: + - 0 + - 65535 +node_types: + org.openecomp.resource.nodes.heat.network.neutron.SecurityRules: + derived_from: tosca.nodes.Root + properties: + description: + type: string + description: Description of the security group + required: false + status: SUPPORTED + name: + type: string + description: A symbolic name for this security group, which is not required to be unique. + required: false + status: SUPPORTED + rules: + type: list + description: List of security group rules + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.SecurityRules.Rule + attributes: + show: + type: string + description: Detailed information about resource + status: SUPPORTED + requirements: + - port: + capability: tosca.capabilities.Attachment + node: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + relationship: org.openecomp.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..2253a1e4af --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml @@ -0,0 +1,249 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NovaServerGlobalTypes + template_version: 1.0.0 +description: Nova Server TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.novaServer.network.PortExtraProperties: + derived_from: tosca.datatypes.Root + description: Nova server network expand properties for port + properties: + port_security_enabled: + type: boolean + description: Flag to enable/disable port security on the port + required: false + status: SUPPORTED + mac_address: + type: string + description: MAC address to give to this port + required: false + status: SUPPORTED + admin_state_up: + type: boolean + description: The administrative state of this port + required: false + default: true + status: SUPPORTED + qos_policy: + type: string + description: The name or ID of QoS policy to attach to this port + required: false + status: SUPPORTED + allowed_address_pairs: + type: list + description: Additional MAC/IP address pairs allowed to pass through the port + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.AddressPair + binding:vnic_type: + type: string + description: The vnic type to be bound on the neutron port + required: false + status: SUPPORTED + constraints: + - valid_values: + - macvtap + - direct + - normal + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + org.openecomp.datatypes.heat.novaServer.network.AddressInfo: + derived_from: tosca.datatypes.network.NetworkInfo + description: Network addresses with corresponding port id + properties: + port_id: + type: string + description: Port id + required: false + status: SUPPORTED +node_types: + org.openecomp.resource.vfc.nodes.heat.nova.Server: + derived_from: tosca.nodes.Compute + properties: + admin_pass: + type: string + description: The administrator password for the server + required: false + status: SUPPORTED + availability_zone: + type: string + description: Availability zone to create servers in + required: false + status: SUPPORTED + image: + type: string + description: The ID or name of the image to boot with + required: false + status: SUPPORTED + image_update_policy: + type: string + description: Policy on how to apply an image-id update + required: false + default: REBUILD + status: SUPPORTED + constraints: + - valid_values: + - REBUILD_PRESERVE_EPHEMERAL + - REPLACE + - REBUILD + metadata: + type: map + description: Arbitrary key/value metadata to store for this server + required: false + status: SUPPORTED + constraints: + - max_length: 255 + entry_schema: + type: string + constraints: + - max_length: 255 + user_data_update_policy: + type: string + description: Policy on how to apply a user_data update + required: false + default: REPLACE + status: SUPPORTED + constraints: + - valid_values: + - REPLACE + - IGNORE + flavor_update_policy: + type: string + description: Policy on how to apply a flavor update + required: false + default: RESIZE + status: SUPPORTED + constraints: + - valid_values: + - RESIZE + - REPLACE + user_data: + type: string + description: User data script to be executed by cloud-init + required: false + default: '' + status: SUPPORTED + flavor: + type: string + description: The ID or name of the flavor to boot onto + required: true + status: SUPPORTED + key_name: + type: string + description: Name of keypair to inject into the server + required: false + status: SUPPORTED + reservation_id: + type: string + description: A UUID for the set of servers being requested + required: false + status: SUPPORTED + security_groups: + type: list + description: List of security group names or IDs + required: false + default: [ + ] + status: SUPPORTED + entry_schema: + type: string + config_drive: + type: boolean + description: enable config drive on the server + required: false + status: SUPPORTED + personality: + type: map + description: A map of files to create/overwrite on the server upon boot + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + software_config_transport: + type: string + description: How the server should receive the metadata required for software configuration + required: false + default: POLL_SERVER_CFN + status: SUPPORTED + constraints: + - valid_values: + - POLL_SERVER_CFN + - POLL_SERVER_HEAT + - POLL_TEMP_URL + - ZAQAR_MESSAGE + user_data_format: + type: string + description: How the user_data should be formatted for the server + required: false + default: HEAT_CFNTOOLS + status: SUPPORTED + constraints: + - valid_values: + - SOFTWARE_CONFIG + - RAW + - HEAT_CFNTOOLS + diskConfig: + type: string + description: Control how the disk is partitioned when the server is created + required: false + status: SUPPORTED + constraints: + - valid_values: + - AUTO + - MANUAL + name: + type: string + description: Server name + required: false + status: SUPPORTED + scheduler_hints: + type: map + description: Arbitrary key-value pairs specified by the client to help boot a server + required: false + status: SUPPORTED + entry_schema: + type: string + attributes: + accessIPv4: + type: string + description: The manually assigned alternative public IPv4 address of the server + status: SUPPORTED + addresses: + type: map + description: A dict of all network addresses with corresponding port_id + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.novaServer.network.AddressInfo + accessIPv6: + type: string + description: The manually assigned alternative public IPv6 address of the server + status: SUPPORTED + instance_name: + type: string + description: AWS compatible instance name + status: SUPPORTED + name: + type: string + description: Name of the server + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + console_urls: + type: string + description: URLs of servers consoles + status: SUPPORTED \ No newline at end of file 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 new file mode 100644 index 0000000000..8f82967e74 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml @@ -0,0 +1,102 @@ + + 4.0.0 + + + + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0.0-SNAPSHOT + ../.. + + + openecomp-sdc-enrichment-impl + openecomp-sdc-enrichment-impl + + + + org.slf4j + slf4j-api + 1.7.10 + + + + ch.qos.logback + logback-classic + 1.1.2 + + + + + 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.mockito + mockito-all + test + 1.10.19 + + + com.google.guava + guava + 19.0 + + + + org.openecomp.core + openecomp-heat-lib + ${project.version} + + + org.openecomp.core + openecomp-tosca-lib + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-translator-core + ${project.version} + + + + + + + \ 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/EnrichmentInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/EnrichmentInfo.java new file mode 100644 index 0000000000..17c4091a28 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/EnrichmentInfo.java @@ -0,0 +1,63 @@ +/*- + * ============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.sdc.enrichment; + +import org.openecomp.core.enrichment.types.EntityInfo; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class EnrichmentInfo { + Map> additionalInfo = new HashMap<>(); + Map entityInfo = new HashMap<>(); //componentName,EntityInfo + String key; + Version version; + + public Map> getAdditionalInfo() { + return additionalInfo; + } + + public Map getEntityInfo() { + return entityInfo; + } + + public void addEntityInfo(String type, EntityInfo entityInfo) { + this.entityInfo.put(type, entityInfo); + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/factory/EnricherHandlerFactory.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/factory/EnricherHandlerFactory.java new file mode 100644 index 0000000000..47821f6670 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/factory/EnricherHandlerFactory.java @@ -0,0 +1,32 @@ +/*- + * ============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.sdc.enrichment.factory; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; +import org.openecomp.sdc.enrichment.inter.EnricherHandler; + +public abstract class EnricherHandlerFactory extends AbstractComponentFactory { + + public static EnricherHandlerFactory getInstance() { + return AbstractFactory.getInstance(EnricherHandlerFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerFactoryImpl.java new file mode 100644 index 0000000000..00f5c91661 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.sdc.enrichment.impl; + + +import org.openecomp.sdc.enrichment.factory.EnricherHandlerFactory; +import org.openecomp.sdc.enrichment.inter.EnricherHandler; + +public class EnricherHandlerFactoryImpl extends EnricherHandlerFactory { + + @Override + public EnricherHandler createInterface() { + return new EnricherHandlerImpl(); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java new file mode 100644 index 0000000000..e2e5b47d2a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java @@ -0,0 +1,89 @@ +/*- + * ============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.sdc.enrichment.impl; + +import org.openecomp.core.enrichment.types.EntityInfo; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.datatypes.model.AsdcModel; +import org.openecomp.sdc.enrichment.EnrichmentInfo; +import org.openecomp.sdc.enrichment.impl.external.artifact.ExternalArtifactEnricher; +import org.openecomp.sdc.enrichment.impl.tosca.ToscaEnricher; +import org.openecomp.sdc.enrichment.inter.Enricher; +import org.openecomp.sdc.enrichment.inter.EnricherHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * The type Enricher handler. + */ +public class EnricherHandlerImpl implements EnricherHandler { + + private static Logger logger = LoggerFactory.getLogger(EnricherHandlerImpl.class); + private EnrichmentInfo input; + private AsdcModel model; + + @Override + public List getEnrichers() { + List enricherList = new ArrayList<>(); + enricherList.add(new ToscaEnricher()); + enricherList.add(new ExternalArtifactEnricher()); + return enricherList; + } + + @Override + public Map> enrich() { + Map> errors = new HashMap<>(); + Map> enricherResponse; + for (Enricher enricher : getEnrichers()) { + enricher.setInput(this.input); + enricher.setModel(this.model); + enricherResponse = enricher.enrich(); + errors.putAll(enricherResponse); + } + return errors; + } + + /** + * Adds additional input. + * + * @param key key + * @param input input + */ + public void addAdditionalInput(String key, Object input) { + if (!this.input.getAdditionalInfo().containsKey(key)) { + this.input.getAdditionalInfo().put(key, new ArrayList<>()); + } + this.input.getAdditionalInfo().get(key).add(input); + } + + public void addEntityInfo(String entityId, EntityInfo entityInfo) { + this.input.getEntityInfo().put(entityId, entityInfo); + } + + public void setModel(AsdcModel model) { + this.model = model; + } +} 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 new file mode 100644 index 0000000000..a276cfba7d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java @@ -0,0 +1,106 @@ +/*- + * ============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.sdc.enrichment.impl.external.artifact; + +import org.openecomp.core.enrichment.types.ComponentArtifactType; +import org.openecomp.core.enrichment.types.MibInfo; +import org.openecomp.core.model.dao.EnrichedServiceModelDao; +import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory; +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.core.validation.errors.Messages; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.enrichment.impl.tosca.ComponentInfo; +import org.openecomp.sdc.enrichment.inter.Enricher; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class ExternalArtifactEnricher extends Enricher { + + private static EnrichedServiceModelDao enrichedServiceModelDao = + EnrichedServiceModelDaoFactory.getInstance().createInterface(); + + + @Override + public Map> enrich() { + + Map> errors = new HashMap<>(); + input.getEntityInfo().entrySet().stream().forEach( + entry -> enrichComponentMib(entry.getKey(), (ComponentInfo) entry.getValue(), errors)); + + + return errors; + } + + + private void enrichComponentMib(String componentName, ComponentInfo componentInfo, + Map> errors) { + + String vspId = input.getKey(); + Version version = input.getVersion(); + ServiceArtifact mibServiceArtifact = new ServiceArtifact(); + mibServiceArtifact.setVspId(vspId); + mibServiceArtifact.setVersion(version); + enrichMibFiles(mibServiceArtifact, componentInfo, errors); + } + + private void enrichMibFiles(ServiceArtifact mibServiceArtifact, ComponentInfo componentInfo, + Map> errors) { + if (componentInfo.getMibInfo() == null) { + return; + } + enrichMibByType(componentInfo.getMibInfo().getSnmpTrap(), ComponentArtifactType.SNMP_TRAP, + mibServiceArtifact, errors); + enrichMibByType(componentInfo.getMibInfo().getSnmpPoll(), ComponentArtifactType.SNMP_POLL, + mibServiceArtifact, errors); + } + + private void enrichMibByType(MibInfo mibInfo, ComponentArtifactType type, + ServiceArtifact mibServiceArtifact, + Map> errors) { + if (mibInfo == null) { + return; + } + FileContentHandler mibs; + try { + mibs = FileUtils.getFileContentMapFromZip(FileUtils.toByteArray(mibInfo.getContent())); + } catch (IOException ioException) { + ErrorMessage.ErrorMessageUtil + .addMessage(mibServiceArtifact.getName() + "." + type.name(), errors) + .add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage())); + return; + } + Set fileList = mibs.getFileList(); + for (String fileName : fileList) { + mibServiceArtifact.setContentData(FileUtils.toByteArray(mibs.getFileContent(fileName))); + mibServiceArtifact.setName(mibInfo.getName() + File.separator + fileName); + enrichedServiceModelDao.storeExternalArtifact(mibServiceArtifact); + } + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/CeilometerEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/CeilometerEnricher.java new file mode 100644 index 0000000000..eb79787b59 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/CeilometerEnricher.java @@ -0,0 +1,112 @@ +/*- + * ============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.sdc.enrichment.impl.tosca; + +import org.apache.commons.collections4.MapUtils; +import org.openecomp.core.enrichment.types.CeilometerInfo; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.enrichment.EnrichmentInfo; +import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType; +import org.openecomp.sdc.tosca.datatypes.ToscaElementTypes; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition; +import org.openecomp.sdc.tosca.datatypes.model.CapabilityType; +import org.openecomp.sdc.tosca.datatypes.model.NodeType; +import org.openecomp.sdc.tosca.services.ToscaAnalyzerService; +import org.openecomp.sdc.tosca.services.ToscaUtil; +import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; +import org.openecomp.sdc.translator.services.heattotosca.globaltypes.CommonGlobalTypes; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CeilometerEnricher { + /** + * Enrich map. + * + * @param toscaModel the tosca model + * @param modelNodeType the model node type + * @param input the input + * @return the map + */ + public static Map> enrich(ToscaServiceModel toscaModel, + Map> modelNodeType, + EnrichmentInfo input) { + Map> errors = new HashMap<>(); + input.getEntityInfo().entrySet().stream().forEach( + entry -> enrichNodeType(toscaModel, (ComponentInfo) entry.getValue(), + modelNodeType.get(entry.getKey()))); + + return errors; + } + + private static void enrichNodeType(ToscaServiceModel toscaModel, ComponentInfo componentInfo, + List nodeTypes) { + + for (CeilometerInfo ceilometerInfo : componentInfo.getCeilometerInfo() + .getCeilometerInfoList()) { + String capabilityId = ceilometerInfo.getName(); + + Map properties = getCeilometerProperties(ceilometerInfo); + + //CapabilityType capabilityType = CommonGlobalTypes.createServiceTemplate() + // .getCapability_types(). + // get(ToscaCapabilityType.METRIC_CEILOMETER.getDisplayName()); + //CapabilityType metricCapabilityType = CommonGlobalTypes.createServiceTemplate(). + // getCapability_types().get(ToscaCapabilityType.METRIC.getDisplayName()); + ToscaAnalyzerService toscaAnalyzerService = new ToscaAnalyzerServiceImpl(); + CapabilityType capabilityType = (CapabilityType) toscaAnalyzerService + .getFlatEntity(ToscaElementTypes.CAPABILITY_TYPE, + ToscaCapabilityType.METRIC_CEILOMETER.getDisplayName(), + CommonGlobalTypes.createServiceTemplate(), toscaModel); + + + nodeTypes.stream().forEach(nodeType -> + addCapability(nodeType, capabilityId, ToscaUtil + .convertTypeToDefinition(ToscaCapabilityType.METRIC_CEILOMETER.getDisplayName(), + capabilityType, properties, ceilometerInfo.getDescription()))); + } + } + + private static Map getCeilometerProperties(CeilometerInfo ceilometerInfo) { + Map properties = new HashMap<>(); + properties.put("name", ceilometerInfo.getName()); + properties.put("type", ceilometerInfo.getType()); + properties.put("unit", ceilometerInfo.getUnit()); + if (ceilometerInfo.getCategory() != null) { + properties.put("category", ceilometerInfo.getCategory()); + } + return properties; + } + + private static void addCapability(NodeType nodeType, String capabilityId, + CapabilityDefinition capabilityDefinition) { + if (MapUtils.isEmpty(nodeType.getCapabilities())) { + nodeType.setCapabilities(new HashMap<>()); + } + //clean unnecessary info + capabilityDefinition.setAttributes(null); + capabilityDefinition.setOccurrences(null); + + nodeType.getCapabilities().put(capabilityId, capabilityDefinition); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentInfo.java new file mode 100644 index 0000000000..0a1f3d36ff --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentInfo.java @@ -0,0 +1,47 @@ +/*- + * ============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.sdc.enrichment.impl.tosca; + +import org.openecomp.core.enrichment.types.ComponentCeilometerInfo; +import org.openecomp.core.enrichment.types.ComponentMibInfo; +import org.openecomp.core.enrichment.types.EntityInfo; + +public class ComponentInfo implements EntityInfo { + + private ComponentCeilometerInfo ceilometerInfo; + private ComponentMibInfo mibInfo; + + public ComponentCeilometerInfo getCeilometerInfo() { + return ceilometerInfo; + } + + public void setCeilometerInfo(ComponentCeilometerInfo ceilometerInfo) { + this.ceilometerInfo = ceilometerInfo; + } + + public ComponentMibInfo getMibInfo() { + return mibInfo; + } + + public void setMibInfo(ComponentMibInfo mibInfo) { + this.mibInfo = mibInfo; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/SnmpEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/SnmpEnricher.java new file mode 100644 index 0000000000..42cbcdd50b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/SnmpEnricher.java @@ -0,0 +1,38 @@ +/*- + * ============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.sdc.enrichment.impl.tosca; + +import org.openecomp.sdc.datatypes.error.ErrorMessage; + +import org.openecomp.sdc.enrichment.EnrichmentInfo; +import org.openecomp.sdc.tosca.datatypes.model.NodeType; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SnmpEnricher { + public static Map> enrich(Map> modelNodeType, + EnrichmentInfo input) { + return new HashMap<>(); + + } +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java new file mode 100644 index 0000000000..2c0f03480f --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java @@ -0,0 +1,73 @@ +/*- + * ============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.sdc.enrichment.impl.tosca; + +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.enrichment.inter.Enricher; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.NodeType; +import org.openecomp.sdc.tosca.services.ToscaUtil; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ToscaEnricher extends Enricher { + + Map> componentTypNodeTypeMap; + + @Override + public Map> enrich() { + Map> errors = new HashMap<>(); + Map> enrichResponse; + enrichResponse = enrichCilometer(); + errors.putAll(enrichResponse); + enrichResponse = enrichSnmp(); + errors.putAll(enrichResponse); + + + return errors; + } + + private Map> enrichCilometer() { + Map> enrichResponse; + + ToscaServiceModel toscaModel = (ToscaServiceModel) model; + + componentTypNodeTypeMap = + ToscaUtil.normalizeComponentNameNodeType(toscaModel, input.getEntityInfo().keySet()); + + enrichResponse = CeilometerEnricher.enrich(toscaModel, componentTypNodeTypeMap, this.input); + + return enrichResponse; + } + + + private Map> enrichSnmp() { + Map> enrichResponse; + + enrichResponse = SnmpEnricher.enrich(componentTypNodeTypeMap, this.input); + + return enrichResponse; + } + + +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.java new file mode 100644 index 0000000000..1d6867d1f3 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/Enricher.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.sdc.enrichment.inter; + +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.datatypes.model.AsdcModel; +import org.openecomp.sdc.enrichment.EnrichmentInfo; + +import java.util.List; +import java.util.Map; + +public abstract class Enricher { + + + protected EnrichmentInfo input; + protected AsdcModel model; + + public void setInput(EnrichmentInfo input) { + this.input = input; + } + + public void setModel(AsdcModel model) { + this.model = model; + } + + public abstract Map> enrich(); +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/EnricherHandler.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/EnricherHandler.java new file mode 100644 index 0000000000..717bbc8313 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/EnricherHandler.java @@ -0,0 +1,41 @@ +/*- + * ============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.sdc.enrichment.inter; + +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.datatypes.model.AsdcModel; + +import java.util.List; +import java.util.Map; + +public interface EnricherHandler { + + + List getEnrichers(); + + Map> enrich(); + + void addAdditionalInput(String key, Object input); + + void setModel(AsdcModel model); + + +} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/resources/factoryConfiguration.json new file mode 100644 index 0000000000..56510be13c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/resources/factoryConfiguration.json @@ -0,0 +1,3 @@ +{ + "org.openecomp.sdc.enrichment.factory.EnricherHandlerFactory": "org.openecomp.sdc.enrichment.impl.EnricherHandlerFactoryImpl" +} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml new file mode 100644 index 0000000000..314dac2447 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml @@ -0,0 +1,41 @@ + + 4.0.0 + + + + + openecomp-sdc-lib + org.openecomp.sdc + 1.0.0-SNAPSHOT + + + openecomp-sdc-enrichment-lib + openecomp-sdc-enrichment-lib + pom + + + + 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} + + + + \ No newline at end of file -- cgit 1.2.3-korg