Merge "forwarder GT"
authorAvi Gaffa <avi.gaffa@amdocs.com>
Tue, 14 Nov 2017 07:03:21 +0000 (07:03 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 14 Nov 2017 07:03:21 +0000 (07:03 +0000)
24 files changed:
docs/release-notes.rst
onboarding/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java [new file with mode: 0644]
openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/TogglzConfiguration.java [new file with mode: 0644]
openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/healingConfiguration.json
openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java [new file with mode: 0644]
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
openecomp-be/pom.xml
sdc-os-chef/pom.xml
sdc-os-chef/scripts/docker_run.sh
sdc-os-chef/sdc-backend/Dockerfile
sdc-os-chef/sdc-cassandra/Dockerfile
sdc-os-chef/sdc-elasticsearch/Dockerfile
sdc-os-chef/sdc-frontend/Dockerfile
sdc-os-chef/sdc-kibana/Dockerfile
sdc-os-chef/sdc-sanity/Dockerfile
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
utils/webseal-simulator/pom.xml
utils/webseal-simulator/sdc-simulator/Dockerfile

index 800d53b..5d8ea01 100644 (file)
@@ -23,10 +23,25 @@ SDC SDKs Versions
 -  sdc-tosca
 
    :Version: 1.1.32
+   
+
+Release Purpose
+----------------
+The Amsterdam release is the first OMAP release.
+This release is focused on creating a merged architecture between the OpenECOMP and OpenO comonents.
+In addition, the release enhances the list of supported use cases to support the `VoLTE <https://wiki.onap.org/pages/viewpage.action?pageId=6593603>`_ snd 'vCPE <https://wiki.onap.org/pages/viewpage.action?pageId=3246168>`_ use cases.
 
 New Features
 ------------
 
+Main Fetures
+-  Full and comprehensive VNF/Software Application(VF) and service design
+-  Collaborative design
+-  VNF/VF/SERVICE testing and certification
+-  Distribution to ONAP
+-  External API- for VNF/VF and  service 
+-  Integration with BSS / Customer ordering.
+
 **Epics**
 
 -  [`SDC-52 <https://jira.onap.org/browse/SDC-52>`__\ ] - SDC Opensource
@@ -72,8 +87,6 @@ New Features
    integration with VFC
 -  [`SDC-219 <https://jira.onap.org/browse/SDC-219>`__\ ] - Support for
    uCPE usecase
--  [`SDC-220 <https://jira.onap.org/browse/SDC-220>`__\ ] - integrate
-   VNF onboarding using VNF-SDK
 -  [`SDC-287 <https://jira.onap.org/browse/SDC-287>`__\ ] - catalog
    support TOSCA CSAR import and distribution
 -  [`SDC-326 <https://jira.onap.org/browse/SDC-326>`__\ ] - Support work
@@ -132,8 +145,6 @@ New Features
    quote input of start event for params
 -  [`SDC-161 <https://jira.onap.org/browse/SDC-161>`__\ ] - Remove
    MojoHaus Maven plug-in from pom file
--  [`SDC-222 <https://jira.onap.org/browse/SDC-222>`__\ ] - Retrive and
-   Desplay VNF provided by VNF-SDK
 -  [`SDC-223 <https://jira.onap.org/browse/SDC-223>`__\ ] - Attachment
    display changes - UI
 -  [`SDC-224 <https://jira.onap.org/browse/SDC-224>`__\ ] - Tosca based
@@ -223,91 +234,8 @@ New Features
 -  [`SDC-623 <https://jira.onap.org/browse/SDC-623>`__\ ] - Independent
    Versioning and Release Process
 
-**Tasks**
-
--  [`SDC-185 <https://jira.onap.org/browse/SDC-185>`__\ ] - [Doc]
-   Document SDC generated CSAR structure
--  [`SDC-246 <https://jira.onap.org/browse/SDC-246>`__\ ] - Set up
-   static analysis for on-boarding
--  [`SDC-258 <https://jira.onap.org/browse/SDC-258>`__\ ] - get param
-   from url
--  [`SDC-260 <https://jira.onap.org/browse/SDC-260>`__\ ] - add node
-   property edit panel
--  [`SDC-261 <https://jira.onap.org/browse/SDC-261>`__\ ] - Resolve the
-   String nullpoint problem in validateString() function
--  [`SDC-266 <https://jira.onap.org/browse/SDC-266>`__\ ] - change
-   component structure
--  [`SDC-271 <https://jira.onap.org/browse/SDC-271>`__\ ] - support get
-   dynamic swagger definition
--  [`SDC-281 <https://jira.onap.org/browse/SDC-281>`__\ ] - support
-   swagger definition for microservice
--  [`SDC-284 <https://jira.onap.org/browse/SDC-284>`__\ ] - get
-   parameters from definition
--  [`SDC-285 <https://jira.onap.org/browse/SDC-285>`__\ ] - support set
-   path and query parameters for rest task
--  [`SDC-316 <https://jira.onap.org/browse/SDC-316>`__\ ] - support
-   multi element drag
--  [`SDC-336 <https://jira.onap.org/browse/SDC-336>`__\ ] - support
-   workflow variable to be parameter
--  [`SDC-362 <https://jira.onap.org/browse/SDC-362>`__\ ] - adjust css
-   style for tree node
--  [`SDC-382 <https://jira.onap.org/browse/SDC-382>`__\ ] - Add Python
-   to Cassandra base docker
--  [`SDC-439 <https://jira.onap.org/browse/SDC-439>`__\ ] - add consumer
--  [`SDC-462 <https://jira.onap.org/browse/SDC-462>`__\ ] - Deploy
-   workflow designer in VM
--  [`SDC-475 <https://jira.onap.org/browse/SDC-475>`__\ ] - Update
-   gitignore
--  [`SDC-478 <https://jira.onap.org/browse/SDC-478>`__\ ] - Sanity
-   docker build & vLB + vCSCF\_aligned VNF addition
--  [`SDC-487 <https://jira.onap.org/browse/SDC-487>`__\ ] - remove neo4j
-   classes
--  [`SDC-496 <https://jira.onap.org/browse/SDC-496>`__\ ] - debug csit
-   sanity failure
--  [`SDC-524 <https://jira.onap.org/browse/SDC-524>`__\ ] - move docker
-   pull credentials from settings.xml to pom
--  [`SDC-527 <https://jira.onap.org/browse/SDC-527>`__\ ] - Update
-   SDC-Simulator base image to the latest
--  [`SDC-553 <https://jira.onap.org/browse/SDC-553>`__\ ] - improve
-   build time
--  [`SDC-569 <https://jira.onap.org/browse/SDC-569>`__\ ] - revert
-   changes to sdc tosca and jtosca
--  [`SDC-577 <https://jira.onap.org/browse/SDC-577>`__\ ] - Change of
-   SDC artifact generator version from v10 to v11 for Amsterdam
--  [`SDC-585 <https://jira.onap.org/browse/SDC-585>`__\ ] - pom.xml
-   alignment - sdc-docker-base
--  [`SDC-635 <https://jira.onap.org/browse/SDC-635>`__\ ] - Updating
-   schema from V11 to V10
--  [`SDC-636 <https://jira.onap.org/browse/SDC-636>`__\ ] - add docs for
-   workflow designer
--  [`SDC-644 <https://jira.onap.org/browse/SDC-644>`__\ ] - Fix doc8
-   errors
-
-**Sub-task**
-
--  [`SDC-372 <https://jira.onap.org/browse/SDC-372>`__\ ] - document
-   jenkins triggers
--  [`SDC-377 <https://jira.onap.org/browse/SDC-377>`__\ ] - create tast
-   case, docker init logic and push to integration project
--  [`SDC-378 <https://jira.onap.org/browse/SDC-378>`__\ ] - create
-   Jenkins jobs to trigger csit test cases
--  [`SDC-419 <https://jira.onap.org/browse/SDC-419>`__\ ] - Setup Read
-   The Docs for SDC
--  [`SDC-530 <https://jira.onap.org/browse/SDC-530>`__\ ] - remove all
-   use of snapshoots from the code
--  [`SDC-542 <https://jira.onap.org/browse/SDC-542>`__\ ] - sanity
-   stabilization
--  [`SDC-551 <https://jira.onap.org/browse/SDC-551>`__\ ] - Fix typos
-   and error/warning messages from sphinx-build
--  [`SDC-563 <https://jira.onap.org/browse/SDC-563>`__\ ] - add tosca
-   parser verification step in onboarding test
--  [`SDC-579 <https://jira.onap.org/browse/SDC-579>`__\ ] - fill SDC
-   SDKs
--  [`SDC-611 <https://jira.onap.org/browse/SDC-611>`__\ ] - sanity
-   stabilization
-
-
-**One or two sentences explaining the purpose of this Release.**
+
+
 
 Bug Fixes
 ---------
index d3023c5..9a10b0f 100644 (file)
@@ -97,6 +97,7 @@
         <zusammen-state-store.version>0.2.2</zusammen-state-store.version>
         <pmd.version>5.8.1</pmd.version>
         <build.tools.version>${project.version}</build.tools.version>
+        <togglz.version>2.4.1.Final</togglz.version>
     </properties>
 
     <build>
index 08e8dd8..35865f9 100644 (file)
         <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 (file)
index 0000000..aab9845
--- /dev/null
@@ -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 (file)
index 0000000..d743205
--- /dev/null
@@ -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);
+  }
+}
index 9f83296..4e1b0df 100644 (file)
@@ -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 (file)
index 0000000..038a0d8
--- /dev/null
@@ -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);
+
+  }
+}
index d401e49..895b3f9 100644 (file)
@@ -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,
index 59dea8a..d0364e7 100644 (file)
@@ -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);
index 62f3c07..528db5e 100644 (file)
@@ -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();
index 722c286..4512fce 100644 (file)
 
 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;
