summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main/java
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2020-12-08 06:10:02 +0000
committerGerrit Code Review <gerrit@onap.org>2020-12-08 06:10:02 +0000
commitaedd6d19874b046f1e72026dd4a9cdc0aad39172 (patch)
tree6bbc80cfaa1f4b4c6e27c5d56cb9cf21e06b5e18 /csarvalidation/src/main/java
parentf65a16e597a267a0c6fae80db8b06f9e34f512d6 (diff)
parent625cc87fc112891fc5945d2f2f0669f3bf75f089 (diff)
Merge "Add rules parameter for selected rules validation"
Diffstat (limited to 'csarvalidation/src/main/java')
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java32
1 files changed, 24 insertions, 8 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 74697f1..637a454 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/VTPValidateCSAR.java
@@ -42,7 +42,10 @@ public class VTPValidateCSAR extends OnapCommand {
private static Gson gson = new Gson();
private static final Logger LOG = LoggerFactory.getLogger(VTPValidateCSAR.class);
- public static final String PNF_ATTRIBUTE_NAME = "pnf";
+ private static final String RULES_ATTRIBUTE_SEPARATOR = ",";
+ private static final String PNF_ATTRIBUTE_NAME = "pnf";
+ private static final String CSAR_ATTRIBUTE_NAME = "csar";
+ private static final String RULES_ATTRIBUTE_NAME = "rules";
public static class CSARValidation {
@@ -216,8 +219,9 @@ public class VTPValidateCSAR extends OnapCommand {
@Override
protected void run() throws OnapCommandException {
//Read the input arguments
- String path = (String) getParametersMap().get("csar").getValue();
+ String path = (String) getParametersMap().get(CSAR_ATTRIBUTE_NAME).getValue();
boolean isPnf = (boolean) getParametersMap().get(PNF_ATTRIBUTE_NAME).getValue();
+ String rulesToValidate = (String) getParametersMap().get(RULES_ATTRIBUTE_NAME).getValue();
boolean overallPass = true;
try (CSARArchive csar = isPnf ? new PnfCSARArchive() : new CSARArchive()) {
@@ -244,13 +248,25 @@ public class VTPValidateCSAR extends OnapCommand {
validation.getResults().add(resultSOL004);
- //Run thru the vnfreqs requirement checks
String keyReqs = isPnf ? "pnfreqs.enabled" : "vnfreqs.enabled";
- for (String vnfreq : this.getPropertiesList(keyReqs)) {
- CSARValidation.Result result = new CSARValidation.Result();
- result.setVnfreqName(vnfreq);
-
- overallPass = validateVnfOrPnf(path, validation, ignoreCodes, vnfreq, result, isPnf, overallPass);
+ List<String> activeRules = this.getPropertiesList(keyReqs);
+ if(rulesToValidate.isEmpty()) {
+ // Run thru the vnfreqs requirement checks
+ for (String vnfreq : activeRules) {
+ CSARValidation.Result result = new CSARValidation.Result();
+ result.setVnfreqName(vnfreq);
+ overallPass = validateVnfOrPnf(path, validation, ignoreCodes, vnfreq, result, isPnf, overallPass);
+ }
+ } else {
+ // Validate selected rules
+ String[] listOfRulesToValidate = rulesToValidate.split(RULES_ATTRIBUTE_SEPARATOR);
+ for (String rule : listOfRulesToValidate) {
+ if(activeRules.contains(rule)) {
+ CSARValidation.Result result = new CSARValidation.Result();
+ result.setVnfreqName(rule);
+ overallPass = validateVnfOrPnf(path, validation, ignoreCodes, rule, result, isPnf, overallPass);
+ }
+ }
}
validation.setDate(new Date().toString());