diff options
author | luxin <luxin7@huawei.com> | 2018-01-24 17:31:34 +0800 |
---|---|---|
committer | luxin <luxin7@huawei.com> | 2018-01-24 17:31:34 +0800 |
commit | 8fdcb65926d6e89775d8d52550536508359e75b5 (patch) | |
tree | 4530c42cc67f54380ffdb782d67474c78f5dee71 /ResmanagementService/service/src/main | |
parent | 8d4c0a7c7230ea1f147a83049bee03e20a8fa789 (diff) |
vnfInstanceId Replaced by constant
Change-Id: I059ea8917d46bb7eed009f5ccb01419857c6c0e1
Issue-ID: VFC-672
Signed-off-by: luxin <luxin7@huawei.com>
Diffstat (limited to 'ResmanagementService/service/src/main')
2 files changed, 8 insertions, 5 deletions
diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/ParamConstant.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/ParamConstant.java index 27e8d49..0268632 100644 --- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/ParamConstant.java +++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/common/constant/ParamConstant.java @@ -42,6 +42,8 @@ public class ParamConstant { */ public static final String PARAM_TENANTID = "tenantId"; + public static final String VNF_INSTANCEID = "vnfInstanceId"; + public static final String TOTAL_CPU = "totalCPU"; public static final String USED_CPU = "usedCPU"; diff --git a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfInfoServiceImpl.java b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfInfoServiceImpl.java index dce3c25..ddac68d 100644 --- a/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfInfoServiceImpl.java +++ b/ResmanagementService/service/src/main/java/org/onap/vfc/nfvo/resmanagement/service/group/impl/VnfInfoServiceImpl.java @@ -19,12 +19,13 @@ package org.onap.vfc.nfvo.resmanagement.service.group.impl; import java.util.List; import java.util.Map; +import org.onap.vfc.nfvo.resmanagement.common.constant.ParamConstant; +import org.onap.vfc.nfvo.resmanagement.common.util.restclient.ServiceException; import org.onap.vfc.nfvo.resmanagement.service.dao.inf.VnfInfoDao; import org.onap.vfc.nfvo.resmanagement.service.entity.VmEntity; import org.onap.vfc.nfvo.resmanagement.service.entity.VnfInfoEntity; import org.onap.vfc.nfvo.resmanagement.service.group.inf.VmService; import org.onap.vfc.nfvo.resmanagement.service.group.inf.VnfInfoService; -import org.onap.vfc.nfvo.resmanagement.common.util.restclient.ServiceException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +61,7 @@ public class VnfInfoServiceImpl implements VnfInfoService { LOGGER.info("function=addVnfInfo; object: {}", object); saveVm(object); JSONObject vnf = new JSONObject(); - vnf.put("vnfInstanceId", object.get("vnfInstanceId")); + vnf.put(ParamConstant.VNF_INSTANCEID, object.get(ParamConstant.VNF_INSTANCEID)); vnf.put("nsId", object.get("nsId")); vnf.put("vnfmId", object.get("vnfmId")); VnfInfoEntity vnfInfoEntity = VnfInfoEntity.toEntity(vnf); @@ -72,7 +73,7 @@ public class VnfInfoServiceImpl implements VnfInfoService { } JSONObject resultObj = new JSONObject(); if(result > 0) { - resultObj.put("vnfInstanceId", object.get("vnfInstanceId")); + resultObj.put(ParamConstant.VNF_INSTANCEID, object.get(ParamConstant.VNF_INSTANCEID)); } else { LOGGER.error("function=addVnfInfo; msg=add vnfInfo into DB error."); resultObj.put("message", "Add vnfInfo into DB error."); @@ -103,11 +104,11 @@ public class VnfInfoServiceImpl implements VnfInfoService { * @since VFC 1.0 */ private void saveVm(JSONObject object) throws ServiceException { - String vnfInstanceId = object.getString("vnfInstanceId"); + String vnfInstanceId = object.getString(ParamConstant.VNF_INSTANCEID); JSONArray vms = object.getJSONArray("vms"); for(int i = 0; i < vms.size(); i++) { JSONObject vmObj = vms.getJSONObject(i); - vmObj.put("vnfInstanceId", vnfInstanceId); + vmObj.put(ParamConstant.VNF_INSTANCEID, vnfInstanceId); vmService.addVm(VmEntity.toEntity(vmObj)); } |