diff options
author | 2019-03-13 14:55:59 +0530 | |
---|---|---|
committer | 2019-03-13 15:51:24 +0530 | |
commit | 0d08c0ad086d7cbe8a1efcef9164a0cca08e2864 (patch) | |
tree | aaffd3f4dc943a06b0b4968a07ddfe7a1bcd08e4 /veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary | |
parent | 03ff3e042bb3070148f06e7cf819150150e5e6af (diff) |
JAVA Test code coveragedublin
JAVA Test code coverage Issue-ID: VNFSDK-381
Change-Id: I460967cde23f51c208e0b92d1a4cbdb1a1968118
Signed-off-by: SrikanthN <sn00469487@techmahindra.com>
Diffstat (limited to 'veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary')
17 files changed, 221 insertions, 547 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, |