diff options
author | Bogumil Zebek <bogumil.zebek@nokia.com> | 2019-04-09 11:51:50 +0200 |
---|---|---|
committer | Zebek Bogumil <bogumil.zebek@nokia.com> | 2019-04-10 07:26:53 +0200 |
commit | 96fcbb323829e81abf746efc5f62763f277786b6 (patch) | |
tree | 7d14f0c8d86d2096e13798e9098c200fc91cc84f /csarvalidation/src/main/java | |
parent | 00e2233d95577a78c47cbabcce818191287a2a63 (diff) |
Separate list of TCS
Change-Id: I15bed6fe97e2d4bc025ddcd38f8b2bd72364257a
Issue-ID: AAI-391
Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Diffstat (limited to 'csarvalidation/src/main/java')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java b/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java index 006d78d..d348235 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java @@ -16,7 +16,6 @@ package org.onap.cvc.csar; -import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -185,13 +184,13 @@ public class VTPValidateCSAR extends OnapCommand { protected void run() throws OnapCommandException { //Read the input arguments String path = (String) getParametersMap().get("csar").getValue(); + boolean isPnf = (boolean) getParametersMap().get("pnf").getValue(); boolean overallPass = true; - try { - CSARArchive csar = new CSARArchive(); + try(CSARArchive csar = isPnf ? new PnfCSARArchive(): new CSARArchive()){ csar.init(path); csar.parse(); - csar.cleanup(); + //Fill up the basic details CSARValidation validation = new CSARValidation(); @@ -201,7 +200,8 @@ public class VTPValidateCSAR extends OnapCommand { validation.getVnf().setType("TOSCA"); validation.getVnf().setMode(csar.getToscaMeta().getMode().name()); - List <String> ignoreCodes = this.getIgnoreErrorCodes(); + String keyErrors = isPnf ? "pnferrors.ignored" : "vnferrors.ignored"; + List <String> ignoreCodes = this.getPropertiesList(keyErrors); //Add SOL004 error codes CSARValidation.Result resultSOL004 = new CSARValidation.Result(); @@ -214,12 +214,13 @@ public class VTPValidateCSAR extends OnapCommand { overallPass = false; } } - resultSOL004.setPassed(resultSOL004.getErrors().size() == 0); + resultSOL004.setPassed(resultSOL004.getErrors().isEmpty()); validation.getResults().add(resultSOL004); //Run thru the vnfreqs requirement checks - for (String vnfreq: this.getEnabledReqs()) { + String keyReqs = isPnf ? "pnfreqs.enabled" : "vnfreqs.enabled"; + for (String vnfreq: this.getPropertiesList(keyReqs)) { CSARValidation.Result result = new CSARValidation.Result(); result.setVnfreqName(vnfreq); @@ -237,7 +238,7 @@ public class VTPValidateCSAR extends OnapCommand { } } - result.setPassed(result.getErrors().size() == 0); + result.setPassed(result.getErrors().isEmpty()); validation.getResults().add(result); } catch (Exception e) { result.setPassed(false); @@ -265,21 +266,12 @@ public class VTPValidateCSAR extends OnapCommand { } } - private List<String> getEnabledReqs() throws IOException { - String[] enabledReqs = prp.getProperty("vnfreqs.enabled", "").split(","); + private List<String> getPropertiesList(String key) { + String[] enabledReqs = prp.getProperty(key, "").split(","); List<String> list = new ArrayList<>(); for(String req: enabledReqs) { if (!req.isEmpty()) list.add(req); } return list; } - - private List<String> getIgnoreErrorCodes() throws IOException { - String[] errorsToIgnore = prp.getProperty("errors.ignored", "").split(","); - List<String> list = new ArrayList<>(); - for(String req: errorsToIgnore) { - if (!req.isEmpty()) list.add(req); - } - return list; - } } |