summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java3
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java9
10 files changed, 71 insertions, 36 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java
index 485b4204c7..39362c7e10 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java
@@ -225,6 +225,7 @@ public class HeatValidationService {
throw new Exception("The file '" + nestedFileName + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
mdcDataDebugMessage.debugExitMessage("file", parentFileName);
return;
}
@@ -242,6 +243,7 @@ public class HeatValidationService {
throw new Exception("The file '" + parentFileName + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
mdcDataDebugMessage.debugExitMessage("file", parentFileName);
return;
}
@@ -374,6 +376,7 @@ public class HeatValidationService {
}
} catch (Exception exception) {
+ logger.debug("",exception);
logger.warn("HEAT Validator will not be executed on file " + nestedFileName
+ " due to illegal HEAT format");
@@ -462,6 +465,7 @@ public class HeatValidationService {
throw new Exception("The file '" + resourceType + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
return;
}
nestedOutputMap = nestedHeatOrchestrationTemplate.getOutputs();
@@ -511,6 +515,7 @@ public class HeatValidationService {
throw new Exception("The file '" + envFileName + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
mdcDataDebugMessage.debugExitMessage("env file", envFileName);
return null;
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java
index 39556795c7..7d90726dd1 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java
@@ -48,7 +48,7 @@ import java.util.Optional;
public class ContrailValidator implements Validator {
- public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
protected static Logger logger = (Logger) LoggerFactory.getLogger(ContrailValidator.class);
@Override
@@ -59,6 +59,7 @@ public class ContrailValidator implements Validator {
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ logger.debug("",exception);
return;
}
Map<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent);
@@ -148,6 +149,7 @@ public class ContrailValidator implements Validator {
heatOrchestrationTemplate =
new YamlUtil().yamlToObject(fileContent, HeatOrchestrationTemplate.class);
} catch (Exception ignored) {
+ logger.debug("",ignored);
// the HeatValidator should handle file that is failing to parse
mdcDataDebugMessage.debugExitMessage("file", fileName);
return Optional.empty();
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java
index 2531150eab..569f2bb760 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java
@@ -1,7 +1,6 @@
package org.openecomp.sdc.validation.impl.validators;
import org.apache.commons.collections4.MapUtils;
-import org.openecomp.sdc.validation.Validator;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
import org.openecomp.core.validation.types.GlobalValidationContext;
import org.openecomp.sdc.common.errors.Messages;
@@ -11,12 +10,14 @@ import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
import org.openecomp.sdc.heat.datatypes.model.Resource;
import org.openecomp.sdc.heat.services.manifest.ManifestUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.logging.types.LoggerErrorDescription;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.validation.Validator;
import org.openecomp.sdc.validation.util.ValidationUtil;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
@@ -29,6 +30,8 @@ public class ForbiddenResourceGuideLineValidator implements Validator {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private static Set<String> forbiddenResources = new HashSet<>();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
@Override
public void init(Map<String, Object> properties) {
Map<String, Map<String, Object>> forbiddenResourcesMap =
@@ -62,6 +65,7 @@ public class ForbiddenResourceGuideLineValidator implements Validator {
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ log.debug("",exception);
return;
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java
index 2712dab11c..1fda0ed783 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java
@@ -27,7 +27,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Optional;
import java.util.Set;
public class HeatResourceValidator extends ResourceBaseValidator {
@@ -48,7 +47,7 @@ public class HeatResourceValidator extends ResourceBaseValidator {
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
-
+ logger.debug("",exception);
}
Set<String> baseFiles = ManifestUtil.getBaseFiles(manifestContent);
String baseFileName = CollectionUtils.isEmpty(baseFiles) ? null : baseFiles.iterator().next();
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
index ddc1bb49b9..5297453369 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
@@ -55,7 +55,7 @@ import java.util.Objects;
import java.util.Set;
public class HeatValidator implements Validator {
- public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
protected static Logger logger = (Logger) LoggerFactory.getLogger(HeatValidator.class);
private static void validateAllRequiredArtifactsExist(String fileName,
@@ -244,7 +244,7 @@ public class HeatValidator implements Validator {
if (CollectionUtils.isNotEmpty(parametersNames)) {
for (Map.Entry<String, Object> envEntry : envContent.getParameters().entrySet()) {
String envParameter = envEntry.getKey();
- if (!parametersNames.contains(envParameter)) {
+ if (parametersNames != null && !parametersNames.contains(envParameter)) {
globalContext.addMessage(envFile, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
.getErrorWithParameters(
Messages.ENV_INCLUDES_PARAMETER_NOT_IN_HEAT.getErrorMessage(), envFile,
@@ -278,7 +278,7 @@ public class HeatValidator implements Validator {
Map<String, Parameter> parametersMap = heatOrchestrationTemplate.getParameters() == null ? null
: heatOrchestrationTemplate.getParameters();
- if (MapUtils.isNotEmpty(parametersMap)) {
+ if (parametersMap != null && MapUtils.isNotEmpty(parametersMap)) {
for (Map.Entry<String, Parameter> parameterEntry : parametersMap.entrySet()) {
Parameter parameter = parameterEntry.getValue();
String parameterType = parameter.getType();
@@ -343,6 +343,7 @@ public class HeatValidator implements Validator {
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ logger.debug("",exception);
return;
}
String baseFileName;
@@ -370,7 +371,8 @@ public class HeatValidator implements Validator {
Set<String> manifestArtifacts = ManifestUtil.getArtifacts(manifestContent);
globalContext.getFiles().stream()
- .filter(fileName -> manifestArtifacts.contains(fileName) && !artifacts.contains(fileName))
+ .filter(fileName -> isManifestArtifact(manifestArtifacts, fileName) &&
+ isNotArtifact(artifacts, fileName))
.forEach(fileName -> globalContext.addMessage(fileName, ErrorLevel.WARNING,
Messages.ARTIFACT_FILE_NOT_REFERENCED.getErrorMessage(),
LoggerTragetServiceName.CHECK_FOR_ORPHAN_ARTIFACTS,
@@ -380,6 +382,14 @@ public class HeatValidator implements Validator {
}
+ private boolean isManifestArtifact(Set<String> manifestArtifacts, String fileName) {
+ return manifestArtifacts.contains(fileName);
+ }
+
+ private boolean isNotArtifact(Set<String> artifacts, String fileName) {
+ return !artifacts.contains(fileName);
+ }
+
private void validate(String fileName, String envFileName, String baseFileName,
Set<String> artifacts, Set<String> securityGroupsNamesFromBaseFileOutputs,
GlobalValidationContext globalContext) {
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java
index 43cafb494c..79c4dc2d96 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java
@@ -45,7 +45,7 @@ import java.util.Optional;
public class ManifestValidator implements Validator {
- public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private static Logger logger = (Logger) LoggerFactory.getLogger(YamlValidator.class);
@Override
@@ -65,6 +65,7 @@ public class ManifestValidator implements Validator {
throw new Exception("The manifest file '" + SdcCommon.MANIFEST_NAME + "' has no content");
}
} catch (Exception re) {
+ logger.debug("",re);
globalContext.addMessage(SdcCommon.MANIFEST_NAME, ErrorLevel.ERROR,
Messages.INVALID_MANIFEST_FILE.getErrorMessage(),
LoggerTragetServiceName.VALIDATE_MANIFEST_CONTENT,
@@ -80,7 +81,7 @@ public class ManifestValidator implements Validator {
LoggerTragetServiceName.VALIDATE_FILE_IN_ZIP, LoggerErrorDescription.MISSING_FILE));
globalContext.getFileContextMap().keySet().stream().filter(name ->
- !manifestFiles.contains(name) && !SdcCommon.MANIFEST_NAME.equals(name)
+ isNotManifestFiles(manifestFiles, name) && isNotManifestName(name)
).forEach(name ->
globalContext.addMessage(name, ErrorLevel.WARNING,
Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage(),
@@ -90,6 +91,14 @@ public class ManifestValidator implements Validator {
mdcDataDebugMessage.debugExitMessage(null, null);
}
+ private boolean isNotManifestFiles(List<String> manifestFiles, String name) {
+ return !manifestFiles.contains(name);
+ }
+
+ private boolean isNotManifestName(String name) {
+ return !SdcCommon.MANIFEST_NAME.equals(name);
+ }
+
private List<String> getManifestFileList(ManifestContent manifestContent,
GlobalValidationContext context) {
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java
index f3af7d7e48..04771e023e 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java
@@ -1,6 +1,8 @@
package org.openecomp.sdc.validation.impl.validators;
import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.validation.Validator;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
import org.openecomp.core.validation.types.GlobalValidationContext;
@@ -26,7 +28,8 @@ import java.util.Set;
* Created by TALIO on 2/15/2017.
*/
public class SharedResourceGuideLineValidator implements Validator {
- public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
@Override
public void validate(GlobalValidationContext globalContext) {
@@ -34,6 +37,7 @@ public class SharedResourceGuideLineValidator implements Validator {
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ log.debug("",exception);
return;
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java
index 445e1c2e3d..0fded4f58e 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java
@@ -39,7 +39,7 @@ import java.util.Map;
import java.util.Optional;
public class YamlValidator implements Validator {
- public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private static final Logger logger = (Logger) LoggerFactory.getLogger(YamlValidator.class);
@Override
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java
index 5dc42c9b9a..d05f2813ff 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java
@@ -90,25 +90,26 @@ public class NovaServerResourceValidator implements ResourceValidator {
return;
}
- for (Object serverGroupValue : schedulerHintsMap.values()) {
- if(!(serverGroupValue instanceof Map)){
- continue;
- }
- Map<String, Object> currentServerMap = (Map<String, Object>) serverGroupValue;
- String serverResourceName =
- currentServerMap == null ? null : (String) currentServerMap
- .get(ResourceReferenceFunctions.GET_RESOURCE.getFunction());
- Resource serverResource =
- serverResourceName == null || resourcesMap == null ? null
- : resourcesMap.get(serverResourceName);
-
- if (serverResource != null && !serverResource.getType()
- .equals(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource())) {
- globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
- .getErrorWithParameters(Messages.SERVER_NOT_DEFINED_FROM_NOVA.getErrorMessage(),
- serverResourceName, resourceEntry.getKey()),
- LoggerTragetServiceName.VALIDATE_SERVER_GROUP_EXISTENCE,
- LoggerErrorDescription.SERVER_NOT_DEFINED_NOVA);
+ if (schedulerHintsMap != null) {
+ for (Object serverGroupValue : schedulerHintsMap.values()) {
+ if (!(serverGroupValue instanceof Map)) {
+ continue;
+ }
+ Map<String, Object> currentServerMap = (Map<String, Object>) serverGroupValue;
+ String serverResourceName = (String) currentServerMap
+ .get(ResourceReferenceFunctions.GET_RESOURCE.getFunction());
+ Resource serverResource =
+ serverResourceName == null || resourcesMap == null ? null
+ : resourcesMap.get(serverResourceName);
+
+ if (serverResource != null && !serverResource.getType()
+ .equals(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource())) {
+ globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
+ .getErrorWithParameters(Messages.SERVER_NOT_DEFINED_FROM_NOVA.getErrorMessage(),
+ serverResourceName, resourceEntry.getKey()),
+ LoggerTragetServiceName.VALIDATE_SERVER_GROUP_EXISTENCE,
+ LoggerErrorDescription.SERVER_NOT_DEFINED_NOVA);
+ }
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java
index 6016ba0cb8..299eabf4e5 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java
@@ -564,11 +564,12 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal
private String getVmName(String nameToGetVmNameFrom, String stringToGetIndexOf) {
int vmIndex =
nameToGetVmNameFrom == null ? -1 : nameToGetVmNameFrom.indexOf(stringToGetIndexOf);
- String vmName = vmIndex < 0 ? null
- : trimNonAlphaNumericCharactersFromEndOfString(nameToGetVmNameFrom.substring(0, vmIndex));
-
+ String vmName = null;
+ if (nameToGetVmNameFrom != null) {
+ vmName = vmIndex < 0 ? null
+ : trimNonAlphaNumericCharactersFromEndOfString(nameToGetVmNameFrom.substring(0, vmIndex));
+ }
return vmName;
-
}
private boolean isVmNameSync(List<String> namesToCompare) {