diff options
author | SrikanthN <sn00469487@techmahindra.com> | 2019-01-29 00:37:36 +0530 |
---|---|---|
committer | SrikanthN <sn00469487@techmahindra.com> | 2019-01-29 00:54:18 +0530 |
commit | c51c2a71c930df4ccbb87492f0450aa7db740ebe (patch) | |
tree | a4ec7542bf0b3585dd94fbb6468ce6a95ffa49d0 /veslibrary/ves_javalibrary/evel_javalib2 | |
parent | 493ed75799223784bdd6f9363d3bc4d189ddb370 (diff) |
VES 7.1 JAVA LIB-Agent Enhancements
HB-Fault-Measurement-Syslog-2Collector enhancements
Issue-ID: VNFSDK-362
Change-Id: I4db391ce8dbc763021ba15f6335d2df1e0b10e40
Signed-off-by: SrikanthN <sn00469487@techmahindra.com>
Diffstat (limited to 'veslibrary/ves_javalibrary/evel_javalib2')
39 files changed, 4504 insertions, 2166 deletions
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/pom.xml b/veslibrary/ves_javalibrary/evel_javalib2/pom.xml index 04af481..c39b101 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/pom.xml +++ b/veslibrary/ves_javalibrary/evel_javalib2/pom.xml @@ -89,6 +89,11 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <version>1.1</version> </dependency> <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/AgentMain.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/AgentMain.java index a6886e2..aaaf006 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/AgentMain.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/AgentMain.java @@ -31,15 +31,18 @@ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; +import java.net.ConnectException; import java.net.HttpURLConnection; import java.net.MalformedURLException; +import java.io.UnsupportedEncodingException; import java.net.URL; +import java.nio.channels.InterruptedByTimeoutException; import java.security.KeyStore; +import java.time.Duration; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.KeyManagerFactory; @@ -86,14 +89,25 @@ public class AgentMain { private static URL vesbatchurl = null; private static HttpURLConnection con = null; private static String userpass = null; - private static String keystore_pth = null; - private static String jks_passw = null; - private static String key_passw = null; - private static String version = "5"; + private static String keystorePath = null; + private static String jksPassw = null; + private static String keyPassw = null; + private static String version = "7"; + + + + private static String userpass2 = null; + private static String keystorePath2 = null; + private static String jksPassw2 = null; + private static String keyPassw2 = null; + private static String url2 = null; + private static URL vesurl2 = null; + private static URL vesbatchurl2 = null; + private static HttpURLConnection con2 = null; /* RingBuffer to forward messages on sending AgentDispatcher thread */ private static RingBuffer ringb = new RingBuffer(100); - private static volatile boolean should_stop = false; + private static volatile boolean shouldStop = false; private static Thread thr; @@ -101,19 +115,36 @@ public class AgentMain { * to external Collector */ private static class AgentDispatcher implements Runnable { - - private void send_object(EvelObject tosend){ - AgentMain.sendObjectWithReturn(tosend); + public static int httpResponse = 0; + public static int httpResponse2 = 0; + private void sendObject(EvelObject tosend){ + while(true) { + httpResponse = AgentMain.sendObjectWithReturn(tosend); + if((httpResponse >= 200 && httpResponse < 299) || httpResponse == 400) { + return; + } + httpResponse2 = AgentMain.sendObjectWithReturn2(tosend); + if((httpResponse2 >= 200 && httpResponse2 < 299) || httpResponse2 == 400) { + return; + } + else { + + try { + Thread.sleep(120000); + }catch(Exception ee) { + } + } + } } public void run() { String datatosend=null; - while (!should_stop){ + while (!shouldStop){ EvelObject tosend = ringb.take(); if( tosend != null && ((datatosend = (String) tosend.datastr) != null)) { - send_object(tosend); + sendObject(tosend); } else { @@ -123,8 +154,8 @@ public class AgentMain { } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.trace("Interrupted on "+url); - System.out.println("Interrupted on "+url); - //e.printStackTrace(); + + } } }//end while @@ -135,14 +166,14 @@ public class AgentMain { EvelObject tosend = ringb.take(); if( tosend != null && ((datatosend = (String) tosend.datastr) != null)) { - send_object(tosend); + sendObject(tosend); } } logger.trace("Send buffer is empty, shutting down"); }//end run }//end AgentDispatcher - public static int doPost(HttpURLConnection con, String dataToSend) throws IOException, UnsupportedEncodingException { + public static int doPost(HttpURLConnection con, String dataToSend) throws IOException { OutputStream os = con.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); @@ -165,7 +196,7 @@ public class AgentMain { in.close(); } logger.error("Resp: " + builder.toString()); - //System.out.println("Resp: " + builder.toString()); + return builder.toString(); } @@ -183,6 +214,152 @@ public class AgentMain { } } }; + + //Second Collector return object + public static final int sendObjectWithReturn2(EvelObject tosend){ + String datatosend = (String) tosend.datastr; + //process data + logger.trace(url2 + "Got an event size second collector "+datatosend.length()); + logger.trace(datatosend); + int respCode = 0; + Duration timeout = Duration.ofSeconds(2000); + try { + + if( tosend.type == false) + + con2 = (HttpURLConnection) vesurl2.openConnection(); + + else + con2 = (HttpURLConnection) vesbatchurl2.openConnection(); + + if (con2 instanceof HttpsURLConnection) { + + HttpsURLConnection httpsConnection = (HttpsURLConnection) con2; + + try { + + SSLContext sc = SSLContext.getInstance("TLSv1.2"); + /* Get the JKS contents */ + if( !keystorePath2.isEmpty() && !jksPassw2.isEmpty() && !keyPassw2.isEmpty() ) + { + final KeyStore keyStore = KeyStore.getInstance("JKS"); + try (final InputStream is = new FileInputStream(keystorePath2)) { + keyStore.load(is, jksPassw2.toCharArray()); + } + final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory + .getDefaultAlgorithm()); + kmf.init(keyStore, keyPassw2.toCharArray()); + final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory + .getDefaultAlgorithm()); + tmf.init(keyStore); + sc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new java.security.SecureRandom()); + } + else + { + // Init the SSLContext with a TrustManager[] and SecureRandom() + sc.init(null, trustAllCerts, new java.security.SecureRandom()); + } + httpsConnection.setDefaultHostnameVerifier(new HostnameVerifier() + { + public boolean verify(String hostname, SSLSession session) + { + return true; + } + }); + httpsConnection.setSSLSocketFactory(sc.getSocketFactory()); + con2 = httpsConnection; + + + } + + catch (final Exception exc) { + logger.error("SSL/TLS connection error"); + } + } + + //add reuqest header + con2.setRequestMethod("POST"); + // No caching, we want the real thing. + + con2.setUseCaches (false); + // Specify the content type. + + con2.setRequestProperty("Content-Type", "application/json"); + con2.setInstanceFollowRedirects( false ); + + //Basic username password authentication + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass2.getBytes("UTF-8")); + con2.setRequestProperty ("Authorization", basicAuth); + + con2.setReadTimeout(15000 /* milliseconds */); + + con2.setConnectTimeout(15000 /* milliseconds */); + + // Send post request + con2.setDoOutput(true); + con2.setDoInput(true); + + con2.setFixedLengthStreamingMode(datatosend.length()); + + + + try { + respCode = AgentMain.doPost(con2, datatosend); + }catch (ConnectException ie) { + /* Handle the interruption. Or ignore it. */ + + + } + catch (InterruptedByTimeoutException ee) { + /* Handle the error. Or ignore it. */ + + + } + catch (IOException te) { + /* Handle the timeout. Or ignore it. */ + + + } + + + + + logger.trace(url2 + "Connection HTTP Response code :"+respCode); + if(respCode < HttpURLConnection.HTTP_OK ) { + logger.trace(url2 + " **INFO**"); + } + else if(respCode >= HttpURLConnection.HTTP_OK && respCode < HttpURLConnection.HTTP_MULT_CHOICE ) + { + logger.trace(url2 + " **OK**"); + + } + else if(respCode >= HttpURLConnection.HTTP_MULT_CHOICE && respCode < HttpURLConnection.HTTP_BAD_REQUEST ) + { + logger.warn(url2 + " **REDIRECTION**"); + + } + else if(respCode >= HttpURLConnection.HTTP_BAD_REQUEST ) + { + logger.warn(url2 + " **SERVER ERROR**"); + InputStream es = con2.getErrorStream(); + AgentMain.readStream(es); + } + + + return respCode; + } catch (ConnectException e) { + + } catch (IOException e) { + logger.error("Exception during POST", e); + + + return 0; + } + + return respCode; + + } + public static int sendObjectWithReturn(EvelObject tosend){ String datatosend = (String) tosend.datastr; @@ -204,15 +381,15 @@ public class AgentMain { SSLContext sc = SSLContext.getInstance("TLSv1.2"); /* Get the JKS contents */ - if( !keystore_pth.isEmpty() && !jks_passw.isEmpty() && !key_passw.isEmpty() ) + if( !keystorePath.isEmpty() && !jksPassw.isEmpty() && !keyPassw.isEmpty() ) { final KeyStore keyStore = KeyStore.getInstance("JKS"); - try (final InputStream is = new FileInputStream(keystore_pth)) { - keyStore.load(is, jks_passw.toCharArray()); + try (final InputStream is = new FileInputStream(keystorePath)) { + keyStore.load(is, jksPassw.toCharArray()); } final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory .getDefaultAlgorithm()); - kmf.init(keyStore, key_passw.toCharArray()); + kmf.init(keyStore, keyPassw.toCharArray()); final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory .getDefaultAlgorithm()); tmf.init(keyStore); @@ -235,7 +412,6 @@ public class AgentMain { } catch (final Exception exc) { - exc.printStackTrace(); logger.error("SSL/TLS connection error"); } } @@ -306,7 +482,7 @@ public class AgentMain { * @note This function initializes the Java EVEL library interfaces. * Validates input parameters and starts the AgentDispatcher thread * - * @param event_api_url The API's URL. + * @param eventApiUrl The API's URL. * @param port The API's port. * @param path The optional path (may be NULL). * @param topic The optional topic part of the URL (may be NULL). @@ -319,15 +495,19 @@ public class AgentMain { * @retval ::EVEL_ERR_CODES On failure. *****************************************************************************/ public static EVEL_ERR_CODES evel_initialize( - String event_api_url, + String eventApiUrl, int port, String path, String topic, String username, String password, - String keystore_path, - String jks_password, - String key_password, + String evelKeystorePath, + String evelJksPassword, + String evelKeyPassword, + String eventApiUrl2, + int port2, + String username2, + String password2, Level level) throws IOException { EVEL_ERR_CODES rc = EVEL_ERR_CODES.EVEL_SUCCESS; @@ -339,14 +519,25 @@ public class AgentMain { /***************************************************************************/ /* Check assumptions. */ /***************************************************************************/ - assert(event_api_url != null); + assert(eventApiUrl != null); assert(port > 1024); assert(username != null); + + assert(eventApiUrl2 != null); + assert(port2 > 1024); + assert(username2 != null); logger.setLevel(level); - if( !isValidURL(event_api_url) ){ - System.out.println("Invalid Event API URL"); + if( !isValidURL(eventApiUrl) ){ + + logger.error("Invalid Event API URL"); + rc = EVEL_ERR_CODES.EVEL_ERR_GEN_FAIL; + System.exit(1); + } + + if( !isValidURL(eventApiUrl2) ){ + logger.error("Invalid Event API URL"); rc = EVEL_ERR_CODES.EVEL_ERR_GEN_FAIL; System.exit(1); @@ -358,21 +549,34 @@ public class AgentMain { version += "/example_vnf"; } - keystore_pth = keystore_path; - jks_passw = jks_password; - key_passw = key_password; + keystorePath = evelKeystorePath; + jksPassw = evelJksPassword; + keyPassw = evelKeyPassword; + + keystorePath2 = evelKeystorePath; + jksPassw2 = evelJksPassword; + keyPassw2 = evelKeyPassword; - url = event_api_url+":"+Integer.toString(port)+path+"/eventListener/v"+version; + url = eventApiUrl+":"+Integer.toString(port)+path+"/eventListener/v"+version; vesurl = null; + + url2 = eventApiUrl2+":"+Integer.toString(port2)+path+"/eventListener/v"+version; + vesurl2 = null; try { vesurl = new URL(url); vesbatchurl = new URL(url+"/eventBatch"); + + + vesurl2 = new URL(url2); + vesbatchurl2 = new URL(url2+"/eventBatch"); } catch (MalformedURLException e) { logger.info("Error in url input"); - e.printStackTrace(); + System.exit(1); } userpass = username + ":" + password; + + userpass2 = username2 + ":" + password2; logger.info("Starting Agent Dispatcher thread"); thr = new Thread(new AgentDispatcher()); @@ -384,10 +588,10 @@ public class AgentMain { } public static void evel_shutdown() { - if(should_stop){ + if(shouldStop){ logger.warn("evel_shutdown was called whilst the agent was already stopping - this has no effect"); } - should_stop = true; + shouldStop = true; logger.debug("Called evel_shutdown, will shutdown when the buffer is empty"); } @@ -414,7 +618,7 @@ public class AgentMain { public static boolean evel_post_event(EvelHeader obj) { - if (should_stop){ + if (shouldStop){ logger.error("evel_post_event called whilst agent is shutting down - event will not be posted"); return false; } @@ -439,7 +643,7 @@ public class AgentMain { public static int evel_post_event_immediate(EvelHeader obj) { - if (should_stop){ + if (shouldStop){ logger.error("evel_post_event_immediate called while agent is shutting down - event will not be posted"); return 0; } @@ -465,7 +669,7 @@ public class AgentMain { public static boolean evel_post_event(EvelBatch obj) { - if (should_stop){ + if (shouldStop){ logger.error("evel_post_event called whilst agent is shutting down - event will not be posted"); return false; } 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 d7c91b3..35685d8 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 @@ -145,10 +145,10 @@ public class EvelFault extends EvelHeader { event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT;
//Validate inputs
assert( condition != null);
- assert( specific_problem != null);
- assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(tpriority) < 0 );
- assert(EVEL_SEVERITIES.EVEL_MAX_SEVERITIES.compareTo(severity) < 0 );
- assert(EVEL_VF_STATUSES.EVEL_MAX_VF_STATUSES.compareTo(status) < 0 );
+ assert( specproblem != null);
+ assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(tpriority) >= 0 );
+ assert(EVEL_SEVERITIES.EVEL_MAX_SEVERITIES.compareTo(severity) >= 0 );
+ assert(EVEL_VF_STATUSES.EVEL_MAX_VF_STATUSES.compareTo(status) >= 0 );
//Init mandatory fields
event_severity = severity;
event_source_type = ev_source_type;
@@ -161,6 +161,7 @@ public class EvelFault extends EvelHeader { alarm_interface_a = new EvelOptionString(false, null);
+
additional_inf = null;
@@ -303,7 +304,7 @@ public class EvelFault extends EvelHeader { * @param source_type The source type to convert.
* @returns The equivalent string.
*****************************************************************************/
- String evel_source_type(EVEL_SOURCE_TYPES source_type)
+ static String evel_source_type(EVEL_SOURCE_TYPES source_type)
{
String result;
@@ -561,6 +562,22 @@ public class EvelFault extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
+ //encode common event header and body
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "faultFields",evelFaultObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java index 2686824..d2c2930 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java @@ -42,6 +42,7 @@ import javax.json.JsonWriter; import org.slf4j.helpers.MessageFormatter;
+
public class EvelHeader {
@@ -206,7 +207,7 @@ public class EvelHeader { }
catch (UnknownHostException ex)
{
- System.out.println("Hostname can not be resolved");
+
}
try{
@@ -230,7 +231,7 @@ public class EvelHeader { }
if (mac != null) {
- /* System.out.print("Current MAC address : ");
+ /*
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) {
@@ -244,7 +245,7 @@ public class EvelHeader { } catch (SocketException e) {
// TODO Auto-generated catch block
- e.printStackTrace();
+
}
@@ -255,21 +256,21 @@ public class EvelHeader { minor_version = EVEL_HEADER_MINOR_VERSION;
//VES 7.0 added 4Sept 2018
- ves_eventListener_version = "7.0.2";
+ ves_eventListener_version = "7.1";
/***************************************************************************/
/* Optional parameters. */
/***************************************************************************/
- event_type = new EvelOptionString(false, null);
- nfcnaming_code = new EvelOptionString(false, null);
- nfnaming_code = new EvelOptionString(false, null);
+ event_type = new EvelOptionString(true, "Perf management");
+ nfcnaming_code = new EvelOptionString(true, "NfcNamingCode");
+ nfnaming_code = new EvelOptionString(true, "NfNamingCode");
reporting_entity_id = new EvelOptionString(true, uuid);
source_id = new EvelOptionString(true, uuid);
- internal_field = new EvelOptionIntHeader(false, null);
+ internal_field = new EvelOptionIntHeader(false, "InternalFeild");
//VES 7.0 added 4Sept2018
- nfVendor_name = new EvelOptionString(false, null);
- timeZoneOffset = new EvelOptionString(false, null);
+ nfVendor_name = new EvelOptionString(true, "nfVendorName");
+ timeZoneOffset = new EvelOptionString(true, "UTC-5:30");
EVEL_EXIT();
}
@@ -577,7 +578,7 @@ public class EvelHeader { {
EVEL_ENTER();
- assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(priority_val) < 0 );
+ assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(priority_val) >= 0 );
priority = priority_val;
@@ -606,6 +607,26 @@ public class EvelHeader { }
/**************************************************************************//**
+ * Set the Event Type property of the event header.
+ *
+ * @note The Reporting Entity Id defaults to the OpenStack VM UUID.
+ *
+ * @param val Optional true or false
+ *****************************************************************************/
+ public void evel_header_set_eventType(String eventtype)
+ {
+ EVEL_ENTER();
+
+ assert(event_type != null);
+
+ event_type.set_option(true);
+ event_type.SetValue(eventtype);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
* Set the Source name property of the event header.
*
* @note Source name should identify the IP address or Source Event originator
@@ -775,18 +796,19 @@ public class EvelHeader { .add("version", version)
.add("reportingEntityId", reporting_entity_id.GetValue())
.add("sourceId", source_id.GetValue());
-
+
/***************************************************************************/
/* Optional fields. */
/***************************************************************************/
+ commheader.add("eventType", event_type.GetValue());
if( event_type.is_set )
- commheader.add("eventType", event_type.GetValue());
- if( source_id.is_set )
- commheader.add("sourceId", source_id.GetValue());
- if( reporting_entity_id.is_set )
- commheader.add("reportingEntityId", reporting_entity_id.GetValue());
-
+// commheader.add("eventType", event_type.GetValue());
+// if( source_id.is_set )
+// commheader.add("sourceId", source_id.GetValue());
+// if( reporting_entity_id.is_set )
+// commheader.add("reportingEntityId", reporting_entity_id.GetValue());
+//
if( internal_field.is_set )
commheader.add("internalField",internal_field.toString());
@@ -797,7 +819,7 @@ public class EvelHeader { //VES 7.0 added 4Sept2018
if( nfVendor_name.is_set )
- commheader.add("nfNamingCode", nfVendor_name.GetValue());
+ commheader.add("nfVendorName", nfVendor_name.GetValue());
if( timeZoneOffset.is_set )
commheader.add("timeZoneOffset", timeZoneOffset.GetValue());
@@ -814,12 +836,11 @@ public class EvelHeader { * retval : String of JSON event header only message
*****************************************************************************/
JsonObject evel_json_encode_event()
- {
-
- JsonObject obj = Json.createObjectBuilder()
-
- .add("event", Json.createObjectBuilder())
- .add( "commonEventHeader",eventHeaderObject() ).build();
+ {
+ JsonObject obj = Json.createObjectBuilder()
+ .add("event", Json.createObjectBuilder()
+ .add("commonEventHeader",eventHeaderObject())
+ ).build();
EVEL_EXIT();
@@ -827,18 +848,18 @@ public class EvelHeader { }
- JsonObject evel_json_encode_eventNew()
+ JsonObject evel_json_encode_event_batch()
{
JsonObject obj = Json.createObjectBuilder()
-
- .add( "commonEventHeader",eventHeaderObject() ).build();
+ // .add("event", Json.createObjectBuilder())
+ .add("commonEventHeader",eventHeaderObject()).build();
EVEL_EXIT();
return obj;
- }
+ }
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 0a6203f..9d8de72 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 @@ -103,30 +103,21 @@ public class EvelHeartbeatField extends EvelHeader { /***************************************************************************/
/* Check preconditions. */
/***************************************************************************/
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_HEARTBEAT_FIELD);
assert(name != null);
assert(value != null);
if( additional_inf == null )
{
- // additional_info = new ArrayList<String[]>();
-
additional_inf = new HashMap<>();
}
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();
}
+
/**************************************************************************//**
* Set the Interval property of the Heartbeat fields event.
*
@@ -194,21 +185,23 @@ public class EvelHeartbeatField extends EvelHeader { }
*/
- if(additional_inf != null) {
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ if(additional_inf != null) {
+ //JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator();
while(it.hasNext()) {
Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
String addl_info_key = add_inf.getKey();
String addl_info_value = add_inf.getValue();
- JsonObject obj1 = Json.createObjectBuilder()
- .add("name", addl_info_key)
- .add("value", addl_info_value).build();
- builder.add(obj1);
+ builder.add("name", addl_info_key);
+ builder.add("value", addl_info_value);
+
+
}
- evelHeatbeat.add("alarmAdditionalInformation", builder);
+ evelHeatbeat.add("additionalFields", builder);
}
+
EVEL_EXIT();
return evelHeatbeat;
@@ -225,8 +218,7 @@ public class EvelHeartbeatField extends EvelHeader { assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_HEARTBEAT_FIELD);
//encode common event header and body
- JsonObject obj = Json.createObjectBuilder()
-
+ JsonObject obj = Json.createObjectBuilder()
.add("event", Json.createObjectBuilder()
.add( "commonEventHeader",eventHeaderObject())
.add( "heartbeatFields",evelHeartbeatFieldObject())
@@ -237,6 +229,24 @@ public class EvelHeartbeatField extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_HEARTBEAT_FIELD);
+ //encode common event header and body
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject())
+ .add( "heartbeatFields",evelHeartbeatFieldObject())
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
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 e6b7fd2..f4287e0 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 @@ -42,6 +42,7 @@ public class EvelMobileFlow extends EvelHeader { int major_version = 2;
int minor_version = 0;
+
static int EVEL_TOS_SUPPORTED = 256;
/**************************************************************************//**
* TCP flags.
@@ -187,7 +188,7 @@ public class EvelMobileFlow extends EvelHeader { EvelOptionInt dur_tunnel_failed_status;
EvelOptionString flow_activated_by;
- EvelOptionTime flow_activation_time;
+ EvelOptionString flow_activation_time;
EvelOptionString flow_deactivated_by;
EvelOptionString gtp_connection_status;
@@ -385,7 +386,7 @@ public class EvelMobileFlow extends EvelHeader { dur_connection_failed_status = new EvelOptionInt();
dur_tunnel_failed_status = new EvelOptionInt();
flow_activated_by = new EvelOptionString();
- flow_activation_time = new EvelOptionTime();
+ flow_activation_time = new EvelOptionString();
flow_deactivated_by = new EvelOptionString();
gtp_connection_status = new EvelOptionString();
gtp_tunnel_status = new EvelOptionString();
@@ -409,7 +410,7 @@ public class EvelMobileFlow extends EvelHeader { /* Mandatory fields */
/***************************************************************************/
String flow_direction;
- public MOBILE_GTP_PER_FLOW_METRICS gtp_per_flow_metrics;
+ public static MOBILE_GTP_PER_FLOW_METRICS gtp_per_flow_metrics;
String ip_protocol_type;
String ip_version;
String other_endpoint_ip_address;
@@ -498,7 +499,7 @@ public class EvelMobileFlow extends EvelHeader { /* Check preconditions. */
/***************************************************************************/
assert(flow_dir != null);
- assert(gtp_per_flow_metr != null);
+ //assert(gtp_per_flow_metr != null);
assert(ip_protocol_typ != null);
assert(ip_vers != null);
assert(other_endpoint_ip_addr != null);
@@ -690,7 +691,7 @@ public class EvelMobileFlow extends EvelHeader { * string. The caller does not need to preserve the value
* once the function returns.
*****************************************************************************/
- void evel_mobile_flow_app_prot_ver_set(String version)
+ public void evel_mobile_flow_app_prot_ver_set(String version)
{
EVEL_ENTER();
@@ -1364,7 +1365,7 @@ public class EvelMobileFlow extends EvelHeader { *****************************************************************************/
public void evel_mobile_gtp_metrics_act_time_set(
MOBILE_GTP_PER_FLOW_METRICS metrics,
- Date act_time)
+ String act_time)
{
EVEL_ENTER();
@@ -1763,31 +1764,6 @@ public class EvelMobileFlow extends EvelHeader { }
- public void evel_mobileFlow_hashMap_add(String name, String value)
- {
-
- EVEL_ENTER();
-
- /***************************************************************************/
- /* Check preconditions. */
- /***************************************************************************/
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
- assert(name != null);
- assert(value != null);
-
- if( hashMap == null )
- {
-
- hashMap = new HashMap<String,String>();
- }
-
- LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- hashMap.put(name, value);
-
-
- EVEL_EXIT();
- }
-
/**************************************************************************//**
@@ -2028,6 +2004,7 @@ public class EvelMobileFlow extends EvelHeader { JsonObjectBuilder evelMobileFlowObject()
{
+
// double version = major_version+(double)minor_version/10;
String version = "4.0";
EVEL_ENTER();
@@ -2124,7 +2101,7 @@ public class EvelMobileFlow extends EvelHeader { {
EVEL_ENTER();
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
//encode common event header and mobile flow body
JsonObject obj = Json.createObjectBuilder()
.add("event", Json.createObjectBuilder()
@@ -2137,6 +2114,24 @@ public class EvelMobileFlow extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ //encode common event header and mobile flow body
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "mobileFlowFields",evelMobileFlowObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
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 3c2150c..2f27a96 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 @@ -52,6 +52,7 @@ public class EvelNotification extends EvelHeader { int major_version = 1; int minor_version = 0; + /***************************************************************************/ /* Mandatory fields */ /***************************************************************************/ @@ -121,36 +122,6 @@ public class EvelNotification extends EvelHeader { } -// public void evel_notification_addl_info_add(String name, String value) -// { -// String[] addl_info = null; -// EVEL_ENTER(); -// -// /***************************************************************************/ -// /* Check preconditions. */ -// /***************************************************************************/ -// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); -// assert(name != null); -// assert(value != null); -// -// if( additional_info == null ) -// { -// additional_info = new ArrayList<String[]>(); -// additional_inf = new HashMap<>(); -// } -// -// 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(); -// } - /**************************************************************************//** * Adds name value pair under hash key @@ -167,7 +138,7 @@ public class EvelNotification extends EvelHeader { /***************************************************************************/ /* Check preconditions. */ /***************************************************************************/ - assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER); + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); assert(hashname != null); assert(name != null); assert(value != null); @@ -203,7 +174,7 @@ public class EvelNotification extends EvelHeader { } catch( Exception e) { - e.printStackTrace(); + } EVEL_EXIT(); @@ -408,7 +379,7 @@ public class EvelNotification extends EvelHeader { newState.encJsonValue(obj, "newState"); oldState.encJsonValue(obj,"oldState"); changeContact.encJsonValue(obj,"changeContact"); - stateInterface.encJsonValue(obj, "syslogProc"); + stateInterface.encJsonValue(obj, "stateInterface"); // additional fields // if( additional_info != null ) // { @@ -507,5 +478,23 @@ public class EvelNotification extends EvelHeader { return obj; } + + JsonObject evel_json_encode_event_batch() + { + EVEL_ENTER(); + + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + + JsonObject obj = Json.createObjectBuilder() + // .add("event", Json.createObjectBuilder() + .add( "commonEventHeader",eventHeaderObject() ) + .add( "notificationFields", evelNotificationObject() ) + .build(); + + EVEL_EXIT(); + + return obj; + + } } 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 1f97625..d01387a 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 @@ -173,7 +173,7 @@ public class EvelOther extends EvelHeader { } catch( Exception e)
{
- e.printStackTrace();
+
}
EVEL_EXIT();
@@ -358,6 +358,24 @@ public class EvelOther extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER);
+ //encode common event header and body for other
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "otherFields",evelOtherObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
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 ee0ab6b..c964849 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 @@ -387,6 +387,22 @@ public class EvelPnfRegistration extends EvelHeader{ return obj; } + + JsonObject evel_json_encode_event_batch() + { + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + //encode common event header and body + JsonObject obj = Json.createObjectBuilder() + // .add("event", Json.createObjectBuilder() + .add( "commonEventHeader",eventHeaderObject() ) + .add( "pnfRegistrationFields",evelPnfRegistrationObject() ) + .build(); + + EVEL_EXIT(); + + return obj; + + } 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 52bed2e..2f1d759 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 @@ -66,6 +66,7 @@ public class EvelScalingMeasurement extends EvelHeader { * JSON equivalent field: machineCheckException
******************************************************************************/
public class MACHINE_CHECK_EXCEPTION{
+
/**
*
*/
@@ -86,11 +87,11 @@ public class EvelScalingMeasurement extends EvelHeader { public class MEASUREMENT_HUGE_PAGE {
String hugePagesIdentifier;
double bytesUsed;
- public EvelOptionDouble bytesFree;
- public EvelOptionDouble vmPageNumberUsed;
- public EvelOptionDouble vmPageNumberFree;
- public EvelOptionDouble percentUsed;
- public EvelOptionDouble percentFree;
+ private EvelOptionDouble bytesFree;
+ private EvelOptionDouble vmPageNumberUsed;
+ private EvelOptionDouble vmPageNumberFree;
+ private EvelOptionDouble percentUsed;
+ private EvelOptionDouble percentFree;
}
@@ -100,13 +101,13 @@ public class EvelScalingMeasurement extends EvelHeader { *****************************************************************************/
public class MEASUREMENT_PROCESS_STATS {
String processIdentifier;
- public EvelOptionDouble forkRate;
- public EvelOptionDouble psStateBlocked;
- public EvelOptionDouble psStatePaging;
- public EvelOptionDouble psStateRunning;
- public EvelOptionDouble psStateSleeping;
- public EvelOptionDouble psStateStopped;
- public EvelOptionDouble psStateZombie;
+ private EvelOptionDouble forkRate;
+ private EvelOptionDouble psStateBlocked;
+ private EvelOptionDouble psStatePaging;
+ private EvelOptionDouble psStateRunning;
+ private EvelOptionDouble psStateSleeping;
+ private EvelOptionDouble psStateStopped;
+ private EvelOptionDouble psStateZombie;
}
@@ -116,9 +117,9 @@ public class EvelScalingMeasurement extends EvelHeader { *****************************************************************************/
public class MEASUREMENT_LOAD {
// String loadIdentifier;
- public EvelOptionDouble shortTerm;
- public EvelOptionDouble midTerm;
- public EvelOptionDouble longTerm;
+ private EvelOptionDouble shortTerm;
+ private EvelOptionDouble midTerm;
+ private EvelOptionDouble longTerm;
}
@@ -129,24 +130,24 @@ public class EvelScalingMeasurement extends EvelHeader { public class MEASUREMENT_CPU_USE {
String id;
double usage;
- public EvelOptionDouble idle;
- public EvelOptionDouble intrpt;
- public EvelOptionDouble nice;
- public EvelOptionDouble softirq;
- public EvelOptionDouble steal;
- public EvelOptionDouble sys;
- public EvelOptionDouble user;
- public EvelOptionDouble wait;
+ private EvelOptionDouble idle;
+ private EvelOptionDouble intrpt;
+ private EvelOptionDouble nice;
+ private EvelOptionDouble softirq;
+ private EvelOptionDouble steal;
+ private EvelOptionDouble sys;
+ private EvelOptionDouble user;
+ private EvelOptionDouble wait;
/*
* Ves6.0 added fields 14/07/2018
*/
private EvelOptionDouble cpuCapacityContention;
- public EvelOptionDouble cpuDemandAvg;
- public EvelOptionDouble cpuDemandMhz;
- public EvelOptionDouble cpuDemandPct;
- public EvelOptionDouble cpuLatencyAvg;
- public EvelOptionDouble cpuOverheadAvg;
- public EvelOptionDouble cpuSwapWaitTime;
+ private EvelOptionDouble cpuDemandAvg;
+ private EvelOptionDouble cpuDemandMhz;
+ private EvelOptionDouble cpuDemandPct;
+ private EvelOptionDouble cpuLatencyAvg;
+ private EvelOptionDouble cpuOverheadAvg;
+ private EvelOptionDouble cpuSwapWaitTime;
}
@@ -156,64 +157,64 @@ public class EvelScalingMeasurement extends EvelHeader { *****************************************************************************/
public class MEASUREMENT_DISK_USE {
String id;
- public EvelOptionDouble iotimeavg;
- public EvelOptionDouble iotimelast;
- public EvelOptionDouble iotimemax;
- public EvelOptionDouble iotimemin;
- public EvelOptionDouble mergereadavg;
- public EvelOptionDouble mergereadlast;
- public EvelOptionDouble mergereadmax;
- public EvelOptionDouble mergereadmin;
- public EvelOptionDouble mergewriteavg;
- public EvelOptionDouble mergewritelast;
- public EvelOptionDouble mergewritemax;
- public EvelOptionDouble mergewritemin;
- public EvelOptionDouble octetsreadavg;
- public EvelOptionDouble octetsreadlast;
- public EvelOptionDouble octetsreadmax;
- public EvelOptionDouble octetsreadmin;
- public EvelOptionDouble octetswriteavg;
- public EvelOptionDouble octetswritelast;
- public EvelOptionDouble octetswritemax;
- public EvelOptionDouble octetswritemin;
- public EvelOptionDouble opsreadavg;
- public EvelOptionDouble opsreadlast;
- public EvelOptionDouble opsreadmax;
- public EvelOptionDouble opsreadmin;
- public EvelOptionDouble opswriteavg;
- public EvelOptionDouble opswritelast;
- public EvelOptionDouble opswritemax;
- public EvelOptionDouble opswritemin;
- public EvelOptionDouble pendingopsavg;
- public EvelOptionDouble pendingopslast;
- public EvelOptionDouble pendingopsmax;
- public EvelOptionDouble pendingopsmin;
- public EvelOptionDouble timereadavg;
- public EvelOptionDouble timereadlast;
- public EvelOptionDouble timereadmax;
- public EvelOptionDouble timereadmin;
- public EvelOptionDouble timewriteavg;
- public EvelOptionDouble timewritelast;
- public EvelOptionDouble timewritemax;
- public EvelOptionDouble timewritemin;
+ private EvelOptionDouble iotimeavg;
+ private EvelOptionDouble iotimelast;
+ private EvelOptionDouble iotimemax;
+ private EvelOptionDouble iotimemin;
+ private EvelOptionDouble mergereadavg;
+ private EvelOptionDouble mergereadlast;
+ private EvelOptionDouble mergereadmax;
+ private EvelOptionDouble mergereadmin;
+ private EvelOptionDouble mergewriteavg;
+ private EvelOptionDouble mergewritelast;
+ private EvelOptionDouble mergewritemax;
+ private EvelOptionDouble mergewritemin;
+ private EvelOptionDouble octetsreadavg;
+ private EvelOptionDouble octetsreadlast;
+ private EvelOptionDouble octetsreadmax;
+ private EvelOptionDouble octetsreadmin;
+ private EvelOptionDouble octetswriteavg;
+ private EvelOptionDouble octetswritelast;
+ private EvelOptionDouble octetswritemax;
+ private EvelOptionDouble octetswritemin;
+ private EvelOptionDouble opsreadavg;
+ private EvelOptionDouble opsreadlast;
+ private EvelOptionDouble opsreadmax;
+ private EvelOptionDouble opsreadmin;
+ private EvelOptionDouble opswriteavg;
+ private EvelOptionDouble opswritelast;
+ private EvelOptionDouble opswritemax;
+ private EvelOptionDouble opswritemin;
+ private EvelOptionDouble pendingopsavg;
+ private EvelOptionDouble pendingopslast;
+ private EvelOptionDouble pendingopsmax;
+ private EvelOptionDouble pendingopsmin;
+ private EvelOptionDouble timereadavg;
+ private EvelOptionDouble timereadlast;
+ private EvelOptionDouble timereadmax;
+ private EvelOptionDouble timereadmin;
+ private EvelOptionDouble timewriteavg;
+ private EvelOptionDouble timewritelast;
+ private EvelOptionDouble timewritemax;
+ private EvelOptionDouble timewritemin;
/*
* VES6.0 Added fields 14/07/2018
*/
- public EvelOptionDouble diskBusResets;
- public EvelOptionDouble diskCommandsAborted;
- public EvelOptionDouble diskTime;
- public EvelOptionDouble diskFlushRequests;
- public EvelOptionDouble diskFlushTime;
- public EvelOptionDouble diskCommandsAvg;
- public EvelOptionDouble diskReadCommandsAvg;
- public EvelOptionDouble diskWriteCommandsAvg;
- public EvelOptionDouble diskTotalReadLatencyAvg;
- public EvelOptionDouble diskTotalWriteLatencyAvg;
-
- public EvelOptionDouble diskWeightedIoTimeAvg;
- public EvelOptionDouble diskWeightedIoTimeLast;
- public EvelOptionDouble diskWeightedIoTimeMax;
- public EvelOptionDouble diskWeightedIoTimeMin;
+ private EvelOptionDouble diskBusResets;
+ private EvelOptionDouble diskCommandsAborted;
+ private EvelOptionDouble diskTime;
+ private EvelOptionDouble diskFlushRequests;
+ private EvelOptionDouble diskFlushTime;
+ private EvelOptionDouble diskCommandsAvg;
+ private EvelOptionDouble diskReadCommandsAvg;
+ private EvelOptionDouble diskWriteCommandsAvg;
+ private EvelOptionDouble diskTotalReadLatencyAvg;
+ private EvelOptionDouble diskTotalWriteLatencyAvg;
+
+ private EvelOptionDouble diskWeightedIoTimeAvg;
+ private EvelOptionDouble diskWeightedIoTimeLast;
+ private EvelOptionDouble diskWeightedIoTimeMax;
+ private EvelOptionDouble diskWeightedIoTimeMin;
}
@@ -240,37 +241,41 @@ public class EvelScalingMeasurement extends EvelHeader { String id;
String vmid;
double membuffsz;
- public EvelOptionDouble memcache;
- public EvelOptionDouble memconfig;
- public EvelOptionDouble memfree;
- public EvelOptionDouble slabrecl;
- public EvelOptionDouble slabunrecl;
- public EvelOptionDouble memused;
+ private EvelOptionDouble memcache;
+ private EvelOptionDouble memconfig;
+ private EvelOptionDouble memfree;
+ private EvelOptionDouble slabrecl;
+ private EvelOptionDouble slabunrecl;
+ private EvelOptionDouble memused;
/*
* VES6.0 Added fields 14/07/2018
*/
- public EvelOptionDouble memoryDemand;
- public EvelOptionDouble memoryLatencyAvg;
- public EvelOptionDouble memorySwapUsedAvg;
- public EvelOptionDouble memorySwapOutAvg;
- public EvelOptionDouble memorySwapInAvg;
- public EvelOptionDouble memorySwapInRateAvg;
- public EvelOptionDouble memorySwapOutRateAvg;
- public EvelOptionDouble memorySharedAvg;
+ private EvelOptionDouble memoryDemand;
+ private EvelOptionDouble memoryLatencyAvg;
+ private EvelOptionDouble memorySwapUsedAvg;
+ private EvelOptionDouble memorySwapOutAvg;
+ private EvelOptionDouble memorySwapInAvg;
+ private EvelOptionDouble memorySwapInRateAvg;
+ private EvelOptionDouble memorySwapOutRateAvg;
+ private EvelOptionDouble memorySharedAvg;
+
+
+
+
}
/**************************************************************************//**
* myerrors.
* JSON equivalent field: myerrors
*****************************************************************************/
- public class MEASUREMENT_ERRORS {
- int receive_discards;
- int receive_myerrors;
- int transmit_discards;
- int transmit_myerrors;
- }
+// public class MEASUREMENT_ERRORS {
+// int receive_discards;
+// int receive_myerrors;
+// int transmit_discards;
+// int transmit_myerrors;
+// }
/**************************************************************************//**
* Latency Bucket.
@@ -282,8 +287,8 @@ public class EvelScalingMeasurement extends EvelHeader { /***************************************************************************/
/* Optional fields */
/***************************************************************************/
- public EvelOptionDouble high_end;
- public EvelOptionDouble low_end;
+ private EvelOptionDouble high_end;
+ private EvelOptionDouble low_end;
}
@@ -299,74 +304,74 @@ public class EvelScalingMeasurement extends EvelHeader { /***************************************************************************/
/*Cumulative count of broadcast packets received as read at the end of
the measurement interval*/
- public EvelOptionDouble recvd_bcast_packets_acc;
+ private EvelOptionDouble recvd_bcast_packets_acc;
/*Count of broadcast packets received within the measurement interval*/
- public EvelOptionDouble recvd_bcast_packets_delta;
+ private EvelOptionDouble recvd_bcast_packets_delta;
/*Cumulative count of discarded packets received as read at the end of
the measurement interval*/
- public EvelOptionDouble recvd_discarded_packets_acc;
+ private EvelOptionDouble recvd_discarded_packets_acc;
/*Count of discarded packets received within the measurement interval*/
- public EvelOptionDouble recvd_discarded_packets_delta;
+ private EvelOptionDouble recvd_discarded_packets_delta;
/*Cumulative count of error packets received as read at the end of
the measurement interval*/
- public EvelOptionDouble recvd_error_packets_acc;
+ private EvelOptionDouble recvd_error_packets_acc;
/*Count of error packets received within the measurement interval*/
- public EvelOptionDouble recvd_error_packets_delta;
+ private EvelOptionDouble recvd_error_packets_delta;
/*Cumulative count of multicast packets received as read at the end of
the measurement interval*/
- public EvelOptionDouble recvd_mcast_packets_acc;
+ private EvelOptionDouble recvd_mcast_packets_acc;
/*Count of mcast packets received within the measurement interval*/
- public EvelOptionDouble recvd_mcast_packets_delta;
+ private EvelOptionDouble recvd_mcast_packets_delta;
/*Cumulative count of octets received as read at the end of
the measurement interval*/
- public EvelOptionDouble recvd_octets_acc;
+ private EvelOptionDouble recvd_octets_acc;
/*Count of octets received within the measurement interval*/
- public EvelOptionDouble recvd_octets_delta;
+ private EvelOptionDouble recvd_octets_delta;
/*Cumulative count of all packets received as read at the end of
the measurement interval*/
- public EvelOptionDouble recvd_total_packets_acc;
+ private EvelOptionDouble recvd_total_packets_acc;
/*Count of all packets received within the measurement interval*/
- public EvelOptionDouble recvd_total_packets_delta;
+ private EvelOptionDouble recvd_total_packets_delta;
/*Cumulative count of unicast packets received as read at the end of
the measurement interval*/
- public EvelOptionDouble recvd_ucast_packets_acc;
+ private EvelOptionDouble recvd_ucast_packets_acc;
/*Count of unicast packets received within the measurement interval*/
- public EvelOptionDouble recvd_ucast_packets_delta;
+ private EvelOptionDouble recvd_ucast_packets_delta;
/*Cumulative count of transmitted broadcast packets at the end of
the measurement interval*/
- public EvelOptionDouble tx_bcast_packets_acc;
+ private EvelOptionDouble tx_bcast_packets_acc;
/*Count of transmitted broadcast packets within the measurement interval*/
- public EvelOptionDouble tx_bcast_packets_delta;
+ private EvelOptionDouble tx_bcast_packets_delta;
/*Cumulative count of transmit discarded packets at the end of
the measurement interval*/
- public EvelOptionDouble tx_discarded_packets_acc;
+ private EvelOptionDouble tx_discarded_packets_acc;
/*Count of transmit discarded packets within the measurement interval*/
- public EvelOptionDouble tx_discarded_packets_delta;
+ private EvelOptionDouble tx_discarded_packets_delta;
/*Cumulative count of transmit error packets at the end of
the measurement interval*/
- public EvelOptionDouble tx_error_packets_acc;
+ private EvelOptionDouble tx_error_packets_acc;
/*Count of transmit error packets within the measurement interval*/
- public EvelOptionDouble tx_error_packets_delta;
+ private EvelOptionDouble tx_error_packets_delta;
/*Cumulative count of transmit multicast packets at the end of
the measurement interval*/
- public EvelOptionDouble tx_mcast_packets_acc;
+ private EvelOptionDouble tx_mcast_packets_acc;
/*Count of transmit multicast packets within the measurement interval*/
- public EvelOptionDouble tx_mcast_packets_delta;
+ private EvelOptionDouble tx_mcast_packets_delta;
/*Cumulative count of transmit octets at the end of
the measurement interval*/
- public EvelOptionDouble tx_octets_acc;
+ private EvelOptionDouble tx_octets_acc;
/*Count of transmit octets received within the measurement interval*/
- public EvelOptionDouble tx_octets_delta;
+ private EvelOptionDouble tx_octets_delta;
/*Cumulative count of all transmit packets at the end of
the measurement interval*/
- public EvelOptionDouble tx_total_packets_acc;
+ private EvelOptionDouble tx_total_packets_acc;
/*Count of transmit packets within the measurement interval*/
- public EvelOptionDouble tx_total_packets_delta;
+ private EvelOptionDouble tx_total_packets_delta;
/*Cumulative count of all transmit unicast packets at the end of
the measurement interval*/
- public EvelOptionDouble tx_ucast_packets_acc;
+ private EvelOptionDouble tx_ucast_packets_acc;
/*Count of transmit unicast packets within the measurement interval*/
- public EvelOptionDouble tx_ucast_packets_delta;
+ private EvelOptionDouble tx_ucast_packets_delta;
/*VES6.0 added field 14July*/
String nicIdentifier;
@@ -374,15 +379,15 @@ public class EvelScalingMeasurement extends EvelHeader { /*
* VES6.0 added field 19July
*/
- public EvelOptionDouble administrativeState;
- public EvelOptionDouble operationalState;
- public EvelOptionDouble receivedPercentDiscard;
- public EvelOptionDouble receivedPercentError;
- public EvelOptionDouble receivedUtilization;
- public EvelOptionString speed;
- public EvelOptionDouble transmittedPercentDiscard;
- public EvelOptionDouble transmittedPercentError;
- public EvelOptionDouble transmittedUtilization;
+ private EvelOptionString administrativeState;
+ private EvelOptionString operationalState;
+ private EvelOptionDouble receivedPercentDiscard;
+ private EvelOptionDouble receivedPercentError;
+ private EvelOptionDouble receivedUtilization;
+ private EvelOptionDouble speed;
+ private EvelOptionDouble transmittedPercentDiscard;
+ private EvelOptionDouble transmittedPercentError;
+ private EvelOptionDouble transmittedUtilization;
}
@@ -439,68 +444,140 @@ public class EvelScalingMeasurement extends EvelHeader { *****************************************************************************/
public class MEASUREMENT_IPMI {
+
+
/***************************************************************************/
/* Optional fields */
/***************************************************************************/
- public EvelOptionDouble exitAirTemperature;
- public EvelOptionDouble ioModuleTemperature;
- public EvelOptionDouble frontPanelTemperature;
- public EvelOptionDouble systemAirflow;
+ private EvelOptionDouble exitAirTemperature;
+ private EvelOptionDouble ioModuleTemperature;
+ private EvelOptionDouble frontPanelTemperature;
+ private EvelOptionDouble systemAirflow;
+
+
+
+
+
+
+ public void evel_measurement_ipmi_exitAirTemperature_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.exitAirTemperature.SetValuePr(val,"exitAir Temperature");
+ EVEL_EXIT();
+ }
+
+
+
+
+
+
ArrayList<MEASUREMENT_IPMI_PROCESSOR> ipmiprocessor;
public class MEASUREMENT_IPMI_PROCESSOR {
- public String processorIdentifier;
- public EvelOptionDouble processorThermalControlPercent;
- public EvelOptionDouble processorDTSthermalMargin;
+ private String processorIdentifier;
+ private EvelOptionDouble processorThermalControlPercent;
+ private EvelOptionDouble processorDtsThermalMargin;
ArrayList<Processor_DIMMaggregate_Thermal_Margin> processorDIMMaggregateThermalMargin;
public class Processor_DIMMaggregate_Thermal_Margin {
- public String processorDIMMaggregateThermalMarginIdentifier;
- public double processorDIMMaggregateThermalMargin;
+ private String processorDIMMaggregateThermalMarginIdentifier;
+ private double thermalMargin;
}
- public void evel_measurement_IPMI_ProcessorDIMMaggregateThermalMargin_add(
- String thermalMarginIdentifier,
- double thermalMargin)
- {
- Processor_DIMMaggregate_Thermal_Margin pp = null;
- EVEL_ENTER();
+ public ArrayList<Processor_DIMMaggregate_Thermal_Margin> getProcessorDIMMaggregateThermalMargin(
+ String thermalMarginIdentifier,
+ double thermalMargin)
+ {
+ Processor_DIMMaggregate_Thermal_Margin pp = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(thermalMarginIdentifier != null);
+ assert(thermalMargin > 0.0);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding ThermalMarginIdentifier={0} Use={1}", thermalMarginIdentifier, thermalMargin));
+ pp = new Processor_DIMMaggregate_Thermal_Margin();
+ assert(pp != null);
+ pp.processorDIMMaggregateThermalMarginIdentifier = thermalMarginIdentifier;
+ assert(pp.thermalMargin >= 0.0);
+ pp.thermalMargin = thermalMargin;
+
+ if( processorDIMMaggregateThermalMargin == null ){
+ processorDIMMaggregateThermalMargin = new ArrayList<Processor_DIMMaggregate_Thermal_Margin>();
+ LOGGER.debug("Allocate new ProcessorDIMMaggregateThermalMargin");
+ }
+
+ processorDIMMaggregateThermalMargin.add(pp);
+
- /***************************************************************************/
- /* Check assumptions. */
- /***************************************************************************/
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(thermalMarginIdentifier != null);
- assert(thermalMargin > 0.0);
+ EVEL_EXIT();
+ return processorDIMMaggregateThermalMargin;
+ }
+
+
+
+
+
+ }
+
+
+
+ ArrayList<Processor_DIMMaggregate_Thermal_Margin> processorDIMMaggregateThermalMargin;
+ public void evelMeasurementIpmiProcessorAdd(String processorIdentifier,double val, double processDTSthermalMargin,String thermalMarginIdentifier, double thermalMargin) {
+ MEASUREMENT_IPMI_PROCESSOR mIP = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(processorIdentifier != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", processorIdentifier));
+ mIP = new MEASUREMENT_IPMI_PROCESSOR();
+ assert(mIP != null);
+ mIP.processorIdentifier = processorIdentifier;
+ mIP.processorThermalControlPercent = new EvelOptionDouble();
+ mIP.processorThermalControlPercent.SetValuePr(val,"Processor Thermal Control Percent");
+ mIP.processorDtsThermalMargin = new EvelOptionDouble();
+ mIP.processorDtsThermalMargin.SetValuePr(processDTSthermalMargin,"processor DTSthermal Margin");
+
+
+
+ if( ipmiprocessor == null ){
+ ipmiprocessor = new ArrayList<MEASUREMENT_IPMI_PROCESSOR>();
+ LOGGER.debug("Allocate new IPMI_PROCESSOR");
+ }
+
+
+ mIP.processorDIMMaggregateThermalMargin = new MEASUREMENT_IPMI_PROCESSOR().getProcessorDIMMaggregateThermalMargin(thermalMarginIdentifier,thermalMargin);//processorDIMMaggregateThermalMargin;
- /***************************************************************************/
- /* Allocate a container for the value and push onto the list. */
- /***************************************************************************/
- LOGGER.debug(MessageFormatter.format("Adding ThermalMarginIdentifier={0} Use={1}", thermalMarginIdentifier, thermalMargin));
- pp = new Processor_DIMMaggregate_Thermal_Margin();
- assert(pp != null);
- pp.processorDIMMaggregateThermalMarginIdentifier = thermalMarginIdentifier;
- assert(pp.processorDIMMaggregateThermalMargin >= 0.0);
- pp.processorDIMMaggregateThermalMargin = thermalMargin;
- if( processorDIMMaggregateThermalMargin == null ){
- processorDIMMaggregateThermalMargin = new ArrayList<Processor_DIMMaggregate_Thermal_Margin>();
- LOGGER.debug("Allocate new ProcessorDIMMaggregateThermalMargin");
- }
+ ipmiprocessor.add(mIP);
+
- processorDIMMaggregateThermalMargin.add(pp);
+ EVEL_EXIT();
- EVEL_EXIT();
- }
-
-
}
- public void evel_measurement_IPMI_MEASUREMENT_IPMI_PROCESSOR_add(
- String processorIdentifier
+
+
+ public MEASUREMENT_IPMI_PROCESSOR evel_measurement_IPMI_MEASUREMENT_IPMI_PROCESSOR_add(
+ String processorIdentifier,double val
)
{
MEASUREMENT_IPMI_PROCESSOR mIP = null;
@@ -521,7 +598,8 @@ public class EvelScalingMeasurement extends EvelHeader { assert(mIP != null);
mIP.processorIdentifier = processorIdentifier;
mIP.processorThermalControlPercent = new EvelOptionDouble();
- mIP.processorDTSthermalMargin = new EvelOptionDouble();
+ mIP.processorThermalControlPercent.SetValuePr(val,"Processor Thermal Control Percent");
+ mIP.processorDtsThermalMargin = new EvelOptionDouble();
@@ -531,24 +609,21 @@ public class EvelScalingMeasurement extends EvelHeader { }
ipmiprocessor.add(mIP);
-
+
EVEL_EXIT();
+ return mIP;
}
-
-
-
-
-
+
ArrayList<IPMIglobalAggregateTemperatureMargin> ipmiglobalAggregateTemperatureMarginArray;
public class IPMIglobalAggregateTemperatureMargin {
- public String globalAggregateTemperatureMarginIdentifier;
- public EvelOptionDouble globalAggregateTemeratureMargin;
+ private String globalAggregateTemperatureMarginIdentifier;
+ private EvelOptionDouble globalAggregateTemeratureMargin;
}
public void evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add(
- String globalAggregateTemperatureMarginIdentifier
+ String globalAggregateTemperatureMarginIdentifier,double val
)
{
IPMIglobalAggregateTemperatureMargin ipmiGlobalAgg = null;
@@ -569,7 +644,7 @@ public class EvelScalingMeasurement extends EvelHeader { assert(ipmiGlobalAgg != null);
ipmiGlobalAgg.globalAggregateTemperatureMarginIdentifier = globalAggregateTemperatureMarginIdentifier;
ipmiGlobalAgg.globalAggregateTemeratureMargin = new EvelOptionDouble();
-
+ ipmiGlobalAgg.globalAggregateTemeratureMargin.SetValuePr(val,"Processor Thermal Control Percent");
if( ipmiglobalAggregateTemperatureMarginArray == null ){
ipmiglobalAggregateTemperatureMarginArray = new ArrayList<IPMIglobalAggregateTemperatureMargin>();
@@ -583,17 +658,19 @@ public class EvelScalingMeasurement extends EvelHeader { +
+
ArrayList<IPMIpowerSupply> ipmipowerSupply;
public class IPMIpowerSupply {
- public String powerSupplyIdentifier;
- public EvelOptionDouble powerSupplyInputPower;
- public EvelOptionDouble powerSupplycurrentOutputPercent;
- public EvelOptionDouble powerSupplyTemperature;
+ private String powerSupplyIdentifier;
+ private EvelOptionDouble powerSupplyInputPower;
+ private EvelOptionDouble powerSupplycurrentOutputPercent;
+ private EvelOptionDouble powerSupplyTemperature;
}
public void evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add(
- String powerSupplyIdentifier
+ String powerSupplyIdentifier,double powerSupplyInputPower,double powerSupplycurrentOutputPercent,double powerSupplyTemperature
)
{
IPMIpowerSupply ipmipower = null;
@@ -603,7 +680,7 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(ipmipower != null);
+ //assert(ipmipower != null);
/***************************************************************************/
@@ -614,8 +691,11 @@ public class EvelScalingMeasurement extends EvelHeader { assert(ipmipower != null);
ipmipower.powerSupplyIdentifier = powerSupplyIdentifier;
ipmipower.powerSupplycurrentOutputPercent = new EvelOptionDouble();
+ ipmipower.powerSupplycurrentOutputPercent.SetValuePr(powerSupplyInputPower,"Power Supply Input Power");
ipmipower.powerSupplyInputPower = new EvelOptionDouble();
+ ipmipower.powerSupplyInputPower.SetValuePr(powerSupplycurrentOutputPercent,"power Supply currentOutput Percent");
ipmipower.powerSupplyTemperature = new EvelOptionDouble();
+ ipmipower.powerSupplyTemperature.SetValuePr(powerSupplyTemperature,"power Supply Temperature");
if( ipmipowerSupply == null ){
@@ -635,14 +715,14 @@ public class EvelScalingMeasurement extends EvelHeader { ArrayList<IPMIbattery> ipmibattery;
public class IPMIbattery {
- public String batteryIdentifier;
- public EvelOptionString batteryType;
- public EvelOptionDouble batteryVoltageLevel;
+ private String batteryIdentifier;
+ private EvelOptionString batteryType;
+ private EvelOptionDouble batteryVoltageLevel;
}
public void evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add(
- String batteryIdentifier
+ String batteryIdentifier,String batteryType,double batteryVoltageLevel
)
{
IPMIbattery imibatt = null;
@@ -652,7 +732,7 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(imibatt != null);
+ //assert(imibatt != null);
/***************************************************************************/
@@ -663,7 +743,9 @@ public class EvelScalingMeasurement extends EvelHeader { assert(imibatt != null);
imibatt.batteryIdentifier = batteryIdentifier;
imibatt.batteryType = new EvelOptionString();
+ imibatt.batteryType.SetValue("BatteryType");
imibatt.batteryVoltageLevel = new EvelOptionDouble();
+ imibatt.batteryVoltageLevel.SetValuePr(batteryVoltageLevel,"Battery Voltage Level");
if( ipmibattery == null ){
ipmibattery = new ArrayList<IPMIbattery>();
@@ -680,14 +762,14 @@ public class EvelScalingMeasurement extends EvelHeader { ArrayList<IPMINIC> ipmiNIC;
public class IPMINIC {
- public String nic_Identifier;
- public EvelOptionDouble nic_Temperature;
+ private String nicIdentifier;
+ private EvelOptionDouble nicTemperature;
}
public void evel_measurement_IPMINIC_add(
- String nic_Identifier
+ String nicIdentifier,double nicTemperature
)
{
IPMINIC ipmiNic = null;
@@ -697,17 +779,19 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(ipmiNic != null);
+ //assert(ipmiNic != null);
/***************************************************************************/
/* Allocate a container for the value and push onto the list. */
/***************************************************************************/
- LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", nic_Identifier));
+
ipmiNic = new IPMINIC();
assert(ipmiNic != null);
- ipmiNic.nic_Identifier = nic_Identifier;
- ipmiNic.nic_Temperature = new EvelOptionDouble();
+ ipmiNic.nicIdentifier = nicIdentifier;
+ ipmiNic.nicTemperature = new EvelOptionDouble();
+ ipmiNic.nicTemperature.SetValuePr(nicTemperature, "nic Temperature");
+
@@ -726,15 +810,15 @@ public class EvelScalingMeasurement extends EvelHeader { ArrayList<IPMIHSBP> ipmiHSBP;
public class IPMIHSBP {
- public String hsbpIdentifier;
- public EvelOptionDouble hsbpTemperature;
+ private String hsbpIdentifier;
+ private EvelOptionDouble hsbpTemperature;
}
public void evel_measurement_IPMIHSBP_add(
- String hsbpIdentifier
+ String hsbpIdentifier,double hsbpTemperature
)
{
IPMIHSBP ipmiHsbp = null;
@@ -744,7 +828,7 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(ipmiHsbp != null);
+ //assert(ipmiHsbp != null);
/***************************************************************************/
@@ -755,7 +839,7 @@ public class EvelScalingMeasurement extends EvelHeader { assert(ipmiHsbp != null);
ipmiHsbp.hsbpIdentifier = hsbpIdentifier;
ipmiHsbp.hsbpTemperature = new EvelOptionDouble();
-
+ ipmiHsbp.hsbpTemperature.SetValuePr(hsbpTemperature,"Hsbp Temperature");
if( ipmiHSBP == null ){
ipmiHSBP = new ArrayList<IPMIHSBP>();
@@ -773,8 +857,8 @@ public class EvelScalingMeasurement extends EvelHeader { ArrayList<IPMIbaseboardTemperature> ipmibaseboardTemperature;
public class IPMIbaseboardTemperature {
- public String baseboardTemperatureIdentifier;
- public EvelOptionDouble baseboardTemperature;
+ private String baseboardTemperatureIdentifier;
+ private EvelOptionDouble baseboardTemperature;
}
@@ -782,7 +866,7 @@ public class EvelScalingMeasurement extends EvelHeader { public void evel_measurement_IPMIbaseboardTemperature_add(
- String baseboardTemperatureIdentifier
+ String baseboardTemperatureIdentifier,double baseboardTemperature
)
{
IPMIbaseboardTemperature ipmibaseboardTemp = null;
@@ -792,7 +876,7 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(ipmibaseboardTemperature != null);
+ //assert(ipmibaseboardTemperature != null);
/***************************************************************************/
@@ -803,6 +887,7 @@ public class EvelScalingMeasurement extends EvelHeader { assert(ipmibaseboardTemp != null);
ipmibaseboardTemp.baseboardTemperatureIdentifier = baseboardTemperatureIdentifier;
ipmibaseboardTemp.baseboardTemperature = new EvelOptionDouble();
+ ipmibaseboardTemp.baseboardTemperature.SetValuePr(baseboardTemperature,"Baseboard Temperature");
if( ipmibaseboardTemperature == null ){
ipmibaseboardTemperature = new ArrayList<IPMIbaseboardTemperature>();
@@ -820,15 +905,15 @@ public class EvelScalingMeasurement extends EvelHeader { ArrayList<IPMIbaseboardvoltageResulator> ipmiBaseboardvoltageResulator;
public class IPMIbaseboardvoltageResulator {
- public String baseboardVoltageRegulatorIdentifier;
- public EvelOptionDouble voltageRegulatorTemperature;
+ private String baseboardVoltageRegulatorIdentifier;
+ private EvelOptionDouble voltageRegulatorTemperature;
}
public void evel_measurement_IPMIbaseboardvoltageResulator_add(
- String baseboardVoltageRegulatorIdentifier
+ String baseboardVoltageRegulatorIdentifier,double voltageRegulatorTemperature
)
{
IPMIbaseboardvoltageResulator ipmiBaseboardvoltageRes = null;
@@ -838,7 +923,7 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(ipmiBaseboardvoltageRes != null);
+ //assert(ipmiBaseboardvoltageRes != null);
/***************************************************************************/
@@ -849,6 +934,7 @@ public class EvelScalingMeasurement extends EvelHeader { assert(ipmiBaseboardvoltageRes != null);
ipmiBaseboardvoltageRes.baseboardVoltageRegulatorIdentifier = baseboardVoltageRegulatorIdentifier;
ipmiBaseboardvoltageRes.voltageRegulatorTemperature = new EvelOptionDouble();
+ ipmiBaseboardvoltageRes.voltageRegulatorTemperature.SetValuePr(voltageRegulatorTemperature,"Voltage Regulator Temperature");
if( ipmiBaseboardvoltageResulator == null ){
ipmiBaseboardvoltageResulator = new ArrayList<IPMIbaseboardvoltageResulator>();
@@ -866,14 +952,14 @@ public class EvelScalingMeasurement extends EvelHeader { ArrayList<IPMIfan> ipmiFan;
public class IPMIfan {
- public String fanIdentifier;
- public EvelOptionDouble fanSpeed;
+ private String fanIdentifier;
+ private EvelOptionDouble fanSpeed;
}
public void evel_measurement_IPMIfan_add(
- String fanIdentifier
+ String fanIdentifier,double fanSpeed
)
{
IPMIfan ipmiF = null;
@@ -883,7 +969,7 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(ipmiF != null);
+ //assert(ipmiF != null);
/***************************************************************************/
@@ -894,6 +980,7 @@ public class EvelScalingMeasurement extends EvelHeader { assert(ipmiF != null);
ipmiF.fanIdentifier = fanIdentifier;
ipmiF.fanSpeed = new EvelOptionDouble();
+ ipmiF.fanSpeed.SetValuePr(fanSpeed,"Fan Speed");
if( ipmiFan == null ){
ipmiFan = new ArrayList<IPMIfan>();
@@ -907,14 +994,84 @@ public class EvelScalingMeasurement extends EvelHeader { -
-
-
-
+ public void evel_meas_ipmi_add(MEASUREMENT_IPMI ipmi,double exitAirTemperature,double frontPanelTemperature,double ioModuleTemperature,double systemAirflow)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ // MEASUREMENT_IPMI ipmi = new MEASUREMENT_IPMI();
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmi != null);
+
+
+
+ assert(ipmi != null);
+ //cpu_use.id = id;
+ //cpu_use.usage = usage;
+ ipmi.exitAirTemperature = new EvelOptionDouble();
+ ipmi.exitAirTemperature.SetValuePr(exitAirTemperature, "Exit Air Temperature");
+ ipmi.frontPanelTemperature = new EvelOptionDouble();
+ ipmi.frontPanelTemperature.SetValuePr(frontPanelTemperature, "front Panel Temperature");
+ ipmi.ioModuleTemperature = new EvelOptionDouble();
+ ipmi.ioModuleTemperature.SetValuePr(ioModuleTemperature, "IOModule Temperature");
+ ipmi.systemAirflow = new EvelOptionDouble();
+ ipmi.systemAirflow.SetValuePr(systemAirflow, "System Airflow");
+ ipmi.ipmibaseboardTemperature = null;
+ ipmi.ipmiBaseboardvoltageResulator = null;
+ ipmi.ipmibattery = null;
+ ipmi.ipmiFan = null;
+ ipmi.ipmiglobalAggregateTemperatureMarginArray = null;
+ ipmi.ipmiHSBP = null;
+ ipmi.ipmiNIC = null;
+ ipmi.ipmipowerSupply = null;
+ ipmi.ipmiprocessor = null;
+
+
+ if( ipmis == null ){
+ ipmis = new ArrayList<MEASUREMENT_IPMI>();
+ LOGGER.debug("Allocate new file system usage");
+ }
+
+
+ ipmis.add(ipmi);
+
+ EVEL_EXIT();
+
+ //return ipmi;
+ }
+
+
+
+ public void evel_measurement_ipmi_frontPanelTemperature_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.frontPanelTemperature.SetValuePr(val,"Front panel temp in Celsius");
+ EVEL_EXIT();
+ }
+ public void evel_measurement_ipmi_ioModuleTemperature_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.ioModuleTemperature.SetValuePr(val,"Io module temp in Celsius ");
+ EVEL_EXIT();
+ }
+ public void evel_measurement_ipmi_systemAirflow_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.systemAirflow.SetValuePr(val,"Airflow in cubic feet per minute (cfm)");
+ EVEL_EXIT();
+ }
+
+
+
@@ -923,372 +1080,12 @@ public class EvelScalingMeasurement extends EvelHeader { -
-
-
-
-// ArrayList<MEASUREMENT_IPMI_PERCENT_USAGE> ipmi_percentage;
-// ArrayList<MEASUREMENT_IPMI_VOLTAGE> ipmi_voltage;
-//
-// ArrayList<MEASUREMENT_IPMI_TEMPARATURE> ipmi_temparature;
-// ArrayList<MEASUREMENT_IPMI_FAN> ipmi_fan;
-// ArrayList<MEASUREMENT_IPMI_CFM> ipmi_cfm;
-// ArrayList<MEASUREMENT_IPMI_WATTS> ipmi_watts;
-// /**************************************************************************//**
-// * IPMI Percent Usage.
-// * JSON equivalent field: PercentUsage
-// *****************************************************************************/
-// public class MEASUREMENT_IPMI_PERCENT_USAGE {
-// public EvelOptionDouble P2ThermCtrl;
-// public EvelOptionDouble P1ThermCtrl;
-// public EvelOptionDouble PS1CurrOut;
-//
-// }
-//
-// public class MEASUREMENT_IPMI_VOLTAGE {
-// public EvelOptionDouble BB3_3vVbat;
-// public EvelOptionDouble BB12_0v;
-//
-// }
-//
-// public class MEASUREMENT_IPMI_TEMPARATURE {
-// public EvelOptionDouble AggThermMgn1;
-// public EvelOptionDouble DIMMThrmMrgn4;
-// public EvelOptionDouble DIMMThrmMrgn3;
-// public EvelOptionDouble DIMMThrmMrgn2;
-// public EvelOptionDouble DIMMThrmMrgn1;
-// public EvelOptionDouble P2DTSThermMgn;
-// public EvelOptionDouble P1DTSThermMgn;
-// public EvelOptionDouble P2ThermCtrl;
-// public EvelOptionDouble P1ThermCtrl;
-// public EvelOptionDouble P2ThermMargin;
-// public EvelOptionDouble P1ThermMargin;
-// public EvelOptionDouble PS1Temperature;
-// public EvelOptionDouble LANNICTemp;
-// public EvelOptionDouble ExitAirTemp;
-// public EvelOptionDouble HSBP1Temp;
-// public EvelOptionDouble IOModTemp;
-// public EvelOptionDouble BBLftRearTemp;
-// public EvelOptionDouble BBRtRearTemp;
-// public EvelOptionDouble BBBMCTemp;
-// public EvelOptionDouble SSBTemp;
-// public EvelOptionDouble FrontPanelTemp;
-// public EvelOptionDouble BBP2VRTemp;
-// public EvelOptionDouble BBP1VRTemp;
-//
-// }
-//
-// public class MEASUREMENT_IPMI_FAN {
-// public EvelOptionDouble SystemFan6B;
-// public EvelOptionDouble SystemFan6A;
-// public EvelOptionDouble SystemFan5B;
-// public EvelOptionDouble SystemFan5A;
-// public EvelOptionDouble SystemFan4B;
-// public EvelOptionDouble SystemFan4A;
-// public EvelOptionDouble SystemFan3B;
-// public EvelOptionDouble SystemFan3A;
-// public EvelOptionDouble SystemFan2B;
-// public EvelOptionDouble SystemFa_2A;
-// public EvelOptionDouble SystemFan1B;
-// public EvelOptionDouble SystemFan1A;
-//
-// }
-// public class MEASUREMENT_IPMI_CFM {
-// public EvelOptionDouble System_Airflow;
-//
-// }
-// public class MEASUREMENT_IPMI_WATTS {
-// public EvelOptionDouble PS1InputPower;
-//
-// }
-//
-//
-// public MEASUREMENT_IPMI_TEMPARATURE evel_measurement_new_temparature_add(double usage)
-// {
-// EVEL_ENTER();
-//
-// /***************************************************************************/
-// /* Check assumptions. */
-// /***************************************************************************/
-// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
-// assert(usage >= 0.0);
-//
-// /***************************************************************************/
-// /* Allocate a container for the value and push onto the list. */
-// /***************************************************************************/
-// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
-// MEASUREMENT_IPMI_TEMPARATURE temparature = new MEASUREMENT_IPMI_TEMPARATURE();
-// assert(temparature != null);
-// temparature.AggThermMgn1 = new EvelOptionDouble();
-// temparature.DIMMThrmMrgn4 = new EvelOptionDouble();
-//
-// temparature.DIMMThrmMrgn3 = new EvelOptionDouble();
-// temparature.DIMMThrmMrgn2 = new EvelOptionDouble();
-// temparature.DIMMThrmMrgn1 = new EvelOptionDouble();
-// temparature.P2DTSThermMgn = new EvelOptionDouble();
-// temparature.P1DTSThermMgn = new EvelOptionDouble();
-// temparature.P2ThermCtrl = new EvelOptionDouble();
-// temparature.P1ThermCtrl = new EvelOptionDouble();
-// temparature.P2ThermMargin = new EvelOptionDouble();
-// temparature.P1ThermMargin = new EvelOptionDouble();
-// temparature.PS1Temperature = new EvelOptionDouble();
-// temparature.LANNICTemp = new EvelOptionDouble();
-// temparature.ExitAirTemp = new EvelOptionDouble();
-// temparature.HSBP1Temp = new EvelOptionDouble();
-// temparature.IOModTemp = new EvelOptionDouble();
-// temparature.BBLftRearTemp = new EvelOptionDouble();
-// temparature.BBRtRearTemp = new EvelOptionDouble();
-// temparature.BBBMCTemp = new EvelOptionDouble();
-// temparature.SSBTemp = new EvelOptionDouble();
-// temparature.FrontPanelTemp = new EvelOptionDouble();
-// temparature.BBP2VRTemp = new EvelOptionDouble();
-// temparature.BBP1VRTemp = new EvelOptionDouble();
-//
-//
-//
-// if( ipmi_temparature == null ){
-// ipmi_temparature = new ArrayList<MEASUREMENT_IPMI_TEMPARATURE>();
-// LOGGER.debug("Allocate percent_usage");
-// }
-//
-// ipmi_temparature.add(temparature);
-//
-// EVEL_EXIT();
-// return temparature;
-// }
-//
-//
-//
-// public MEASUREMENT_IPMI_FAN evel_measurement_new_fan_add(double usage)
-// {
-// EVEL_ENTER();
-//
-// /***************************************************************************/
-// /* Check assumptions. */
-// /***************************************************************************/
-// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
-// assert(usage >= 0.0);
-//
-// /***************************************************************************/
-// /* Allocate a container for the value and push onto the list. */
-// /***************************************************************************/
-// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
-// MEASUREMENT_IPMI_FAN fan = new MEASUREMENT_IPMI_FAN();
-// assert(fan != null);
-// fan.SystemFan6B = new EvelOptionDouble();
-// fan.SystemFan6A = new EvelOptionDouble();
-// fan.SystemFan5B = new EvelOptionDouble();
-// fan.SystemFan5A = new EvelOptionDouble();
-// fan.SystemFan4B = new EvelOptionDouble();
-// fan.SystemFan4A = new EvelOptionDouble();
-// fan.SystemFan3B = new EvelOptionDouble();
-// fan.SystemFan3A = new EvelOptionDouble();
-// fan.SystemFan2B = new EvelOptionDouble();
-// fan.SystemFa_2A = new EvelOptionDouble();
-// fan.SystemFan1B = new EvelOptionDouble();
-// fan.SystemFan1A = new EvelOptionDouble();
-//
-// if( ipmi_fan == null ){
-// ipmi_fan = new ArrayList<MEASUREMENT_IPMI_FAN>();
-// LOGGER.debug("Allocate percent_usage");
-// }
-//
-// ipmi_fan.add(fan);
-//
-// EVEL_EXIT();
-// return fan;
-// }
-//
-//
-// public MEASUREMENT_IPMI_CFM evel_measurement_new_cfm_add(double usage)
-// {
-// EVEL_ENTER();
-//
-// /***************************************************************************/
-// /* Check assumptions. */
-// /***************************************************************************/
-// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
-// assert(usage >= 0.0);
-//
-// /***************************************************************************/
-// /* Allocate a container for the value and push onto the list. */
-// /***************************************************************************/
-// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
-// MEASUREMENT_IPMI_CFM cfm = new MEASUREMENT_IPMI_CFM();
-// assert(cfm != null);
-// cfm.System_Airflow = new EvelOptionDouble();
-//
-//
-//
-//
-//
-// if( ipmi_cfm == null ){
-// ipmi_cfm = new ArrayList<MEASUREMENT_IPMI_CFM>();
-// LOGGER.debug("Allocate percent_usage");
-// }
-//
-// ipmi_cfm.add(cfm);
-//
-// EVEL_EXIT();
-// return cfm;
-// }
-//
-//
-// public MEASUREMENT_IPMI_WATTS evel_measurement_new_watts_add(double usage)
-// {
-// EVEL_ENTER();
-//
-// /***************************************************************************/
-// /* Check assumptions. */
-// /***************************************************************************/
-// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
-// assert(usage >= 0.0);
-//
-// /***************************************************************************/
-// /* Allocate a container for the value and push onto the list. */
-// /***************************************************************************/
-// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
-// MEASUREMENT_IPMI_WATTS watts = new MEASUREMENT_IPMI_WATTS();
-// assert(watts != null);
-// watts.PS1InputPower = new EvelOptionDouble();
-//
-//
-//
-//
-//
-// if( ipmi_watts == null ){
-// ipmi_watts = new ArrayList<MEASUREMENT_IPMI_WATTS>();
-// LOGGER.debug("Allocate percent_usage");
-// }
-//
-// ipmi_watts.add(watts);
-//
-// EVEL_EXIT();
-// return watts;
-// }
-
-
-// public MEASUREMENT_IPMI_VOLTAGE evel_measurement_new_voltage_add(double usage)
-// {
-// EVEL_ENTER();
-//
-// /***************************************************************************/
-// /* Check assumptions. */
-// /***************************************************************************/
-// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
-// assert(usage >= 0.0);
-//
-// /***************************************************************************/
-// /* Allocate a container for the value and push onto the list. */
-// /***************************************************************************/
-// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
-// MEASUREMENT_IPMI_VOLTAGE voltage = new MEASUREMENT_IPMI_VOLTAGE();
-// assert(voltage != null);
-// voltage.BB12_0v = new EvelOptionDouble();
-// voltage.BB3_3vVbat = new EvelOptionDouble();
-//
-//
-//
-//
-// if( ipmi_voltage == null ){
-// ipmi_voltage = new ArrayList<MEASUREMENT_IPMI_VOLTAGE>();
-// LOGGER.debug("Allocate percent_usage");
-// }
-//
-// ipmi_voltage.add(voltage);
-//
-// EVEL_EXIT();
-// return voltage;
-// }
-
-// public MEASUREMENT_IPMI_PERCENT_USAGE evel_measurement_new_percent_usage_add(double usage)
-// {
-// EVEL_ENTER();
-//
-// /***************************************************************************/
-// /* Check assumptions. */
-// /***************************************************************************/
-// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
-// assert(usage >= 0.0);
-//
-// /***************************************************************************/
-// /* Allocate a container for the value and push onto the list. */
-// /***************************************************************************/
-// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
-// MEASUREMENT_IPMI_PERCENT_USAGE percent_usage = new MEASUREMENT_IPMI_PERCENT_USAGE();
-// assert(percent_usage != null);
-// percent_usage.P1ThermCtrl = new EvelOptionDouble();
-// percent_usage.P2ThermCtrl = new EvelOptionDouble();
-// percent_usage.PS1CurrOut = new EvelOptionDouble();
-//
-//
-//
-// if( ipmi_percentage == null ){
-// ipmi_percentage = new ArrayList<MEASUREMENT_IPMI_PERCENT_USAGE>();
-// LOGGER.debug("Allocate percent_usage");
-// }
-//
-// ipmi_percentage.add(percent_usage);
-//
-// EVEL_EXIT();
-// return percent_usage;
-// }
-//
+
}
- public MEASUREMENT_IPMI evel_meas_ipmi_add(MEASUREMENT_IPMI ipmi)
- {
- EVEL_ENTER();
-
- /***************************************************************************/
- /* Check preconditions. */
- /***************************************************************************/
-
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(ipmi != null);
-
- if( ipmis == null ){
- ipmis = new ArrayList<MEASUREMENT_IPMI>();
- LOGGER.debug("Allocate new file system usage");
- }
-
-
- ipmis.add(ipmi);
-
- EVEL_EXIT();
-
- return ipmi;
- }
-
- public void evel_measurement_ipmi_exitAirTemperature_set(MEASUREMENT_IPMI ipmi,
- double val)
- {
- EVEL_ENTER();
- ipmi.exitAirTemperature.SetValuePr(val,"System fan exit air flow temperature in Celsius ");
- EVEL_EXIT();
- }
- public void evel_measurement_ipmi_frontPanelTemperature_set(MEASUREMENT_IPMI ipmi,
- double val)
- {
- EVEL_ENTER();
- ipmi.frontPanelTemperature.SetValuePr(val,"Front panel temp in Celsius");
- EVEL_EXIT();
- }
- public void evel_measurement_ipmi_ioModuleTemperature_set(MEASUREMENT_IPMI ipmi,
- double val)
- {
- EVEL_ENTER();
- ipmi.ioModuleTemperature.SetValuePr(val,"Io module temp in Celsius ");
- EVEL_EXIT();
- }
- public void evel_measurement_ipmi_systemAirflow_set(MEASUREMENT_IPMI ipmi,
- double val)
- {
- EVEL_ENTER();
- ipmi.systemAirflow.SetValuePr(val,"Airflow in cubic feet per minute (cfm)");
- EVEL_EXIT();
- }
+
+
@@ -1325,7 +1122,7 @@ public class EvelScalingMeasurement extends EvelHeader { ArrayList<MEASUREMENT_DISK_USE> disk_usage;
boolean errstat;
- MEASUREMENT_ERRORS myerrors;
+ // MEASUREMENT_ERRORS myerrors;
ArrayList<MEASUREMENT_FEATURE_USE> feature_usage;
ArrayList<MEASUREMENT_FSYS_USE> filesystem_usage;
ArrayList<MEASUREMENT_LATENCY_BUCKET> latency_distribution;
@@ -1463,13 +1260,7 @@ public class EvelScalingMeasurement extends EvelHeader { }
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();
}
@@ -1480,38 +1271,98 @@ public class EvelScalingMeasurement extends EvelHeader { public MEASUREMENT_IPMI evel_measurement_new_ipmis_add()
{
- EVEL_ENTER();
-
- /***************************************************************************/
- /* Check assumptions. */
- /***************************************************************************/
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
-
- /***************************************************************************/
- /* Allocate a container for the value and push onto the list. */
- /***************************************************************************/
- //LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", id, usage));
- MEASUREMENT_IPMI ipmi = new MEASUREMENT_IPMI();
- assert(ipmi != null);
- //cpu_use.id = id;
- //cpu_use.usage = usage;
- ipmi.exitAirTemperature = new EvelOptionDouble();
- ipmi.frontPanelTemperature = new EvelOptionDouble();
- ipmi.ioModuleTemperature = new EvelOptionDouble();
- ipmi.systemAirflow = new EvelOptionDouble();
-
-
- if( ipmis == null ){
- ipmis= new ArrayList<MEASUREMENT_IPMI>();
- LOGGER.debug("Allocate new ipmis");
- }
-
- ipmis.add(ipmi);
-
- EVEL_EXIT();
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ MEASUREMENT_IPMI ipmi = new MEASUREMENT_IPMI();
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmi != null);
+
+
+
+ assert(ipmi != null);
+ //cpu_use.id = id;
+ //cpu_use.usage = usage;
+ ipmi.exitAirTemperature = new EvelOptionDouble();
+ // ipmi.exitAirTemperature.SetValuePr(exitAirTemperature, "Exit Air Temperature");
+ ipmi.frontPanelTemperature = new EvelOptionDouble();
+ // ipmi.frontPanelTemperature.SetValuePr(frontPanelTemperature, "front Panel Temperature");
+ ipmi.ioModuleTemperature = new EvelOptionDouble();
+ // ipmi.ioModuleTemperature.SetValuePr(ioModuleTemperature, "IOModule Temperature");
+ ipmi.systemAirflow = new EvelOptionDouble();
+ // ipmi.systemAirflow.SetValuePr(systemAirflow, "System Airflow");
+ ipmi.ipmibaseboardTemperature = null;
+ ipmi.ipmiBaseboardvoltageResulator = null;
+ ipmi.ipmibattery = null;
+ ipmi.ipmiFan = null;
+ ipmi.ipmiglobalAggregateTemperatureMarginArray = null;
+ ipmi.ipmiHSBP = null;
+ ipmi.ipmiNIC = null;
+ ipmi.ipmipowerSupply = null;
+ ipmi.ipmiprocessor = null;
+
+
+ if( ipmis == null ){
+ ipmis = new ArrayList<MEASUREMENT_IPMI>();
+ LOGGER.debug("Allocate new file IPMI");
+ }
+
+
+ ipmis.add(ipmi);
+
+ EVEL_EXIT();
+
return ipmi;
}
+
+
+
+
+
+
+
+
+// public MEASUREMENT_IPMI evel_measurement_new_ipmis_add(double exitAirTemperature,double frontPanelTemperature,double ioModuleTemperature,double systemAirflow)
+// {
+// EVEL_ENTER();
+//
+// /***************************************************************************/
+// /* Check assumptions. */
+// /***************************************************************************/
+// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+//
+// /***************************************************************************/
+// /* Allocate a container for the value and push onto the list. */
+// /***************************************************************************/
+// //LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", id, usage));
+// MEASUREMENT_IPMI ipmi = new MEASUREMENT_IPMI();
+// assert(ipmi != null);
+// //cpu_use.id = id;
+// //cpu_use.usage = usage;
+// ipmi.exitAirTemperature = new EvelOptionDouble();
+// ipmi.exitAirTemperature.SetValuePr(exitAirTemperature, "Exit Air Temperature");
+// ipmi.frontPanelTemperature = new EvelOptionDouble();
+// ipmi.frontPanelTemperature.SetValuePr(frontPanelTemperature, "front Panel Temperature");
+// ipmi.ioModuleTemperature = new EvelOptionDouble();
+// ipmi.ioModuleTemperature.SetValuePr(ioModuleTemperature, "IOModule Temperature");
+// ipmi.systemAirflow = new EvelOptionDouble();
+// ipmi.systemAirflow.SetValuePr(systemAirflow, "System Airflow");
+//
+//
+// if( ipmis == null ){
+// ipmis= new ArrayList<MEASUREMENT_IPMI>();
+// LOGGER.debug("Allocate new ipmis");
+// }
+//
+// ipmis.add(ipmi);
+//
+// EVEL_EXIT();
+// return ipmi;
+// }
+
/*
@@ -1577,66 +1428,6 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
}
- /**************************************************************************//**
- * Add an additional set of myerrors to the Measurement.
- *
- * @note The property is treated as immutable: it is only valid to call
- * the setter once. However, we don't assert if the caller tries to
- * overwrite, just ignoring the update instead.
- *
- * @param measurement Pointer to the measurement.
- * @param receive_discard The number of receive discards.
- * @param receive_error The number of receive myerrors.
- * @param transmit_discard The number of transmit discards.
- * @param transmit_error The number of transmit myerrors.
- *****************************************************************************/
- public void evel_measurement_myerrors_set(
- int receive_discard,
- int receive_error,
- int transmit_discard,
- int transmit_error)
- {
-
- EVEL_ENTER();
-
- /***************************************************************************/
- /* Check preconditions. */
- /***************************************************************************/
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(receive_discard >= 0);
- assert(receive_error >= 0);
- assert(transmit_discard >= 0);
- assert(transmit_error >= 0);
-
- if (errstat == false)
- {
- errstat = true;
- LOGGER.debug(MessageFormat.format("Adding myerrors: {0}, {1}, {2}, {3}",
- receive_discard,
- receive_error,
- transmit_discard,
- transmit_error));
- if( myerrors == null )myerrors = new MEASUREMENT_ERRORS();
- myerrors.receive_discards = receive_discard;
- myerrors.receive_myerrors = receive_error;
- myerrors.transmit_discards = transmit_discard;
- myerrors.transmit_myerrors = transmit_error;
- }
- else
- {
- LOGGER.debug(MessageFormat.format("Adding myerrors: {0}, {1}; {2}, {3} myerrors already set: {4}, {5}; {6}, {7}",
- receive_discard,
- receive_error,
- transmit_discard,
- transmit_error,
- myerrors.receive_discards,
- myerrors.receive_myerrors,
- myerrors.transmit_discards,
- myerrors.transmit_myerrors));
- }
-
- EVEL_EXIT();
- }
/**************************************************************************//**
* Set the Mean Request Latency property of the Measurement.
@@ -2122,28 +1913,7 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
return huge_page;
}
-
-
- /**************************************************************************//**
- * Set Number of free hugepages in bytes
- * @note The property is treated as immutable: it is only valid to call
- * the setter once. However, we don't assert if the caller tries to
- * overwrite, just ignoring the update instead.
- *
- * @param cpu_use Pointer to the CPU Use.
- * @param string double
- *****************************************************************************/
-
-
-// public void evel_measurement_huge_page_hugePagesIdentifier_set(MEASUREMENT_HUGE_PAGE huge_page,
-// String string)
-// {
-// EVEL_ENTER();
-// huge_page.SetValuePr(string,"CPU hugePagesIdentifier");
-// EVEL_EXIT();
-//
-//
-// }
+
/**************************************************************************//**
* Set Number of free hugepages in percent
* @note The property is treated as immutable: it is only valid to call
@@ -2631,14 +2401,13 @@ public class EvelScalingMeasurement extends EvelHeader { mem_use.memorySwapOutRateAvg= new EvelOptionDouble();
mem_use.memorySwapUsedAvg= new EvelOptionDouble();
- assert(mem_use.id != null);
+ // assert(mem_use.id != null);
if( mem_usage == null ){
mem_usage = new ArrayList<MEASUREMENT_MEM_USE>();
LOGGER.debug("Allocated new memory usage");
}
-
mem_usage.add(mem_use);
EVEL_EXIT();
@@ -4461,19 +4230,20 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check preconditions. */
/***************************************************************************/
assert(vnic_id != null);
- assert(val_suspect.equals("true") || val_suspect.equals("false"));
+ // assert(val_suspect.equals("true") || val_suspect.equals("false"));
+
/***************************************************************************/
/* Allocate, then set Mandatory Parameters. */
/***************************************************************************/
-
+
vnic_perf = new MEASUREMENT_NIC_PERFORMANCE();
assert(vnic_perf != null);
vnic_perf.vnic_id = vnic_id;
vnic_perf.valuesaresuspect = val_suspect;
//VES6.0 added field 14July
- //vnic_perf.nicIdentifier = nicIdentifier;
+ //vnic_perf.nicIdentifier = vnic_id;
vnic_perf.recvd_bcast_packets_acc= new EvelOptionDouble();
vnic_perf.recvd_bcast_packets_delta= new EvelOptionDouble();
@@ -4506,23 +4276,28 @@ public class EvelScalingMeasurement extends EvelHeader { vnic_perf.tx_ucast_packets_delta= new EvelOptionDouble();
- vnic_perf.administrativeState= new EvelOptionDouble();
- vnic_perf.operationalState= new EvelOptionDouble();
+ vnic_perf.administrativeState= new EvelOptionString();
+ vnic_perf.operationalState= new EvelOptionString();
vnic_perf.receivedPercentDiscard= new EvelOptionDouble();
vnic_perf.receivedPercentError= new EvelOptionDouble();
vnic_perf.receivedUtilization= new EvelOptionDouble();
- vnic_perf.speed= new EvelOptionString();
+ vnic_perf.speed= new EvelOptionDouble();
vnic_perf.transmittedPercentDiscard= new EvelOptionDouble();
vnic_perf.transmittedPercentError= new EvelOptionDouble();
vnic_perf.transmittedUtilization= new EvelOptionDouble();
+
+ //assert(vnic_perf.vnic_id != null);
+ if( vnic_usage == null ){
+ vnic_usage = new ArrayList<MEASUREMENT_NIC_PERFORMANCE>();
+ LOGGER.debug("Allocated new Vnic Perfomence");
+ }
+
+
+ vnic_usage.add(vnic_perf);
- LOGGER.debug("Adding "+vnic_perf+"VNIC ID="+ vnic_perf.vnic_id+"Value="+vnic_perf.valuesaresuspect);
- /***************************************************************************/
- /* Initialize Optional Parameters. */
- /***************************************************************************/
EVEL_EXIT();
return vnic_perf;
@@ -5323,14 +5098,14 @@ public class EvelScalingMeasurement extends EvelHeader { */
public void evel_vnic_performance_administrativeState_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
- double administrativeState)
+ String administrativeState)
{
EVEL_ENTER();
/***************************************************************************/
/* Check preconditions. */
/***************************************************************************/
- assert(administrativeState >= 0.0);
+ assert(administrativeState != null);
vnic_performance.administrativeState.SetValuePr(
administrativeState,"Administrative State");
@@ -5341,14 +5116,14 @@ public class EvelScalingMeasurement extends EvelHeader { public void evel_vnic_performance_operationalState_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
- double operationalState)
+ String operationalState)
{
EVEL_ENTER();
/***************************************************************************/
/* Check preconditions. */
/***************************************************************************/
- assert(operationalState >= 0.0);
+ assert(operationalState != null);
vnic_performance.operationalState.SetValuePr(
operationalState,"operational State");
@@ -5405,17 +5180,17 @@ public class EvelScalingMeasurement extends EvelHeader { }
public void evel_vnic_performance_speed_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
- String speed)
+ double speed)
{
EVEL_ENTER();
/***************************************************************************/
/* Check preconditions. */
/***************************************************************************/
- assert(speed != null);
+ assert(speed >= 0.0);
- vnic_performance.speed.SetValuePr(
- speed,"Speed");
+ vnic_performance.speed.SetValuePr(speed, "Speed");
+
EVEL_EXIT();
}
@@ -5496,6 +5271,7 @@ public class EvelScalingMeasurement extends EvelHeader { }
vnic_usage.add(vnic_performance);
+
EVEL_EXIT();
}
@@ -5545,7 +5321,7 @@ public class EvelScalingMeasurement extends EvelHeader { String valset,
//VES6.0 added field 14July
//String nicIdentifier,
- String speed,
+ double speed,
double recvd_bcast_packets_acc,
double recvd_bcast_packets_delta,
double recvd_discarded_packets_acc,
@@ -5575,8 +5351,8 @@ public class EvelScalingMeasurement extends EvelHeader { double tx_ucast_packets_acc,
double tx_ucast_packets_delta,
//VES6.0 addded fileds 19July
- double administrativeState,
- double operationalState,
+ String administrativeState,
+ String operationalState,
double receivedPercentDiscard,
double receivedPercentError,
double receivedUtilization,
@@ -5714,10 +5490,6 @@ public class EvelScalingMeasurement extends EvelHeader { IPMIbaseboardTemperature ipmiBaseBoardTempJson;
IPMIbaseboardvoltageResulator ipmiBaseboardVoltageResultatorJson;
IPMIfan ipmifanjson;
- //DLIST_ITEM item = null;
- //DLIST_ITEM nested_item = null;
- //DLIST_ITEM addl_info_item = null;
- //OTHER_FIELD addl_info = null;
// double version = major_version+(double)minor_version/10;
String version = "4.0";
EVEL_ENTER();
@@ -5736,20 +5508,6 @@ public class EvelScalingMeasurement extends EvelHeader { /***************************************************************************/
/* Optional fields. */
/***************************************************************************/
- // additional fields
-// if( additional_info != null )
-// {
-// JsonArrayBuilder builder = Json.createArrayBuilder();
-// for(int i=0;i<additional_info.size();i++) {
-// String[] addl_info = additional_info.get(i);
-// JsonObject obj = Json.createObjectBuilder()
-// .add("name", addl_info[0])
-// .add("value", addl_info[1]).build();
-// builder.add(obj);
-// }
-// evelmeasmt.add("additionalFields", builder);
-// }
-
if(additional_inf != null) {
JsonObjectBuilder builder = Json.createObjectBuilder();
@@ -5759,9 +5517,6 @@ public class EvelScalingMeasurement extends EvelHeader { Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
String addl_info_key = add_inf.getKey();
String addl_info_value = add_inf.getValue();
-// JsonObject obj1 = Json.createObjectBuilder()
-// .add("name", addl_info_key)
-// .add("value", addl_info_value).build();
builder.add(addl_info_key, addl_info_value);
}
evelmeasmt.add("additionalFields", builder);
@@ -5856,17 +5611,6 @@ public class EvelScalingMeasurement extends EvelHeader { obj.add( "percentUsed", hugePage.percentUsed.value);
obj.add( "percentFree", hugePage.percentFree.value);
-// obj.add( "bytesFree", hugePage.bytesFree);
-// obj.add( "vmPageNumberUsed", hugePage.vmPageNumberUsed);
-// obj.add( "vmPageNumberFree", hugePage.vmPageNumberFree);
-// obj.add( "percentUsed", hugePage.percentUsed);
-// obj.add( "percentFree", hugePage.percentFree);
-
-
-// hugePage.correctedMemoryErrors.encJsonValue(obj, "correctedMemoryErrors");
-// hugePage.correctedMemoryErrors_In1Hr.encJsonValue(obj, "correctedMemoryErrorsIn1Hr");
-// hugePage.uncorrectedMemoryErrors.encJsonValue(obj, "uncorrectedMemoryErrors");
-// hugePage.uncorrectedMemoryErrors_In1Hr.encJsonValue(obj, "uncorrectedMemoryErrorsIn1Hr");
builder.add(obj.build());
@@ -5912,23 +5656,36 @@ public class EvelScalingMeasurement extends EvelHeader { if(ipmis != null && ipmis.size() > 0) {
JsonObjectBuilder builder1 = Json.createObjectBuilder();
JsonArrayBuilder builder = Json.createArrayBuilder();
- System.out.println("ipmis size---"+ ipmis.size());
+
for(int i=0;i<ipmis.size();i++) {
ipmij = ipmis.get(i);
// JsonObjectBuilder obj= null;
- JsonObjectBuilder obj = Json.createObjectBuilder();
+
+ builder1.add("exitAirTemperature", ipmij.exitAirTemperature.GetValue().doubleValue());
+ builder1.add("frontPanelTemperature", ipmij.frontPanelTemperature.GetValue().doubleValue());
+ builder1.add("ioModuleTemperature", ipmij.ioModuleTemperature.GetValue().doubleValue());
+ builder1.add("systemAirflow", ipmij.systemAirflow.GetValue().doubleValue());
+
+
+
+ /*JsonObjectBuilder obj = Json.createObjectBuilder();
ipmij.exitAirTemperature.encJsonValue(obj, "exitAirTemperature");
ipmij.frontPanelTemperature.encJsonValue(obj, "frontPanelTemperature");
ipmij.ioModuleTemperature.encJsonValue(obj, "ioModuleTemperature");
- ipmij.systemAirflow.encJsonValue(obj, "systemAirflow");
+ ipmij.systemAirflow.encJsonValue(obj, "systemAirflow"); */
+
+
+
+
+
if(ipmij.ipmiprocessor != null && ipmij.ipmiprocessor.size() > 0 ) {
JsonArrayBuilder ipmi_processor_builder = Json.createArrayBuilder();
for(int j=0; j<ipmij.ipmiprocessor.size();j++) {
ipmiProcessorJson = ipmij.ipmiprocessor.get(j);
JsonObjectBuilder obj1 = Json.createObjectBuilder().add("processorIdentifier", ipmiProcessorJson.processorIdentifier);
- ipmiProcessorJson.processorDTSthermalMargin.encJsonValue(obj1 , "processorDTSthermalMargin");
+ ipmiProcessorJson.processorDtsThermalMargin.encJsonValue(obj1 , "processorDtsThermalMargin");
ipmiProcessorJson.processorThermalControlPercent.encJsonValue(obj1, "processorThermalControlPercent");
if(ipmiProcessorJson.processorDIMMaggregateThermalMargin != null &&
ipmiProcessorJson.processorDIMMaggregateThermalMargin.size() > 0) {
@@ -5936,12 +5693,12 @@ public class EvelScalingMeasurement extends EvelHeader { for( int k=0 ;k<ipmiProcessorJson.processorDIMMaggregateThermalMargin.size();k++) {
ipmiProcessorDIMMagregatejson = ipmiProcessorJson.processorDIMMaggregateThermalMargin.get(k);
- JsonObjectBuilder obj2 = Json.createObjectBuilder().add("processorDIMMaggregateThermalMarginIdentifier", ipmiProcessorDIMMagregatejson.processorDIMMaggregateThermalMarginIdentifier)
- .add("processorDIMMaggregateThermalMargin", ipmiProcessorDIMMagregatejson.processorDIMMaggregateThermalMargin);
+ JsonObjectBuilder obj2 = Json.createObjectBuilder().add("processorDimmAggregateThermalMarginIdentifier", ipmiProcessorDIMMagregatejson.processorDIMMaggregateThermalMarginIdentifier)
+ .add("thermalMargin", ipmiProcessorDIMMagregatejson.thermalMargin);
ipmi_procesor_DTS_thermal_margin.add(obj2.build());
}
- obj1.add("processorDIMMaggregateThermalMargin", ipmi_procesor_DTS_thermal_margin );
+ obj1.add("processorDimmAggregateThermalMarginArray", ipmi_procesor_DTS_thermal_margin );
}
@@ -5960,13 +5717,13 @@ public class EvelScalingMeasurement extends EvelHeader { for(int j=0; j<ipmij.ipmiglobalAggregateTemperatureMarginArray.size();j++) {
ipmiGlobalAggTempMarginJson = ipmij.ipmiglobalAggregateTemperatureMarginArray.get(j);
JsonObjectBuilder obj1 = Json.createObjectBuilder().add("globalAggregateTemperatureMarginIdentifier", ipmiGlobalAggTempMarginJson.globalAggregateTemperatureMarginIdentifier);
- ipmiGlobalAggTempMarginJson.globalAggregateTemeratureMargin.encJsonValue(obj1, "globalAggregateTemeratureMargin");
+ ipmiGlobalAggTempMarginJson.globalAggregateTemeratureMargin.encJsonValue(obj1, "globalAggregateTemperatureMargin");
ipmi_global_aggregate_tepmerature_margin_array.add(obj1.build());
}
// obj.add("globalAggregateTemperatureMarginArray", ipmi_global_aggregate_tepmerature_margin_array );
- builder1.add("globalAggregateTemperatureMarginArray", ipmi_global_aggregate_tepmerature_margin_array);
+ builder1.add("ipmiGlobalAggregateTemperatureMarginArray", ipmi_global_aggregate_tepmerature_margin_array);
}
@@ -5978,7 +5735,7 @@ public class EvelScalingMeasurement extends EvelHeader { for(int j=0; j<ipmij.ipmipowerSupply.size();j++) {
ipmiPowerSupplyJson = ipmij.ipmipowerSupply.get(j);
JsonObjectBuilder obj1 = Json.createObjectBuilder().add("powerSupplyIdentifier", ipmiPowerSupplyJson.powerSupplyIdentifier);
- ipmiPowerSupplyJson.powerSupplycurrentOutputPercent.encJsonValue(obj1, "powerSupplycurrentOutputPercent");
+ ipmiPowerSupplyJson.powerSupplycurrentOutputPercent.encJsonValue(obj1, "powerSupplyCurrentOutputPercent");
ipmiPowerSupplyJson.powerSupplyInputPower.encJsonValue(obj1, "powerSupplyInputPower");
ipmiPowerSupplyJson.powerSupplyTemperature.encJsonValue(obj1, "powerSupplyTemperature");
@@ -6014,8 +5771,9 @@ public class EvelScalingMeasurement extends EvelHeader { JsonArrayBuilder ipmi_Nic_array = Json.createArrayBuilder();
for(int j=0; j<ipmij.ipmiNIC.size();j++) {
ipmiNicJson = ipmij.ipmiNIC.get(j);
- JsonObjectBuilder obj1 = Json.createObjectBuilder().add("nicIdentifier", ipmiNicJson.nic_Identifier);
- ipmiNicJson.nic_Temperature.encJsonValue(obj1, "nicIdentifier");
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("nicIdentifier", ipmiNicJson.nicIdentifier);
+ ipmiNicJson.nicTemperature.encJsonValue(obj1, "nicTemperature");
+
@@ -6070,7 +5828,7 @@ public class EvelScalingMeasurement extends EvelHeader { ipmiBaseboardVoltageResultatorJson = ipmij.ipmiBaseboardvoltageResulator.get(j);
JsonObjectBuilder obj1 = Json.createObjectBuilder().add("baseboardVoltageRegulatorIdentifier",
ipmiBaseboardVoltageResultatorJson.baseboardVoltageRegulatorIdentifier);
- ipmiBaseboardVoltageResultatorJson.voltageRegulatorTemperature.encJsonValue(obj1, "baseboardTemperature");
+ ipmiBaseboardVoltageResultatorJson.voltageRegulatorTemperature.encJsonValue(obj1, "voltageRegulatorTemperature");
@@ -6106,9 +5864,10 @@ public class EvelScalingMeasurement extends EvelHeader { - builder.add(obj.build());
+ //builder.add(obj.build());
}
//evelmeasmt.add("ipmi", builder) ;
+
evelmeasmt.add("ipmi", builder1) ;
}
@@ -6283,7 +6042,7 @@ public class EvelScalingMeasurement extends EvelHeader { nic_use.tx_ucast_packets_delta.encJsonValue(obj,"transmittedUnicastPacketsDelta");
//VES6.0 added fields 19July
- nic_use.administrativeState.encJsonValue(obj, "administrativeState");
+ // nic_use.administrativeState.encJsonValue(obj, "administrativeState");
nic_use.administrativeState.encJsonValue(obj, "administrativeState");
nic_use.operationalState.encJsonValue(obj, "operationalState");
nic_use.receivedPercentDiscard.encJsonValue(obj, "receivedPercentDiscard");
@@ -6315,14 +6074,27 @@ public class EvelScalingMeasurement extends EvelHeader { JsonObjectBuilder obj = Json.createObjectBuilder()
// .add( "memIdentifier", mem_use.id)
.add( "vmIdentifier", mem_use.vmid)
- .add( "percentMemoryUsage",mem_use.membuffsz);
+ .add( "memoryBuffered",mem_use.membuffsz);
mem_use.memcache.encJsonValue(obj,"memoryCached");
mem_use.memconfig.encJsonValue(obj,"memoryConfigured");
mem_use.memfree.encJsonValue(obj,"memoryFree");
mem_use.slabrecl.encJsonValue(obj,"memorySlabRecl");
mem_use.slabunrecl.encJsonValue(obj,"memorySlabUnrecl");
- mem_use.memused.encJsonValue(obj,"memoryUsed");
+ mem_use.memused.encJsonValue(obj,"memoryUsed");
+
+ mem_use.memoryDemand.encJsonValue(obj,"memoryDemand");
+ mem_use.memoryLatencyAvg.encJsonValue(obj,"memoryLatencyAvg");
+
+ mem_use.memoryLatencyAvg.encJsonValue(obj,"memoryLatencyAvg");
+ mem_use.memorySharedAvg.encJsonValue(obj,"memorySharedAvg");
+ mem_use.memorySwapInAvg.encJsonValue(obj,"memorySwapInAvg");
+ mem_use.memorySwapInRateAvg.encJsonValue(obj,"memorySwapInRateAvg");
+
+ mem_use.memorySwapOutAvg.encJsonValue(obj,"memorySwapOutAvg");
+ mem_use.memorySwapOutRateAvg.encJsonValue(obj,"memorySwapOutRateAvg");
+ mem_use.memorySwapUsedAvg.encJsonValue(obj,"memorySwapUsedAvg");
+
builder.add(obj.build());
}
@@ -6334,17 +6106,6 @@ public class EvelScalingMeasurement extends EvelHeader { /***************************************************************************/
- /* myerrors list. */
- /***************************************************************************/
- // if (errstat == true && myerrors != null)
- // {
- // evelmeasmt.add("receiveDiscards", myerrors.receive_discards);
- // evelmeasmt.add("receivemyerrors", myerrors.receive_myerrors);
- // evelmeasmt.add("transmitDiscards", myerrors.transmit_discards);
- // evelmeasmt.add("transmitmyerrors", myerrors.transmit_myerrors);
- // }
-
- /***************************************************************************/
/* Feature Utilization list. */
/***************************************************************************/
if( feature_usage != null && feature_usage.size() > 0 )
@@ -6353,10 +6114,6 @@ public class EvelScalingMeasurement extends EvelHeader { // JsonArrayBuilder builder = Json.createArrayBuilder();
for(int i=0;i<feature_usage.size();i++) {
feature_use = feature_usage.get(i);
-// JsonObjectBuilder obj = Json.createObjectBuilder()
-// .add( "featureIdentifier", feature_use.feature_id)
-// .add( "featureUtilization", feature_use.feature_utilization);
-
builder.add(feature_use.feature_id, feature_use.feature_utilization+"");
}
evelmeasmt.add("featureUsageArray", builder);
@@ -6396,9 +6153,6 @@ public class EvelScalingMeasurement extends EvelHeader { for(int j=0;j<meas_group.measurements.size();j++) {
custom_meas = meas_group.measurements.get(j);
-// JsonObjectBuilder obj2 = Json.createObjectBuilder()
-// .add("name",custom_meas.name)
-// .add("value",custom_meas.value);
builder2.add(custom_meas.name, custom_meas.value);
}
obj.add("hashMap", builder2);
@@ -6442,7 +6196,7 @@ public class EvelScalingMeasurement extends EvelHeader { {
EVEL_ENTER();
- assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
//encode common event header and measurement body
JsonObject obj = Json.createObjectBuilder()
.add("event", Json.createObjectBuilder()
@@ -6455,6 +6209,24 @@ public class EvelScalingMeasurement extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ //encode common event header and measurement body
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "measurementFields",evelScalingMeasurementObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
\ No newline at end of file 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 f720a36..d2d9fc1 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 @@ -40,6 +40,7 @@ public class EvelSipSignaling extends EvelHeader { int major_version = 1;
int minor_version = 0;
+
/**************************************************************************//**
* Vendor VNF Name fields.
* JSON equivalent field: vendorVnfNameFields
@@ -555,5 +556,21 @@ public class EvelSipSignaling extends EvelHeader { }
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ //encode commonheader and sip signaling body fields
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "sipSignalingFields",evelSipSignalingObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+ }
}
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 90df4d6..25ffef5 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 @@ -92,8 +92,8 @@ public class EvelStateChange extends EvelHeader { {
super(evname,evid);
event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE;
- assert(EVEL_ENTITY_STATE.EVEL_MAX_ENTITY_STATES.compareTo(newstate) < 0 );
- assert(EVEL_ENTITY_STATE.EVEL_MAX_ENTITY_STATES.compareTo(oldstate) < 0 );
+ assert(EVEL_ENTITY_STATE.EVEL_MAX_ENTITY_STATES.compareTo(newstate) >= 0 );
+ assert(EVEL_ENTITY_STATE.EVEL_MAX_ENTITY_STATES.compareTo(oldstate) >= 0 );
assert( interfce != null);
new_state = newstate;
@@ -276,6 +276,24 @@ public class EvelStateChange extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ //encode header and state change fields
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "stateChangeFields",evelStateChangeObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
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 a1bd94b..847e7a0 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 @@ -38,6 +38,7 @@ import org.apache.log4j.Logger; import org.slf4j.helpers.MessageFormatter;
import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES;
+import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES;
public class EvelSyslog extends EvelHeader {
@@ -45,6 +46,7 @@ public class EvelSyslog extends EvelHeader { int major_version = 3;
int minor_version = 0;
+
/**************************************************************************//**
* Alert types.
* JSON equivalent fields: newState, oldState
@@ -106,6 +108,8 @@ public class EvelSyslog extends EvelHeader { EvelOptionInt syslog_ver;
EvelOptionString syslogmsg_host;
+ EvelOptionString syslogTs;
+
HashMap<String, String > additional_inf;
@@ -121,15 +125,15 @@ public class EvelSyslog extends EvelHeader { *
*****************************************************************************/
public EvelSyslog(String evname, String evid,
- EvelFault.EVEL_SOURCE_TYPES evt_source_type,
+ EvelFault.EVEL_SOURCE_TYPES evt_source_type,
String syslg_msg,
String syslg_tag)
{
super(evname,evid);
event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG;
- assert(EvelFault.EVEL_SOURCE_TYPES.EVEL_MAX_SOURCE_TYPES.compareTo(event_source_type) < 0);
- assert(syslog_msg != null);
- assert(syslog_tag != null);
+ assert(EvelFault.EVEL_SOURCE_TYPES.EVEL_MAX_SOURCE_TYPES.compareTo(evt_source_type) >= 0);
+ assert(syslg_msg != null);
+ assert(syslg_tag != null);
event_source_type = evt_source_type;
syslog_msg = syslg_msg;
@@ -147,6 +151,9 @@ public class EvelSyslog extends EvelHeader { syslogmsg_host = new EvelOptionString();
+ syslogTs = new EvelOptionString();
+
+
additional_inf =null;
}
@@ -464,8 +471,32 @@ public class EvelSyslog extends EvelHeader { EVEL_EXIT();
}
-
+ /**************************************************************************//**
+ * Set the Structured SDID property of the SyslogTs.
+ *
+ * @note The property is treated as immutable: it is only valid to call
+ * the setter once. However, we don't assert if the caller tries to
+ * overwrite, just ignoring the update instead.
+ *
+ *
+ * @param sdid The Structured Data to be set. ASCIIZ string. name@number
+ * Caller does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_syslogTs_set(String syslogT)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(syslogT != null);
+ syslogTs.SetValuePr(syslogT, "SyslogTs");
+ EVEL_EXIT();
+ }
+
/**************************************************************************//**
* Set the Structured SDID property of the Syslog.
*
@@ -526,6 +557,9 @@ public class EvelSyslog extends EvelHeader { }
EVEL_EXIT();
}
+
+
+
/**************************************************************************//**
@@ -545,7 +579,7 @@ public class EvelSyslog extends EvelHeader { /* Mandatory fields */
/***************************************************************************/
JsonObjectBuilder obj = Json.createObjectBuilder()
- .add("eventSourceType", event_source_type.toString())
+ .add("eventSourceType", EvelFault.evel_source_type(event_source_type))
.add("syslogMsg", syslog_msg)
.add("syslogTag", syslog_tag)
.add("syslogFieldsVersion",version);
@@ -564,6 +598,8 @@ public class EvelSyslog extends EvelHeader { syslog_ver.encJsonValue(obj, "syslogVer");
syslogmsg_host.encJsonValue(obj, "syslogMsgHost");
+ syslogTs.encJsonValue(obj, "syslogTs");
+
if(additional_inf != null) {
//JsonArrayBuilder builder = Json.createArrayBuilder();
@@ -608,6 +644,24 @@ public class EvelSyslog extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "syslogFields",evelSyslogObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
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 11a6f83..128d8be 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 @@ -725,6 +725,24 @@ public class EvelThresholdCross extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "thresholdCrossingAlertFields",evelThresholdCrossingObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
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 c95dbc8..d33abce 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 @@ -42,6 +42,7 @@ public class EvelVoiceQuality extends EvelHeader { int major_version = 1;
int minor_version = 0;
+
/**************************************************************************//**
* Vendor VNF Name fields.
* JSON equivalent field: vendorVnfNameFields
@@ -521,7 +522,7 @@ public class EvelVoiceQuality extends EvelHeader { /***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
assert(adjacencyName != null);
- assert(mosCqe >= 1 && mosCqe <= 5);
+ assert(mosCqe >= 0 && mosCqe <= 5);
assert(rFactor >= 0 && rFactor <= 100);
assert(endpointDescr != null && (endpointDescr.equals("Caller")||endpointDescr.equals("Callee")) );
@@ -580,6 +581,9 @@ public class EvelVoiceQuality extends EvelHeader { vQMetrices.endpointRtpPacketsLost.SetValuePr(endpointRtpPacketsLost,"End point Rtp Packets Lost");
vQMetrices.localAverageJitter.SetValuePr(localAverageJitter,"Local Average Jitter");
vQMetrices.localMaxJitter.SetValuePr(localMaxJitter, "Local Max Jitter");
+
+ vQMetrices.localAverageJitterBufferDelay.SetValuePr(localAverageJitterBufferDelay, "local Average Jitter Buffer Delay");
+
vQMetrices.localMaxJitterBufferDelay.SetValuePr(localMaxJitterBufferDelay, "Local Max Jitter Buffer Delay");
vQMetrices.localRtpOctetsLost.SetValuePr(localRtpOctetsLost, "Local RtpOctets Lost");
vQMetrices.localRtpPacketsLost.SetValuePr(localRtpPacketsLost, "Local RtpPackets Lost");
@@ -678,14 +682,14 @@ public class EvelVoiceQuality extends EvelHeader { .add("adjacencyName", vQMetrics.adjacencyName)
.add("endpointDescription", vQMetrics.endpointDescription);
- vQMetrics.endpointJitter.encJsonValue(obj,"endpointJitter");
+ // vQMetrics.endpointJitter.encJsonValue(obj,"endpointJitter");
vQMetrics.endpointRtpOctetsDiscarded.encJsonValue(obj,"endpointRtpOctetsDiscarded");
vQMetrics.endpointRtpOctetsReceived.encJsonValue(obj,"endpointRtpOctetsReceived");
vQMetrics.endpointRtpOctetsSent.encJsonValue(obj,"endpointRtpOctetsSent");
vQMetrics.endpointRtpPacketsDiscarded.encJsonValue(obj,"endpointRtpPacketsDiscarded");
vQMetrics.endpointRtpPacketsReceived.encJsonValue(obj,"endpointRtpPacketsReceived");
vQMetrics.endpointRtpPacketsSent.encJsonValue(obj,"endpointRtpPacketsSent");
- vQMetrics.localJitter.encJsonValue(obj,"localJitter");
+ // vQMetrics.localJitter.encJsonValue(obj,"localJitter");
vQMetrics.localRtpOctetsDiscarded.encJsonValue(obj,"localRtpOctetsDiscarded");
vQMetrics.localRtpOctetsReceived.encJsonValue(obj,"localRtpOctetsReceived");
vQMetrics.localRtpOctetsSent.encJsonValue(obj,"localRtpOctetsSent");
@@ -693,7 +697,7 @@ public class EvelVoiceQuality extends EvelHeader { vQMetrics.localRtpPacketsReceived.encJsonValue(obj,"localRtpPacketsReceived");
vQMetrics.localRtpPacketsSent.encJsonValue(obj,"localRtpPacketsSent");
vQMetrics.mosCqe.encJsonValue(obj,"mosCqe");
- vQMetrics.packetsLost.encJsonValue(obj,"packetsLost");
+ // vQMetrics.packetsLost.encJsonValue(obj,"packetsLost");
vQMetrics.packetLossPercent.encJsonValue(obj,"packetLossPercent");
vQMetrics.rFactor.encJsonValue(obj,"rFactor");
vQMetrics.roundTripDelay.encJsonValue(obj,"roundTripDelay");
@@ -707,8 +711,8 @@ public class EvelVoiceQuality extends EvelHeader { vQMetrics.endpointRtpOctetsLost.encJsonValue(obj, "endpointRtpOctetsLost");
vQMetrics.endpointRtpPacketsLost.encJsonValue(obj, "endpointRtpPacketsLost");
vQMetrics.localAverageJitter.encJsonValue(obj, "localAverageJitter");
- vQMetrics.localMaxJitter.encJsonValue(obj, "endpointRtpOctetsLost");
- System.out.println("local aveg jitter buffer delay...");
+ vQMetrics.localMaxJitter.encJsonValue(obj, "localMaxJitter");
+
vQMetrics.localAverageJitterBufferDelay.encJsonValue(obj, "localAverageJitterBufferDelay");
vQMetrics.localMaxJitterBufferDelay.encJsonValue(obj, "localMaxJitterBufferDelay");
@@ -719,8 +723,7 @@ public class EvelVoiceQuality extends EvelHeader { evelvq.add("endOfCallVqmSummaries", obj);
- System.out.println("local aveg jitter buffer delay...2"+ obj);
- System.out.println("local aveg jitter buffer delay..."+ evelvq);
+
}
@@ -755,6 +758,24 @@ public class EvelVoiceQuality extends EvelHeader { return obj;
}
+
+ JsonObject evel_json_encode_event_batch()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+
+ JsonObject obj = Json.createObjectBuilder()
+ // .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "voiceQualityFields",evelVoiceQualityObject() )
+ .build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/DeviceData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/DeviceData.java new file mode 100644 index 0000000..94f9c4e --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/DeviceData.java @@ -0,0 +1,118 @@ +package evel_javalibrary.att.com.loadbalance; +/**************************************************************************//** + * @file + * Measurement class + * + * This file implements the Measurement Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send CPU, Memory, Disk Measurements to Collector. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +import java.io.Serializable; + +public class DeviceData implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + private String t0bytesIn; + private String t0bytesOut; + private String t0packetIn; + private String t0packetOut; + + private String t1Bytesin; + private String t1Bytesout; + private String t1Packetsin; + private String t1Packetsout; + + private String Instanceres02Command; + + public String getT0bytesIn() { + return t0bytesIn; + } + + public void setT0bytesIn(String t0bytesIn) { + this.t0bytesIn = t0bytesIn; + } + + public String getT0bytesOut() { + return t0bytesOut; + } + + public void setT0bytesOut(String t0bytesOut) { + this.t0bytesOut = t0bytesOut; + } + + public String getT0packetIn() { + return t0packetIn; + } + + public void setT0packetIn(String t0packetIn) { + this.t0packetIn = t0packetIn; + } + + public String getT0packetOut() { + return t0packetOut; + } + + public void setT0packetOut(String t0packetOut) { + this.t0packetOut = t0packetOut; + } + + public String getT1Bytesin() { + return t1Bytesin; + } + + public void setT1Bytesin(String t1Bytesin) { + this.t1Bytesin = t1Bytesin; + } + + public String getT1Bytesout() { + return t1Bytesout; + } + + public void setT1Bytesout(String t1Bytesout) { + this.t1Bytesout = t1Bytesout; + } + + public String getT1Packetsin() { + return t1Packetsin; + } + + public void setT1Packetsin(String t1Packetsin) { + this.t1Packetsin = t1Packetsin; + } + + public String getT1Packetsout() { + return t1Packetsout; + } + + public void setT1Packetsout(String t1Packetsout) { + this.t1Packetsout = t1Packetsout; + } + + public String getInstanceres02Command() { + return Instanceres02Command; + } + + public void setInstanceres02Command(String instanceres02Command) { + Instanceres02Command = instanceres02Command; + } + + +}
\ No newline at end of file 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 new file mode 100644 index 0000000..6329ee7 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/FaultData.java @@ -0,0 +1,1228 @@ +package evel_javalibrary.att.com.loadbalance; +/**************************************************************************//** + * @file + * Evel Fault Event class extends EvelHeader class + * + * This file implements the Evel Fault Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send Fault events. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + + +import org.apache.log4j.Level; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import evel_javalibrary.att.com.AgentMain; +import evel_javalibrary.att.com.EvelBatch; +import evel_javalibrary.att.com.EvelFault; +import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES; +import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES; +import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES; +import evel_javalibrary.att.com.EvelHeader; + + + +public class FaultData{ + + + static HashMap<String, String> fault_config = new HashMap<>(); + static HashMap<String, String> interface_config = new HashMap<>(); + + static HashMap<String, String> faultConfig = new HashMap<>(); + + static HashMap<String, String> faultInstanceres01 = new HashMap<>(); + static HashMap<String, String> faultInstanceres02 = new HashMap<>(); + static HashMap<String, String> tempAlaramClearParameter = new HashMap<>(); + + + static HashMap<String, String> Instanceres02ClearParameter = new HashMap<>(); + + + static String[] resDevice =null; + static String[] tempInitres; + static String[] tempcommandres; + static String[] tempcommand02res; + static HashMap<String, String> faultConfigTempInit = new HashMap<>(); + static HashMap<String, String> faultConfigCommand = new HashMap<>(); + static String alarmCondition =""; + static String specificProblem = ""; + static String eventSeverity=""; + static String alarmInterfaceA =""; + + static String alarmConditionClear =""; + static String specificProblemClear = ""; + static String eventSeverityClear=""; + + static String Instance02alarmInterfaceA; + static String Instance02eventCategory; + static String Instance02eventSourceType; + static String Instance02eventName; + + static String ins02alarmConditionClear; + static String ins02specificProblemClear; + static String ins02eventSeverityClear; + + static String setAlarmCondition; + static String setSpecificProblem; + static String setEventSeverity; + + static String eventCategory =""; + static String eventSourceType =""; + static HashMap<String, String> hm = new HashMap<>(); + + static String linkStart = ""; + static int linkCount; + static String event_id1 = "fault"; + static String event_id = "00000000"; + static float bytes_in; + static float bytes_out; + static float packets_in; + static float packets_out; + + static float ins02Cmd; + + + static int falut_raised =0; + + + public final Runnable faultInstance01; + public final Runnable faultInstance02; + + public FaultData(){ + + faultInstance01 = new Runnable() { + + @Override + public void run() { + int gm_event_id = 1; + String event_id2=null; + + Long start_epoch_microsec = 0L; + Long last_epoch_microsec = 0L; + String hostName = hostName(); + try { + readFalutConfig(); + readVppMetrics(resDevice); + } catch (IOException | ParseException e1) { + + } + + + String[] intFaceMapFault = resDevice; + int numOfInterfacesFalut = 0; + if( intFaceMapFault != null) + numOfInterfacesFalut = intFaceMapFault.length; + if( numOfInterfacesFalut <= 0) { + + return; + } + + HashMap<String, DeviceData> falut_last_metrics = readVppMetrics(resDevice); + + while(true) { + try { + EvelBatch ebt = new EvelBatch(); + + for( String falut : intFaceMapFault ) { + + HashMap<String, DeviceData> falut_current_metrics = readVppMetrics(resDevice); + + + for( String tmp_device :falut_current_metrics.keySet() ) { + + + + int receivedOctetsDelta = Integer.parseInt((falut_current_metrics.get(tmp_device).getT1Bytesin()) ) + - Integer.parseInt((falut_last_metrics.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 transmittedOctetsDelta = Integer.parseInt((falut_current_metrics.get(tmp_device).getT1Bytesout()) ) + - Integer.parseInt((falut_last_metrics.get(tmp_device).getT0bytesOut())); + + + + int transmittedTotalPacketsDelta = Integer.parseInt((falut_current_metrics.get(tmp_device).getT1Packetsout()) ) + - Integer.parseInt((falut_last_metrics.get(tmp_device).getT0packetOut())); + + + String alarmInterface = tmp_device; //resDevice[0]; + 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, + EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW, + EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, + EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER, + EVEL_VF_STATUSES.EVEL_VF_STATUS_IDLE); + if(eveFalt != null) { + + falut_raised =1; + + 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; + + eveFalt.evel_last_epoch_set(start_epoch_microsec); + eveFalt.evel_start_epoch_set(last_epoch_microsec); + + 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()); + 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_id_set(faultConfig.get("reportingEntityId").toString()); + eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName").toString()); + eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId").toString()); + + 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_timeZoneOffset_set(faultConfig.get("timeZoneOffset").toString()); + AgentMain.evel_post_event(eveFalt); + } + + } + + }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, + EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW, + EVEL_SEVERITIES.EVEL_SEVERITY_NORMAL, + EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER, + EVEL_VF_STATUSES.EVEL_VF_STATUS_IDLE); + + + + if(eveFalt != null) { + falut_raised =1; + + if( faultConfig.get("eventType")!=null) { + eveFalt.evel_fault_type_set(faultConfig.get("eventType")); + 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()); + + 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_id_set(faultConfig.get("reportingEntityId").toString()); + eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName").toString()); + eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId").toString()); + + 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_timeZoneOffset_set(faultConfig.get("timeZoneOffset").toString()); + AgentMain.evel_post_event(eveFalt); + + } + + } + + + + } + + + try { + String Ins01Interval=""; + long milliseconds = 60000; + if(faultInstanceres01.get("tmp_faultCheckInterval") == null) { + Ins01Interval = Long.toString(milliseconds); + }else { + Ins01Interval = faultInstanceres01.get("tmp_faultCheckInterval"); + } + Thread.sleep(Integer.parseInt(Ins01Interval)); + }catch(Exception e) {} + + } //for map keyset + + } //for intFaceMapFault + + + }catch (Exception e) { + + } + + + } + } + }; + + faultInstance02 = new Runnable() { + + @Override + public void run() { + int gm_event_id = 1; + String event_id2=null; + Long start_epoch_microsec = 0L; + Long last_epoch_microsec = 0L; + String hostName = hostName(); + try { + readFalutConfig(); + readVppMetrics(resDevice); + } catch (IOException | ParseException e1) { + + } + + + String[] intFaceMapFault = resDevice; + int numOfInterfacesFalut = 0; + if( intFaceMapFault != null) + numOfInterfacesFalut = intFaceMapFault.length; + if( numOfInterfacesFalut <= 0) { + + return; + } + + HashMap<String, DeviceData> falut_last_metrics = readVppMetrics(resDevice); + + while(true) { + try { + EvelBatch ebt = new EvelBatch(); + + HashMap<String, DeviceData> falutMetric = readVppMetrics(resDevice); + DeviceData mdGetdata = new DeviceData(); + String ins02cmd = mdGetdata.getInstanceres02Command(); + + + 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, + EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW, + EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, + EVEL_SOURCE_TYPES.EVEL_SOURCE_VIRTUAL_MACHINE, + EVEL_VF_STATUSES.EVEL_VF_STATUS_IDLE); + + + if(eveFalt != null) { + + falut_raised =1; + + + + 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; + + eveFalt.evel_last_epoch_set(start_epoch_microsec); + eveFalt.evel_start_epoch_set(last_epoch_microsec); + + eveFalt.evel_fault_category_set(Instance02eventCategory); + eveFalt.evel_fault_interface_set(Instance02alarmInterfaceA.replaceAll("^[\"']+|[\"']+$", "")); + + eveFalt.evel_nfcnamingcode_set(faultConfig.get("nfcNamingCode").toString()); + eveFalt.evel_nfnamingcode_set(faultConfig.get("nfNamingCode").toString()); + + 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_id_set(faultConfig.get("reportingEntityId").toString()); + eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName").toString()); + eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId").toString()); + + 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_timeZoneOffset_set(faultConfig.get("timeZoneOffset").toString()); + AgentMain.evel_post_event(eveFalt); + } + + } + + }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, + EvelHeader.PRIORITIES.EVEL_PRIORITY_LOW, + EVEL_SEVERITIES.EVEL_SEVERITY_NORMAL, + EVEL_SOURCE_TYPES.EVEL_SOURCE_VIRTUAL_MACHINE, + EVEL_VF_STATUSES.EVEL_VF_STATUS_IDLE); + + + + if(eveFalt != null) { + falut_raised =1; + + if( faultConfig.get("eventType")!=null) { + eveFalt.evel_fault_type_set(faultConfig.get("eventType")); + eveFalt.evel_fault_category_set(Instance02eventCategory); + eveFalt.evel_fault_interface_set(Instance02alarmInterfaceA.replaceAll("^[\"']+|[\"']+$", "")); + + eveFalt.evel_nfcnamingcode_set(faultConfig.get("nfcNamingCode").toString()); + eveFalt.evel_nfnamingcode_set(faultConfig.get("nfNamingCode").toString()); + + 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_id_set(faultConfig.get("reportingEntityId").toString()); + eveFalt.evel_nfVendorName_set(faultConfig.get("nfVendorName").toString()); + eveFalt.evel_header_set_sourceid(true,faultConfig.get("sourceId").toString()); + + 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_timeZoneOffset_set(faultConfig.get("timeZoneOffset").toString()); + AgentMain.evel_post_event(eveFalt); + + } + + } + + + + } + + + try { + String Ins02Interval=""; + long milliseconds = 60000; + if(faultInstanceres02.get("tmp_faultCheckInterval") == null) { + Ins02Interval = Long.toString(milliseconds); + }else { + Ins02Interval = faultInstanceres02.get("tmp_faultCheckInterval"); + } + Thread.sleep(Integer.parseInt(Ins02Interval)); + }catch(Exception e) { + + } + + }catch (Exception e) { + + } + + + } + } + }; + + } + private final static char[] hexArray = "0123456789ABCDEF".toCharArray(); + private static String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for ( int j = 0; j < bytes.length; j++ ) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + return new String(hexChars); + } + public static String hostName() { + String hostname = "Unknown"; + String uuid = "Unknown"; + try + { + InetAddress addr; + addr = InetAddress.getLocalHost(); + hostname = addr.getHostName(); + } + catch (UnknownHostException ex) + { + + } + try{ + Enumeration<NetworkInterface> networks = + NetworkInterface.getNetworkInterfaces(); + while(networks.hasMoreElements()) { + NetworkInterface network = networks.nextElement(); + byte[] mac = network.getHardwareAddress(); + + if(hostname.equalsIgnoreCase("unknown")) + { + Enumeration inetAddrs = network.getInetAddresses(); + while(inetAddrs.hasMoreElements()){ + InetAddress inetAddr = (InetAddress) inetAddrs.nextElement(); + if (!inetAddr.isLoopbackAddress()) { + hostname = inetAddr.getHostAddress(); + break; + } + } + } + if (mac != null) { + uuid = bytesToHex(mac); + } + } + } catch (SocketException e) { + // TODO Auto-generated catch block + + } + + return hostname; + } + + + + public static HashMap<String, String> readFalutConfig() throws IOException, ParseException { + + System.out.println("readFalutConfig calling out lo:"); + + 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("="); + faultConfigCommand.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(); + System.out.println("specificProblemClear data:"+ specificProblemClear); + + //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, 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) { + + //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"); + + + //t1 + String t1BytesIn = faultConfigCommand.get("tmp_t1BytesIn"); + String t1BytesOut = faultConfigCommand.get("tmp_t1BytesOut").toString(); + String t1PacketsIn = faultConfigCommand.get("tmp_t1PacketsIn"); + String t1PacketsOut = faultConfigCommand.get("tmp_t1PacketsOut"); + + + + + String echoFalut = faultInstanceres02.get("tmp_cmd1"); + HashMap<String, DeviceData> vppMetrics = new HashMap<>(); + + for(int i=0;i<linkStart.length;i++) { + String device = linkStart[i]; + + + //t0 + 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(","); + + + + //t1 + String replacet1Bytesin =""; + if(t1BytesIn.contains("$tmp_device")) { + String repString = t1BytesIn.replace("$tmp_device", device.trim()); + replacet1Bytesin = repString.replace("sudo", "/bin/sh,-c,"); + } + String[] t1BytesinArray= replacet1Bytesin.split(","); + + String replacet1BytesOut =""; + if(t1BytesOut.contains("$tmp_device")) { + String repString = t1BytesOut.replace("$tmp_device", device.trim()); + replacet1BytesOut = repString.replace("sudo", "/bin/sh,-c,"); + } + String[] t1BytesoutArray = replacet1BytesOut.split(","); + + String replacet1PacketsIn =""; + if(t1PacketsIn.contains("$tmp_device")) { + String repString = t1PacketsIn.replace("$tmp_device", device.trim()); + replacet1PacketsIn = repString.replace("sudo", "/bin/sh,-c,"); + } + String[] t1PacketsInArray= replacet1PacketsIn.split(","); + + String replacet1PacketsOut =""; + if(t1PacketsOut.contains("$tmp_device")) { + String repString = t1PacketsOut.replace("$tmp_device", device.trim()); + replacet1PacketsOut = repString.replace("sudo", "/bin/sh,-c,"); + + } + String[] t1PacketsOutArray= replacet1PacketsOut.split(","); + + try { + //t0 + 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(); + + + //t1_Commands run + + Runtime rt6 = Runtime.getRuntime(); + Process t1bytesinchild = rt6.exec(t1BytesinArray); + BufferedReader readert1Bytesin = new BufferedReader(new InputStreamReader( + t1bytesinchild.getInputStream())); + String readMetrics5= readert1Bytesin.readLine(); + + + + Runtime rt7 = Runtime.getRuntime(); + Process t1bytesoutchild = rt7.exec(t1BytesoutArray); + BufferedReader readert1Bytesout = new BufferedReader(new InputStreamReader( + t1bytesoutchild.getInputStream())); + String readMetrics6= readert1Bytesout.readLine(); + + Runtime rt8 = Runtime.getRuntime(); + Process t1packetsInchild = rt8.exec(t1PacketsInArray); + BufferedReader readert1PacketsIn = new BufferedReader(new InputStreamReader( + t1packetsInchild.getInputStream())); + String readMetrics7= readert1PacketsIn.readLine(); + + + Runtime rt9 = Runtime.getRuntime(); + Process t1packetsOutchild = rt9.exec(t1PacketsOutArray); + BufferedReader readert1packetsOut = new BufferedReader(new InputStreamReader( + t1packetsOutchild.getInputStream())); + String readMetrics8= readert1packetsOut.readLine(); + + + mddata.setT0bytesIn(readMetrics); + mddata.setT0bytesOut(readMetrics1); + mddata.setT0packetIn(readMetrics2); + mddata.setT0packetOut(readMetrics3); + + mddata.setT1Bytesin(readMetrics5); + mddata.setT1Bytesout(readMetrics6); + mddata.setT1Packetsin(readMetrics7); + mddata.setT1Packetsout(readMetrics8); + + + 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 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, + null,null, + "will", + "pill", + null, null, null, + "http://127.0.0.1",30001, "will", + "pill", + Level.TRACE); + }catch(Exception e) { + e.printStackTrace(); + return; + } + FaultData flDataThread = new FaultData(); + new Thread(flDataThread.faultInstance01).start(); + new Thread(flDataThread.faultInstance02).start(); + } + +} 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 new file mode 100644 index 0000000..59667ab --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/HeartBeatData.java @@ -0,0 +1,213 @@ +package evel_javalibrary.att.com.loadbalance; +/**************************************************************************//** + * @file + * Heartbeat field class + * + * This file implements the Heartbeat Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send Agent status. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +import java.io.FileReader; +import java.io.IOException; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.UnknownHostException; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + + +import evel_javalibrary.att.com.AgentMain; +import evel_javalibrary.att.com.EvelHeartbeatField; + +import org.apache.log4j.Level; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +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; + + + public void run() { + + Long start_epoch_microsec = 0L; + Long last_epoch_microsec = 0L; + String hostName = hostName(); + try { + readHeartbeatConfig(); + }catch(Exception e) { + } + while(true) { + String heatBeatInterval=""; + long milliseconds = 60000; + + event_id2 = event_id1+ event_id+(gm_event_id++); + if(hbConfig.get("heartbeatInterval") == null) { + heatBeatInterval = Long.toString(milliseconds); + }else { + heatBeatInterval = hbConfig.get("heartbeatInterval"); + } + EvelHeartbeatField evelHb = new EvelHeartbeatField(Integer.parseInt(heatBeatInterval) , + hbConfig.get("eventName"), + event_id2); + + if( hbConfig.get("eventType")!=null) { + start_epoch_microsec = last_epoch_microsec; + last_epoch_microsec = System.nanoTime()/1000; + + evelHb.evel_last_epoch_set(start_epoch_microsec); + evelHb.evel_start_epoch_set(last_epoch_microsec); + + 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()); + 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_id_set(hbConfig.get("reportingEntityId").toString()); + evelHb.evel_nfVendorName_set(hbConfig.get("nfVendorName").toString()); + evelHb.evel_header_set_sourceid(true,hbConfig.get("sourceId").toString()); + 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_timeZoneOffset_set(hbConfig.get("timeZoneOffset").toString()); + + } + + try { + Thread.sleep(Integer.parseInt(heatBeatInterval)); + }catch(Exception e) { + + } + AgentMain.evel_post_event(evelHb); + } + } + + + public static HashMap<String, String> readHeartbeatConfig() throws IOException, ParseException { + JSONParser jsonParser = new JSONParser(); + try { + + FileReader reader = new FileReader("./src/main/java/evel_javalibrary/att/com/loadbalance/hb_config.json"); + JSONObject obj = (JSONObject) jsonParser.parse(reader); + Map.Entry pair = null; + String convertObject =""; + String[] res; + Map directParameters = ((Map)obj.get("tmp_directParameters")); + Iterator<Map.Entry> itr1 = directParameters.entrySet().iterator(); + while (itr1.hasNext()) { + pair = itr1.next(); + convertObject=String.valueOf(pair); + res = convertObject.split("="); + hbConfig.put(res[0], res[1]); + } + + } catch (ClassCastException ex) { + ex.printStackTrace(); + } + return hbConfig; + } + +private final static char[] hexArray = "0123456789ABCDEF".toCharArray(); +private static String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for ( int j = 0; j < bytes.length; j++ ) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + return new String(hexChars); +} + +public static String hostName() { + String hostname = "Unknown"; + String uuid = "Unknown"; + try + { + InetAddress addr; + addr = InetAddress.getLocalHost(); + hostname = addr.getHostName(); + } + catch (UnknownHostException ex) + { + } + try{ + Enumeration<NetworkInterface> networks = + NetworkInterface.getNetworkInterfaces(); + while(networks.hasMoreElements()) { + NetworkInterface network = networks.nextElement(); + byte[] mac = network.getHardwareAddress(); + + if(hostname.equalsIgnoreCase("unknown")) + { + Enumeration inetAddrs = network.getInetAddresses(); + while(inetAddrs.hasMoreElements()){ + InetAddress inetAddr = (InetAddress) inetAddrs.nextElement(); + if (!inetAddr.isLoopbackAddress()) { + hostname = inetAddr.getHostAddress(); + break; + } + } + } + if (mac != null) { + uuid = bytesToHex(mac); + } + } + } catch (SocketException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return hostname; +} + +public static void main(String[] args) { + // TODO Auto-generated method stub + + try { + AgentMain.evel_initialize("http://127.0.0.1",30000, + null,null, + "will", + "pill", + null, null, null, + "http://127.0.0.1",30001, "will", + "pill", + Level.TRACE); + }catch(Exception e) { + e.printStackTrace(); + return; + } + HeartBeatData hbDataThread = new HeartBeatData(); + hbDataThread.start(); + } + + + +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/Main.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/Main.java deleted file mode 100644 index 83f97e1..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/Main.java +++ /dev/null @@ -1,64 +0,0 @@ -package evel_javalibrary.att.com.loadbalance; -/**************************************************************************//** - * @file - * Sample Test Agent for EVEL library - * - * This file implements the Sample Agent which is intended to provide a - * simple wrapper around the complexity of AT&T's Vendor Event Listener API so - * that VNFs can use it without worrying about details of the API transport. - * It also shows how events can be formatted with data for POST - * - * License - * ------- - * Unless otherwise specified, all software contained herein is - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *****************************************************************************/ - -import org.apache.log4j.Level; - -import evel_javalibrary.att.com.AgentMain; -//import evel_javalibrary.att.com.MeasureData; -//import evel_javalibrary.att.com.heartBeatData; - - - - - -public class Main { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - try { - AgentMain.evel_initialize("http://127.0.0.1", 30000, - null,null, - "will", - "pill", - null, null, null, - Level.TRACE); - }catch(Exception e) { - e.printStackTrace(); - return; - } - MeasureData mdataThread = new MeasureData(); - mdataThread.start(); - - heartBeatData hbDataThread = new heartBeatData(); - hbDataThread.start(); - - faultData flDataThread = new faultData(); - flDataThread.start(); - - } - -} - 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 38c517a..9fa537e 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 @@ -24,352 +24,574 @@ package evel_javalibrary.att.com.loadbalance; import java.io.BufferedReader; -import java.io.File; + +import java.io.FileReader; +import java.io.IOException; import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.nio.file.Files; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.UnknownHostException; import java.util.ArrayList; +import java.util.Enumeration; import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.log4j.Level; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; import evel_javalibrary.att.com.AgentMain; import evel_javalibrary.att.com.EvelBatch; import evel_javalibrary.att.com.EvelScalingMeasurement; public class MeasureData extends Thread{ - static HashMap<String, String> hm = new HashMap<>(); - static HashMap<String, String> vpp_metrics = new HashMap<>(); - static HashMap<String, String> common_meas = new HashMap<>(); - - static int bytes_in_this_round; - static int bytes_out_this_round; - static int packets_in_this_round; - static int packets_out_this_round; + static HashMap<String, String> measConfig = new HashMap<>(); + static String[] resDevice =null; + static String[] tempInitres; + static String[] tempcommandres; + static String[] tempcommandres1; + static HashMap<String, String> vNicPerformanceCommand1 = new HashMap<>(); + static HashMap<String, String> vNicPerformanceArray = new HashMap<>(); + static HashMap<String, String> initTempCommand = new HashMap<>(); + static float bytesInLo; + static float bytesOutLo; + static float packetsInLo; + static float packetsOutLo; - static int gm_event_id = 1; - static String event_id1 = "mvfs"; - static String event_id = "00000000"; - static String event_id2=null; + static float bytesInEnps03; + static float bytesOutEnps03; + static float packetsInEnps03; + static float packetsOutEnps03; - static int request_rate = 0; + static float bytesInDocker0; + static float bytesOutDocker0; + static float packetsInDocker0; + static float packetsOutDocker0; - static long epoch_start = 0; + static int gmEventId = 1; + static String eventId1 = "mvfs"; + static String eventId = "00000000"; + static String eventId2=null; + + static int requestRate = 0; static String linkStart = ""; static int linkCount; Long start_epoch_microsec = 0L; Long last_epoch_microsec = 0L; - - //public static void main(String[] args) { public void run() { - // TODO Auto-generated method stub - //read_config_file(); - read_meas_traffic(); - read_common_config_file(); - read_meas_config_file(); + + try { + + readMeasurementConfig(); + readVppMetrics(resDevice); + } catch (IOException | ParseException e1) { + e1.printStackTrace(); + } + + String[] intFaceMap = resDevice; - HashMap<String, String> intFaceMap = read_interface_config_file(); int numOfInterfaces = 0; - if( !intFaceMap.isEmpty() ) - numOfInterfaces = intFaceMap.size(); + if( intFaceMap != null) + numOfInterfaces = intFaceMap.length; if( numOfInterfaces <= 0) { - System.out.println("ERROR : Didn't find interfacess in config file, exiting thread"); + return; - } + } - System.out.println("MAP values: " + hm.values()); - HashMap last_metrics = read_vpp_metrics(linkStart); + + try { - Thread.sleep(Integer.parseInt(common_meas.get("measurementInterval"))); + Thread.sleep(1000); }catch(Exception e) {} while(true) { - //request_rate = rand()%10000; - request_rate =2; - EvelBatch ebt = new EvelBatch(); - event_id2 = event_id1+ event_id+(gm_event_id++); - EvelScalingMeasurement eveMeas = new EvelScalingMeasurement( Double.parseDouble(common_meas.get("measurementInterval")) , - common_meas.get("eventName"), - event_id2); - - for( String vNic : intFaceMap.keySet() ) { - //System.out.println("INFO:: getting vpp metrics for vNic "+vNic); + HashMap<String, DeviceData> lastMetrics = readVppMetrics(resDevice); + //HashMap<String, DeviceData> currentMetrics = readVppMetrics(resDevice);; + HashMap<String, DeviceData> currentMetrics = lastMetrics; + requestRate =2; + eventId2 = eventId1+ eventId+(gmEventId++); + String measurmentInterval=""; + long milliseconds = 60000; + if(measConfig.get("measurementInterval") == null) { + measurmentInterval = Long.toString(milliseconds); + }else { + measurmentInterval = measConfig.get("measurementInterval"); + } + EvelScalingMeasurement eveMeas = new EvelScalingMeasurement(Integer.parseInt(measurmentInterval) , + measConfig.get("eventName"), + eventId2); - HashMap current_metrics = read_vpp_metrics(vNic); - if( current_metrics.size() !=4 ) { - System.out.println("ERROR:: Did't get vpp metrics for vNic "+vNic); - continue; - } - - if (Integer.parseInt((String) current_metrics.get("bytes_in")) - - Integer.parseInt((String) last_metrics.get("bytes_in")) > 0) { - bytes_in_this_round = Integer.parseInt((String) current_metrics.get("bytes_in")) - - Integer.parseInt((String) last_metrics.get("bytes_in")); - } else { - bytes_in_this_round = 0; - } - - if (Integer.parseInt((String) current_metrics.get("bytes_out")) - - Integer.parseInt((String) last_metrics.get("bytes_out")) > 0) { - bytes_out_this_round = Integer.parseInt((String) current_metrics.get("bytes_out")) - - Integer.parseInt((String) last_metrics.get("bytes_out")); - } else { - bytes_out_this_round = 0; - } + for( String vNic : intFaceMap) { + + int receivedOctetsDeltaLo = 0; + int receivedTotalPacketsDeltaLo = 0; + int transmittedOctetsDeltaLo = 0; + int transmittedTotalPacketsDeltaLo = 0; + + System.out.println("Data Array T0 "+vNic+" , "+ currentMetrics.get(vNic).getT0bytesIn()+" " + + currentMetrics.get(vNic).getT0bytesOut()+" " + + currentMetrics.get(vNic).getT0packetIn()+" " + + currentMetrics.get(vNic).getT0packetOut()); + System.out.println("Data Array T1 "+vNic+" , "+ currentMetrics.get(vNic).getT1Bytesin()+" " + + currentMetrics.get(vNic).getT1Bytesout()+" " + + currentMetrics.get(vNic).getT1Packetsin()+" " + + currentMetrics.get(vNic).getT1Packetsout()); - if (Integer.parseInt((String) current_metrics.get("packets_in")) - - Integer.parseInt((String) last_metrics.get("packets_in")) > 0) { - packets_in_this_round = Integer.parseInt((String) current_metrics.get("packets_in")) - - Integer.parseInt((String) last_metrics.get("packets_in")); - } else { - packets_in_this_round = 0; - } - - if (Integer.parseInt((String) current_metrics.get("packets_out")) - - Integer.parseInt((String) last_metrics.get("packets_out")) > 0) { - packets_out_this_round = Integer.parseInt((String) current_metrics.get("packets_out")) - - Integer.parseInt((String) last_metrics.get("packets_out")); - } else { - packets_out_this_round = 0; - } - event_id2 = event_id1+ (gm_event_id++); - /* EvelScalingMeasurement eveMeas = new EvelScalingMeasurement( Double.parseDouble(hm.get("measurementInterval")) , - hm.get("eventName"), - event_id2); */ - - - EvelScalingMeasurement.MEASUREMENT_NIC_PERFORMANCE vNicPerf = eveMeas.evel_measurement_new_vnic_performance(vNic, "true"); - eveMeas.evel_meas_vnic_performance_add(vNicPerf ); - if( hm.get("eventType")!=null) { - - 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); + if (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesin())) + - Integer.parseInt((lastMetrics.get(vNic).getT0bytesIn()) ) > 0) { + receivedOctetsDeltaLo = (int) (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesin()) ) + - Integer.parseInt((lastMetrics.get(vNic).getT0bytesIn()) )); + } else { + receivedOctetsDeltaLo = 0; + } + + if (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsin())) + - Integer.parseInt((lastMetrics.get(vNic).getT0packetIn()) ) > 0) { + receivedTotalPacketsDeltaLo = (int) (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsin()) ) + - Integer.parseInt((lastMetrics.get(vNic).getT0packetIn()) )); + } else { + receivedTotalPacketsDeltaLo = 0; + } - eveMeas.evel_measurement_type_set( hm.get("eventType").toString()); - eveMeas.evel_measurement_request_rate_set(request_rate ); - eveMeas.evel_vnic_performance_rx_total_pkt_delta_set(vNicPerf, packets_in_this_round); - eveMeas.evel_vnic_performance_tx_total_pkt_delta_set(vNicPerf, packets_out_this_round); - eveMeas.evel_vnic_performance_rx_octets_delta_set( vNicPerf, bytes_in_this_round); - eveMeas.evel_vnic_performance_tx_octets_delta_set( vNicPerf, bytes_out_this_round); - eveMeas.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); - eveMeas.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); - eveMeas.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); - eveMeas.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); - eveMeas.evel_nfVendorName_set(hm.get("nfVendorName").toString()); - eveMeas.evel_header_set_sourceid(true,hm.get("sourceId").toString()); + if (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesout())) + - Integer.parseInt((lastMetrics.get(vNic).getT0bytesOut()) ) > 0) { + transmittedOctetsDeltaLo = (int) (Integer.parseInt((currentMetrics.get(vNic).getT1Bytesout()) ) + - Integer.parseInt((lastMetrics.get(vNic).getT0bytesOut()))); + } else { + transmittedOctetsDeltaLo = 0; + } + - eveMeas.evel_header_set_source_name(hm.get("sourceName").toString()); - eveMeas.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); + if (Integer.parseInt((currentMetrics.get(vNic).getT1Packetsout())) + - Integer.parseInt((lastMetrics.get(vNic).getT0packetOut()) ) > 0) { + transmittedTotalPacketsDeltaLo = (int) (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()); - + eveMeas.evel_vnic_performance_rx_octets_delta_set( vNicPerf, receivedOctetsDeltaLo); + eveMeas.evel_vnic_performance_rx_total_pkt_delta_set(vNicPerf, receivedTotalPacketsDeltaLo); + 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()); + 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_id_set(measConfig.get("reportingEntityId").toString()); + eveMeas.evel_nfVendorName_set(measConfig.get("nfVendorName").toString()); + eveMeas.evel_header_set_sourceid(true,measConfig.get("sourceId").toString()); + 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_timeZoneOffset_set(measConfig.get("timeZoneOffset").toString()); } - - - try { - Thread.sleep(Integer.parseInt(common_meas.get("measurementInterval"))); - }catch(Exception e) {} - last_metrics = current_metrics; - } - //ebt.addEvent(eveMeas); + } AgentMain.evel_post_event(eveMeas); - System.out.println(" Event sent"); - + boolean continues = true; + long curr = System.currentTimeMillis(); + while(continues) { + try { + Thread.sleep(100); + }catch (Exception e) { + // TODO: handle exception + } + if(System.currentTimeMillis() >= (curr+Integer.parseInt(measurmentInterval))) { + continues = false; + } + + + } } } - - - - public static HashMap<String, String> read_vpp_metrics(String linkStart) { - Process p; - - String s=""; - HashMap<String, String> vpp_metrics_map = new HashMap<>(); - String params[] = {"-f3", "-f11", "-f4", "-f12"}; - try { - Runtime rt = Runtime.getRuntime(); - for(int i=0;i<4;i++) { - String[] command = {"/bin/sh", "-c", "cat /proc/net/dev | grep \""+linkStart+"\" | tr -s \' \' | cut -d\' \' "+params[i]+""}; - Process child = rt.exec(command); - - BufferedReader reader = new BufferedReader(new InputStreamReader( - child.getInputStream())); - - while ((s= reader.readLine()) != null) { - String[] res = s.split(" "); - if( i==0) - vpp_metrics_map.put("bytes_in", res[0]); - if( i==1) - vpp_metrics_map.put("packets_in", res[0]); - if( i==2) - vpp_metrics_map.put("bytes_out", res[0]); - if( i==3) - vpp_metrics_map.put("packets_out", res[0]); - - } - } - - } catch (Exception e) { + private final static char[] hexArray = "0123456789ABCDEF".toCharArray(); + private static String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for ( int j = 0; j < bytes.length; j++ ) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + return new String(hexChars); + } + public static String hostName() { + String hostname = "Unknown"; + String uuid = "Unknown"; + try + { + InetAddress addr; + addr = InetAddress.getLocalHost(); + hostname = addr.getHostName(); + } + catch (UnknownHostException ex) + { + } + try{ + Enumeration<NetworkInterface> networks = + NetworkInterface.getNetworkInterfaces(); + while(networks.hasMoreElements()) { + NetworkInterface network = networks.nextElement(); + byte[] mac = network.getHardwareAddress(); + + if(hostname.equalsIgnoreCase("unknown")) + { + Enumeration inetAddrs = network.getInetAddresses(); + while(inetAddrs.hasMoreElements()){ + InetAddress inetAddr = (InetAddress) inetAddrs.nextElement(); + if (!inetAddr.isLoopbackAddress()) { + hostname = inetAddr.getHostAddress(); + break; + } + } + } + if (mac != null) { + uuid = bytesToHex(mac); + } + } + } catch (SocketException e) { + // TODO Auto-generated catch block e.printStackTrace(); } - return vpp_metrics_map; + + return hostname; } - public static HashMap<String, String> read_common_config_file() { - - List<String> list = new ArrayList<String>(); - - - hm.put("eventType", ""); - hm.put("nfcNamingCode", ""); - hm.put("nfNamingCode", ""); - hm.put("nfVendorName", ""); - hm.put("reportingEntityId", ""); - hm.put("reportingEntityName", ""); - hm.put("sourceId", ""); - hm.put("sourceName", ""); - hm.put("timeZoneOffset", ""); + public static HashMap<String, String> readMeasurementConfig() throws IOException, ParseException { + JSONParser jsonParser = new JSONParser(); - - - System.out.println("KEYS: " + hm.keySet().size()); - System.out.println("VALUES: " + hm.values()); - try { - // File file = new File("/home/ves/users/admin/temp/fw_common_config.txt"); - File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt"); - list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); - for (String lineSplit : list) { - String[] res = lineSplit.split(" "); - hm.put(res[0], res[1]); - System.out.println("File reading after split ---" + res[0]); - System.out.println("File reading after split second---" + res[1]); - } - } catch (Exception ex) { - ex.printStackTrace(); + + FileReader reader = new FileReader("./src/main/java/evel_javalibrary/att/com/loadbalance/meas_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("="); + measConfig.put(directres[0], directres[1]); + } + + String eventName = measConfig.get("eventName").toString(); + 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("="); + measConfig.put(indirectres[0], indirectres[1]); + } + + + + //tmp_init + // Map tempInitParameters = ((Map)indirectParameters.get("tmp_init")); + + //tmp_init + Map.Entry tempcommandPair = null; + String tempcommandObject =""; + Map tempcommandParameters = ((Map)indirectParameters.get("tmp_init")); + Iterator<Map.Entry> itr3 = tempcommandParameters.entrySet().iterator(); + while (itr3.hasNext()) { + tempcommandPair = itr3.next(); + tempcommandObject=String.valueOf(tempcommandPair); + tempcommandres = tempcommandObject.split("="); + initTempCommand.put(tempcommandres[0], tempcommandres[1]); + } + + //tmp_command1 + Map.Entry tempcommand1Pair = null; + String tempcommand1Object =""; + JSONArray nicPerfomenceArray = (JSONArray) indirectParameters.get("vNicPerformance"); + Map vNic = (Map)nicPerfomenceArray.get(0); + Map perf = ((Map)vNic.get("tmp_vnic_command")); + Iterator<Map.Entry> itr5 = perf.entrySet().iterator(); + while (itr5.hasNext()) { + tempcommand1Pair = itr5.next(); + tempcommand1Object=String.valueOf(tempcommand1Pair); + tempcommandres1 = tempcommand1Object.split("="); + vNicPerformanceCommand1.put(tempcommandres1[0], tempcommandres1[1]); + } + Map.Entry vnicPair = null; + String vnicObject =""; + String[] nicPerfomenceArrayRes; + vNic = (Map)nicPerfomenceArray.get(0); + Iterator<Map.Entry> itr6 = vNic.entrySet().iterator(); + while (itr6.hasNext()) { + vnicPair = itr6.next(); + vnicObject=String.valueOf(vnicPair); + nicPerfomenceArrayRes = vnicObject.split("="); + vNicPerformanceArray.put(nicPerfomenceArrayRes[0], nicPerfomenceArrayRes[1]); + } + + String receivedOctetsDelta = vNicPerformanceArray.get("receivedOctetsDelta"); + + } catch (ClassCastException ex) { + } - System.out.println("KEYS: " + hm.keySet().size()); - System.out.println("VALUES: " + hm.values()); - return hm; + return measConfig; } + + public static HashMap<String, DeviceData> readVppMetrics(String[] linkStart) { + DeviceData mddata = null; new DeviceData(); - public static HashMap<String, String> read_interface_config_file() { - - List<String> list = new ArrayList<String>(); - HashMap<String, String> interface_config = new HashMap<>(); - //interface_config.put("lo", ""); + //tmp_t0 + String t0BytesIn = initTempCommand.get("tmp_t0BytesIn"); + String t0BytesOut = initTempCommand.get("tmp_t0BytesOut"); + String t0PacketsIn = initTempCommand.get("tmp_t0PacketsIn"); + String t0PacketsOut = initTempCommand.get("tmp_t0PacketsOut"); - System.out.println("KEYS: " + interface_config.keySet().size()); - System.out.println("VALUES: " + interface_config.values()); - - try { - //File file = new File("/home/ves/users/admin/temp/fw_interface_config.txt"); - File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt"); - list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); - for (String lineSplit : list) { - String[] res = lineSplit.split(" "); - interface_config.put(res[0], res[1]); - } + //tmp_t1 + String t1BytesIn = vNicPerformanceCommand1.get("tmp_t1BytesIn"); + String t1BytesOut = vNicPerformanceCommand1.get("tmp_t1BytesOut").toString(); + String t1PacketsIn = vNicPerformanceCommand1.get("tmp_t1PacketsIn"); + String t1PacketsOut = vNicPerformanceCommand1.get("tmp_t1PacketsOut"); + + + HashMap<String, DeviceData> vppMetrics = new HashMap<>(); + for(int i = 0; i < linkStart.length; i++) { + mddata =new DeviceData(); + String device = linkStart[i]; - linkStart = (String)interface_config.keySet().toArray()[1]; - linkCount = interface_config.keySet().size(); + //t0_ + String replaceInitBytesint0 =""; + if(t0BytesIn.contains("$tmp_device")) { + String repString = t0BytesIn.replace("$tmp_device", device.trim()); + replaceInitBytesint0 = repString.replace("sudo", "/bin/sh,-c,"); + } + String[] t0BytesinArray= replaceInitBytesint0.split(","); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return interface_config; - } + String replaceInitBytesout=""; + if(t0BytesOut.contains("$tmp_device")) { + String repString = t0BytesOut.replace("$tmp_device", device.trim()); + replaceInitBytesout = repString.replace("sudo", "/bin/sh,-c,"); + } + String[] t0BytesoutArray= replaceInitBytesout.split(","); + + String replaceInitPacketsin =""; + if(t0PacketsIn.contains("$tmp_device")) { + String repString = t0PacketsIn.replace("$tmp_device", device.trim()); + replaceInitPacketsin = repString.replace("sudo", "/bin/sh,-c,"); - - - + } + String[] t0PacketsinArray= replaceInitPacketsin.split(","); + + + String replaceInitPacketsout =""; + if(t0PacketsOut.contains("$tmp_device")) { + String repString = t0PacketsOut.replace("$tmp_device", device.trim()); + replaceInitPacketsout = repString.replace("sudo", "/bin/sh,-c,"); - - public static HashMap<String, String> read_meas_config_file() { + } + String[] t0PacketsoutArray= replaceInitPacketsout.split(","); + + //t1 + String replaceBytesin =""; + if(t1BytesIn.contains("$tmp_device")) { + String repString = t1BytesIn.replace("$tmp_device", device.trim()); + replaceBytesin = repString.replace("sudo", "/bin/sh,-c,"); - List<String> list = new ArrayList<String>(); + } + String[] t1BytesinArray= replaceBytesin.split(","); + + String replaceBytesOut =""; + if(t1BytesOut.contains("$tmp_device")) { + String repString = t1BytesOut.replace("$tmp_device", device.trim()); + replaceBytesOut = repString.replace("sudo", "/bin/sh,-c,"); + } + String[] t1BytesoutArray = replaceBytesOut.split(","); + + String replacePacketsIn =""; + if(t1PacketsIn.contains("$tmp_device")) { + String repString = t1PacketsIn.replace("$tmp_device", device.trim()); + replacePacketsIn = repString.replace("sudo", "/bin/sh,-c,"); + } + String[] t1PacketsInArray= replacePacketsIn.split(","); + + String replacePacketsOut =""; + if(t1PacketsOut.contains("$tmp_device")) { + String repString = t1PacketsOut.replace("$tmp_device", device.trim()); + replacePacketsOut = repString.replace("sudo", "/bin/sh,-c,"); - common_meas.put("eventName", "Measurement_vFirewall-AT&T_nicPerformance"); - common_meas.put("measurementInterval", ""); + } + String[] t1PacketsOutArray= replacePacketsOut.split(","); - System.out.println("KEYS: " + common_meas.keySet().size()); - System.out.println("VALUES: " + common_meas.values()); + try { + //t0_Commands run + Runtime rt5 = Runtime.getRuntime(); + Process initBytesint0child = rt5.exec(t0BytesinArray); + BufferedReader readerinitBytesint0 = new BufferedReader(new InputStreamReader( + initBytesint0child.getInputStream())); + String readinitMetrics= readerinitBytesint0.readLine(); + + Runtime rt6 = Runtime.getRuntime(); + Process initBytesoutchild = rt6.exec(t0BytesoutArray); + BufferedReader readerinitBytesout = new BufferedReader(new InputStreamReader( + initBytesoutchild.getInputStream())); + String readinitMetrics2= readerinitBytesout.readLine(); + + + Runtime rt7 = Runtime.getRuntime(); + Process initPacketsinchild = rt7.exec(t0PacketsinArray); + BufferedReader readerinitPacketsin = new BufferedReader(new InputStreamReader( + initPacketsinchild.getInputStream())); + String readinitMetrics3= readerinitPacketsin.readLine(); + + + + Runtime rt8 = Runtime.getRuntime(); + Process initPacketsoutchild = rt8.exec(t0PacketsoutArray); + BufferedReader readerinitPacketsout = new BufferedReader(new InputStreamReader( + initPacketsoutchild.getInputStream())); + String readinitMetrics4= readerinitPacketsout.readLine(); + + - try { - //File file = new File("/home/ves/users/admin/temp/fw_meas_config.txt"); - File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt"); - list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); - for (String lineSplit : list) { - String[] res = lineSplit.split(" "); - common_meas.put(res[0], res[1]); - } - } catch (Exception ex) { - ex.printStackTrace(); - } - System.out.println("KEYS: " + common_meas.keySet().size()); - System.out.println("VALUES: " + common_meas.values()); - return common_meas; - } + //t1_Commands run + 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(); + + + + Runtime rt2 = Runtime.getRuntime(); + Process bytesoutchild = rt2.exec(t1BytesoutArray); + BufferedReader readerBytesout = new BufferedReader(new InputStreamReader( + bytesoutchild.getInputStream())); + String readMetrics1= readerBytesout.readLine(); + + Runtime rt3 = Runtime.getRuntime(); + Process packetsInchild = rt3.exec(t1PacketsInArray); + BufferedReader readerPacketsIn = new BufferedReader(new InputStreamReader( + packetsInchild.getInputStream())); + String readMetrics2= readerPacketsIn.readLine(); + + Runtime rt4 = Runtime.getRuntime(); + Process packetsOutchild = rt4.exec(t1PacketsOutArray); + BufferedReader readerpacketsOut = new BufferedReader(new InputStreamReader( + packetsOutchild.getInputStream())); + String readMetrics3= readerpacketsOut.readLine(); + + // System.out.println(device+" , T1 command data: "+ readMetrics+"," + readMetrics1+"," + readMetrics2+"," + readMetrics3); + // System.out.println(device+" , T0 command data: "+ readinitMetrics+"," + readinitMetrics2+"," + readinitMetrics3+"," + readinitMetrics4); + + //t1 + mddata.setT1Bytesin(readMetrics); + mddata.setT1Bytesout(readMetrics1); + mddata.setT1Packetsin(readMetrics2); + mddata.setT1Packetsout(readMetrics3); + + //t0 + mddata.setT0bytesIn(readinitMetrics); + mddata.setT0bytesOut(readinitMetrics2); + mddata.setT0packetIn(readinitMetrics3); + mddata.setT0packetOut(readinitMetrics4); + + 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) { + e.printStackTrace(); + } + } + return vppMetrics; + } - public static HashMap<String, String> read_meas_traffic() { - Process p; - List<String> vpp_params = new ArrayList(); - String s=""; - // HashMap<String, String> vpp_metrics_map = new HashMap<>(); - String params[] = {"-f3", "-f11", "-f4", "-f12"}; + + public static void main(String[] args) { + // TODO Auto-generated method stub + try { -// System.out.println("***********inside read_vpp_metrics"); -// String command = "cat /proc/net/dev | grep \"Receive\" | tr -s \' \' | cut -d\' \' -f3"; - //{"-f3", "-f11", "-f4", "-f12"}; -// String command = "cat /proc/net/dev | grep \""+vnic+"\" "; - for(int i=0;i<4;i++) { - String[] command = {"/bin/sh", "-c", "docker logs vHello | grep -c"}; -// System.out.println("**COMMAND***: "+command); - Process child = Runtime.getRuntime().exec(command); - - BufferedReader reader = new BufferedReader(new InputStreamReader( - child.getInputStream())); - - while ((s= reader.readLine()) != null) { - vpp_params.add(s); - System.out.println("VPP meas_traffic:----" + s); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return vpp_metrics; + AgentMain.evel_initialize("http://127.0.0.1",30000, + null,null, + "will", + "pill", + null, null, null, + "http://127.0.0.1",30001, "will", + "pill", + Level.TRACE); + }catch(Exception e) { + e.printStackTrace(); + return; + } + MeasureData mdataThread = new MeasureData(); + mdataThread.start(); + } + + + } diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Fault.md b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Fault.md new file mode 100644 index 0000000..0151629 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Fault.md @@ -0,0 +1,33 @@ + +PROJECT DESCRIPTION + +--- +This project contains the source code and scripts for the generation of fault events. + + - README.md: this file. + + + - FaultData.java and DeviceData.java files: source code that uses the ECOMP Vendor Event Listener Library (VES) to generate the fault events. Fault is generated based on the link status. If number of bytes transmitted/received is less than the low water mark, the fault is generated. The application reads flt_config.json file for parameter values and populate the fault event. If eventName, eventSourceType, vfStatus, specificProblem or alarmCondition parameter value is not given, the application terminates. If reportingEntityName and sourceName parameter values are not given, then it gets the hostname and populates it. If tmp_faultCheckInterval is not given, it defaults to 60 seconds. + + + + - FaultData.java: It reads input parameters like DCAE IP address and port from configuration files contained in /opt/config. Based on the collector configuration, use FaultData.java for use single and 2 collectors configuration. + + +USAGE +----- + +Update the configuration files with proper parameters values so that events generated would contain those values + +To run the FaultData.java in single collector configuration, please execute the following steps: + + -Compile Load Balance VES agent + javac -cp <.:dependent jars> ./evel_javalibrary/att/com/loadbalance + In Eclipse right click on veslibrary/ves_javalibrary/evel_javalib2 application-> click Run As ->and select -> mvn build option then + ->select the configuration mvn clean install. + + + -Run Load Balance VES agent + java -cp <.:dependent jars> evel_javalibrary.att.com.loadbalance.FaultData.java + In Eclipse right click on evel_javalibrary.att.com.loadbalance.FaultData.java class right click -> click Run As -> click Java application. + diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_HeartBeat.md b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_HeartBeat.md new file mode 100644 index 0000000..7e541f8 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_HeartBeat.md @@ -0,0 +1,38 @@ + +PROJECT DESCRIPTION + +--- +This project contains the source code and scripts for the periodic generation of heartbeat events. + + - README.md: this file. + + + - HeartBeatData.java file: source code that uses the ECOMP Vendor Event Listener Library (VES) to generate the periodic heartbeat events. It reads hb_config.json file for parameter values and populate the heartbeat event. If eventName parameter value is not given, the application terminates. If reportingEntityName and sourceName parameter values are not given, then it gets the hostname and populates it. If heartbeatInterval is not given, it defaults to 60 seconds. + + + + - HeartBeatData.java file: It reads input parameters like DCAE IP address and port from configuration files contained in /opt/config. Based on the collector configuration, use HeartBeatData.java file for single and 2 collectors configuration. + + +USAGE +----- + +Update the configuration files with proper parameters values so that events generated would contain those values com.googlecode.json-simple + + +To run the HeartBeatData.java in single collector configuration, please execute the following steps: + + -Compile Load Balance VES agent + javac -cp <.:dependent jars> ./evel_javalibrary/att/com/loadbalance + In Eclipse right click on veslibrary/ves_javalibrary/evel_javalib2 application-> click Run As ->and select -> mvn build option then + ->select the configuration mvn clean install. + + -Run Load Balance VES agent + java -cp <.:dependent jars> evel_javalibrary.att.com.loadbalance.HeartBeatData.java + In Eclipse right click on evel_javalibrary.att.com.loadbalance.HeartBeatData.java class right click -> click Run As -> click Java application. + + <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>1.1.1</version> + </dependency> diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Measurement.md b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Measurement.md new file mode 100644 index 0000000..f17c9d4 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Measurement.md @@ -0,0 +1,32 @@ + +PROJECT DESCRIPTION + +--- +This project contains the source code and scripts for the periodic generation of network measurement reports events. It also generates fault event if the packets/bytes transferred are below the low water mark for the network interface. + + - README.md: this file. + + + - MeasureData.java and DeviceData.java files: source code that uses the ECOMP Vendor Event Listener Library (VES) to read metrics from the network interface and send periodic measurement reports to the VES collector in DCAE. It reads meas_config.json file for parameter values and populate the heartbeat event. If eventName parameter value is not given, the application terminates. If reportingEntityName and sourceName parameter values are not given, then it gets the hostname and populates it. + + + - - MeasureData.java: It reads input parameters like DCAE IP address and port from configuration files contained in /opt/config. Based on the collector configuration, use MeasureData.java for single and 2 collectors configuration. + + +USAGE +----- + +Update the configuration files with proper parameters values so that events generated would contain those values + +To run the MeasureData.java, please execute the following steps: + + -Compile Load Balance VES agent + javac -cp <.:dependent jars> ./evel_javalibrary/att/com/loadbalance + In Eclipse right click on veslibrary/ves_javalibrary/evel_javalib2 application-> click Run As ->and select -> mvn build option then + ->select the configuration mvn clean install. + + -Run Load Balance VES agent + java -cp <.:dependent jars> evel_javalibrary.att.com.loadbalance.MeasureData.java + In Eclipse right click on evel_javalibrary.att.com.loadbalance.MeasureData.java class right click -> click Run As -> click Java application. + + diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Syslog.md b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Syslog.md new file mode 100644 index 0000000..8b8ee6d --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/README_Syslog.md @@ -0,0 +1,30 @@ + +PROJECT DESCRIPTION + +--- +This project contains the source code and scripts for the periodic generation of network measurement reports and heartbeat events. It also generates fault event if the packets/bytes transferred are below the low water mark for the network interface. + + + - syslogData.java file: source code that uses the ECOMP Vendor Event Listener Library (VES) to read syslog message from /var/log/syslog and send syslog events to the VES collector in DCAE. It reads syslog_config.json file for parameter values and populate the syslog event. If eventName parameter value is not given, the application terminates. If reportingEntityName and sourceName parameter values are not given. + + + - - syslogData.java: It reads input parameters like DCAE IP address and port from configuration files contained in /opt/config. Based on the collector configuration, use MeasureData.java for single and 2 collectors configuration. + + +USAGE +----- + +Update the configuration files with proper parameters values so that events generated would contain those values + +To run the MeasureData.java, please execute the following steps: + + -Compile Load Balance VES agent + javac -cp <.:dependent jars> ./evel_javalibrary/att/com/loadbalance + In Eclipse right click on veslibrary/ves_javalibrary/evel_javalib2 application-> click Run As ->and select -> mvn build option then + ->select the configuration mvn clean install. + + -Run Load Balance VES agent + java -cp <.:dependent jars> evel_javalibrary.att.com.loadbalance.syslogData.java + In Eclipse right click on evel_javalibrary.att.com.loadbalance.syslogData.java class right click -> click Run As -> click Java application. + + 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 deleted file mode 100644 index 5400ba3..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/faultData.java +++ /dev/null @@ -1,286 +0,0 @@ -package evel_javalibrary.att.com.loadbalance; -/**************************************************************************//** - * @file - * Evel Fault Event class extends EvelHeader class - * - * This file implements the Evel Fault Event class which is intended to provide a - * simple wrapper around the complexity of AT&T's Vendor Event Listener API so - * that VNFs can use it to send Fault events. - * - * License - * ------- - * Unless otherwise specified, all software contained herein is - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *****************************************************************************/ - -import java.io.File; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import evel_javalibrary.att.com.AgentMain; -import evel_javalibrary.att.com.EvelBatch; -import evel_javalibrary.att.com.EvelFault; -import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES; -import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES; -import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES; -import evel_javalibrary.att.com.EvelHeader; -import evel_javalibrary.att.com.EvelHeader.PRIORITIES; - - - -public class faultData extends Thread{ - - static HashMap<String, String> fault_config = new HashMap<>(); - static HashMap<String, String> interface_config = new HashMap<>(); - - static HashMap<String, String> hm = new HashMap<>(); - - static String linkStart = ""; - static int linkCount; - - - static int gm_event_id = 1; - static String event_id1 = "fault"; - static String event_id = "00000000"; - static String event_id2=null; - - - static int bytes_in; - static int bytes_out; - static int packets_in; - static int packets_out; - - - static int falut_raised =0; - - - public void run() { - - String alarmCondition = "linkDown"; - String specificProblem = "Transmit-Receive issue"; - - Long start_epoch_microsec = 0L; - Long last_epoch_microsec = 0L; - - - MeasureData mdataThread = new MeasureData(); - hm = mdataThread.read_common_config_file(); - - read_fault_config_file(); - HashMap<String, String> intFaceMapFault = mdataThread.read_interface_config_file(); - int numOfInterfacesFalut = 0; - if( !intFaceMapFault.isEmpty() ) - numOfInterfacesFalut = intFaceMapFault.size(); - if( numOfInterfacesFalut <= 0) { - System.out.println("ERROR : Didn't find interfacess in config file, exiting thread"); - return; - } - - - HashMap falut_last_metrics = mdataThread.read_vpp_metrics(linkStart); - - while(true) { - //request_rate = rand()%10000; - //request_rate =2; - EvelBatch ebt = new EvelBatch(); - event_id2 = event_id1+ event_id+(gm_event_id++); -// EvelScalingMeasurement eveMeas = new EvelScalingMeasurement( Double.parseDouble(common_meas.get("measurementInterval")) , -// common_meas.get("eventName"), -// event_id2); - - EvelHeader header = new EvelHeader("", ""); - - - //EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, alarmCondition, specificProblem,EVEL_PRIORITY_MEDIUM, EVEL_SEVERITY_MAJOR,EVEL_SOURCE_HOST,EVEL_VF_STATUS_IDLE); - - EvelFault eveFalt = new EvelFault(fault_config.get("eventName"),event_id2, alarmCondition, specificProblem, - EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH, - EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, - EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD, - EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE); - - - - //EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, alarmCondition,specificProblem,1,1,3,1); - // EvelFault eveFalt = new EvelFault("eventName", "event_id2", "alarmCondition","specificProblem",1,1,3,1); - // EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, alarmCondition,specificProblem,1,1,3,1); - - for( String falut : intFaceMapFault.keySet() ) { - - HashMap falut_current_metrics = mdataThread.read_vpp_metrics(falut); - if( falut_current_metrics.size() !=4 ) { - System.out.println("ERROR:: Did't get vpp metrics for vNic "+falut); - continue; - } - - if (Integer.parseInt((String) falut_current_metrics.get("bytes_in")) - - Integer.parseInt((String) falut_last_metrics.get("bytes_in")) > 0) { - bytes_in = Integer.parseInt((String) falut_current_metrics.get("bytes_in")) - - Integer.parseInt((String) falut_last_metrics.get("bytes_in")); - } else { - bytes_in = 0; - } - - if (Integer.parseInt((String) falut_current_metrics.get("bytes_out")) - - Integer.parseInt((String) falut_last_metrics.get("bytes_out")) > 0) { - bytes_out = Integer.parseInt((String) falut_current_metrics.get("bytes_out")) - - Integer.parseInt((String) falut_last_metrics.get("bytes_out")); - } else { - bytes_out = 0; - } - - if (Integer.parseInt((String) falut_current_metrics.get("packets_in")) - - Integer.parseInt((String) falut_last_metrics.get("packets_in")) > 0) { - packets_in = Integer.parseInt((String) falut_current_metrics.get("packets_in")) - - Integer.parseInt((String) falut_last_metrics.get("packets_in")); - } else { - packets_in = 0; - } - - if (Integer.parseInt((String) falut_current_metrics.get("packets_out")) - - Integer.parseInt((String) falut_last_metrics.get("packets_out")) > 0) { - packets_out = Integer.parseInt((String) falut_current_metrics.get("packets_out")) - - Integer.parseInt((String) falut_last_metrics.get("packets_out")); - } else { - packets_out = 0; - } - - - - if((bytes_in < Integer.parseInt((String)fault_config.get("lowWaterMark")) || bytes_out < Integer.parseInt((String)fault_config.get("lowWaterMark")) || - packets_in < Integer.parseInt((String)fault_config.get("lowWaterMark")) || packets_out < Integer.parseInt((String)fault_config.get("lowWaterMark"))) && falut_raised == 0){ - - event_id2 = event_id1+ (gm_event_id++); - - if(eveFalt != null) { - - falut_raised =1; - eveFalt.evel_fault_interface_set(linkStart); - - if( hm.get("eventType")!=null) { - eveFalt.evel_fault_type_set(hm.get("eventType")); - - start_epoch_microsec = last_epoch_microsec; - last_epoch_microsec = System.nanoTime()/1000; - - eveFalt.evel_last_epoch_set(start_epoch_microsec); - eveFalt.evel_start_epoch_set(last_epoch_microsec); - - eveFalt.evel_fault_category_set("link"); - eveFalt.evel_fault_interface_set("My Interface"); - eveFalt.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); - eveFalt.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); - eveFalt.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); - eveFalt.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); - eveFalt.evel_nfVendorName_set(hm.get("nfVendorName").toString()); - eveFalt.evel_header_set_sourceid(true,hm.get("sourceId").toString()); - - eveFalt.evel_header_set_source_name(hm.get("sourceName").toString()); - eveFalt.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); - - } - - } - - }else if((bytes_in > Integer.parseInt((String)fault_config.get("lowWaterMark")) && bytes_out > Integer.parseInt((String)fault_config.get("lowWaterMark")) && - packets_in > Integer.parseInt((String)fault_config.get("lowWaterMark")) && packets_out > Integer.parseInt((String)fault_config.get("lowWaterMark"))) && falut_raised == 1) { - - - - event_id2 = event_id1+ (gm_event_id++); -// EvelHeader header = new EvelHeader("", ""); -// EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, "linkDown", "Transmit-Receive issue", header.priority, eveFalt.event_severity,eveFalt.event_source_type,eveFalt.vf_status); - - if(eveFalt != null) { - falut_raised =1; - - eveFalt.evel_fault_interface_set(linkStart); - System.out.println("Event type is "+hm.get("eventType") ); - if( hm.get("eventType")!=null) { - eveFalt.evel_fault_type_set(hm.get("eventType")); - - eveFalt.evel_fault_category_set("link"); - eveFalt.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); - eveFalt.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); - eveFalt.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); - eveFalt.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); - eveFalt.evel_nfVendorName_set(hm.get("nfVendorName").toString()); - eveFalt.evel_header_set_sourceid(true,hm.get("sourceId").toString()); - - eveFalt.evel_header_set_source_name(hm.get("sourceName").toString()); - eveFalt.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); - - } - - } - - - - } - - - try { - Thread.sleep(1000); - }catch(Exception e) {} - } - // ebt.addEvent(eveFalt); - AgentMain.evel_post_event(eveFalt); - System.out.println(" Event sent"); - - } - - - } - - - - - - - public static HashMap<String, String> read_fault_config_file() { - - List<String> list = new ArrayList<String>(); - - List<String> list_interface = new ArrayList<String>(); - - fault_config.put("eventName", ""); - fault_config.put("faultCheckInterval", ""); - fault_config.put("lowWaterMark", ""); - - //interface_config.put("lo", ""); - - try { - // File file = new File("/home/ves/users/admin/temp/fw_flt_config.txt"); - File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt"); - System.out.println("File path is..."+ file); - list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); - for (String lineSplit : list) { - String[] res = lineSplit.split(" "); - fault_config.put(res[0], res[1]); - } - - - } catch (Exception ex) { - ex.printStackTrace(); - } - System.out.println("KEYS:fault_config " + fault_config.keySet().size()); - System.out.println("VALUES:fault_config " + fault_config.values()); - return fault_config; - } - - - -} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/flt_config.json b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/flt_config.json new file mode 100644 index 0000000..edae8a6 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/flt_config.json @@ -0,0 +1,74 @@ +{ + "tmp_directParameters": { + "eventType": "applicationVnf", + "nfcNamingCode": "AFX", + "nfNamingCode": "AFX", + "nfVendorName": "AT&T", + "priority": "Low", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "timeZoneOffset": "UTC-05:30", + "vfStatus": "Idle", + "tmp_device": ["lo", "enp0s3", "docker0"] + + }, + "tmp_indirectParameters": { + "tmp_faultInstance01": { + "eventName": "Fault_vLoadbalance-AT&T_linkDownError", + "eventCategory": "link", + "eventSourceType": "router", + "tmp_init":{ + "tmp_t0BytesIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f2", + "tmp_t0BytesOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f10", + "tmp_t0PacketsIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f3", + "tmp_t0PacketsOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f11" + }, + "alarmInterfaceA": "$tmp_device", + "tmp_faultCheckInterval": 20, + "tmp_lowWaterMark": 1, + "tmp_command": { + "tmp_t1BytesIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f2", + "tmp_t1BytesOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f10", + "tmp_t1PacketsIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f3", + "tmp_t1PacketsOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f11" + }, + "tmp_BytesIn": "$(tmp_t1BytesIn - tmp_t0BytesIn)", + "tmp_PacketsIn": "$(tmp_t1PacketsIn - tmp_t0PacketsIn)", + "tmp_BytesOut": "$(tmp_t1BytesOut - tmp_t0BytesOut)", + "tmp_PacketsOut": "$(tmp_t1PacketsOut - tmp_t0PacketsOut)", + "tmp_alarmSetParameters": { + "specificProblem": "physical or logical connection to a remote router is down", + "eventSeverity": "MAJOR", + "alarmCondition": "link down trap_alarm" + }, + "tmp_alarmClearParameters": { + "specificProblem": "physical or logical connection to a remote router is up", + "eventSeverity": "NORMAL", + "alarmCondition": "link up trap_alarm" + } + }, + "tmp_faultInstance02": { + "eventName": "Fault_vLoadbalance-AT&T_serviceDownError", + "alarmInterfaceA": "afx@input.service", + "eventCategory": "other", + "eventSourceType": "virtualMachine", + "tmp_faultCheckInterval": 10, + "tmp_command": { + + "tmp_cmd1": "echo 1" + }, + "tmp_alarmSetParameters": { + "specificProblem": "service is down", + "eventSeverity": "MAJOR", + "alarmCondition": "service down trap_alarm" + }, + "tmp_alarmClearParameters": { + "specificProblem": "service is up", + "eventSeverity": "NORMAL", + "alarmCondition": "service up trap_alarm" + } + } + } +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt deleted file mode 100644 index e40b5b3..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt +++ /dev/null @@ -1,9 +0,0 @@ -eventType platform -nfcNamingCode ssc -nfNamingCode scfx -nfVendorName AT&T -reportingEntityId cc305d54-75b4-431b-adb2-eb6b9e541234 -reportingEntityName ibcx0001vm002oam001 -sourceId de305d54-75b4-431b-adb2-eb6b9e546014 -sourceName scfx0001vm002cap001 -timeZoneOffset UTC-05:30 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_config.txt deleted file mode 100644 index f730d6f..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_config.txt +++ /dev/null @@ -1,10 +0,0 @@ -eventName Measurement_vFirewall-AT&T_nicPerformance -eventType platform -nfcNamingCode ssc -nfNamingCode scfx -nfVendorName AT&T -reportingEntityId cc305d54-75b4-431b-adb2-eb6b9e541234 -reportingEntityName ibcx0001vm002oam001 -sourceId de305d54-75b4-431b-adb2-eb6b9e546014 -timeZoneOffset UTC-05:30 -measurementInterval 30 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt deleted file mode 100644 index 4b660ea..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt +++ /dev/null @@ -1,3 +0,0 @@ -eventName Fault_vFirewall-AT&T_linkDownError -faultCheckInterval 30 -lowWaterMark 100 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt deleted file mode 100644 index c288120..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt +++ /dev/null @@ -1,2 +0,0 @@ -eventName Heartbeat_vFirewall-AT&T_heartbeat -heartbeatInterval 20 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt deleted file mode 100644 index 46c3777..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt +++ /dev/null @@ -1,13 +0,0 @@ -lo DNS1_RSLOTPORT_VLAN_CLASSTYPE -bond0 DNS2_RSLOTPORT_VLAN_CLASSTYPE -bond0.4020 DNS3_RSLOTPORT_VLAN_CLASSTYPE -bond0.4020.4020 DNS4_RSLOTPORT_VLAN_CLASSTYPE -bond0.4021 DNS5_RSLOTPORT_VLAN_CLASSTYPE -bond0.4021.4021 DNS6_RSLOTPORT_VLAN_CLASSTYPE -ens3 DNS7_RSLOTPORT_VLAN_CLASSTYPE -ens4 DNS8_RSLOTPORT_VLAN_CLASSTYPE -ens5 DNS9_RSLOTPORT_VLAN_CLASSTYPE -ens6 DNSa_RSLOTPORT_VLAN_CLASSTYPE -ens7 DNSb_RSLOTPORT_VLAN_CLASSTYPE -docker0 DNSb_RSLOTPORT_VLAN_CLASSTYPE -enp0s3 DNSb_RSLOTPORT_VLAN_CLASSTYPE diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt deleted file mode 100644 index 7fac2f7..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt +++ /dev/null @@ -1,2 +0,0 @@ -eventName Measurement_vFirewall-AT&T_nicPerformance -measurementInterval 30 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/hb_config.json b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/hb_config.json new file mode 100644 index 0000000..c1b3a19 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/hb_config.json @@ -0,0 +1,15 @@ +{ + "tmp_directParameters": { + "eventName": "Heartbeat_vLoadbalance-AT&T_heartbeat", + "eventType": "platform", + "nfcNamingCode": "ssc", + "nfNamingCode": "scfx", + "nfVendorName": "AT&T", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "timeZoneOffset": "UTC-05:30", + "heartbeatInterval": 300 + } +} 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 deleted file mode 100644 index 9da7521..0000000 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/heartBeatData.java +++ /dev/null @@ -1,153 +0,0 @@ -package evel_javalibrary.att.com.loadbalance; -/**************************************************************************//** - * @file - * Heartbeat field class - * - * This file implements the Heartbeat Event class which is intended to provide a - * simple wrapper around the complexity of AT&T's Vendor Event Listener API so - * that VNFs can use it to send Agent status. - * - * License - * ------- - * Unless otherwise specified, all software contained herein is - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *****************************************************************************/ - -import java.io.File; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import javax.json.Json; -import javax.json.JsonArray; -import javax.json.JsonArrayBuilder; -import javax.json.JsonObject; -import javax.json.JsonObjectBuilder; - -import evel_javalibrary.att.com.AgentMain; -import evel_javalibrary.att.com.EvelBatch; -import evel_javalibrary.att.com.EvelHeartbeatField; - -public class heartBeatData extends Thread{ - - static HashMap<String, String> hm = new HashMap<>(); - static HashMap<String, String> hb_config = new HashMap<>(); - static int gm_event_id = 1; - static String event_id1 = "mvfs"; - static String event_id2=null; - - - public void run() { - - Long start_epoch_microsec = 0L; - Long last_epoch_microsec = 0L; - - MeasureData mdataThread = new MeasureData(); - hm = mdataThread.read_common_config_file(); - read_hb_config_file(); - - while(true) { - event_id2 = event_id1+ (gm_event_id++); - - - EvelHeartbeatField evelHb = new EvelHeartbeatField(Integer.parseInt(hb_config.get("heartbeatInterval")) , - hb_config.get("eventName"), - event_id2); - - if( hm.get("eventType")!=null) { - - start_epoch_microsec = last_epoch_microsec; - last_epoch_microsec = System.nanoTime()/1000; - - evelHb.evel_last_epoch_set(start_epoch_microsec); - evelHb.evel_start_epoch_set(last_epoch_microsec); - - evelHb.evel_header_type_set(hm.get("eventType").toString()); - evelHb.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); - evelHb.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); - evelHb.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); - evelHb.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); - evelHb.evel_nfVendorName_set(hm.get("nfVendorName").toString()); - evelHb.evel_header_set_sourceid(true,hm.get("sourceId").toString()); - evelHb.evel_header_set_source_name(hm.get("sourceName").toString()); - - evelHb.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); - - - JsonObject obj = Json.createObjectBuilder() - .add( "heartbeatFields",evelHeartbeatFieldObject() - ).build(); - - EvelBatch ebt = new EvelBatch(); - //ebt.addEvent(evelHb); - - - System.out.println(" Event sent..."+ obj.asJsonObject()); - System.out.println("Event sent...###########"); - AgentMain.evel_post_event(evelHb); - System.out.println(" Event sent..."); - } - - try { - Thread.sleep(1000); - }catch(Exception e) { - - } - } - } - - - JsonObjectBuilder evelHeartbeatFieldObject() - { - String version = "3.0"; - JsonObjectBuilder evelHeatbeat = Json.createObjectBuilder() - .add("heartbeatInterval", hb_config.get("heartbeatInterval")); - evelHeatbeat.add( "heartbeatFieldsVersion", version); - return evelHeatbeat; - } - - - public static HashMap<String, String> read_hb_config_file() { - - List<String> list = new ArrayList<String>(); - - hb_config.put("eventName", ""); - hb_config.put("heartbeatInterval", ""); - - - System.out.println("KEYS: " + hb_config.keySet().size()); - System.out.println("VALUES: " + hb_config.values()); - - try { - //File file = new File("/home/ves/users/admin/temp/fw_hb_config.txt"); - File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt"); - list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); - for (String lineSplit : list) { - String[] res = lineSplit.split(" "); - hb_config.put(res[0], res[1]); -// System.out.println("File reading after split ---" + res[0]); -// System.out.println("File reading after split second---" + res[1]); - } - } catch (Exception ex) { - ex.printStackTrace(); - } - System.out.println("KEYS:hb_config " + hb_config.keySet().size()); - System.out.println("VALUES:hb_config " + hb_config.values()); - return hb_config; - } - - - - -} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/meas_config.json b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/meas_config.json new file mode 100644 index 0000000..5d1a41e --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/meas_config.json @@ -0,0 +1,51 @@ +{ + "tmp_directParameters": { + "eventName": "Measurement_vFirewall-AT&T_nicPerformance", + "eventType": "applicationVnf", + "nfcNamingCode": "AFX", + "nfNamingCode": "AFX", + "nfVendorName": "AT&T", + "priority": "Low", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "timeZoneOffset": "UTC-05:30", + "measurementInterval": 25000, + "tmp_device": ["lo", "enp0s3","docker0"] + }, + "tmp_indirectParameters": { + "tmp_init":{ + "tmp_t0BytesIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f2", + "tmp_t0BytesOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f10", + "tmp_t0PacketsIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f3", + "tmp_t0PacketsOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f11" + }, + "vNicPerformance": [{ + "tmp_vnic_command": { + "tmp_t1BytesIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f2", + "tmp_t1BytesOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f10", + "tmp_t1PacketsIn": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f3", + "tmp_t1PacketsOut": "sudo cat /proc/net/dev | grep $tmp_device | tr -s ' ' | cut -d ':' -f2 | cut -d ' ' -f11" + }, + "receivedOctetsDelta": "$(tmp_t1BytesIn - tmp_t0BytesIn)", + "receivedTotalPacketsDelta": "$(tmp_t1PacketsIn - tmp_t0PacketsIn)", + "transmittedOctetsDelta": "$(tmp_t1BytesOut - tmp_t0BytesOut)", + "transmittedTotalPacketsDelta": "$(tmp_t1PacketsOut - tmp_t0PacketsOut)", + "valuesAreSuspect": "true", + "vNicIdentifier": "$tmp_device" + }], + "cpuUsage": [{ + "tmp_cpuuse_command": { + "tmp_cpuUseCmd": "/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 | cut -d ':' -f2", + "tmp_cpuIdle": "/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 |cut -d ':' -f2 | cut -d ',' -f4 | cut -b 1-5", + "tmp_cpuUsageSystem": "/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 |cut -d ':' -f2 | cut -d ',' -f2 | cut -b 1-5", + "tmp_cpuUsageUser": "/usr/bin/top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 |cut -d ':' -f2 | cut -d ',' -f1 | cut -b 1-5" + }, + "cpuIdentifier": "Cpu1", + "cpuIdle": "$tmp_cpuIdle", + "cpuUsageSystem": "$tmp_cpuUsageSystem", + "cpuUsageUser": "$tmp_cpuUsageUser" + }] + } +}
\ No newline at end of file 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 new file mode 100644 index 0000000..89fc89d --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslogData.java @@ -0,0 +1,274 @@ +package evel_javalibrary.att.com.loadbalance; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.UnknownHostException; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.apache.log4j.Level; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; +import evel_javalibrary.att.com.AgentMain; +import evel_javalibrary.att.com.EvelSyslog; +import evel_javalibrary.att.com.EvelFault; +import evel_javalibrary.att.com.EvelSyslog.EVEL_SYSLOG_FACILITIES; + +/**************************************************************************//** + * @file + * Syslog class + * + * This file implements the Measurement Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send CPU, Memory, Disk Measurements to Collector. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +public class syslogData extends Thread{ + + + static HashMap<String, String> syslogConfig = new HashMap<>(); + static String[] interfaceDevice =null; + + static String syslogInterval=""; + static String syslogFile =""; + static String tempCommand = ""; + static int gmEventId = 1; + static String eventId1 = "syslog"; + static String eventId = "00000000"; + static String eventId2=null; + + private static int linesReadFromFile =0; + + public void run() { + try { + readSyslogConfig(); + + } catch (IOException | ParseException e) {} + + while(true) { + String tagToCompare = syslogConfig.get("syslogTag").toString(); + + syslogFileRead(tagToCompare ); + + try { Thread.sleep(500);}catch(Exception e) {} + + } + } + + + public void sendSysLogEvent(String sysTag,String syslogMsg) { + Long start_epoch_microsec = 0L; + Long last_epoch_microsec = 0L; + String hostName = hostName(); + + eventId2 = eventId1+ eventId+(gmEventId++); + EvelSyslog eveSyslog = new EvelSyslog(syslogConfig.get("eventName"), + eventId2, EvelFault.EVEL_SOURCE_TYPES.EVEL_SOURCE_VIRTUAL_MACHINE, + syslogMsg, sysTag); + + if( syslogConfig.get("eventType")!=null) { + start_epoch_microsec = last_epoch_microsec; + last_epoch_microsec = System.nanoTime()/1000; + + eveSyslog.evel_last_epoch_set(start_epoch_microsec); + eveSyslog.evel_start_epoch_set(last_epoch_microsec); + + 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()); + 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_id_set(syslogConfig.get("reportingEntityId").toString()); + eveSyslog.evel_nfVendorName_set(syslogConfig.get("nfVendorName").toString()); + eveSyslog.evel_header_set_sourceid(true,syslogConfig.get("sourceId").toString()); + 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_timeZoneOffset_set(syslogConfig.get("timeZoneOffset").toString()); + } + + eveSyslog.evel_syslog_facility_set(EVEL_SYSLOG_FACILITIES.EVEL_SYSLOG_FACILITY_LOCAL0); + eveSyslog.evel_syslog_proc_set(syslogConfig.get("syslogProc").toString()); + + + + AgentMain.evel_post_event(eveSyslog); + + } + + public String syslogFileRead(String tagToCompare){ + String syslines =""; + int currentIndex = 0; + boolean compare = false; + + try { + + BufferedReader reader = new BufferedReader(new FileReader("/var/log/syslog")); + String line = reader.readLine(); + while (line != null) { + if( currentIndex == linesReadFromFile ) { + compare=true; + } + if( compare ) { + if( line.contains(tagToCompare) ) + sendSysLogEvent( tagToCompare, line); + } + currentIndex ++; + + line = reader.readLine(); + } + + if( compare ) + linesReadFromFile=currentIndex; + + + } catch (Exception ex) { + ex.printStackTrace(); + } + + return null; + } + + private final static char[] hexArray = "0123456789ABCDEF".toCharArray(); + private static String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for ( int j = 0; j < bytes.length; j++ ) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + return new String(hexChars); + } + + public static String hostName() { + String hostname = "Unknown"; + String uuid = "Unknown"; + try + { + InetAddress addr; + addr = InetAddress.getLocalHost(); + hostname = addr.getHostName(); + } + catch (UnknownHostException ex) + { + + } + try{ + Enumeration<NetworkInterface> networks = + NetworkInterface.getNetworkInterfaces(); + while(networks.hasMoreElements()) { + NetworkInterface network = networks.nextElement(); + byte[] mac = network.getHardwareAddress(); + + if(hostname.equalsIgnoreCase("unknown")) + { + Enumeration inetAddrs = network.getInetAddresses(); + while(inetAddrs.hasMoreElements()){ + InetAddress inetAddr = (InetAddress) inetAddrs.nextElement(); + if (!inetAddr.isLoopbackAddress()) { + hostname = inetAddr.getHostAddress(); + break; + } + } + } + if (mac != null) { + uuid = bytesToHex(mac); + } + } + } catch (SocketException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return hostname; + } + + + public static HashMap<String, String> readSyslogConfig() throws IOException, ParseException { + + JSONParser jsonParser = new JSONParser(); + try { + + FileReader reader = new FileReader("./src/main/java/evel_javalibrary/att/com/loadbalance/syslog_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("="); + syslogConfig.put(directres[0], directres[1]); + + } + //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("="); + syslogConfig.put(indirectres[0], indirectres[1]); + } + syslogFile = syslogConfig.get("tmp_syslogFile").toString(); + } catch (ClassCastException ex) { + ex.printStackTrace(); + } + return syslogConfig; + } + + + public static void main(String[] args) { + // TODO Auto-generated method stub + + try { + AgentMain.evel_initialize("http://127.0.0.1",30000, + null,null, + "will", + "pill", + null, null, null, + "http://127.0.0.1",30001, "will", + "pill", + Level.TRACE); + }catch(Exception e) { + e.printStackTrace(); + return; + } + syslogData syslogDataThread = new syslogData(); + syslogDataThread.start(); + } + + + + +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslog_config.json b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslog_config.json new file mode 100644 index 0000000..6b598b1 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/syslog_config.json @@ -0,0 +1,20 @@ +{ + "tmp_directParameters": { + "eventName": "syslog_vLoadbalance-AT&T_connectionReset", + "eventType": "applicationVnf", + "nfcNamingCode": "AFX", + "nfNamingCode": "AFX", + "nfVendorName": "AT&T", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "timeZoneOffset": "UTC-05:30", + "eventSourceType": "virtualMachine", + "syslogProc": "vSyslog", + "syslogTag": "INSECURE MODE" + }, + "tmp_indirectParameters": { + "tmp_syslogFile": "/var/log/syslog" + } +}
\ No newline at end of file diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/maindir/Main.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/maindir/Main.java index 96da88a..13a5066 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/maindir/Main.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/maindir/Main.java @@ -43,12 +43,12 @@ import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_FEATURE_USE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_FSYS_USE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_HUGE_PAGE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI; -import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.MEASUREMENT_IPMI_PROCESSOR; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LATENCY_BUCKET; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LOAD; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_MEM_USE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_NIC_PERFORMANCE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_PROCESS_STATS; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.MEASUREMENT_IPMI_PROCESSOR; import evel_javalibrary.att.com.EvelStateChange.EVEL_ENTITY_STATE; import evel_javalibrary.att.com.EvelSyslog.EVEL_SYSLOG_FACILITIES; import evel_javalibrary.att.com.EvelThresholdCross.EVEL_ALERT_TYPE; @@ -69,44 +69,45 @@ public class Main { try{ - AgentMain.evel_initialize("http://127.0.0.1", 30000, + AgentMain.evel_initialize("http://127.0.0.1",30000, // "http://1.2.3.4", 8080, //"/vendor_event_listener","/example_vnf", null,null, "will", "pill", null, null, null, + "http://127.0.0.1",30001, "will", + "pill", //"/home/gokul/newwk/demo/vnfs/VES5.0/evel/sslcerts2/my-keystore.jks", "changeit", "changeit", Level.TRACE); } catch( Exception e ) - { - e.printStackTrace(); + { } - for(int i= 0; i < 2; i++) //srikanth no need for forloop , send only once. + for(int i= 0; i < 30; i++) //srikanth no need for forloop , send only once. { EvelHeader 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"); -// -// -// -// -// AgentMain.evel_post_event(header); + header.evel_nfnamingcode_set("vVNF"); + header.evel_nfcnamingcode_set("vVNF"); + header.evel_timeZoneOffset_set("UTC+5:30"); + + + + + // AgentMain.evel_post_event(header); try { - Thread.sleep(1); + Thread.sleep(1000); } catch( Exception e ) { - e.printStackTrace(); + } EvelBatch be = new EvelBatch(); - + EvelFault flt = new EvelFault("Fault_vVNF", "vmname_ip", "My alaram condition", "It broke very badly", EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH, @@ -117,32 +118,12 @@ public class Main flt.evel_fault_addl_info_add("name2", "value2"); flt.evel_fault_interface_set("My Interface Card"); flt.evel_fault_category_set("link"); - AgentMain.evel_post_event(flt); - - -// 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"); -// AgentMain.evel_post_event(flt3); -// be.addEvent(flt3); + + + // be.addEvent(flt); + AgentMain.evel_post_event(flt); + + /* @@ -154,18 +135,41 @@ public class Main EvelStateChange.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.addEvent(stc); + AgentMain.evel_post_event(stc); /* * State Change End * */ + + 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); + + AgentMain.evel_post_event(notification); + + +/* +* notification Change End +* */ + EvelScalingMeasurement sm = new EvelScalingMeasurement(10.0,"Measurements_vVNF", "vmname_ip"); - sm.evel_measurement_myerrors_set(10,20,30,40); + // sm.evel_measurement_myerrors_set(10,20,30,40); sm.evel_measurement_concurrent_sessions_set(5); sm.evel_measurement_config_entities_set(9); @@ -248,7 +252,7 @@ public class Main sm.evel_measurement_disk_use_timewritemax_set(diskuse, 10.1); sm.evel_measurement_disk_use_timewritemin_set(diskuse, 10.1); - MEASUREMENT_FEATURE_USE featureuse = sm.evel_measurement_feature_use_add("featureuse", 100); + MEASUREMENT_FEATURE_USE featureuse = sm.evel_measurement_feature_use_add("features", 100); MEASUREMENT_HUGE_PAGE husePage= sm.evel_measurement_new_huge_page_add("HUGEPage1", 100000); sm.evel_measurement_huge_page_bytesFree_set(husePage, 1100000); @@ -257,8 +261,7 @@ public class Main sm.evel_measurement_huge_page_vmPageNumberFree_set(husePage, 3000); sm.evel_measurement_huge_page_vmPageNumberUsed_set(husePage, 4000); - - + MEASUREMENT_MEM_USE memuse = sm.evel_measurement_new_mem_use_add("memuse", 100.0); sm.evel_measurement_mem_use_memcache_set(memuse, 51.1); sm.evel_measurement_mem_use_memconfig_set(memuse, 51.1); @@ -266,6 +269,7 @@ public class Main sm.evel_measurement_mem_use_slab_reclaimed_set(memuse, 51.1); sm.evel_measurement_mem_use_slab_unreclaimable_set(memuse, 51.1); sm.evel_measurement_mem_use_usedup_set(memuse, 51.1); + sm.evel_measurement_mem_use_memoryDemand_set(memuse, 51.1); sm.evel_measurement_mem_use_memoryLatencyAvg_set(memuse, 51.1); sm.evel_measurement_mem_use_memorySharedAvg_set(memuse, 51.1); @@ -277,6 +281,7 @@ public class Main + MEASUREMENT_LATENCY_BUCKET latecy = sm.evel_measurement_latency_add(10000, 2000, 3000); sm.evel_meas_latency_bucket_low_end_set(latecy, 10); sm.evel_meas_latency_bucket_high_end_set(latecy, 20); @@ -284,14 +289,48 @@ public class Main MEASUREMENT_FSYS_USE fileuse = sm.evel_measurement_fsys_use_add("FileSystem", 10.0, 2.8, 2.4, 3.3, 5.5, 9.0); - MEASUREMENT_NIC_PERFORMANCE vnic = sm.evel_measurement_new_vnic_performance("vnic1","true"); - vnic.recvd_bcast_packets_acc.SetValue(2400000.0); - vnic.recvd_mcast_packets_delta.SetValue(5677888.0); - vnic.recvd_mcast_packets_acc.SetValue(5677888.0); - vnic.tx_ucast_packets_acc.SetValue(547856576.0); - vnic.tx_ucast_packets_delta.SetValue(540000.0); + MEASUREMENT_NIC_PERFORMANCE vnic = sm.evel_measurement_new_vnic_performance("VNicIdentifiew", "false"); + + sm.evel_vnic_performance_rx_bcast_pkt_acc_set(vnic, 1000.0); + sm.evel_vnic_performance_rx_bcast_pkt_delta_set(vnic, 200.0); + sm.evel_vnic_performance_rx_discard_pkt_acc_set(vnic, 300.0); + sm.evel_vnic_performance_rx_discard_pkt_delta_set(vnic, 400.0); + sm.evel_vnic_performance_rx_error_pkt_acc_set(vnic, 500.0); + sm.evel_vnic_performance_rx_error_pkt_delta_set(vnic, 600.0); + sm.evel_vnic_performance_rx_mcast_pkt_acc_set(vnic, 700.0); + sm.evel_vnic_performance_rx_mcast_pkt_delta_set(vnic, 800.0); + sm.evel_vnic_performance_rx_octets_acc_set(vnic, 900.0); + sm.evel_vnic_performance_rx_octets_delta_set(vnic, 3400.0); + + sm.evel_vnic_performance_rx_total_pkt_acc_set(vnic, 67.9); + sm.evel_vnic_performance_rx_total_pkt_delta_set(vnic, 37.8); + sm.evel_vnic_performance_rx_ucast_pkt_acc_set(vnic, 234.7); + sm.evel_vnic_performance_rx_ucast_pkt_delta_set(vnic, 457.9); + sm.evel_vnic_performance_tx_bcast_pkt_acc_set(vnic, 76.4); + sm.evel_vnic_performance_tx_bcast_pkt_delta_set(vnic, 65.9); + sm.evel_vnic_performance_tx_discarded_pkt_acc_set(vnic, 76.87); + sm.evel_vnic_performance_tx_discarded_pkt_delta_set(vnic, 45.98); + sm.evel_vnic_performance_tx_error_pkt_acc_set(vnic, 54.98); + sm.evel_vnic_performance_tx_error_pkt_delta_set(vnic, 22.90); + sm.evel_vnic_performance_tx_mcast_pkt_acc_set(vnic, 22.8); + sm.evel_vnic_performance_tx_mcast_pkt_delta_set(vnic, 22.8); + sm.evel_vnic_performance_tx_octets_acc_set(vnic, 33.3); + sm.evel_vnic_performance_tx_octets_delta_set(vnic, 33.9); + sm.evel_vnic_performance_tx_total_pkt_acc_set(vnic, 23.9); + sm.evel_vnic_performance_tx_total_pkt_delta_set(vnic, 65.9); + sm.evel_vnic_performance_tx_ucast_pkt_acc_set(vnic, 23.9); + sm.evel_vnic_performance_tx_ucast_pkt_delta_set(vnic, 44.9); + sm.evel_vnic_performance_administrativeState_set(vnic, "inService"); + sm.evel_vnic_performance_operationalState_set(vnic, "inService"); + sm.evel_vnic_performance_receivedPercentDiscard_set(vnic, 12.0); + sm.evel_vnic_performance_receivedPercentError_set(vnic, 13.0); + sm.evel_vnic_performance_receivedUtilization_set(vnic, 14.01); + sm.evel_vnic_performance_speed_set(vnic, 12.99); + sm.evel_vnic_performance_transmittedPercentDiscard_set(vnic, 98.9); + sm.evel_vnic_performance_transmittedPercentError_set(vnic, 23.9); + sm.evel_vnic_performance_transmittedUtilization_set(vnic, 23.9); + - sm.evel_meas_vnic_performance_add(vnic); MEASUREMENT_CODEC_USE codecuse = sm.evel_measurement_codec_use_add("codecuse", 100); @@ -319,37 +358,64 @@ public class Main sm.evel_measurement_addl_info_add("name", "value"); + MEASUREMENT_IPMI ipmi = sm.evel_measurement_new_ipmis_add(); - sm.evel_measurement_ipmi_exitAirTemperature_set(ipmi, 10.0); - sm.evel_measurement_ipmi_frontPanelTemperature_set(ipmi, 11.0); - sm.evel_measurement_ipmi_ioModuleTemperature_set(ipmi, 12.2); - sm.evel_measurement_ipmi_systemAirflow_set(ipmi, 13.4); + ipmi.evel_meas_ipmi_add(ipmi,10.2, 10.2, 10.2, 10.2); + + // ipmi.evel_measurement_ipmi_exitAirTemperature_set(ipmi, 10.0); +// ipmi.evel_measurement_ipmi_frontPanelTemperature_set(ipmi, 11.0); +// ipmi.evel_measurement_ipmi_ioModuleTemperature_set(ipmi, 12.2); +// ipmi.evel_measurement_ipmi_systemAirflow_set(ipmi, 13.4); - ipmi.evel_measurement_IPMI_MEASUREMENT_IPMI_PROCESSOR_add("ProcessorIdentifier"); - ipmi.evel_measurement_IPMIbaseboardTemperature_add("IPMIbaseboardTemperature"); - ipmi.evel_measurement_IPMIbaseboardvoltageResulator_add("IPMIbaseboardvoltageRegulator"); - ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add("IPMIbattery"); - ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add("powerSupplyIdentifier"); - ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add("AggregateTemperatureMargin"); - ipmi.evel_measurement_IPMINIC_add("nic_Identifier"); - ipmi.evel_measurement_IPMIHSBP_add("hsbpIdentifier"); - ipmi.evel_measurement_IPMIfan_add("fanIdentifier"); + MEASUREMENT_IPMI_PROCESSOR proc = ipmi.evel_measurement_IPMI_MEASUREMENT_IPMI_PROCESSOR_add("Proc1", 11.008); + + + + proc.getProcessorDIMMaggregateThermalMargin("ThermID1", 23.45); + proc.getProcessorDIMMaggregateThermalMargin("ThermID2", 65.45); + ipmi.evelMeasurementIpmiProcessorAdd("IPMIPro",10.000,12.000,"DIMM1",90.000); + ipmi.evelMeasurementIpmiProcessorAdd("IPMIPro",10.000,12.000,"DIMM1",90.000); + + + ipmi.evel_measurement_IPMIbaseboardTemperature_add("IPMIbaseboardTemperature", 10.001); + ipmi.evel_measurement_IPMIbaseboardTemperature_add("IPMIbaseboardTemperature2", 3445.0033); + + + ipmi.evel_measurement_IPMIbaseboardvoltageResulator_add("IPMIbaseboardvoltageRegulator", 12.000); + ipmi.evel_measurement_IPMIbaseboardvoltageResulator_add("IPMIbaseboardvoltageRegulator2", 99.000089); + + + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add("IPMIbattery", "BatteryType", 123.00); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add("IPMIbattery2", "BatteryType2", 123.11); + + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add("PowerSupply", 19.000, 23.000, 34.000); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add("PowerSupply2", 11.002, 33.44, 90.0001); + + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add("AggregateTemperatureMargin",14.00000); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add("AggregateTemperatureMargin2",14.1111); + + ipmi.evel_measurement_IPMINIC_add("nic_Identifier", 10.000); + ipmi.evel_measurement_IPMINIC_add("nic_Identifier2", 1111.011); + ipmi.evel_measurement_IPMIHSBP_add("hsbpIdentifier", 10.990); + ipmi.evel_measurement_IPMIHSBP_add("hsbpIdentifier2", 12.990); + ipmi.evel_measurement_IPMIfan_add("fanIdentfier", 10.000); + ipmi.evel_measurement_IPMIfan_add("fanIdentfier2", 21.077); + sm.evel_measurement_custom_measurement_add("Measurement", "name", "value"); - //sm.evel_meas_ipmi_add(ipmi); srikant , impi has added above, no need add here - -// cpuuse.steal.SetValue(34.0); -// cpuuse.user.SetValue(32.0); -// sm.evel_measurement_custom_measurement_add("group1","name1","val1"); -// sm.evel_measurement_custom_measurement_add("group1","name2","val2"); -// sm.evel_measurement_custom_measurement_add("group2","name1","val1"); -// sm.evel_measurement_custom_measurement_add("group2","name2","val2"); + + sm.evel_measurement_custom_measurement_add("group1","name1","val1"); + sm.evel_measurement_custom_measurement_add("group1","name2","val2"); + sm.evel_measurement_custom_measurement_add("group2","name1","val1"); + sm.evel_measurement_custom_measurement_add("group2","name2","val2"); - // be.addEvent(sm); - // AgentMain.evel_post_event(be); + sm.evel_measurement_addl_info_add("name", "value"); + sm.evel_measurement_addl_info_add("name", "value"); + // be.addEvent(sm); + AgentMain.evel_post_event(sm); @@ -361,7 +427,7 @@ public class Main - AgentMain.evel_post_event(sm); + @@ -387,13 +453,14 @@ public class Main sysl.evel_syslog_severity_set("Data"); sysl.evel_syslog_version_set(20); sysl.evel_syslog_msghost_set("Host@msg"); + sysl.evel_syslogTs_set("SyslogTs"); + sysl.evel__syslog_addl_info_add("name1", "value1"); sysl.evel__syslog_addl_info_add("name2", "value2"); - AgentMain.evel_post_event(sysl); - - //be.addEvent(sysl); + // be.addEvent(sysl); + AgentMain.evel_post_event(sysl); /* * Ves6.0 Updated 15/07/2018 */ @@ -406,23 +473,7 @@ public class Main * */ - 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"); - - AgentMain.evel_post_event(notification); - - - - -/* - * notification Change End - * */ + @@ -430,10 +481,10 @@ public class Main 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("FF:28:22:34:45:56"); + 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("100.10.10"); + pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("localhost"); pnfRegistration.evel_pnfRegistration_softwareVersion_set("SW1234"); @@ -441,8 +492,8 @@ public class Main pnfRegistration.evel_pnfRegistration_unitFamily_set("unitFamily222"); pnfRegistration.evel_pnfRegistration_unitType_set("unitType1"); - pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("10.255.1.254"); - pnfRegistration.evel_pnrregistration_add_oamV6IpAddress_set("10.100.100.254"); + pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("localhost"); + pnfRegistration.evel_pnrregistration_add_oamV6IpAddress_set("localhost"); pnfRegistration.evel_pnfRegistration_vendorName_set("Vend_nam_123"); @@ -450,9 +501,10 @@ public class Main pnfRegistration.evel_pnrregistration_addl_info_add("Name2", "value2"); - AgentMain.evel_post_event(pnfRegistration); + - // be.addEvent(pnfRegistration); + // be.addEvent(pnfRegistration); + AgentMain.evel_post_event(pnfRegistration); /* * EvelPnfRegistration Change End @@ -461,23 +513,26 @@ public class Main EvelHeartbeatField hfld = new EvelHeartbeatField(123,"HeartbeatField_vVNF", "1"); hfld.evel_hrtbt_interval_set(100); hfld.evel_timeZoneOffset_set("UTC+5:30"); + hfld.evel_hrtbt_field_addl_info_add("Name", "Value"); + // be.addEvent(hfld); AgentMain.evel_post_event(hfld); + /* * EvelHeartbeatField Change End * */ - EvelSipSignaling sip = new EvelSipSignaling("SipSignaling_vVNF", "vmname_ip","aricent","corlator","127.0.0.1","5647","10.1.1.124","5678"); - - + 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"); - AgentMain.evel_post_event(sip); - - // be.addEvent(sip); + sip.evel_signaling_compressed_sip_set("CompressedIP"); + sip.evel_signaling_summary_sip_set("SummarySip"); + + // be.addEvent(sip); + AgentMain.evel_post_event(sip); /* * EvelSipSignaling Change End * */ @@ -491,15 +546,16 @@ public class Main vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 20, 30, 40, 50, 60, 70, 80, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 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"); - AgentMain.evel_post_event(vq); - // be.addEvent(vq); + // be.addEvent(vq); + AgentMain.evel_post_event(vq); /* * EvelVoiceQuality Change End @@ -516,16 +572,15 @@ public class Main 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"); - AgentMain.evel_post_event(ev); + - // be.addEvent(ev); - + // be.addEvent(ev); + AgentMain.evel_post_event(ev); /* * EvelOther Change End * */ - String dateStart = "01/14/2012 09:29:58"; String dateStop = "01/15/2012 10:31:48"; @@ -539,7 +594,7 @@ public class Main d1 = format.parse(dateStart); d2 = format.parse(dateStop); }catch (Exception e) { - e.printStackTrace(); + } EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip", "CRIT", "mcastRxPackets", EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_CLEAR, @@ -566,10 +621,10 @@ public class Main tca.evel_thresholdcross_alertid_add("alert3"); tca.evel_thresholdcross_hashMap_add("hashName", "hashValue"); - AgentMain.evel_post_event(tca); - // be.addEvent(tca); + // be.addEvent(tca); + AgentMain.evel_post_event(tca); @@ -584,9 +639,9 @@ public class Main null, "GTP", "v2.3", - "1.2.3.4", + "localhost", 345556, - "5.6.7.8", + "localhost", 334344); MOBILE_GTP_PER_FLOW_METRICS mygtp = mf.new MOBILE_GTP_PER_FLOW_METRICS( 1.01, @@ -622,6 +677,21 @@ public class Main 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); @@ -630,20 +700,39 @@ public class Main 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_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); AgentMain.evel_post_event(mf); - // be.addEvent(mf); - // AgentMain.evel_post_event(be); + /* * EvelMobileFlow Change End @@ -651,8 +740,9 @@ public class Main } //srikanth no need for forloop , send only once. + - AgentMain.evel_shutdown(); + AgentMain.evel_shutdown(); } } 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 d1dd3d4..f7b7c51 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java @@ -20,6 +20,14 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + import evel_javalibrary.att.com.*; import evel_javalibrary.att.com.AgentMain.EVEL_ERR_CODES; import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES; @@ -27,23 +35,25 @@ import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES; import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES; import evel_javalibrary.att.com.EvelHeader.PRIORITIES; import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS; +import evel_javalibrary.att.com.EvelScalingMeasurement.MACHINE_CHECK_EXCEPTION; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CODEC_USE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CPU_USE; -import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_MEM_USE; -import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LATENCY_BUCKET; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_DISK_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_FEATURE_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_FSYS_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_HUGE_PAGE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LATENCY_BUCKET; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LOAD; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_MEM_USE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_NIC_PERFORMANCE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_PROCESS_STATS; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.MEASUREMENT_IPMI_PROCESSOR; import evel_javalibrary.att.com.EvelStateChange.EVEL_ENTITY_STATE; +import evel_javalibrary.att.com.EvelSyslog.EVEL_SYSLOG_FACILITIES; import evel_javalibrary.att.com.EvelThresholdCross.EVEL_ALERT_TYPE; import evel_javalibrary.att.com.EvelThresholdCross.EVEL_EVENT_ACTION; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; @@ -83,7 +93,8 @@ public class TestJunit { //evel init try { - mymainmock.evel_initialize( "http://127.0.0.1", 30000, "/vendor_event_listener", "/example_vnf", null, null,null, "pill", "will", Level.DEBUG); + mymainmock.evel_initialize( "http://127.0.0.1", 30000, "/vendor_event_listener", "/example_vnf", null, null,null, "pill", "will","http://127.0.0.1",30001, "will", + "pill", Level.DEBUG); } catch ( Exception e ) { e.printStackTrace(); @@ -97,18 +108,30 @@ 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"); when(mymainmock.evel_post_event(header)).thenReturn(true); boolean ret = mymainmock.evel_post_event(header); LOG.info("Returned "+ret); assertTrue( ret ); + } + @Test + public void testHeartbeatField() { + 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 ); + + } @Test public void testFault() { - EvelFault flt = new EvelFault("Fault_vVNF", "vmname_ip", - "NIC error", "Hardware failed", + EvelFault flt = 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, @@ -118,6 +141,8 @@ public class TestJunit { flt.evel_fault_category_set("intftype"); flt.evel_fault_interface_set("eth0"); 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); @@ -166,28 +191,92 @@ public class TestJunit { assertTrue( ret ); } + @Test public void testMeasurement() { EvelScalingMeasurement sm = new EvelScalingMeasurement(10.0,"Measurements_vVNF", "vmname_ip"); - sm.evel_measurement_type_set("dummy"); - sm.evel_measurement_addl_info_add("meas1","value1"); - sm.evel_measurement_addl_info_add("meas2","value2"); - sm.evel_measurement_concurrent_sessions_set(3); - sm.evel_measurement_config_entities_set(3); - sm.evel_measurement_myerrors_set(10,20,30,40); - sm.evel_measurement_mean_req_lat_set(123.0); - sm.evel_measurement_request_rate_set(12); - MEASUREMENT_CPU_USE my1 = sm.evel_measurement_new_cpu_use_add("cpu1", 100.0); - my1.idle.SetValue(20.0); - my1.sys.SetValue(21.0); - MEASUREMENT_CPU_USE my2 = sm.evel_measurement_new_cpu_use_add("cpu2", 10.0); - my2.steal.SetValue(34.0); - my2.user.SetValue(32.0); - sm.evel_measurement_custom_measurement_add("group1","name1","val1"); - sm.evel_measurement_custom_measurement_add("group1","name2","val2"); - sm.evel_measurement_custom_measurement_add("group2","name1","val1"); - sm.evel_measurement_custom_measurement_add("group2","name2","val2"); + sm.evel_measurement_concurrent_sessions_set(5); + sm.evel_measurement_config_entities_set(9); + sm.evel_measurement_mean_req_lat_set(13.6); + sm.evel_measurement_request_rate_set(1234); + sm.evel_measurement_vnfc_scaling_metric_set(35); + sm.evel_measurement_media_port_use_set(20); + + MEASUREMENT_CPU_USE cpuuse = sm.evel_measurement_new_cpu_use_add("cpu2", 10.0); + sm.evel_measurement_cpu_use_cpuCapacityContention_set(cpuuse, 11.3); + sm.evel_measurement_cpu_use_cpuDeamandAvg_set(cpuuse, 11.4); + sm.evel_measurement_cpu_use_cpuDeamandPct_set(cpuuse, 11.6); + sm.evel_measurement_cpu_use_cpuDeamandMhz_set(cpuuse, 11.8); + sm.evel_measurement_cpu_use_cpuLatencyAvg_set(cpuuse, 11.9); + sm.evel_measurement_cpu_use_cpuOverheadAvg_set(cpuuse, 12.2); + sm.evel_measurement_cpu_use_cpuSwapWaitTime_set(cpuuse, 13.2); + sm.evel_measurement_cpu_use_idle_set(cpuuse, 14.2); + sm.evel_measurement_cpu_use_interrupt_set(cpuuse, 15.2); + sm.evel_measurement_cpu_use_nice_set(cpuuse, 16.2); + sm.evel_measurement_cpu_use_softirq_set(cpuuse, 17.2); + sm.evel_measurement_cpu_use_steal_set(cpuuse, 18.2); + sm.evel_measurement_cpu_use_system_set(cpuuse, 19.2); + sm.evel_measurement_cpu_use_usageuser_set(cpuuse, 18.9); + sm.evel_measurement_cpu_use_wait_set(cpuuse, 19.9); + + + MEASUREMENT_DISK_USE diskuse = sm.evel_measurement_new_disk_use_add("100"); + sm.evel_measurement_disk_use_diskWeightedIoTimeAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWeightedIoTimeLast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWeightedIoTimeMax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWeightedIoTimeMin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskBusResets_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskCommandsAborted_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskCommandsAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskFlushRequests_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskReadCommandsAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskFlushTime_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskTime_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskTotalReadLatencyAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskTotalWriteLatencyAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWriteCommandsAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimeavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewritemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswritemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswritemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopsavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopslast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopsmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopsmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewritemin_set(diskuse, 10.1); + JsonObjectBuilder jsonObjBld1 = Json.createObjectBuilder() .add("trackIdentifier", 12345) @@ -225,88 +314,172 @@ public class TestJunit { JsonObject custom2 = jsonObjBld2.build(); sm.evel_measurement_add_jsonobj(custom2); - sm.evel_measurement_cpu_use_idle_set(my1,0.5); - sm.evel_measurement_cpu_use_interrupt_set(my1,0.5); - sm.evel_measurement_cpu_use_nice_set(my1,0.5); - sm.evel_measurement_cpu_use_softirq_set(my1,0.5); - sm.evel_measurement_cpu_use_steal_set(my1,0.5); - sm.evel_measurement_cpu_use_system_set(my1,0.5); - sm.evel_measurement_cpu_use_usageuser_set(my1,0.5); - - MEASUREMENT_MEM_USE mym1 = sm.evel_measurement_new_mem_use_add("mem1",123456.0); - sm.evel_measurement_mem_use_memcache_set(mym1, 456.); - sm.evel_measurement_mem_use_memconfig_set(mym1, 456.); - sm.evel_measurement_mem_use_memfree_set(mym1, 456.); - sm.evel_measurement_mem_use_slab_reclaimed_set(mym1, 456.); - sm.evel_measurement_mem_use_slab_unreclaimable_set(mym1, 456.); - sm.evel_measurement_mem_use_usedup_set(mym1, 456.); - - MEASUREMENT_DISK_USE dsk = sm.evel_measurement_new_disk_use_add("disk1"); - sm.evel_measurement_disk_use_iotimeavg_set(dsk, 1.0); - sm.evel_measurement_disk_use_iotimelast_set(dsk, 1.0); - sm.evel_measurement_disk_use_iotimemax_set(dsk, 100.0); - sm.evel_measurement_disk_use_mergereadavg_set(dsk, 67.); - sm.evel_measurement_disk_use_mergereadlast_set(dsk, 67.); - sm.evel_measurement_disk_use_mergereadmax_set(dsk, 678.); - sm.evel_measurement_disk_use_mergereadmin_set(dsk, 678.); - sm.evel_measurement_disk_use_mergewritelast_set(dsk,456.); - sm.evel_measurement_disk_use_mergewritemax_set(dsk,678.); - sm.evel_measurement_disk_use_mergewritemin_set(dsk,67.); - sm.evel_measurement_disk_use_octetsreadavg_set(dsk,65.); - sm.evel_measurement_disk_use_octetsreadlast_set(dsk,78.); - sm.evel_measurement_disk_use_octetsreadmax_set(dsk,56.); - sm.evel_measurement_disk_use_octetsreadmin_set(dsk,345.); - sm.evel_measurement_disk_use_octetswriteavg_set(dsk,34.); - sm.evel_measurement_disk_use_octetswritelast_set(dsk,676.); - sm.evel_measurement_disk_use_octetswritemax_set(dsk, 56.); - sm.evel_measurement_disk_use_octetswritemin_set(dsk,678.); - sm.evel_measurement_disk_use_opsreadavg_set(dsk,67.); - sm.evel_measurement_disk_use_opsreadlast_set(dsk,33.); - sm.evel_measurement_disk_use_opsreadmax_set(dsk,678.); - sm.evel_measurement_disk_use_opsreadmin_set(dsk,23.); - sm.evel_measurement_disk_use_opswriteavg_set(dsk,23.); - sm.evel_measurement_disk_use_opswritelast_set(dsk,23.); - sm.evel_measurement_disk_use_opswritemax_set(dsk,23.); - sm.evel_measurement_disk_use_opswritemin_set(dsk,23.); - - sm.evel_measurement_disk_use_pendingopsavg_set(dsk,23.); - sm.evel_measurement_disk_use_pendingopslast_set(dsk,23.); - sm.evel_measurement_disk_use_pendingopsmax_set(dsk,23.); - sm.evel_measurement_disk_use_pendingopsmin_set(dsk,23.); - - sm.evel_measurement_disk_use_timereadavg_set(dsk,45.); - sm.evel_measurement_disk_use_timereadlast_set(dsk,45.); - sm.evel_measurement_disk_use_timereadmax_set(dsk,45.); - sm.evel_measurement_disk_use_timereadmin_set(dsk,45.); - - sm.evel_measurement_disk_use_timewriteavg_set(dsk,45.); - sm.evel_measurement_disk_use_timewritelast_set(dsk,45.); - sm.evel_measurement_disk_use_timewritemax_set(dsk,45.); - sm.evel_measurement_disk_use_timewritemin_set(dsk,45.); - - - MEASUREMENT_NIC_PERFORMANCE vnic_p = sm.evel_measurement_new_vnic_performance("vnic1","true"); - vnic_p.recvd_bcast_packets_acc.SetValue(2400000.0); - vnic_p.recvd_mcast_packets_delta.SetValue(5677888.0); - vnic_p.recvd_mcast_packets_acc.SetValue(5677888.0); - vnic_p.tx_ucast_packets_acc.SetValue(547856576.0); - vnic_p.tx_ucast_packets_delta.SetValue(540000.0); - sm.evel_meas_vnic_performance_add(vnic_p); - sm.evel_measurement_fsys_use_add("fs1",40000.0, 5678.0, 5432.0,45.0,67.0,78.0); - sm.evel_measurement_feature_use_add("latefeature",40); - sm.evel_measurement_codec_use_add("codec",41); - - MEASUREMENT_LATENCY_BUCKET myb = sm.evel_new_meas_latency_bucket(10); - sm.evel_meas_latency_bucket_high_end_set(myb,1000.); - sm.evel_meas_latency_bucket_low_end_set(myb,1.); - sm.evel_meas_latency_bucket_add(myb); - sm.evel_measurement_latency_add(1.,10.,20); + MEASUREMENT_FEATURE_USE featureuse = sm.evel_measurement_feature_use_add("features", 100); + + MEASUREMENT_HUGE_PAGE husePage= sm.evel_measurement_new_huge_page_add("HUGEPage1", 100000); + sm.evel_measurement_huge_page_bytesFree_set(husePage, 1100000); + sm.evel_measurement_huge_page_percentFree_set(husePage, 1000); + sm.evel_measurement_huge_page_percentUsed_set(husePage, 2000); + sm.evel_measurement_huge_page_vmPageNumberFree_set(husePage, 3000); + sm.evel_measurement_huge_page_vmPageNumberUsed_set(husePage, 4000); + + + MEASUREMENT_MEM_USE memuse = sm.evel_measurement_new_mem_use_add("memuse", 100.0); + sm.evel_measurement_mem_use_memcache_set(memuse, 51.1); + sm.evel_measurement_mem_use_memconfig_set(memuse, 51.1); + sm.evel_measurement_mem_use_memfree_set(memuse, 51.1); + sm.evel_measurement_mem_use_slab_reclaimed_set(memuse, 51.1); + sm.evel_measurement_mem_use_slab_unreclaimable_set(memuse, 51.1); + sm.evel_measurement_mem_use_usedup_set(memuse, 51.1); + + sm.evel_measurement_mem_use_memoryDemand_set(memuse, 51.1); + sm.evel_measurement_mem_use_memoryLatencyAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySharedAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapInAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapInRateAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapOutAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapOutRateAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapUsedAvg_set(memuse, 51.1); + + + + MEASUREMENT_LATENCY_BUCKET latecy = sm.evel_measurement_latency_add(10000, 2000, 3000); + sm.evel_meas_latency_bucket_low_end_set(latecy, 10); + sm.evel_meas_latency_bucket_high_end_set(latecy, 20); + + MEASUREMENT_FSYS_USE fileuse = sm.evel_measurement_fsys_use_add("FileSystem", 10.0, 2.8, 2.4, 3.3, 5.5, 9.0); + + + MEASUREMENT_NIC_PERFORMANCE vnic = sm.evel_measurement_new_vnic_performance("VNicIdentifiew", "false"); + + sm.evel_vnic_performance_rx_bcast_pkt_acc_set(vnic, 1000.0); + sm.evel_vnic_performance_rx_bcast_pkt_delta_set(vnic, 200.0); + sm.evel_vnic_performance_rx_discard_pkt_acc_set(vnic, 300.0); + sm.evel_vnic_performance_rx_discard_pkt_delta_set(vnic, 400.0); + sm.evel_vnic_performance_rx_error_pkt_acc_set(vnic, 500.0); + sm.evel_vnic_performance_rx_error_pkt_delta_set(vnic, 600.0); + sm.evel_vnic_performance_rx_mcast_pkt_acc_set(vnic, 700.0); + sm.evel_vnic_performance_rx_mcast_pkt_delta_set(vnic, 800.0); + sm.evel_vnic_performance_rx_octets_acc_set(vnic, 900.0); + sm.evel_vnic_performance_rx_octets_delta_set(vnic, 3400.0); + + sm.evel_vnic_performance_rx_total_pkt_acc_set(vnic, 67.9); + sm.evel_vnic_performance_rx_total_pkt_delta_set(vnic, 37.8); + sm.evel_vnic_performance_rx_ucast_pkt_acc_set(vnic, 234.7); + sm.evel_vnic_performance_rx_ucast_pkt_delta_set(vnic, 457.9); + sm.evel_vnic_performance_tx_bcast_pkt_acc_set(vnic, 76.4); + sm.evel_vnic_performance_tx_bcast_pkt_delta_set(vnic, 65.9); + sm.evel_vnic_performance_tx_discarded_pkt_acc_set(vnic, 76.87); + sm.evel_vnic_performance_tx_discarded_pkt_delta_set(vnic, 45.98); + sm.evel_vnic_performance_tx_error_pkt_acc_set(vnic, 54.98); + sm.evel_vnic_performance_tx_error_pkt_delta_set(vnic, 22.90); + sm.evel_vnic_performance_tx_mcast_pkt_acc_set(vnic, 22.8); + sm.evel_vnic_performance_tx_mcast_pkt_delta_set(vnic, 22.8); + sm.evel_vnic_performance_tx_octets_acc_set(vnic, 33.3); + sm.evel_vnic_performance_tx_octets_delta_set(vnic, 33.9); + sm.evel_vnic_performance_tx_total_pkt_acc_set(vnic, 23.9); + sm.evel_vnic_performance_tx_total_pkt_delta_set(vnic, 65.9); + sm.evel_vnic_performance_tx_ucast_pkt_acc_set(vnic, 23.9); + sm.evel_vnic_performance_tx_ucast_pkt_delta_set(vnic, 44.9); + sm.evel_vnic_performance_administrativeState_set(vnic, "inService"); + sm.evel_vnic_performance_operationalState_set(vnic, "inService"); + sm.evel_vnic_performance_receivedPercentDiscard_set(vnic, 12.0); + sm.evel_vnic_performance_receivedPercentError_set(vnic, 13.0); + sm.evel_vnic_performance_receivedUtilization_set(vnic, 14.01); + sm.evel_vnic_performance_speed_set(vnic, 12.99); + sm.evel_vnic_performance_transmittedPercentDiscard_set(vnic, 98.9); + sm.evel_vnic_performance_transmittedPercentError_set(vnic, 23.9); + sm.evel_vnic_performance_transmittedUtilization_set(vnic, 23.9); + + MEASUREMENT_NIC_PERFORMANCE vNicPerf = sm.evel_measurement_new_vnic_performance("VnicIdentifier", "true"); + sm.evel_meas_vnic_performance_add(vNicPerf ); + + MEASUREMENT_CODEC_USE codecuse = sm.evel_measurement_codec_use_add("codecuse", 100); + + + MEASUREMENT_LOAD load = sm.evel_measurement_new_load_add(19); + sm.evel_measurement_load_shortTerm_set(load, 55.5); + sm.evel_measurement_load_midTerm_set(load, 66.3); + sm.evel_measurement_load_longTerm_set(load, 77.3); + + MEASUREMENT_PROCESS_STATS processtate = sm.evel_measurement_new_process_stats_add("ProcessState", 19); + sm.evel_measurement_process_stats_forkRate_set(processtate, 20.3); + sm.evel_measurement_process_stats_psStateBlocked_set(processtate, 22.1); + sm.evel_measurement_process_stats_psStatePaging_set(processtate, 23.3); + sm.evel_measurement_process_stats_psStateRunning_set(processtate, 24.2); + sm.evel_measurement_process_stats_psStateSleeping_set(processtate, 25.5); + sm.evel_measurement_process_stats_psStateStopped_set(processtate, 26.6); + sm.evel_measurement_process_stats_psStateZombie_set(processtate, 26.6); + + MACHINE_CHECK_EXCEPTION except = sm.evel_measurement_new_machine_check_exception_add("Exception"); + sm.evel_measurement_Exception_correctedMemoryErrors_set(except, 10.0); + sm.evel_measurement_Exception_correctedMemoryErrors_In1Hr_set(except, 12.5); + sm.evel_measurement_Exception_uncorrectedMemoryErrors_set(except, 15.2); + sm.evel_measurement_Exception_uncorrectedMemoryErrors_In1Hr_set(except, 15.3); + + + sm.evel_measurement_addl_info_add("name", "value"); + + + MEASUREMENT_IPMI ipmi = sm.evel_measurement_new_ipmis_add(); + + ipmi.evel_meas_ipmi_add(ipmi,10.2, 10.2, 10.2, 10.2); + + MEASUREMENT_IPMI_PROCESSOR proc = ipmi.evel_measurement_IPMI_MEASUREMENT_IPMI_PROCESSOR_add("Proc1", 11.008); + + + + proc.getProcessorDIMMaggregateThermalMargin("ThermID1", 23.45); + proc.getProcessorDIMMaggregateThermalMargin("ThermID2", 65.45); + ipmi.evelMeasurementIpmiProcessorAdd("IPMIPro",10.000,12.000,"DIMM1",90.000); + ipmi.evelMeasurementIpmiProcessorAdd("IPMIPro",10.000,12.000,"DIMM1",90.000); + + + ipmi.evel_measurement_IPMIbaseboardTemperature_add("IPMIbaseboardTemperature", 10.001); + ipmi.evel_measurement_IPMIbaseboardTemperature_add("IPMIbaseboardTemperature2", 3445.0033); + + + ipmi.evel_measurement_IPMIbaseboardvoltageResulator_add("IPMIbaseboardvoltageRegulator", 12.000); + ipmi.evel_measurement_IPMIbaseboardvoltageResulator_add("IPMIbaseboardvoltageRegulator2", 99.000089); + + + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add("IPMIbattery", "BatteryType", 123.00); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add("IPMIbattery2", "BatteryType2", 123.11); + + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add("PowerSupply", 19.000, 23.000, 34.000); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add("PowerSupply2", 11.002, 33.44, 90.0001); + + + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add("AggregateTemperatureMargin",14.00000); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add("AggregateTemperatureMargin2",14.1111); + + ipmi.evel_measurement_IPMINIC_add("nic_Identifier", 10.000); + ipmi.evel_measurement_IPMINIC_add("nic_Identifier2", 1111.011); + ipmi.evel_measurement_IPMIHSBP_add("hsbpIdentifier", 10.990); + ipmi.evel_measurement_IPMIHSBP_add("hsbpIdentifier2", 12.990); + ipmi.evel_measurement_IPMIfan_add("fanIdentfier", 10.000); + ipmi.evel_measurement_IPMIfan_add("fanIdentfier2", 21.077); + + sm.evel_measurement_custom_measurement_add("Measurement", "name", "value"); + + + sm.evel_measurement_custom_measurement_add("group1","name1","val1"); + sm.evel_measurement_custom_measurement_add("group1","name2","val2"); + sm.evel_measurement_custom_measurement_add("group2","name1","val1"); + sm.evel_measurement_custom_measurement_add("group2","name2","val2"); + + sm.evel_measurement_addl_info_add("name", "value"); + sm.evel_measurement_addl_info_add("name", "value"); + + + /* * Arguments updated 15/07/2018 */ - sm.evel_measurement_vnic_performance_add("vnic","vals","5 mbps", 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.,29.,30.,31.,32.,33.,34.,35.,36.); + + 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); @@ -314,45 +487,43 @@ public class TestJunit { assertTrue( ret ); } - @Test + @Test public void testSyslog() { - EvelSyslog sysl = new EvelSyslog("Syslog_vVNF", "vmname_ip", - EvelFault.EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER, - "Router failed","JUNIPER"); - sysl.evel_syslog_proc_id_set(456); - sysl.evel_syslog_proc_set("routed"); - sysl.evel_syslog_type_set("named"); - sysl.evel_syslog_addl_filter_set("syslfilter"); - sysl.evel_syslog_event_source_host_set("vm2474"); - sysl.evel_syslog_facility_set(EvelSyslog.EVEL_SYSLOG_FACILITIES.EVEL_SYSLOG_FACILITY_LOCAL7); - sysl.evel_syslog_severity_set("Warning"); - sysl.evel_syslog_version_set(10); - sysl.evel_syslog_s_data_set("hello"); - sysl.evel_syslog_sdid_set("hello"); - sysl.evel_syslog_severity_set("critical"); + 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"); when(mymainmock.evel_post_event(sysl)).thenReturn(true); boolean ret = mymainmock.evel_post_event(sysl); LOG.info("Returned "+ret); assertTrue( ret ); } + - @Test - public void testHtbtField() { - EvelHeartbeatField hfld = new EvelHeartbeatField(123,"HeartbeatField_vVNF", "vmname_ip"); - hfld.evel_hrtbt_interval_set(23); - hfld.evel_hrtbt_field_addl_info_add("bgpb", "fail"); - hfld.evel_hrtbt_interval_set(100); - - when(mymainmock.evel_post_event(hfld)).thenReturn(true); - boolean ret = mymainmock.evel_post_event(hfld); - LOG.info("Returned "+ret); - assertTrue( ret ); - } - + @Test public void testEvelMobileFlow() { + + EvelMobileFlow mf1 = new EvelMobileFlow("hello","there"); EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS gtp = mf1.new MOBILE_GTP_PER_FLOW_METRICS(12.0, 13.0, 1,2,3,4,5,6,7,new Date(), "mflow", 8,9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24,25,26); mf1.gtp_per_flow_metrics = gtp; @@ -362,29 +533,85 @@ public class TestJunit { mf.evel_mobile_flow_addl_field_add("bgpb", "fail"); 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 ); } + + + @Test + public void testEvelNotification() { + + + 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"); + + when(mymainmock.evel_post_event(notification)).thenReturn(true); + boolean ret = mymainmock.evel_post_event(notification); + LOG.info("Returned "+ret); + assertTrue( ret ); + } + @Test + public void testEvelPnfRegistration() { + + + 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_modelNumber_set("FE934567"); + 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"); + + + + when(mymainmock.evel_post_event(pnfRegistration)).thenReturn(true); + boolean ret = mymainmock.evel_post_event(pnfRegistration); + LOG.info("Returned "+ret); + assertTrue( ret ); + } + + + + @Test public void testSipSignaling() { - EvelSipSignaling sip = new EvelSipSignaling("SipSignaling_vVNF", "vmname_ip","aricent","corlator","127.0.0.1","5647","10.1.1.124","5678"); - sip.evel_signaling_type_set("BVOIP"); - sip.evel_signaling_local_ip_address_set("1.2.3.4"); - sip.evel_signaling_local_port_set("446"); - sip.evel_signaling_remote_ip_address_set("1.2.3.4"); - sip.evel_signaling_remote_port_set("1446"); - sip.evel_signaling_vnfmodule_name_set("sipmc"); - sip.evel_signaling_vnfname_set("SIPVM"); - sip.evel_signaling_compressed_sip_set("comprsip"); - sip.evel_signaling_summary_sip_set("summsip"); - sip.evel_signaling_correlator_set("corl"); - sip.evel_signaling_addl_info_add("bgpb", "fail"); + 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"); when(mymainmock.evel_post_event(sip)).thenReturn(true); boolean ret = mymainmock.evel_post_event(sip); @@ -392,25 +619,21 @@ public class TestJunit { assertTrue( ret ); } + @Test public void testVoiceQuality() { - EvelVoiceQuality vq = new EvelVoiceQuality("VoiceQuality_vVNF", "vmname_ip", - "calleeSideCodc", - "callerSideCodc", "corlator", - "midCllRtcp", "juniper"); - /* - * Arguments updated 15/07/2018 - */ - vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 20, 30, 40, 50, 60, 70, 80, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 190, 200,210,220,230,240,250,260,270,280,290,300); - //vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 190, 200,210,220,230,240,250,260,270,280,290,300); - vq.evel_voice_quality_addl_info_add("bgpb", "fail"); - vq.evel_voice_quality_callee_codec_set("codec1"); - vq.evel_voice_quality_caller_codec_set("codec1"); - vq.evel_voice_quality_correlator_set("codec1"); - vq.evel_voice_quality_rtcp_data_set("codec1"); - vq.evel_voice_quality_vnfmodule_name_set("mod1"); - vq.evel_voice_quality_vnfname_set("mod1"); - vq.evel_voice_quality_phone_number_set("1234-567-8910"); + 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"); /* * Arguments updated 15/07/2018 */ @@ -425,14 +648,17 @@ public class TestJunit { @Test public void testEvelOther() { - EvelOther ev = new EvelOther("MyCustomEvent_vVNF", "vmname_ip"); - ev.evel_other_field_add("a1", "b1"); - ev.evel_other_field_add("a1", "b2"); - - ev.evel_other_field_add_namedarray("a1", "b1", "c1"); - ev.evel_other_field_add_namedarray("a1", "b2", "c2"); - ev.evel_other_field_add_namedarray("a2", "b1", "c1"); - ev.evel_other_field_add_namedarray("a2", "b1", "c1"); + 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() @@ -475,40 +701,30 @@ public class TestJunit { d1 = format.parse(dateStart); d2 = format.parse(dateStop); }catch (Exception e) { - e.printStackTrace(); + } - -// EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip", -// "CRIT", -// "mcast Limit reached", -// "mcastRxPackets", -// "1250000000", -// EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_SET, -// "Mcast Rx breached", -// EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_ELEMENT_ANOMALY, -// d1, -// EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL, -// d2); - - 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_interfacename_set("ns345"); - tca.evel_thresholdcross_addl_info_add("n1", "v1"); - tca.evel_thresholdcross_addl_info_add("n2", "v2"); - tca.evel_thresholdcross_alertid_add("alert1"); - tca.evel_thresholdcross_alertid_add("alert2"); - tca.evel_threshold_cross_possible_rootcause_set("ns345"); - tca.evel_threshold_cross_networkservice_set("ns345"); - tca.evel_threshold_cross_interfacename_set("eth0"); - tca.evel_threshold_cross_data_elementtype_set("alert2"); - tca.evel_threshold_cross_data_collector_set("alert2"); - tca.evel_threshold_cross_alertvalue_set("value"); + 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"); when(mymainmock.evel_post_event(tca)).thenReturn(true); boolean ret = mymainmock.evel_post_event(tca); @@ -525,49 +741,100 @@ public class TestJunit { try { d1 = format.parse(dateStart); }catch (Exception e) { - e.printStackTrace(); + } - EvelMobileFlow mf = new EvelMobileFlow("MobileFlow_vVNF", "vmname_ip", - "In", - null, - "GTP", - "v2.3", - "1.2.3.4", - 345556, - "5.6.7.8", - 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; + 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"); when(mymainmock.evel_post_event(mf)).thenReturn(true); boolean ret = mymainmock.evel_post_event(mf); |