summaryrefslogtreecommitdiffstats
path: root/huawei/vnfmadapter/VnfmadapterService
diff options
context:
space:
mode:
authorliuqian <liuqian13@huawei.com>2018-05-25 17:47:17 +0800
committerliuqian <liuqian13@huawei.com>2018-05-25 17:47:17 +0800
commita97127783318ee42d800085ceb44dc361c02e3c3 (patch)
tree15cbe6a9abb9eedf09a8c9cb05006033af449282 /huawei/vnfmadapter/VnfmadapterService
parent3deb44ab5e917eeab3313166f374fae6bf095dde (diff)
fix bug
Change-Id: Icde7c7ebdf27646522aeab223e41e1a2316022e9 Issue-ID: VFC-923 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/rest/VnfResourceRoa.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfResourceRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfResourceRoa.java
index dbd87301..fa1e4c39 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfResourceRoa.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfResourceRoa.java
@@ -121,16 +121,17 @@ public class VnfResourceRoa {
JSONArray vmList = dataObject.getJSONArray("vm_list");
String changeType = "";
String operation = "";
- if(1 == dataObject.getInt("event_type")) {
+ int eventType = dataObject.getInt("event_type");
+ if(1 == eventType) {
changeType = "added";
operation = "Instantiate";
- } else if(4 == dataObject.getInt("event_type")) {
+ } else if(4 == eventType) {
changeType = "removed";
operation = "Terminal";
- } else if(3 == dataObject.getInt("event_type")) {
+ } else if(3 == eventType) {
changeType = "added";
operation = "Scaleout";
- } else if(2 == dataObject.getInt("event_type")) {
+ } else if(2 == eventType) {
changeType = "removed";
operation = "Scalein";
}
@@ -138,6 +139,9 @@ public class VnfResourceRoa {
for(int i = 0; i < vmList.size(); i++) {
JSONObject vm = vmList.getJSONObject(i);
LOG.info("function=callLcmNotify, vm: {}", vm);
+ if((2 == eventType) && ("Active".equalsIgnoreCase(vm.getString("status")))) {
+ continue;
+ }
JSONObject affectedVm = new JSONObject();
String vimVimId = vm.getString("vim_vm_id");
affectedVm.put("vnfcInstanceId", vimVimId);
@@ -149,6 +153,10 @@ public class VnfResourceRoa {
LOG.info("function=callLcmNotify, affectedVm: {}", affectedVm);
affectedVnfc.add(affectedVm);
}
+ if(affectedVnfc.isEmpty()) {
+ LOG.warn("function=callLcmNotify, affectedVnfc is empty.");
+ return;
+ }
JSONObject notification = new JSONObject();
notification.put("status", dataObject.getString("vnf_status"));
notification.put("vnfInstanceId", vnfInstanceId);