From 63e6575a65ef141ce965ae276642e3ebcffa0ba9 Mon Sep 17 00:00:00 2001 From: luxin Date: Fri, 28 Apr 2017 13:24:33 +0800 Subject: validate status interface NFVO-171 Change-Id: Ie7d7d64303cf72f1f2b001799655182da7cbf82a Signed-off-by: luxin --- .../vnfsdk/lctest/common/constant/UrlConstant.java | 3 +++ .../business/impl/VnfpackageServiceImpl.java | 25 ++++++++++++++++++++++ .../service/business/inf/VnfpackageService.java | 9 ++++++++ .../vnfsdk/lctest/service/rest/VnfpackageRoa.java | 13 +++++++++++ 4 files changed, 50 insertions(+) diff --git a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/common/constant/UrlConstant.java b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/common/constant/UrlConstant.java index 67de902..8cf83fa 100644 --- a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/common/constant/UrlConstant.java +++ b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/common/constant/UrlConstant.java @@ -40,6 +40,9 @@ public class UrlConstant { */ public static final String NSLCM_VNFPACKAGE_URL = "/openoapi/nslcm/v1/vnfonboarding"; + public static final String MARKETPLACE_UPDATE_STATUS_URL = + "/openoapi/vnfsdk-marketplace/v1/PackageResource/updatestatus"; + public static final String QUERY_VNFPACKAGE_URL = "/openoapi/nslcm/v1/vnfpackage/%s"; } diff --git a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/impl/VnfpackageServiceImpl.java b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/impl/VnfpackageServiceImpl.java index 43c418b..e566577 100644 --- a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/impl/VnfpackageServiceImpl.java +++ b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/impl/VnfpackageServiceImpl.java @@ -58,6 +58,7 @@ public class VnfpackageServiceImpl implements VnfpackageService { resJson.put("message", "NS LCM response Error."); return resJson; } + LOGGER.info("VnfpackageServiceImpl::onboarding rsp:{}", rsp); return JSONObject.fromObject(rsp); } @@ -77,7 +78,31 @@ public class VnfpackageServiceImpl implements VnfpackageService { resJson.put("message", "NS LCM response Error."); return resJson; } + LOGGER.info("VnfpackageServiceImpl::queryVnfpackage rsp:{}", rsp); return rsp; } + /** + *
+ * + * @param object + * @return + * @since NFVO 0.5 + */ + @Override + public JSONObject updatestatus(JSONObject object) { + LOGGER.info("VnfpackageServiceImpl::updatestatus:{}", object.toString()); + Map paramsMap = new HashMap<>(3); + paramsMap.put("url", UrlConstant.MARKETPLACE_UPDATE_STATUS_URL); + paramsMap.put("methodType", RestfulUtil.TYPE_POST); + String rsp = RestfulUtil.getRemoteResponseContent(paramsMap, object.toString()); + if(null == rsp) { + JSONObject resJson = new JSONObject(); + resJson.put("message", "Marketplace response Error."); + return resJson; + } + LOGGER.info("VnfpackageServiceImpl::updatestatus rsp:{}", rsp); + return JSONObject.fromObject(rsp); + } + } diff --git a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/inf/VnfpackageService.java b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/inf/VnfpackageService.java index f7977ad..5c5e670 100644 --- a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/inf/VnfpackageService.java +++ b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/business/inf/VnfpackageService.java @@ -46,4 +46,13 @@ public interface VnfpackageService { */ JSONObject queryVnfpackage(String csarId); + /** + *
+ * + * @param object + * @return + * @since NFVO 0.5 + */ + JSONObject updatestatus(JSONObject object); + } diff --git a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/rest/VnfpackageRoa.java b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/rest/VnfpackageRoa.java index 4c909bd..e1d271d 100644 --- a/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/rest/VnfpackageRoa.java +++ b/lifecycle-test/src/main/java/org/openo/vnfsdk/lctest/service/rest/VnfpackageRoa.java @@ -71,6 +71,19 @@ public class VnfpackageRoa { return vnfpackageService.onboarding(object); } + @POST + @Path("/updatestatus") + public JSONObject updatestatus(@Context HttpServletRequest context) throws ServiceException { + JSONObject object = RequestUtil.getJsonRequestBody(context); + if(null == object) { + LOGGER.error("function=onboarding; msg=context is null."); + throw new ServiceException("org.openo.vnfsdk.lctest.service.rest.VnfpackageRoa.onboarding.null"); + } + + LOGGER.info("VnfpackageRoa::updatestatus:{}", object.toString()); + return vnfpackageService.updatestatus(object); + } + /** *
* -- cgit 1.2.3-korg