diff options
author | ’zhaoyh6‘ <zhaoyh6@asiainfo.com> | 2022-05-19 10:54:40 +0800 |
---|---|---|
committer | ’zhaoyh6‘ <zhaoyh6@asiainfo.com> | 2022-05-19 10:54:53 +0800 |
commit | 6488a4b4eedbcd06338b50ad0362a8477511bdb4 (patch) | |
tree | a0affbfb258a29e57fa6880bd63f269d0300dcd1 | |
parent | 3afade76f0fbd9abc4b58329f8cb4502b4af96b7 (diff) |
feat:Modify access node display format
Issue-ID: REQ-1075
Signed-off-by: ’zhaoyh6‘ <zhaoyh6@asiainfo.com>
Change-Id: I27677f418b0c101d5f2e99ccd81596053832a307
3 files changed, 35 insertions, 14 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/constant/IntentConstant.java b/server/src/main/java/org/onap/usecaseui/server/constant/IntentConstant.java index 4262fdad..6210ccc5 100644 --- a/server/src/main/java/org/onap/usecaseui/server/constant/IntentConstant.java +++ b/server/src/main/java/org/onap/usecaseui/server/constant/IntentConstant.java @@ -15,6 +15,9 @@ */ package org.onap.usecaseui.server.constant; +import java.util.HashMap; +import java.util.Map; + public final class IntentConstant { public final static String UPLOADPATH = "/home/uui/upload/"; public final static String NLPLOADPATH = "/home/uuihome/uui/bert-master/upload/"; @@ -31,4 +34,6 @@ public final class IntentConstant { public final static String NLP_ONLINE_URL_BASE = NLP_HOST+":33011"; public final static String NLP_OFFLINE_URL_BASE = NLP_HOST+":33012"; public final static String NLP_FILE_URL_BASE = NLP_HOST+":33013"; + + public static Map<String, String> NetWorkNodeAlias = new HashMap<>(); } diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java index e4d66767..8de9efa4 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java @@ -312,12 +312,12 @@ public class IntentController { String instanceId = getUUID(); String accessPointAlias = intentInstanceService.formatAccessPoint(accessPoint); if ("".equals(accessPointAlias)) { - if (text.indexOf("Access one") > -1) { - accessPointAlias = "tranportEp_src_ID_111_1"; - } else if (text.indexOf("Access two") > -1) { - accessPointAlias = "tranportEp_src_ID_111_2"; - } else if (text.indexOf("Access three") > -1) { - accessPointAlias = "tranportEp_src_ID_113_1"; + if (text.toLowerCase().contains("access one") || text.toLowerCase().contains("company a")) { + accessPointAlias = MapUtils.getString(IntentConstant.NetWorkNodeAlias, "tranportEp_src_ID_111_1","tranportEp_src_ID_111_1"); + } else if (text.toLowerCase().contains("access two") || text.toLowerCase().contains("company b")) { + accessPointAlias = MapUtils.getString(IntentConstant.NetWorkNodeAlias, "tranportEp_src_ID_111_2","tranportEp_src_ID_111_2"); + } else if (text.toLowerCase().contains("access three") || text.toLowerCase().contains("company c")) { + accessPointAlias = MapUtils.getString(IntentConstant.NetWorkNodeAlias, "tranportEp_src_ID_113_1","tranportEp_src_ID_113_1"); } } String bandwidthAlias = null; @@ -339,7 +339,9 @@ public class IntentController { String cloudPointAlias = intentInstanceService.formatCloudPoint(cloudPoint); if ("".equals(cloudPointAlias)) { if (text.indexOf("Cloud one") > -1) { - cloudPointAlias = "tranportEp_dst_ID_212_1"; + cloudPointAlias = MapUtils.getString(IntentConstant.NetWorkNodeAlias, "tranportEp_dst_ID_212_1","tranportEp_dst_ID_212_1"); + }else if (text.indexOf("Cloud two") > -1) { + cloudPointAlias = MapUtils.getString(IntentConstant.NetWorkNodeAlias, "tranportEp_dst_ID_213_1","tranportEp_dst_ID_213_1"); } } @@ -410,7 +412,12 @@ public class IntentController { int currentPage = (int) ((Map)body).get("currentPage"); int pageSize = (int) ((Map)body).get("pageSize"); logger.error("getInstanceList --> currentPage:" + currentPage + ",pageSize:" + pageSize); - return intentInstanceService.queryIntentInstance(null, currentPage, pageSize); + Page<CCVPNInstance> ccvpnInstancePage = intentInstanceService.queryIntentInstance(null, currentPage, pageSize); + for (CCVPNInstance instance : ccvpnInstancePage.getList()) { + instance.setAccessPointOneName(MapUtils.getString(IntentConstant.NetWorkNodeAlias, instance.getAccessPointOneName(),instance.getAccessPointOneName())); + instance.setCloudPointName(MapUtils.getString(IntentConstant.NetWorkNodeAlias, instance.getCloudPointName(),instance.getCloudPointName())); + } + return ccvpnInstancePage; } @IntentResponseBody @ResponseBody @@ -420,9 +427,9 @@ public class IntentController { String intentInstanceId = (String) ((Map)body).get("instanceId"); String name = (String) ((Map)body).get("name"); String lineNum = (String) ((Map)body).get("lineNum"); - String cloudPointName = (String) ((Map)body).get("cloudPointName"); + String cloudPointName = ((String) ((Map)body).get("cloudPointName")).split("\\(")[0]; Map<String, Object> accessPointOne = (Map) ((Map)body).get("accessPointOne"); - String accessPointOneName = MapUtils.getString(accessPointOne, "name"); + String accessPointOneName = MapUtils.getString(accessPointOne, "name").split("\\(")[0]; int accessPointOneBandWidth = MapUtils.getIntValue(accessPointOne, "bandwidth"); boolean protectStatus = MapUtils.getBooleanValue((Map)body,"protect", false); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java index ffe8b49b..af8955a1 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java @@ -415,9 +415,17 @@ public class IntentInstanceServiceImpl implements IntentInstanceService { if (!metadatumResponse.isSuccessful()) { logger.error("get Intent-Instance metadatum error:" + metadatumResponse.toString()); continue; + }else { + logger.debug("get Intent-Instance metadatum ok: instance id:" + instance.getInstanceId() + ", metadatum info:" + metadatumResponse.toString()); } JSONObject metadatum = metadatumResponse.body(); - int metaval = metadatum.getJSONArray("metadatum").getJSONObject(0).getIntValue("metaval"); + JSONArray metadatumArr = metadatum.getJSONArray("metadatum"); + int metaval = -1; + for (int i = 0; i < metadatumArr.size(); i++) { + if (metaval == -1 || metaval > metadatumArr.getJSONObject(i).getIntValue("metaval")) { + metaval = metadatumArr.getJSONObject(i).getIntValue("metaval"); + } + } instancePerformance.setBandwidth(metaval); Session session = getSession(); @@ -473,7 +481,7 @@ public class IntentInstanceServiceImpl implements IntentInstanceService { params.put("subscriptionServiceType", "IBN"); params.put("serviceType", "CLL"); JSONObject additionalProperties = new JSONObject(); - additionalProperties.put("enableSdnc", "false"); + additionalProperties.put("enableSdnc", "true"); params.put("additionalProperties", additionalProperties); okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params)); intentApiService.deleteIntentInstance(requestBody).execute(); @@ -621,11 +629,12 @@ public class IntentInstanceServiceImpl implements IntentInstanceService { for (int i = 0; i<data.size(); i++) { JSONObject nodeInfo = data.getJSONObject(i); if ("ROOT".equals(nodeInfo.getString("type"))) { - cloudAccessNodeList.add(nodeInfo.getString("route-id")); + cloudAccessNodeList.add(nodeInfo.getString("route-id")+"("+nodeInfo.getString("data-source")+")"); } else { - accessNodeList.add(nodeInfo.getString("route-id")); + accessNodeList.add(nodeInfo.getString("route-id")+"("+nodeInfo.getString("data-source")+")"); } + IntentConstant.NetWorkNodeAlias.put(nodeInfo.getString("route-id"), nodeInfo.getString("route-id")+"("+nodeInfo.getString("data-source")+")"); } result.put("accessNodeList",accessNodeList); result.put("cloudAccessNodeList",cloudAccessNodeList); |