-  }
 }
index 442b7de..3934f41 100644 (file)
             <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>
index 1630b31..f0bf6ec 100644 (file)
                         <configuration>
                             <verbose>true</verbose>
                             <apiVersion>1.23</apiVersion>
-                            <registry>nexus3.onap.org:10003</registry>
+                            <registry>nexus3.onap.org:10001</registry>
                             <authConfig>
                                 <pull>
                                        <username>docker</username>
index 08be852..b147c81 100755 (executable)
@@ -64,27 +64,27 @@ DEBUG_PORT="--publish 4000:4000"
 [ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)      || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
 [ -f /opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=ecomp-nexus:${PORT}
 
-while [ "$1" != "" ]; do
+while test $# -gt 0; do
     case $1 in
         -r | --release )
             shift
-            RELEASE=${1}
+            RELEASE=$1
             ;;
         -e | --environment )
                        shift
-            DEP_ENV=${1}
+            DEP_ENV=$1
             ;;
                -p | --port )
             shift
-            PORT=${1}
+            PORT=$1
                        ;;
-               -l | --local )
-               shift
-               LOCAL=true
-               ;;
-               -s | --skipTests )
-               shift
-               SKIPTESTS=true
+       -l | --local )
+           shift
+           LOCAL=true
+           ;;
+       -s | --skipTests )
+          shift
+          SKIPTESTS=true
                ;;
         -h | --help )
                        usage
