summaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml6
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java15
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java27
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java121
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java40
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java23
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java23
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java19
-rw-r--r--openecomp-be/pom.xml26
10 files changed, 282 insertions, 21 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
index 08e8dd8ec8..35865f988e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
@@ -11,6 +11,12 @@
<param-value>WEB-INF/beans-services.xml</param-value>
</context-param>
+ <context-param>
+ <param-name>org.togglz.core.manager.TogglzConfig</param-name>
+ <param-value>org.openecomp.sdc.common.togglz.TogglzConfiguration</param-value>
+ </context-param>
+
+
<listener>
<listener-class>org.openecomp.server.listeners.OnboardingAppStartupListener</listener-class>
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java
new file mode 100644
index 0000000000..aab9845573
--- /dev/null
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdc.common.togglz;
+
+import org.togglz.core.Feature;
+import org.togglz.core.annotation.Label;
+import org.togglz.core.context.FeatureContext;
+
+public enum ToggleableFeature implements Feature {
+
+ @Label ("Forwarder Capability")
+ FORWARDER_CAPABILITY;
+
+ public boolean isActive() {
+ return FeatureContext.getFeatureManager().isActive(this);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java
new file mode 100644
index 0000000000..d743205e5b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdc.common.togglz;
+
+import org.togglz.core.Feature;
+import org.togglz.core.manager.TogglzConfig;
+import org.togglz.core.repository.StateRepository;
+import org.togglz.core.repository.file.FileBasedStateRepository;
+import org.togglz.core.user.SimpleFeatureUser;
+import org.togglz.core.user.UserProvider;
+
+import java.io.File;
+
+public class TogglzConfiguration implements TogglzConfig {
+ @Override
+ public Class<? extends Feature> getFeatureClass() {
+ return ToggleableFeature.class;
+ }
+
+ @Override
+ public StateRepository getStateRepository() {
+ return new FileBasedStateRepository(new File("/tmp/features.properties"));
+ }
+
+ @Override
+ public UserProvider getUserProvider() {
+ return () -> new SimpleFeatureUser("admin", true);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json
index 9f83296a71..4e1b0df97a 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json
@@ -8,5 +8,6 @@
"COMPONENT_QUESTIONNAIRE_HEALER" : "org.openecomp.sdc.healing.healers.ComponentQuestionnaireHealer",
"HEAT_TOSCA_TRANSLATION_HEALER" : "org.openecomp.sdc.healing.healers.HeatToToscaTranslationHealer",
"VLM_VERSION_HEALER" : "org.openecomp.sdc.healing.healers.VlmVersionHealer",
- "VALIDATION_STRUCTURE_HEALER" : "org.openecomp.sdc.healing.healers.ValidationStructureHealer"
+ "VALIDATION_STRUCTURE_HEALER" : "org.openecomp.sdc.healing.healers.ValidationStructureHealer",
+ "FORWARDER_CAPABILITY_HEALER" : "org.openecomp.sdc.healing.healers.ForwarderCapabilityHealer"
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java
new file mode 100644
index 0000000000..038a0d889a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java
@@ -0,0 +1,121 @@
+package org.openecomp.sdc.healing.healers;
+
+import org.apache.commons.collections.MapUtils;
+import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.dao.ServiceModelDaoFactory;
+import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.DataModelUtil;
+import org.openecomp.sdc.tosca.services.ToscaAnalyzerService;
+import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl;
+import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesServiceTemplates;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ForwarderCapabilityHealer implements Healer {
+
+ private MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+ private final ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao =
+ ServiceModelDaoFactory.getInstance().createInterface();
+ private static ToscaAnalyzerService toscaAnalyzerService = new ToscaAnalyzerServiceImpl();
+ private static final String FORWARDER_CAPABILITY_ID = "Forwarder";
+ private static final String UNDERSCORE = "_";
+
+ @Override
+ public Object heal(Map<String, Object> healingParams) throws Exception {
+ String vspId = (String) healingParams.get(SdcCommon.VSP_ID);
+ Version version = (Version) healingParams.get(SdcCommon.VERSION);
+
+ if(!ToggleableFeature.FORWARDER_CAPABILITY.isActive()) {
+ return Optional.empty();
+ }
+
+ ToscaServiceModel serviceModel =
+ serviceModelDao.getServiceModel(vspId, version);
+
+ if (Objects.isNull(serviceModel)
+ || MapUtils.isEmpty(serviceModel.getServiceTemplates())) {
+ return Optional.empty();
+ }
+
+ addForwarderCapabilityToServiceModel(serviceModel);
+ serviceModelDao.deleteAll(vspId, version);
+ serviceModelDao.storeServiceModel(vspId, version, serviceModel);
+
+ return Optional.of(serviceModel);
+ }
+
+ private void addForwarderCapabilityToServiceModel(ToscaServiceModel serviceModel) {
+ serviceModel.getServiceTemplates().entrySet().stream().filter(serviceTemplateEntry -> Objects
+ .nonNull(serviceTemplateEntry.getValue()))
+ .forEach(serviceTemplateEntry -> handleServiceTemplate(serviceTemplateEntry.getValue(),
+ serviceModel));
+
+ handleGlobalTypes(serviceModel);
+ }
+
+ private void handleGlobalTypes(ToscaServiceModel serviceModel) {
+ Map<String, ServiceTemplate> globalTypesServiceTemplates =
+ GlobalTypesServiceTemplates.getGlobalTypesServiceTemplates();
+
+ if (MapUtils.isEmpty(globalTypesServiceTemplates)) {
+ return;
+ }
+
+ globalTypesServiceTemplates.entrySet()
+ .stream()
+ .filter(globalTypesServiceTemplateEntry -> Objects.nonNull
+ (globalTypesServiceTemplateEntry.getValue()))
+ .forEach(globalTypesServiceTemplateEntry -> serviceModel.addServiceTemplate
+ (globalTypesServiceTemplateEntry.getKey(), globalTypesServiceTemplateEntry.getValue()));
+ }
+
+ private void handleServiceTemplate(ServiceTemplate serviceTemplate,
+ ToscaServiceModel toscaServiceModel) {
+ if (Objects.isNull(serviceTemplate.getTopology_template())
+ || MapUtils.isEmpty(serviceTemplate.getTopology_template().getNode_templates())) {
+ return;
+ }
+
+ Map<String, NodeTemplate> nodeTemplates =
+ serviceTemplate.getTopology_template().getNode_templates();
+
+ nodeTemplates.entrySet().stream()
+ .filter(nodeTemplateEntry ->
+ toscaAnalyzerService.isTypeOf(nodeTemplateEntry.getValue(),
+ ToscaNodeType.NATIVE_NETWORK_PORT, serviceTemplate, toscaServiceModel))
+ .forEach(nodeTemplateEntry ->
+ addForwarderToSubstitutionMappings(nodeTemplateEntry.getKey(), serviceTemplate)
+ );
+ }
+
+ private void addForwarderToSubstitutionMappings(String portNodeTemplateId,
+ ServiceTemplate serviceTemplate) {
+ if (Objects.isNull(serviceTemplate.getTopology_template())
+ || Objects.isNull(serviceTemplate.getTopology_template().getSubstitution_mappings())) {
+ return;
+ }
+
+ List<String> substitutionMappingCapabilityList =
+ Arrays.asList(portNodeTemplateId, FORWARDER_CAPABILITY_ID);
+
+ DataModelUtil.addSubstitutionMappingCapability(
+ serviceTemplate,
+ FORWARDER_CAPABILITY_ID + UNDERSCORE + portNodeTemplateId,
+ substitutionMappingCapabilityList);
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
index d401e4930b..895b3f9670 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
@@ -27,6 +27,7 @@ import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.tosca.services.YamlUtil;
import org.openecomp.core.validation.util.MessageContainerUtil;
import org.openecomp.sdc.common.errors.CoreException;
@@ -106,6 +107,7 @@ public class HeatToToscaUtil {
protected static Logger logger = (Logger) LoggerFactory.getLogger(HeatToToscaUtil.class);
protected static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private static final String forwarder = "forwarder";
/**
@@ -1277,23 +1279,37 @@ public class HeatToToscaUtil {
NodeType flatNodeType =
getNodeTypeWithFlatHierarchy(type, serviceTemplate, context);
- String capabilityKey;
- List<String> capabilityMapping;
+
if (flatNodeType.getCapabilities() != null) {
- for (Map.Entry<String, CapabilityDefinition> capabilityNodeEntry : flatNodeType
- .getCapabilities()
- .entrySet()) {
- capabilityKey = capabilityNodeEntry.getKey() + "_" + templateName;
- nodeTypeCapabilitiesDefinition.put(capabilityKey, capabilityNodeEntry.getValue().clone());
- capabilityMapping = new ArrayList<>();
- capabilityMapping.add(templateName);
- capabilityMapping.add(capabilityNodeEntry.getKey());
- capabilitySubstitutionMapping.put(capabilityKey, capabilityMapping);
- }
+ flatNodeType.getCapabilities()
+ .entrySet()
+ .stream()
+ .filter(capabilityNodeEntry -> shouldCapabilityNeedsToBeAdded(capabilityNodeEntry.getKey()))
+ .forEach(capabilityNodeEntry ->
+ addCapabilityToSubMapping(
+ templateName, capabilityNodeEntry, nodeTypeCapabilitiesDefinition, capabilitySubstitutionMapping));
}
mdcDataDebugMessage.debugExitMessage(null, null);
}
+ private static boolean shouldCapabilityNeedsToBeAdded(String capabilityKey) {
+ return !capabilityKey.contains(forwarder) || ToggleableFeature.FORWARDER_CAPABILITY.isActive();
+ }
+
+ private static void addCapabilityToSubMapping(String templateName,
+ Map.Entry<String, CapabilityDefinition> capabilityNodeEntry,
+ Map<String, CapabilityDefinition> nodeTypeCapabilitiesDefinition,
+ Map<String, List<String>> capabilitySubstitutionMapping) {
+ String capabilityKey;
+ List<String> capabilityMapping;
+ capabilityKey = capabilityNodeEntry.getKey() + "_" + templateName;
+ nodeTypeCapabilitiesDefinition.put(capabilityKey, capabilityNodeEntry.getValue().clone());
+ capabilityMapping = new ArrayList<>();
+ capabilityMapping.add(templateName);
+ capabilityMapping.add(capabilityNodeEntry.getKey());
+ capabilitySubstitutionMapping.put(capabilityKey, capabilityMapping);
+ }
+
private static List<Map<String, RequirementDefinition>> getNodeTypeReqs(
String type,
String templateName,
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
index 59dea8afb9..d0364e793c 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
@@ -21,7 +21,9 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
import org.apache.commons.collections4.MapUtils;
+import org.junit.AfterClass;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.openecomp.core.translator.api.HeatToToscaTranslator;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
@@ -30,6 +32,7 @@ import org.openecomp.core.validation.util.MessageContainerUtil;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
@@ -39,6 +42,8 @@ import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.translator.TestUtils;
+import org.togglz.testing.TestFeatureManager;
+import org.togglz.testing.TestFeatureManagerProvider;
import java.io.BufferedInputStream;
import java.io.File;
@@ -62,6 +67,24 @@ public class BaseFullTranslationTest {
public static final String IN_POSTFIX = "/in";
public static final String OUT_POSTFIX = "/out";
+ protected static TestFeatureManager manager;
+
+ @BeforeClass
+ public static void enableForwarderFeature(){
+ manager = new TestFeatureManager(ToggleableFeature.class);
+ if (!ToggleableFeature.FORWARDER_CAPABILITY.isActive()) {
+ manager.enable(ToggleableFeature.FORWARDER_CAPABILITY);
+ }
+ }
+
+
+ @AfterClass
+ public static void disableForwarderFeature() {
+ manager.disable(ToggleableFeature.FORWARDER_CAPABILITY);
+ manager = null;
+ TestFeatureManagerProvider.setFeatureManager(null);
+ }
+
protected void testTranslationWithInit(String path) throws IOException {
File translatedZipFile = initTranslatorAndTranslate(path);
testTranslation(path, translatedZipFile);
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
index 62f3c07411..528db5ee77 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
@@ -34,8 +34,10 @@ import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidati
import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateVolumeInConsolidationData;
import org.apache.commons.collections4.MapUtils;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
@@ -43,6 +45,7 @@ import org.openecomp.core.validation.util.MessageContainerUtil;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
@@ -66,6 +69,8 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
import org.openecomp.sdc.translator.services.heattotosca.TranslationService;
import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
+import org.togglz.testing.TestFeatureManager;
+import org.togglz.testing.TestFeatureManagerProvider;
import java.io.BufferedInputStream;
import java.io.File;
@@ -98,6 +103,24 @@ public class BaseResourceTranslationTest {
private final String MANIFEST_NAME = SdcCommon.MANIFEST_NAME;
private String validationFilename = "validationOutput.json";
+ protected static TestFeatureManager manager;
+
+ @BeforeClass
+ public static void enableForwarderFeature(){
+ manager = new TestFeatureManager(ToggleableFeature.class);
+ if (!ToggleableFeature.FORWARDER_CAPABILITY.isActive()) {
+ manager.enable(ToggleableFeature.FORWARDER_CAPABILITY);
+ }
+ }
+
+
+ @AfterClass
+ public static void disableForwarderFeature() {
+ manager.disable(ToggleableFeature.FORWARDER_CAPABILITY);
+ manager = null;
+ TestFeatureManagerProvider.setFeatureManager(null);
+ }
+
@Before
public void setUp() throws IOException {
initTranslatorAndTranslate();
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
index 722c286f50..4512fce159 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
@@ -20,12 +20,14 @@
package org.openecomp.sdc.tosca.datatypes;
+import org.apache.commons.collections.MapUtils;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.sdc.datatypes.model.AsdcModel;
import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.sdc.tosca.services.DataModelUtil;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
/**
@@ -87,6 +89,15 @@ public class ToscaServiceModel implements AsdcModel {
return Collections.unmodifiableMap(serviceTemplates);
}
+ public void addServiceTemplate(String serviceTemplateName,
+ ServiceTemplate serviceTemplate) {
+ if(MapUtils.isEmpty(serviceTemplates)){
+ serviceTemplates = new HashMap<>();
+ }
+
+ serviceTemplates.put(serviceTemplateName, serviceTemplate);
+ }
+
/**
* Sets service templates.
*
@@ -123,12 +134,4 @@ public class ToscaServiceModel implements AsdcModel {
public static ToscaServiceModel getClonedServiceModel(ToscaServiceModel toscaServiceModel) {
return ToscaServiceModel.class.cast(DataModelUtil.getClonedObject(toscaServiceModel));
}
-
- public FileContentHandler getExternalFiles() {
- return externalFiles;
- }
-
- public void setExternalFiles(FileContentHandler externalFiles) {
- this.externalFiles = externalFiles;
- }
}
diff --git a/openecomp-be/pom.xml b/openecomp-be/pom.xml
index 442b7dec15..3934f411fd 100644
--- a/openecomp-be/pom.xml
+++ b/openecomp-be/pom.xml
@@ -32,6 +32,32 @@
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
+
+ <!-- Feature Toggle support libraries-->
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-core</artifactId>
+ <version>${togglz.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-servlet</artifactId>
+ <version>${togglz.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-console</artifactId>
+ <version>${togglz.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.togglz</groupId>
+ <artifactId>togglz-testing</artifactId>
+ <version>${togglz.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>