aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMurali Mohan Murthy Potham <murali.p@huawei.com>2017-09-26 11:17:52 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-26 11:17:52 +0000
commit250f9524972b57446c9dc7a662d5f84b8b2a78a2 (patch)
treeebc1bb5483e93b089365eadc40dddb4e118e0180
parent48852bd9db1159b16ddeadebae8b300204538ba7 (diff)
parent1cebc6e93630431a1b530a6415d3d1a5996d458d (diff)
Merge "Add validation to market place"
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/pom.xml5
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java17
2 files changed, 22 insertions, 0 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/pom.xml b/vnfmarket-be/vnf-sdk-marketplace/pom.xml
index d281b973..6a526b52 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/pom.xml
+++ b/vnfmarket-be/vnf-sdk-marketplace/pom.xml
@@ -191,6 +191,11 @@
<version>2.4</version>
</dependency>
<!-- UT end -->
+ <dependency>
+ <groupId>org.onap.vnfsdk.validation</groupId>
+ <artifactId>validation-csar</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<profiles>
<profile>
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
index b3773c5f..9178931e 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java
@@ -58,6 +58,8 @@ import org.onap.vnfsdk.marketplace.onboarding.onboardmanager.OnBoardingHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.onap.validation.csar.CsarValidator;
+
import net.sf.json.JSONObject;
public class PackageWrapper {
@@ -230,6 +232,21 @@ public class PackageWrapper {
uploadedInputStream.close();
+ try {
+ CsarValidator cv = new CsarValidator(packageId, fileLocation);
+
+ if (!cv.validateCsar()) {
+ LOG.error("Could not validate failed");
+ return Response.status(Status.EXPECTATION_FAILED).build();
+ }
+
+
+ } catch (Exception e) {
+ LOG.error("CSAR validation panicked");
+ return Response.status(Status.EXPECTATION_FAILED).build();
+ }
+
+
PackageBasicInfo basicInfo = PackageWrapperUtil.getPacageBasicInfo(fileLocation);
UploadPackageResponse result = new UploadPackageResponse();
Boolean isEnd = PackageWrapperUtil.isUploadEnd(contentRange);