diff options
author | Shnaider, Marina (ms7589) <ms7589@intl.att.com> | 2018-08-12 10:55:05 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-08-12 13:41:20 +0000 |
commit | f1240fd2a1568fc628ce5ae379c2d7956c7e307e (patch) | |
tree | 6474d109cee6b15d151179e13cb6ff40e2fa9f59 /openecomp-be/lib | |
parent | 9cf203ce666acc92413dd4f49aed5400c41d8d20 (diff) |
Toggle for SRIOV
Adding Toggle for Fabric Configuration feature
Change-Id: I4c8c23c67d215597b0a32212f24416de977ef2eb
Issue-ID: SDC-1623
Signed-off-by: Shnaider, Marina (ms7589) <ms7589@intl.att.com>
Diffstat (limited to 'openecomp-be/lib')
4 files changed, 34 insertions, 3 deletions
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 index 4f4192805a..4eaa8c823d 100644 --- 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 @@ -1,11 +1,16 @@ 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(("MRN")) + MRN, + + @Label("Fabric Configuration") + FABRIC_CONFIGURATION; public boolean isActive() { return FeatureContext.getFeatureManager().isActive(this); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java index 3f5e41745b..745d1bdf90 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java @@ -37,6 +37,7 @@ import org.onap.sdc.tosca.datatypes.model.RelationshipTemplate; import org.onap.sdc.tosca.datatypes.model.RequirementAssignment; import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.onap.sdc.tosca.datatypes.model.CapabilityDefinition; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.heat.datatypes.HeatBoolean; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; @@ -359,8 +360,11 @@ public class ResourceTranslationNovaServerImpl extends ResourceTranslationBase { for (Map<String, Object> heatNetwork : heatNetworkList) { Optional<Resource> portResourceOp = getOrTranslatePortTemplate(translateTo, heatNetwork.get( - Constants.PORT_PROPERTY_NAME), translatedId, novaNodeTemplate); - portResourceOp.ifPresent(portResource -> handleFabricConfiguration(translateTo, novaNodeTemplate.getType(), portResource)); + Constants.PORT_PROPERTY_NAME), translatedId, novaNodeTemplate); + + if (ToggleableFeature.FABRIC_CONFIGURATION.isActive()) { + portResourceOp.ifPresent(portResource -> handleFabricConfiguration(translateTo, novaNodeTemplate.getType(), portResource)); + } } 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 b3ea6319b2..5e5bda3997 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 @@ -33,6 +33,7 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile; +import org.openecomp.sdc.tosca.services.ToscaFileOutputService; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; import org.openecomp.sdc.translator.TestUtils; import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; @@ -123,6 +124,7 @@ public class BaseResourceTranslationTest { } return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); + } 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/ResourceTranslationNovaServerImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java index 6e1653137a..ae493bbebc 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java @@ -20,9 +20,13 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; +import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType; +import org.togglz.testing.TestFeatureManagerProvider; import java.io.IOException; @@ -36,6 +40,13 @@ public class ResourceTranslationNovaServerImplTest extends BaseResourceTranslati public void setUp() throws IOException { // do not delete this function. it prevents the superclass setup from running } + + @BeforeClass + public static void enablefabricConfigurationTagging() { + manager.enable(ToggleableFeature.FABRIC_CONFIGURATION); + TestFeatureManagerProvider.setFeatureManager(manager); + } + @Test public void testTranslate() throws Exception { @@ -110,4 +121,13 @@ public class ResourceTranslationNovaServerImplTest extends BaseResourceTranslati } + @AfterClass + public static void disableVLANTagging() { + manager.disable(ToggleableFeature.FABRIC_CONFIGURATION); + manager = null; + TestFeatureManagerProvider.setFeatureManager(null); + } + + + } |