summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'csarvalidation/src/main/java/org/onap')
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/csar/CommonConstants.java4
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java41
2 files changed, 44 insertions, 1 deletions
diff --git a/csarvalidation/src/main/java/org/onap/validation/csar/CommonConstants.java b/csarvalidation/src/main/java/org/onap/validation/csar/CommonConstants.java
index 29c4bdf..5f4e053 100644
--- a/csarvalidation/src/main/java/org/onap/validation/csar/CommonConstants.java
+++ b/csarvalidation/src/main/java/org/onap/validation/csar/CommonConstants.java
@@ -45,6 +45,10 @@ public class CommonConstants {
public static final String MAINSERV_TEMPLATE = "MainServiceTemplate.yaml";
+ public static final String TOSCA_SWIMAGE = "tosca.artifacts.nfv.SwImage";
+
+ public static final String TOSCA_IMAGE = "tosca.artifacts.Deployment.Image";
+
public static final String CSAR_SUFFIX = ".csar";
public static final String HTTP_HEADER_CONTENT_RANGE = "Content-Range";
diff --git a/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java b/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java
index 88cd0e0..d27aa5a 100644
--- a/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java
+++ b/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java
@@ -108,6 +108,8 @@ public class CsarValidator {
String vms = validateMainService();
+ //String r02454 = r02454();
+
if((CommonConstants.SUCCESS_STR != vsm) && (CommonConstants.SUCCESS_STR != vms)) {
return vsm + " OR " + vms;
@@ -116,7 +118,11 @@ public class CsarValidator {
if(CommonConstants.SUCCESS_STR != vtm) {
return vtm;
}
-
+/*
+ if (CommonConstants.SUCCESS_STR != r02454) {
+ return r02454;
+ }
+*/
return CommonConstants.SUCCESS_STR;
}
@@ -291,12 +297,45 @@ public class CsarValidator {
if(!Paths.get(MAINSERV_TEMPLATE).isAbsolute()) {
mainservTemplate = csarFiles.get(FilenameUtils.getName(mainservTemplate));
}
+
if(StringUtils.isEmpty(mainservTemplate)) {
return "MainServiceTemplate does not exist in the package";
}
return CommonConstants.SUCCESS_STR;
}
+ /*
+ * @Author: Victor Gao
+ * @Description:
+ * @Date: 2018/9/18
+ * @Param: [filePath]
+ * @return: boolean
+ **/
+ public static String r02454() {
+ String mainservTemplate = MAINSERV_TEMPLATE;
+ mainservTemplate = csarFiles.get(FilenameUtils.getName(mainservTemplate));
+
+ //TODO: Fixme R3 only check the existence of swImage filed inside VNFD.
+ File file = new File(mainservTemplate);
+ try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
+ String tempString = null;
+ while ((tempString = reader.readLine()) != null) {
+ if (tempString.contains((CommonConstants.TOSCA_SWIMAGE))) {
+ return CommonConstants.SUCCESS_STR;
+ }
+ }
+ } catch(IOException e2) {
+ return ("CSAR_META_VALIDATION" + ":" + "Exception caught while validateCsarMeta ! " + ErrorCodes.FILE_IO
+ + e2);
+ }
+
+ if(StringUtils.isEmpty(mainservTemplate)) {
+ return "Can not find the swImage inside Mainservicetemplate";
+ }
+
+ return "Can not find the swImage inside Mainservicetemplate";
+ }
+
private static String checkEntryFor(String fileWithPath, String attribute) throws IOException {
List<String> lines = Files.readAllLines(Paths.get(fileWithPath), UTF_8);