summaryrefslogtreecommitdiffstats
path: root/huawei/vnfmadapter/VnfmadapterService
diff options
context:
space:
mode:
authorliuqian <liuqian13@huawei.com>2018-05-24 12:39:44 +0800
committerliuqian <liuqian13@huawei.com>2018-05-24 12:39:44 +0800
commit0ca9baabf9ad09ea1a65f832a9ed4637b87087a1 (patch)
treee9147acdfae6c7b8d0bf319f5de941f45bbc102d /huawei/vnfmadapter/VnfmadapterService
parentb134e6b307a65cf282e25a1c53f0f68e2807ddec (diff)
modify healVnf vmid
Change-Id: I6fa69cb3a35a295d7055e256ae54a39eadd22409 Issue-ID: VFC-920 Signed-off-by: liuqian <liuqian13@huawei.com>
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService')
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java20
1 files changed, 18 insertions, 2 deletions
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 42d5b875..92b28f36 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
@@ -350,13 +350,13 @@ public class VnfMgrVnfm implements InterfaceVnfMgr {
String action = jsonObject.getString("action");
JSONObject affectedVm = jsonObject.getJSONObject("affectedvm");
- String vmId = affectedVm.getString("vmid");
+ String vmId = getNativeVmId(affectedVm.getString("vmid"), vnfmObjcet, vnfInstanceId);
String path = String.format(ParamConstants.HEAL_VNF, vmId);
JSONObject subJsonObject = new JSONObject();
subJsonObject.put("type", "hard");
subJsonObject.put("boot_mode", "");
- if("vmReset".equals(action)) {
+ if("vmReset".equalsIgnoreCase(action)) {
subJsonObject.put("action", "reset");
}
LOG.info("healVnf subJsonObject :" + subJsonObject);
@@ -374,6 +374,22 @@ public class VnfMgrVnfm implements InterfaceVnfMgr {
return restJson;
}
+ private String getNativeVmId(String vimVmId, JSONObject vnfmObjcet, String vnfInstanceId) {
+ JSONObject queryVms = ResultRequestUtil.call(vnfmObjcet,
+ String.format(ParamConstants.VNF_GET_VMINFO, vnfInstanceId), Constant.GET, null, Constant.CERTIFICATE);
+ LOG.info("function=getNativeVmId, msg=query vms result=" + queryVms);
+ JSONArray vms = queryVms.getJSONObject("data").getJSONArray("vms");
+ for(int i = 0; i < vms.size(); i++) {
+ JSONObject obj = vms.getJSONObject(i);
+ String tmpVimVmId = obj.getString("backend_id");
+ if(vimVmId.equalsIgnoreCase(tmpVimVmId)) {
+ return obj.getString("id");
+ }
+ }
+ LOG.error("function=getNativeVmId, msg=get native vmId failed.");
+ return "";
+ }
+
public JSONObject getJobFromVnfm(JSONObject vnfmObjcet, String jobId) {
LOG.warn("function=getJobFromVnfm, jobId: {}", jobId);