change capabilities datatype
[sdc.git] / openecomp-be / lib / openecomp-sdc-enrichment-lib / openecomp-sdc-enrichment-impl / src / main / java / org / openecomp / sdc / enrichment / impl / tosca / PortMirroringEnricher.java
index 705773d..629868c 100644 (file)
@@ -1,14 +1,26 @@
-package org.openecomp.sdc.enrichment.impl.tosca;
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * 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.
+ */
 
-import static org.openecomp.sdc.tosca.services.DataModelUtil.getClonedObject;
-import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME;
-import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_ID;
+package org.openecomp.sdc.enrichment.impl.tosca;
 
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
 import org.openecomp.sdc.datatypes.error.ErrorMessage;
 import org.openecomp.sdc.enrichment.impl.tosca.model.PortMirroringConnectionPointDescription;
-import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
 import org.openecomp.sdc.tosca.datatypes.ToscaElementTypes;
 import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
@@ -39,6 +51,10 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import static org.openecomp.sdc.tosca.services.DataModelUtil.getClonedObject;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME;
+import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_ID;
+
 public class PortMirroringEnricher {
   //Map of service template file name and map of all port node template ids, node template
   private Map<String, Map<String, NodeTemplate>> portNodeTemplates = new HashMap<>();
@@ -47,9 +63,8 @@ public class PortMirroringEnricher {
   //Map of substitution service template name and the list of ports with link requirement from
   // the abstract
   private Map<String, List<String>> portNodeTemplateIdsFromAbstract = new HashMap<>();
-  private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
   private Map<String, ServiceTemplate> globalTypesServiceTemplate =
-      GlobalTypesGenerator.getGlobalTypesServiceTemplate();
+      GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP);
 
   /**
    * Enrich tosca for port mirroring.
@@ -58,7 +73,6 @@ public class PortMirroringEnricher {
    * @return the map          Error descriptor map
    */
   public Map<String, List<ErrorMessage>> enrich(ToscaServiceModel toscaServiceModel) {
-    mdcDataDebugMessage.debugEntryMessage(null);
     Map<String, List<ErrorMessage>> errors = new HashMap<>();
     Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
     serviceTemplates.entrySet().stream()
@@ -72,7 +86,6 @@ public class PortMirroringEnricher {
     filterExternalPorts(toscaServiceModel);
     //Handle external port changes
     handleExternalPorts(toscaServiceModel);
-    mdcDataDebugMessage.debugExitMessage(null);
     return errors;
   }
 
@@ -244,10 +257,6 @@ public class PortMirroringEnricher {
   }
 
   private void addPortMirroringCapability(NodeTemplate portNodeTemplate) {
-    List<Map<String, CapabilityAssignment>> capabilities = portNodeTemplate.getCapabilities();
-    if (Objects.isNull(capabilities)) {
-      capabilities = new ArrayList<>();
-    }
     Map<String, Object> portMirroringCapabilityProperties = new HashMap<>();
     PortMirroringConnectionPointDescription connectionPoint = new
         PortMirroringConnectionPointDescription();