-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;
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<>();
//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.
* @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()
filterExternalPorts(toscaServiceModel);
//Handle external port changes
handleExternalPorts(toscaServiceModel);
- mdcDataDebugMessage.debugExitMessage(null);
return errors;
}
}
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();