summaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java63
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java78
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/MANIFEST.json27
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.env0
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.yaml14
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/firstVol.yaml1
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/second.yaml14
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/MANIFEST.json27
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.env0
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.yaml26
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/firstVol.yaml1
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/second.yaml14
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java43
13 files changed, 234 insertions, 74 deletions
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 04771e023e..424f8d3517 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,9 @@
package org.openecomp.sdc.validation.impl.validators;
import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.core.validation.ErrorMessageCode;
+import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.validation.Validator;
@@ -30,6 +33,12 @@ import java.util.Set;
public class SharedResourceGuideLineValidator implements Validator {
public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+ private static final ErrorMessageCode ERROR_CODE_SRG_1 = new ErrorMessageCode("SRG1");
+ private static final ErrorMessageCode ERROR_CODE_SRG_2 = new ErrorMessageCode("SRG2");
+ private static final ErrorMessageCode ERROR_CODE_SRG_3 = new ErrorMessageCode("SRG3");
+ private static final ErrorMessageCode ERROR_CODE_SRG_4 = new ErrorMessageCode("SRG4");
+ private static final ErrorMessageCode ERROR_CODE_SRG_5 = new ErrorMessageCode("SRG5");
+ private static final ErrorMessageCode ERROR_CODE_SRG_6 = new ErrorMessageCode("SRG6");
@Override
public void validate(GlobalValidationContext globalContext) {
@@ -41,7 +50,7 @@ public class SharedResourceGuideLineValidator implements Validator {
return;
}
- Set<String> baseFiles = ValidationUtil.validateManifest(manifestContent, globalContext);
+ Set<String> baseFiles = validateManifest(manifestContent, globalContext);
Map<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent);
Map<String, FileData> fileEnvMap = ManifestUtil.getFileAndItsEnv(manifestContent);
@@ -55,10 +64,47 @@ public class SharedResourceGuideLineValidator implements Validator {
}
+ private Set<String> validateManifest(ManifestContent manifestContent,
+ GlobalValidationContext globalContext) {
+ mdcDataDebugMessage.debugEntryMessage("file", SdcCommon.MANIFEST_NAME);
+ Set<String> baseFiles = ManifestUtil.getBaseFiles(manifestContent);
+ if (baseFiles == null || baseFiles.size() == 0) {
+ globalContext.addMessage(
+ SdcCommon.MANIFEST_NAME,
+ ErrorLevel.WARNING,
+ ErrorMessagesFormatBuilder
+ .getErrorWithParameters(ERROR_CODE_SRG_3,Messages
+ .MISSIN_BASE_HEAT_FILE.getErrorMessage()),
+ LoggerTragetServiceName.VALIDATE_BASE_FILE,
+ LoggerErrorDescription.MISSING_BASE_HEAT);
+ } else if (baseFiles.size() > 1) {
+ String baseFileList = getElementListAsString(baseFiles);
+ globalContext.addMessage(
+ SdcCommon.MANIFEST_NAME,
+ ErrorLevel.WARNING,
+ ErrorMessagesFormatBuilder
+ .getErrorWithParameters(ERROR_CODE_SRG_4,Messages
+ .MULTI_BASE_HEAT_FILE.getErrorMessage(),
+ baseFileList),
+ LoggerTragetServiceName.VALIDATE_BASE_FILE,
+ LoggerErrorDescription.MULTI_BASE_HEAT);
+ }
+ mdcDataDebugMessage.debugExitMessage("file", SdcCommon.MANIFEST_NAME);
+ return baseFiles;
+ }
+
+ private static String getElementListAsString(Set<String> elementCollection) {
+ return "["
+ + CommonMethods.collectionToCommaSeparatedString(elementCollection)
+ + "]";
+ }
+
private void validate(String fileName, String envFileName, Map<String, FileData.Type> fileTypeMap,
Set<String> baseFiles, GlobalValidationContext globalContext) {
+ globalContext.setMessageCode(ERROR_CODE_SRG_5);
HeatOrchestrationTemplate
- heatOrchestrationTemplate = ValidationUtil.checkHeatOrchestrationPreCondition(fileName, globalContext);
+ heatOrchestrationTemplate = ValidationUtil
+ .checkHeatOrchestrationPreCondition(fileName, globalContext);
if (heatOrchestrationTemplate == null) {
return;
}
@@ -88,15 +134,15 @@ public class SharedResourceGuideLineValidator implements Validator {
}
Set<String> expectedExposedResources = new HashSet<>();
- Set<String> actualExposedResources = new HashSet<>();
heatOrchestrationTemplate.getResources()
.entrySet()
.stream()
.filter(entry -> ValidationUtil.isExpectedToBeExposed(entry.getValue().getType()))
.forEach(entry -> expectedExposedResources.add(entry.getKey()));
+ Set<String> actualExposedResources = new HashSet<>();
if (heatOrchestrationTemplate.getOutputs() != null) {
-
+ globalContext.setMessageCode(ERROR_CODE_SRG_6);
heatOrchestrationTemplate.getOutputs().entrySet()
.stream()
.filter(entry -> isPropertyValueGetResource(fileName, entry.getValue().getValue(),
@@ -105,7 +151,6 @@ public class SharedResourceGuideLineValidator implements Validator {
getResourceIdFromPropertyValue(fileName, entry.getValue().getValue(),
globalContext)));
}
-
ValidationUtil.removeExposedResourcesCalledByGetResource(fileName, actualExposedResources,
heatOrchestrationTemplate, globalContext);
@@ -117,7 +162,8 @@ public class SharedResourceGuideLineValidator implements Validator {
.forEach(name -> globalContext.addMessage(
fileName,
ErrorLevel.WARNING, ErrorMessagesFormatBuilder
- .getErrorWithParameters(Messages.RESOURCE_NOT_DEFINED_IN_OUTPUT.getErrorMessage(),
+ .getErrorWithParameters(ERROR_CODE_SRG_1,Messages
+ .RESOURCE_NOT_DEFINED_IN_OUTPUT.getErrorMessage(),
name),
LoggerTragetServiceName.VALIDATE_BASE_FILE,
LoggerErrorDescription.RESOURCE_NOT_DEFINED_AS_OUTPUT));
@@ -156,7 +202,7 @@ public class SharedResourceGuideLineValidator implements Validator {
.forEach(entry -> expectedExposedResources.add(entry.getKey()));
if (heatOrchestrationTemplate.getOutputs() != null) {
-
+ globalContext.setMessageCode(ERROR_CODE_SRG_6);
heatOrchestrationTemplate.getOutputs().entrySet()
.stream()
.filter(entry -> isPropertyValueGetResource(fileName, entry.getValue().getValue(),
@@ -174,7 +220,8 @@ public class SharedResourceGuideLineValidator implements Validator {
.forEach(name -> globalContext.addMessage(
fileName,
ErrorLevel.WARNING, ErrorMessagesFormatBuilder
- .getErrorWithParameters(Messages.VOLUME_HEAT_NOT_EXPOSED.getErrorMessage(), name),
+ .getErrorWithParameters(ERROR_CODE_SRG_2,Messages
+ .VOLUME_HEAT_NOT_EXPOSED.getErrorMessage(), name),
LoggerTragetServiceName.VALIDATE_VOLUME_FILE,
LoggerErrorDescription.VOLUME_FILE_NOT_EXPOSED));
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java
index 5994c23642..e7c2d37d32 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java
@@ -13,143 +13,169 @@ import java.util.Map;
*/
public class SharedResourceGuideLineValidatorTest {
+ private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/guideLineValidator";
Validator validator = new SharedResourceGuideLineValidator();
@Test
public void testBaseHeatExposeNetwork() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/positive/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeNetwork/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/negative/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeNetwork/negative/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Resource is not defined as output and thus cannot be Shared, Resource ID [SecurityGroup_expose]");
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [SecurityGroup_expose]");
+ }
+
+ @Test
+ public void testParseException(){
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ RESOURCE_PATH + "/baseHeatDoesNotExposeNetwork/parseException/");
+ Assert.assertEquals(messages.size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "ERROR: [SRG5]: Invalid HEAT format problem - [while scanning for the next token\n" +
+ "found character '\\t(TAB)' that cannot start any token. (Do not use \\t(TAB) for indentation)\n" +
+ " in 'reader', line 5, column 1:\n" +
+ " \t\t\tresources:\n" +
+ " ^\n" +
+ "]");
+ }
+
+ @Test
+ public void testInvalidGetResource(){
+ Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ RESOURCE_PATH + "/" +
+ "baseHeatDoesNotExposeNetworkInvalidGetResource");
+ Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [net_expose]");
+
}
@Test
public void testBaseHeatExposeNetworkAndVolume() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/positive/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeNetworkAndVolume/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkAndVolume/negative/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeNetworkAndVolume/negative/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 2);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Resource is not defined as output and thus cannot be Shared, Resource ID [volume_expose]");
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [volume_expose]");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(),
- "WARNING: Resource is not defined as output and thus cannot be Shared, Resource ID [net_expose]");
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [net_expose]");
}
@Test
public void testBaseHeatExposeServerGroup() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/positive/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeServerGroup/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeServerGroup/negative/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeServerGroup/negative/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Resource is not defined as output and thus cannot be Shared, Resource ID [ServerGroup_expose]");
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [ServerGroup_expose]");
}
@Test
public void testBaseHeatExposeSecurityGroup() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/positive/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeSecurityGroup/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeSecurityGroup/negative/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeSecurityGroup/negative/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Resource is not defined as output and thus cannot be Shared, Resource ID [SecurityGroup_expose]");
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [SecurityGroup_expose]");
}
@Test
public void testBaseHeatExposeVolume() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/positive/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeVolume/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeVolume/negative/");
+ RESOURCE_PATH + "/baseHeatDoesNotExposeVolume/negative/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Resource is not defined as output and thus cannot be Shared, Resource ID [volume_expose]");
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [volume_expose]");
}
@Test
public void testHeatVolumeExpose() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/positive/");
+ RESOURCE_PATH + "/heatVolumeExpose/positive/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/heatVolumeExpose/negative/");
+ RESOURCE_PATH + "/heatVolumeExpose/negative/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("firstVol.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("firstVol.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Volume is not defined as output and thus cannot be attached volume_expose");
+ "WARNING: [SRG2]: Volume is not defined as output and thus cannot be attached volume_expose");
}
@Test
public void testResourceIsExposedByCallingGetResourceNotFromOutput() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/positive");
+ RESOURCE_PATH + "/baseHeatExposeResourceUsingGetResource/positive");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 0);
messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/baseHeatExposeResourceUsingGetResource/negative");
+ RESOURCE_PATH + "/baseHeatExposeResourceUsingGetResource/negative");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("base_virc.yaml").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("base_virc.yaml").getErrorMessageList().get(0).getMessage(),
- "WARNING: Resource is not defined as output and thus cannot be Shared, Resource ID [virc_RSG]");
+ "WARNING: [SRG1]: Resource is not defined as output and thus cannot be Shared, Resource ID [virc_RSG]");
}
@Test
public void testMissingBaseHeat() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/missingBaseHeat/");
+ RESOURCE_PATH + "/missingBaseHeat/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("MANIFEST.json").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("MANIFEST.json").getErrorMessageList().get(0).getMessage(),
- "WARNING: Missing Base HEAT. Pay attention that without Base HEAT, there will be no shared resources");
+ "WARNING: [SRG3]: Missing Base HEAT. Pay attention that without Base HEAT, there will be no shared resources");
}
@Test
public void testMultiBaseHeat() {
Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
- "/org/openecomp/validation/validators/guideLineValidator/multiBaseHeat/");
+ RESOURCE_PATH + "/multiBaseHeat/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
Assert.assertEquals(messages.get("MANIFEST.json").getErrorMessageList().size(), 1);
Assert.assertEquals(messages.get("MANIFEST.json").getErrorMessageList().get(0).getMessage(),
- "WARNING: Multi Base HEAT. Expected only one. Files [second.yaml,first.yaml].");
+ "WARNING: [SRG4]: Multi Base HEAT. Expected only one. Files [second.yaml,first.yaml].");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/MANIFEST.json
new file mode 100644
index 0000000000..76ce6de6e6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/MANIFEST.json
@@ -0,0 +1,27 @@
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "file": "first.yaml",
+ "type": "HEAT",
+ "isBase": true,
+ "data": [
+ {
+ "file": "first.env",
+ "type": "HEAT_ENV"
+ },
+ {
+ "file": "firstVol.yaml",
+ "type": "HEAT_VOL"
+ }
+ ]
+ },
+ {
+ "file": "second.yaml",
+ "type": "HEAT",
+ "isBase": false
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.env
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.env
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.yaml
new file mode 100644
index 0000000000..e38e40de9f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/first.yaml
@@ -0,0 +1,14 @@
+heat_template_version: 2013-05-23
+
+description: heat expose volume resource
+
+ resources:
+ net_expose:
+ type: OS::Neutron::Net
+
+outputs:
+ expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: net_expose }
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/firstVol.yaml
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/firstVol.yaml
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/second.yaml
new file mode 100644
index 0000000000..bb06b9d60a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/second.yaml
@@ -0,0 +1,14 @@
+heat_template_version: 2013-05-23
+
+description: heat second
+
+resources:
+ network_expose:
+ type: OS::Neutron::Net
+
+outputs:
+ expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: network_expose }
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/MANIFEST.json
new file mode 100644
index 0000000000..76ce6de6e6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/MANIFEST.json
@@ -0,0 +1,27 @@
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "file": "first.yaml",
+ "type": "HEAT",
+ "isBase": true,
+ "data": [
+ {
+ "file": "first.env",
+ "type": "HEAT_ENV"
+ },
+ {
+ "file": "firstVol.yaml",
+ "type": "HEAT_VOL"
+ }
+ ]
+ },
+ {
+ "file": "second.yaml",
+ "type": "HEAT",
+ "isBase": false
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.env
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.env
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.yaml
new file mode 100644
index 0000000000..2ea7847b8b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/first.yaml
@@ -0,0 +1,26 @@
+heat_template_version: 2013-05-23
+
+description: heat expose volume resource
+
+parameters:
+ pcrf_oam_vol_name_2:
+ type: string
+ label: OAM volume name 2
+ description: Assigning name to volume
+
+resources:
+ net_expose:
+ type: OS::Neutron::Net
+
+ aaa:
+ type: OS::Neutron::Net
+ properties:
+ name: {get_param: pcrf_oam_vol_name_2}
+
+
+outputs:
+ expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: aaa }
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/firstVol.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/firstVol.yaml
new file mode 100644
index 0000000000..9e26dfeeb6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/firstVol.yaml
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/second.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/second.yaml
new file mode 100644
index 0000000000..bb06b9d60a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetworkInvalidGetResource/second.yaml
@@ -0,0 +1,14 @@
+heat_template_version: 2013-05-23
+
+description: heat second
+
+resources:
+ network_expose:
+ type: OS::Neutron::Net
+
+outputs:
+ expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: network_expose }
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java
index 217ff857f6..d9e0351578 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java
@@ -2,7 +2,6 @@ package org.openecomp.sdc.validation.util;
import org.apache.commons.collections4.CollectionUtils;
-import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
import org.openecomp.core.validation.types.GlobalValidationContext;
@@ -16,7 +15,6 @@ import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
import org.openecomp.sdc.heat.datatypes.model.Resource;
import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions;
import org.openecomp.sdc.heat.services.HeatStructureUtil;
-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;
@@ -229,8 +227,9 @@ public class ValidationUtil {
}
} catch (Exception exception) {
globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
- .getErrorWithParameters(Messages.INVALID_HEAT_FORMAT_REASON.getErrorMessage(),
- getParserExceptionReason(exception)),
+ .getErrorWithParameters(globalContext.getMessageCode(),
+ Messages.INVALID_HEAT_FORMAT_REASON.getErrorMessage()
+ , getParserExceptionReason(exception)),
LoggerTragetServiceName.VALIDATE_HEAT_FORMAT,
LoggerErrorDescription.INVALID_HEAT_FORMAT);
mdcDataDebugMessage.debugExitMessage("file", fileName);
@@ -240,41 +239,5 @@ public class ValidationUtil {
return heatOrchestrationTemplate;
}
- public static Set<String> validateManifest(ManifestContent manifestContent,
- GlobalValidationContext globalContext) {
-
- mdcDataDebugMessage.debugEntryMessage("file", SdcCommon.MANIFEST_NAME);
-
- Set<String> baseFiles = ManifestUtil.getBaseFiles(manifestContent);
- if (baseFiles == null || baseFiles.size() == 0) {
- globalContext.addMessage(
- SdcCommon.MANIFEST_NAME,
- ErrorLevel.WARNING,
- ErrorMessagesFormatBuilder
- .getErrorWithParameters(Messages.MISSIN_BASE_HEAT_FILE.getErrorMessage()),
- LoggerTragetServiceName.VALIDATE_BASE_FILE,
- LoggerErrorDescription.MISSING_BASE_HEAT);
- } else if (baseFiles.size() > 1) {
- String baseFileList = getElementListAsString(baseFiles);
- globalContext.addMessage(
- SdcCommon.MANIFEST_NAME,
- ErrorLevel.WARNING,
- ErrorMessagesFormatBuilder
- .getErrorWithParameters(Messages.MULTI_BASE_HEAT_FILE.getErrorMessage(),
- baseFileList),
- LoggerTragetServiceName.VALIDATE_BASE_FILE,
- LoggerErrorDescription.MULTI_BASE_HEAT);
- }
-
- mdcDataDebugMessage.debugExitMessage("file", SdcCommon.MANIFEST_NAME);
- return baseFiles;
- }
-
- private static String getElementListAsString(Set<String> elementCollection) {
-
- return "["
- + CommonMethods.collectionToCommaSeparatedString(elementCollection)
- + "]";
- }
}