From 97ae8f2529f7a4976848bc194db3488d912e541b Mon Sep 17 00:00:00 2001 From: Arun Arora Date: Thu, 9 Nov 2017 18:01:14 +0530 Subject: VMWare vesagent integration tests bug fixes 1. Fix the schema text for Alarm OFF event 2. Fix for maintaining VES Send state in case of Error Response Change-Id: I336fa7cab22ed409c2deb6f99528c04e32fa44af Issue-ID: MULTICLOUD-8 Signed-off-by: Arun Arora --- .../onap/multicloud/openstack/vmware/VESRestAPI.java | 18 ++++++++++++------ .../onap/multicloud/openstack/vmware/VsphereData.java | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VESRestAPI.java b/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VESRestAPI.java index 9fef06e..5298261 100644 --- a/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VESRestAPI.java +++ b/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VESRestAPI.java @@ -60,11 +60,11 @@ public class VESRestAPI{ post.setHeader("Content-type", applicationJson); HttpResponse response = client.execute(post); log.info(response.getStatusLine().toString()); + sock.close(); + client.close(); if(vESCollectorSendStatus(response,map,uuidKey,list,timer,vesSendStatus)){ return true; } - sock.close(); - client.close(); } }catch(Exception e){ log.info("VES Collector connection refused, exception occured"); @@ -101,6 +101,8 @@ public class VESRestAPI{ post.addHeader("Accept", applicationJson); HttpResponse response = client.execute(post); log.info(response.getStatusLine().toString()); + sock.close(); + client.close(); if(!connectionRefused(response)){ return true; } @@ -108,8 +110,6 @@ public class VESRestAPI{ return true; } } - sock.close(); - client.close(); }catch(Exception e){ log.info("connection refused, exception occured"); log.error("error",e); @@ -135,7 +135,7 @@ public class VESRestAPI{ } - public boolean vESCollectorSendStatus ( HttpResponse response,JsonStoreMap map,String uuidKey, List list,VesTimer timer,String vesSendStatus) throws ParseException { + public boolean vESCollectorSendStatus ( HttpResponse response,JsonStoreMap map,String uuidKey, List list,VesTimer timer,String vesSendStatus) throws ParseException { JsonAlarmStorage store = list.get(0); log.info(String.valueOf(list.size())); log.info(store.alarm); @@ -172,8 +172,14 @@ public class VESRestAPI{ log.info("timer is not running...."); } return true; + }else if(response.getStatusLine().getStatusCode()>=400 && response.getStatusLine().getStatusCode()<600){ + if(alarmStatus == "OFF" && vesSendStatus=="new"){ + list.get(0).vesSendStatus = "failed"; + map.updateMap(uuidKey, list); + } + return true; }else{ - log.info("connection error !200"); + log.info("connection error"); return false; } } diff --git a/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VsphereData.java b/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VsphereData.java index f3dce32..e1a0b19 100644 --- a/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VsphereData.java +++ b/vesagent/src/main/java/org/onap/multicloud/openstack/vmware/VsphereData.java @@ -82,7 +82,7 @@ public class VsphereData { else { eventName="Fault_MultiCloud_VMFailureCleared"; priority="Normal"; - eventSeverity="Normal" ; + eventSeverity="NORMAL" ; alarmCondition="Vm_Restart"; vfStatus="Active"; specificProblem="AlarmOff"; -- cgit 1.2.3-korg