summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java12
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfResourceMgr.java17
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java14
3 files changed, 28 insertions, 15 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java
index bd2ad3fa..45662faf 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java
@@ -124,6 +124,8 @@ public class Constant {
public static final String RETCODE = "retCode";
+ public static final String REASON = "reason";
+
public static final String STATUS = "status";
public static final String VNFPKGINFO = "vnfpkginfo.json";
@@ -134,6 +136,16 @@ public class Constant {
public static final String ERRORMSG = "errorMsg";
+ public static final String VIMID = "vimId";
+
+ public static final String VNFMID = "vnfmId";
+
+ public static final String ACTION = "action";
+
+ public static final String VNFDID = "vnfdId";
+
+ public static final String JOBID = "jobId";
+
private Constant() {
// private constructor
}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfResourceMgr.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfResourceMgr.java
index 29141588..f31d5a5d 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfResourceMgr.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfResourceMgr.java
@@ -57,7 +57,7 @@ public class VnfResourceMgr {
public JSONObject grantVnfResource(JSONObject vnfObj, String vnfId, String vnfmId) {
LOG.warn("function=grantVnfResource, msg=enter to grant vnf resource, params: {}", vnfObj);
JSONObject resultJson = new JSONObject();
- resultJson.put("retCode", Constant.REST_FAIL);
+ resultJson.put(Constant.RETCODE, Constant.REST_FAIL);
try {
String type = vnfObj.getString("type");
String requestType = vnfObj.getString("operation_right");
@@ -81,12 +81,12 @@ public class VnfResourceMgr {
}
JSONObject grantObj = new JSONObject();
- grantObj.put("vimId", vnfObj.getString("vim_id"));
+ grantObj.put(Constant.VIMID, vnfObj.getString("vim_id"));
grantObj.put("vnfId", vnfId);
grantObj.put("vnfName", vnfName);
- grantObj.put("vnfmId", vnfmId);
+ grantObj.put(Constant.VNFMID, vnfmId);
String action = getGrantAction(type, requestType);
- grantObj.put("action", action);
+ grantObj.put(Constant.ACTION, action);
JSONObject grantParam = parseGrantParam(resMap, grantObj);
resultJson = sendGrantToResmgr(grantParam);
@@ -127,7 +127,7 @@ public class VnfResourceMgr {
private JSONObject parseGrantParam(Map<String, Integer> resMap, JSONObject grantParam) {
JSONObject result = new JSONObject();
result.put("vnfInstanceId", grantParam.getString("vnfId"));
- result.put("vimId", grantParam.getString("vimId"));
+ result.put(Constant.VIMID, grantParam.getString(Constant.VIMID));
JSONArray resource = new JSONArray();
JSONObject resourceObj = new JSONObject();
@@ -151,15 +151,16 @@ public class VnfResourceMgr {
resourceObj.put("vdu", grantParam.getString("vnfName"));
resource.add(resourceObj);
- if("online".equals(grantParam.getString("action")) || "scaleOut".equals(grantParam.getString("action"))) {
+ if("online".equals(grantParam.getString(Constant.ACTION))
+ || "scaleOut".equals(grantParam.getString(Constant.ACTION))) {
result.put("addResource", resource);
} else {
result.put("removeResource", resource);
}
JSONObject additionalParam = new JSONObject();
- additionalParam.put("vnfmId", grantParam.getString("vnfmId"));
- additionalParam.put("vimId", grantParam.getString("vimId"));
+ additionalParam.put(Constant.VNFMID, grantParam.getString(Constant.VNFMID));
+ additionalParam.put(Constant.VIMID, grantParam.getString(Constant.VIMID));
additionalParam.put("tenant", "");
result.put("additionalParam", additionalParam);
LOG.info("funtion=parseGrantParam, result={}", result);
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
index de8686cd..7d3c14c2 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
@@ -60,9 +60,9 @@ public class VnfRoa {
private VnfMgr vnfMgr;
- private static Map<String, String> PROGRESSITEM;
+ private static Map<String, String> progressItem;
- private static Map<String, String> JOBSTATUSITEM;
+ private static Map<String, String> jobstatusItem;
static {
Map<String, String> map = new HashMap<>();
@@ -70,14 +70,14 @@ public class VnfRoa {
map.put("Active", "100");
map.put("Stopped", "50");
map.put("Error", "100");
- PROGRESSITEM = UnmodifiableMap.decorate(map);
+ progressItem = UnmodifiableMap.decorate(map);
map = new HashMap<>();
map.put("Building", "processing");
map.put("Active", "finished");
map.put("Stopped", "processing");
map.put("Error", "error");
- JOBSTATUSITEM = UnmodifiableMap.decorate(map);
+ jobstatusItem = UnmodifiableMap.decorate(map);
}
public void setVnfMgr(VnfMgr vnfMgr) {
@@ -321,10 +321,10 @@ public class VnfRoa {
JSONObject jobInfoJson = new JSONObject();
JSONObject retJson = restJson.getJSONArray("data").getJSONObject(0);
jobInfoJson.put("jobId", retJson.getString("id"));
- responseJson.put("progress", PROGRESSITEM.get(retJson.getString(Constant.STATUS)));
- responseJson.put("status", JOBSTATUSITEM.get(retJson.getString(Constant.STATUS)));
+ responseJson.put("progress", progressItem.get(retJson.getString(Constant.STATUS)));
+ responseJson.put("status", jobstatusItem.get(retJson.getString(Constant.STATUS)));
responseJson.put("errorCode", "null");
- responseJson.put("responseId", PROGRESSITEM.get(retJson.getString(Constant.STATUS)));
+ responseJson.put("responseId", progressItem.get(retJson.getString(Constant.STATUS)));
jobInfoJson.put("responsedescriptor", responseJson);
return jobInfoJson.toString();
}