From 9478f6a826cffd3b9f5f6aabbcc9c57bb7696b32 Mon Sep 17 00:00:00 2001 From: luxin Date: Wed, 21 Mar 2018 16:38:56 +0800 Subject: Fix scale vnf parameters Change-Id: I4367e0ee15a9bb6bb368ae9cd3bc1667a92d835c Issue-ID: VFC-725 Signed-off-by: luxin --- .../svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java | 17 ++++++++++++----- .../vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java | 8 ++++---- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'huawei/vnfmadapter/VnfmadapterService') diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java index fae1e98d..9c3a624b 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java @@ -39,6 +39,10 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { private static final Logger LOG = LoggerFactory.getLogger(VnfMgrVnfm.class); + private static final int PARAM_ZERO = 0; + + private static final int PARAM_ONE = 1; + @Override public JSONObject scaleVnf(JSONObject vnfObject, JSONObject vnfmObject, String vnfmId, String vnfInstanceId) { LOG.warn("function=scaleVnf, msg=enter to scale a vnf"); @@ -56,10 +60,15 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { vdu.put("h_steps", vnfObject.get("numberOfSteps")); vduList.add(vdu); scaleInfo.put("vnf_id", vnfInstanceId); - scaleInfo.put("scale_type", 0); + scaleInfo.put("scale_pattern", "without_plan"); + scaleInfo.put("scale_type", PARAM_ZERO); scaleInfo.put("scale_action", scaleType); + scaleInfo.put("scale_step", PARAM_ZERO); + scaleInfo.put("scale_step_value", PARAM_ONE); + scaleInfo.put("scale_group", vdu.getString("vdu_type")); scaleInfo.put("vdu_list", vduList); - if(scaleType == 0) {// scale_in + if(scaleType == PARAM_ZERO) { + // scale_in JSONArray vmList = new JSONArray(); try { JSONObject additionalParam = vnfObject.getJSONObject("additionalParam"); @@ -78,9 +87,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { if(statusCode == Constant.HTTP_CREATED || statusCode == Constant.HTTP_OK) { restJson.put(Constant.RETCODE, Constant.REST_SUCCESS); - JSONObject resultObj = new JSONObject(); - resultObj.put(Constant.JOBID, vnfInstanceId + "_" + Constant.PUT); - restJson.put("data", resultObj); + restJson.put("data", queryResult.getJSONObject("data").getJSONObject("scale_info")); } else { LOG.error("function=scaleVnf, msg=send create vnf msg to csm get wrong status: " + statusCode); } diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java index f90126c8..47ae7dc8 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java @@ -51,7 +51,7 @@ import net.sf.json.JSONObject; * @author * @version VFC 1.0 Aug 24, 2016 */ -@Path("/rest/plat/smapp/v1") +@Path("/rest") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class AuthRoa { @@ -73,7 +73,7 @@ public class AuthRoa { * @since VFC 1.0 */ @PUT - @Path("/oauth/token") + @Path("/plat/smapp/v1/oauth/token") public String authToken(@Context HttpServletRequest context, @Context HttpServletResponse resp) { LOG.warn("function=login, msg=enter to get token."); JSONObject subJsonObject = VnfmJsonUtil.getJsonFromContexts(context); @@ -112,7 +112,7 @@ public class AuthRoa { * @since VFC 1.0 */ @DELETE - @Path("/auth/tokens/{userName}/{roarand}") + @Path("/plat/smapp/v1/auth/tokens/{userName}/{roarand}") public String delAuthToken(@PathParam(Constant.USERNAME) String userName, @PathParam("roarand") String roarand, @Context HttpServletResponse resp) { LOG.warn("function=logout, msg=enter to logout"); @@ -133,7 +133,7 @@ public class AuthRoa { * @since VFC 1.0 */ @GET - @Path("/nfvo/shakehand") + @Path("/vnfmmed/v2/nfvo/shakehand") public String shakehand(@QueryParam("roattr") String roattr, @Context HttpServletResponse resp) { JSONObject resultJson = new JSONObject(); resultJson.put("status", "running"); -- cgit 1.2.3-korg