summaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace/src
diff options
context:
space:
mode:
authorAvinashS <avinash.s@huawei.com>2017-09-25 17:58:08 +0530
committerAvinash S <avinash.s@huawei.com>2017-09-26 05:23:42 +0000
commit1cebc6e93630431a1b530a6415d3d1a5996d458d (patch)
tree729586474e8455b8db919a91b0c18a7a7dbc7776 /vnfmarket-be/vnf-sdk-marketplace/src
parentc72dbd3f88778ab999ff69cc312618761d6ca07b (diff)
Add validation to market place
Added Csar, Tosca, and Mainservice validation Change-Id: I43e5245b77cd5f096e8bd062546138ee311ab86c Issue-Id: VNFSDK-90 Signed-off-by: AvinashS <avinash.s@huawei.com>
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java17
1 files changed, 17 insertions, 0 deletions
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);