summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2019-04-26 08:05:20 +0200
committerZebek Bogumil <bogumil.zebek@nokia.com>2019-04-26 08:05:20 +0200
commit5222844a7befd0adaed24c7dbe6e90c63add9655 (patch)
tree6c89ad7036c2ed7a966a1a30c259a6a9018187cd /csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java
parent089d8c3fb0a277351a55371dff8c2b27bd3f4ed5 (diff)
Basic PNFD validation
Change-Id: I959324f3fc0ba89d99a291d0608aa5a5ba778077 Issue-ID: VNFSDK-341 Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Diffstat (limited to 'csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java')
-rw-r--r--csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java
index bd771e0..eafdbde 100644
--- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java
+++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/VTPValidateCSARBase.java
@@ -19,9 +19,11 @@ package org.onap.cvc.csar.cc;
import org.onap.cli.fw.cmd.OnapCommand;
import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.error.OnapCommandExecutionFailed;
+import org.onap.cli.fw.input.OnapCommandParameter;
import org.onap.cvc.csar.CSARArchive;
import org.onap.cvc.csar.CSARArchive.CSARError;
import org.onap.cvc.csar.FileArchive;
+import org.onap.cvc.csar.PnfCSARArchive;
import org.onap.cvc.csar.ZipFileContentValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,9 +46,10 @@ public abstract class VTPValidateCSARBase extends OnapCommand {
protected void run() throws OnapCommandException {
//Read the input arguments
String path = (String) getParametersMap().get("csar").getValue();
+ boolean isPnf = isPnf();
//execute
- try (CSARArchive csar = this.createArchiveInstance()){
+ try (CSARArchive csar = isPnf ? new PnfCSARArchive(): new CSARArchive()){
csar.init(path);
@@ -77,7 +80,12 @@ public abstract class VTPValidateCSARBase extends OnapCommand {
this.getResult().setOutput(this.errors);
}
- protected CSARArchive createArchiveInstance(){
- return new CSARArchive();
- }
+ private boolean isPnf() {
+ final OnapCommandParameter pnf = getParametersMap().get("pnf");
+ return pnf != null && (boolean) pnf.getValue();
+ }
+
+ public List<CSARError> getErrors() {
+ return this.errors;
+ }
}