summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main/java/org
diff options
context:
space:
mode:
authorMichal Banka <michal.banka@nokia.com>2020-05-20 10:12:11 +0200
committerBogumil Zebek <bogumil.zebek@nokia.com>2020-05-21 07:30:21 +0000
commitdd77214f4d619637975b7ac28219446a454abc5a (patch)
treed0eda4282660dc598dcb0f50f82c8f13266a6101 /csarvalidation/src/main/java/org
parent0bb03735689b28dee661bb2d59dfc56f44cf9e2c (diff)
Add file extension checking to R972082
Change-Id: If67fce758fdeac29bbb1450892d89a424fdb7c84 Signed-off-by: Michal Banka <michal.banka@nokia.com> Issue-ID: VNFSDK-585
Diffstat (limited to 'csarvalidation/src/main/java/org')
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java
index 60bdd47..4b35328 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082.java
@@ -115,6 +115,16 @@ public class VTPValidateCSARR972082 extends VTPValidateCSARBase {
}
}
+ private static class InvalidFileExtensionError extends PnfCSARError {
+
+ private InvalidFileExtensionError(final String fileName) {
+ super(ERROR_CODE,
+ String.format("Invalid. File extension %s is invalid", fileName),
+ UNKNOWN_LINE_NUMBER,
+ fileName);
+ }
+ }
+
private static class ValidateNonManoSection {
private static final String ATTRIBUTE_NAME = "onap_pnf_sw_information";
@@ -187,6 +197,9 @@ public class VTPValidateCSARR972082 extends VTPValidateCSARBase {
if (StringUtils.isEmpty(swInformationFilePath)) {
errors.add(new MissingSourceElementUnderAttributeError("", swInformationFilePath));
return;
+ } else if (!swInformationFilePath.matches(".*\\.yaml$")) {
+ errors.add(new InvalidFileExtensionError(swInformationFilePath));
+ return;
}
final Optional<PnfSoftwareInformation> parsedYaml = parse(swInformationFilePath);
if (!parsedYaml.isPresent()) {