1 package org.openecomp.vid.model;
3 import java.text.DateFormat;
4 import java.text.SimpleDateFormat;
5 import java.util.HashMap;
7 import java.util.regex.Pattern;
9 import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
10 import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
12 public class NewVNF extends NewNode {
14 /** The Constant LOG. */
15 private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VNF.class);
17 /** The Constant dateFormat. */
18 final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
20 /** The pattern used to normalize VNF names */
21 final static Pattern COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
23 /** The model customization name. */
24 private String modelCustomizationName;
26 /** The vf modules. */
27 private Map<String, VfModule> vfModules = new HashMap<String, VfModule>();
29 /** The volume groups. */
30 private Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup>();
33 * Instantiates a newvnf.
40 * Gets the model customization name.
42 * @return the model customization name
44 public String getModelCustomizationName() {
45 return modelCustomizationName;
49 * Gets the vf modules.
51 * @return the vf modules
53 public Map<String, VfModule> getVfModules() {
58 * Sets the vf modules.
60 * @param vfModules the vf modules
62 public void setVfModules(Map<String, VfModule> vfModules) {
63 this.vfModules = vfModules;
67 * Gets the volume groups.
69 * @return the volume groups
71 public Map<String, VolumeGroup> getVolumeGroups() {
76 * Sets the volume groups.
78 * @param volumeGroups the volume groups
80 public void setVolumeGroups(Map<String, VolumeGroup> volumeGroups) {
81 this.volumeGroups = volumeGroups;
86 * Sets the model customization name.
88 * @param modelCustomizationName the new model customization name
90 public void setModelCustomizationName(String modelCustomizationName) {
91 this.modelCustomizationName = modelCustomizationName;
94 * Normalize the VNF name
96 * @return the normalized name
98 public static String normalizeName (String originalName) {
100 String normalizedName = originalName.toLowerCase();
101 normalizedName = COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
102 String[] splitArr = null;
105 splitArr = normalizedName.split(" ");
107 catch (Exception ex ) {
108 return (normalizedName);
110 StringBuffer sb = new StringBuffer();
111 if ( splitArr != null ) {
112 for (String splitElement : splitArr) {
113 sb.append(splitElement);
115 return (sb.toString());
118 return (normalizedName);