@@ -94,9 +94,9 @@ while [ "$1" != "" ]; do
                usage
             exit 1
     esac
-    shift
 done
 
+
 [ -f /opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
 
 
index e28a85d..ecd245a 100644 (file)
@@ -1,4 +1,4 @@
-FROM openecomp/base_sdc-backend:1.0.0-SNAPSHOT-latest
+FROM openecomp/base_sdc-backend:v1.0.0
 
 COPY chef-solo /root/chef-solo/
 
index 6066aeb..27cbc92 100644 (file)
@@ -1,4 +1,4 @@
-FROM openecomp/base_sdc-cassandra:1.0.0-SNAPSHOT-latest
+FROM openecomp/base_sdc-cassandra:v1.0.0
 
 COPY chef-solo /root/chef-solo/
 
index 60db8e5..4f1463d 100644 (file)
@@ -1,4 +1,4 @@
-FROM openecomp/base_sdc-elasticsearch:1.0.0-SNAPSHOT-latest
+FROM openecomp/base_sdc-elasticsearch:v1.0.0
 
 COPY chef-solo /root/chef-solo/
 
index 5039b08..2940a43 100644 (file)
@@ -1,4 +1,4 @@
-FROM openecomp/base_sdc-frontend:1.0.0-SNAPSHOT-latest
+FROM openecomp/base_sdc-frontend:v1.0.0
 
 COPY chef-solo /root/chef-solo/
 
index 6a058de..ccaa350 100644 (file)
@@ -1,4 +1,4 @@
-FROM openecomp/base_sdc-kibana:1.0.0-SNAPSHOT-latest
+FROM openecomp/base_sdc-kibana:v1.0.0
 
 COPY chef-solo /root/chef-solo/
 
index 38bf266..1dd064a 100644 (file)
@@ -1,4 +1,4 @@
-FROM openecomp/base_sdc-sanity:1.0.0-SNAPSHOT-latest
+FROM openecomp/base_sdc-sanity:v1.0.0
 
 COPY chef-solo /root/chef-solo/
 
index 71735d5..0e0a974 100644 (file)
@@ -24,6 +24,7 @@ import static org.testng.AssertJUnit.assertEquals;
 
 import java.util.Map;
 
+import org.codehaus.jackson.map.DeserializationConfig;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
 import org.openecomp.sdc.be.model.User;
@@ -123,6 +124,7 @@ public class ConsumerRestUtils extends BaseRestUtils {
                String bodyToParse = restResponse.getResponse();
                ObjectMapper mapper = new ObjectMapper();
                try {
+                       mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                        ConsumerDataDefinition component = mapper.readValue(bodyToParse, ConsumerDataDefinition.class);
                        return component;
                } catch (Exception e) {
index 9595383..7789231 100644 (file)
@@ -215,6 +215,7 @@ public class ResponseParser {
                mapper.registerModule(module);
                ComponentInstanceProperty propertyDefinition = null;
                try {
+                       mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                        propertyDefinition = mapper.readValue(response, ComponentInstanceProperty.class);
                        logger.debug(propertyDefinition.toString());
                } catch (IOException e) {
@@ -233,7 +234,7 @@ public class ResponseParser {
                ObjectMapper mapper = new ObjectMapper();
                ArtifactDefinition artifactDefinition = null;
                try {
-
+                       mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                        artifactDefinition = mapper.readValue(response, ArtifactDefinition.class);
                        logger.debug(artifactDefinition.toString());
                } catch (IOException e) {
@@ -273,6 +274,7 @@ public class ResponseParser {
                JsonDeserializer<PropertyConstraint> desrializer = new PropertyConstraintJacksonDeserialiser();
                addDeserializer(module, PropertyConstraint.class, desrializer);
                mapper.registerModule(module);
+               mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                try {
                        object = mapper.readValue(json, clazz);
                        // System.out.println("Class: "+clazz.getSimpleName()+", json:
@@ -311,6 +313,8 @@ public class ResponseParser {
                mapper.registerModule(module);
                Service service = null;
                try {
+//                     TODO Andrey L. uncomment line below in case to ignore on unknown properties, not recommended, added by Matvey
+                       mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                        service = mapper.readValue(response, Service.class);
                        logger.debug(service.toString());
                } catch (IOException e) {
@@ -334,6 +338,7 @@ public class ResponseParser {
                
                Product product = null;
                try {
+                       mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                        product = mapper.readValue(response, Product.class);
                        logger.debug(product.toString());
                } catch (IOException e) {
@@ -355,6 +360,7 @@ public class ResponseParser {
                mapper.registerModule(module);
                ComponentInstance componentInstance = null;
                try {
+                       mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                        componentInstance = mapper.readValue(response, ComponentInstance.class);
                        logger.debug(componentInstance.toString());
                } catch (IOException e) {
index fb60abd..e240da6 100644 (file)
                                                <configuration>
                                                        <verbose>true</verbose>
                                                        <apiVersion>1.23</apiVersion>
-                                                       <registry>nexus3.onap.org:10003</registry>
+                                                       <registry>nexus3.onap.org:10001</registry>
                             <authConfig>
                                 <pull>
                                                    <username>docker</username>
index e1a415f..99fad58 100644 (file)
@@ -1,4 +1,4 @@
-FROM openecomp/base_sdc-frontend:1.0.0-SNAPSHOT-latest
+FROM openecomp/base_sdc-frontend:v1.0.0
 
 COPY chef-solo /root/chef-solo/