summaryrefslogtreecommitdiffstats
path: root/veslibrary/ves_javalibrary
diff options
context:
space:
mode:
Diffstat (limited to 'veslibrary/ves_javalibrary')
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelBatch.java2
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java5
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java8
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java9
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java5
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java28
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java4
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/FaultData.java446
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/HeartBeatData.java67
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java81
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslogData.java89
-rw-r--r--veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java426
18 files changed, 286 insertions, 908 deletions
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelBatch.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelBatch.java
index 9cc3d2b..a90733c 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelBatch.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelBatch.java
@@ -60,7 +60,7 @@ public class EvelBatch {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event header only message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
JsonObjectBuilder batchobj = Json.createObjectBuilder();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java
index 35685d8..57192a8 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java
@@ -463,7 +463,6 @@ public class EvelFault extends EvelHeader {
String fault_severity;
String fault_source_type;
String fault_vf_status;
- // double version = major_version+(double)minor_version/10;
String version = "4.0";
EVEL_ENTER();
@@ -547,7 +546,7 @@ public class EvelFault extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
//encode common event header and body
@@ -563,7 +562,7 @@ public class EvelFault extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
//encode common event header and body
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java
index 9d8de72..133c172 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java
@@ -39,9 +39,6 @@ import org.apache.log4j.Logger;
public class EvelHeartbeatField extends EvelHeader {
- //version of Heartbeat field format revisions
- int major_version = 1;
- int minor_version = 0;
/**************************************************************************//**
* Alert types.
@@ -57,7 +54,6 @@ public class EvelHeartbeatField extends EvelHeader {
/***************************************************************************/
/* Optional fields */
/***************************************************************************/
- // ArrayList<String[]> additional_info;
HashMap<String, String > additional_inf;
@@ -212,7 +208,7 @@ public class EvelHeartbeatField extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -230,7 +226,7 @@ public class EvelHeartbeatField extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java
index f4287e0..6291844 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java
@@ -39,9 +39,6 @@ import org.apache.log4j.Logger;
public class EvelMobileFlow extends EvelHeader {
- int major_version = 2;
- int minor_version = 0;
-
static int EVEL_TOS_SUPPORTED = 256;
/**************************************************************************//**
@@ -421,7 +418,6 @@ public class EvelMobileFlow extends EvelHeader {
/***************************************************************************/
/* Optional fields */
/***************************************************************************/
- //ArrayList<String[]> ipTosList;
Map<String,String> additional_inf;
Map<String,String> hashMap;
@@ -1969,7 +1965,6 @@ public class EvelMobileFlow extends EvelHeader {
-
metrics.dur_connection_failed_status.encJsonValue(obj, "durConnectionFailedStatus");
metrics.dur_tunnel_failed_status.encJsonValue(obj, "durTunnelFailedStatus");
metrics.flow_activated_by.encJsonValue(obj, "flowActivatedBy");
@@ -2097,7 +2092,7 @@ public class EvelMobileFlow extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -2115,7 +2110,7 @@ public class EvelMobileFlow extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java
index 2f27a96..5087e2e 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java
@@ -461,7 +461,7 @@ public class EvelNotification extends EvelHeader {
}
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -479,7 +479,7 @@ public class EvelNotification extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java
index d01387a..dbfaff3 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java
@@ -341,7 +341,7 @@ public class EvelOther extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -359,7 +359,7 @@ public class EvelOther extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java
index c964849..1b286b4 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java
@@ -372,7 +372,7 @@ public class EvelPnfRegistration extends EvelHeader{
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION);
//encode common event header and body
@@ -388,7 +388,7 @@ public class EvelPnfRegistration extends EvelHeader{
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION);
//encode common event header and body
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java
index 2f1d759..875f157 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java
@@ -6192,7 +6192,7 @@ public class EvelScalingMeasurement extends EvelHeader {
*
* retval : String of JSON event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -6210,7 +6210,8 @@ public class EvelScalingMeasurement extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java
index d2d9fc1..98bb056 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java
@@ -538,7 +538,7 @@ public class EvelSipSignaling extends EvelHeader {
*
* retval : String of JSON event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -556,7 +556,7 @@ public class EvelSipSignaling extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java
index 25ffef5..6fbc5b5 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java
@@ -259,7 +259,7 @@ public class EvelStateChange extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON state change event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -277,7 +277,7 @@ public class EvelStateChange extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java
index 847e7a0..f8bed62 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java
@@ -627,7 +627,7 @@ public class EvelSyslog extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON syslog event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -645,7 +645,7 @@ public class EvelSyslog extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java
index 128d8be..2cf5da3 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java
@@ -43,10 +43,6 @@ import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS;
public class EvelThresholdCross extends EvelHeader {
-
- int major_version = 1;
- int minor_version = 0;
-
/**************************************************************************//**
* Alert types.
* JSON equivalent fields: newState, oldState
@@ -104,7 +100,6 @@ public class EvelThresholdCross extends EvelHeader {
/***************************************************************************/
/* Optional fields */
/***************************************************************************/
- //ArrayList<String[]> additional_info;
Map<String,String> additional_inf;
@@ -151,18 +146,14 @@ public class EvelThresholdCross extends EvelHeader {
super(evname,evid);
event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING;
assert( tcriticality!= null );
- // assert( tname!= null );
assert( tthresholdCrossed!= null );
- // assert( tvalue!= null );
assert( talertAction!= null );
additionalParameters = new PERF_COUNTER();
assert( additionalParameters != null);
additionalParameters.criticality = tcriticality;
- // additionalParameters.name = tname;
additionalParameters.thresholdCrossed = tthresholdCrossed;
- // additionalParameters.value = tvalue;
additionalParameters.hashMap = null;
@@ -252,7 +243,6 @@ public class EvelThresholdCross extends EvelHeader {
*****************************************************************************/
public void evel_thresholdcross_addl_info_add(String name, String value)
{
- //String[] addl_info = null;
EVEL_ENTER();
/***************************************************************************/
@@ -264,17 +254,11 @@ public class EvelThresholdCross extends EvelHeader {
if( additional_inf == null )
{
- // additional_info = new ArrayList<String[]>();
additional_inf = new HashMap<String,String>();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- // addl_info = new String[2];
- // assert(addl_info != null);
- // addl_info[0] = name;
- // addl_info[1] = value;
additional_inf.put(name, value);
- // additional_info.add(addl_info);
EVEL_EXIT();
}
@@ -296,7 +280,7 @@ public class EvelThresholdCross extends EvelHeader {
*****************************************************************************/
public void evel_thresholdcross_hashMap_add(String name, String value)
{
- //String[] addl_info = null;
+
EVEL_ENTER();
/***************************************************************************/
@@ -308,17 +292,11 @@ public class EvelThresholdCross extends EvelHeader {
if( additionalParameters.hashMap == null )
{
- // additional_info = new ArrayList<String[]>();
additionalParameters.hashMap = new HashMap<String,String>();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- // addl_info = new String[2];
- // assert(addl_info != null);
- // addl_info[0] = name;
- // addl_info[1] = value;
additionalParameters.hashMap.put(name, value);
- // additional_info.add(addl_info);
EVEL_EXIT();
}
@@ -708,7 +686,7 @@ public class EvelThresholdCross extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON TCA event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -726,7 +704,7 @@ public class EvelThresholdCross extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java
index d33abce..d964c74 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java
@@ -741,7 +741,7 @@ public class EvelVoiceQuality extends EvelHeader {
* Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON Voice Quality event message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ public JsonObject evel_json_encode_event()
{
EVEL_ENTER();
@@ -759,7 +759,7 @@ public class EvelVoiceQuality extends EvelHeader {
}
- JsonObject evel_json_encode_event_batch()
+ public JsonObject evel_json_encode_event_batch()
{
EVEL_ENTER();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/FaultData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/FaultData.java
index 135838e..046051c 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/FaultData.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/FaultData.java
@@ -39,6 +39,7 @@ import java.util.Map;
import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@@ -116,7 +117,7 @@ public class FaultData{
static int falut_raised =0;
-
+ private static final Logger logger = Logger.getLogger(AgentMain.class);
public final Runnable faultInstance01;
public final Runnable faultInstance02;
@@ -126,17 +127,17 @@ public class FaultData{
@Override
public void run() {
- int gm_event_id = 1;
- String event_id2=null;
+ int gmEventId = 1;
+ String eventId2=null;
- Long start_epoch_microsec = 0L;
- Long last_epoch_microsec = 0L;
+ Long startEpochMicrosec = 0L;
+ Long lastEpochMicrosec = 0L;
String hostName = hostName();
try {
readFalutConfig();
readVppMetrics(resDevice);
} catch (IOException | ParseException e1) {
-
+ logger.error(e1);
}
@@ -149,41 +150,41 @@ public class FaultData{
return;
}
- HashMap<String, DeviceData> falut_last_metrics = readVppMetrics(resDevice);
+ HashMap<String, DeviceData> falutLastMetrics = readVppMetrics(resDevice);
while(true) {
try {
- EvelBatch ebt = new EvelBatch();
+
for( String falut : intFaceMapFault ) {
- HashMap<String, DeviceData> falut_current_metrics = readVppMetrics(resDevice);
+ HashMap<String, DeviceData> falutCurrentMetrics = readVppMetrics(resDevice);
- for( String tmp_device :falut_current_metrics.keySet() ) {
+ for( String tmp_device :falutCurrentMetrics.keySet() ) {
- int receivedOctetsDelta = Integer.parseInt((falut_current_metrics.get(tmp_device).getT1Bytesin()) )
- - Integer.parseInt((falut_last_metrics.get(tmp_device).getT0bytesIn()));
+ int receivedOctetsDelta = Integer.parseInt((falutCurrentMetrics.get(tmp_device).getT1Bytesin()) )
+ - Integer.parseInt((falutLastMetrics.get(tmp_device).getT0bytesIn()));
- int receivedTotalPacketsDelta = Integer.parseInt((falut_current_metrics.get(tmp_device).getT1Packetsin()) )
- - Integer.parseInt((falut_last_metrics.get(tmp_device).getT0packetIn()));
+ int receivedTotalPacketsDelta = Integer.parseInt((falutCurrentMetrics.get(tmp_device).getT1Packetsin()) )
+ - Integer.parseInt((falutLastMetrics.get(tmp_device).getT0packetIn()));
- int transmittedOctetsDelta = Integer.parseInt((falut_current_metrics.get(tmp_device).getT1Bytesout()) )
- - Integer.parseInt((falut_last_metrics.get(tmp_device).getT0bytesOut()));
+ int transmittedOctetsDelta = Integer.parseInt((falutCurrentMetrics.get(tmp_device).getT1Bytesout()) )
+ - Integer.parseInt((falutLastMetrics.get(tmp_device).getT0bytesOut()));
- int transmittedTotalPacketsDelta = Integer.parseInt((falut_current_metrics.get(tmp_device).getT1Packetsout()) )
- - Integer.parseInt((falut_last_metrics.get(tmp_device).getT0packetOut()));
+ int transmittedTotalPacketsDelta = Integer.parseInt((falutCurrentMetrics.get(tmp_device).getT1Packetsout()) )
+ - Integer.parseInt((falutLastMetrics.get(tmp_device).getT0packetOut()));
- String alarmInterface = tmp_device; //resDevice[0];
+ String alarmInterface = tmp_device;
if((receivedOctetsDelta < Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark")) || transmittedOctetsDelta < Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark")) ||
receivedTotalPacketsDelta < Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark")) || transmittedTotalPacketsDelta < Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark"))) && falut_raised == 0){
- event_id2 = event_id1+ event_id+(gm_event_id++);
- EvelFault eveFalt = new EvelFault(faultInstanceres01.get("eventName"),event_id2, alarmCondition, specificProblem,
+ eventId2 = event_id1+ event_id+(gmEventId++);
+ EvelFault eveFalt = new EvelFault(faultInstanceres01.get("eventName"),eventId2, alarmCondition, specificProblem,
EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW,
EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER,
@@ -195,32 +196,32 @@ public class FaultData{
if( faultConfig.get("eventType")!=null) {
eveFalt.evel_fault_type_set(faultConfig.get("eventType"));
- start_epoch_microsec = last_epoch_microsec;
- last_epoch_microsec = System.nanoTime()/1000;
+ startEpochMicrosec = lastEpochMicrosec;
+ lastEpochMicrosec = System.nanoTime()/1000;
- eveFalt.evel_last_epoch_set(start_epoch_microsec);
- eveFalt.evel_start_epoch_set(last_epoch_microsec);
+ eveFalt.evel_last_epoch_set(startEpochMicrosec);
+ eveFalt.evel_start_epoch_set(lastEpochMicrosec);
eveFalt.evel_fault_category_set(eventCategory);
eveFalt.evel_fault_interface_set(alarmInterface.replaceAll("^[\"']+|[\"']+$", ""));
- eveFalt.evel_nfcnamingcode_set(faultConfig.get("nfcNamingCode").toString());
- eveFalt.evel_nfnamingcode_set(faultConfig.get("nfNamingCode").toString());
+ eveFalt.evel_nfcnamingcode_set(faultConfig.get("nfcNamingCode"));
+ eveFalt.evel_nfnamingcode_set(faultConfig.get("nfNamingCode"));
if(faultConfig.get("reportingEntityName") == null) {
eveFalt.evel_reporting_entity_name_set(hostName);
}else {
- eveFalt.evel_reporting_entity_name_set(faultConfig.get("reportingEntityName").toString());
+ eveFalt.evel_reporting_entity_name_set(faultConfig.get("reportingEntityName"));
}
- eveFalt.evel_reporting_entity_id_set(faultConfig.get("reportingEntityId").toString());
- eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName").toString());
- eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId").toString());
+ eveFalt.evel_reporting_entity_id_set(faultConfig.get("reportingEntityId"));
+ eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName"));
+ eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId"));
if(faultConfig.get("sourceName") == null) {
eveFalt.evel_header_set_source_name(hostName);
}else {
- eveFalt.evel_header_set_source_name(faultConfig.get("sourceName").toString());
+ eveFalt.evel_header_set_source_name(faultConfig.get("sourceName"));
}
- eveFalt.evel_timeZoneOffset_set(faultConfig.get("timeZoneOffset").toString());
+ eveFalt.evel_timeZoneOffset_set(faultConfig.get("timeZoneOffset"));
AgentMain.evel_post_event(eveFalt);
}
@@ -229,8 +230,8 @@ public class FaultData{
}else if((receivedOctetsDelta > Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark")) && transmittedOctetsDelta > Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark")) &&
receivedTotalPacketsDelta > Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark")) && transmittedTotalPacketsDelta > Integer.parseInt((String)faultInstanceres01.get("tmp_lowWaterMark"))) && falut_raised == 1) {
- event_id2 = event_id1+event_id+ (gm_event_id++);
- EvelFault eveFalt = new EvelFault(faultInstanceres01.get("eventName"),event_id2, alarmConditionClear, specificProblemClear,
+ eventId2 = event_id1+event_id+ (gmEventId++);
+ EvelFault eveFalt = new EvelFault(faultInstanceres01.get("eventName"),eventId2, alarmConditionClear, specificProblemClear,
EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW,
EVEL_SEVERITIES.EVEL_SEVERITY_NORMAL,
EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER,
@@ -246,28 +247,28 @@ public class FaultData{
eveFalt.evel_fault_category_set(eventCategory);
eveFalt.evel_fault_interface_set(alarmInterface.replaceAll("^[\"']+|[\"']+$", ""));
- eveFalt.evel_nfcnamingcode_set(faultConfig.get("nfcNamingCode").toString());
- eveFalt.evel_nfnamingcode_set(faultConfig.get("nfNamingCode").toString());
+ eveFalt.evel_nfcnamingcode_set(faultConfig.get("nfcNamingCode"));
+ eveFalt.evel_nfnamingcode_set(faultConfig.get("nfNamingCode"));
if(faultConfig.get("reportingEntityName") == null) {
eveFalt.evel_reporting_entity_name_set(hostName);
}else {
- eveFalt.evel_reporting_entity_name_set(faultConfig.get("reportingEntityName").toString());
+ eveFalt.evel_reporting_entity_name_set(faultConfig.get("reportingEntityName"));
}
- eveFalt.evel_reporting_entity_id_set(faultConfig.get("reportingEntityId").toString());
- eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName").toString());
- eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId").toString());
+ eveFalt.evel_reporting_entity_id_set(faultConfig.get("reportingEntityId"));
+ eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName"));
+ eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId"));
if(faultConfig.get("sourceName") == null) {
eveFalt.evel_header_set_source_name(hostName);
}else {
- eveFalt.evel_header_set_source_name(faultConfig.get("sourceName").toString());
+ eveFalt.evel_header_set_source_name(faultConfig.get("sourceName"));
}
- eveFalt.evel_timeZoneOffset_set(faultConfig.get("timeZoneOffset").toString());
+ eveFalt.evel_timeZoneOffset_set(faultConfig.get("timeZoneOffset"));
AgentMain.evel_post_event(eveFalt);
}
@@ -296,7 +297,7 @@ public class FaultData{
}catch (Exception e) {
-
+ logger.error(e);
}
@@ -308,10 +309,10 @@ public class FaultData{
@Override
public void run() {
- int gm_event_id = 1;
- String event_id2=null;
- Long start_epoch_microsec = 0L;
- Long last_epoch_microsec = 0L;
+ int gmEventid = 1;
+ String eventid2=null;
+ Long startEpochmicrosec = 0L;
+ Long lastEpochmicrosec = 0L;
String hostName = hostName();
try {
readFalutConfig();
@@ -343,8 +344,8 @@ public class FaultData{
if(ins02Cmd < Integer.parseInt((String)falutMetric.get("Instanceres02Cmd").getInstanceres02Command())){
- event_id2 = event_id1+ event_id+(gm_event_id++);
- EvelFault eveFalt = new EvelFault(Instance02eventName,event_id2, setAlarmCondition, setSpecificProblem,
+ eventid2 = event_id1+ event_id+(gmEventid++);
+ EvelFault eveFalt = new EvelFault(Instance02eventName,eventid2, setAlarmCondition, setSpecificProblem,
EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW,
EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
EVEL_SOURCE_TYPES.EVEL_SOURCE_VIRTUAL_MACHINE,
@@ -360,11 +361,11 @@ public class FaultData{
if( faultConfig.get("eventType")!=null) {
eveFalt.evel_fault_type_set(faultConfig.get("eventType"));
- start_epoch_microsec = last_epoch_microsec;
- last_epoch_microsec = System.nanoTime()/1000;
+ startEpochmicrosec = lastEpochmicrosec;
+ lastEpochmicrosec = System.nanoTime()/1000;
- eveFalt.evel_last_epoch_set(start_epoch_microsec);
- eveFalt.evel_start_epoch_set(last_epoch_microsec);
+ eveFalt.evel_last_epoch_set(startEpochmicrosec);
+ eveFalt.evel_start_epoch_set(lastEpochmicrosec);
eveFalt.evel_fault_category_set(Instance02eventCategory);
eveFalt.evel_fault_interface_set(Instance02alarmInterfaceA.replaceAll("^[\"']+|[\"']+$", ""));
@@ -398,8 +399,8 @@ public class FaultData{
}else if(ins02Cmd > Integer.parseInt((String)falutMetric.get("Instanceres02Cmd").getInstanceres02Command())) {
- event_id2 = event_id1+ event_id+(gm_event_id++);
- EvelFault eveFalt = new EvelFault(Instance02eventName,event_id2, ins02alarmConditionClear, ins02specificProblemClear,
+ eventid2 = event_id1+ event_id+(gmEventid++);
+ EvelFault eveFalt = new EvelFault(Instance02eventName,eventid2, ins02alarmConditionClear, ins02specificProblemClear,
EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW,
EVEL_SEVERITIES.EVEL_SEVERITY_NORMAL,
EVEL_SOURCE_TYPES.EVEL_SOURCE_VIRTUAL_MACHINE,
@@ -458,14 +459,14 @@ public class FaultData{
}
Thread.sleep(Integer.parseInt(Ins02Interval));
}catch(Exception e) {
-
+ logger.error(e);
}
}catch (Exception e) {
-
+ logger.error(e);
}
-
+ break;
}
}
};
@@ -517,8 +518,7 @@ public class FaultData{
}
}
} catch (SocketException e) {
- // TODO Auto-generated catch block
-
+ logger.error(e);
}
return hostname;
@@ -526,7 +526,7 @@ public class FaultData{
- public static HashMap<String, String> readFalutConfig() throws IOException, ParseException {
+ private static HashMap<String, String> readFalutConfig() throws IOException, ParseException {
@@ -717,7 +717,7 @@ public class FaultData{
} catch (ClassCastException ex) {
- ex.printStackTrace();
+ logger.error(ex);
}
return faultConfig;
}
@@ -725,207 +725,15 @@ public class FaultData{
- public static HashMap<String, String> readFalutConfig1() throws IOException, ParseException {
- List<String> list = new ArrayList<String>();
- JSONParser jsonParser = new JSONParser();
- try {
-
- FileReader reader = new FileReader("./src/main/java/evel_javalibrary/att/com/loadbalance/flt_config.json");
- JSONObject obj = (JSONObject) jsonParser.parse(reader);
- Map.Entry directPair = null;
- String directObject ="";
- String[] directres;
- Map directParameters = ((Map)obj.get("tmp_directParameters"));
- Iterator<Map.Entry> itr1 = directParameters.entrySet().iterator();
- while (itr1.hasNext()) {
- directPair = itr1.next();
- directObject=String.valueOf(directPair);
- directres = directObject.split("=");
- faultConfig.put(directres[0], directres[1]);
- }
- JSONArray arrJson = (JSONArray) directParameters.get("tmp_device");
- resDevice = new String[arrJson.size()];
- for(int i = 0; i < arrJson.size(); i++)
- resDevice[i] = (String) arrJson.get(i);
-
-
- //tmp_indirectParameters
- Map.Entry indirectPair = null;
- String indirectObject ="";
- String[] indirectres;
- Map indirectParameters = ((Map)obj.get("tmp_indirectParameters"));
- Iterator<Map.Entry> itr2 = indirectParameters.entrySet().iterator();
- while (itr2.hasNext()) {
- indirectPair = itr2.next();
- indirectObject=String.valueOf(indirectPair);
- indirectres = indirectObject.split("=");
- faultConfig.put(indirectres[0], indirectres[1]);
- }
-
-
- //tmp_faultInstance01
- Map.Entry faultInstancePair = null;
- String faultInstanceObject ="";
- String[] faultInstanceres;
- Map faultInstanceParameters = ((Map)indirectParameters.get("tmp_faultInstance01"));
- Iterator<Map.Entry> itr3 = faultInstanceParameters.entrySet().iterator();
- while (itr3.hasNext()) {
- faultInstancePair = itr3.next();
- faultInstanceObject=String.valueOf(faultInstancePair);
- faultInstanceres = faultInstanceObject.split("=");
- faultInstanceres01.put(faultInstanceres[0], faultInstanceres[1]);
- }
-
-
- eventCategory = faultInstanceres01.get("eventCategory").toString();
- eventSourceType = faultInstanceres01.get("eventSourceType").toString();
- //tmp_init
- Map.Entry tempInitPair = null;
- String tempInitObject ="";
- Map tempInitParameters = ((Map)faultInstanceParameters.get("tmp_init"));
- Iterator<Map.Entry> itr4 = tempInitParameters.entrySet().iterator();
- while (itr4.hasNext()) {
- tempInitPair = itr4.next();
- tempInitObject=String.valueOf(tempInitPair);
- tempInitres = tempInitObject.split("=");
- faultConfigTempInit.put(tempInitres[0], tempInitres[1]);
- }
-
- String tmp_t0BytesOut = faultConfigTempInit.get("tmp_init");
-
-
-
- //tmp_command
- Map.Entry tempcommandPair = null;
- String tempcommandObject ="";
- Map tempcommandParameters = ((Map)faultInstanceParameters.get("tmp_command"));
- Iterator<Map.Entry> itr5 = tempcommandParameters.entrySet().iterator();
- while (itr5.hasNext()) {
- tempcommandPair = itr5.next();
- tempcommandObject=String.valueOf(tempcommandPair);
- tempcommandres = tempcommandObject.split("=");
- faultConfig.put(tempcommandres[0], tempcommandres[1]);
- }
-
- //tmp_alarmSetParameters
- Map.Entry alarmSetPair = null;
- String alarmSetObject ="";
- String[] alarmSetres;
- Map alarmSetParameters = ((Map)faultInstanceParameters.get("tmp_alarmSetParameters"));
- Iterator<Map.Entry> itr6 = alarmSetParameters.entrySet().iterator();
- while (itr6.hasNext()) {
- alarmSetPair = itr6.next();
- alarmSetObject=String.valueOf(alarmSetPair);
- alarmSetres = alarmSetObject.split("=");
- faultConfig.put(alarmSetres[0], alarmSetres[1]);
- }
-
-
- alarmCondition = faultConfig.get("alarmCondition").toString();
- specificProblem = faultConfig.get("specificProblem").toString();
- eventSeverity = faultConfig.get("eventSeverity").toString();
-
- //tmp_alarmClearParameters
- Map.Entry alarmClearPair = null;
- String alarmClearObject ="";
- String[] alarmClearres;
- Map alarmClearParameters = ((Map)faultInstanceParameters.get("tmp_alarmClearParameters"));
- Iterator<Map.Entry> itr7 = alarmClearParameters.entrySet().iterator();
- while (itr7.hasNext()) {
- alarmClearPair = itr7.next();
- alarmClearObject=String.valueOf(alarmClearPair);
- alarmClearres = alarmClearObject.split("=");
- tempAlaramClearParameter.put(alarmClearres[0], alarmClearres[1]);
- }
-
- alarmConditionClear = tempAlaramClearParameter.get("alarmCondition").toString();
- specificProblemClear = tempAlaramClearParameter.get("specificProblem").toString();
- eventSeverityClear = tempAlaramClearParameter.get("eventSeverity").toString();
-
-
- //tmp_faultInstance02
- Map.Entry faultInstance02Pair = null;
- String faultInstance02Object ="";
- String[] faultInstance02res;
- Map faultInstance02Parameters = ((Map)indirectParameters.get("tmp_faultInstance02"));
- Iterator<Map.Entry> itr8 = faultInstance02Parameters.entrySet().iterator();
- while (itr8.hasNext()) {
- faultInstance02Pair = itr8.next();
- faultInstance02Object=String.valueOf(faultInstance02Pair);
- faultInstance02res = faultInstance02Object.split("=");
- faultInstanceres02.put(faultInstance02res[0], faultInstance02res[1]);
- }
- Instance02alarmInterfaceA = faultInstanceres02.get("alarmInterfaceA");
- Instance02eventCategory = faultInstanceres02.get("eventCategory");
- Instance02eventSourceType = faultInstanceres02.get("eventSourceType");
- Instance02eventName = faultInstanceres02.get("eventName");
-
- //tmp_command
- Map.Entry tempcommand02Pair = null;
- String tempcommand02Object ="";
- Map tempcommand02Parameters = ((Map)faultInstance02Parameters.get("tmp_command"));
- Iterator<Map.Entry> itr9 = tempcommand02Parameters.entrySet().iterator();
- while (itr9.hasNext()) {
- tempcommand02Pair = itr9.next();
- tempcommand02Object=String.valueOf(tempcommand02Pair);
- tempcommand02res = tempcommand02Object.split("=");
- faultInstanceres02.put(tempcommand02res[0], tempcommand02res[1]);
- }
-
-
-
- //tmp_alarmSetParameters
- Map.Entry Instance02alarmSetPair = null;
- String Instance02alarmSetObject ="";
- String[] Instance02alarmSetres;
- Map Instance02alarmSetParameters = ((Map)faultInstance02Parameters.get("tmp_alarmSetParameters"));
- Iterator<Map.Entry> itr10 = Instance02alarmSetParameters.entrySet().iterator();
- while (itr10.hasNext()) {
- Instance02alarmSetPair = itr10.next();
- Instance02alarmSetObject=String.valueOf(Instance02alarmSetPair);
- Instance02alarmSetres = Instance02alarmSetObject.split("=");
- faultInstanceres02.put(Instance02alarmSetres[0], Instance02alarmSetres[1]);
- }
-
-
- setAlarmCondition = faultInstanceres02.get("alarmCondition").toString();
- setSpecificProblem = faultInstanceres02.get("specificProblem").toString();
- setEventSeverity = faultInstanceres02.get("eventSeverity").toString();
-
- //tmp_alarmClearParameters
- Map.Entry Instanceres02alarmClearPair = null;
- String Instanceres02alarmClearObject ="";
- String[] Instanceres02alarmClearres;
- Map Instanceres02alarmClearParameters = ((Map)faultInstance02Parameters.get("tmp_alarmClearParameters"));
- Iterator<Map.Entry> itr11 = Instanceres02alarmClearParameters.entrySet().iterator();
- while (itr11.hasNext()) {
- Instanceres02alarmClearPair = itr11.next();
- Instanceres02alarmClearObject=String.valueOf(Instanceres02alarmClearPair);
- Instanceres02alarmClearres = Instanceres02alarmClearObject.split("=");
- Instanceres02ClearParameter.put(Instanceres02alarmClearres[0], Instanceres02alarmClearres[1]);
- }
-
- ins02alarmConditionClear = Instanceres02ClearParameter.get("alarmCondition").toString();
- ins02specificProblemClear = Instanceres02ClearParameter.get("specificProblem").toString();
- ins02eventSeverityClear = Instanceres02ClearParameter.get("eventSeverity").toString();
-
-
-
-
- } catch (ClassCastException ex) {
- ex.printStackTrace();
- }
- return faultConfig;
- }
- public static HashMap<String, DeviceData> readVppMetrics(String[] linkStart) {
+ private static HashMap<String, DeviceData> readVppMetrics(String[] linkStart) {
//t0
- String Bytesin = faultConfigTempInit.get("tmp_t0BytesIn");
- String BytesOut = faultConfigTempInit.get("tmp_t0BytesOut").toString();
- String PacketsIn = faultConfigTempInit.get("tmp_t0PacketsIn");
- String PacketsOut = faultConfigTempInit.get("tmp_t0PacketsOut");
+ String bytesIn = faultConfigTempInit.get("tmp_t0BytesIn");
+ String bytesOut = faultConfigTempInit.get("tmp_t0BytesOut").toString();
+ String packetsIn = faultConfigTempInit.get("tmp_t0PacketsIn");
+ String packetsOut = faultConfigTempInit.get("tmp_t0PacketsOut");
//t1
@@ -946,31 +754,31 @@ public class FaultData{
//t0
String replaceBytesin ="";
- if(Bytesin.contains("$tmp_device")) {
- String repString = Bytesin.replace("$tmp_device", device.trim());
+ if(bytesIn.contains("$tmp_device")) {
+ String repString = bytesIn.replace("$tmp_device", device.trim());
replaceBytesin = repString.replace("sudo", "/bin/sh,-c,");
}
String[] bytesinArray= replaceBytesin.split(",");
String replaceBytesOut ="";
- if(BytesOut.contains("$tmp_device")) {
- String repString = BytesOut.replace("$tmp_device", device.trim());
+ if(bytesOut.contains("$tmp_device")) {
+ String repString = bytesOut.replace("$tmp_device", device.trim());
replaceBytesOut = repString.replace("sudo", "/bin/sh,-c,");
}
String[] bytesoutArray = replaceBytesOut.split(",");
String replacePacketsIn ="";
- if(PacketsIn.contains("$tmp_device")) {
- String repString = PacketsIn.replace("$tmp_device", device.trim());
+ if(packetsIn.contains("$tmp_device")) {
+ String repString = packetsIn.replace("$tmp_device", device.trim());
replacePacketsIn = repString.replace("sudo", "/bin/sh,-c,");
}
String[] packetsInArray= replacePacketsIn.split(",");
String replacePacketsOut ="";
- if(PacketsOut.contains("$tmp_device")) {
- String repString = PacketsOut.replace("$tmp_device", device.trim());
+ if(packetsOut.contains("$tmp_device")) {
+ String repString = packetsOut.replace("$tmp_device", device.trim());
replacePacketsOut = repString.replace("sudo", "/bin/sh,-c,");
}
String[] packetsOutArray= replacePacketsOut.split(",");
@@ -1096,7 +904,7 @@ public class FaultData{
}
}catch (Exception e) {
-
+ logger.error(e);
}
}
return vppMetrics;
@@ -1104,108 +912,8 @@ public class FaultData{
- public static HashMap<String, DeviceData> readVppMetrics1(String[] linkStart) {
- String Bytesin = faultConfigTempInit.get("tmp_t0BytesIn");
- String BytesOut = faultConfigTempInit.get("tmp_t0BytesOut").toString();
- String PacketsIn = faultConfigTempInit.get("tmp_t0PacketsIn");
- String PacketsOut = faultConfigTempInit.get("tmp_t0PacketsOut");
-
- String echoFalut = faultInstanceres02.get("tmp_cmd1");
- HashMap<String, DeviceData> vppMetrics = new HashMap<>();
-
- for(int i=0;i<linkStart.length;i++) {
- String device = linkStart[i];
- String replaceBytesin ="";
- if(Bytesin.contains("$tmp_device")) {
- String repString = Bytesin.replace("$tmp_device", device.trim());
- replaceBytesin = repString.replace("sudo", "/bin/sh,-c,");
-
- }
-
- String[] bytesinArray= replaceBytesin.split(",");
-
-
- String replaceBytesOut ="";
- if(BytesOut.contains("$tmp_device")) {
- String repString = BytesOut.replace("$tmp_device", device.trim());
- replaceBytesOut = repString.replace("sudo", "/bin/sh,-c,");
- }
-
- String[] bytesoutArray = replaceBytesOut.split(",");
-
-
-
-
- String replacePacketsIn ="";
- if(PacketsIn.contains("$tmp_device")) {
- String repString = PacketsIn.replace("$tmp_device", device.trim());
- replacePacketsIn = repString.replace("sudo", "/bin/sh,-c,");
-
- }
- String[] packetsInArray= replacePacketsIn.split(",");
-
-
- String replacePacketsOut ="";
- if(PacketsOut.contains("$tmp_device")) {
- String repString = PacketsOut.replace("$tmp_device", device.trim());
- replacePacketsOut = repString.replace("sudo", "/bin/sh,-c,");
-
- }
- String[] packetsOutArray= replacePacketsOut.split(",");
- try {
-
- Runtime rt1 = Runtime.getRuntime();
- Process bytesinchild = rt1.exec(bytesinArray);
- BufferedReader readerBytesin = new BufferedReader(new InputStreamReader(
- bytesinchild.getInputStream()));
- String readMetrics= readerBytesin.readLine();
- Runtime rt2 = Runtime.getRuntime();
- Process bytesoutchild = rt2.exec(bytesoutArray);
- BufferedReader readerBytesout = new BufferedReader(new InputStreamReader(
- bytesoutchild.getInputStream()));
- String readMetrics1= readerBytesout.readLine();
- Runtime rt3 = Runtime.getRuntime();
- Process packetsInchild = rt3.exec(packetsInArray);
- BufferedReader readerPacketsIn = new BufferedReader(new InputStreamReader(
- packetsInchild.getInputStream()));
- String readMetrics2= readerPacketsIn.readLine();
- Runtime rt4 = Runtime.getRuntime();
- Process packetsOutchild = rt4.exec(packetsOutArray);
- BufferedReader readerpacketsOut = new BufferedReader(new InputStreamReader(
- packetsOutchild.getInputStream()));
- String readMetrics3= readerpacketsOut.readLine();
- Runtime rt5 = Runtime.getRuntime();
- Process echoFaultchild = rt5.exec(echoFalut);
- BufferedReader readerechoFault = new BufferedReader(new InputStreamReader(
- echoFaultchild.getInputStream()));
- String echoFaultMetric= readerechoFault.readLine();
- DeviceData mddata = new DeviceData();
-
-// mddata.setBytesIn(readMetrics);
-// mddata.setBytesOut(readMetrics1);
-// mddata.setPacketIn(readMetrics2);
-// mddata.setPacketOut(readMetrics3);
-
- mddata.setInstanceres02Command(echoFaultMetric);
-
- vppMetrics.put("Instanceres02Cmd", mddata);
-
- if(device.equals("enp0s3")) {
- vppMetrics.put("enp0s3", mddata);
- }else if(device.equals("lo")) {
- vppMetrics.put("lo", mddata);
- }else if(device.equals("docker0")) {
- vppMetrics.put("docker0", mddata);
- }
- }catch (Exception e) {
-
- }
- }
- return vppMetrics;
- }
public static void main(String[] args) {
- // TODO Auto-generated method stub
try {
AgentMain.evel_initialize("http://127.0.0.1",30000,
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/HeartBeatData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/HeartBeatData.java
index 52ddaea..77c1823 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/HeartBeatData.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/HeartBeatData.java
@@ -38,6 +38,7 @@ import evel_javalibrary.att.com.AgentMain;
import evel_javalibrary.att.com.EvelHeartbeatField;
import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@@ -45,26 +46,28 @@ import org.json.simple.parser.ParseException;
public class HeartBeatData extends Thread{
static HashMap<String, String> hbConfig = new HashMap();
- static int gm_event_id = 1;
- static String event_id1 = "heartbeatvfs";
- static String event_id = "00000000";
- static String event_id2=null;
+ static int gmEventid = 1;
+ static String eventId1 = "heartbeatvfs";
+ static String eventId = "00000000";
+ static String eventId2=null;
+ private static final Logger logger = Logger.getLogger(AgentMain.class);
- public void run() {
-
- Long start_epoch_microsec = 0L;
- Long last_epoch_microsec = 0L;
+ @Override
+ public void run() {
+ Long startEpochMicrosec = 0L;
+ Long lastEpochMicrosec = 0L;
String hostName = hostName();
try {
readHeartbeatConfig();
- }catch(Exception e) {
+ }catch(Exception e) {
+ logger.error(e);
}
while(true) {
String heatBeatInterval="";
long milliseconds = 60000;
- event_id2 = event_id1+ event_id+(gm_event_id++);
+ eventId2 = eventId1+ eventId+(gmEventid++);
if(hbConfig.get("heartbeatInterval") == null) {
heatBeatInterval = Long.toString(milliseconds);
}else {
@@ -72,46 +75,46 @@ public class HeartBeatData extends Thread{
}
EvelHeartbeatField evelHb = new EvelHeartbeatField(Integer.parseInt(heatBeatInterval) ,
hbConfig.get("eventName"),
- event_id2);
+ eventId2);
if( hbConfig.get("eventType")!=null) {
- start_epoch_microsec = last_epoch_microsec;
- last_epoch_microsec = System.nanoTime()/1000;
+ startEpochMicrosec = lastEpochMicrosec;
+ lastEpochMicrosec = System.nanoTime()/1000;
- evelHb.evel_last_epoch_set(start_epoch_microsec);
- evelHb.evel_start_epoch_set(last_epoch_microsec);
+ evelHb.evel_last_epoch_set(startEpochMicrosec);
+ evelHb.evel_start_epoch_set(lastEpochMicrosec);
- evelHb.evel_header_type_set(hbConfig.get("eventType").toString());
- evelHb.evel_nfcnamingcode_set(hbConfig.get("nfcNamingCode").toString());
- evelHb.evel_nfnamingcode_set(hbConfig.get("nfNamingCode").toString());
+ evelHb.evel_header_type_set(hbConfig.get("eventType"));
+ evelHb.evel_nfcnamingcode_set(hbConfig.get("nfcNamingCode"));
+ evelHb.evel_nfnamingcode_set(hbConfig.get("nfNamingCode"));
if(hbConfig.get("reportingEntityName") == null) {
evelHb.evel_reporting_entity_name_set(hostName);
}else {
- evelHb.evel_reporting_entity_name_set(hbConfig.get("reportingEntityName").toString());
+ evelHb.evel_reporting_entity_name_set(hbConfig.get("reportingEntityName"));
}
- evelHb.evel_reporting_entity_id_set(hbConfig.get("reportingEntityId").toString());
- evelHb.evel_nfVendorName_set(hbConfig.get("nfVendorName").toString());
- evelHb.evel_header_set_sourceid(true,hbConfig.get("sourceId").toString());
+ evelHb.evel_reporting_entity_id_set(hbConfig.get("reportingEntityId"));
+ evelHb.evel_nfVendorName_set(hbConfig.get("nfVendorName"));
+ evelHb.evel_header_set_sourceid(true,hbConfig.get("sourceId"));
if(hbConfig.get("sourceName") == null) {
evelHb.evel_header_set_source_name(hostName);
}else {
- evelHb.evel_header_set_source_name(hbConfig.get("sourceName").toString());
+ evelHb.evel_header_set_source_name(hbConfig.get("sourceName"));
}
- evelHb.evel_timeZoneOffset_set(hbConfig.get("timeZoneOffset").toString());
+ evelHb.evel_timeZoneOffset_set(hbConfig.get("timeZoneOffset"));
}
try {
Thread.sleep(Integer.parseInt(heatBeatInterval));
}catch(Exception e) {
-
+ logger.error(e);
}
AgentMain.evel_post_event(evelHb);
}
}
- public static HashMap<String, String> readHeartbeatConfig() throws IOException, ParseException {
+ private static HashMap<String, String> readHeartbeatConfig() throws IOException, ParseException {
JSONParser jsonParser = new JSONParser();
try {
@@ -130,7 +133,7 @@ public class HeartBeatData extends Thread{
}
} catch (ClassCastException ex) {
- ex.printStackTrace();
+ logger.error(ex);
}
return hbConfig;
}
@@ -148,7 +151,7 @@ private static String bytesToHex(byte[] bytes) {
public static String hostName() {
String hostname = "Unknown";
- String uuid = "Unknown";
+
try
{
InetAddress addr;
@@ -157,6 +160,7 @@ public static String hostName() {
}
catch (UnknownHostException ex)
{
+ logger.error(ex);
}
try{
Enumeration<NetworkInterface> networks =
@@ -177,19 +181,18 @@ public static String hostName() {
}
}
if (mac != null) {
- uuid = bytesToHex(mac);
+ bytesToHex(mac);
}
}
} catch (SocketException e) {
- // TODO Auto-generated catch block
-
+ logger.error(e);
}
return hostname;
}
public static void main(String[] args) {
- // TODO Auto-generated method stub
+
try {
AgentMain.evel_initialize("http://127.0.0.1",30000,
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java
index d3c0d5f..744d3aa 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java
@@ -40,6 +40,7 @@ import java.util.List;
import java.util.Map;
import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@@ -85,9 +86,11 @@ public class MeasureData extends Thread{
static String linkStart = "";
static int linkCount;
+ private static final Logger logger = Logger.getLogger(AgentMain.class);
+ Long startEpochMicrosec = 0L;
+ Long lastEpochMicrosec = 0L;
- Long start_epoch_microsec = 0L;
- Long last_epoch_microsec = 0L;
+ @Override
public void run() {
try {
@@ -95,7 +98,7 @@ public class MeasureData extends Thread{
readMeasurementConfig();
readVppMetrics(resDevice);
} catch (IOException | ParseException e1) {
- e1.printStackTrace();
+ logger.error(e1);
}
String[] intFaceMap = resDevice;
@@ -113,12 +116,13 @@ public class MeasureData extends Thread{
try {
Thread.sleep(1000);
- }catch(Exception e) {}
+ }catch(Exception e) {
+ logger.error(e);
+ }
while(true) {
HashMap<String, DeviceData> lastMetrics = readVppMetrics(resDevice);
- //HashMap<String, DeviceData> currentMetrics = readVppMetrics(resDevice);;
HashMap<String, DeviceData> currentMetrics = lastMetrics;
requestRate =2;
eventId2 = eventId1+ eventId+(gmEventId++);
@@ -143,7 +147,7 @@ public class MeasureData extends Thread{
if (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesin()))
- Integer.parseInt((lastMetrics.get(vNic).getT0bytesIn()) ) > 0) {
- receivedOctetsDeltaLo = (int) (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesin()) )
+ receivedOctetsDeltaLo = (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesin()) )
- Integer.parseInt((lastMetrics.get(vNic).getT0bytesIn()) ));
} else {
receivedOctetsDeltaLo = 0;
@@ -152,7 +156,7 @@ public class MeasureData extends Thread{
if (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsin()))
- Integer.parseInt((lastMetrics.get(vNic).getT0packetIn()) ) > 0) {
- receivedTotalPacketsDeltaLo = (int) (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsin()) )
+ receivedTotalPacketsDeltaLo =(Integer.parseInt((currentMetrics.get(vNic).getT1Packetsin()) )
- Integer.parseInt((lastMetrics.get(vNic).getT0packetIn()) ));
} else {
receivedTotalPacketsDeltaLo = 0;
@@ -161,7 +165,7 @@ public class MeasureData extends Thread{
if (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesout()))
- Integer.parseInt((lastMetrics.get(vNic).getT0bytesOut()) ) > 0) {
- transmittedOctetsDeltaLo = (int) (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesout()) )
+ transmittedOctetsDeltaLo = (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesout()) )
- Integer.parseInt((lastMetrics.get(vNic).getT0bytesOut())));
} else {
transmittedOctetsDeltaLo = 0;
@@ -170,22 +174,20 @@ public class MeasureData extends Thread{
if (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsout()))
- Integer.parseInt((lastMetrics.get(vNic).getT0packetOut()) ) > 0) {
- transmittedTotalPacketsDeltaLo = (int) (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsout()) )
+ transmittedTotalPacketsDeltaLo = (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsout()) )
- Integer.parseInt((lastMetrics.get(vNic).getT0packetOut())));
} else {
transmittedTotalPacketsDeltaLo = 0;
}
EvelScalingMeasurement.MEASUREMENT_NIC_PERFORMANCE vNicPerf = eveMeas.evel_measurement_new_vnic_performance(vNic.replaceAll("^[\"']+|[\"']+$", ""), "true");
- //eveMeas.evel_meas_vnic_performance_add(vNicPerf);
-
if( measConfig.get("eventType")!=null) {
String hostName = hostName();
- start_epoch_microsec = last_epoch_microsec;
- last_epoch_microsec = System.nanoTime()/1000;
- eveMeas.evel_last_epoch_set(start_epoch_microsec);
- eveMeas.evel_start_epoch_set(last_epoch_microsec);
- eveMeas.evel_measurement_type_set( measConfig.get("eventType").toString());
+ startEpochMicrosec = lastEpochMicrosec;
+ lastEpochMicrosec = System.nanoTime()/1000;
+ eveMeas.evel_last_epoch_set(startEpochMicrosec);
+ eveMeas.evel_start_epoch_set(lastEpochMicrosec);
+ eveMeas.evel_measurement_type_set( measConfig.get("eventType"));
eveMeas.evel_vnic_performance_rx_octets_delta_set( vNicPerf, receivedOctetsDeltaLo);
@@ -193,22 +195,22 @@ public class MeasureData extends Thread{
eveMeas.evel_vnic_performance_tx_octets_delta_set( vNicPerf, transmittedOctetsDeltaLo);
eveMeas.evel_vnic_performance_tx_total_pkt_delta_set(vNicPerf, transmittedTotalPacketsDeltaLo);
- eveMeas.evel_nfcnamingcode_set(measConfig.get("nfcNamingCode").toString());
- eveMeas.evel_nfnamingcode_set(measConfig.get("nfNamingCode").toString());
+ eveMeas.evel_nfcnamingcode_set(measConfig.get("nfcNamingCode"));
+ eveMeas.evel_nfnamingcode_set(measConfig.get("nfNamingCode"));
if(measConfig.get("reportingEntityName") == null) {
eveMeas.evel_reporting_entity_name_set(hostName);
}else {
- eveMeas.evel_reporting_entity_name_set(measConfig.get("reportingEntityName").toString());
+ eveMeas.evel_reporting_entity_name_set(measConfig.get("reportingEntityName"));
}
- eveMeas.evel_reporting_entity_id_set(measConfig.get("reportingEntityId").toString());
- eveMeas.evel_nfVendorName_set(measConfig.get("nfVendorName").toString());
- eveMeas.evel_header_set_sourceid(true,measConfig.get("sourceId").toString());
+ eveMeas.evel_reporting_entity_id_set(measConfig.get("reportingEntityId"));
+ eveMeas.evel_nfVendorName_set(measConfig.get("nfVendorName"));
+ eveMeas.evel_header_set_sourceid(true,measConfig.get("sourceId"));
if(measConfig.get("sourceName") == null) {
eveMeas.evel_header_set_source_name(hostName);
}else {
- eveMeas.evel_header_set_source_name(measConfig.get("sourceName").toString());
+ eveMeas.evel_header_set_source_name(measConfig.get("sourceName"));
}
- eveMeas.evel_timeZoneOffset_set(measConfig.get("timeZoneOffset").toString());
+ eveMeas.evel_timeZoneOffset_set(measConfig.get("timeZoneOffset"));
}
@@ -220,7 +222,7 @@ public class MeasureData extends Thread{
try {
Thread.sleep(100);
}catch (Exception e) {
- // TODO: handle exception
+ logger.error(e);
}
if(System.currentTimeMillis() >= (curr+Integer.parseInt(measurmentInterval))) {
continues = false;
@@ -244,7 +246,6 @@ public class MeasureData extends Thread{
}
public static String hostName() {
String hostname = "Unknown";
- String uuid = "Unknown";
try
{
InetAddress addr;
@@ -253,6 +254,7 @@ public class MeasureData extends Thread{
}
catch (UnknownHostException ex)
{
+ logger.error(ex);
}
try{
Enumeration<NetworkInterface> networks =
@@ -273,12 +275,11 @@ public class MeasureData extends Thread{
}
}
if (mac != null) {
- uuid = bytesToHex(mac);
+ bytesToHex(mac);
}
}
} catch (SocketException e) {
- // TODO Auto-generated catch block
-
+ logger.error(e);
}
return hostname;
@@ -286,7 +287,7 @@ public class MeasureData extends Thread{
- public static HashMap<String, String> readMeasurementConfig() throws IOException, ParseException {
+ private static HashMap<String, String> readMeasurementConfig() throws IOException, ParseException {
JSONParser jsonParser = new JSONParser();
try {
@@ -305,7 +306,7 @@ public class MeasureData extends Thread{
measConfig.put(directres[0], directres[1]);
}
- String eventName = measConfig.get("eventName").toString();
+ String eventName = measConfig.get("eventName");
JSONArray arrJson = (JSONArray) directParameters.get("tmp_device");
resDevice = new String[arrJson.size()];
for(int i = 0; i < arrJson.size(); i++)
@@ -325,11 +326,6 @@ public class MeasureData extends Thread{
measConfig.put(indirectres[0], indirectres[1]);
}
-
-
- //tmp_init
- // Map tempInitParameters = ((Map)indirectParameters.get("tmp_init"));
-
//tmp_init
Map.Entry tempcommandPair = null;
String tempcommandObject ="";
@@ -370,14 +366,14 @@ public class MeasureData extends Thread{
String receivedOctetsDelta = vNicPerformanceArray.get("receivedOctetsDelta");
} catch (ClassCastException ex) {
-
+ logger.error(ex);
}
return measConfig;
}
- public static HashMap<String, DeviceData> readVppMetrics(String[] linkStart) {
+ private static HashMap<String, DeviceData> readVppMetrics(String[] linkStart) {
DeviceData mddata = null; new DeviceData();
@@ -500,7 +496,6 @@ public class MeasureData extends Thread{
Thread.sleep(Integer.parseInt(measConfig.get("measurementInterval")));
Runtime rt1 = Runtime.getRuntime();
Process bytesinchild = rt1.exec(t1BytesinArray);
- // bytesinchild.waitFor();
BufferedReader readerBytesin = new BufferedReader(new InputStreamReader(
bytesinchild.getInputStream()));
String readMetrics= readerBytesin.readLine();
@@ -549,7 +544,7 @@ public class MeasureData extends Thread{
}
}catch (Exception e) {
-
+ logger.error(e);
}
}
return vppMetrics;
@@ -560,8 +555,7 @@ public class MeasureData extends Thread{
public static void main(String[] args) {
- // TODO Auto-generated method stub
-
+
try {
AgentMain.evel_initialize("http://127.0.0.1",30000,
null,null,
@@ -571,8 +565,7 @@ public class MeasureData extends Thread{
"http://127.0.0.1",30001, "will",
"pill",
Level.TRACE);
- }catch(Exception e) {
-
+ }catch(Exception e) {
return;
}
MeasureData mdataThread = new MeasureData();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslogData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslogData.java
index a323675..a9ccca9 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslogData.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslogData.java
@@ -12,6 +12,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@@ -56,29 +57,34 @@ public class syslogData extends Thread{
static String eventId1 = "syslog";
static String eventId = "00000000";
static String eventId2=null;
-
+ private static final Logger logger = Logger.getLogger(AgentMain.class);
private static int linesReadFromFile =0;
-
+ @Override
public void run() {
try {
readSyslogConfig();
-
- } catch (IOException | ParseException e) {}
+ } catch (IOException | ParseException e) {
+ logger.error(e);
+ }
while(true) {
- String tagToCompare = syslogConfig.get("syslogTag").toString();
-
+ String tagToCompare = syslogConfig.get("syslogTag");
+ try {
syslogFileRead(tagToCompare );
-
- try { Thread.sleep(500);}catch(Exception e) {}
+ }catch (Exception e) {
+ logger.error(e);
+ }
+ try { Thread.sleep(500);}catch(Exception e) {
+ logger.error(e);
+ }
}
}
public void sendSysLogEvent(String sysTag,String syslogMsg) {
- Long start_epoch_microsec = 0L;
- Long last_epoch_microsec = 0L;
+ Long startEpochMicrosec = 0L;
+ Long lastEpochMicrosec = 0L;
String hostName = hostName();
eventId2 = eventId1+ eventId+(gmEventId++);
@@ -87,33 +93,33 @@ public class syslogData extends Thread{
syslogMsg, sysTag);
if( syslogConfig.get("eventType")!=null) {
- start_epoch_microsec = last_epoch_microsec;
- last_epoch_microsec = System.nanoTime()/1000;
+ startEpochMicrosec = lastEpochMicrosec;
+ lastEpochMicrosec = System.nanoTime()/1000;
- eveSyslog.evel_last_epoch_set(start_epoch_microsec);
- eveSyslog.evel_start_epoch_set(last_epoch_microsec);
+ eveSyslog.evel_last_epoch_set(startEpochMicrosec);
+ eveSyslog.evel_start_epoch_set(lastEpochMicrosec);
- eveSyslog.evel_header_type_set(syslogConfig.get("eventType").toString());
- eveSyslog.evel_nfcnamingcode_set(syslogConfig.get("nfcNamingCode").toString());
- eveSyslog.evel_nfnamingcode_set(syslogConfig.get("nfNamingCode").toString());
+ eveSyslog.evel_header_type_set(syslogConfig.get("eventType"));
+ eveSyslog.evel_nfcnamingcode_set(syslogConfig.get("nfcNamingCode"));
+ eveSyslog.evel_nfnamingcode_set(syslogConfig.get("nfNamingCode"));
if(syslogConfig.get("reportingEntityName") == null) {
eveSyslog.evel_reporting_entity_name_set(hostName);
}else {
- eveSyslog.evel_reporting_entity_name_set(syslogConfig.get("reportingEntityName").toString());
+ eveSyslog.evel_reporting_entity_name_set(syslogConfig.get("reportingEntityName"));
}
- eveSyslog.evel_reporting_entity_id_set(syslogConfig.get("reportingEntityId").toString());
- eveSyslog.evel_nfVendorName_set(syslogConfig.get("nfVendorName").toString());
- eveSyslog.evel_header_set_sourceid(true,syslogConfig.get("sourceId").toString());
+ eveSyslog.evel_reporting_entity_id_set(syslogConfig.get("reportingEntityId"));
+ eveSyslog.evel_nfVendorName_set(syslogConfig.get("nfVendorName"));
+ eveSyslog.evel_header_set_sourceid(true,syslogConfig.get("sourceId"));
if(syslogConfig.get("sourceName") == null) {
eveSyslog.evel_header_set_source_name(hostName);
}else {
- eveSyslog.evel_header_set_source_name(syslogConfig.get("sourceName").toString());
+ eveSyslog.evel_header_set_source_name(syslogConfig.get("sourceName"));
}
- eveSyslog.evel_timeZoneOffset_set(syslogConfig.get("timeZoneOffset").toString());
+ eveSyslog.evel_timeZoneOffset_set(syslogConfig.get("timeZoneOffset"));
}
eveSyslog.evel_syslog_facility_set(EVEL_SYSLOG_FACILITIES.EVEL_SYSLOG_FACILITY_LOCAL0);
- eveSyslog.evel_syslog_proc_set(syslogConfig.get("syslogProc").toString());
+ eveSyslog.evel_syslog_proc_set(syslogConfig.get("syslogProc"));
@@ -121,14 +127,11 @@ public class syslogData extends Thread{
}
- public String syslogFileRead(String tagToCompare){
- String syslines ="";
+ public String syslogFileRead(String tagToCompare) throws IOException{
+
int currentIndex = 0;
boolean compare = false;
-
- try {
-
- BufferedReader reader = new BufferedReader(new FileReader("/var/log/syslog"));
+ try (BufferedReader reader = new BufferedReader(new FileReader("/var/log/syslog"))){
String line = reader.readLine();
while (line != null) {
if( currentIndex == linesReadFromFile ) {
@@ -141,15 +144,14 @@ public class syslogData extends Thread{
currentIndex ++;
line = reader.readLine();
- }
-
- if( compare )
+ }
+ if( compare ) {
linesReadFromFile=currentIndex;
-
+ }
} catch (Exception ex) {
- ex.printStackTrace();
- }
+ logger.error(ex);
+ }
return null;
}
@@ -167,7 +169,7 @@ public class syslogData extends Thread{
public static String hostName() {
String hostname = "Unknown";
- String uuid = "Unknown";
+
try
{
InetAddress addr;
@@ -176,7 +178,7 @@ public class syslogData extends Thread{
}
catch (UnknownHostException ex)
{
-
+ logger.error(ex);
}
try{
Enumeration<NetworkInterface> networks =
@@ -197,11 +199,11 @@ public class syslogData extends Thread{
}
}
if (mac != null) {
- uuid = bytesToHex(mac);
+ bytesToHex(mac);
}
}
} catch (SocketException e) {
- // TODO Auto-generated catch block
+ logger.error(e);
}
@@ -209,7 +211,7 @@ public class syslogData extends Thread{
}
- public static HashMap<String, String> readSyslogConfig() throws IOException, ParseException {
+ private static HashMap<String, String> readSyslogConfig() throws IOException, ParseException {
JSONParser jsonParser = new JSONParser();
try {
@@ -240,16 +242,15 @@ public class syslogData extends Thread{
indirectres = indirectObject.split("=");
syslogConfig.put(indirectres[0], indirectres[1]);
}
- syslogFile = syslogConfig.get("tmp_syslogFile").toString();
+ syslogFile = syslogConfig.get("tmp_syslogFile");
} catch (ClassCastException ex) {
- ex.printStackTrace();
+ logger.error(ex);
}
return syslogConfig;
}
public static void main(String[] args) {
- // TODO Auto-generated method stub
try {
AgentMain.evel_initialize("http://127.0.0.1",30000,
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java b/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java
index fe993ec..adab087 100644
--- a/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java
+++ b/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java
@@ -107,7 +107,7 @@ public class TestJunit {
}
}
-
+
@Test
public void testMain() {
Main mains = new Main();
@@ -119,7 +119,8 @@ public class TestJunit {
@Test
public void testLBHeartBeat() {
HeartBeatData hb = new HeartBeatData();
- hb.start();
+ hb.start();
+ hb.hostName();
}
@Test
@@ -127,7 +128,7 @@ public class TestJunit {
FaultData flDataThread = new FaultData();
new Thread(flDataThread.faultInstance01).start();
new Thread(flDataThread.faultInstance02).start();
-
+ flDataThread.hostName();
String[] strArray = {"name1","name12","name13"};
flDataThread.main(strArray);
}
@@ -136,7 +137,7 @@ public class TestJunit {
public void testLBMeasurement() {
MeasureData mdataThread = new MeasureData();
mdataThread.start();
-
+ mdataThread.hostName();
String[] strArra = {"meas1","meas1","meas1"};
mdataThread.main(strArra);
@@ -144,9 +145,14 @@ public class TestJunit {
}
@Test
- public void testLBSyslog() {
+ public void testLBSyslog() throws IOException {
syslogData syslogDataThread = new syslogData();
syslogDataThread.start();
+ syslogDataThread.syslogFileRead("INSECURE MODE");
+ syslogDataThread.hostName();
+ syslogDataThread.sendSysLogEvent("INSECURE MODE", "Jan 23 18:09:01 ves-VirtualBox cron[1119]: (*system*) INSECURE MODE (group/other writable) (/etc/crontab)");
+ String[] strArra = {"meas1"};
+ syslogDataThread.main(strArra);
}
@@ -162,6 +168,15 @@ public class TestJunit {
dd.setT1Bytesout("671940");
dd.setT1Packetsin("73017");
dd.setT1Packetsout("86180");
+ dd.getInstanceres02Command();
+ dd.getT0bytesIn();
+ dd.getT0bytesOut();
+ dd.getT0packetIn();
+ dd.getT0packetOut();
+ dd.getT1Bytesin();
+ dd.getT1Bytesout();
+ dd.getT1Packetsin();
+ dd.getT1Packetsout();
}
@@ -198,10 +213,10 @@ public class TestJunit {
EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_OUT_OF_SERVICE,"bgp");
stc.evel_statechange_addl_info_add("bgpa", "fail");
stc.evel_statechange_addl_info_add("bgpb", "fail");
- when(mymainmock.evel_post_event(stc)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(stc);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+
+ stc.evel_json_encode_event();
+ stc.evel_json_encode_event_batch();
}
@@ -212,7 +227,7 @@ public class TestJunit {
header = EvelHeader.evel_new_heartbeat("Hearbeat_vAFX","vmname_ip");
header.evel_nfnamingcode_set("vVNF");
header.evel_nfcnamingcode_set("vVNF");
- header.evel_timeZoneOffset_set("UTC+5:30");
+ header.evel_timeZoneOffset_set("UTC+5:30");
when(mymainmock.evel_post_event(header)).thenReturn(true);
boolean ret = mymainmock.evel_post_event(header);
LOG.info("Returned "+ret);
@@ -225,10 +240,9 @@ public class TestJunit {
EvelHeartbeatField hfld = new EvelHeartbeatField(123,"HeartbeatField_vVNF", "1");
hfld.evel_hrtbt_interval_set(100);
hfld.evel_timeZoneOffset_set("UTC+5:30");
- when(mymainmock.evel_post_event(hfld)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(hfld);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+ hfld.evel_json_encode_event();
+ hfld.evel_json_encode_event_batch();
}
@@ -247,305 +261,18 @@ public class TestJunit {
flt.evel_fault_type_set("vmintf");
flt.evel_fault_interface_set("My Interface Card");
flt.evel_fault_category_set("link");
- when(mymainmock.evel_post_event(flt)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(flt);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+ flt.evel_json_encode_event();
+ flt.evel_json_encode_event_batch();
}
@Test
public void testBatch() {
EvelBatch be = new EvelBatch();
- EvelFault flt2 = new EvelFault("Fault_vVNF", "vmname_ip",
- "NIC error", "Hardware failed",
- EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH,
- EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
- EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
- EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
- flt2.evel_fault_addl_info_add("nichw", "fail");
- flt2.evel_fault_addl_info_add("nicsw", "fail");
- be.addEvent(flt2);
- EvelFault flt3 = new EvelFault("Fault_vVNF", "vmname_ip2",
- "NIC error", "Hardware failed",
- EvelHeader.PRIORITIES.EVEL_PRIORITY_NORMAL,
- EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
- EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
- EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
- flt3.evel_fault_type_set("Interface fault");
- flt3.evel_fault_category_set("Failed category");
- flt3.evel_fault_interface_set("An Interface Card");
- flt3.evel_fault_addl_info_add("nichw", "fail");
- flt3.evel_fault_addl_info_add("nicsw", "fail");
- be.addEvent(flt3);
-
-
- EvelStateChange stc = new EvelStateChange("StateChange_vVNF", "vmname_ip",
- EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_IN_SERVICE,
- EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_OUT_OF_SERVICE,"bgp");
- stc.evel_statechange_addl_info_add("bgpa", "fail");
- stc.evel_statechange_addl_info_add("bgpb", "fail");
- //AgentMain.evel_post_event(stc);
- be.addEvent(stc);
+ be.evel_json_encode_event();
-
- EvelSyslog sysl = new EvelSyslog("Syslog_vVNF", "vmname_ip",
- EvelFault.EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER,
- "Router failed","JUNIPER");
- sysl.evel_syslog_event_source_host_set("SL Host");
- sysl.evel_syslog_priority_set(21);
- sysl.evel_syslog_proc_id_set(456);
- sysl.evel_syslog_proc_set("routed");
- sysl.evel_syslog_s_data_set("sys data");
- sysl.evel_syslog_sdid_set("200");
- sysl.evel_syslog_severity_set("Alert");
- sysl.evel_syslog_facility_set(EVEL_SYSLOG_FACILITIES.EVEL_SYSLOG_FACILITY_INTERNAL);
- sysl.evel_syslog_severity_set("Data");
- sysl.evel_syslog_version_set(20);
- sysl.evel_syslog_msghost_set("Hostmsg");
- sysl.evel_syslogTs_set("SyslogTs");
- sysl.evel__syslog_addl_info_add("name1", "value1");
- sysl.evel__syslog_addl_info_add("name2", "value2");
- be.addEvent(sysl);
-
-
- EvelNotification notification = new EvelNotification("Notification_vVNF", "vmname_ip","change_identifier", "configuration changed");
- notification.evel_notification_add_newState_set("maintainance");
- notification.evel_notification_add_oldState_set("out of Service");
- notification.evel_notification_add_changeContact_set("ChangeContact");
- notification.evel_notification_addl_info_add("name1", "value1");
- notification.evel_notification_addl_info_add("name4", "value5");
- notification.evel_notification_add_namedarray("hmNam1", "hmName1", "hmNmae2");
- notification.evel_notification_add_stateInterface_set("StateChange");
- be.addEvent(notification);
-
-
-
- EvelPnfRegistration pnfRegistration = new EvelPnfRegistration("PnfRegistration_vVNF", "vmname_ip");
- pnfRegistration.evel_pnrregistration_add_lastServiceDate_set("10FEB2019");
- pnfRegistration.evel_pnrregistration_add_modelNumber_set("123456789");
- pnfRegistration.evel_pnfRegistration_serialNumber_set("6061ZW3");
- pnfRegistration.evel_pnrregistration_add_macaddress_set("localhost");
- pnfRegistration.evel_pnrregistration_add_manufactureDate_set("FEB2011");
- pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("localhost");
-
- pnfRegistration.evel_pnfRegistration_softwareVersion_set("SW1234");
-
-
- pnfRegistration.evel_pnfRegistration_unitFamily_set("unitFamily222");
- pnfRegistration.evel_pnfRegistration_unitType_set("unitType1");
-
- pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("localhost");
- pnfRegistration.evel_pnrregistration_add_oamV6IpAddress_set("localhost");
-
-
- pnfRegistration.evel_pnfRegistration_vendorName_set("Vend_nam_123");
- pnfRegistration.evel_pnrregistration_addl_info_add("Name1", "value1");
- pnfRegistration.evel_pnrregistration_addl_info_add("Name2", "value2");
- be.addEvent(pnfRegistration);
-
- EvelSipSignaling sip = new EvelSipSignaling("SipSignaling_vVNF", "vmname_ip","aricent","corlator","localhost","5647","localhost","5678");
- sip.evel_signaling_vnfmodule_name_set("nfName");
- sip.evel_signaling_vnfname_set("nf_name");
- sip.evel_signaling_addl_info_add("name1", "value1");
- sip.evel_signaling_addl_info_add("name2", "value2");
- sip.evel_signaling_compressed_sip_set("CompressedIP");
- sip.evel_signaling_summary_sip_set("SummarySip");
- be.addEvent(sip);
-
- EvelVoiceQuality vq = new EvelVoiceQuality("VoiceQuality_vVNF", "vmname_ip",
- "calleeSideCodc",
- "callerSideCodc", "corlator",
- "midCllRtcp", "juniper");
- vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 20, 30, 40, 50, 60, 70, 80, 100, 110, 120, 130, 140, 1.1, 160.12, 17, 190, 200,210,220,230,240,250,260,270,280,290,300);
- vq.evel_voice_quality_phone_number_set("PhoneNumber");
- vq.evel_voice_quality_vnfmodule_name_set("vnfNaming");
- vq.evel_voice_quality_vnfname_set("vnfName");
- vq.evel_voice_quality_addl_info_add("Name1", "value1");
- vq.evel_voice_quality_addl_info_add("Name2", "value2");
- be.addEvent(vq);
-
- EvelOther ev = new EvelOther("MyCustomEvent_vVNF", "vmname_ip");
- ev.evel_other_field_add("name1", "value1");
- ev.evel_other_field_add("name2", "value2");
- ev.evel_other_field_add("name3", "value3");
- ev.evel_other_field_add("name4", "value4");
-
- ev.evel_other_field_add_namedarray("value3", "name3", "value6");
- ev.evel_other_field_add_namedarray("value1", "name4", "value7");
- ev.evel_other_field_add_namedarray("value1", "name4", "value7");
- ev.evel_other_field_add_namedarray("value4", "name5", "value8");
-
-
- JsonObjectBuilder jsonObjBld =
- Json.createObjectBuilder()
- .add("trackIdentifier", 12345)
- .add("remoteSource", "vm1235")
- .add("ended", "12:45:67")
- .add("detached", 633453)
- .add("frameWidth", 765765)
- .add("frameHeight", 767867)
- .add("framesPerSecond", 334343)
- .add("framesSent", 8976786)
- .add("framesReceived", 233423)
- .add("frameHeight", 8897896)
- .add("framesDecoded", 3434533)
- .add("framesDropped", 87867676)
- .add("framesCorrupted", 3345342)
- .add("audioLevel", "-45dBm");
- JsonObject custom = jsonObjBld.build();
-
- ev.evel_other_field_add_jsonobj(custom);
- be.addEvent(ev);
-
- String dateStart = "01/14/2012 09:29:58";
- String dateStop = "01/15/2012 10:31:48";
-
- //HH converts hour in 24 hours format (0-23), day calculation
- SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
-
- Date d1 = null;
- Date d2 = null;
-
- try {
- d1 = format.parse(dateStart);
- d2 = format.parse(dateStop);
- }catch (Exception e) {
-
- }
-
- EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip", "CRIT",
- "mcastRxPackets", EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_CLEAR,
- "Mcast Rx breached",
- EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_CARD_ANOMALY,
-
- d1, EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL,
- d2);
-
- tca.evel_threshold_cross_alertvalue_set("alertvalue");
- tca.evel_threshold_cross_data_collector_set("data_collector");
- tca.evel_threshold_cross_data_elementtype_set("data_elementtype");
- tca.evel_threshold_cross_interfacename_set("interfacename");
- tca.evel_threshold_cross_networkservice_set("networkservice");
- tca.evel_threshold_cross_possible_rootcause_set("possible_rootcause");
-
- tca.evel_thresholdcross_addl_info_add("addname1", "addvalue1");
- tca.evel_thresholdcross_addl_info_add("addname2", "addvalue2");
- tca.evel_thresholdcross_alertid_add("alert1");
- tca.evel_thresholdcross_alertid_add("alert2");
- tca.evel_thresholdcross_alertid_add("alert3");
- tca.evel_thresholdcross_hashMap_add("hashName", "hashValue");
- be.addEvent(tca);
-
-
-
-
- try {
- d1 = format.parse(dateStart);
- }catch (Exception e) {
-
- }
- EvelMobileFlow mf = new EvelMobileFlow("MobileFlow_vVNF", "vmname_ip",
- "In",
- null,
- "GTP",
- "v2.3",
- "localhost",
- 345556,
- "localhost",
- 334344);
- MOBILE_GTP_PER_FLOW_METRICS mygtp = mf.new MOBILE_GTP_PER_FLOW_METRICS(
- 1.01,
- 2.02,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- d1,
- "ACTIVE",
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25,
- 26,
- 27,
- 28);
- mf.gtp_per_flow_metrics = mygtp;
-
-
- mf.evel_mobile_gtp_metrics_dur_con_fail_set(mygtp, 1);
- mf.evel_mobile_gtp_metrics_dur_tun_fail_set(mygtp, 1);
- mf.evel_mobile_gtp_metrics_act_by_set(mygtp, "Active");
- mf.evel_mobile_gtp_metrics_act_time_set(mygtp, "Time");
- mf.evel_mobile_gtp_metrics_deact_by_set(mygtp, "FlowDeactivation");
- mf.evel_mobile_gtp_metrics_con_status_set(mygtp, "Status");
- mf.evel_mobile_gtp_metrics_tun_status_set(mygtp, "Tunnel Status");
- mf.evel_mobile_gtp_metrics_large_pkt_rtt_set(mygtp, 12);
- mf.evel_mobile_gtp_metrics_large_pkt_thresh_set(mygtp, 123);
- mf.evel_mobile_gtp_metrics_max_rcv_bit_rate_set(mygtp, 12);
- mf.evel_mobile_gtp_metrics_max_trx_bit_rate_set(mygtp, 12);
- mf.evel_mobile_gtp_metrics_num_echo_fail_set(mygtp, 1);
- mf.evel_mobile_gtp_metrics_num_tun_fail_set(mygtp, 2);
- mf.evel_mobile_gtp_metrics_num_http_errors_set(mygtp, 2);
-
- mf.evel_mobile_gtp_metrics_iptos_set(mygtp,2, 3);
- mf.evel_mobile_gtp_metrics_iptos_set(mygtp,5, 6);
-
- mf.evel_mobile_gtp_metrics_tcp_flag_count_add(mygtp, 3, 4);
- mf.evel_mobile_gtp_metrics_tcp_flag_count_add(mygtp, 5, 8);
-
- mf.evel_mobile_gtp_metrics_qci_cos_count_add(mygtp, 2, 3);
- mf.evel_mobile_gtp_metrics_qci_cos_count_add(mygtp, 5, 6);
- mf.evel_mobile_flow_addl_field_add("mobileFlowName1", "mobileValue1");
- mf.evel_mobile_flow_app_type_set("application type");
- mf.evel_mobile_flow_app_prot_type_set("appProtocolType");
- mf.evel_mobile_flow_app_prot_ver_set("appProtocolVersion");
- mf.evel_mobile_flow_cid_set("CID");
- mf.evel_mobile_flow_con_type_set("ConnectionType");
- mf.evel_mobile_flow_ecgi_set("ECGI");
- mf.evel_mobile_flow_gtp_prot_type_set("gtpProtocalType");
- mf.evel_mobile_flow_gtp_prot_ver_set("GtpVersion");
- mf.evel_mobile_flow_http_header_set("HttpHeader");
- mf.evel_mobile_flow_imei_set("IMEI");
- mf.evel_mobile_flow_imsi_set("IMSI");
- mf.evel_mobile_flow_lac_set("LAC");
- mf.evel_mobile_flow_mcc_set("MCC");
- mf.evel_mobile_flow_mnc_set("MNC");
- mf.evel_mobile_flow_msisdn_set("Msisdn");
- mf.evel_mobile_flow_other_func_role_set("OtherFunctionRole");
-
- mf.evel_mobile_flow_rac_set("RAC");
- mf.evel_mobile_flow_radio_acc_tech_set("RadoiAcessTech");
- mf.evel_mobile_flow_sac_set("SAC");
-
- mf.evel_mobile_flow_samp_alg_set(123);
- mf.evel_mobile_flow_tac_set("TAC");
- mf.evel_mobile_flow_tunnel_id_set("Tunnel");
- mf.evel_mobile_flow_vlan_id_set("Vlan");
- be.addEvent(mf);
-
-
-
- when(mymainmock.evel_post_event(be)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(be);
- LOG.info("Returned "+ret);
- assertTrue( ret );
}
@@ -838,10 +565,9 @@ public class TestJunit {
sm.evel_measurement_vnic_performance_add("vnic","vals",0., 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,"administrativeState","operationalState",31.,32.,33.,34.,35.,36.);
- when(mymainmock.evel_post_event(sm)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(sm);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+ sm.evel_json_encode_event();
+ sm.evel_json_encode_event_batch();
+
}
@Test
@@ -867,11 +593,10 @@ public class TestJunit {
sysl.evel__syslog_addl_info_add("name1", "value1");
sysl.evel__syslog_addl_info_add("name2", "value2");
+
+ sysl.evel_json_encode_event();
+ sysl.evel_json_encode_event_batch();
- when(mymainmock.evel_post_event(sysl)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(sysl);
- LOG.info("Returned "+ret);
- assertTrue( ret );
}
@@ -891,11 +616,10 @@ public class TestJunit {
mf.evel_mobile_flow_type_set("named");
mf.evel_mobile_flow_app_type_set("named");
mf.evel_mobile_flow_addl_field_add("Name", "Value");
-
- when(mymainmock.evel_post_event(mf)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(mf);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+
+ mf.evel_json_encode_event();
+ mf.evel_json_encode_event_batch();
}
@@ -914,10 +638,9 @@ public class TestJunit {
notification.evel_notification_add_stateInterface_set("StateChange");
- when(mymainmock.evel_post_event(notification)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(notification);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+ notification.evel_json_encode_event();
+ notification.evel_json_encode_event_batch();
+
}
@Test
@@ -930,7 +653,7 @@ public class TestJunit {
pnfRegistration.evel_pnfRegistration_serialNumber_set("6061ZW3");
pnfRegistration.evel_pnrregistration_add_macaddress_set("localhost");
pnfRegistration.evel_pnrregistration_add_manufactureDate_set("FEB2011");
- // pnfRegistration.evel_pnrregistration_add_modelNumber_set("FE934567");
+
pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("localhost");
pnfRegistration.evel_pnfRegistration_softwareVersion_set("SW1234");
@@ -947,12 +670,8 @@ public class TestJunit {
pnfRegistration.evel_pnrregistration_addl_info_add("Name1", "value1");
pnfRegistration.evel_pnrregistration_addl_info_add("Name2", "value2");
-
-
- when(mymainmock.evel_post_event(pnfRegistration)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(pnfRegistration);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+ pnfRegistration.evel_json_encode_event();
+ pnfRegistration.evel_json_encode_event_batch();
}
@@ -969,11 +688,9 @@ public class TestJunit {
sip.evel_signaling_addl_info_add("name2", "value2");
sip.evel_signaling_compressed_sip_set("CompressedIP");
sip.evel_signaling_summary_sip_set("SummarySip");
-
- when(mymainmock.evel_post_event(sip)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(sip);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+ sip.evel_json_encode_event();
+ sip.evel_json_encode_event_batch();
}
@@ -991,16 +708,9 @@ public class TestJunit {
vq.evel_voice_quality_vnfname_set("vnfName");
vq.evel_voice_quality_addl_info_add("Name1", "value1");
vq.evel_voice_quality_addl_info_add("Name2", "value2");
- /*
- * Arguments updated 15/07/2018
- */
-
- // vq.evel_voice_quality_end_metrics_set("name","descr",2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12,13.,14.,15.,16.,17.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,29.,30.);
-
- when(mymainmock.evel_post_event(vq)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(vq);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+ vq.evel_json_encode_event();
+ vq.evel_json_encode_event_batch();
}
@Test
@@ -1037,10 +747,9 @@ public class TestJunit {
ev.evel_other_field_add_jsonobj(custom);
- when(mymainmock.evel_post_event(ev)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(ev);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+ ev.evel_json_encode_event();
+ ev.evel_json_encode_event_batch();
+
}
@Test
@@ -1082,11 +791,9 @@ public class TestJunit {
tca.evel_thresholdcross_alertid_add("alert2");
tca.evel_thresholdcross_alertid_add("alert3");
tca.evel_thresholdcross_hashMap_add("hashName", "hashValue");
-
- when(mymainmock.evel_post_event(tca)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(tca);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+ tca.evel_json_encode_event();
+ tca.evel_json_encode_event_batch();
}
@@ -1140,9 +847,7 @@ public class TestJunit {
26,
27,
28);
- mf.gtp_per_flow_metrics = mygtp;
-
-
+ mf.gtp_per_flow_metrics = mygtp;
mf.evel_mobile_gtp_metrics_dur_con_fail_set(mygtp, 1);
mf.evel_mobile_gtp_metrics_dur_tun_fail_set(mygtp, 1);
mf.evel_mobile_gtp_metrics_act_by_set(mygtp, "Active");
@@ -1192,11 +897,10 @@ public class TestJunit {
mf.evel_mobile_flow_tac_set("TAC");
mf.evel_mobile_flow_tunnel_id_set("Tunnel");
mf.evel_mobile_flow_vlan_id_set("Vlan");
-
- when(mymainmock.evel_post_event(mf)).thenReturn(true);
- boolean ret = mymainmock.evel_post_event(mf);
- LOG.info("Returned "+ret);
- assertTrue( ret );
+
+ mf.evel_json_encode_event();
+ mf.evel_json_encode_event_batch();
+
}