diff options
author | 2017-09-21 12:51:55 -0400 | |
---|---|---|
committer | 2017-09-21 12:55:40 -0400 | |
commit | a43e38e7bdc183709399bc49179b7137c6debe23 (patch) | |
tree | 49fe0e277d7b4065e1f5e57b17ad1c7b3e631481 /veslibrary/ves_javalibrary/evel_javalib2/src | |
parent | d5ffdf731a1f163728c859ece5c861f6c403e4d7 (diff) |
Adding C and Java VES Vendor libs
Issue-Id: VNFRQTS-94
Change-Id: Iee0e154a94f3ef4ea43efcd474acacb0fa54c43f
Signed-Off-by: Gokul Singaraju <goksing@gmail.com>
Diffstat (limited to 'veslibrary/ves_javalibrary/evel_javalib2/src')
20 files changed, 11090 insertions, 0 deletions
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java new file mode 100644 index 0000000..22d5a0a --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/AgentMain.java @@ -0,0 +1,322 @@ + +package evel_javalibrary.att.com; + +/**************************************************************************//** + * @file + * Header for EVEL library + * + * This file implements the EVEL library 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. + * + * License + * ------- + * + * 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.Logger; +import org.apache.log4j.Level; + +//import java.io.BufferedReader; +import java.io.BufferedWriter; +//import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStream; +//import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +//import java.net.ProtocolException; +import java.net.URL; +//import java.nio.charset.StandardCharsets; + + +import javax.net.ssl.HttpsURLConnection; + +import org.apache.log4j.BasicConfigurator; + +/** + * @author Gokul Singaraju + */ + + +public class AgentMain { + +/**************************************************************************//** + * Error codes + * + * Error codes for EVEL low level interface + *****************************************************************************/ +public enum EVEL_ERR_CODES { + EVEL_SUCCESS, /** The operation was successful. */ + EVEL_ERR_GEN_FAIL, /** Non-specific failure. */ + EVEL_CURL_LIBRARY_FAIL, /** A cURL library operation failed. */ + EVEL_PTHREAD_LIBRARY_FAIL, /** A Posix threads operation failed. */ + EVEL_OUT_OF_MEMORY, /** A memory allocation failure occurred. */ + EVEL_EVENT_BUFFER_FULL, /** Too many events in the ring-buffer. */ + EVEL_EVENT_HANDLER_INACTIVE, /** Attempt to raise event when inactive. */ + EVEL_NO_METADATA, /** Failed to retrieve OpenStack metadata. */ + EVEL_BAD_METADATA, /** OpenStack metadata invalid format. */ + EVEL_BAD_JSON_FORMAT, /** JSON failed to parse correctly. */ + EVEL_JSON_KEY_NOT_FOUND, /** Failed to find the specified JSON key. */ + EVEL_MAX_ERROR_CODES /** Maximum number of valid error codes. */ +} + + private static final Logger logger = Logger.getLogger(AgentMain.class); + + private static String url = null; + private static URL vesurl = null; + private static HttpURLConnection con = null; + private static String userpass = null; + private static String version = "5"; + + /* RingBuffer to forward messages on sending AgentDispatcher thread */ + private static RingBuffer ringb = new RingBuffer(100); + + Thread thr; + + /* AgentDispatcher loops on messages in RingBuffer and POSTs them + * to external Collector + */ + private static class AgentDispatcher implements Runnable { + public void run() { + + String datatosend=null; + for(;;){ + if( (datatosend = (String) ringb.take()) != null ) + { + //process data + + logger.trace(url + "Got an event size "+datatosend.length()); + logger.trace(datatosend); + + try { + + //HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); + con = (HttpURLConnection) vesurl.openConnection(); + if (con instanceof HttpsURLConnection) { + HttpsURLConnection httpsConnection = (HttpsURLConnection) con; + //SSLContext sc = SSLContext.getInstance("TLSv1.2"); + // Init the SSLContext with a TrustManager[] and SecureRandom() + //sc.init(null, null, new java.security.SecureRandom()); + //httpsConnection.setHostnameVerifier(getHostnameVerifier()); + //httpsConnection.setSSLSocketFactory(sc.getSocketFactory()); + con = httpsConnection; + } + + //add reuqest header + con.setRequestMethod("POST"); + //con.setRequestProperty("User-Agent", USER_AGENT); + //con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); + // No caching, we want the real thing. + con.setUseCaches (false); + // Specify the content type. + con.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); + //con.setChunkedStreamingMode(0); + con.setInstanceFollowRedirects( false ); + //Basic username password authentication + String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes("UTF-8")); + con.setRequestProperty ("Authorization", basicAuth); + + con.setReadTimeout(15000 /* milliseconds */); + con.setConnectTimeout(15000 /* milliseconds */); + // Send post request + con.setDoOutput(true); + con.setDoInput(true); + + con.setFixedLengthStreamingMode(datatosend.length()); + OutputStream os = con.getOutputStream(); + BufferedWriter writer = new BufferedWriter( + new OutputStreamWriter(os, "UTF-8")); + //Call writer POST + writer.write(datatosend); + writer.flush(); + writer.close(); + os.close(); + //Handle the response code for POST request + int respCode = con.getResponseCode(); + logger.trace(url + "Connection HTTP Response code :"+respCode); + if(respCode < HttpURLConnection.HTTP_OK ) { + logger.trace(url + " **INFO**"); + } + else if(respCode >= HttpURLConnection.HTTP_OK && respCode < HttpURLConnection.HTTP_MULT_CHOICE ) + { + logger.trace(url + " **OK**"); + } + else if(respCode >= HttpURLConnection.HTTP_MULT_CHOICE && respCode < HttpURLConnection.HTTP_BAD_REQUEST ) + { + logger.warn(url + " **REDIRECTION**"); + } + else if(respCode >= HttpURLConnection.HTTP_BAD_REQUEST ) + { + logger.warn(url + " **SERVER ERROR**"); + + InputStream es = con.getErrorStream(); + if( es != null) + { + int ret = 0; + byte[] buf = null; + // read the response body + while ((ret = es.read(buf)) > 0) { + logger.info("Resp:"+buf); + } + // close the errorstream + es.close(); + } + } + + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + else + { + logger.trace(url + "Waiting for events"); + try { + Thread.sleep(5); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }//end for + }//end run + }//end AgentDispatcher + // Validate URL + public static boolean isValidURL(String urlStr) { + try { + URL url = new URL(urlStr); + return true; + } + catch (MalformedURLException e) { + return false; + } + } + + /**************************************************************************//** + * Library initialization. + * + * Initialize the EVEL library. + * + * @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 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). + * @param username Username for Basic Authentication of requests. + * @param password Password for Basic Authentication of requests. + * @param Level Java Log levels. + * + * @returns Status code + * @retval EVEL_SUCCESS On success + * @retval ::EVEL_ERR_CODES On failure. + *****************************************************************************/ + public static EVEL_ERR_CODES evel_initialize( + String event_api_url, + int port, + String path, + String topic, + String username, + String password, + Level level) throws IOException + { + EVEL_ERR_CODES rc = EVEL_ERR_CODES.EVEL_SUCCESS; + String throt_api_url = "http://127.0.0.1"; + + EVEL_ENTER(); + + BasicConfigurator.configure(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(event_api_url != null); + assert(port > 1024); + assert(throt_api_url != null); + assert(username != null); + + logger.setLevel(level); + + if( !isValidURL(event_api_url) || !isValidURL(throt_api_url)){ + System.out.println("Invalid Event API URL"); + rc = EVEL_ERR_CODES.EVEL_ERR_GEN_FAIL; + System.exit(1); + } + + if(path == null){ + path = ""; + } else { + version += "/example_vnf"; + } + + url = event_api_url+":"+Integer.toString(port)+path+"/eventListener/v"+version; + vesurl = null; + try { + vesurl = new URL(url); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + logger.info("Error in url input"); + e.printStackTrace(); + System.exit(1); + } + userpass = username + ":" + password; + + logger.info("Starting Agent Dispatcher thread"); + long startTime = System.currentTimeMillis(); + Thread t = new Thread(new AgentDispatcher()); + t.start(); + + EVEL_EXIT(); + return rc; + + } + + private static void EVEL_EXIT() { + // TODO Auto-generated method stub + + } + + private static void EVEL_ENTER() { + // TODO Auto-generated method stub + + } + + /**************************************************************************//** + * Handle user formatted post message + * + * @note This function handles VES 5.x formatted messages from all valid + * Domains and stores them in RingBuffer. + * + * @param obj VES 5.x formatted user messages with common header + * and optional specialized body + * + * @retval boolean True On successful acceptance False on failure + *****************************************************************************/ + + public static boolean evel_post_event(EvelHeader obj ) + { + String data = obj.evel_json_encode_event(); + boolean ret = ringb.put(data); + logger.info("Evel Post event ret:"+ret); + return ret; + } + + + +}
\ No newline at end of file diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java new file mode 100644 index 0000000..a252378 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java @@ -0,0 +1,528 @@ +package evel_javalibrary.att.com;
+
+/**************************************************************************//**
+ * @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
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+import org.slf4j.helpers.MessageFormatter;
+
+
+public class EvelFault extends EvelHeader {
+ //version of EvelFault format revisions
+ int major_version = 2;
+ int minor_version = 1;
+
+ /**************************************************************************//**
+ * Fault / Threshold severities.
+ * JSON equivalent field: eventSeverity
+ *****************************************************************************/
+ public enum EVEL_SEVERITIES{
+ EVEL_SEVERITY_CRITICAL,
+ EVEL_SEVERITY_MAJOR,
+ EVEL_SEVERITY_MINOR,
+ EVEL_SEVERITY_WARNING,
+ EVEL_SEVERITY_NORMAL,
+ EVEL_MAX_SEVERITIES
+ }
+
+ /**************************************************************************//**
+ * Fault source types.
+ * JSON equivalent field: eventSourceType
+ *****************************************************************************/
+ public enum EVEL_SOURCE_TYPES{
+ EVEL_SOURCE_OTHER,
+ EVEL_SOURCE_ROUTER,
+ EVEL_SOURCE_SWITCH,
+ EVEL_SOURCE_HOST,
+ EVEL_SOURCE_CARD,
+ EVEL_SOURCE_PORT,
+ EVEL_SOURCE_SLOT_THRESHOLD,
+ EVEL_SOURCE_PORT_THRESHOLD,
+ EVEL_SOURCE_VIRTUAL_MACHINE,
+ EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION,
+ /***************************************************************************/
+ /* START OF VENDOR-SPECIFIC VALUES */
+ /* */
+ /* Vendor-specific values should be added here, and handled appropriately */
+ /* in evel_event.c. */
+ /***************************************************************************/
+
+ /***************************************************************************/
+ /* END OF VENDOR-SPECIFIC VALUES */
+ /***************************************************************************/
+ EVEL_MAX_SOURCE_TYPES
+ }
+
+ /**************************************************************************//**
+ * Fault VNF Status.
+ * JSON equivalent field: vfStatus
+ *****************************************************************************/
+ public enum EVEL_VF_STATUSES{
+ EVEL_VF_STATUS_ACTIVE,
+ EVEL_VF_STATUS_IDLE,
+ EVEL_VF_STATUS_PREP_TERMINATE,
+ EVEL_VF_STATUS_READY_TERMINATE,
+ EVEL_VF_STATUS_REQ_TERMINATE,
+ EVEL_MAX_VF_STATUSES
+ }
+
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ EVEL_SEVERITIES event_severity;
+ EVEL_SOURCE_TYPES event_source_type;
+ String alarm_condition;
+ String specific_problem;
+ EVEL_VF_STATUSES vf_status;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ EvelOptionString category;
+ EvelOptionString alarm_interface_a;
+ ArrayList<String[]> additional_info;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelFault.class.getName() );
+
+ /**************************************************************************//**
+ * Create a new fault event.
+ *
+ * @note The mandatory fields on the Fault must be supplied to this factory
+ * function and are immutable once set. Optional fields have explicit
+ * setter functions, but again values may only be set once so that the
+ * Fault has immutable properties.
+ * @param condition The condition indicated by the Fault.
+ * @param specproblem The specific problem triggering the fault.
+ * @param priority The priority of the event.
+ * @param severity The severity of the Fault.
+ * @param ev_source_type Source of Alarm event
+ * @param status status of Virtual Function
+ *****************************************************************************/
+ public EvelFault(String evname, String ev_id,
+ String condition, String specproblem,
+ EvelHeader.PRIORITIES priority,
+ EVEL_SEVERITIES severity,
+ EVEL_SOURCE_TYPES ev_source_type,
+ EVEL_VF_STATUSES status)
+ {
+ //Initializes Evel Header and Domain
+ super(evname,ev_id);
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT;
+ //Validate inputs
+ assert( condition != null);
+ assert( specific_problem != null);
+ assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(priority) < 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;
+ alarm_condition = condition;
+ specific_problem = specproblem;
+ vf_status = status;
+ //Init optional fields
+ category = new EvelOptionString(false, null);
+ alarm_interface_a = new EvelOptionString(false, null);
+ additional_info = null;
+ }
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Fault.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param fault Pointer to the fault.
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_fault_addl_info_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Fault Category property of the Fault.
+ *
+ * @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 fault Pointer to the fault.
+ * @param category Category : license, link, routing, security, signaling.
+ * ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_fault_category_set( String categ)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
+ assert(categ != null);
+
+ category.SetValuePr(categ,"Fault Category set");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Alarm Interface A property of the Fault.
+ *
+ * @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 fault Pointer to the fault.
+ * @param interface The Alarm Interface A to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_fault_interface_set(String intf)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
+ assert(intf != null);
+
+ alarm_interface_a.SetValuePr(intf,"Alarm Interface A");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Event Type property of the Fault.
+ *
+ * @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 fault Pointer to the fault.
+ * @param type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_fault_type_set(String type)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(type != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
+
+ evel_header_type_set(type);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
+ *
+ * @param source_type The source type to convert.
+ * @returns The equivalent string.
+ *****************************************************************************/
+ String evel_source_type(EVEL_SOURCE_TYPES source_type)
+ {
+ String result;
+
+ EVEL_ENTER();
+
+ switch (source_type)
+ {
+ case EVEL_SOURCE_OTHER:
+ result = "other";
+ break;
+
+ case EVEL_SOURCE_ROUTER:
+ result = "router";
+ break;
+
+ case EVEL_SOURCE_SWITCH:
+ result = "switch";
+ break;
+
+ case EVEL_SOURCE_HOST:
+ result = "host";
+ break;
+
+ case EVEL_SOURCE_CARD:
+ result = "card";
+ break;
+
+ case EVEL_SOURCE_PORT:
+ result = "port";
+ break;
+
+ case EVEL_SOURCE_SLOT_THRESHOLD:
+ result = "slotThreshold";
+ break;
+
+ case EVEL_SOURCE_PORT_THRESHOLD:
+ result = "portThreshold";
+ break;
+
+ case EVEL_SOURCE_VIRTUAL_MACHINE:
+ result = "virtualMachine";
+ break;
+
+ case EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION:
+ result = "virtualNetworkFunction";
+ break;
+
+ default:
+ result = null;
+ LOGGER.error(MessageFormatter.format("Unexpected Event Source Type {0}", source_type));
+ System.exit(1);
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+ /**************************************************************************//**
+ * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
+ *
+ * @param severity The severity to convert.
+ * @returns The equivalent string.
+ *****************************************************************************/
+ String evel_severity(EVEL_SEVERITIES severity)
+ {
+ String result = null;
+
+ EVEL_ENTER();
+
+ switch (severity)
+ {
+ case EVEL_SEVERITY_CRITICAL:
+ result = "CRITICAL";
+ break;
+
+ case EVEL_SEVERITY_MAJOR:
+ result = "MAJOR";
+ break;
+
+ case EVEL_SEVERITY_MINOR:
+ result = "MINOR";
+ break;
+
+ case EVEL_SEVERITY_WARNING:
+ result = "WARNING";
+ break;
+
+ case EVEL_SEVERITY_NORMAL:
+ result = "NORMAL";
+ break;
+
+ default:
+ LOGGER.error("Unexpected event severity "+severity);
+ System.exit(1);
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+
+ /**************************************************************************//**
+ * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
+ *
+ * @param vf_status The vf_status to convert.
+ * @returns The equivalent string.
+ *****************************************************************************/
+ String evel_vf_status(EVEL_VF_STATUSES vf_status)
+ {
+ String result;
+
+ EVEL_ENTER();
+
+ switch (vf_status)
+ {
+ case EVEL_VF_STATUS_ACTIVE:
+ result = "Active";
+ break;
+
+ case EVEL_VF_STATUS_IDLE:
+ result = "Idle";
+ break;
+
+ case EVEL_VF_STATUS_PREP_TERMINATE:
+ result = "Preparing to terminate";
+ break;
+
+ case EVEL_VF_STATUS_READY_TERMINATE:
+ result = "Ready to terminate";
+ break;
+
+ case EVEL_VF_STATUS_REQ_TERMINATE:
+ result = "Requesting termination";
+ break;
+
+ default:
+ result = null;
+ LOGGER.error("Unexpected VF Status "+vf_status);
+ System.exit(1);
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+ /**************************************************************************//**
+ * Encode the fault in JSON according to AT&T's schema for the fault type.
+ *
+ * @retval JsonObjectBuilder of fault body portion of message
+ *****************************************************************************/
+ JsonObjectBuilder evelFaultObject()
+ {
+ String fault_severity;
+ String fault_source_type;
+ String fault_vf_status;
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+
+ fault_severity = evel_severity(event_severity);
+ fault_source_type = evel_source_type(event_source_type);
+ fault_vf_status = evel_vf_status(vf_status);
+
+ JsonObjectBuilder evelfault = Json.createObjectBuilder()
+ .add("alarmCondition", alarm_condition);
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+
+ if( category.is_set )
+ evelfault.add("eventCategory", category.GetValue());
+ if( alarm_interface_a.is_set )
+ evelfault.add("eventCategory", alarm_interface_a.GetValue());
+
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+ evelfault.add( "eventSeverity", fault_severity);
+ evelfault.add( "eventSourceType", fault_source_type);
+ evelfault.add( "specificProblem", specific_problem);
+ evelfault.add( "vfStatus", fault_vf_status);
+ evelfault.add( "faultFieldsVersion", version);
+
+ /***************************************************************************/
+ /* Encode additional Name value pairs if any. */
+ /***************************************************************************/
+ 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);
+ }
+ evelfault.add("alarmAdditionalInformation", builder);
+ }
+
+ EVEL_EXIT();
+
+ return evelfault;
+ }
+
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ 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.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java new file mode 100644 index 0000000..8b5538b --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java @@ -0,0 +1,664 @@ +package evel_javalibrary.att.com;
+
+/**************************************************************************//**
+ * @file
+ * Header for EVEL Header library
+ *
+ * This file implements the EVEL library 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.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.Enumeration;
+import java.util.logging.Logger;
+import java.io.StringWriter;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonString;
+import javax.json.JsonWriter;
+
+import org.slf4j.helpers.MessageFormatter;
+
+
+public class EvelHeader {
+
+ /**************************************************************************//**
+ * Event domains for the various events we support.
+ * JSON equivalent field: domain
+ *****************************************************************************/
+ public enum DOMAINS {
+ EVEL_DOMAIN_INTERNAL, /** Internal event, not for external routing. */
+ EVEL_DOMAIN_FAULT, /** A Fault event. */
+ EVEL_DOMAIN_HEARTBEAT, /** A Heartbeat event (event header only). */
+ EVEL_DOMAIN_MEASUREMENT, /** A Measurement for VF Scaling event. */
+ EVEL_DOMAIN_MOBILE_FLOW, /** A Mobile Flow event. */
+ EVEL_DOMAIN_OTHER, /** Another event. */
+ EVEL_DOMAIN_REPORT, /** A Measurement for VF Reporting event. */
+ EVEL_DOMAIN_SIPSIGNALING, /** A Signaling event. */
+ EVEL_DOMAIN_STATE_CHANGE, /** A State Change event. */
+ EVEL_DOMAIN_SYSLOG, /** A Syslog event. */
+ EVEL_DOMAIN_THRESHOLD_CROSSING, /** A Threshold crossing alert Event */
+ EVEL_DOMAIN_VOICE_QUALITY, /** A Voice Quality Event */
+ EVEL_DOMAIN_HEARTBEAT_FIELD,/** A Heartbeat field event. */
+ EVEL_MAX_DOMAINS /** Maximum number of recognized Event types. */
+ }
+
+ /**************************************************************************//**
+ * Event priorities.
+ * JSON equivalent field: priority
+ *****************************************************************************/
+ public enum PRIORITIES {
+ EVEL_PRIORITY_HIGH,
+ EVEL_PRIORITY_MEDIUM,
+ EVEL_PRIORITY_NORMAL,
+ EVEL_PRIORITY_LOW,
+ EVEL_MAX_PRIORITIES
+ }
+
+ final int EVEL_HEADER_MAJOR_VERSION = 1;
+ final int EVEL_HEADER_MINOR_VERSION = 1;
+ /***************************************************************************/
+ /* Version */
+ /***************************************************************************/
+ int major_version;
+ int minor_version;
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ DOMAINS event_domain;
+ String event_id=null;
+ String event_name=null;
+ String source_name=null;
+ String reporting_entity_name=null;
+ PRIORITIES priority;
+ Long start_epoch_microsec = 0L;
+ Long last_epoch_microsec = 0L;
+ int sequence;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ EvelOptionString event_type;
+ EvelOptionString source_id;
+ EvelOptionString reporting_entity_id;
+ EvelOptionIntHeader internal_field;
+ EvelOptionString nfcnaming_code;
+ EvelOptionString nfnaming_code;
+
+ /**************************************************************************//**
+ * Unique sequence number for events from this VNF.
+ *****************************************************************************/
+ static int event_sequence = 1;
+ private static final Logger LOGGER = Logger.getLogger( EvelHeader.class.getName() );
+
+ protected static void EVEL_EXIT() {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected static void EVEL_ENTER() {
+ // TODO Auto-generated method stub
+ }
+
+ /**************************************************************************//**
+ * Set the next event_sequence to use.
+ *
+ * @param sequence The next sequence number to use.
+ *****************************************************************************/
+ void evel_set_next_event_sequence( int sequence)
+ {
+ EVEL_ENTER();
+
+ LOGGER.info(MessageFormat.format("Setting event sequence to {0}, was {1} ", sequence, event_sequence));
+ event_sequence = sequence;
+
+ EVEL_EXIT();
+ }
+
+ 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);
+ }
+
+ /**************************************************************************//**
+ * Initialize a newly created event header.
+ *
+ * @param header Pointer to the header being initialized.
+ *****************************************************************************/
+ public EvelHeader(String eventname,String ev_id)
+ {
+ EVEL_ENTER();
+
+ assert(eventname != null);
+
+ /***************************************************************************/
+ /* Initialize the header. Get a new event sequence number. Note that if */
+ /* any memory allocation fails in here we will fail gracefully because */
+ /* everything downstream can cope with nulls. */
+ /***************************************************************************/
+ this.event_domain = DOMAINS.EVEL_DOMAIN_HEARTBEAT;
+ if(ev_id == null){
+ event_id = MessageFormat.format("{0}", event_sequence);
+ LOGGER.warning("WARNING:not confirming to Common Event Format 28.3 standard");
+ } else
+ event_id = ev_id;
+ event_name = eventname;
+ start_epoch_microsec = last_epoch_microsec;
+ last_epoch_microsec = System.nanoTime()/1000;
+ priority = PRIORITIES.EVEL_PRIORITY_NORMAL;
+
+ String hostname = "Unknown";
+ String uuid = "Unknown";
+
+ try
+ {
+ InetAddress addr;
+ addr = InetAddress.getLocalHost();
+ hostname = addr.getHostName();
+ }
+ catch (UnknownHostException ex)
+ {
+ System.out.println("Hostname can not be resolved");
+ }
+
+ 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) {
+ /* System.out.print("Current MAC address : ");
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < mac.length; i++) {
+ sb.append(String.format("%02X%s", mac[i],
+ (i < mac.length - 1) ? "-" : ""));
+ } */
+
+ uuid = bytesToHex(mac);
+ }
+ }
+
+ } catch (SocketException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ reporting_entity_name = hostname;
+ source_name = hostname;
+ sequence = event_sequence;
+
+ major_version = EVEL_HEADER_MAJOR_VERSION;
+ minor_version = EVEL_HEADER_MINOR_VERSION;
+ event_sequence++;
+
+ /***************************************************************************/
+ /* Optional parameters. */
+ /***************************************************************************/
+ event_type = new EvelOptionString(false, null);
+ nfcnaming_code = new EvelOptionString(false, null);
+ nfnaming_code = new EvelOptionString(false, null);
+ reporting_entity_id = new EvelOptionString(true, uuid);
+ source_id = new EvelOptionString(true, uuid);
+ internal_field = new EvelOptionIntHeader(false, null);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Create a new heartbeat event.
+ *
+ * @note that the heartbeat is just a "naked" commonEventHeader!
+ *
+ * @returns pointer to the newly manufactured ::EVENT_HEADER.
+ * @retval null Failed to create the event.
+ ****************************************************************************/
+
+
+ public static EvelHeader evel_new_heartbeat()
+ {
+ EvelHeader header = null;
+ EVEL_ENTER();
+ /***************************************************************************/
+ /* Initialize the header. Get a new event sequence number. Note that if */
+ /* any memory allocation fails in here we will fail gracefully because */
+ /* everything downstream can cope with nulls. */
+ /***************************************************************************/
+ header = new EvelHeader("Heartbeat",null);
+ header.event_type.set_option(true);
+ header.event_type.SetValue("HEARTBEAT");
+ LOGGER.info(header.event_type.value);
+
+ EVEL_EXIT();
+ return header;
+ }
+
+ /**************************************************************************//**
+ * Create a new heartbeat event.
+ *
+ * @note that the heartbeat is just a "naked" commonEventHeader!
+ *
+ * @returns pointer to the newly manufactured ::EVENT_HEADER.
+ * @retval null Failed to create the event.
+ ****************************************************************************/
+
+
+ public static EvelHeader evel_new_heartbeat(String evname,String evid)
+ {
+ EvelHeader header = null;
+ EVEL_ENTER();
+ /***************************************************************************/
+ /* Initialize the header. Get a new event sequence number. Note that if */
+ /* any memory allocation fails in here we will fail gracefully because */
+ /* everything downstream can cope with nulls. */
+ /***************************************************************************/
+ header = new EvelHeader(evname,evid);
+ header.event_type.set_option(true);
+ header.event_type.SetValue("HEARTBEAT");;
+ LOGGER.info(header.event_type.value);
+
+ EVEL_EXIT();
+ return header;
+ }
+
+
+ /**************************************************************************//**
+ * Set the Event Type property of the event header.
+ *
+ * @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 header Pointer to the ::EVENT_HEADER.
+ * @param type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_header_type_set(String type)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(type != null);
+
+ event_type.set_option(true);
+ event_type.SetValue(type);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Start Epoch property of the event header.
+ *
+ * @note The Start Epoch defaults to the time of event creation.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param start_epoch_microsec
+ * The start epoch to set, in microseconds.
+ *****************************************************************************/
+ public void evel_start_epoch_set(Long epoch_microsec)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ start_epoch_microsec = epoch_microsec;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Last Epoch property of the event header.
+ *
+ * @note The Last Epoch defaults to the time of event creation.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param last_epoch_microsec
+ * The last epoch to set, in microseconds.
+ *****************************************************************************/
+ public void evel_last_epoch_set(Long epoch_microsec)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ last_epoch_microsec = epoch_microsec;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the NFC Naming code property of the event header.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param nfcnamingcode String
+ *****************************************************************************/
+ public void evel_nfcnamingcode_set(String nfcnam)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ assert(nfcnam != null);
+ nfcnaming_code.set_option(true);
+ nfcnaming_code.SetValue(nfcnam);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the NF Naming code property of the event header.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param nfnamingcode String
+ *****************************************************************************/
+ public void evel_nfnamingcode_set(String nfnam)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ assert(nfnam != null);
+ nfnaming_code.set_option(true);
+ nfnaming_code.SetValue(nfnam);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Reporting Entity Name property of the event header.
+ *
+ * @note The Reporting Entity Name defaults to the OpenStack VM Name.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param entity_name The entity name to set.
+ *****************************************************************************/
+ public void evel_reporting_entity_name_set(String entity_name)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ assert(entity_name != null);
+
+ /***************************************************************************/
+ /* Free the previously allocated memory and replace it with a copy of the */
+ /* provided one. */
+ /***************************************************************************/
+ reporting_entity_name = entity_name;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Reporting Entity Id property of the event header.
+ *
+ * @note The Reporting Entity Id defaults to the OpenStack VM UUID.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param entity_id The entity id to set.
+ *****************************************************************************/
+ public void evel_reporting_entity_id_set(String entity_id)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ assert(entity_id != null);
+
+ /***************************************************************************/
+ /* Free the previously allocated memory and replace it with a copy of the */
+ /* provided one. Note that evel_force_option_string strdups entity_id. */
+ /***************************************************************************/
+ reporting_entity_id.set_option(true);
+ reporting_entity_id.SetValue(entity_id);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
+ *
+ * @param domain The domain to convert.
+ * @returns The equivalent string.
+ *****************************************************************************/
+ String evel_event_domain(DOMAINS domain)
+ {
+ String result;
+
+ EVEL_ENTER();
+
+ switch (domain)
+ {
+ case EVEL_DOMAIN_HEARTBEAT:
+ result = "heartbeat";
+ break;
+
+ case EVEL_DOMAIN_FAULT:
+ result = "fault";
+ break;
+
+ case EVEL_DOMAIN_MEASUREMENT:
+ result = "measurementsForVfScaling";
+ break;
+
+ case EVEL_DOMAIN_REPORT:
+ result = "measurementsForVfReporting";
+ break;
+
+ case EVEL_DOMAIN_MOBILE_FLOW:
+ result = "mobileFlow";
+ break;
+
+ case EVEL_DOMAIN_HEARTBEAT_FIELD:
+ result = "heartbeat";
+ break;
+
+ case EVEL_DOMAIN_SIPSIGNALING:
+ result = "sipSignaling";
+ break;
+
+ case EVEL_DOMAIN_STATE_CHANGE:
+ result = "stateChange";
+ break;
+
+ case EVEL_DOMAIN_SYSLOG:
+ result = "syslog";
+ break;
+
+ case EVEL_DOMAIN_OTHER:
+ result = "other";
+ break;
+
+ case EVEL_DOMAIN_VOICE_QUALITY:
+ result = "voiceQuality";
+ break;
+
+ case EVEL_DOMAIN_THRESHOLD_CROSSING:
+ result = "thresholdCrossingAlert";
+ break;
+
+ default:
+ result = null;
+ LOGGER.severe(MessageFormat.format("Unexpected domain {0}", domain));
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+ /**************************************************************************//**
+ * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
+ *
+ * @param priority The priority to convert.
+ * @returns The equivalent string.
+ *****************************************************************************/
+ String evel_event_priority(PRIORITIES priority)
+ {
+ String result;
+
+ EVEL_ENTER();
+
+ switch (priority)
+ {
+ case EVEL_PRIORITY_HIGH:
+ result = "High";
+ break;
+
+ case EVEL_PRIORITY_MEDIUM:
+ result = "Medium";
+ break;
+
+ case EVEL_PRIORITY_NORMAL:
+ result = "Normal";
+ break;
+
+ case EVEL_PRIORITY_LOW:
+ result = "Low";
+ break;
+
+ default:
+ result = null;
+ LOGGER.severe(MessageFormat.format("Unexpected priority {0}", priority));
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+ /**************************************************************************//**
+ * Encode the CommonEventHeaeder as a JSON event object builder
+ * according to AT&T's schema.
+ *
+ * @retval JsonObjectBuilder of fault body portion of message
+ *****************************************************************************/
+ JsonObjectBuilder eventHeaderObject()
+ {
+ String domain = evel_event_domain(event_domain);
+ String prity = evel_event_priority(priority);
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Required fields. */
+ /***************************************************************************/
+
+ JsonObjectBuilder commheader = Json.createObjectBuilder()
+ .add("domain", domain)
+ .add("eventId", event_id)
+ .add("eventName", event_name)
+ .add("lastEpochMicrosec", last_epoch_microsec)
+ .add("priority", prity)
+ .add("reportingEntityName", reporting_entity_name)
+ .add("sequence", sequence)
+ .add("sourceName", source_name)
+ .add("startEpochMicrosec", start_epoch_microsec)
+ .add("version", version)
+ .add("reportingEntityId", reporting_entity_id.GetValue())
+ .add("sourceId", source_id.GetValue());
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+
+ 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());
+
+ if( internal_field.is_set )
+ commheader.add("internalField",internal_field.toString());
+
+ if( nfcnaming_code.is_set )
+ commheader.add("nfcNamingCode", nfcnaming_code.GetValue());
+ if( nfnaming_code.is_set )
+ commheader.add("nfNamingCode", nfnaming_code.GetValue());
+
+ EVEL_EXIT();
+
+ return commheader;
+
+ }
+
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON event header only message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+
+ JsonObject obj = Json.createObjectBuilder()
+ .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ ).build();
+
+ EVEL_EXIT();
+
+ return obj.toString();
+
+ }
+
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java new file mode 100644 index 0000000..08c6f4f --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeartbeatField.java @@ -0,0 +1,214 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Heartbeat field class
+ *
+ * This file implements the Evel 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
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+
+
+public class EvelHeartbeatField extends EvelHeader {
+
+ //version of Heartbeat field format revisions
+ int major_version = 1;
+ int minor_version = 2;
+
+ /**************************************************************************//**
+ * Alert types.
+ * JSON equivalent fields: newState, oldState
+ *****************************************************************************/
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ int heartbeat_interval;
+
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ ArrayList<String[]> additional_info;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelHeartbeatField.class.getName() );
+
+ /**************************************************************************//**
+ * Construct Heartbeat field event.
+ *
+ * @param interval The Heartbeat interval at which messages are sent.
+ *
+ *****************************************************************************/
+ public EvelHeartbeatField(int interval,String evname,String evid)
+ {
+ super(evname,evid);
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_HEARTBEAT_FIELD;
+ assert( interval > 0 );
+
+ heartbeat_interval = interval;
+
+ additional_info = null;
+ }
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Fault.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_hrtbt_field_addl_info_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Interval property of the Heartbeat fields event.
+ *
+ * @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 interval Heartbeat interval.
+ *****************************************************************************/
+ public void evel_hrtbt_interval_set( int interval)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_set_option_string. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_HEARTBEAT_FIELD);
+ assert(interval > 0);
+
+ heartbeat_interval = interval;
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Encode the Heartbeat field in JSON according to AT&T's schema.
+ *
+ * @retval JsonObjectBuilder of Heartbeat field body portion of message
+ *****************************************************************************/
+ JsonObjectBuilder evelHeartbeatFieldObject()
+ {
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_HEARTBEAT_FIELD);
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+
+ JsonObjectBuilder evelstate = Json.createObjectBuilder()
+ .add("heartbeatInterval", heartbeat_interval);
+
+ evelstate.add( "heartbeatFieldsVersion", version);
+
+ /***************************************************************************/
+ /* Checkpoint, so that we can wind back if all fields are suppressed. */
+ /***************************************************************************/
+ 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);
+ }
+ evelstate.add("additionalFields", builder);
+ }
+
+ EVEL_EXIT();
+
+ return evelstate;
+ }
+
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ 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.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java new file mode 100644 index 0000000..5b2c408 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelMobileFlow.java @@ -0,0 +1,2064 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Mobile Flow class
+ *
+ * This file implements the Evel Mobile Flow 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 Mobile flow events.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+
+
+
+public class EvelMobileFlow extends EvelHeader {
+
+ int major_version = 1;
+ int minor_version = 2;
+
+ static int EVEL_TOS_SUPPORTED = 256;
+ /**************************************************************************//**
+ * TCP flags.
+ * JSON equivalent fields: tcpFlagCountList, tcpFlagList
+ *****************************************************************************/
+ public enum EVEL_TCP_FLAGS {
+ EVEL_TCP_NS,
+ EVEL_TCP_CWR,
+ EVEL_TCP_ECE,
+ EVEL_TCP_URG,
+ EVEL_TCP_ACK,
+ EVEL_TCP_PSH,
+ EVEL_TCP_RST,
+ EVEL_TCP_SYN,
+ EVEL_TCP_FIN,
+ EVEL_MAX_TCP_FLAGS
+ }
+ static int EVEL_MAX_TCP_FLAGS = 10;
+ /**************************************************************************//**
+ * Mobile QCI Classes of Service.
+ * JSON equivalent fields: mobileQciCosCountList, mobileQciCosList
+ *****************************************************************************/
+ public enum EVEL_QCI_COS_TYPES {
+
+ /***************************************************************************/
+ /* UMTS Classes of Service. */
+ /***************************************************************************/
+ EVEL_QCI_COS_UMTS_CONVERSATIONAL,
+ EVEL_QCI_COS_UMTS_STREAMING,
+ EVEL_QCI_COS_UMTS_INTERACTIVE,
+ EVEL_QCI_COS_UMTS_BACKGROUND,
+
+ /***************************************************************************/
+ /* LTE Classes of Service. */
+ /***************************************************************************/
+ EVEL_QCI_COS_LTE_1,
+ EVEL_QCI_COS_LTE_2,
+ EVEL_QCI_COS_LTE_3,
+ EVEL_QCI_COS_LTE_4,
+ EVEL_QCI_COS_LTE_65,
+ EVEL_QCI_COS_LTE_66,
+ EVEL_QCI_COS_LTE_5,
+ EVEL_QCI_COS_LTE_6,
+ EVEL_QCI_COS_LTE_7,
+ EVEL_QCI_COS_LTE_8,
+ EVEL_QCI_COS_LTE_9,
+ EVEL_QCI_COS_LTE_69,
+ EVEL_QCI_COS_LTE_70,
+ EVEL_MAX_QCI_COS_TYPES
+ }
+ static int EVEL_MAX_QCI_COS_TYPES = 18;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelMobileFlow.class.getName() );
+
+
+ /*****************************************************************************/
+ /* Array of strings to use when encoding TCP flags. */
+ /*****************************************************************************/
+ static final String[/*EVEL_MAX_TCP_FLAGS*/] evel_tcp_flag_strings = {
+ "NS",
+ "CWR",
+ "ECE",
+ "URG",
+ "ACK",
+ "PSH",
+ "RST",
+ "SYN",
+ "FIN"
+ };
+
+ /*****************************************************************************/
+ /* Array of strings to use when encoding QCI COS. */
+ /*****************************************************************************/
+ static final String[/*EVEL_MAX_QCI_COS_TYPES*/] evel_qci_cos_strings = {
+ "conversational",
+ "streaming",
+ "interactive",
+ "background",
+ "1",
+ "2",
+ "3",
+ "4",
+ "65",
+ "66",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "69",
+ "70"
+ };
+
+
+ /**************************************************************************//**
+ * Vendor VNF Name fields.
+ * JSON equivalent field: vendorVnfNameFields
+ *****************************************************************************/
+ /**************************************************************************//**
+ * Mobile GTP Per Flow Metrics.
+ * JSON equivalent field: gtpPerFlowMetrics
+ *****************************************************************************/
+ public class MOBILE_GTP_PER_FLOW_METRICS {
+ double avg_bit_error_rate;
+ double avg_packet_delay_variation;
+ int avg_packet_latency;
+ int avg_receive_throughput;
+ int avg_transmit_throughput;
+
+ int flow_activation_epoch;
+ int flow_activation_microsec;
+
+ int flow_deactivation_epoch;
+ int flow_deactivation_microsec;
+ Date flow_deactivation_time;
+ String flow_status;
+ int max_packet_delay_variation;
+ int num_activation_failures;
+ int num_bit_errors;
+ int num_bytes_received;
+ int num_bytes_transmitted;
+ int num_dropped_packets;
+ int num_l7_bytes_received;
+ int num_l7_bytes_transmitted;
+ int num_lost_packets;
+ int num_out_of_order_packets;
+ int num_packet_errors;
+ int num_packets_received_excl_retrans;
+ int num_packets_received_incl_retrans;
+ int num_packets_transmitted_incl_retrans;
+ int num_retries;
+ int num_timeouts;
+ int num_tunneled_l7_bytes_received;
+ int round_trip_time;
+ int time_to_first_byte;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ EvelOptionInt ip_tos_counts[/*EVEL_TOS_SUPPORTED*/];
+ EvelOptionInt tcp_flag_counts[/*EVEL_MAX_TCP_FLAGS*/];
+ EvelOptionInt qci_cos_counts[/*EVEL_MAX_QCI_COS_TYPES*/];
+
+ EvelOptionInt dur_connection_failed_status;
+ EvelOptionInt dur_tunnel_failed_status;
+ EvelOptionString flow_activated_by;
+
+ EvelOptionTime flow_activation_time;
+ EvelOptionString flow_deactivated_by;
+
+ EvelOptionString gtp_connection_status;
+ EvelOptionString gtp_tunnel_status;
+ EvelOptionInt large_packet_rtt;
+ EvelOptionDouble large_packet_threshold;
+ EvelOptionInt max_receive_bit_rate;
+ EvelOptionInt max_transmit_bit_rate;
+ EvelOptionInt num_gtp_echo_failures;
+ EvelOptionInt num_gtp_tunnel_errors;
+ EvelOptionInt num_http_errors;
+
+ /**************************************************************************//**
+ * Create a new Mobile GTP Per Flow Metrics.
+ *
+ * @note The mandatory fields on the Mobile GTP Per Flow Metrics must be
+ * supplied to this factory function and are immutable once set.
+ * Optional fields have explicit setter functions, but again values
+ * may only be set once so that the Mobile GTP Per Flow Metrics has
+ * immutable properties.
+ *
+ * @param avg_bit_error_rate Average bit error rate.
+ * @param avg_packet_delay_variation Average delay or jitter in ms.
+ * @param avg_packet_latency Average delivery latency.
+ * @param avg_receive_throughput Average receive throughput.
+ * @param avg_transmit_throughput Average transmit throughput.
+ * @param flow_activation_epoch Time the connection is activated.
+ * @param flow_activation_microsec Microseconds for the start of the flow
+ * connection.
+ * @param flow_deactivation_epoch Time for the end of the connection.
+ * @param flow_deactivation_microsec Microseconds for the end of the flow
+ * connection.
+ * @param flow_deactivation_time Transmission time of the first packet.
+ * @param flow_status Connection status.
+ * @param max_packet_delay_variation Maximum packet delay or jitter in ms.
+ * @param num_activation_failures Number of failed activation requests.
+ * @param num_bit_errors Number of errored bits.
+ * @param num_bytes_received Number of bytes received.
+ * @param num_bytes_transmitted Number of bytes transmitted.
+ * @param num_dropped_packets Number of received packets dropped.
+ * @param num_l7_bytes_received Number of tunneled Layer 7 bytes
+ * received.
+ * @param num_l7_bytes_transmitted Number of tunneled Layer 7 bytes
+ * transmitted.
+ * @param num_lost_packets Number of lost packets.
+ * @param num_out_of_order_packets Number of out-of-order packets.
+ * @param num_packet_errors Number of errored packets.
+ * @param num_packets_received_excl_retrans Number of packets received,
+ * excluding retransmits.
+ * @param num_packets_received_incl_retrans Number of packets received.
+ * @param num_packets_transmitted_incl_retrans Number of packets
+ * transmitted.
+ * @param num_retries Number of packet retries.
+ * @param num_timeouts Number of packet timeouts.
+ * @param num_tunneled_l7_bytes_received Number of tunneled Layer 7 bytes
+ * received, excluding retransmits.
+ * @param round_trip_time Round trip time.
+ * @param time_to_first_byte Time in ms between connection
+ * activation and first byte received.
+ *
+ * @returns pointer to the newly manufactured ::MOBILE_GTP_PER_FLOW_METRICS.
+ * If the structure is not used it must be released using
+ * ::evel_free_mobile_gtp_flow_metrics.
+ * @retval null Failed to create the event.
+ *****************************************************************************/
+ public MOBILE_GTP_PER_FLOW_METRICS(
+ double tavg_bit_error_rate,
+ double tavg_packet_delay_variation,
+ int tavg_packet_latency,
+ int tavg_receive_throughput,
+ int tavg_transmit_throughput,
+ int tflow_activation_epoch,
+ int tflow_activation_microsec,
+ int tflow_deactivation_epoch,
+ int tflow_deactivation_microsec,
+ Date tflow_deactivation_time,
+ String tflow_status,
+ int tmax_packet_delay_variation,
+ int tnum_activation_failures,
+ int tnum_bit_errors,
+ int tnum_bytes_received,
+ int tnum_bytes_transmitted,
+ int tnum_dropped_packets,
+ int tnum_l7_bytes_received,
+ int tnum_l7_bytes_transmitted,
+ int tnum_lost_packets,
+ int tnum_out_of_order_packets,
+ int tnum_packet_errors,
+ int tnum_packets_received_excl_retrans,
+ int tnum_packets_received_incl_retrans,
+ int tnum_packets_transmitted_incl_retrans,
+ int tnum_retries,
+ int tnum_timeouts,
+ int tnum_tunneled_l7_bytes_received,
+ int tround_trip_time,
+ int ttime_to_first_byte)
+ {
+ int ii;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tavg_bit_error_rate >= 0.0);
+ assert(tavg_packet_delay_variation >= 0.0);
+ assert(tavg_packet_latency >= 0);
+ assert(tavg_receive_throughput >= 0);
+ assert(tavg_transmit_throughput >= 0);
+ assert(tflow_activation_epoch > 0);
+ assert(tflow_activation_microsec >= 0);
+ assert(tflow_deactivation_epoch > 0);
+ assert(tflow_deactivation_microsec >= 0);
+ assert(tflow_status != null);
+ assert(tmax_packet_delay_variation >= 0);
+ assert(tnum_activation_failures >= 0);
+ assert(tnum_bit_errors >= 0);
+ assert(tnum_bytes_received >= 0);
+ assert(tnum_bytes_transmitted >= 0);
+ assert(tnum_dropped_packets >= 0);
+ assert(tnum_l7_bytes_received >= 0);
+ assert(tnum_l7_bytes_transmitted >= 0);
+ assert(tnum_lost_packets >= 0);
+ assert(tnum_out_of_order_packets >= 0);
+ assert(tnum_packet_errors >= 0);
+ assert(tnum_packets_received_excl_retrans >= 0);
+ assert(tnum_packets_received_incl_retrans >= 0);
+ assert(tnum_packets_transmitted_incl_retrans >= 0);
+ assert(tnum_retries >= 0);
+ assert(tnum_timeouts >= 0);
+ assert(tnum_tunneled_l7_bytes_received >= 0);
+ assert(tround_trip_time >= 0);
+ assert(ttime_to_first_byte >= 0);
+
+ /***************************************************************************/
+ /* Allocate the Mobile Flow GTP Per Flow Metrics. */
+ /***************************************************************************/
+ LOGGER.debug("New Mobile Flow GTP Per Flow Metrics");
+
+ /***************************************************************************/
+ /* Initialize the Mobile Flow GTP Per Flow Metrics fields. Optional */
+ /* string values are uninitialized (null). */
+ /***************************************************************************/
+ avg_bit_error_rate = tavg_bit_error_rate;
+ avg_packet_delay_variation = tavg_packet_delay_variation;
+ avg_packet_latency = tavg_packet_latency;
+ avg_receive_throughput = tavg_receive_throughput;
+ avg_transmit_throughput = tavg_transmit_throughput;
+ flow_activation_epoch = tflow_activation_epoch;
+ flow_activation_microsec = tflow_activation_microsec;
+ flow_deactivation_epoch = tflow_deactivation_epoch;
+ flow_deactivation_microsec = tflow_deactivation_microsec;
+ flow_deactivation_time = tflow_deactivation_time;
+ flow_status = tflow_status;
+ max_packet_delay_variation = tmax_packet_delay_variation;
+ num_activation_failures = tnum_activation_failures;
+ num_bit_errors = tnum_bit_errors;
+ num_bytes_received = tnum_bytes_received;
+ num_bytes_transmitted = tnum_bytes_transmitted;
+ num_dropped_packets = tnum_dropped_packets;
+ num_l7_bytes_received = tnum_l7_bytes_received;
+ num_l7_bytes_transmitted = tnum_l7_bytes_transmitted;
+ num_lost_packets = tnum_lost_packets;
+ num_out_of_order_packets = tnum_out_of_order_packets;
+ num_packet_errors = tnum_packet_errors;
+ num_packets_received_excl_retrans =
+ tnum_packets_received_excl_retrans;
+ num_packets_received_incl_retrans =
+ tnum_packets_received_incl_retrans;
+ num_packets_transmitted_incl_retrans =
+ tnum_packets_transmitted_incl_retrans;
+ num_retries = tnum_retries;
+ num_timeouts = tnum_timeouts;
+ num_tunneled_l7_bytes_received = tnum_tunneled_l7_bytes_received;
+ round_trip_time = tround_trip_time;
+ time_to_first_byte = ttime_to_first_byte;
+ ip_tos_counts = new EvelOptionInt[EVEL_TOS_SUPPORTED];
+ for (ii = 0; ii < EVEL_TOS_SUPPORTED; ii++)
+ {
+ ip_tos_counts[ii] = new EvelOptionInt();
+ }
+ tcp_flag_counts = new EvelOptionInt[EVEL_MAX_TCP_FLAGS];
+ for (ii = 0; ii < EVEL_MAX_TCP_FLAGS; ii++)
+ {
+ tcp_flag_counts[ii] = new EvelOptionInt();
+ }
+ qci_cos_counts = new EvelOptionInt[EVEL_MAX_QCI_COS_TYPES];
+ for (ii = 0; ii < EVEL_MAX_QCI_COS_TYPES; ii++)
+ {
+ qci_cos_counts[ii] = new EvelOptionInt();
+ }
+ dur_connection_failed_status = new EvelOptionInt();
+ dur_tunnel_failed_status = new EvelOptionInt();
+ flow_activated_by = new EvelOptionString();
+ flow_activation_time = new EvelOptionTime();
+ flow_deactivated_by = new EvelOptionString();
+ gtp_connection_status = new EvelOptionString();
+ gtp_tunnel_status = new EvelOptionString();
+ large_packet_rtt = new EvelOptionInt();
+ large_packet_threshold = new EvelOptionDouble();
+ max_receive_bit_rate = new EvelOptionInt();
+ max_transmit_bit_rate = new EvelOptionInt();
+ num_gtp_echo_failures = new EvelOptionInt();
+ num_gtp_tunnel_errors = new EvelOptionInt();
+ num_http_errors = new EvelOptionInt();
+
+ EVEL_EXIT();
+ }
+ }
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ String flow_direction;
+ public MOBILE_GTP_PER_FLOW_METRICS gtp_per_flow_metrics;
+ String ip_protocol_type;
+ String ip_version;
+ String other_endpoint_ip_address;
+ int other_endpoint_port;
+ String reporting_endpoint_ip_addr;
+ int reporting_endpoint_port;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ ArrayList<String[]> additional_info;
+ EvelOptionString application_type;
+ EvelOptionString app_protocol_type;
+ EvelOptionString app_protocol_version;
+ EvelOptionString cid;
+ EvelOptionString connection_type;
+ EvelOptionString ecgi;
+ EvelOptionString gtp_protocol_type;
+ EvelOptionString gtp_version;
+ EvelOptionString http_header;
+ EvelOptionString imei;
+ EvelOptionString imsi;
+ EvelOptionString lac;
+ EvelOptionString mcc;
+ EvelOptionString mnc;
+ EvelOptionString msisdn;
+ EvelOptionString other_functional_role;
+ EvelOptionString rac;
+ EvelOptionString radio_access_technology;
+ EvelOptionString sac;
+ EvelOptionInt sampling_algorithm;
+ EvelOptionString tac;
+ EvelOptionString tunnel_id;
+ EvelOptionString vlan_id;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+
+
+ /*****************************************************************************/
+ /* Local prototypes */
+ /*****************************************************************************/
+
+
+ /**************************************************************************//**
+ * Create a new Mobile Flow event.
+ *
+ * @note The mandatory fields on the Mobile Flow must be supplied to this
+ * factory function and are immutable once set. Optional fields have
+ * explicit setter functions, but again values may only be set once so
+ * that the Mobile Flow has immutable properties.
+ * @param flow_direction Flow direction.
+ * @param gtp_per_flow_metrics GTP per-flow metrics.
+ * @param ip_protocol_type IP protocol type.
+ * @param ip_version IP protocol version.
+ * @param other_endpoint_ip_address IP address of the other endpoint.
+ * @param other_endpoint_port IP port of the other endpoint.
+ * @param reporting_endpoint_ip_addr IP address of the reporting endpoint.
+
+ * @param reporting_endpoint_port IP port of the reporting endpoint.
+ *****************************************************************************/
+ public EvelMobileFlow( String evname, String evid,
+ String flow_dir,
+ MOBILE_GTP_PER_FLOW_METRICS gtp_per_flow_metr,
+ String ip_protocol_typ,
+ String ip_vers,
+ String other_endpoint_ip_addr,
+ int other_endpoint_pt,
+ String reporting_endpoint_ipaddr,
+ int reporting_endpoint_pt)
+ {
+ super(evname,evid);
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(flow_dir != null);
+ assert(gtp_per_flow_metr != null);
+ assert(ip_protocol_typ != null);
+ assert(ip_vers != null);
+ assert(other_endpoint_ip_addr != null);
+ assert(other_endpoint_pt > 0);
+ assert(reporting_endpoint_ipaddr != null);
+ assert(reporting_endpoint_pt > 0);
+
+ /***************************************************************************/
+ /* Allocate the Mobile Flow. */
+ /***************************************************************************/
+ LOGGER.debug("New Mobile Flow created");
+
+ /***************************************************************************/
+ /* Initialize the header & the Mobile Flow fields. Optional string values */
+ /* are uninitialized (null). */
+ /***************************************************************************/
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW;
+ flow_direction = flow_dir;
+ gtp_per_flow_metrics = gtp_per_flow_metr;
+ ip_protocol_type = ip_protocol_typ;
+ ip_version = ip_vers;
+ other_endpoint_ip_address = other_endpoint_ip_addr;
+ other_endpoint_port = other_endpoint_pt;
+ reporting_endpoint_ip_addr = reporting_endpoint_ipaddr;
+ reporting_endpoint_port = reporting_endpoint_pt;
+
+ application_type = new EvelOptionString();
+ app_protocol_type = new EvelOptionString();
+ app_protocol_version = new EvelOptionString();
+ cid = new EvelOptionString();
+ connection_type = new EvelOptionString();
+ ecgi = new EvelOptionString();
+ gtp_protocol_type = new EvelOptionString();
+ gtp_version = new EvelOptionString();
+ http_header = new EvelOptionString();
+ imei = new EvelOptionString();
+ imsi = new EvelOptionString();
+ lac = new EvelOptionString();
+ mcc = new EvelOptionString();
+ mnc = new EvelOptionString();
+ msisdn = new EvelOptionString();
+ other_functional_role = new EvelOptionString();
+ rac = new EvelOptionString();
+ radio_access_technology = new EvelOptionString();
+ sac = new EvelOptionString();
+ sampling_algorithm = new EvelOptionInt();
+ tac = new EvelOptionString();
+ tunnel_id = new EvelOptionString();
+ vlan_id = new EvelOptionString();
+ additional_info = null;
+
+ EVEL_EXIT();
+
+ }
+
+
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Mobile flow.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_addl_field_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Event Type property of the Mobile Flow.
+ *
+ * @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 type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_type_set(String typ)
+ {
+ EVEL_ENTER();
+ assert(typ != null);
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ evel_header_type_set(typ);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Application Type property of the Mobile Flow.
+ *
+ * @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 type The Application Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_app_type_set(String type)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(type != null);
+
+ application_type.SetValuePr(
+ type,
+ "Application Type");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Application Protocol Type property of the Mobile Flow.
+ *
+ * @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 type The Application Protocol Type to be set. ASCIIZ string.
+ * The caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_app_prot_type_set(String type)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(type != null);
+
+ app_protocol_type.SetValuePr(
+ type,
+ "Application Protocol Type");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Application Protocol Version property of the Mobile Flow.
+ *
+ * @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 version The Application Protocol Version to be set. ASCIIZ
+ * string. The caller does not need to preserve the value
+ * once the function returns.
+ *****************************************************************************/
+ void evel_mobile_flow_app_prot_ver_set(String version)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(version != null);
+
+ app_protocol_version.SetValuePr(
+ version,
+ "Application Protocol Version");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the CID property of the Mobile Flow.
+ *
+ * @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 cid The CID to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_cid_set(String cd)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(cid != null);
+
+ cid.SetValuePr(
+ cd,
+ "CID");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Connection Type property of the Mobile Flow.
+ *
+ * @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 type The Connection Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_con_type_set(String type)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(type != null);
+
+ connection_type.SetValuePr(
+ type,
+ "Connection Type");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the ECGI property of the Mobile Flow.
+ *
+ * @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 ecgi The ECGI to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_ecgi_set(String ecgit)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(ecgit != null);
+
+ ecgi.SetValuePr(
+ ecgit,
+ "ECGI");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the GTP Protocol Type property of the Mobile Flow.
+ *
+ * @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 type The GTP Protocol Type to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_gtp_prot_type_set(String type)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(type != null);
+
+ gtp_protocol_type.SetValuePr(
+ type,
+ "GTP Protocol Type");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the GTP Protocol Version property of the Mobile Flow.
+ *
+ * @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 version The GTP Protocol Version to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_gtp_prot_ver_set(String version)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(version != null);
+
+ gtp_version.SetValuePr(
+ version,
+ "GTP Protocol Version");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the HTTP Header property of the Mobile Flow.
+ *
+ * @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 header The HTTP header to be set. ASCIIZ string. The caller does
+ * not need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_http_header_set(String header)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(header != null);
+
+ http_header.SetValuePr(
+ header,
+ "HTTP Header");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the IMEI property of the Mobile Flow.
+ *
+ * @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 imei The IMEI to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_imei_set(String imeit)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(imeit != null);
+
+ imei.SetValuePr(
+ imeit,
+ "IMEI");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the IMSI property of the Mobile Flow.
+ *
+ * @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 imsi The IMSI to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_imsi_set(String imsit)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(imsit != null);
+
+ imsi.SetValuePr(
+ imsit,
+ "IMSI");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the LAC property of the Mobile Flow.
+ *
+ * @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 lac The LAC to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_lac_set(String lact)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+ assert(lact != null);
+
+ lac.SetValuePr(
+ lact,
+ "LAC");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the MCC property of the Mobile Flow.
+ *
+ * @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 mcc The MCC to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_mcc_set(String mcct)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(mcct != null);
+
+ mcc.SetValuePr(
+ mcct,
+ "MCC");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the MNC property of the Mobile Flow.
+ *
+ * @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 mnc The MNC to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_mnc_set(String mnct)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(mnct != null);
+
+ mnc.SetValuePr(
+ mnct,
+ "MNC");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the MSISDN property of the Mobile Flow.
+ *
+ * @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 msisdn The MSISDN to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_msisdn_set(String msisdnt)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(msisdnt != null);
+
+ msisdn.SetValuePr(
+ msisdnt,
+ "MSISDN");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Other Functional Role property of the Mobile Flow.
+ *
+ * @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 role The Other Functional Role to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_other_func_role_set(String role)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(role != null);
+
+ other_functional_role.SetValuePr(
+ role,
+ "Other Functional Role");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the RAC property of the Mobile Flow.
+ *
+ * @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 rac The RAC to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_rac_set(String ract)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(ract != null);
+
+ rac.SetValuePr(
+ ract,
+ "RAC");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Radio Access Technology property of the Mobile Flow.
+ *
+ * @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 tech The Radio Access Technology to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_radio_acc_tech_set(String tech)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(tech != null);
+
+ radio_access_technology.SetValuePr(
+ tech,
+ "Radio Access Technology");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the SAC property of the Mobile Flow.
+ *
+ * @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 sac The SAC to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_sac_set(String sact)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(sact != null);
+
+ sac.SetValuePr(
+ sact,
+ "SAC");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Sampling Algorithm property of the Mobile Flow.
+ *
+ * @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 algorithm The Sampling Algorithm to be set.
+ *****************************************************************************/
+ public void evel_mobile_flow_samp_alg_set(
+ int algorithm)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(algorithm >= 0);
+
+ sampling_algorithm.SetValuePr(
+ algorithm,
+ "Sampling Algorithm");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the TAC property of the Mobile Flow.
+ *
+ * @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 tac The TAC to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_tac_set(String tact)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(tact != null);
+
+ tac.SetValuePr(
+ tact,
+ "TAC");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Tunnel ID property of the Mobile Flow.
+ *
+ * @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 tunnel_id The Tunnel ID to be set. ASCIIZ string. The caller does
+ * not need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_tunnel_id_set(String tunnel_idt)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(tunnel_idt != null);
+
+ tunnel_id.SetValuePr(
+ tunnel_idt,
+ "Tunnel ID");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the VLAN ID property of the Mobile Flow.
+ *
+ * @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 vlan_id The VLAN ID to be set. ASCIIZ string. The caller does
+ * not need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_mobile_flow_vlan_id_set(String vlan_idt)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ assert(vlan_idt != null);
+
+ vlan_id.SetValuePr(
+ vlan_idt,
+ "VLAN ID");
+ EVEL_EXIT();
+ }
+
+
+
+ /**************************************************************************//**
+ * Set the Duration of Connection Failed Status property of the Mobile GTP Per
+ * Flow Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param duration The Duration of Connection Failed Status to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_dur_con_fail_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int duration)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(duration >= 0);
+
+ metrics.dur_connection_failed_status.SetValuePr(
+ duration,
+ "Duration of Connection Failed Status");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Duration of Tunnel Failed Status property of the Mobile GTP Per Flow
+ * Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param duration The Duration of Tunnel Failed Status to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_dur_tun_fail_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int duration)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(duration >= 0);
+
+ metrics.dur_tunnel_failed_status.SetValuePr(
+ duration,
+ "Duration of Tunnel Failed Status");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Activated By property of the Mobile GTP Per Flow metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param act_by The Activated By to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_act_by_set(MOBILE_GTP_PER_FLOW_METRICS metrics,
+ String act_by)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(act_by != null);
+
+ metrics.flow_activated_by.SetValuePr(
+ act_by,
+ "Activated By");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Activation Time property of the Mobile GTP Per Flow metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param act_time The Activation Time to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_act_time_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ Date act_time)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+
+ metrics.flow_activation_time.SetValuePr(
+ act_time,
+ "Activation Time");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Deactivated By property of the Mobile GTP Per Flow metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param deact_by The Deactivated By to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_deact_by_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ String deact_by)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(deact_by != null);
+
+ metrics.flow_deactivated_by.SetValuePr(
+ deact_by,
+ "Deactivated By");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the GTP Connection Status property of the Mobile GTP Per Flow metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param status The GTP Connection Status to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_con_status_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ String status)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(status != null);
+
+ metrics.gtp_connection_status.SetValuePr(
+ status,
+ "GTP Connection Status");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the GTP Tunnel Status property of the Mobile GTP Per Flow metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param status The GTP Tunnel Status to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_tun_status_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ String status)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(status != null);
+
+ metrics.gtp_tunnel_status.SetValuePr(
+ status,
+ "GTP Tunnel Status");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set an IP Type-of-Service count property of the Mobile GTP Per Flow metrics.
+ *
+ * @param metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param index The index of the IP Type-of-Service.
+ * @param count The count.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_iptos_set(MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int index,
+ int count)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(index >= 0);
+ assert(index < EVEL_TOS_SUPPORTED);
+ assert(count >= 0);
+ assert(count <= 255);
+
+ LOGGER.debug("IP Type-of-Service "+index);
+ metrics.ip_tos_counts[index].SetValuePr(
+ count,
+ "IP Type-of-Service");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Large Packet Round-Trip Time property of the Mobile GTP Per Flow
+ * Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param rtt The Large Packet Round-Trip Time to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_large_pkt_rtt_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int rtt)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(rtt >= 0);
+
+ metrics.large_packet_rtt.SetValuePr(
+ rtt,
+ "Large Packet Round-Trip Time");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Large Packet Threshold property of the Mobile GTP Per Flow Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param threshold The Large Packet Threshold to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_large_pkt_thresh_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ double threshold)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(threshold >= 0.0);
+
+ metrics.large_packet_threshold.SetValuePr(
+ threshold,
+ "Large Packet Threshold");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Max Receive Bit Rate property of the Mobile GTP Per Flow Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param rate The Max Receive Bit Rate to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_max_rcv_bit_rate_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int rate)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(rate >= 0);
+
+ metrics.max_receive_bit_rate.SetValuePr(
+ rate,
+ "Max Receive Bit Rate");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Max Transmit Bit Rate property of the Mobile GTP Per Flow Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param rate The Max Transmit Bit Rate to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_max_trx_bit_rate_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int rate)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(rate >= 0);
+
+ metrics.max_transmit_bit_rate.SetValuePr(
+ rate,
+ "Max Transmit Bit Rate");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Number of GTP Echo Failures property of the Mobile GTP Per Flow
+ * Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param num The Number of GTP Echo Failures to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_num_echo_fail_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int num)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(num >= 0);
+
+ metrics.num_gtp_echo_failures.SetValuePr(
+ num,
+ "Number of GTP Echo Failures");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Number of GTP Tunnel Errors property of the Mobile GTP Per Flow
+ * Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param num The Number of GTP Tunnel Errors to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_num_tun_fail_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int num)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(num >= 0);
+
+ metrics.num_gtp_tunnel_errors.SetValuePr(
+ num,
+ "Number of GTP Tunnel Errors");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Number of HTTP Errors property of the Mobile GTP Per Flow Metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param num The Number of HTTP Errors to be set.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_num_http_errors_set(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int num)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(num >= 0);
+
+ metrics.num_http_errors.SetValuePr(
+ num,
+ "Number of HTTP Errors");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add a TCP flag count to the metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param tcp_flag The TCP flag to be updated.
+ * @param count The associated flag count, which must be nonzero.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_tcp_flag_count_add(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int tcp_flag,
+ int count)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(tcp_flag >= 0 && tcp_flag < EVEL_MAX_TCP_FLAGS);
+ assert(count >= 0);
+
+ LOGGER.debug("TCP Flag: "+tcp_flag);
+ metrics.tcp_flag_counts[tcp_flag].SetValuePr(
+ count,
+ "TCP flag");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add a QCI COS count to the metrics.
+ *
+ * @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 metrics Pointer to the Mobile GTP Per Flow Metrics.
+ * @param qci_cos The QCI COS count to be updated.
+ * @param count The associated QCI COS count.
+ *****************************************************************************/
+ public void evel_mobile_gtp_metrics_qci_cos_count_add(
+ MOBILE_GTP_PER_FLOW_METRICS metrics,
+ int qci_cos,
+ int count)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(metrics != null);
+ assert(qci_cos >= 0);
+ assert(qci_cos < EVEL_MAX_QCI_COS_TYPES);
+ assert(count >= 0);
+
+ LOGGER.debug("QCI COS: "+ qci_cos);
+ metrics.qci_cos_counts[qci_cos].SetValuePr(
+ count,
+ "QCI COS");
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Encode the GTP Per Flow Object in JSON according to AT&T's schema.
+ *
+ * @retval JsonObjectBuilder of GTP Flow body portion of message
+ *****************************************************************************/
+ JsonObjectBuilder evelGtpPerFlowObject()
+ {
+ int index;
+ boolean found_ip_tos;
+ boolean found_tcp_flag;
+ boolean found_qci_cos;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Mandatory parameters. */
+ /***************************************************************************/
+ MOBILE_GTP_PER_FLOW_METRICS metrics = gtp_per_flow_metrics;
+
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add("avgBitErrorRate", metrics.avg_bit_error_rate)
+ .add("avgPacketDelayVariation", metrics.avg_packet_delay_variation)
+ .add("avgPacketLatency", metrics.avg_packet_latency)
+ .add("avgReceiveThroughput", metrics.avg_receive_throughput)
+ .add("avgTransmitThroughput", metrics.avg_transmit_throughput)
+ .add("flowActivationEpoch", metrics.flow_activation_epoch)
+ .add("flowActivationMicrosec", metrics.flow_activation_microsec)
+ .add("flowDeactivationEpoch", metrics.flow_deactivation_epoch)
+ .add("flowDeactivationMicrosec", metrics.flow_deactivation_microsec)
+ .add("flowDeactivationTime", metrics.flow_deactivation_time.toString())
+ .add("flowStatus", metrics.flow_status)
+ .add("maxPacketDelayVariation", metrics.max_packet_delay_variation)
+ .add("numActivationFailures", metrics.num_activation_failures)
+ .add( "numBitErrors", metrics.num_bit_errors)
+ .add( "numBytesReceived", metrics.num_bytes_received)
+ .add( "numBytesTransmitted", metrics.num_bytes_transmitted)
+ .add( "numDroppedPackets", metrics.num_dropped_packets)
+ .add( "numL7BytesReceived", metrics.num_l7_bytes_received)
+ .add( "numL7BytesTransmitted", metrics.num_l7_bytes_transmitted)
+ .add( "numLostPackets", metrics.num_lost_packets)
+ .add( "numOutOfOrderPackets", metrics.num_out_of_order_packets)
+ .add( "numPacketErrors", metrics.num_packet_errors)
+ .add( "numPacketsReceivedExclRetrans",
+ metrics.num_packets_received_excl_retrans)
+ .add(
+ "numPacketsReceivedInclRetrans",
+ metrics.num_packets_received_incl_retrans)
+ .add(
+ "numPacketsTransmittedInclRetrans",
+ metrics.num_packets_transmitted_incl_retrans)
+ .add( "numRetries", metrics.num_retries)
+ .add( "numTimeouts", metrics.num_timeouts)
+ .add(
+ "numTunneledL7BytesReceived",
+ metrics.num_tunneled_l7_bytes_received)
+ .add( "roundTripTime", metrics.round_trip_time)
+ .add( "timeToFirstByte", metrics.time_to_first_byte);
+
+ /***************************************************************************/
+ /* Optional parameters. */
+ /***************************************************************************/
+ found_ip_tos = false;
+ for (index = 0; index < EVEL_TOS_SUPPORTED; index++)
+ {
+ if (metrics.ip_tos_counts[index].is_set)
+ {
+ found_ip_tos = true;
+ break;
+ }
+ }
+
+ if (found_ip_tos)
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for (index = 0; index < EVEL_TOS_SUPPORTED; index++)
+ {
+ if (metrics.ip_tos_counts[index].is_set)
+ {
+ JsonObjectBuilder obj2 = Json.createObjectBuilder()
+ .add(Integer.toString(index), metrics.ip_tos_counts[index].value);
+ builder.add(obj2);
+ }
+ }
+ obj.add("ipTosCountList", builder);
+ }
+
+
+ /***************************************************************************/
+ /* Make some compile-time assertions about EVEL_TCP_FLAGS. If you update */
+ /* these, make sure you update evel_tcp_flag_strings to match the enum. */
+ /***************************************************************************/
+
+ found_tcp_flag = false;
+ for (index = 0; index < EVEL_MAX_TCP_FLAGS; index++)
+ {
+ if (metrics.tcp_flag_counts[index].is_set)
+ {
+ found_tcp_flag = true;
+ break;
+ }
+ }
+
+ if (found_tcp_flag)
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for (index = 0; index < EVEL_MAX_TCP_FLAGS; index++)
+ {
+ if (metrics.tcp_flag_counts[index].is_set)
+ {
+ JsonObjectBuilder obj2 = Json.createObjectBuilder()
+ .add(Integer.toString(index), evel_tcp_flag_strings[index]);
+ builder.add(obj2);
+ }
+ }
+ obj.add("tcpFlagList", builder);
+ }
+
+ if (found_tcp_flag)
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for (index = 0; index < EVEL_MAX_TCP_FLAGS; index++)
+ {
+ if (metrics.tcp_flag_counts[index].is_set)
+ {
+ JsonObjectBuilder obj2 = Json.createObjectBuilder()
+ .add(evel_tcp_flag_strings[index], metrics.tcp_flag_counts[index].value);
+ builder.add(obj2);
+ }
+ }
+ obj.add("tcpFlagCountList", builder);
+ }
+
+ /***************************************************************************/
+ /* Make some compile-time assertions about EVEL_QCI_COS_TYPES. If you */
+ /* update these, make sure you update evel_qci_cos_strings to match the */
+ /* enum. */
+ /***************************************************************************/
+
+ found_qci_cos = false;
+ for (index = 0; index < EVEL_MAX_QCI_COS_TYPES; index++)
+ {
+ if (metrics.qci_cos_counts[index].is_set)
+ {
+ found_qci_cos = true;
+ break;
+ }
+ }
+
+ if (found_qci_cos)
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for (index = 0; index < EVEL_MAX_QCI_COS_TYPES; index++)
+ {
+ if (metrics.qci_cos_counts[index].is_set)
+ {
+ JsonObjectBuilder obj2 = Json.createObjectBuilder()
+ .add(Integer.toString(index), evel_qci_cos_strings[index]);
+ builder.add(obj2);
+ }
+ }
+ obj.add("mobileQciCosList", builder);
+ }
+
+ if (found_qci_cos)
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for (index = 0; index < EVEL_MAX_QCI_COS_TYPES; index++)
+ {
+ if (metrics.qci_cos_counts[index].is_set)
+ {
+ JsonObjectBuilder obj2 = Json.createObjectBuilder()
+ .add(evel_qci_cos_strings[index], metrics.qci_cos_counts[index].value);
+ builder.add(obj2);
+ }
+ }
+ obj.add("mobileQciCosCountList", builder);
+ }
+
+ metrics.dur_connection_failed_status.encJsonValue(obj, "durConnectionFailedStatus");
+ metrics.dur_tunnel_failed_status.encJsonValue(obj, "durTunnelFailedStatus");
+ metrics.flow_activated_by.encJsonValue(obj, "flowActivatedBy");
+ metrics.flow_activation_time.encJsonValue(obj,"flowActivationTime");
+ metrics.flow_deactivated_by.encJsonValue(obj, "flowDeactivatedBy");
+ metrics.gtp_connection_status.encJsonValue(obj, "gtpConnectionStatus");
+ metrics.gtp_tunnel_status.encJsonValue(obj, "gtpTunnelStatus");
+ metrics.large_packet_rtt.encJsonValue(obj, "largePacketRtt");
+ metrics.large_packet_threshold.encJsonValue(obj, "largePacketThreshold");
+ metrics.max_receive_bit_rate.encJsonValue(obj, "maxReceiveBitRate");
+ metrics.max_transmit_bit_rate.encJsonValue(obj, "maxTransmitBitRate");
+ metrics.num_gtp_echo_failures.encJsonValue(obj, "numGtpEchoFailures");
+ metrics.num_gtp_tunnel_errors.encJsonValue(obj, "numGtpTunnelErrors");
+ metrics.num_http_errors.encJsonValue(obj, "numHttpErrors");
+
+ return obj;
+
+ }
+
+
+ /**************************************************************************//**
+ * Encode Mobile Flow Object according to VES schema
+ *
+ * @retval JSON Object of Mobile Flow event
+ *****************************************************************************/
+ JsonObjectBuilder evelMobileFlowObject()
+ {
+
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MOBILE_FLOW);
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+ JsonObjectBuilder evelmf = Json.createObjectBuilder()
+ .add("flowDirection", flow_direction)
+ .add("ipProtocolType", ip_protocol_type)
+ .add("ipVersion", ip_version)
+ .add("otherEndpointIpAddress", other_endpoint_ip_address)
+ .add("otherEndpointPort", other_endpoint_port)
+ .add("reportingEndpointIpAddr", reporting_endpoint_ip_addr)
+ .add("reportingEndpointPort", reporting_endpoint_port);
+
+ //call gtp per flow object encoding function
+ if(gtp_per_flow_metrics != null)
+ evelmf.add("gtpPerFlowMetrics", evelGtpPerFlowObject());
+
+
+
+ /***************************************************************************/
+ /* 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);
+ }
+ evelmf.add("additionalFields", builder);
+ }
+
+
+ /***************************************************************************/
+ /* Optional parameters. */
+ /***************************************************************************/
+ application_type.encJsonValue(evelmf, "applicationType");
+ app_protocol_type.encJsonValue(evelmf, "appProtocolType");
+ app_protocol_version.encJsonValue(evelmf, "appProtocolVersion");
+ cid.encJsonValue(evelmf,"cid");
+ connection_type.encJsonValue(evelmf, "connectionType");
+ ecgi.encJsonValue(evelmf, "ecgi");
+ gtp_protocol_type.encJsonValue(evelmf, "gtpProtocolType");
+ gtp_version.encJsonValue(evelmf, "gtpVersion");
+ http_header.encJsonValue(evelmf, "httpHeader");
+ imei.encJsonValue(evelmf, "imei");
+ imsi.encJsonValue(evelmf, "imsi");
+ lac.encJsonValue(evelmf, "lac");
+ mcc.encJsonValue(evelmf, "mcc");
+ mnc.encJsonValue(evelmf, "mnc");
+ msisdn.encJsonValue(evelmf, "msisdn");
+ other_functional_role.encJsonValue(evelmf,"otherFunctionalRole");
+ rac.encJsonValue(evelmf, "rac");
+ radio_access_technology.encJsonValue(evelmf, "radioAccessTechnology");
+ sac.encJsonValue(evelmf, "sac");
+ sampling_algorithm.encJsonValue(evelmf, "samplingAlgorithm");
+ tac.encJsonValue(evelmf, "tac");
+ tunnel_id.encJsonValue(evelmf,"tunnelId");
+ vlan_id.encJsonValue(evelmf,"vlanId");
+
+
+ /***************************************************************************/
+ /* Although optional, we always generate the version. Note that this */
+ /* closes the object, too. */
+ /***************************************************************************/
+ evelmf.add("mobileFlowFieldsVersion", version);
+
+ EVEL_EXIT();
+
+ return evelmf;
+ }
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ //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.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOption.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOption.java new file mode 100644 index 0000000..f457e85 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOption.java @@ -0,0 +1,43 @@ +package evel_javalibrary.att.com;
+/*
+ * * 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.
+ *
+ *
+ * Basic Evel Option root class to handle optional message fields
+ */
+public class EvelOption {
+
+ boolean is_set;//optional value setting
+
+ public EvelOption()//default constructor
+ {
+ is_set = false;
+ }
+
+ public EvelOption(boolean val)
+ {
+ is_set = val;
+ }
+
+ public void set_option(boolean tf)//Setter
+ {
+ is_set = tf;
+ }
+
+ public boolean get_option(boolean tf)//Getter
+ {
+ return is_set;
+ }
+
+}
+
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionDouble.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionDouble.java new file mode 100644 index 0000000..d936ae5 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionDouble.java @@ -0,0 +1,87 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Option Double class
+ *
+ * This file implements the Evel Option class to handle optional double fields.
+ *
+ * License
+ * -------
+ *
+ * * 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 javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+/*
+ * Handles Optional Double fields
+ */
+public class EvelOptionDouble extends EvelOption {
+
+ /**************************************************************************//**
+ * Optional parameter holder for string.
+ *****************************************************************************/
+ Double value;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelOptionDouble.class.getName() );
+
+ public EvelOptionDouble()
+ {
+ super(false);
+ value = 0.0;
+ }
+
+ public EvelOptionDouble(boolean val, Double str)
+ {
+ super(val);
+ value = str;
+ }
+
+ public void InitValue()
+ {
+ is_set = false;
+ value = 0.0;
+ }
+ //Sets Double value
+ public void SetValue(Double str)
+ {
+ is_set = true;
+ value = str;
+ }
+ //Sets Double value with debugging message
+ public void SetValuePr(Double str, String mstr)
+ {
+
+ is_set = true;
+ value = str;
+ LOGGER.debug("Setting "+mstr+" to "+str);
+ }
+ //Getter
+ public Double GetValue()
+ {
+ return value;
+ }
+ /*
+ * Encoding JSON function
+ * @retval boolean returns option true if object is encoded
+ */
+ public boolean encJsonValue(JsonObjectBuilder obj, String name)
+ {
+ //If option is set encodes Double value into JSON object
+ // with name tag
+ if( is_set ) obj.add(name, value);
+ return is_set;
+ }
+
+}
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionInt.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionInt.java new file mode 100644 index 0000000..a6a9900 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionInt.java @@ -0,0 +1,88 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Option Int class
+ *
+ * This file implements the Evel Option class to handle optional ont fields.
+ *
+ * License
+ * -------
+ *
+ * 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 javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+/*
+ * Handles Optional Integer fields
+ */
+public class EvelOptionInt extends EvelOption {
+
+ /**************************************************************************//**
+ * Optional parameter holder for string.
+ *****************************************************************************/
+ int value;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelOptionInt.class.getName() );
+
+ public EvelOptionInt()
+ {
+ super(false);
+ value = 0;
+ }
+
+ public EvelOptionInt(boolean val, int str)
+ {
+ super(val);
+ value = str;
+ }
+
+ public void InitValue()
+ {
+ is_set = false;
+ value = 0;
+ }
+ //Sets int value
+ public void SetValue(int str)
+ {
+ is_set = true;
+ value = str;
+ }
+ //Sets Integer value outputting debugging message
+ public void SetValuePr(int str, String mstr)
+ {
+
+ is_set = true;
+ value = str;
+ LOGGER.debug("Setting "+mstr+" to "+str);
+ }
+
+ public int GetValue()
+ {
+ return value;
+ }
+ /*
+ * Encoding JSON function
+ * @retval boolean returns option true if object is encoded
+ * with Integer value
+ */
+ public boolean encJsonValue(JsonObjectBuilder obj, String name)
+ {
+ //If option is set encodes int value into JSON object
+ // with name tag
+ if( is_set ) obj.add(name, value);
+ return is_set;
+ }
+
+}
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionIntHeader.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionIntHeader.java new file mode 100644 index 0000000..3a601a6 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionIntHeader.java @@ -0,0 +1,51 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Option Internal Header class
+ *
+ * This file implements the Evel Option class to handle optional internal header
+ * fields.
+ *
+ * License
+ * -------
+ *
+ * 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.util.Date;
+
+public class EvelOptionIntHeader extends EvelOption {
+
+ /**************************************************************************//**
+ * Optional parameter for any Java object
+ *****************************************************************************/
+ java.lang.Object value;
+
+ public EvelOptionIntHeader(boolean val, java.lang.Object str)
+ {
+ super(val);
+ value = str;
+ }
+
+ public void SetValue(java.lang.Object str)
+ {
+ value = str;
+ }
+
+ public java.lang.Object GetValue()
+ {
+ return value;
+ }
+
+}
+
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionLong.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionLong.java new file mode 100644 index 0000000..3758d75 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionLong.java @@ -0,0 +1,75 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Option Long class
+ *
+ * This file implements the Evel Option class to handle optional Long fields.
+ *
+ * License
+ * -------
+ *
+ * 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.Logger;
+/*
+ * Handles Optional Long Integer fields
+ */
+public class EvelOptionLong extends EvelOption {
+
+ /**************************************************************************//**
+ * Optional parameter holder for string.
+ *****************************************************************************/
+ Long value;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelOptionLong.class.getName() );
+
+ public EvelOptionLong()
+ {
+ super(false);
+ value = 0L;
+ }
+
+ public EvelOptionLong(boolean val, Long str)
+ {
+ super(val);
+ value = str;
+ }
+
+ public void InitValue()
+ {
+ is_set = false;
+ value = 0L;
+ }
+ //Setter
+ public void SetValue(Long str)
+ {
+ is_set = true;
+ value = str;
+ }
+
+ //Sets Long Integer value outputting debugging message
+ public void SetValuePr(Long str, String mstr)
+ {
+
+ is_set = true;
+ value = str;
+ LOGGER.debug("Setting "+mstr+" to "+str);
+ }
+
+ public Long GetValue()
+ {
+ return value;
+ }
+
+}
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java new file mode 100644 index 0000000..5cf5e83 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionString.java @@ -0,0 +1,88 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Option String class
+ *
+ * This file implements the Evel Option class to handle optional String fields.
+ *
+ * License
+ * -------
+ *
+ * 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 javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+/*
+ * Handles Optional String fields
+ */
+public class EvelOptionString extends EvelOption {
+
+ /**************************************************************************//**
+ * Optional parameter holder for string.
+ *****************************************************************************/
+ String value;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelOptionString.class.getName() );
+
+ public EvelOptionString()
+ {
+ super(false);
+ value = null;
+ }
+
+ public EvelOptionString(boolean val, String str)
+ {
+ super(val);
+ value = str;
+ }
+
+ public void InitValue()
+ {
+ is_set = false;
+ value = null;
+ }
+ //Setter
+ public void SetValue(String str)
+ {
+ is_set = true;
+ value = str;
+ }
+
+ //Sets String value outputting debugging message
+ public void SetValuePr(String str, String mstr)
+ {
+
+ is_set = true;
+ value = str;
+ LOGGER.debug("Setting "+mstr+" to "+str);
+ }
+ //Getter
+ public String GetValue()
+ {
+ return value;
+ }
+ /*
+ * Encoding JSON function
+ * @retval boolean returns option true if object is encoded
+ * with String value
+ */
+ public boolean encJsonValue(JsonObjectBuilder obj, String name)
+ {
+ if( is_set ) obj.add(name, value);
+ return is_set;
+ }
+
+}
+
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionTime.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionTime.java new file mode 100644 index 0000000..66109c1 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOptionTime.java @@ -0,0 +1,91 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Option Time class
+ *
+ * This file implements the Evel Option Time class to handle optional time fields.
+ *
+ * License
+ * -------
+ *
+ * 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.util.Date;
+
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonValue;
+
+import org.apache.log4j.Logger;
+/*
+ * Handles Optional Date/Time fields
+ */
+public class EvelOptionTime extends EvelOption {
+
+ /**************************************************************************//**
+ * Optional parameter holder for string.
+ *****************************************************************************/
+ Date value;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelOptionTime.class.getName() );
+
+ public EvelOptionTime()
+ {
+ super(false);
+ value = null;
+ }
+
+ public EvelOptionTime(boolean val, Date str)
+ {
+ super(val);
+ value = str;
+ }
+
+ public void InitValue()
+ {
+ is_set = false;
+ value = null;
+ }
+ //Setter
+ public void SetValue(Date str)
+ {
+ is_set = true;
+ value = str;
+ }
+
+ //Sets Date value outputting debugging message
+ public void SetValuePr(Date str, String mstr)
+ {
+
+ is_set = true;
+ value = str;
+ LOGGER.debug("Setting "+mstr+" to "+str);
+ }
+
+ public Date GetValue()
+ {
+ return value;
+ }
+ /*
+ * Encoding JSON function
+ * @retval boolean returns option true if object is encoded
+ * with Date value
+ */
+ public boolean encJsonValue(JsonObjectBuilder obj, String name)
+ {
+ if( is_set ) obj.add(name, (JsonValue) value);
+ return is_set;
+ }
+
+}
+
+
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java new file mode 100644 index 0000000..3778767 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelOther.java @@ -0,0 +1,347 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Other class
+ *
+ * This file implements the Evel Other class to handle Other domain events.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+import org.slf4j.helpers.MessageFormatter;
+
+/*
+ * Handles Optional Other fields
+ */
+public class EvelOther extends EvelHeader {
+
+ int major_version = 1;
+ int minor_version = 1;
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ ArrayList<javax.json.JsonObject> additional_objects;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ Map<String,String> additional_info;
+ HashMap<String,Map<String,String>> evelmap;
+
+
+ private static final Logger LOGGER = Logger.getLogger( EvelOther.class.getName() );
+
+ /**************************************************************************//**
+ * Create a new Other event.
+ *
+ *****************************************************************************/
+ public EvelOther(String evname,String evid)
+ {
+ //Init header and domain
+ super(evname,evid);
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+
+ /***************************************************************************/
+ /* Allocate the measurement. */
+ /***************************************************************************/
+ LOGGER.debug("New Evel Other Object");
+
+ /***************************************************************************/
+ /* Initialize the header & the measurement fields. */
+ /***************************************************************************/
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER;
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+ additional_info = null;
+ additional_objects = null;
+ evelmap = null;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Event Type property of 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 type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_other_type_set(String typ)
+ {
+ EVEL_ENTER();
+ assert(typ != null);
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER);
+ evel_header_type_set(typ);
+
+ EVEL_EXIT();
+ }
+
+
+
+
+ /**************************************************************************//**
+ * Adds name value pair under hash key
+ *
+ *
+ * @param hashname String Hash name.
+ * @param name String Name.
+ * @param value String Value.
+ *****************************************************************************/
+ public void evel_other_field_add_namedarray(String hashname, String name, String value)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER);
+ assert(hashname != null);
+ assert(name != null);
+ assert(value != null);
+
+ if( evelmap == null)
+ evelmap = new HashMap<String,Map<String,String>>();
+
+ LOGGER.debug("Adding hash : "+hashname+" name="+name+"value= "+value);
+
+ Map<String,String> mymap = null;
+ try{
+ mymap = evelmap.get(hashname);
+ } catch( Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ if(mymap == null)
+ mymap = new HashMap<String,String>();
+ try{
+ if( mymap.put(name, value) == null)
+ LOGGER.debug("Unable to add map hash : "+hashname+" name="+name+"value= "+value);;
+
+ if( evelmap.put(hashname, mymap) == null)
+ LOGGER.debug("Unable to add hash entry : "+hashname+" name="+name+"value= "+value);;
+ } catch( Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Add a json object to optional jsonObject list.
+ *
+ * @param jsonobj Pointer to json object
+ *****************************************************************************/
+ public void evel_other_field_add_jsonobj(javax.json.JsonObject jsonobj)
+ {
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER);
+ assert(jsonobj != null);
+
+ LOGGER.debug("Adding jsonObject");
+
+ if( additional_objects == null )
+ additional_objects = new ArrayList<javax.json.JsonObject>();
+
+ additional_objects.add(jsonobj);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add a field name/value pair to the Other.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ * @param name ASCIIZ string with the field's name. The caller does not
+ * need to preserve the value once the function returns.
+ * @param value ASCIIZ string with the field's value. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_other_field_add(String name, String value)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER);
+ assert(name != null);
+ assert(value != null);
+
+ LOGGER.debug("Adding name="+name+" value="+value);
+
+ if(additional_info == null)
+ additional_info = new HashMap<String,String>();
+
+ if( additional_info.put(name, value) == null)
+ LOGGER.debug("Unable to add map : name="+name+"value= "+value);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Encode Other Object according to VES schema
+ *
+ * @retval JSON Object of Other event
+ *****************************************************************************/
+ JsonObjectBuilder evelOtherObject()
+ {
+
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_OTHER);
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+
+ /***************************************************************************/
+ /* Additional Objects. */
+ /***************************************************************************/
+
+ JsonObjectBuilder eveloth = Json.createObjectBuilder();
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+ // additional fields
+ if( additional_info != null )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(Map.Entry<String, String> entry : additional_info.entrySet()){
+ LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry.getKey(), entry.getValue()));
+ JsonObject obj = Json.createObjectBuilder()
+ .add("name", entry.getKey())
+ .add("value", entry.getValue()).build();
+ builder.add(obj);
+ }
+ eveloth.add("nameValuePairs", builder);
+ }
+
+ if( additional_objects != null && additional_objects.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<additional_objects.size();i++) {
+ JsonObject jobj = additional_objects.get(i);
+ builder.add(jobj);
+ }
+ eveloth.add("jsonObjects",builder);
+ }
+
+ if( evelmap != null && evelmap.size() > 0)
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(Map.Entry<String, Map<String,String>> entry : evelmap.entrySet()){
+ LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry.getKey(), entry.getValue()));
+ Map<String,String> item = entry.getValue();
+ JsonArrayBuilder builder2 = Json.createArrayBuilder();
+ for(Map.Entry<String, String> entry2 : item.entrySet()){
+ LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry2.getKey(), entry2.getValue()));
+ JsonObject obj = Json.createObjectBuilder()
+ .add("name", entry2.getKey())
+ .add("value", entry2.getValue()).build();
+ builder2.add(obj);
+ }
+
+
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add(entry.getKey(),builder2);
+
+ builder.add(obj);
+ }
+ eveloth.add("hashOfNameValuePairArrays", builder);
+ }
+
+
+
+
+ /***************************************************************************/
+ /* Although optional, we always generate the version. Note that this */
+ /* closes the object, too. */
+ /***************************************************************************/
+ eveloth.add("otherFieldsVersion", version);
+
+ EVEL_EXIT();
+
+ return eveloth;
+ }
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ 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.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java new file mode 100644 index 0000000..392de48 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java @@ -0,0 +1,3677 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Scaling Measurement class
+ *
+ * This file implements the Evel Scaling 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
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+import org.slf4j.helpers.MessageFormatter;
+
+
+public class EvelScalingMeasurement extends EvelHeader {
+
+ int major_version = 2;
+ int minor_version = 1;
+
+ /**************************************************************************//**
+ * CPU Usage.
+ * JSON equivalent field: cpuUsage
+ *****************************************************************************/
+ 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;
+ }
+
+
+ /**************************************************************************//**
+ * Disk Usage.
+ * JSON equivalent field: diskUsage
+ *****************************************************************************/
+ 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;
+
+ }
+
+ /**************************************************************************//**
+ * Filesystem Usage.
+ * JSON equivalent field: filesystemUsage
+ *****************************************************************************/
+ public class MEASUREMENT_FSYS_USE {
+ String filesystem_name;
+ double block_configured;
+ double block_iops;
+ double block_used;
+ double ephemeral_configured;
+ double ephemeral_iops;
+ double ephemeral_used;
+ }
+
+ /**************************************************************************//**
+ * Memory Usage.
+ * JSON equivalent field: memoryUsage
+ *****************************************************************************/
+ public class MEASUREMENT_MEM_USE {
+ String id;
+ String vmid;
+ double membuffsz;
+ public EvelOptionDouble memcache;
+ public EvelOptionDouble memconfig;
+ public EvelOptionDouble memfree;
+ public EvelOptionDouble slabrecl;
+ public EvelOptionDouble slabunrecl;
+ public EvelOptionDouble memused;
+ }
+
+ /**************************************************************************//**
+ * myerrors.
+ * JSON equivalent field: myerrors
+ *****************************************************************************/
+ public class MEASUREMENT_ERRORS {
+ int receive_discards;
+ int receive_myerrors;
+ int transmit_discards;
+ int transmit_myerrors;
+ }
+
+ /**************************************************************************//**
+ * Latency Bucket.
+ * JSON equivalent field: latencyBucketMeasure
+ *****************************************************************************/
+ public class MEASUREMENT_LATENCY_BUCKET {
+ int count;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ public EvelOptionDouble high_end;
+ public EvelOptionDouble low_end;
+
+ }
+
+ /**************************************************************************//**
+ * Virtual NIC usage.
+ * JSON equivalent field: vNicUsage
+ *****************************************************************************/
+ public class MEASUREMENT_VNIC_PERFORMANCE {
+ String vnic_id;
+ String valuesaresuspect;
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ /*Cumulative count of broadcast packets received as read at the end of
+ the measurement interval*/
+ public EvelOptionDouble recvd_bcast_packets_acc;
+ /*Count of broadcast packets received within the measurement interval*/
+ public 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;
+ /*Count of discarded packets received within the measurement interval*/
+ public 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;
+ /*Count of error packets received within the measurement interval*/
+ public 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;
+ /*Count of mcast packets received within the measurement interval*/
+ public EvelOptionDouble recvd_mcast_packets_delta;
+ /*Cumulative count of octets received as read at the end of
+ the measurement interval*/
+ public EvelOptionDouble recvd_octets_acc;
+ /*Count of octets received within the measurement interval*/
+ public 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;
+ /*Count of all packets received within the measurement interval*/
+ public 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;
+ /*Count of unicast packets received within the measurement interval*/
+ public EvelOptionDouble recvd_ucast_packets_delta;
+ /*Cumulative count of transmitted broadcast packets at the end of
+ the measurement interval*/
+ public EvelOptionDouble tx_bcast_packets_acc;
+ /*Count of transmitted broadcast packets within the measurement interval*/
+ public EvelOptionDouble tx_bcast_packets_delta;
+ /*Cumulative count of transmit discarded packets at the end of
+ the measurement interval*/
+ public EvelOptionDouble tx_discarded_packets_acc;
+ /*Count of transmit discarded packets within the measurement interval*/
+ public EvelOptionDouble tx_discarded_packets_delta;
+ /*Cumulative count of transmit error packets at the end of
+ the measurement interval*/
+ public EvelOptionDouble tx_error_packets_acc;
+ /*Count of transmit error packets within the measurement interval*/
+ public EvelOptionDouble tx_error_packets_delta;
+ /*Cumulative count of transmit multicast packets at the end of
+ the measurement interval*/
+ public EvelOptionDouble tx_mcast_packets_acc;
+ /*Count of transmit multicast packets within the measurement interval*/
+ public EvelOptionDouble tx_mcast_packets_delta;
+ /*Cumulative count of transmit octets at the end of
+ the measurement interval*/
+ public EvelOptionDouble tx_octets_acc;
+ /*Count of transmit octets received within the measurement interval*/
+ public EvelOptionDouble tx_octets_delta;
+ /*Cumulative count of all transmit packets at the end of
+ the measurement interval*/
+ public EvelOptionDouble tx_total_packets_acc;
+ /*Count of transmit packets within the measurement interval*/
+ public 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;
+ /*Count of transmit unicast packets within the measurement interval*/
+ public EvelOptionDouble tx_ucast_packets_delta;
+ }
+
+ /**************************************************************************//**
+ * Codec Usage.
+ * JSON equivalent field: codecsInUse
+ *****************************************************************************/
+ public class MEASUREMENT_CODEC_USE {
+ String codec_id;
+ int number_in_use;
+ }
+
+ /**************************************************************************//**
+ * Feature Usage.
+ * JSON equivalent field: featuresInUse
+ *****************************************************************************/
+ public class MEASUREMENT_FEATURE_USE {
+ String feature_id;
+ int feature_utilization;
+ }
+
+
+ /**************************************************************************//**
+ * Custom Defined Measurement.
+ * JSON equivalent field: measurements
+ *****************************************************************************/
+ public class CUSTOM_MEASUREMENT {
+ String name;
+ String value;
+ }
+
+ /**************************************************************************//**
+ * Measurement Group.
+ * JSON equivalent field: additionalMeasurements
+ *****************************************************************************/
+ public class MEASUREMENT_GROUP {
+ String name;
+ ArrayList<CUSTOM_MEASUREMENT> measurements;
+ }
+
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ double measurement_interval;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ ArrayList<String[]> additional_info;
+ ArrayList<MEASUREMENT_GROUP> additional_measurements;
+ ArrayList<javax.json.JsonObject> additional_objects;
+ ArrayList<MEASUREMENT_CODEC_USE> codec_usage;
+ EvelOptionInt concurrent_sessions;
+ EvelOptionInt configured_entities;
+ ArrayList<MEASUREMENT_CPU_USE> cpu_usage;
+ ArrayList<MEASUREMENT_DISK_USE> disk_usage;
+ boolean errstat;
+ MEASUREMENT_ERRORS myerrors;
+ ArrayList<MEASUREMENT_FEATURE_USE> feature_usage;
+ ArrayList<MEASUREMENT_FSYS_USE> filesystem_usage;
+ ArrayList<MEASUREMENT_LATENCY_BUCKET> latency_distribution;
+ EvelOptionDouble mean_request_latency;
+ ArrayList<MEASUREMENT_MEM_USE> mem_usage;
+ EvelOptionInt media_ports_in_use;
+ EvelOptionInt request_rate;
+ EvelOptionInt vnfc_scaling_metric;
+ ArrayList<MEASUREMENT_VNIC_PERFORMANCE> vnic_usage;
+
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+
+ private static final Logger LOGGER = Logger.getLogger( EvelScalingMeasurement.class.getName() );
+
+
+ /**************************************************************************//**
+ * Constructs a new Measurement event.
+ *
+ * @note The mandatory fields on the Measurement must be supplied to this
+ * factory function and are immutable once set. Optional fields have
+ * explicit setter functions, but again values may only be set once so
+ * that the Measurement has immutable properties.
+ *
+ * @param measurement_interval
+ *
+ *****************************************************************************/
+ public EvelScalingMeasurement(double meas_interval,String evname,String evid)
+ { //Init header
+ super(evname,evid);
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(meas_interval >= 0.0);
+
+ LOGGER.debug("New measurement is at "+meas_interval);
+
+ /***************************************************************************/
+ /* Initialize the header & the measurement fields. */
+ /***************************************************************************/
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT;
+ //initialize optional fields
+ measurement_interval = meas_interval;
+ additional_info = null;
+ additional_measurements = null;
+ additional_objects = null;
+ cpu_usage = null;
+ disk_usage = null;
+ mem_usage = null;
+ filesystem_usage = null;
+ latency_distribution = null;
+ vnic_usage = null;
+ codec_usage = null;
+ feature_usage = null;
+ errstat = false;
+
+ mean_request_latency = new EvelOptionDouble(false, 0.0);
+ vnfc_scaling_metric = new EvelOptionInt(false, 0);
+ concurrent_sessions = new EvelOptionInt(false, 0);
+ configured_entities = new EvelOptionInt(false, 0);
+ media_ports_in_use = new EvelOptionInt(false, 0);
+ request_rate = new EvelOptionInt(false, 0);
+ errstat = false;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Event Type property of 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 type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_measurement_type_set(String typ)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ evel_header_type_set(typ);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Measurement.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_measurement_addl_info_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Concurrent Sessions property of 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 concurrent_sessions The Concurrent Sessions to be set.
+ *****************************************************************************/
+ public void evel_measurement_conc_sess_set(int conc_sessions)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(conc_sessions >= 0);
+
+ concurrent_sessions.SetValuePr(conc_sessions,"Concurrent Sessions");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Configured Entities property of 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 configured_entities The Configured Entities to be set.
+ *****************************************************************************/
+ public void evel_measurement_cfg_ents_set(EvelScalingMeasurement measurement,
+ int config_entities)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(config_entities >= 0);
+
+ configured_entities.SetValuePr(config_entities,"Configured Entities");
+
+ 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.
+ *
+ * @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 mean_request_latency The Mean Request Latency to be set.
+ *****************************************************************************/
+ public void evel_measurement_mean_req_lat_set(
+ double mean_req_latency)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(mean_req_latency >= 0.0);
+
+ mean_request_latency.SetValuePr(mean_req_latency,"Mean Request Latency");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Request Rate property of 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 request_rate The Request Rate to be set.
+ *****************************************************************************/
+ public void evel_measurement_request_rate_set(int req_rate)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(req_rate >= 0);
+
+ request_rate.SetValuePr(req_rate,"Request Rate");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional CPU usage value name/value pair to the Measurement.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ *
+ * @param id ASCIIZ string with the CPU's identifier.
+ * @param usage CPU utilization.
+ *****************************************************************************/
+ public MEASUREMENT_CPU_USE evel_measurement_new_cpu_use_add(String id, double usage)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(id != null);
+ assert(usage >= 0.0);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", id, usage));
+ MEASUREMENT_CPU_USE cpu_use = new MEASUREMENT_CPU_USE();
+ assert(cpu_use != null);
+ cpu_use.id = id;
+ cpu_use.usage = usage;
+ cpu_use.idle = new EvelOptionDouble();
+ cpu_use.intrpt = new EvelOptionDouble();
+ cpu_use.nice = new EvelOptionDouble();
+ cpu_use.softirq = new EvelOptionDouble();
+ cpu_use.steal = new EvelOptionDouble();
+ cpu_use.sys = new EvelOptionDouble();
+ cpu_use.user = new EvelOptionDouble();
+ cpu_use.wait = new EvelOptionDouble();
+
+ if( cpu_usage == null ){
+ cpu_usage = new ArrayList<MEASUREMENT_CPU_USE>();
+ if( cpu_usage == null)LOGGER.error("Unable to allocate new cpu usage");
+ }
+
+ cpu_usage.add(cpu_use);
+
+ EVEL_EXIT();
+ return cpu_use;
+ }
+
+ /**************************************************************************//**
+ * Set the CPU Idle value in measurement interval
+ * percentage of CPU time spent in the idle task
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_idle_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.idle.SetValuePr(val,"CPU idle time");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the percentage of time spent servicing interrupts
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_interrupt_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.intrpt.SetValuePr(val,"CPU interrupt value");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the percentage of time spent running user space processes that have been niced
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_nice_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.nice.SetValuePr(val, "CPU nice value");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the percentage of time spent handling soft irq interrupts
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_softirq_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.softirq.SetValuePr(val, "CPU Soft IRQ value");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the percentage of time spent in involuntary wait
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_steal_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.steal.SetValuePr(val,"CPU involuntary wait");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the percentage of time spent on system tasks running the kernel
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_system_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.sys.SetValuePr(val,"CPU System load");
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the percentage of time spent running un-niced user space processes
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_usageuser_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.user.SetValuePr(val,"CPU User load value");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the percentage of CPU time spent waiting for I/O operations to complete
+ *
+ * @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 val double
+ *****************************************************************************/
+ public void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.wait.SetValuePr(val, "CPU Wait IO value");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Add an additional Memory usage value name/value pair to the Measurement.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ *
+ * @param id ASCIIZ string with the Memory identifier.
+ * @param vmidentifier ASCIIZ string with the VM's identifier.
+ * @param membuffsz Memory Size.
+ *
+ * @return Returns pointer to memory use structure in measurements
+ *****************************************************************************/
+ public MEASUREMENT_MEM_USE evel_measurement_new_mem_use_add(
+ String id, String vmidentifier, double membuffsz)
+ {
+ MEASUREMENT_MEM_USE mem_use = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(id != null);
+ assert(membuffsz >= 0.0);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding id={0} buffer size={1}", id, membuffsz));
+ mem_use = new MEASUREMENT_MEM_USE();
+ assert(mem_use != null);
+ mem_use.id = id;
+ mem_use.vmid = vmidentifier;
+ mem_use.membuffsz = membuffsz;
+ mem_use.memcache = new EvelOptionDouble();
+ mem_use.memconfig= new EvelOptionDouble();
+ mem_use.memfree= new EvelOptionDouble();
+ mem_use.slabrecl= new EvelOptionDouble();
+ mem_use.slabunrecl= new EvelOptionDouble();
+ mem_use.memused= new EvelOptionDouble();
+
+ assert(mem_use.id != null);
+
+ if( mem_usage == null ){
+ mem_usage = new ArrayList<MEASUREMENT_MEM_USE>();
+ if( mem_usage == null )LOGGER.error("Unable to allocate new memory usage");
+ }
+
+
+ mem_usage.add(mem_use);
+
+ EVEL_EXIT();
+ return mem_use;
+ }
+
+ /**************************************************************************//**
+ * Set kilobytes of memory used for cache
+ *
+ * @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 mem_use Pointer to the Memory Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memcache.SetValuePr(val,"Memory cache value");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set kilobytes of memory configured in the virtual machine on which the VNFC reporting
+ *
+ * @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 mem_use Pointer to the Memory Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memconfig.SetValuePr(val, "Memory configured value");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set kilobytes of physical RAM left unused by the system
+ *
+ * @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 mem_use Pointer to the Memory Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memfree.SetValuePr(val, "Memory freely available value");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the part of the slab that can be reclaimed such as caches measured in kilobytes
+ *
+ * @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 mem_use Pointer to the Memory Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_mem_use_slab_reclaimed_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.slabrecl.SetValuePr(val, "Memory reclaimable slab set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the part of the slab that cannot be reclaimed such as caches measured in kilobytes
+ *
+ * @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 mem_use Pointer to the Memory Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.slabunrecl.SetValuePr(val, "Memory unreclaimable slab set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the total memory minus the sum of free, buffered, cached and slab memory in kilobytes
+ *
+ * @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 mem_use Pointer to the Memory Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_mem_use_usedup_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memused.SetValuePr(val, "Memory usedup total set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional Disk usage value name/value pair to the Measurement.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ *
+ * @param id ASCIIZ string with the CPU's identifier.
+ * @param usage Disk utilization.
+ *****************************************************************************/
+ public MEASUREMENT_DISK_USE evel_measurement_new_disk_use_add(String id)
+ {
+ MEASUREMENT_DISK_USE disk_use = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(id != null);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding id={0} disk usage", id));
+ disk_use = new MEASUREMENT_DISK_USE();
+ assert(disk_use != null);
+ disk_use.id = id;
+ assert(disk_use.id != null);
+
+ disk_use.iotimeavg= new EvelOptionDouble();
+ disk_use.iotimelast= new EvelOptionDouble();
+ disk_use.iotimemax= new EvelOptionDouble();
+ disk_use.iotimemin= new EvelOptionDouble();
+ disk_use.mergereadavg= new EvelOptionDouble();
+ disk_use.mergereadlast= new EvelOptionDouble();
+ disk_use.mergereadmax= new EvelOptionDouble();
+ disk_use.mergereadmin= new EvelOptionDouble();
+ disk_use.mergewriteavg= new EvelOptionDouble();
+ disk_use.mergewritelast= new EvelOptionDouble();
+ disk_use.mergewritemax= new EvelOptionDouble();
+ disk_use.mergewritemin= new EvelOptionDouble();
+ disk_use.octetsreadavg= new EvelOptionDouble();
+ disk_use.octetsreadlast= new EvelOptionDouble();
+ disk_use.octetsreadmax= new EvelOptionDouble();
+ disk_use.octetsreadmin= new EvelOptionDouble();
+ disk_use.octetswriteavg= new EvelOptionDouble();
+ disk_use.octetswritelast= new EvelOptionDouble();
+ disk_use.octetswritemax= new EvelOptionDouble();
+ disk_use.octetswritemin= new EvelOptionDouble();
+ disk_use.opsreadavg= new EvelOptionDouble();
+ disk_use.opsreadlast= new EvelOptionDouble();
+ disk_use.opsreadmax= new EvelOptionDouble();
+ disk_use.opsreadmin= new EvelOptionDouble();
+ disk_use.opswriteavg= new EvelOptionDouble();
+ disk_use.opswritelast= new EvelOptionDouble();
+ disk_use.opswritemax= new EvelOptionDouble();
+ disk_use.opswritemin= new EvelOptionDouble();
+ disk_use.pendingopsavg= new EvelOptionDouble();
+ disk_use.pendingopslast= new EvelOptionDouble();
+ disk_use.pendingopsmax= new EvelOptionDouble();
+ disk_use.pendingopsmin= new EvelOptionDouble();
+ disk_use.timereadavg= new EvelOptionDouble();
+ disk_use.timereadlast= new EvelOptionDouble();
+ disk_use.timereadmax= new EvelOptionDouble();
+ disk_use.timereadmin= new EvelOptionDouble();
+ disk_use.timewriteavg= new EvelOptionDouble();
+ disk_use.timewritelast= new EvelOptionDouble();
+ disk_use.timewritemax= new EvelOptionDouble();
+ disk_use.timewritemin= new EvelOptionDouble();
+
+ if( disk_usage == null ){
+ disk_usage = new ArrayList<MEASUREMENT_DISK_USE>();
+ if( disk_usage == null ) LOGGER.error("Unable to allocate new disk usage");
+ }
+
+
+ disk_usage.add(disk_use);
+
+
+ EVEL_EXIT();
+ return disk_use;
+ }
+
+ /**************************************************************************//**
+ * Set milliseconds spent doing input/output operations over 1 sec; treat
+ * this metric as a device load percentage where 1000ms matches 100% load;
+ * provide the average over the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_iotimeavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.iotimeavg.SetValuePr(val,"Disk ioload set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set milliseconds spent doing input/output operations over 1 sec; treat
+ * this metric as a device load percentage where 1000ms matches 100% load;
+ * provide the last value within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_iotimelast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.iotimelast.SetValuePr(val, "Disk ioloadlast set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set milliseconds spent doing input/output operations over 1 sec; treat
+ * this metric as a device load percentage where 1000ms matches 100% load;
+ * provide the maximum value within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_iotimemax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.iotimemax.SetValuePr(val, "Disk ioloadmax set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set milliseconds spent doing input/output operations over 1 sec; treat
+ * this metric as a device load percentage where 1000ms matches 100% load;
+ * provide the minimum value within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_iotimemin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.iotimemin.SetValuePr(val, "Disk ioloadmin set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set number of logical read operations that were merged into physical read
+ * operations, e.g., two logical reads were served by one physical disk access;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_mergereadavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.mergereadavg.SetValuePr(val, "Disk Merged read average set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of logical read operations that were merged into physical read
+ * operations, e.g., two logical reads were served by one physical disk access;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_mergereadlast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.mergereadlast.SetValuePr(val, "Disk mergedload last set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of logical read operations that were merged into physical read
+ * operations, e.g., two logical reads were served by one physical disk access;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_mergereadmax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.mergereadmax.SetValuePr(val, "Disk merged loadmax set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set number of logical read operations that were merged into physical read
+ * operations, e.g., two logical reads were served by one physical disk access;
+ * provide the minimum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_mergereadmin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.mergereadmin.SetValuePr(val, "Disk merged loadmin set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of logical write operations that were merged into physical read
+ * operations, e.g., two logical writes were served by one physical disk access;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_mergewritelast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.mergewritelast.SetValuePr(val, "Disk merged writelast set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of logical write operations that were merged into physical read
+ * operations, e.g., two logical writes were served by one physical disk access;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_mergewritemax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.mergewritemax.SetValuePr(val, "Disk writemax set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of logical write operations that were merged into physical read
+ * operations, e.g., two logical writes were served by one physical disk access;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_mergewritemin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.mergewritemin.SetValuePr(val, "Disk writemin set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set number of octets per second read from a disk or partition;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetsreadavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetsreadavg.SetValuePr(val, "Octets readavg set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set number of octets per second read from a disk or partition;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetsreadlast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetsreadlast.SetValuePr(val, "Octets readlast set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set number of octets per second read from a disk or partition;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetsreadmax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetsreadmax.SetValuePr(val, "Octets readmax set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of octets per second read from a disk or partition;
+ * provide the minimum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetsreadmin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetsreadmin.SetValuePr(val, "Octets readmin set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of octets per second written to a disk or partition;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetswriteavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetswriteavg.SetValuePr(val, "Octets writeavg set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of octets per second written to a disk or partition;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetswritelast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetswritelast.SetValuePr(val, "Octets writelast set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of octets per second written to a disk or partition;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetswritemax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetswritemax.SetValuePr(val, "Octets writemax set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of octets per second written to a disk or partition;
+ * provide the minimum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_octetswritemin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.octetswritemin.SetValuePr(val, "Octets writemin set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set number of read operations per second issued to the disk;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opsreadavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opsreadavg.SetValuePr(val, "Disk read operation average set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of read operations per second issued to the disk;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opsreadlast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opsreadlast.SetValuePr(val, "Disk read operation last set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of read operations per second issued to the disk;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opsreadmax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opsreadmax.SetValuePr(val, "Disk read operation maximum set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of read operations per second issued to the disk;
+ * provide the minimum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opsreadmin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opsreadmin.SetValuePr(val, "Disk read operation minimum set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of write operations per second issued to the disk;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opswriteavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opswriteavg.SetValuePr(val, "Disk write operation average set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of write operations per second issued to the disk;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opswritelast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opswritelast.SetValuePr(val, "Disk write operation last set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set number of write operations per second issued to the disk;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opswritemax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opswritemax.SetValuePr(val, "Disk write operation maximum set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set number of write operations per second issued to the disk;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_opswritemin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.opswritemin.SetValuePr(val, "Disk write operation minimum set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set queue size of pending I/O operations per second;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_pendingopsavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.pendingopsavg.SetValuePr(val, "Disk pending operation average set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set queue size of pending I/O operations per second;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_pendingopslast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.pendingopslast.SetValuePr(val, "Disk pending operation last set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set queue size of pending I/O operations per second;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_pendingopsmax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.pendingopsmax.SetValuePr(val, "Disk pending operation maximum set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set queue size of pending I/O operations per second;
+ * provide the minimum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_pendingopsmin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.pendingopsmin.SetValuePr(val, "Disk pending operation min set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set milliseconds a read operation took to complete;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timereadavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timereadavg.SetValuePr(val, "Disk read time average set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set milliseconds a read operation took to complete;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timereadlast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timereadlast.SetValuePr(val, "Disk read time last set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set milliseconds a read operation took to complete;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timereadmax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timereadmax.SetValuePr(val, "Disk read time maximum set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set milliseconds a read operation took to complete;
+ * provide the minimum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timereadmin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timereadmin.SetValuePr(val, "Disk read time minimum set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set milliseconds a write operation took to complete;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timewriteavg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timewriteavg.SetValuePr(val, "Disk write time average set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set milliseconds a write operation took to complete;
+ * provide the last measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timewritelast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timewritelast.SetValuePr(val, "Disk write time last set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set milliseconds a write operation took to complete;
+ * provide the maximum measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timewritemax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timewritemax.SetValuePr(val, "Disk write time max set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set milliseconds a write operation took to complete;
+ * provide the average measurement within the measurement interval
+ *
+ * @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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_timewritemin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.timewritemin.SetValuePr(val, "Disk write time min set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional File System usage value name/value pair to the
+ * Measurement.
+ *
+ * The filesystem_name is null delimited ASCII string. The library takes a
+ * copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ *
+ * @param filesystem_name ASCIIZ string with the file-system's UUID.
+ * @param block_configured Block storage configured.
+ * @param block_used Block storage in use.
+ * @param block_iops Block storage IOPS.
+ * @param ephemeral_configured Ephemeral storage configured.
+ * @param ephemeral_used Ephemeral storage in use.
+ * @param ephemeral_iops Ephemeral storage IOPS.
+ *****************************************************************************/
+ public void evel_measurement_fsys_use_add(
+ String filesystem_name,
+ double block_configured,
+ double block_used,
+ double block_iops,
+ double ephemeral_configured,
+ double ephemeral_used,
+ double ephemeral_iops)
+ {
+ MEASUREMENT_FSYS_USE fsys_use = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(filesystem_name != null);
+ assert(block_configured >= 0.0);
+ assert(block_used >= 0.0);
+ assert(block_iops >= 0.0);
+ assert(ephemeral_configured >= 0.0);
+ assert(ephemeral_used >= 0.0);
+ assert(ephemeral_iops >= 0.0);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug("Adding filesystem_name="+filesystem_name);
+ fsys_use = new MEASUREMENT_FSYS_USE();
+ assert(fsys_use != null);
+ fsys_use.filesystem_name = filesystem_name;
+ fsys_use.block_configured = block_configured;
+ fsys_use.block_used = block_used;
+ fsys_use.block_iops = block_iops;
+ fsys_use.ephemeral_configured = ephemeral_configured;
+ fsys_use.ephemeral_used = ephemeral_used;
+ fsys_use.ephemeral_iops = ephemeral_iops;
+
+ if( filesystem_usage == null ){
+ filesystem_usage = new ArrayList<MEASUREMENT_FSYS_USE>();
+ if( filesystem_usage == null )LOGGER.error("Unable to allocate new file system usage");
+ }
+
+ filesystem_usage.add(fsys_use);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add a Feature usage value name/value pair to the Measurement.
+ *
+ * The name is null delimited ASCII string. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ *
+ * @param feature ASCIIZ string with the feature's name.
+ * @param utilization Utilization of the feature.
+ *****************************************************************************/
+ public void evel_measurement_feature_use_add(
+ String feature,
+ int utilization)
+ {
+ MEASUREMENT_FEATURE_USE feature_use = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(feature != null);
+ assert(utilization >= 0);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Feature={0} Use={1}", feature, utilization));
+ feature_use = new MEASUREMENT_FEATURE_USE();
+ assert(feature_use != null);
+ feature_use.feature_id = feature;
+ assert(feature_use.feature_id != null);
+ feature_use.feature_utilization = utilization;
+
+ if( feature_usage == null ){
+ feature_usage = new ArrayList<MEASUREMENT_FEATURE_USE>();
+ if( feature_usage == null )LOGGER.error("Unable to allocate new feature usage");
+ }
+
+ feature_usage.add(feature_use);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add a Additional Measurement value name/value pair to the Report.
+ *
+ * The name is null delimited ASCII string. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param measurement Pointer to the Measaurement.
+ * @param group ASCIIZ string with the measurement group's name.
+ * @param name ASCIIZ string containing the measurement's name.
+ * @param value ASCIIZ string containing the measurement's value.
+ *****************************************************************************/
+ public void evel_measurement_custom_measurement_add(
+ String group,
+ String name,
+ String value)
+ {
+ MEASUREMENT_GROUP measurement_group = null;
+ CUSTOM_MEASUREMENT custom_measurement = null;
+ MEASUREMENT_GROUP item = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(group != null);
+ assert(name != null);
+ assert(value != null);
+
+ /***************************************************************************/
+ /* Allocate a container for the name/value pair. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormat.format("Adding Measurement Group={0} Name={1} Value={2}",
+ group, name, value));
+ custom_measurement = new CUSTOM_MEASUREMENT();
+ assert(custom_measurement != null);
+ custom_measurement.name = name;
+ assert(custom_measurement.name != null);
+ custom_measurement.value = value;
+ assert(custom_measurement.value != null);
+
+ /***************************************************************************/
+ /* See if we have that group already. */
+ /***************************************************************************/
+ if (additional_measurements != null && additional_measurements.size()>0)
+ {
+ for(int i=0;i<additional_measurements.size();i++)
+ {
+ item = additional_measurements.get(i);
+ if( item.name.equals(name))
+ {
+ LOGGER.debug("Found existing Measurement Group");
+ measurement_group = item;
+ break;
+ }
+ }
+ }
+
+ /***************************************************************************/
+ /* If we didn't have the group already, create it. */
+ /***************************************************************************/
+ if (measurement_group == null)
+ {
+ LOGGER.debug("Creating new Measurement Group");
+ measurement_group = new MEASUREMENT_GROUP();
+ assert(measurement_group != null);
+ measurement_group.name = group;
+ assert(measurement_group.name != null);
+ if( additional_measurements == null){
+ additional_measurements = new ArrayList<MEASUREMENT_GROUP>();
+ if( additional_measurements == null ){
+ LOGGER.error("Unable to allocate additional measurements ");
+ }
+ }
+ additional_measurements.add(measurement_group);
+ }
+
+ /***************************************************************************/
+ /* If we didn't have the group already, create it. */
+ /***************************************************************************/
+ measurement_group.measurements.add(custom_measurement);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add a Codec usage value name/value pair to the Measurement.
+ *
+ * The name is null delimited ASCII string. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ *
+ * @param codec ASCIIZ string with the codec's name.
+ * @param utilization Number of codecs in use.
+ *****************************************************************************/
+ public void evel_measurement_codec_use_add( String codec,
+ int utilization )
+ {
+ MEASUREMENT_CODEC_USE codec_use = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(codec != null);
+ assert(utilization >= 0.0);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Codec={0} Use={1}", codec, utilization));
+ codec_use = new MEASUREMENT_CODEC_USE();
+ assert(codec_use != null);
+ codec_use.codec_id = codec;
+ codec_use.number_in_use = utilization;
+
+ if( codec_usage == null ){
+ codec_usage = new ArrayList<MEASUREMENT_CODEC_USE>();
+ if( codec_usage == null )LOGGER.error("Unable to allocate new codec usage");
+ }
+
+ codec_usage.add(codec_use);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Media Ports in Use property of 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 media_ports_in_use The media port usage to set.
+ *****************************************************************************/
+ public void evel_measurement_media_port_use_set(
+ int media_portsuse)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(media_portsuse >= 0);
+
+ media_ports_in_use.SetValuePr(
+ media_portsuse,
+ "Media Ports In Use");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the VNFC Scaling Metric property of 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 scaling_metric The scaling metric to set.
+ *****************************************************************************/
+ public void evel_measurement_vnfc_scaling_metric_set(EvelScalingMeasurement measurement,
+ int scaling_metric)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(measurement != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(scaling_metric >= 0.0);
+
+ vnfc_scaling_metric.SetValuePr(
+ scaling_metric,
+ "VNFC Scaling Metric");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Create a new Latency Bucket to be added to a Measurement event.
+ *
+ * @note The mandatory fields on the ::MEASUREMENT_LATENCY_BUCKET must be
+ * supplied to this factory function and are immutable once set.
+ * Optional fields have explicit setter functions, but again values
+ * may only be set once so that the ::MEASUREMENT_LATENCY_BUCKET has
+ * immutable properties.
+ *
+ * @param count Count of events in this bucket.
+ *
+ * @returns pointer to the newly manufactured ::MEASUREMENT_LATENCY_BUCKET.
+ * If the structure is not used it must be released using free.
+ * @retval null Failed to create the Latency Bucket.
+ *****************************************************************************/
+ public MEASUREMENT_LATENCY_BUCKET evel_new_meas_latency_bucket(int count)
+ {
+ MEASUREMENT_LATENCY_BUCKET bucket=null;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(count >= 0);
+
+ /***************************************************************************/
+ /* Allocate, then set Mandatory Parameters. */
+ /***************************************************************************/
+ LOGGER.debug("Creating bucket, count = "+count);
+ bucket = new MEASUREMENT_LATENCY_BUCKET();
+ assert(bucket != null);
+
+ /***************************************************************************/
+ /* Set Mandatory Parameters. */
+ /***************************************************************************/
+ bucket.count = count;
+
+ /***************************************************************************/
+ /* Initialize Optional Parameters. */
+ /***************************************************************************/
+ bucket.low_end = new EvelOptionDouble();
+ bucket.high_end = new EvelOptionDouble();
+
+ EVEL_EXIT();
+
+ return bucket;
+ }
+
+ /**************************************************************************//**
+ * Set the High End property of the Measurement Latency Bucket.
+ *
+ * @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 bucket Pointer to the Measurement Latency Bucket.
+ * @param high_end High end of the bucket's range.
+ *****************************************************************************/
+ public void evel_meas_latency_bucket_high_end_set(
+ MEASUREMENT_LATENCY_BUCKET bucket,
+ double high_end)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(high_end >= 0.0);
+ bucket.high_end.SetValuePr(high_end, "High End");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Low End property of the Measurement Latency Bucket.
+ *
+ * @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 bucket Pointer to the Measurement Latency Bucket.
+ * @param low_end Low end of the bucket's range.
+ *****************************************************************************/
+ public void evel_meas_latency_bucket_low_end_set(
+ MEASUREMENT_LATENCY_BUCKET bucket,
+ double low_end)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(low_end >= 0.0);
+ bucket.low_end.SetValuePr(low_end, "Low End");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional Measurement Latency Bucket to the specified event.
+ *
+ * @param measurement Pointer to the Measurement event.
+ * @param bucket Pointer to the Measurement Latency Bucket to add.
+ *****************************************************************************/
+ public void evel_meas_latency_bucket_add(MEASUREMENT_LATENCY_BUCKET bucket)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(bucket != null);
+
+ if( latency_distribution == null ){
+ latency_distribution = new ArrayList<MEASUREMENT_LATENCY_BUCKET>();
+ if( latency_distribution == null )LOGGER.error("Unable to allocate new file system usage");
+ }
+ latency_distribution.add(bucket);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional Latency Distribution bucket to the Measurement.
+ *
+ * This function implements the previous API, purely for convenience.
+ *
+ *
+ * @param low_end Low end of the bucket's range.
+ * @param high_end High end of the bucket's range.
+ * @param count Count of events in this bucket.
+ *****************************************************************************/
+ public void evel_measurement_latency_add(
+ double low_end,
+ double high_end,
+ int count)
+ {
+ MEASUREMENT_LATENCY_BUCKET bucket = null;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Trust the assertions in the underlying methods. */
+ /***************************************************************************/
+ bucket = evel_new_meas_latency_bucket(count);
+ bucket.low_end.SetValue(low_end);
+ bucket.high_end.SetValue(high_end);
+ evel_meas_latency_bucket_add(bucket);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Create a new vNIC Use to be added to a Measurement event.
+ *
+ * @note The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied
+ * to this factory function and are immutable once set. Optional
+ * fields have explicit setter functions, but again values may only be
+ * set once so that the ::MEASUREMENT_VNIC_PERFORMANCE has immutable
+ * properties.
+ *
+ * @param vnic_id ASCIIZ string with the vNIC's ID.
+ * @param val_suspect True or false confidence in data.
+ *
+ * @returns pointer to the newly manufactured ::MEASUREMENT_VNIC_PERFORMANCE.
+ * If the structure is not used it must be released using
+ * ::evel_measurement_free_vnic_performance.
+ * @retval null Failed to create the vNIC Use.
+ *****************************************************************************/
+ public MEASUREMENT_VNIC_PERFORMANCE evel_measurement_new_vnic_performance(String vnic_id,
+ String val_suspect)
+ {
+ MEASUREMENT_VNIC_PERFORMANCE vnic_perf=null;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(vnic_id != null);
+ assert(val_suspect.equals("true") || val_suspect.equals("false"));
+
+ /***************************************************************************/
+ /* Allocate, then set Mandatory Parameters. */
+ /***************************************************************************/
+
+ vnic_perf = new MEASUREMENT_VNIC_PERFORMANCE();
+ assert(vnic_perf != null);
+ vnic_perf.vnic_id = vnic_id;
+ vnic_perf.valuesaresuspect = val_suspect;
+
+ vnic_perf.recvd_bcast_packets_acc= new EvelOptionDouble();
+ vnic_perf.recvd_bcast_packets_delta= new EvelOptionDouble();
+
+ vnic_perf.recvd_discarded_packets_acc= new EvelOptionDouble();
+ vnic_perf.recvd_discarded_packets_delta= new EvelOptionDouble();
+ vnic_perf.recvd_error_packets_acc= new EvelOptionDouble();
+ vnic_perf.recvd_error_packets_delta= new EvelOptionDouble();
+ vnic_perf.recvd_mcast_packets_acc= new EvelOptionDouble();
+ vnic_perf.recvd_mcast_packets_delta= new EvelOptionDouble();
+ vnic_perf.recvd_octets_acc= new EvelOptionDouble();
+ vnic_perf.recvd_octets_delta= new EvelOptionDouble();
+ vnic_perf.recvd_total_packets_acc= new EvelOptionDouble();
+ vnic_perf.recvd_total_packets_delta= new EvelOptionDouble();
+ vnic_perf.recvd_ucast_packets_acc= new EvelOptionDouble();
+ vnic_perf.recvd_ucast_packets_delta= new EvelOptionDouble();
+ vnic_perf.tx_bcast_packets_acc= new EvelOptionDouble();
+ vnic_perf.tx_bcast_packets_delta= new EvelOptionDouble();
+ vnic_perf.tx_discarded_packets_acc= new EvelOptionDouble();
+ vnic_perf.tx_discarded_packets_delta= new EvelOptionDouble();
+ vnic_perf.tx_error_packets_acc= new EvelOptionDouble();
+ vnic_perf.tx_error_packets_delta= new EvelOptionDouble();
+ vnic_perf.tx_mcast_packets_acc= new EvelOptionDouble();
+ vnic_perf.tx_mcast_packets_delta= new EvelOptionDouble();
+ vnic_perf.tx_octets_acc= new EvelOptionDouble();
+ vnic_perf.tx_octets_delta= new EvelOptionDouble();
+ vnic_perf.tx_total_packets_acc= new EvelOptionDouble();
+ vnic_perf.tx_total_packets_delta= new EvelOptionDouble();
+ vnic_perf.tx_ucast_packets_acc= new EvelOptionDouble();
+ vnic_perf.tx_ucast_packets_delta= new EvelOptionDouble();
+
+ LOGGER.debug("Adding "+vnic_perf+"VNIC ID="+ vnic_perf.vnic_id+"Value="+vnic_perf.valuesaresuspect);
+
+ /***************************************************************************/
+ /* Initialize Optional Parameters. */
+ /***************************************************************************/
+ EVEL_EXIT();
+
+ return vnic_perf;
+ }
+
+
+
+ /**************************************************************************//**
+ * Set the Accumulated Broadcast Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_bcast_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_bcast_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_bcast_packets_acc >= 0.0);
+
+ vnic_performance.recvd_bcast_packets_acc.SetValuePr(
+ recvd_bcast_packets_acc,
+ "Broadcast Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Broadcast Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_bcast_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_bcast_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_bcast_packets_delta >= 0.0);
+
+ vnic_performance.recvd_bcast_packets_delta.SetValuePr(
+ recvd_bcast_packets_delta,
+ "Delta Broadcast Packets recieved");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Discarded Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_discard_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_discard_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_discard_packets_acc >= 0.0);
+
+ vnic_performance.recvd_discarded_packets_acc.SetValuePr(
+ recvd_discard_packets_acc,
+ "Discarded Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Discarded Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_discard_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_discard_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_discard_packets_delta >= 0.0);
+
+ vnic_performance.recvd_discarded_packets_delta.SetValuePr(
+ recvd_discard_packets_delta,
+ "Delta Discarded Packets recieved");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Error Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_error_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_error_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_error_packets_acc >= 0.0);
+
+ vnic_performance.recvd_error_packets_acc.SetValuePr(
+ recvd_error_packets_acc,
+ "Error Packets received accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Error Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_error_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_error_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_error_packets_delta >= 0.0);
+
+ vnic_performance.recvd_error_packets_delta.SetValuePr(
+ recvd_error_packets_delta,
+ "Delta Error Packets recieved");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Accumulated Multicast Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_mcast_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_mcast_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_mcast_packets_acc >= 0.0);
+
+ vnic_performance.recvd_mcast_packets_acc.SetValuePr(
+ recvd_mcast_packets_acc,
+ "Multicast Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Multicast Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_mcast_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_mcast_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_mcast_packets_delta >= 0.0);
+
+ vnic_performance.recvd_mcast_packets_delta.SetValuePr(
+ recvd_mcast_packets_delta,
+ "Delta Multicast Packets recieved");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Accumulated Octets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_octets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_octets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_octets_acc >= 0.0);
+
+ vnic_performance.recvd_octets_acc.SetValuePr(
+ recvd_octets_acc,
+ "Octets received accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Octets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_octets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_octets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_octets_delta >= 0.0);
+
+ vnic_performance.recvd_octets_delta.SetValuePr(
+ recvd_octets_delta,
+ "Delta Octets recieved");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Accumulated Total Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_total_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_total_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_total_packets_acc >= 0.0);
+
+ vnic_performance.recvd_total_packets_acc.SetValuePr(
+ recvd_total_packets_acc,
+ "Total Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Total Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_total_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_total_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_total_packets_delta >= 0.0);
+
+ vnic_performance.recvd_total_packets_delta.SetValuePr(
+ recvd_total_packets_delta,
+ "Delta Total Packets recieved");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Accumulated Unicast Packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_ucast_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_ucast_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_ucast_packets_acc >= 0.0);
+
+ vnic_performance.recvd_ucast_packets_acc.SetValuePr(
+ recvd_ucast_packets_acc,
+ "Unicast Packets received accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Unicast packets Received in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param recvd_ucast_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double recvd_ucast_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(recvd_ucast_packets_delta >= 0.0);
+
+ vnic_performance.recvd_ucast_packets_delta.SetValuePr(
+ recvd_ucast_packets_delta,
+ "Delta Unicast packets recieved");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Transmitted Broadcast Packets in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_bcast_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_bcast_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_bcast_packets_acc >= 0.0);
+
+ vnic_performance.tx_bcast_packets_acc.SetValuePr(
+ tx_bcast_packets_acc,
+ "Transmitted Broadcast Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Broadcast packets Transmitted in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_bcast_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_bcast_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_bcast_packets_delta >= 0.0);
+
+ vnic_performance.tx_bcast_packets_delta.SetValuePr(
+ tx_bcast_packets_delta,
+ "Delta Transmitted Broadcast packets ");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Transmitted Discarded Packets in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_discarded_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_discarded_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_discarded_packets_acc >= 0.0);
+
+ vnic_performance.tx_discarded_packets_acc.SetValuePr(
+ tx_discarded_packets_acc,
+ "Transmitted Discarded Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Discarded packets Transmitted in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_discarded_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_discarded_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_discarded_packets_delta >= 0.0);
+
+ vnic_performance.tx_discarded_packets_delta.SetValuePr(
+ tx_discarded_packets_delta,
+ "Delta Transmitted Discarded packets ");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Transmitted Errored Packets in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_error_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_error_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_error_packets_acc >= 0.0);
+
+ vnic_performance.tx_error_packets_acc.SetValuePr(
+ tx_error_packets_acc,
+ "Transmitted Error Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Errored packets Transmitted in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_error_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_error_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_error_packets_delta >= 0.0);
+
+ vnic_performance.tx_error_packets_delta.SetValuePr(
+ tx_error_packets_delta,
+ "Delta Transmitted Error packets ");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Transmitted Multicast Packets in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_mcast_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_mcast_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_mcast_packets_acc >= 0.0);
+
+ vnic_performance.tx_mcast_packets_acc.SetValuePr(
+ tx_mcast_packets_acc,
+ "Transmitted Multicast Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Multicast packets Transmitted in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_mcast_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_mcast_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_mcast_packets_delta >= 0.0);
+
+ vnic_performance.tx_mcast_packets_delta.SetValuePr(
+ tx_mcast_packets_delta,
+ "Delta Transmitted Multicast packets ");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Transmitted Octets in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_octets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_octets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_octets_acc >= 0.0);
+
+ vnic_performance.tx_octets_acc.SetValuePr(
+ tx_octets_acc,
+ "Transmitted Octets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Octets Transmitted in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_octets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_octets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_octets_delta >= 0.0);
+
+ vnic_performance.tx_octets_delta.SetValuePr(
+ tx_octets_delta,
+ "Delta Transmitted Octets ");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Transmitted Total Packets in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_total_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_total_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_total_packets_acc >= 0.0);
+
+ vnic_performance.tx_total_packets_acc.SetValuePr(
+ tx_total_packets_acc,
+ "Transmitted Total Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Total Packets Transmitted in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_total_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_total_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_total_packets_delta >= 0.0);
+
+ vnic_performance.tx_total_packets_delta.SetValuePr(
+ tx_total_packets_delta,
+ "Delta Transmitted Total Packets ");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Transmitted Unicast Packets in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_ucast_packets_acc
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_ucast_packets_acc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_ucast_packets_acc >= 0.0);
+
+ vnic_performance.tx_ucast_packets_acc.SetValuePr(
+ tx_ucast_packets_acc,
+ "Transmitted Unicast Packets accumulated");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Delta Octets Transmitted in measurement interval
+ * property of the vNIC performance.
+ *
+ * @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 vnic_performance Pointer to the vNIC Use.
+ * @param tx_ucast_packets_delta
+ *****************************************************************************/
+ public void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE vnic_performance,
+ double tx_ucast_packets_delta)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(tx_ucast_packets_delta >= 0.0);
+
+ vnic_performance.tx_ucast_packets_delta.SetValuePr(
+ tx_ucast_packets_delta,
+ "Delta Transmitted Unicast Packets ");
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Add an additional vNIC Use to the specified Measurement event.
+ *
+ *
+ * @param vnic_performance Pointer to the vNIC Use to add.
+ *****************************************************************************/
+ public void evel_meas_vnic_performance_add(
+ MEASUREMENT_VNIC_PERFORMANCE vnic_performance)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(vnic_performance != null);
+
+ if( vnic_usage == null ){
+ vnic_usage = new ArrayList<MEASUREMENT_VNIC_PERFORMANCE>();
+ if( vnic_usage == null )LOGGER.error("Unable to allocate new file system usage");
+ }
+
+ vnic_usage.add(vnic_performance);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional vNIC usage record Measurement.
+ *
+ * This function implements the previous API, purely for convenience.
+ *
+ * The ID is null delimited ASCII string. The library takes a copy so the
+ * caller does not have to preserve values after the function returns.
+ *
+ * @param measurement Pointer to the measurement.
+ * @param vnic_id ASCIIZ string with the vNIC's ID.
+ * @param valset true or false confidence level
+ * @param recvd_bcast_packets_acc Recieved broadcast packets
+ * @param recvd_bcast_packets_delta Received delta broadcast packets
+ * @param recvd_discarded_packets_acc Recieved discarded packets
+ * @param recvd_discarded_packets_delta Received discarded delta packets
+ * @param recvd_error_packets_acc Received error packets
+ * @param recvd_error_packets_delta, Received delta error packets
+ * @param recvd_mcast_packets_acc Received multicast packets
+ * @param recvd_mcast_packets_delta Received delta multicast packets
+ * @param recvd_octets_acc Received octets
+ * @param recvd_octets_delta Received delta octets
+ * @param recvd_total_packets_acc Received total packets
+ * @param recvd_total_packets_delta Received delta total packets
+ * @param recvd_ucast_packets_acc Received Unicast packets
+ * @param recvd_ucast_packets_delta Received delta unicast packets
+ * @param tx_bcast_packets_acc Transmitted broadcast packets
+ * @param tx_bcast_packets_delta Transmitted delta broadcast packets
+ * @param tx_discarded_packets_acc Transmitted packets discarded
+ * @param tx_discarded_packets_delta Transmitted delta discarded packets
+ * @param tx_error_packets_acc Transmitted error packets
+ * @param tx_error_packets_delta Transmitted delta error packets
+ * @param tx_mcast_packets_acc Transmitted multicast packets accumulated
+ * @param tx_mcast_packets_delta Transmitted delta multicast packets
+ * @param tx_octets_acc Transmitted octets
+ * @param tx_octets_delta Transmitted delta octets
+ * @param tx_total_packets_acc Transmitted total packets
+ * @param tx_total_packets_delta Transmitted delta total packets
+ * @param tx_ucast_packets_acc Transmitted Unicast packets
+ * @param tx_ucast_packets_delta Transmitted delta Unicast packets
+ *****************************************************************************/
+ public void evel_measurement_vnic_performance_add(
+ String vnic_id,
+ String valset,
+ double recvd_bcast_packets_acc,
+ double recvd_bcast_packets_delta,
+ double recvd_discarded_packets_acc,
+ double recvd_discarded_packets_delta,
+ double recvd_error_packets_acc,
+ double recvd_error_packets_delta,
+ double recvd_mcast_packets_acc,
+ double recvd_mcast_packets_delta,
+ double recvd_octets_acc,
+ double recvd_octets_delta,
+ double recvd_total_packets_acc,
+ double recvd_total_packets_delta,
+ double recvd_ucast_packets_acc,
+ double recvd_ucast_packets_delta,
+ double tx_bcast_packets_acc,
+ double tx_bcast_packets_delta,
+ double tx_discarded_packets_acc,
+ double tx_discarded_packets_delta,
+ double tx_error_packets_acc,
+ double tx_error_packets_delta,
+ double tx_mcast_packets_acc,
+ double tx_mcast_packets_delta,
+ double tx_octets_acc,
+ double tx_octets_delta,
+ double tx_total_packets_acc,
+ double tx_total_packets_delta,
+ double tx_ucast_packets_acc,
+ double tx_ucast_packets_delta)
+ {
+ MEASUREMENT_VNIC_PERFORMANCE vnic_performance = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Trust the assertions in the underlying methods. */
+ /***************************************************************************/
+ vnic_performance = evel_measurement_new_vnic_performance(vnic_id, valset);
+
+ evel_vnic_performance_rx_bcast_pkt_acc_set(vnic_performance, recvd_bcast_packets_acc);
+ evel_vnic_performance_rx_bcast_pkt_delta_set(vnic_performance, recvd_bcast_packets_delta);
+ evel_vnic_performance_rx_discard_pkt_acc_set(vnic_performance, recvd_discarded_packets_acc);
+ evel_vnic_performance_rx_discard_pkt_delta_set(vnic_performance, recvd_discarded_packets_delta);
+ evel_vnic_performance_rx_error_pkt_acc_set(vnic_performance, recvd_error_packets_acc);
+ evel_vnic_performance_rx_error_pkt_delta_set(vnic_performance, recvd_error_packets_delta);
+ evel_vnic_performance_rx_mcast_pkt_acc_set(vnic_performance, recvd_mcast_packets_acc);
+ evel_vnic_performance_rx_mcast_pkt_delta_set(vnic_performance, recvd_mcast_packets_delta);
+ evel_vnic_performance_rx_octets_acc_set(vnic_performance, recvd_octets_acc);
+ evel_vnic_performance_rx_octets_delta_set(vnic_performance, recvd_octets_delta);
+ evel_vnic_performance_rx_total_pkt_acc_set(vnic_performance, recvd_total_packets_acc);
+ evel_vnic_performance_rx_total_pkt_delta_set(vnic_performance, recvd_total_packets_delta);
+ evel_vnic_performance_rx_ucast_pkt_acc_set(vnic_performance, recvd_ucast_packets_acc);
+ evel_vnic_performance_rx_ucast_pkt_delta_set(vnic_performance, recvd_ucast_packets_delta);
+ evel_vnic_performance_tx_bcast_pkt_acc_set(vnic_performance, tx_bcast_packets_acc);
+ evel_vnic_performance_tx_bcast_pkt_delta_set(vnic_performance, tx_bcast_packets_delta);
+ evel_vnic_performance_tx_discarded_pkt_acc_set(vnic_performance, tx_discarded_packets_acc);
+ evel_vnic_performance_tx_discarded_pkt_delta_set(vnic_performance, tx_discarded_packets_delta);
+ evel_vnic_performance_tx_error_pkt_acc_set(vnic_performance, tx_error_packets_acc);
+ evel_vnic_performance_tx_error_pkt_delta_set(vnic_performance, tx_error_packets_delta);
+ evel_vnic_performance_tx_mcast_pkt_acc_set(vnic_performance, tx_mcast_packets_acc);
+ evel_vnic_performance_tx_mcast_pkt_delta_set(vnic_performance, tx_mcast_packets_delta);
+ evel_vnic_performance_tx_octets_acc_set(vnic_performance, tx_octets_acc);
+ evel_vnic_performance_tx_octets_delta_set(vnic_performance, tx_octets_delta);
+ evel_vnic_performance_tx_total_pkt_acc_set(vnic_performance, tx_total_packets_acc);
+ evel_vnic_performance_tx_total_pkt_delta_set(vnic_performance, tx_total_packets_delta);
+ evel_vnic_performance_tx_ucast_pkt_acc_set(vnic_performance, tx_ucast_packets_acc);
+ evel_vnic_performance_tx_ucast_pkt_delta_set(vnic_performance, tx_ucast_packets_delta);
+
+ if( vnic_usage == null ){
+ vnic_usage = new ArrayList<MEASUREMENT_VNIC_PERFORMANCE>();
+ if( vnic_usage == null )LOGGER.error("Unable to allocate new file system usage");
+ }
+
+ vnic_usage.add(vnic_performance);
+ }
+
+ /**************************************************************************//**
+ * Add a json object to jsonObject list.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param jsonobj Pointer to json object
+ *****************************************************************************/
+ public void evel_measurement_add_jsonobj(javax.json.JsonObject jsonobj)
+ {
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(jsonobj != null);
+
+ LOGGER.debug("Adding jsonObject");
+
+ if( additional_objects == null )
+ additional_objects = new ArrayList<javax.json.JsonObject>();
+
+ additional_objects.add(jsonobj);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Encode Scaling Measurement Object according to VES schema
+ *
+ * @retval JSON Object of Scaling Measurement event
+ *****************************************************************************/
+ JsonObjectBuilder evelScalingMeasurementObject()
+ {
+ MEASUREMENT_CPU_USE cpu_use = null;
+ MEASUREMENT_MEM_USE mem_use = null;
+ MEASUREMENT_DISK_USE disk_use = null;
+ MEASUREMENT_FSYS_USE fsys_use = null;
+ MEASUREMENT_LATENCY_BUCKET bucket = null;
+ MEASUREMENT_VNIC_PERFORMANCE vnic_use = null;
+ MEASUREMENT_FEATURE_USE feature_use = null;
+ MEASUREMENT_CODEC_USE codec_use = null;
+ MEASUREMENT_GROUP meas_group = null;
+ CUSTOM_MEASUREMENT custom_meas = null;
+ //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;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+ JsonObjectBuilder evelmeasmt = Json.createObjectBuilder()
+ .add("measurementInterval", measurement_interval);
+
+ /***************************************************************************/
+ /* 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);
+ }
+
+
+ // TBD additional json objects
+ if( concurrent_sessions.is_set )
+ evelmeasmt.add("concurrentSessions", concurrent_sessions.GetValue());
+ if( configured_entities.is_set )
+ evelmeasmt.add("configuredEntities", configured_entities.GetValue());
+
+ /***************************************************************************/
+ /* CPU Use list. */
+ /***************************************************************************/
+ if( cpu_usage != null && cpu_usage.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<cpu_usage.size();i++) {
+ cpu_use = cpu_usage.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "cpuIdentifier", cpu_use.id)
+ .add( "percentUsage",cpu_use.usage);
+
+ cpu_use.idle.encJsonValue(obj,"cpuIdle");
+ cpu_use.intrpt.encJsonValue(obj,"cpuUsageInterrupt");
+ cpu_use.nice.encJsonValue(obj,"cpuUsageNice");
+ cpu_use.softirq.encJsonValue(obj,"cpuUsageSoftIrq");
+ cpu_use.steal.encJsonValue(obj,"cpuUsageSteal");
+ cpu_use.sys.encJsonValue(obj,"cpuUsageSystem");
+ cpu_use.user.encJsonValue(obj,"cpuUsageUser");
+ cpu_use.wait.encJsonValue(obj,"cpuWait");
+
+ builder.add(obj.build());
+ }
+ evelmeasmt.add("cpuUsageArray", builder);
+ }
+
+
+
+ /***************************************************************************/
+ /* Disk Use list. */
+ /***************************************************************************/
+ if( disk_usage != null && disk_usage.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<disk_usage.size();i++) {
+ disk_use = disk_usage.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "diskIdentifier", disk_use.id);
+
+ disk_use.iotimeavg.encJsonValue(obj,"diskIoTimeAvg");
+ disk_use.iotimelast.encJsonValue(obj,"diskIoTimeLast");
+ disk_use.iotimemax.encJsonValue(obj,"diskIoTimeMax");
+ disk_use.iotimemin.encJsonValue(obj,"diskIoTimeMin");
+ disk_use.mergereadavg.encJsonValue(obj,"diskMergedReadAvg");
+ disk_use.mergereadlast.encJsonValue(obj,"diskMergedReadLast");
+ disk_use.mergereadmax.encJsonValue(obj,"diskMergedReadMax");
+ disk_use.mergereadmin.encJsonValue(obj,"diskMergedReadMin");
+ disk_use.mergewriteavg.encJsonValue(obj,"diskMergedWriteAvg");
+ disk_use.mergewritelast.encJsonValue(obj,"diskMergedWriteLast");
+ disk_use.mergewritemax.encJsonValue(obj,"diskMergedWriteMax");
+ disk_use.mergewritemin.encJsonValue(obj,"diskMergedWriteMin");
+ disk_use.octetsreadavg.encJsonValue(obj,"diskOctetsReadAvg");
+ disk_use.octetsreadlast.encJsonValue(obj,"diskOctetsReadLast");
+ disk_use.octetsreadmax.encJsonValue(obj,"diskOctetsReadMax");
+ disk_use.octetsreadmin.encJsonValue(obj,"diskOctetsReadMin");
+ disk_use.octetswriteavg.encJsonValue(obj,"diskOctetsWriteAvg");
+ disk_use.octetswritelast.encJsonValue(obj,"diskOctetsWriteLast");
+ disk_use.octetswritemax.encJsonValue(obj,"diskOctetsWriteMax");
+ disk_use.octetswritemin.encJsonValue(obj,"diskOctetsWriteMin");
+ disk_use.opsreadavg.encJsonValue(obj,"diskOpsReadAvg");
+ disk_use.opsreadlast.encJsonValue(obj,"diskOpsReadLast");
+ disk_use.opsreadmax.encJsonValue(obj,"diskOpsReadMax");
+ disk_use.opsreadmin.encJsonValue(obj,"diskOpsReadMin");
+ disk_use.opswriteavg.encJsonValue(obj,"diskOpsWriteAvg");
+ disk_use.opswritelast.encJsonValue(obj,"diskOpsWriteLast");
+ disk_use.opswritemax.encJsonValue(obj,"diskOpsWriteMax");
+ disk_use.opswritemin.encJsonValue(obj,"diskOpsWriteMin");
+ disk_use.pendingopsavg.encJsonValue(obj,"diskPendingOperationsAvg");
+ disk_use.pendingopslast.encJsonValue(obj,"diskPendingOperationsLast");
+ disk_use.pendingopsmax.encJsonValue(obj,"diskPendingOperationsMax");
+ disk_use.pendingopsmin.encJsonValue(obj,"diskPendingOperationsMin");
+ disk_use.timereadavg.encJsonValue(obj,"diskTimeReadAvg");
+ disk_use.timereadlast.encJsonValue(obj,"diskTimeReadLast");
+ disk_use.timereadmax.encJsonValue(obj,"diskTimeReadMax");
+ disk_use.timereadmin.encJsonValue(obj,"diskTimeReadMin");
+ disk_use.timewriteavg.encJsonValue(obj,"diskTimeWriteAvg");
+ disk_use.timewritelast.encJsonValue(obj,"diskTimeWriteLast");
+ disk_use.timewritemax.encJsonValue(obj,"diskTimeWriteMax");
+ disk_use.timewritemin.encJsonValue(obj,"diskTimeWriteMin");
+
+ builder.add(obj.build());
+ }
+ evelmeasmt.add("diskUsageArray", builder);
+ }
+
+
+ /***************************************************************************/
+ /* Filesystem Usage list. */
+ /***************************************************************************/
+ if( filesystem_usage != null && filesystem_usage.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<filesystem_usage.size();i++) {
+ fsys_use = filesystem_usage.get(i);
+ JsonObject obj = Json.createObjectBuilder()
+ .add("blockConfigured", fsys_use.block_configured)
+ .add("blockIops", fsys_use.block_iops)
+ .add("blockUsed", fsys_use.block_used)
+ .add("ephemeralConfigured", fsys_use.ephemeral_configured)
+ .add("ephemeralIops", fsys_use.ephemeral_iops)
+ .add("ephemeralUsed", fsys_use.ephemeral_used)
+ .add("filesystemName", fsys_use.filesystem_name)
+ .build();
+ builder.add(obj);
+ }
+ evelmeasmt.add("filesystemUsageArray", builder);
+ }
+
+ /***************************************************************************/
+ /* Latency distribution. */
+ /***************************************************************************/
+ if( latency_distribution != null && latency_distribution.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<latency_distribution.size();i++) {
+ bucket = latency_distribution.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "countsInTheBucket", bucket.count);
+
+ bucket.low_end.encJsonValue(obj,"lowEndOfLatencyBucket");
+ bucket.high_end.encJsonValue(obj,"highEndOfLatencyBucket");
+
+ builder.add(obj.build());
+ }
+ evelmeasmt.add("latencyDistribution", builder);
+ }
+
+ mean_request_latency.encJsonValue(evelmeasmt, "meanRequestLatency");
+ request_rate.encJsonValue(evelmeasmt, "requestRate");
+
+ /***************************************************************************/
+ /* vNIC Usage TBD Performance array */
+ /***************************************************************************/
+ if( vnic_usage!= null && vnic_usage.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<vnic_usage.size();i++) {
+ vnic_use = vnic_usage.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "vNicIdentifier", vnic_use.vnic_id)
+ .add( "valuesAreSuspect",vnic_use.valuesaresuspect);
+
+
+ /*********************************************************************/
+ /* Optional fields. */
+ /*********************************************************************/
+ vnic_use.recvd_bcast_packets_acc.encJsonValue(obj,"receivedBroadcastPacketsAccumulated");
+ vnic_use.recvd_bcast_packets_delta.encJsonValue(obj,"receivedBroadcastPacketsDelta");
+ vnic_use.recvd_discarded_packets_acc.encJsonValue(obj,"receivedDiscardedPacketsAccumulated");
+ vnic_use.recvd_discarded_packets_delta.encJsonValue(obj,"receivedDiscardedPacketsDelta");
+ vnic_use.recvd_error_packets_acc.encJsonValue(obj,"receivedErrorPacketsAccumulated");
+ vnic_use.recvd_error_packets_delta.encJsonValue(obj,"receivedErrorPacketsDelta");
+
+ vnic_use.recvd_mcast_packets_acc.encJsonValue(obj,"receivedMulticastPacketsAccumulated");
+ vnic_use.recvd_mcast_packets_delta.encJsonValue(obj,"receivedMulticastPacketsDelta");
+ vnic_use.recvd_octets_acc.encJsonValue(obj,"receivedOctetsAccumulated");
+ vnic_use.recvd_octets_delta.encJsonValue(obj,"receivedOctetsDelta");
+
+ vnic_use.recvd_total_packets_acc.encJsonValue(obj,"receivedTotalPacketsAccumulated");
+ vnic_use.recvd_total_packets_delta.encJsonValue(obj,"receivedTotalPacketsDelta");
+ vnic_use.recvd_ucast_packets_acc.encJsonValue(obj,"receivedUnicastPacketsAccumulated");
+ vnic_use.recvd_ucast_packets_delta.encJsonValue(obj,"receivedUnicastPacketsDelta");
+
+ vnic_use.tx_bcast_packets_acc.encJsonValue(obj,"transmittedBroadcastPacketsAccumulated");
+ vnic_use.tx_bcast_packets_delta.encJsonValue(obj,"transmittedBroadcastPacketsDelta");
+ vnic_use.tx_discarded_packets_acc.encJsonValue(obj,"transmittedDiscardedPacketsAccumulated");
+ vnic_use.tx_discarded_packets_delta.encJsonValue(obj,"transmittedDiscardedPacketsDelta");
+
+ vnic_use.tx_error_packets_acc.encJsonValue(obj,"transmittedErrorPacketsAccumulated");
+ vnic_use.tx_error_packets_delta.encJsonValue(obj,"transmittedErrorPacketsDelta");
+ vnic_use.tx_mcast_packets_acc.encJsonValue(obj,"transmittedMulticastPacketsAccumulated");
+ vnic_use.tx_mcast_packets_delta.encJsonValue(obj,"transmittedMulticastPacketsDelta");
+
+ vnic_use.tx_octets_acc.encJsonValue(obj,"transmittedOctetsAccumulated");
+ vnic_use.tx_octets_delta.encJsonValue(obj,"transmittedOctetsDelta");
+ vnic_use.tx_total_packets_acc.encJsonValue(obj,"transmittedTotalPacketsAccumulated");
+ vnic_use.tx_total_packets_delta.encJsonValue(obj,"transmittedTotalPacketsDelta");
+ vnic_use.tx_ucast_packets_acc.encJsonValue(obj,"transmittedUnicastPacketsAccumulated");
+ vnic_use.tx_ucast_packets_delta.encJsonValue(obj,"transmittedUnicastPacketsDelta");
+
+ builder.add(obj.build());
+ }
+ evelmeasmt.add("vNicUsageArray", builder);
+ }
+
+
+
+ /***************************************************************************/
+ /* Memory Use list. */
+ /***************************************************************************/
+ if( mem_usage != null && mem_usage.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<mem_usage.size();i++) {
+ mem_use = mem_usage.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "memIdentifier", mem_use.id)
+ .add( "vmIdentifier", mem_use.vmid)
+ .add( "percentUsage",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");
+
+ builder.add(obj.build());
+ }
+ evelmeasmt.add("memUsageArray", builder);
+ }
+
+ media_ports_in_use.encJsonValue(evelmeasmt, "numberOfMediaPortsInUse");
+ vnfc_scaling_metric.encJsonValue(evelmeasmt, "vnfcScalingMetric");
+
+
+ /***************************************************************************/
+ /* 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 )
+ {
+ 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(obj.build());
+ }
+ evelmeasmt.add("featureUsageArray", builder);
+ }
+
+
+ /***************************************************************************/
+ /* Codec Utilization list. */
+ /***************************************************************************/
+ if( codec_usage != null && codec_usage.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<codec_usage.size();i++) {
+ codec_use = codec_usage.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "codecIdentifier", codec_use.codec_id)
+ .add( "numberInUse", codec_use.number_in_use);
+
+ builder.add(obj.build());
+ }
+ evelmeasmt.add("codecUsageArray", builder);
+ }
+
+
+ /***************************************************************************/
+ /* Additional Measurement Groups list. */
+ /***************************************************************************/
+ if( additional_measurements != null && additional_measurements.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<additional_measurements.size();i++) {
+ meas_group = additional_measurements.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "name", meas_group.name);
+ JsonArrayBuilder builder2 = Json.createArrayBuilder();
+ 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(obj2.build());
+ }
+ obj.add("measurements", builder2);
+ builder.add(obj.build());
+ }
+ evelmeasmt.add("additionalMeasurements", builder);
+ }
+
+ /***************************************************************************/
+ /* Additional Objects. */
+ /***************************************************************************/
+ if( additional_objects != null && additional_objects.size() > 0 )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<additional_objects.size();i++) {
+ JsonObject jobj = additional_objects.get(i);
+ builder.add(jobj);
+ }
+ evelmeasmt.add("additionalObjects",builder);
+ }
+
+ /***************************************************************************/
+ /* Although optional, we always generate the version. Note that this */
+ /* closes the object, too. */
+ /***************************************************************************/
+ evelmeasmt.add("measurementsForVfScalingVersion", version);
+
+ EVEL_EXIT();
+
+ return evelmeasmt;
+ }
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ *
+ * retval : String of JSON event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ //encode common event header and measurement body
+ JsonObject obj = Json.createObjectBuilder()
+ .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "measurementsForVfScalingFields",evelScalingMeasurementObject() )
+ ).build();
+
+ EVEL_EXIT();
+
+ return obj.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java new file mode 100644 index 0000000..0dcab34 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSipSignaling.java @@ -0,0 +1,558 @@ +package evel_javalibrary.att.com;
+
+/**************************************************************************//**
+ * @file
+ * Evel SIP Signalling class
+ *
+ * This file implements the Evel SIP Signaling 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 SIP events.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+import org.slf4j.helpers.MessageFormatter;
+
+
+public class EvelSipSignaling extends EvelHeader {
+
+ int major_version = 2;
+ int minor_version = 1;
+
+ /**************************************************************************//**
+ * Vendor VNF Name fields.
+ * JSON equivalent field: vendorVnfNameFields
+ *****************************************************************************/
+ public class VENDOR_VNFNAME_FIELD {
+ String vendorname;
+ EvelOptionString vfmodule;
+ EvelOptionString vnfname;
+ }
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ VENDOR_VNFNAME_FIELD vnfname_field;
+ String correlator; /* JSON: correlator */
+ String local_ip_address; /* JSON: localIpAddress */
+ String local_port; /* JSON: localPort */
+ String remote_ip_address; /* JSON: remoteIpAddress */
+ String remote_port; /* JSON: remotePort */
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ ArrayList<String[]> additional_info;
+ EvelOptionString compressed_sip; /* JSON: compressedSip */
+ EvelOptionString summary_sip; /* JSON: summarySip */
+
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+
+ private static final Logger LOGGER = Logger.getLogger( EvelSipSignaling.class.getName() );
+
+
+ /**************************************************************************//**
+ * Create a new SIP Signaling event.
+ * @param corlator Correlator value
+ * @param locip_address Local IP address
+ * @param loc_port Local Port
+ * @param remip_address Remote IP address
+ * @param rem_port Remote Port
+ *
+ *****************************************************************************/
+ public EvelSipSignaling(String evname,String evid,
+ String vendr_name,
+ String corlator,
+ String locip_address,
+ String loc_port,
+ String remip_address,
+ String rem_port)
+ {//Init header
+ super(evname,evid);
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(vendr_name != null);
+ assert(corlator != null);
+ assert(locip_address != null);
+ assert(loc_port != null);
+
+ assert(remip_address != null);
+ assert(rem_port != null);
+
+ LOGGER.debug("New SipSignaling vendor "+vendr_name+" correlator"+corlator+"local_ip_address"+locip_address+"local port"+loc_port+"remote ip address"+remip_address+"remote port"+rem_port);
+
+ /***************************************************************************/
+ /* Initialize the header & the Domain */
+ /***************************************************************************/
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING;
+ /***************************************************************************/
+ /* Initialize mandatory fields */
+ /***************************************************************************/
+
+ correlator = corlator;
+ local_ip_address = locip_address;
+ local_port = loc_port;
+ remote_ip_address = remip_address;
+ remote_port = rem_port;
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+
+ vnfname_field = new VENDOR_VNFNAME_FIELD();
+ vnfname_field.vendorname = vendr_name;
+ vnfname_field.vfmodule = new EvelOptionString();
+ vnfname_field.vnfname = new EvelOptionString();
+
+ additional_info = null;
+ compressed_sip = new EvelOptionString();
+ summary_sip = new EvelOptionString();
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Event Type property of the SIP signaling.
+ *
+ * @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 type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_type_set(String typ)
+ {
+ EVEL_ENTER();
+ assert(typ != null);
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ evel_header_type_set(typ);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Local Ip Address property of the Signaling event.
+ *
+ * @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 local_ip_address
+ * The Local Ip Address to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_signaling_local_ip_address_set(
+ String loc_ip_address)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(loc_ip_address != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling Local IP "+loc_ip_address);
+
+ local_ip_address = loc_ip_address;
+
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Local Port property of the Signaling event.
+ *
+ * @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 local_port The Local Port to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_local_port_set(String loc_port)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(loc_port != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling Local Port "+loc_port);
+
+ local_port = loc_port;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Remote Ip Address property of the Signaling event.
+ *
+ * @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 remote_ip_address
+ * The Remote Ip Address to be set. ASCIIZ string. The
+ * caller does not need to preserve the value once the
+ * function returns.
+ *****************************************************************************/
+ public void evel_signaling_remote_ip_address_set(String remip_address)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(remip_address != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling Remote IP Address "+remip_address);
+
+ remote_ip_address = remip_address;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Remote Port property of the Signaling event.
+ *
+ * @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 remote_port The Remote Port to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_remote_port_set(String rem_port)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(rem_port != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling Remote Port "+rem_port);
+
+ remote_port = rem_port;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Vendor module property of the Signaling event.
+ *
+ * @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 modulename The module name to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_vnfmodule_name_set(String module_name)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(module_name != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling Module Name "+module_name);
+
+ vnfname_field.vfmodule.SetValue(module_name);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Vendor module property of the Signaling event.
+ *
+ * @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 vnfname The Virtual Network function to be set. ASCIIZ string.
+ * The caller does not need to preserve the value once
+ * the function returns.
+ *****************************************************************************/
+ public void evel_signaling_vnfname_set(String vnfname)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(vnfname != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling VNF Name "+vnfname);
+
+ vnfname_field.vnfname.SetValue(vnfname);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Compressed SIP property of the Signaling event.
+ *
+ * @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 compressed_sip
+ * The Compressed SIP to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_compressed_sip_set(String compr_sip)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(compr_sip != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling Compressed SIP "+compr_sip);
+
+ compressed_sip.SetValue(compr_sip);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Summary SIP property of the Signaling event.
+ *
+ * @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 summary_sip The Summary SIP to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_summary_sip_set(String summ_sip)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(summ_sip != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting SipSignaling Summary SIP "+summ_sip);
+
+ summary_sip.SetValue(summ_sip);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Correlator property of the Signaling event.
+ *
+ * @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 correlator The correlator to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_correlator_set(String corlator)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(corlator != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ LOGGER.debug("Setting Correlator "+corlator);
+
+ correlator = corlator;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Signaling.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_signaling_addl_info_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Encode SIP Signaling Object according to VES schema
+ *
+ * @retval JSON Object of SIP event
+ *****************************************************************************/
+ JsonObjectBuilder evelSipSignalingObject()
+ {
+
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SIPSIGNALING);
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+
+ JsonObjectBuilder vnfnamedobj = Json.createObjectBuilder()
+ .add( "vendorName",vnfname_field.vendorname);
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vfModuleName");
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vnfName");
+
+ JsonObjectBuilder evelsip = Json.createObjectBuilder()
+ .add("correlator", correlator)
+ .add("localIpAddress", local_ip_address)
+ .add("localPort", local_port)
+ .add("remoteIpAddress", remote_ip_address)
+ .add("remotePort", remote_port)
+ .add("vendorVnfNamedFields", vnfnamedobj);
+
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+ compressed_sip.encJsonValue(evelsip, "compressedSip");
+ summary_sip.encJsonValue(evelsip, "summarySip");
+
+
+ // 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);
+ }
+ evelsip.add("additionalFields", builder);
+ }
+
+
+ /***************************************************************************/
+ /* Although optional, we always generate the version. Note that this */
+ /* closes the object, too. */
+ /***************************************************************************/
+ evelsip.add("signalingFieldsVersion", version);
+
+ EVEL_EXIT();
+
+ return evelsip;
+ }
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ *
+ * retval : String of JSON event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ 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( "signalingFields",evelSipSignalingObject() )
+ ).build();
+
+ EVEL_EXIT();
+
+ return obj.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java new file mode 100644 index 0000000..817b283 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelStateChange.java @@ -0,0 +1,258 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel State Change class
+ *
+ * This file implements the Evel State Change 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 State change events.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+import org.slf4j.helpers.MessageFormatter;
+
+import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES;
+
+
+public class EvelStateChange extends EvelHeader {
+
+ int major_version = 1;
+ int minor_version = 2;
+
+ /**************************************************************************//**
+ * Alert types.
+ * JSON equivalent fields: newState, oldState
+ *****************************************************************************/
+ public enum EVEL_ENTITY_STATE{
+ EVEL_ENTITY_STATE_IN_SERVICE,
+ EVEL_ENTITY_STATE_MAINTENANCE,
+ EVEL_ENTITY_STATE_OUT_OF_SERVICE,
+ EVEL_MAX_ENTITY_STATES
+ }
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ EVEL_ENTITY_STATE new_state;
+ EVEL_ENTITY_STATE old_state;
+ String state_interface;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ ArrayList<String[]> additional_info;
+
+ private static final Logger LOGGER = Logger.getLogger( EvelStateChange.class.getName() );
+
+ /**************************************************************************//**
+ * Create a new State Change event.
+ *
+ * @note The mandatory fields on the State Change must be supplied to this
+ * factory function and are immutable once set. Optional fields have
+ * explicit setter functions, but again values may only be set once
+ * so that the State Change has immutable properties.
+ *
+ * @param new_state The new state of the reporting entity.
+ * @param old_state The old state of the reporting entity.
+ * @param interface The card or port name of the reporting entity.
+ *
+ *****************************************************************************/
+ public EvelStateChange(String evname, String evid,
+ EVEL_ENTITY_STATE newstate,
+ EVEL_ENTITY_STATE oldstate,
+ String interfce)
+ {
+ 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( interfce != null);
+
+ new_state = newstate;
+ old_state = oldstate;
+ state_interface = interfce;
+
+ additional_info = null;
+ }
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Fault.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_statechange_addl_info_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
+ *
+ * @param state The entity state to encode.
+ *
+ * @returns the corresponding string
+ *****************************************************************************/
+ String evel_entity_state(EVEL_ENTITY_STATE state)
+ {
+ String result=null;
+
+ EVEL_ENTER();
+
+ switch (state)
+ {
+ case EVEL_ENTITY_STATE_IN_SERVICE:
+ result = "inService";
+ break;
+
+ case EVEL_ENTITY_STATE_MAINTENANCE:
+ result = "maintenance";
+ break;
+
+ case EVEL_ENTITY_STATE_OUT_OF_SERVICE:
+ result = "outOfService";
+ break;
+
+ default:
+ LOGGER.error("Unexpected entity state "+state);
+ System.exit(1);
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+
+ /**************************************************************************//**
+ * Encode the State Change in JSON according to AT&T's schema.
+ *
+ *****************************************************************************/
+ JsonObjectBuilder evelStateChangeObject()
+ {
+ String nstate;
+ String ostate;
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_STATE_CHANGE);
+
+
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+ nstate = evel_entity_state(new_state);
+ ostate = evel_entity_state(old_state);
+
+ JsonObjectBuilder evelstate = Json.createObjectBuilder()
+ .add("newState", nstate)
+ .add("oldState", ostate)
+ .add("stateInterface", state_interface);
+
+ evelstate.add( "stateChangeFieldsVersion", version);
+
+ /***************************************************************************/
+ /* Optional additional information */
+ /***************************************************************************/
+ 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);
+ }
+ evelstate.add("additionalFields", builder);
+ }
+
+ EVEL_EXIT();
+
+ return evelstate;
+ }
+
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON state change event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ 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.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java new file mode 100644 index 0000000..272ff3a --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelSyslog.java @@ -0,0 +1,486 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Syslog class
+ *
+ * This file implements the Evel Syslog 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 Syslog events.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+import org.slf4j.helpers.MessageFormatter;
+
+import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES;
+
+
+public class EvelSyslog extends EvelHeader {
+
+ int major_version = 1;
+ int minor_version = 2;
+
+ /**************************************************************************//**
+ * Alert types.
+ * JSON equivalent fields: newState, oldState
+ *****************************************************************************/
+ /**************************************************************************//**
+ * Syslog facilities.
+ * JSON equivalent field: syslogFacility
+ *****************************************************************************/
+ public enum EVEL_SYSLOG_FACILITIES{
+ EVEL_SYSLOG_FACILITY_KERNEL,
+ EVEL_SYSLOG_FACILITY_USER,
+ EVEL_SYSLOG_FACILITY_MAIL,
+ EVEL_SYSLOG_FACILITY_SYSTEM_DAEMON,
+ EVEL_SYSLOG_FACILITY_SECURITY_AUTH,
+ EVEL_SYSLOG_FACILITY_INTERNAL,
+ EVEL_SYSLOG_FACILITY_LINE_PRINTER,
+ EVEL_SYSLOG_FACILITY_NETWORK_NEWS,
+ EVEL_SYSLOG_FACILITY_UUCP,
+ EVEL_SYSLOG_FACILITY_CLOCK_DAEMON,
+ EVEL_SYSLOG_FACILITY_SECURITY_AUTH2,
+ EVEL_SYSLOG_FACILITY_FTP_DAEMON,
+ EVEL_SYSLOG_FACILITY_NTP,
+ EVEL_SYSLOG_FACILITY_LOG_AUDIT,
+ EVEL_SYSLOG_FACILITY_LOG_ALERT,
+ EVEL_SYSLOG_FACILITY_CLOCK_DAEMON2,
+ EVEL_SYSLOG_FACILITY_LOCAL0,
+ EVEL_SYSLOG_FACILITY_LOCAL1,
+ EVEL_SYSLOG_FACILITY_LOCAL2,
+ EVEL_SYSLOG_FACILITY_LOCAL3,
+ EVEL_SYSLOG_FACILITY_LOCAL4,
+ EVEL_SYSLOG_FACILITY_LOCAL5,
+ EVEL_SYSLOG_FACILITY_LOCAL6,
+ EVEL_SYSLOG_FACILITY_LOCAL7,
+ EVEL_MAX_SYSLOG_FACILITIES
+ }
+
+
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ EvelFault.EVEL_SOURCE_TYPES event_source_type;
+ String syslog_msg;
+ String syslog_tag;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ EvelOptionString additional_filters;
+ EvelOptionString event_source_host;
+ EvelOptionInt syslog_facility;
+ EvelOptionInt syslog_priority;
+ EvelOptionString syslog_proc;
+ EvelOptionInt syslog_proc_id;
+ EvelOptionString syslog_s_data;
+ EvelOptionString syslog_sdid;
+ EvelOptionString syslog_severity;
+ double syslog_fver;
+ EvelOptionInt syslog_ver;
+
+
+ private static final Logger LOGGER = Logger.getLogger( EvelSyslog.class.getName() );
+
+ /**************************************************************************//**
+ * Create a new Syslog event.
+ *
+ *
+ * @param syslg_msg The Syslog message string.
+ * @param syslg_tag The Syslog tag string.
+ * @param interface The card or port name of the reporting entity.
+ *
+ *****************************************************************************/
+ public EvelSyslog(String evname, String evid,
+ 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);
+
+ event_source_type = evt_source_type;
+ syslog_msg = syslg_msg;
+ syslog_tag = syslg_tag;
+ syslog_facility = new EvelOptionInt();
+ syslog_priority = new EvelOptionInt();
+ syslog_proc_id = new EvelOptionInt();
+ syslog_ver = new EvelOptionInt();
+ additional_filters = new EvelOptionString();
+ event_source_host = new EvelOptionString();
+ syslog_proc = new EvelOptionString();
+ syslog_s_data = new EvelOptionString();
+ syslog_sdid = new EvelOptionString();
+ syslog_severity = new EvelOptionString();
+ }
+
+ /**************************************************************************//**
+ * Set the Event Type property of the Syslog.
+ *
+ * @param type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_syslog_type_set(String typ)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ evel_header_type_set(typ);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Syslog.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ *
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_syslog_addl_filter_set(String filter)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(filter != null);
+
+ additional_filters.SetValuePr(
+ filter,
+ "Syslog filter string");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Event Source Host property of the Syslog.
+ *
+ * @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 host The Event Source Host to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_syslog_event_source_host_set(String host)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(host != null);
+
+ event_source_host.SetValuePr(
+ host,
+ "Event Source Host");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Facility property of the Syslog.
+ *
+ * @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 syslog Pointer to the Syslog.
+ * @param facility The Syslog Facility to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_syslog_facility_set(
+ EVEL_SYSLOG_FACILITIES facility)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(facility.compareTo(EVEL_SYSLOG_FACILITIES.EVEL_MAX_SYSLOG_FACILITIES) < 0);
+ int num = facility.compareTo(EVEL_SYSLOG_FACILITIES.EVEL_SYSLOG_FACILITY_KERNEL);
+
+ syslog_facility.SetValuePr(
+ num,
+ "Facility");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Process property of the Syslog.
+ *
+ * @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 proc The Process to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_syslog_proc_set(String proc)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(proc != null);
+
+ syslog_proc.SetValuePr(proc, "Process");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Process ID property of the Syslog.
+ *
+ * @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 proc_id The Process ID to be set. ASCIIZ string. The caller does
+ * not need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_syslog_proc_id_set(int proc_id)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(proc_id > 0);
+
+ syslog_proc_id.SetValuePr(
+ proc_id,
+ "Process ID");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Version property of the Syslog.
+ *
+ * @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 version The Version to be set. ASCIIZ string. The caller does not
+ * need to preserve the value once the function returns.
+ *****************************************************************************/
+ public void evel_syslog_version_set(int version)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(version >= 0);
+
+ syslog_ver.SetValuePr(
+ version,
+ "Version");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Structured Data property of the Syslog.
+ *
+ * @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 s_data The Structured Data to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_syslog_s_data_set(String s_data)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(s_data != null);
+
+ syslog_s_data.SetValuePr(
+ s_data,
+ "Structured Data");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Structured SDID property of the Syslog.
+ *
+ * @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_syslog_sdid_set(String sdid)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(sdid != null);
+
+ syslog_sdid.SetValuePr(
+ sdid,
+ "SdId set");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Structured Severity property of the Syslog.
+ *
+ * @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.
+ * Caller does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_syslog_severity_set(String severty)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(severty != null);
+
+ if( severty.equals("Alert") || severty.equals("Critical") || severty.equals("Debug") ||
+ severty.equals("Emergency") || severty.equals("Error") || severty.equals("Info") ||
+ severty.equals("Notice") || severty.equals("Warning") )
+ {
+ syslog_severity.SetValuePr(
+ severty,
+ "Severity set");
+ }
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Encode the Syslog in JSON according to AT&T's schema.
+ *
+ *****************************************************************************/
+ JsonObjectBuilder evelSyslogObject()
+ {
+ String evt_source_type;
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add("eventSourceType", event_source_type.toString())
+ .add("syslogMsg", syslog_msg)
+ .add("syslogTag", syslog_tag)
+ .add("syslogFieldsVersion",version);
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ event_source_host.encJsonValue(obj, "eventSourceHost");
+ syslog_facility.encJsonValue(obj,"syslogFacility");
+ syslog_priority.encJsonValue(obj,"syslogPri");
+ syslog_proc.encJsonValue(obj, "syslogProc");
+ syslog_proc_id.encJsonValue(obj, "syslogProcId");
+ syslog_s_data.encJsonValue(obj, "syslogSData");
+ syslog_sdid.encJsonValue(obj, "syslogSdId");
+ syslog_severity.encJsonValue(obj, "syslogSev");
+ syslog_ver.encJsonValue(obj, "syslogVer");
+
+ EVEL_EXIT();
+
+ return obj;
+ }
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON syslog event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ 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.toString();
+
+ }
+
+
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java new file mode 100644 index 0000000..1a1b1f0 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelThresholdCross.java @@ -0,0 +1,502 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * Evel Threshold Crossing event class
+ *
+ * This file implements the Evel Threshold Crossing 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 Threshold Crossing Alert events.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+
+import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS;
+
+
+public class EvelThresholdCross extends EvelHeader {
+
+
+ int major_version = 1;
+ int minor_version = 1;
+
+ /**************************************************************************//**
+ * Alert types.
+ * JSON equivalent fields: newState, oldState
+ *****************************************************************************/
+ public enum EVEL_EVENT_ACTION {
+ EVEL_EVENT_ACTION_CLEAR,
+ EVEL_EVENT_ACTION_CONTINUE,
+ EVEL_EVENT_ACTION_SET,
+ EVEL_MAX_EVENT_ACTION
+ }
+
+ public enum EVEL_ALERT_TYPE {
+ EVEL_CARD_ANOMALY,
+ EVEL_ELEMENT_ANOMALY,
+ EVEL_INTERFACE_ANOMALY,
+ EVEL_SERVICE_ANOMALY,
+ EVEL_MAX_ANOMALY
+ }
+
+ public enum EVEL_SEVERITIES{
+ EVEL_SEVERITY_CRITICAL,
+ EVEL_SEVERITY_MAJOR,
+ EVEL_SEVERITY_MINOR,
+ EVEL_SEVERITY_WARNING,
+ EVEL_SEVERITY_NORMAL,
+ EVEL_MAX_SEVERITIES
+ }
+
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+
+ public class PERF_COUNTER {
+ String criticality;
+ String name;
+ String thresholdCrossed;
+ String value;
+ }
+
+ PERF_COUNTER additionalParameters;
+ EVEL_EVENT_ACTION alertAction;
+ String alertDescription;
+ EVEL_ALERT_TYPE alertType;
+ Date collectionTimestamp;
+ EVEL_SEVERITIES eventSeverity;
+ Date eventStartTimestamp;
+
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ ArrayList<String[]> additional_info;
+ EvelOptionString alertValue;
+ ArrayList<String> alertidList;
+ EvelOptionString dataCollector;
+ EvelOptionString elementType;
+ EvelOptionString interfaceName;
+ EvelOptionString networkService;
+ EvelOptionString possibleRootCause;
+
+
+ private static final Logger LOGGER = Logger.getLogger( EvelThresholdCross.class.getName() );
+
+ /**************************************************************************//**
+ * Create a new Threshold Crossing event.
+ *
+ *
+ * @param String tcriticality Counter Criticality MAJ MIN,
+ * @param String tname Counter Threshold name
+ * @param String tthresholdCrossed Counter Threshold crossed value
+ * @param String tvalue Counter actual value
+ * @param EVEL_EVENT_ACTION talertAction Alert set continue or clear
+ * @param String talertDescription
+ * @param EVEL_ALERT_TYPE talertType Kind of anamoly
+ * @param Date tcollectionTimestamp time at which alert was collected
+ * @param EVEL_SEVERITIES teventSeverity Severity of Alert
+ * @param Date teventStartTimestamp Time when this alert started
+ *****************************************************************************/
+ public EvelThresholdCross( String evname,String evid,
+ String tcriticality,
+ String tname,
+ String tthresholdCrossed,
+ String tvalue,
+ EVEL_EVENT_ACTION talertAction,
+ String talertDescription,
+ EVEL_ALERT_TYPE talertType,
+ Date tcollectionTimestamp,
+ EVEL_SEVERITIES teventSeverity,
+ Date teventStartTimestamp)
+ {
+ super(evname,evid);
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING;
+ assert( tcriticality!= null );
+ assert( tname!= null );
+ assert( tthresholdCrossed!= null );
+ assert( tvalue!= null );
+ assert( talertAction!= null );
+
+ additionalParameters = new PERF_COUNTER();
+ assert( additionalParameters != null);
+
+ additionalParameters.criticality = tcriticality;
+ additionalParameters.name = tname;
+ additionalParameters.thresholdCrossed = tthresholdCrossed;
+ additionalParameters.value = tvalue;
+ alertAction = talertAction;
+ alertDescription = talertDescription;
+ alertType = talertType;
+ collectionTimestamp = tcollectionTimestamp;
+ eventSeverity = teventSeverity;
+ eventStartTimestamp = teventStartTimestamp;
+
+ additional_info = null;
+ alertValue = new EvelOptionString();
+ alertidList = null;
+ dataCollector = new EvelOptionString();
+ elementType = new EvelOptionString();
+ interfaceName = new EvelOptionString();
+ networkService = new EvelOptionString();
+ possibleRootCause = new EvelOptionString();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Event Type property of the TC Alert.
+ *
+ * @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 type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_thresholdcross_type_set(String type)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and call evel_header_type_set. */
+ /***************************************************************************/
+ assert(type!=null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+ evel_header_type_set(type);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an optional additional alertid value to Alert.
+ *
+ *****************************************************************************/
+ public void evel_thresholdcross_alertid_add(String alertid)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+ assert(alertid != null);
+
+ if( alertidList == null )
+ {
+ alertidList = new ArrayList<String>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding alertid={0}", alertid));
+
+ alertidList.add(new String(alertid));
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an optional additional value name/value pair to the Alert.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_thresholdcross_addl_info_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the TCA probable Root cause.
+ *
+ * @param sheader Possible root cause to Threshold
+ *****************************************************************************/
+ public void evel_threshold_cross_possible_rootcause_set(String sheader)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ assert(sheader != null);
+
+ possibleRootCause.SetValuePr(
+ sheader,
+ "Rootcause value");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the TCA networking cause.
+ *
+ * @param sheader Possible networking service value to Threshold
+ *****************************************************************************/
+ public void evel_threshold_cross_networkservice_set(String sheader)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ assert(sheader != null);
+
+ networkService.SetValuePr(
+ sheader,
+ "Networking service value");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the TCA Interface name.
+ *
+ * @param sheader Interface name to threshold
+ *****************************************************************************/
+ public void evel_threshold_cross_interfacename_set(String sheader)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ assert(sheader != null);
+
+ interfaceName.SetValuePr(
+ sheader,
+ "TCA Interface name");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the TCA Data element type.
+ *
+ * @param sheader element type of Threshold
+ *****************************************************************************/
+ public void evel_threshold_cross_data_elementtype_set(String sheader)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ assert(sheader != null);
+
+ elementType.SetValuePr(
+ sheader,
+ "TCA Element type value");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the TCA Data collector value.
+ *
+ * @param sheader Data collector value
+ *****************************************************************************/
+ public void evel_threshold_cross_data_collector_set(String sheader)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ assert(sheader != null);
+
+ dataCollector.SetValuePr(
+ sheader,
+ "Datacollector value");
+ EVEL_EXIT();
+ }
+
+
+
+ /**************************************************************************//**
+ * Set the TCA alert value.
+ *
+ * @param sheader Possible alert value
+ *****************************************************************************/
+ public void evel_threshold_cross_alertvalue_set(String sheader)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ assert(sheader != null);
+
+ alertValue.SetValuePr(
+ sheader,
+ "Alert value");
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Encode the fault in JSON according to AT&T's schema for the TC ALert type.
+ *
+ * @retvalue JSON object of TC Alert encoding
+ *****************************************************************************/
+ JsonObjectBuilder evelThresholdCrossingObject()
+ {
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+ //encode counter
+ JsonObjectBuilder counterobj = Json.createObjectBuilder()
+ .add( "criticality",additionalParameters.criticality)
+ .add( "name", additionalParameters.name)
+ .add( "thresholdCrossed",additionalParameters.thresholdCrossed)
+ .add( "value", additionalParameters.value);
+
+
+ JsonObjectBuilder evelrep = Json.createObjectBuilder()
+ .add("additionalParameters", counterobj)
+ .add("alertAction", alertAction.toString())
+ .add("alertDescription", alertDescription)
+ .add("alertType", alertType.toString())
+ .add("collectionTimestamp", collectionTimestamp.toString())
+ .add("eventSeverity",eventSeverity.toString())
+ .add("eventStartTimestamp",eventStartTimestamp.toString());
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+ alertValue.encJsonValue(evelrep, "alertValue");
+ if( alertidList != null && alertidList.size() > 0)
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<alertidList.size();i++) {
+ String addl_info = alertidList.get(i);
+ JsonObject obj = Json.createObjectBuilder()
+ .add("item",addl_info).build();
+ builder.add(obj);
+ }
+ evelrep.add("associatedAlertIdList", builder);
+ }
+
+ dataCollector.encJsonValue(evelrep, "dataCollector");
+ elementType.encJsonValue(evelrep, "elementType");
+ interfaceName.encJsonValue(evelrep, "interfaceName");
+ networkService.encJsonValue(evelrep, "networkService");
+ possibleRootCause.encJsonValue(evelrep, "possibleRootCause");
+
+
+ evelrep.add( "thresholdCrossingFieldsVersion", version);
+
+ 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);
+ }
+ evelrep.add("additionalFields", builder);
+ }
+
+
+ EVEL_EXIT();
+
+ return evelrep;
+ }
+
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON TCA event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ EVEL_ENTER();
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+
+ JsonObject obj = Json.createObjectBuilder()
+ .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject() )
+ .add( "thresholdCrossingAlert",evelThresholdCrossingObject() )
+ ).build();
+
+ EVEL_EXIT();
+
+ return obj.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java new file mode 100644 index 0000000..409b9b4 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelVoiceQuality.java @@ -0,0 +1,671 @@ +package evel_javalibrary.att.com;
+
+/**************************************************************************//**
+ * @file
+ * Evel Voice Quality event class
+ *
+ * This file implements the Evel TVoice Quality event 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 Voice Quality event reports.
+ *
+ * License
+ * -------
+ *
+ * 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.text.MessageFormat;
+import java.util.ArrayList;
+
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+
+import org.apache.log4j.Logger;
+import org.slf4j.helpers.MessageFormatter;
+
+
+
+public class EvelVoiceQuality extends EvelHeader {
+
+ int major_version = 1;
+ int minor_version = 1;
+
+ /**************************************************************************//**
+ * Vendor VNF Name fields.
+ * JSON equivalent field: vendorVnfNameFields
+ *****************************************************************************/
+ public class VENDOR_VNFNAME_FIELD {
+ String vendorname;
+ EvelOptionString vfmodule;
+ EvelOptionString vnfname;
+ }
+
+ /**************************************************************************//**
+ * Service Event endpoint description
+ * JSON equivalent field: endpointDesc
+ *****************************************************************************/
+ public enum EVEL_SERVICE_ENDPOINT_DESC {
+ EVEL_SERVICE_ENDPOINT_CALLEE,
+ EVEL_SERVICE_ENDPOINT_CALLER,
+ EVEL_MAX_SERVICE_ENDPOINT_DESC
+ }
+
+ /**************************************************************************//**
+ * End of Call Voice Quality Metrices
+ * JSON equivalent field: endOfCallVqmSummaries
+ *****************************************************************************/
+ public class END_OF_CALL_VOICE_QUALITY_METRICS {
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ String adjacencyName;
+ String endpointDescription;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ EvelOptionDouble endpointJitter;
+ EvelOptionDouble endpointRtpOctetsDiscarded;
+ EvelOptionDouble endpointRtpOctetsReceived;
+ EvelOptionDouble endpointRtpOctetsSent;
+ EvelOptionDouble endpointRtpPacketsDiscarded;
+ EvelOptionDouble endpointRtpPacketsReceived;
+ EvelOptionDouble endpointRtpPacketsSent;
+ EvelOptionDouble localJitter;
+ EvelOptionDouble localRtpOctetsDiscarded;
+ EvelOptionDouble localRtpOctetsReceived;
+ EvelOptionDouble localRtpOctetsSent;
+ EvelOptionDouble localRtpPacketsDiscarded;
+ EvelOptionDouble localRtpPacketsReceived;
+ EvelOptionDouble localRtpPacketsSent;
+ EvelOptionDouble mosCqe;
+ EvelOptionDouble packetsLost;
+ EvelOptionDouble packetLossPercent;
+ EvelOptionDouble rFactor;
+ EvelOptionDouble roundTripDelay;
+ }
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ VENDOR_VNFNAME_FIELD vnfname_field;
+ String calleeSideCodec;
+ String callerSideCodec;
+ String correlator;
+ String midCallRtcp;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ ArrayList<String[]> additional_info;
+ END_OF_CALL_VOICE_QUALITY_METRICS endOfCallVqmSummaries;
+ EvelOptionString evphoneNumber;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+
+ private static final Logger LOGGER = Logger.getLogger( EvelVoiceQuality.class.getName() );
+
+
+ /**************************************************************************//**
+ * Create a new Voice Quality event.
+ *
+ * @note The mandatory fields on the Voice Quality must be supplied to this
+ * factory function and are immutable once set. Optional fields have
+ * explicit setter functions, but again values may only be set once so
+ * that the event has immutable properties.
+ *
+ * @param calleeSideCodec callee codec for voice call
+ * @param callerSideCodec caller codec
+ * @param corlator Correlator
+ * @param midCallRtcp Midcall RTCP value
+ * @param vendr_name Vendor name
+ *
+ * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT. If the
+ * event is not used (i.e. posted) it must be released using
+ * ::evel_free_event.
+ * @retval null Failed to create the event.
+ *****************************************************************************/
+ public EvelVoiceQuality(String evname, String evid,
+ String calleeSideCodc,
+ String callerSideCodc, String corlator,
+ String midCllRtcp, String vendr_name)
+ {
+ super(evname,evid);
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(vendr_name != null);
+ assert(calleeSideCodc != null);
+ assert(callerSideCodc != null);
+ assert(midCllRtcp != null);
+ assert(corlator != null);
+
+
+ /***************************************************************************/
+ /* Allocate the measurement. */
+ /***************************************************************************/
+ LOGGER.debug("New Voice Quality vendor "+vendr_name+" correlator"+corlator+"calleeSideCodec"+calleeSideCodc+"callerSideCodec"+callerSideCodc+"midCallRtcp"+midCllRtcp);
+
+ /***************************************************************************/
+ /* Initialize the header & the measurement fields. */
+ /***************************************************************************/
+ event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY;
+ correlator = corlator;
+ calleeSideCodec = calleeSideCodc;
+ callerSideCodec = callerSideCodc;
+ midCallRtcp = midCllRtcp;
+
+ vnfname_field = new VENDOR_VNFNAME_FIELD();
+ vnfname_field.vendorname = vendr_name;
+ vnfname_field.vfmodule = new EvelOptionString();
+ vnfname_field.vnfname = new EvelOptionString();
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+ additional_info = null;
+ endOfCallVqmSummaries = null;
+ evphoneNumber = new EvelOptionString();
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an additional value name/value pair to the Voice Quality.
+ *
+ * The name and value are null delimited ASCII strings. The library takes
+ * a copy so the caller does not have to preserve values after the function
+ * returns.
+ *
+ * @param name ASCIIZ string with the attribute's name. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ * @param value ASCIIZ string with the attribute's value. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_addl_info_add(String name, String value)
+ {
+ String[] addl_info = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_info == null )
+ {
+ additional_info = new ArrayList<String[]>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ addl_info = new String[2];
+ assert(addl_info != null);
+ addl_info[0] = name;
+ addl_info[1] = value;
+
+ additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Callee side codec for Call for domain Voice Quality
+ *
+ * @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 calleeCodecForCall The Callee Side Codec to be set. ASCIIZ
+ * string. The caller does not need to
+ * preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_callee_codec_set(String calleeCodecForCall) {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(calleeCodecForCall != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ LOGGER.debug("Setting Correlator "+calleeCodecForCall);
+
+ calleeSideCodec = calleeCodecForCall;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Caller side codec for Call for domain Voice Quality
+ *
+ * @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 callerCodecForCall The Caller Side Codec to be set. ASCIIZ
+ * string. The caller does not need to
+ * preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_caller_codec_set(String callerCodecForCall) {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(callerCodecForCall != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ LOGGER.debug("Setting CallerCodecForCall "+callerCodecForCall);
+
+ callerSideCodec = callerCodecForCall;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the correlator for domain Voice Quality
+ *
+ * @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 correlator The correlator value to be set. ASCIIZ
+ * string. The caller does not need to
+ * preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_correlator_set(String vCorrelator) {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(vCorrelator != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ LOGGER.debug("Setting Correlator "+vCorrelator);
+
+ correlator = vCorrelator;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the RTCP Call Data for domain Voice Quality
+ *
+ * @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 rtcpCallData The RTCP Call Data to be set. ASCIIZ
+ * string. The caller does not need to
+ * preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_rtcp_data_set(String rtcpCallData) {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(rtcpCallData != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ LOGGER.debug("Setting RTCP Data "+rtcpCallData);
+
+ midCallRtcp = rtcpCallData;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Vendor VNF Name fields for domain Voice Quality
+ *
+ * @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 modulename The Vendor, VNF and VfModule names to be set.
+ * ASCIIZ string. The caller does not need to
+ * preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_vnfmodule_name_set(String module_name) {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(module_name != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ LOGGER.debug("Setting VoiceQuality Module Name "+module_name);
+
+ vnfname_field.vfmodule.SetValue(module_name);
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set the Vendor VNF Name fields for domain Voice Quality
+ *
+ * @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 modulename The Vendor, VNF and VfModule names to be set.
+ * ASCIIZ string. The caller does not need to
+ * preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_vnfname_set(String vnfname) {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(vnfname != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ LOGGER.debug("Setting VoiceQuality VNF Name "+vnfname);
+
+ vnfname_field.vnfname.SetValue(vnfname);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the Phone Number associated with the Correlator for domain Voice Quality
+ *
+ * @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 calleeCodecForCall The Phone Number to be set. ASCIIZ
+ * string. The caller does not need to
+ * preserve the value once the function
+ * returns.
+ *****************************************************************************/
+ public void evel_voice_quality_phone_number_set(String phoneNumber) {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(phoneNumber != null);
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+
+ evphoneNumber.SetValuePr(phoneNumber,"Phone_Number");
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Add an End of Call Voice Quality Metrices
+
+ * The adjacencyName and endpointDescription is null delimited ASCII string.
+ * The library takes a copy so the caller does not have to preserve values
+ * after the function returns.
+ *
+ * @param voiceQuality Pointer to the measurement.
+ * @param adjacencyName Adjacency name
+ * @param endpointDescription Enumeration: ‘Caller’, ‘Callee’.
+ * @param endpointJitter Endpoint jitter
+ * @param endpointRtpOctetsDiscarded Endpoint RTP octets discarded.
+ * @param endpointRtpOctetsReceived Endpoint RTP octets received.
+ * @param endpointRtpOctetsSent Endpoint RTP octets sent
+ * @param endpointRtpPacketsDiscarded Endpoint RTP packets discarded.
+ * @param endpointRtpPacketsReceived Endpoint RTP packets received.
+ * @param endpointRtpPacketsSent Endpoint RTP packets sent.
+ * @param localJitter Local jitter.
+ * @param localRtpOctetsDiscarded Local RTP octets discarded.
+ * @param localRtpOctetsReceived Local RTP octets received.
+ * @param localRtpOctetsSent Local RTP octets sent.
+ * @param localRtpPacketsDiscarded Local RTP packets discarded.
+ * @param localRtpPacketsReceived Local RTP packets received.
+ * @param localRtpPacketsSent Local RTP packets sent.
+ * @param mosCqe Decimal range from 1 to 5
+ * (1 decimal place)
+ * @param packetsLost No Packets lost
+ * @param packetLossPercent Calculated percentage packet loss
+ * @param rFactor rFactor from 0 to 100
+ * @param roundTripDelay Round trip delay in milliseconds
+ *****************************************************************************/
+ public void evel_voice_quality_end_metrics_set(
+ String adjacencyName, String endpointDescr,
+ double endpointJitter,
+ double endpointRtpOctetsDiscarded,
+ double endpointRtpOctetsReceived,
+ double endpointRtpOctetsSent,
+ double endpointRtpPacketsDiscarded,
+ double endpointRtpPacketsReceived,
+ double endpointRtpPacketsSent,
+ double localJitter,
+ double localRtpOctetsDiscarded,
+ double localRtpOctetsReceived,
+ double localRtpOctetsSent,
+ double localRtpPacketsDiscarded,
+ double localRtpPacketsReceived,
+ double localRtpPacketsSent,
+ double mosCqe,
+ double packetsLost,
+ double packetLossPercent,
+ double rFactor,
+ double roundTripDelay) {
+
+ END_OF_CALL_VOICE_QUALITY_METRICS vQMetrices = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+ assert(adjacencyName != null);
+ assert(mosCqe >= 1 && mosCqe <= 5);
+ assert(rFactor >= 0 && rFactor <= 100);
+ assert(endpointDescr != null && (endpointDescr.equals("Caller")||endpointDescr.equals("Callee")) );
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormat.format("Adding adjacencyName={0} endpointDescription={1}", adjacencyName, endpointDescr));
+ vQMetrices = new END_OF_CALL_VOICE_QUALITY_METRICS();
+ assert(vQMetrices != null);
+
+ vQMetrices.adjacencyName = adjacencyName;
+ vQMetrices.endpointDescription = endpointDescr;
+
+ vQMetrices.endpointJitter = new EvelOptionDouble();
+ vQMetrices.endpointRtpOctetsDiscarded= new EvelOptionDouble();
+ vQMetrices.endpointRtpOctetsReceived= new EvelOptionDouble();
+ vQMetrices.endpointRtpOctetsSent= new EvelOptionDouble();
+ vQMetrices.endpointRtpPacketsDiscarded= new EvelOptionDouble();
+ vQMetrices.endpointRtpPacketsReceived= new EvelOptionDouble();
+ vQMetrices.endpointRtpPacketsSent= new EvelOptionDouble();
+ vQMetrices.localJitter= new EvelOptionDouble();
+ vQMetrices.localRtpOctetsDiscarded= new EvelOptionDouble();
+ vQMetrices.localRtpOctetsReceived= new EvelOptionDouble();
+ vQMetrices.localRtpOctetsSent= new EvelOptionDouble();
+ vQMetrices.localRtpPacketsDiscarded= new EvelOptionDouble();
+ vQMetrices.localRtpPacketsReceived= new EvelOptionDouble();
+ vQMetrices.localRtpPacketsSent= new EvelOptionDouble();
+ vQMetrices.mosCqe= new EvelOptionDouble();
+ vQMetrices.packetsLost= new EvelOptionDouble();
+ vQMetrices.packetLossPercent= new EvelOptionDouble();
+ vQMetrices.rFactor= new EvelOptionDouble();
+ vQMetrices.roundTripDelay= new EvelOptionDouble();
+
+ vQMetrices.endpointJitter.SetValuePr(endpointJitter, "Endpoint jitter");
+ vQMetrices.endpointRtpOctetsDiscarded.SetValuePr(endpointRtpOctetsDiscarded, "Endpoint RTP octets discarded");
+ vQMetrices.endpointRtpOctetsReceived.SetValuePr(endpointRtpOctetsReceived, "Endpoint RTP octets received");
+ vQMetrices.endpointRtpOctetsSent.SetValuePr(endpointRtpOctetsSent, "Endpoint RTP octets sent");
+ vQMetrices.endpointRtpPacketsDiscarded.SetValuePr(endpointRtpPacketsDiscarded, "Endpoint RTP packets discarded");
+ vQMetrices.endpointRtpPacketsReceived.SetValuePr(endpointRtpPacketsReceived, "Endpoint RTP packets received");
+ vQMetrices.endpointRtpPacketsSent.SetValuePr(endpointRtpPacketsSent, "Endpoint RTP packets sent");
+ vQMetrices.localJitter.SetValuePr( localJitter, "Local jitter");
+ vQMetrices.localRtpOctetsDiscarded.SetValuePr(localRtpOctetsDiscarded, "Local RTP octets discarded");
+ vQMetrices.localRtpOctetsReceived.SetValuePr(localRtpOctetsReceived, "Local RTP octets received");
+ vQMetrices.localRtpOctetsSent.SetValuePr(localRtpOctetsSent, "Local RTP octets sent");
+ vQMetrices.localRtpPacketsDiscarded.SetValuePr(localRtpPacketsDiscarded, "Local RTP packets discarded");
+ vQMetrices.localRtpPacketsReceived.SetValuePr(localRtpPacketsReceived, "Local RTP packets received");
+ vQMetrices.localRtpPacketsSent.SetValuePr(localRtpPacketsSent, "Local RTP packets sent");
+ vQMetrices.mosCqe.SetValuePr(mosCqe, "Decimal range from 1 to 5 (1 decimal place)");
+ vQMetrices.packetsLost.SetValuePr(packetsLost, "Packets lost");
+ vQMetrices.packetLossPercent.SetValuePr(packetLossPercent, "Calculated percentage packet loss");
+ vQMetrices.rFactor.SetValuePr(rFactor, "rFactor ");
+ vQMetrices.roundTripDelay.SetValuePr(roundTripDelay, "Round trip delay in milliseconds ");
+
+ endOfCallVqmSummaries = vQMetrices;
+
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Encode the Voice Quality in JSON according to AT&T's schema
+ *
+ * @retvalue JSON object of VoiceQuality body encoding
+ *****************************************************************************/
+ JsonObjectBuilder evelVoiceQualityObject()
+ {
+
+ double version = major_version+(double)minor_version/10;
+
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
+
+ /***************************************************************************/
+ /* Mandatory fields. */
+ /***************************************************************************/
+
+ JsonObjectBuilder vnfnamedobj = Json.createObjectBuilder()
+ .add( "vendorName",vnfname_field.vendorname);
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vfModuleName");
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vnfName");
+
+ JsonObjectBuilder evelvq = Json.createObjectBuilder()
+ .add("correlator", correlator)
+ .add("calleeSideCodec", calleeSideCodec)
+ .add("callerSideCodec", callerSideCodec)
+ .add("midCallRtcp", midCallRtcp)
+ .add("voiceQualityFieldsVersion", version)
+ .add("vendorVnfNameFields", vnfnamedobj);
+
+ /***************************************************************************/
+ /* Optional fields. */
+ /***************************************************************************/
+ evphoneNumber.encJsonValue(evelvq, "phoneNumber");
+
+
+ // 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);
+ }
+ evelvq.add("additionalFields", builder);
+ }
+
+
+ if( endOfCallVqmSummaries != null )
+ {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+
+ END_OF_CALL_VOICE_QUALITY_METRICS vQMetrics = endOfCallVqmSummaries;
+
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add("adjacencyName", vQMetrics.adjacencyName)
+ .add("endpointDescription", vQMetrics.endpointDescription);
+
+ 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.localRtpOctetsDiscarded.encJsonValue(obj,"localRtpOctetsDiscarded");
+ vQMetrics.localRtpOctetsReceived.encJsonValue(obj,"localRtpOctetsReceived");
+ vQMetrics.localRtpOctetsSent.encJsonValue(obj,"localRtpOctetsSent");
+ vQMetrics.localRtpPacketsDiscarded.encJsonValue(obj,"localRtpPacketsDiscarded");
+ vQMetrics.localRtpPacketsReceived.encJsonValue(obj,"localRtpPacketsReceived");
+ vQMetrics.localRtpPacketsSent.encJsonValue(obj,"localRtpPacketsSent");
+ vQMetrics.mosCqe.encJsonValue(obj,"mosCqe");
+ vQMetrics.packetsLost.encJsonValue(obj,"packetsLost");
+ vQMetrics.packetLossPercent.encJsonValue(obj,"packetLossPercent");
+ vQMetrics.rFactor.encJsonValue(obj,"rFactor");
+ vQMetrics.roundTripDelay.encJsonValue(obj,"roundTripDelay");
+
+ evelvq.add("endOfCallVqmSummaries", obj);
+ }
+
+
+ /***************************************************************************/
+ /* Although optional, we always generate the version. Note that this */
+ /* closes the object, too. */
+ /***************************************************************************/
+
+ EVEL_EXIT();
+
+ return evelvq;
+ }
+
+ /**************************************************************************//**
+ * Encode the event as a JSON event object according to AT&T's schema.
+ * retval : String of JSON Voice Quality event message
+ *****************************************************************************/
+ String evel_json_encode_event()
+ {
+ 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.toString();
+
+ }
+
+
+}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java new file mode 100644 index 0000000..28b309a --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/RingBuffer.java @@ -0,0 +1,276 @@ +package evel_javalibrary.att.com;
+/**************************************************************************//**
+ * @file
+ * RingBuffer class
+ *
+ * This file implements internal Ringbuffer for storing and
+ * forwarding events to Collector.
+ *
+ * License
+ * -------
+ *
+ * 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.util.concurrent.Semaphore;
+/*
+ * Ringbuffer to store and Forward http(s) POST requests
+ */
+public class RingBuffer {
+
+ // message count semaphore
+ public static Semaphore countsem;
+ // space semaphore
+ public static Semaphore spacesem;
+ // lock semaphore
+ public static Semaphore lock;
+
+ public Object[] elements = null;
+
+ public int capacity = 0;
+ public int writePos = 0;
+ public int available = 0;
+
+ /*
+ * Constructs Ringbuffer of specified capacity
+ */
+ public RingBuffer(int capacity) {
+ this.capacity = capacity;
+ this.elements = new Object[capacity];
+ countsem = new Semaphore(1);
+ spacesem = new Semaphore(capacity);
+ lock = new Semaphore(1);
+ }
+
+ //resets the positions
+ public void reset() {
+ this.writePos = 0;
+ this.available = 0;
+ }
+
+ //returns available capacity
+ public int remainingCapacity() {
+ return this.capacity - this.available;
+ }
+
+
+
+ //Puts Java object into ringbuffer
+ public boolean put(Object element){
+
+ boolean ret = false;
+ //acquire locks
+ try {
+ spacesem.acquire();
+ lock.acquire();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ //store object
+ if(available < capacity){
+ if(writePos >= capacity){
+ writePos = 0;
+ }
+ elements[writePos] = element;
+ writePos++;
+ available++;
+ ret = true;
+ }
+
+ //release Locks
+ lock.release();
+ countsem.release();
+
+
+ return ret;
+ }
+
+ public int put(Object[] newElements){
+ return put(newElements, newElements.length);
+ }
+
+ public int put(Object[] newElements, int length){
+ //Acquire locks
+ try {
+ spacesem.acquire();
+ lock.acquire();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ int readPos = 0;
+ if(this.writePos > this.available){
+ //space above writePos is all empty
+
+ if(length <= this.capacity - this.writePos){
+ //space above writePos is sufficient to insert batch
+
+ for(; readPos < length; readPos++){
+ this.elements[this.writePos++] = newElements[readPos];
+ }
+ this.available += readPos;
+ //release
+ lock.release();
+ countsem.release();
+ return length;
+
+ } else {
+ //both space above writePos and below writePos is necessary to use
+ //to insert batch.
+
+ int lastEmptyPos = writePos - available;
+
+ for(; this.writePos < this.capacity; this.writePos++){
+ this.elements[this.writePos] = newElements[readPos++];
+ }
+
+ //fill into bottom of array too.
+ this.writePos = 0;
+
+ int endPos = Math.min(length - readPos, capacity - available - readPos);
+ for(;this.writePos < endPos; this.writePos++){
+ this.elements[this.writePos] = newElements[readPos++];
+ }
+ this.available += readPos;
+ //release
+ lock.release();
+ countsem.release();
+ return readPos;
+ }
+ } else {
+ int endPos = this.capacity - this.available + this.writePos;
+
+ for(; this.writePos < endPos; this.writePos++){
+ this.elements[this.writePos] = newElements[readPos++];
+ }
+ this.available += readPos;
+ //release
+ lock.release();
+ countsem.release();
+
+ return readPos;
+ }
+
+ }
+
+ /*
+ * Takes a stored object in Ringbuffer and releases the space
+ */
+
+ public Object take() {
+
+ Object nextObj;
+ //acquire lock
+ try {
+ countsem.acquire();
+ lock.acquire();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if(available == 0){
+ nextObj = null;
+ }
+ else {
+ int nextSlot = writePos - available;
+ if(nextSlot < 0){
+ nextSlot += capacity;
+ }
+ nextObj = elements[nextSlot];
+ available--;
+ }
+ //releases object
+ lock.release();
+ spacesem.release();
+
+ return nextObj;
+ }
+
+
+ public int take(Object[] into){
+ return take(into, into.length);
+ }
+
+
+ public int take(Object[] into, int length){
+ int intoPos = 0;
+
+ //acquire lock
+ try {
+ countsem.acquire();
+ lock.acquire();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if(available <= writePos){
+ int nextPos= writePos - available;
+ int endPos = nextPos + Math.min(available, length);
+
+ for(;nextPos < endPos; nextPos++){
+ into[intoPos++] = this.elements[nextPos];
+ }
+ this.available -= intoPos;
+
+ //release
+ lock.release();
+ countsem.release();
+
+ return intoPos;
+ } else {
+ int nextPos = writePos - available + capacity;
+
+ int leftInTop = capacity - nextPos;
+ if(length <= leftInTop){
+ //copy directly
+ for(; intoPos < length; intoPos++){
+ into[intoPos] = this.elements[nextPos++];
+ }
+ this.available -= length;
+ //release
+ lock.release();
+ countsem.release();
+ return length;
+
+ } else {
+ //copy top
+ for(; nextPos < capacity; nextPos++){
+ into[intoPos++] = this.elements[nextPos];
+ }
+
+ //copy bottom - from 0 to writePos
+ nextPos = 0;
+ int leftToCopy = length - intoPos;
+ int endPos = Math.min(writePos, leftToCopy);
+
+ for(;nextPos < endPos; nextPos++){
+ into[intoPos++] = this.elements[nextPos];
+ }
+
+ this.available -= intoPos;
+
+ //release
+ lock.release();
+ countsem.release();
+
+ return intoPos;
+ }
+ }
+ }
+
+}
|