-#ifndef EVEL_INCLUDED
-#define EVEL_INCLUDED
+/*************************************************************************//**
+ *
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
/**************************************************************************//**
* @file
* Header for EVEL library
*
* Zero return value is success (::EVEL_SUCCESS), non-zero is failure and will
* be one of ::EVEL_ERR_CODES.
- *
- * License
- * -------
- *
- * Copyright(c) <2016>, AT&T Intellectual Property. All other rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement: This product includes
- * software developed by the AT&T.
- * 4. Neither the name of AT&T nor the names of its contributors may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY AT&T INTELLECTUAL PROPERTY ''AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AT&T INTELLECTUAL PROPERTY BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
+#ifndef EVEL_INCLUDED
+#define EVEL_INCLUDED
+
#ifdef __cplusplus
extern "C" {
#endif
/* Maximum string lengths. */
/*****************************************************************************/
#define EVEL_MAX_STRING_LEN 4096
-#define EVEL_MAX_JSON_BODY 16000
+#define EVEL_MAX_JSON_BODY 524288
#define EVEL_MAX_ERROR_STRING_LEN 255
#define EVEL_MAX_URL_LEN 511
*****************************************************************************/
typedef enum {
EVEL_DOMAIN_INTERNAL, /** Internal event, not for external routing. */
+ EVEL_DOMAIN_BATCH, /** Batch event, composite event. */
EVEL_DOMAIN_HEARTBEAT, /** A Heartbeat event (event header only). */
EVEL_DOMAIN_FAULT, /** A Fault event. */
EVEL_DOMAIN_MEASUREMENT, /** A Measurement for VF Scaling event. */
EVEL_DOMAIN_STATE_CHANGE, /** A State Change event. */
EVEL_DOMAIN_SYSLOG, /** A Syslog event. */
EVEL_DOMAIN_OTHER, /** Another event. */
+ EVEL_DOMAIN_THRESHOLD_CROSS, /** A Threshold Crossing Event */
EVEL_DOMAIN_VOICE_QUALITY, /** A Voice Quality Event */
EVEL_MAX_DOMAINS /** Maximum number of recognized Event types. */
} EVEL_EVENT_DOMAINS;
/*****************************************************************************/
/* Supported Common Event Header version. */
/*****************************************************************************/
-#define EVEL_HEADER_MAJOR_VERSION 1
-#define EVEL_HEADER_MINOR_VERSION 2
+#define EVEL_HEADER_MAJOR_VERSION 3
+#define EVEL_HEADER_MINOR_VERSION 0
+#define EVEL_BATCH_MAJOR_VERSION 1
+#define EVEL_BATCH_MINOR_VERSION 0
/**************************************************************************//**
* Event header.
* JSON equivalent field: commonEventHeader
EVEL_OPTION_INTHEADER_FIELDS internal_field;
EVEL_OPTION_STRING nfcnaming_code;
EVEL_OPTION_STRING nfnaming_code;
+ DLIST batch_events;
} EVENT_HEADER;
+/**************************************************************************//**
+ * Initialize a newly created event header.
+ *
+ * @param header Pointer to the header being initialized.
+ * @param eventname Eventname string
+ * @param eventid Event id : unique id for classification and analysis
+ * @param header Pointer to the header being initialized.
+ *****************************************************************************/
+void evel_init_header_nameid(EVENT_HEADER * const header,const char *const eventname, const char *eventid);
+
+/**************************************************************************//**
+ * Create a new Batch event.
+ *
+ * @note The mandatory fields on the Batch 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
+ * Batch has immutable properties. At this time evename and eventid
+ * for batch events are set but not used in json encoding
+ * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is
+ * not used (i.e. posted) it must be released using ::evel_free_batch.
+ * @retval NULL Failed to create the event.
+ *****************************************************************************/
+EVENT_HEADER * evel_new_batch(const char* ev_name, const char *ev_id);
+
+
+/**************************************************************************//**
+ * Add an Event into Batch Event
+ *
+ * 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 other Pointer to the Batch Event.
+ * @param jsonobj Pointer to additional Event
+ *****************************************************************************/
+void evel_batch_add_event(EVENT_HEADER * batchev, EVENT_HEADER *child);
+
+/**************************************************************************//**
+ * Free an Batch.
+ *
+ * Free off the Batch supplied. Will free all the contained allocated memory.
+ *
+ * @note It does not free the Batch itself, since that may be part of a
+ * larger structure.
+ *****************************************************************************/
+void evel_free_batch(EVENT_HEADER * event);
+
/*****************************************************************************/
/* Supported Fault version. */
/*****************************************************************************/
#define EVEL_FAULT_MAJOR_VERSION 2
-#define EVEL_FAULT_MINOR_VERSION 1
+#define EVEL_FAULT_MINOR_VERSION 0
/**************************************************************************//**
* Fault.
{
char *jsonstring;
- unsigned long long objinst_epoch_microsec;
+ EVEL_OPTION_ULL objinst_epoch_microsec;
DLIST object_keys; /*EVEL_INTERNAL_KEY list */
} EVEL_JSON_OBJECT_INSTANCE;
/* Supported Measurement version. */
/*****************************************************************************/
#define EVEL_MEASUREMENT_MAJOR_VERSION 2
-#define EVEL_MEASUREMENT_MINOR_VERSION 1
+#define EVEL_MEASUREMENT_MINOR_VERSION 0
/**************************************************************************//**
* Errors.
} EVENT_MEASUREMENT;
+
+
+/**************************************************************************//**
+ * 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 measurement Pointer to the measurement.
+ * @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.
+ *****************************************************************************/
+void evel_measurement_addl_info_add(EVENT_MEASUREMENT * measurement, char * name, char * value);
+
+/**************************************************************************//**
+ * 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 measurement Pointer to the ScalingMeasurement
+ * @param jsonobj Pointer to json object
+ *****************************************************************************/
+void evel_measurement_addl_object_add(EVENT_MEASUREMENT * measurement, EVEL_JSON_OBJECT *jsonobj);
+
/**************************************************************************//**
* CPU Usage.
* JSON equivalent field: cpuUsage
typedef struct measurement_fsys_use {
char * filesystem_name;
double block_configured;
- int block_iops;
+ double block_iops;
double block_used;
double ephemeral_configured;
- int ephemeral_iops;
+ double ephemeral_iops;
double ephemeral_used;
} MEASUREMENT_FSYS_USE;
/* Supported Report version. */
/*****************************************************************************/
#define EVEL_REPORT_MAJOR_VERSION 1
-#define EVEL_REPORT_MINOR_VERSION 1
+#define EVEL_REPORT_MINOR_VERSION 0
/**************************************************************************//**
* Report.
/*****************************************************************************/
/* Supported Mobile Flow version. */
/*****************************************************************************/
-#define EVEL_MOBILE_FLOW_MAJOR_VERSION 1
-#define EVEL_MOBILE_FLOW_MINOR_VERSION 2
+#define EVEL_MOBILE_FLOW_MAJOR_VERSION 2
+#define EVEL_MOBILE_FLOW_MINOR_VERSION 0
/**************************************************************************//**
* Mobile Flow.
/* Supported Other field version. */
/*****************************************************************************/
#define EVEL_OTHER_EVENT_MAJOR_VERSION 1
-#define EVEL_OTHER_EVENT_MINOR_VERSION 1
+#define EVEL_OTHER_EVENT_MINOR_VERSION 0
/**************************************************************************//**
* Other.
/* Supported Service Events version. */
/*****************************************************************************/
#define EVEL_HEARTBEAT_FIELD_MAJOR_VERSION 1
-#define EVEL_HEARTBEAT_FIELD_MINOR_VERSION 1
+#define EVEL_HEARTBEAT_FIELD_MINOR_VERSION 0
/*****************************************************************************/
/* Supported Signaling version. */
/*****************************************************************************/
-#define EVEL_SIGNALING_MAJOR_VERSION 2
-#define EVEL_SIGNALING_MINOR_VERSION 1
+#define EVEL_SIGNALING_MAJOR_VERSION 1
+#define EVEL_SIGNALING_MINOR_VERSION 0
/**************************************************************************//**
* Vendor VNF Name fields.
/*****************************************************************************/
/* Supported State Change version. */
/*****************************************************************************/
-#define EVEL_STATE_CHANGE_MAJOR_VERSION 1
-#define EVEL_STATE_CHANGE_MINOR_VERSION 2
+#define EVEL_STATE_CHANGE_MAJOR_VERSION 2
+#define EVEL_STATE_CHANGE_MINOR_VERSION 0
/**************************************************************************//**
* State Change.
/*****************************************************************************/
/* Supported Syslog version. */
/*****************************************************************************/
-#define EVEL_SYSLOG_MAJOR_VERSION 1
-#define EVEL_SYSLOG_MINOR_VERSION 2
+#define EVEL_SYSLOG_MAJOR_VERSION 3
+#define EVEL_SYSLOG_MINOR_VERSION 0
/**************************************************************************//**
* Syslog.
*
* @param fqdn The API's FQDN or IP address.
* @param port The API's port.
+ * @param bakup_fqdn The API's FQDN or IP address.
+ * @param bakup_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 ring_buf_size Ring buffer size (>=100) ~ Avg Messages in 1hr
* @param secure Whether to use HTTPS (0=HTTP, 1=HTTPS).
+ * @param cert_file_path Path to client certificate file
+ * @param key_file_path Path to client key file
+ * @param ca_info Path to CA info
+ * @param ca_file_path Path to CA file
+ * @param verify_peer SSL verification of peer 0 or 1
+ * @param verify_host SSL verification of host 0 or 1
* @param username Username for Basic Authentication of requests.
* @param password Password for Basic Authentication of requests.
+ * @param bakup_username Username for Basic Authentication of Bakup FQDN.
+ * @param bakup_password Password for Basic Authentication of Bakup FQDN.
+ * @param source_ip The ip of node we represent.(NULL for default ip)
+ * @param bakup_source_ip The ip bakup fqdn interface.(NULL for default ip)
* @param source_type The kind of node we represent.
* @param role The role this node undertakes.
* @param verbosity 0 for normal operation, positive values for chattier
*****************************************************************************/
EVEL_ERR_CODES evel_initialize(const char * const fqdn,
int port,
+ const char * const bakup_fqdn,
+ int bakup_port,
const char * const path,
const char * const topic,
+ int ring_buf_size,
int secure,
+ const char * const cert_file_path,
+ const char * const key_file_path,
+ const char * const ca_info,
+ const char * const ca_file_path,
+ long verify_peer,
+ long verify_host,
const char * const username,
const char * const password,
+ const char * const bakup_username,
+ const char * const bakup_password,
+ const char * const source_ip,
+ const char * const bakup_source_ip,
EVEL_SOURCE_TYPES source_type,
const char * const role,
int verbosity
);
+/**************************************************************************//**
+ * Initialize value for vm_name for all coming events
+ * @param source_name Source name string.
+ * Must confirm with EVEL source name standard
+ * @returns Status code
+ * @retval EVEL_SUCCESS On success
+ * @retval ::EVEL_ERR_CODES On failure.
+ *****************************************************************************/
+EVEL_ERR_CODES evel_set_source_name(char * src_name);
+
+
/**************************************************************************//**
* Clean up the EVEL library.
*
* Encode the event as a JSON event object according to AT&T's schema.
*
* @param json Pointer to where to store the JSON encoded data.
+ * @param mode Event mode or Batch mode
* @param max_size Size of storage available in json_body.
* @param event Pointer to the ::EVENT_HEADER to encode.
* @returns Number of bytes actually written.
int evel_json_encode_event(char * json,
int max_size,
EVENT_HEADER * event);
+int evel_json_encode_batch_event(char * json,
+ int max_size,
+ EVENT_HEADER * event);
+/**************************************************************************//**
+ * Initialize an event instance id.
+ *
+ * @param vfield Pointer to the event vnfname field being initialized.
+ * @param vendor_id The vendor id to encode in the event instance id.
+ * @param event_id The event id to encode in the event instance id.
+ *****************************************************************************/
+void evel_init_vendor_field(VENDOR_VNFNAME_FIELD * const vfield,
+ const char * const vendor_name);
+
+/**************************************************************************//**
+ * Set the Vendor module property of the Vendor.
+ *
+ * @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 vfield Pointer to the Vendor field.
+ * @param module_name The module name to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+void evel_vendor_field_module_set(VENDOR_VNFNAME_FIELD * const vfield,
+ const char * const module_name);
+/**************************************************************************//**
+ * Set the Vendor module property of the Vendor.
+ *
+ * @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 vfield Pointer to the Vendor field.
+ * @param module_name The module name to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+void evel_vendor_field_vnfname_set(VENDOR_VNFNAME_FIELD * const vfield,
+ const char * const vnfname);
+/**************************************************************************//**
+ * Free an event instance id.
+ *
+ * @param vfield Pointer to the event vnfname_field being freed.
+ *****************************************************************************/
+void evel_free_event_vendor_field(VENDOR_VNFNAME_FIELD * const vfield);
/**************************************************************************//**
* Callback function to provide returned data.
*****************************************************************************/
EVENT_HEADER * evel_new_heartbeat(void);
+/**************************************************************************//**
+ * Create a new heartbeat event of given name and type.
+ *
+ * @note that the heartbeat is just a "naked" commonEventHeader!
+ *
+ * @param event_name Unique Event Name: {DomainAbbreviation}_{AsdcModel or ApplicationPlatform}_{DescriptionOfInfoBeingConveyed}
+ * @param event_id A universal identifier of the event for: troubleshooting, cross-referencing of alarms for alarm correlation, offline log analysis, etc
+ *
+ * @returns pointer to the newly manufactured ::EVENT_HEADER. If the event is
+ * not used it must be released using ::evel_free_event
+ * @retval NULL Failed to create the event.
+ *****************************************************************************/
+EVENT_HEADER * evel_new_heartbeat_nameid(const char* ev_name, const char *ev_id);
+
+/**************************************************************************//**
+ * Create a new Heartbeat fields event.
+ *
+ * @note The mandatory fields on the Heartbeat fields 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 ev_name Unique Event Name confirming Domain AsdcModel Description
+ * @param ev_id A universal identifier of the event for: troubleshooting correlation, analysis, etc
+ * @param interval heartbeat interval
+ * @returns pointer to the newly manufactured ::EVENT_HEARTBEAT_FIELD. If the event
+ * is not used (i.e. posted) it must be released using
+ * ::evel_free_hrtbt_field.
+ * @retval NULL Failed to create the event.
+ *****************************************************************************/
+EVENT_HEARTBEAT_FIELD * evel_new_heartbeat_field(int interval,const char* ev_name, const char *ev_id);
+
/**************************************************************************//**
* Free an event header.
*
void evel_header_type_set(EVENT_HEADER * const header,
const char * const type);
+/**************************************************************************//**
+ * Set the next event_sequence to use.
+ *
+ * @param sequence The next sequence number to use.
+ *****************************************************************************/
+void evel_set_global_event_sequence(const int sequence);
+
+/**************************************************************************//**
+ * Set the Event Sequence property of the event header.
+ *
+ * @note This is mainly for tracking fault event sequence numbers
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param sequence_number
+ *
+ *****************************************************************************/
+void evel_event_sequence_set(EVENT_HEADER * const header,const int sequence_number);
+
/**************************************************************************//**
* Set the Start Epoch property of the event header.
*
void evel_reporting_entity_name_set(EVENT_HEADER * const header,
const char * const entity_name);
+/**************************************************************************//**
+ * Set the Source Name property of the event header.
+ *
+ * @note The Source Name defaults to the OpenStack VM Name.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param entity_name The source name to set.
+ *****************************************************************************/
+void evel_source_name_set(EVENT_HEADER * const header,
+ const char * const source_name);
+
/**************************************************************************//**
* Set the Reporting Entity Id property of the event header.
*
void evel_reporting_entity_id_set(EVENT_HEADER * const header,
const char * const entity_id);
+/**************************************************************************//**
+ * Set the Source Id property of the event header.
+ *
+ * @note The Source Id defaults to the OpenStack VM UUID.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param entity_id The Source id to set.
+ *****************************************************************************/
+void evel_source_id_set(EVENT_HEADER * const header,
+ const char * const source_id);
+
+/**************************************************************************//**
+ * Set the NFC Naming code property of the event header.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param nfcnamingcode String
+ *****************************************************************************/
+void evel_nfcnamingcode_set(EVENT_HEADER * const header,
+ const char * const nfcnam);
+/**************************************************************************//**
+ * Set the NF Naming code property of the event header.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param nfnamingcode String
+ *****************************************************************************/
+void evel_nfnamingcode_set(EVENT_HEADER * const header,
+ const char * const nfnam);
+
/*****************************************************************************/
/*****************************************************************************/
/* */
* 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 event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
* @param condition The condition indicated by the Fault.
* @param specific_problem The specific problem triggering the fault.
* @param priority The priority of the event.
* not used (i.e. posted) it must be released using ::evel_free_fault.
* @retval NULL Failed to create the event.
*****************************************************************************/
-EVENT_FAULT * evel_new_fault(const char * const condition,
+EVENT_FAULT * evel_new_fault(const char* ev_name, const char *ev_id,
+ const char * const condition,
const char * const specific_problem,
EVEL_EVENT_PRIORITIES priority,
EVEL_SEVERITIES severity,
* that the Measurement has immutable properties.
*
* @param measurement_interval
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
*
* @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.
*****************************************************************************/
-EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval);
+EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id);
/**************************************************************************//**
* Free a Measurement.
char * filesystem_name,
double block_configured,
double block_used,
- int block_iops,
+ double block_iops,
double ephemeral_configured,
double ephemeral_used,
- int ephemeral_iops);
+ double ephemeral_iops);
/**************************************************************************//**
* Add a Feature usage value name/value pair to the Measurement.
* that the Report has immutable properties.
*
* @param measurement_interval
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
*
* @returns pointer to the newly manufactured ::EVENT_REPORT. If the event is
* not used (i.e. posted) it must be released using
* ::evel_free_report.
* @retval NULL Failed to create the event.
*****************************************************************************/
-EVENT_REPORT * evel_new_report(double measurement_interval);
+EVENT_REPORT * evel_new_report(double measurement_interval,const char* ev_name, const char *ev_id);
/**************************************************************************//**
* Free a Report.
* explicit setter functions, but again values may only be set once so
* that the Mobile Flow has immutable properties.
*
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
* @param flow_direction
* @param gtp_per_flow_metrics
* @param ip_protocol_type
* @retval NULL Failed to create the event.
*****************************************************************************/
EVENT_MOBILE_FLOW * evel_new_mobile_flow(
+ const char* ev_name, const char *ev_id,
const char * const flow_direction,
MOBILE_GTP_PER_FLOW_METRICS * gtp_per_flow_metrics,
const char * const ip_protocol_type,
* 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 event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
* @param vendor_name The vendor id to encode in the event vnf field.
* @param module The module to encode in the event.
* @param vnfname The Virtual network function to encode in the event.
* ::evel_free_signaling.
* @retval NULL Failed to create the event.
*****************************************************************************/
-EVENT_SIGNALING * evel_new_signaling(const char * const vendor_name,
+EVENT_SIGNALING * evel_new_signaling(const char* ev_name, const char *ev_id,
+ const char * const vendor_name,
const char * const correlator,
const char * const local_ip_address,
const char * const local_port,
* setter functions, but again values may only be set once so that the
* Syslog has immutable properties.
*
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
* @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.
* ::evel_free_state_change
* @retval NULL Failed to create the event.
*****************************************************************************/
-EVENT_STATE_CHANGE * evel_new_state_change(const EVEL_ENTITY_STATE new_state,
+EVENT_STATE_CHANGE * evel_new_state_change(const char* ev_name, const char *ev_id,
+ const EVEL_ENTITY_STATE new_state,
const EVEL_ENTITY_STATE old_state,
const char * const interface);
* setter functions, but again values may only be set once so that the
* Syslog has immutable properties.
*
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
* @param event_source_type
* @param syslog_msg
* @param syslog_tag
* not used it must be released using ::evel_free_syslog
* @retval NULL Failed to create the event.
*****************************************************************************/
-EVENT_SYSLOG * evel_new_syslog(EVEL_SOURCE_TYPES event_source_type,
+EVENT_SYSLOG * evel_new_syslog(const char* ev_name, const char *ev_id,
+ EVEL_SOURCE_TYPES event_source_type,
const char * const syslog_msg,
const char * const syslog_tag);
/**************************************************************************//**
* Create a new other event.
*
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
*
* @returns pointer to the newly manufactured ::EVENT_OTHER. If the event is
* not used it must be released using ::evel_free_other.
* @retval NULL Failed to create the event.
*****************************************************************************/
-EVENT_OTHER * evel_new_other(void);
+EVENT_OTHER * evel_new_other(const char* ev_name, const char *ev_id);
/**************************************************************************//**
* Free an Other.
/* Supported Report version. */
/*****************************************************************************/
#define EVEL_VOICEQ_MAJOR_VERSION 1
-#define EVEL_VOICEQ_MINOR_VERSION 1
-
-/**************************************************************************//**
-* Voice QUality.
-* JSON equivalent field: voiceQualityFields
-*****************************************************************************/
-
-typedef struct event_voiceQuality {
- /***************************************************************************/
- /* Header and version */
- /***************************************************************************/
- EVENT_HEADER header;
- int major_version;
- int minor_version;
-
- /***************************************************************************/
- /* Mandatory fields */
- /***************************************************************************/
-
- char *calleeSideCodec;
- char *callerSideCodec;
- char *correlator;
- char *midCallRtcp;
- VENDOR_VNFNAME_FIELD vendorVnfNameFields;
-
- /***************************************************************************/
- /* Optional fields */
- /***************************************************************************/
- EVEL_OPTION_STRING phoneNumber;
- DLIST additionalInformation;
- DLIST endOfCallVqmSummaries;
-
-} EVENT_VOICE_QUALITY;
+#define EVEL_VOICEQ_MINOR_VERSION 0
/**************************************************************************//**
* End of Call Voice Quality Metrices
} END_OF_CALL_VOICE_QUALITY_METRICS;
+/**************************************************************************//**
+* Voice QUality.
+* JSON equivalent field: voiceQualityFields
+*****************************************************************************/
+
+typedef struct event_voiceQuality {
+ /***************************************************************************/
+ /* Header and version */
+ /***************************************************************************/
+ EVENT_HEADER header;
+ int major_version;
+ int minor_version;
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+
+ char *calleeSideCodec;
+ char *callerSideCodec;
+ char *correlator;
+ char *midCallRtcp;
+ VENDOR_VNFNAME_FIELD vendorVnfNameFields;
+ END_OF_CALL_VOICE_QUALITY_METRICS *endOfCallVqmSummaries;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ EVEL_OPTION_STRING phoneNumber;
+ DLIST additionalInformation;
+
+} EVENT_VOICE_QUALITY;
/**************************************************************************//**
* Voice Quality Additional Info.
* JSON equivalent field: additionalInformation
* factory function and are immutable once set. Optional fields have
* explicit setter functions, but again values may only be set once
* so that the Voice Quality has immutable properties.
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
* @param calleeSideCodec Callee codec for the call.
* @param callerSideCodec Caller codec for the call.
* @param correlator Constant across all events on this call.
::evel_free_voice_quality.
* @retval NULL Failed to create the event.
*****************************************************************************/
-EVENT_VOICE_QUALITY * evel_new_voice_quality(const char * const calleeSideCodec,
+EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev_id,
+ const char * const calleeSideCodec,
const char * const callerSideCodec, const char * const correlator,
const char * const midCallRtcp, const char * const vendorVnfNameFields);
void evel_voice_quality_addl_info_add(EVENT_VOICE_QUALITY * voiceQuality, char * name, char * value);
+/*****************************************************************************/
+/*****************************************************************************/
+/* */
+/* THRESHOLD CROSSING ALERT */
+/* */
+/*****************************************************************************/
+/*****************************************************************************/
+
+typedef enum evel_event_action {
+ EVEL_EVENT_ACTION_CLEAR,
+ EVEL_EVENT_ACTION_CONTINUE,
+ EVEL_EVENT_ACTION_SET,
+ EVEL_MAX_EVENT_ACTION
+}EVEL_EVENT_ACTION;
+
+typedef enum evel_alert_type {
+ EVEL_CARD_ANOMALY,
+ EVEL_ELEMENT_ANOMALY,
+ EVEL_INTERFACE_ANOMALY,
+ EVEL_SERVICE_ANOMALY,
+ EVEL_MAX_ANOMALY
+}EVEL_ALERT_TYPE;
+
+
+typedef struct perf_counter {
+ char * criticality;
+ char * name;
+ char * thresholdCrossed;
+ char * value;
+}PERF_COUNTER;
+
+
+/*****************************************************************************/
+/* Supported Threshold Crossing version. */
+/*****************************************************************************/
+#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 2
+#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 0
+
+/**************************************************************************//**
+ * Threshold Crossing.
+ * JSON equivalent field: Threshold Cross Fields
+ *****************************************************************************/
+typedef struct event_threshold_cross {
+ /***************************************************************************/
+ /* Header and version */
+ /***************************************************************************/
+ EVENT_HEADER header;
+ int major_version;
+ int minor_version;
+
+ /***************************************************************************/
+ /* Mandatory fields */
+ /***************************************************************************/
+ PERF_COUNTER additionalParameters;
+ EVEL_EVENT_ACTION alertAction;
+ char * alertDescription;
+ EVEL_ALERT_TYPE alertType;
+ unsigned long long collectionTimestamp;
+ EVEL_SEVERITIES eventSeverity;
+ unsigned long long eventStartTimestamp;
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ DLIST additional_info;
+ EVEL_OPTION_STRING alertValue;
+ DLIST alertidList;
+ EVEL_OPTION_STRING dataCollector;
+ EVEL_OPTION_STRING elementType;
+ EVEL_OPTION_STRING interfaceName;
+ EVEL_OPTION_STRING networkService;
+ EVEL_OPTION_STRING possibleRootCause;
+
+} EVENT_THRESHOLD_CROSS;
+
+
+/**************************************************************************//**
+ * Create a new Threshold Crossing Alert event.
+ *
+ * @note The mandatory fields on the TCA 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
+ * TCA has immutable properties.
+ *
+ * @param event_name Unique Event Name
+ * @param event_id A universal identifier of the event for analysis etc
+ * @param char* tcriticality Performance Counter Criticality MAJ MIN,
+ * @param char* tname Performance Counter Threshold name
+ * @param char* tthresholdCrossed Counter Threshold crossed value
+ * @param char* tvalue Counter actual value
+ * @param EVEL_EVENT_ACTION talertAction Alert set continue or clear
+ * @param char* talertDescription
+ * @param EVEL_ALERT_TYPE talertType Kind of anamoly
+ * @param unsigned long long tcollectionTimestamp time at which alert was collected
+ * @param EVEL_SEVERITIES teventSeverity Severity of Alert
+ * @param unsigned long long teventStartTimestamp Time when this alert started
+ *
+ * @returns pointer to the newly manufactured ::EVENT_THRESHOLD_CROSS. If the
+ * event is not used it must be released using
+ * ::evel_free_threshold_cross
+ * @retval NULL Failed to create the event.
+ *****************************************************************************/
+EVENT_THRESHOLD_CROSS * evel_new_threshold_cross(
+ const char* ev_name, const char *ev_id,
+ char * tcriticality,
+ char * tname,
+ char * tthresholdCrossed,
+ char * tvalue,
+ EVEL_EVENT_ACTION talertAction,
+ char * talertDescription,
+ EVEL_ALERT_TYPE talertType,
+ unsigned long long tcollectionTimestamp,
+ EVEL_SEVERITIES teventSeverity,
+ unsigned long long teventStartTimestamp);
+
+/**************************************************************************//**
+ * Free a Threshold cross event.
+ *
+ * Free off the Threshold crossing event supplied. Will free all the contained allocated
+ * memory.
+ *
+ * @note It does not free the Threshold Cross itself, since that may be part of a
+ * larger structure.
+ *****************************************************************************/
+void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const tcp);
+
+/**************************************************************************//**
+ * Set the Event Type property of the Threshold Cross.
+ *
+ * @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 tcp Pointer to the ::EVENT_THRESHOLD_CROSS.
+ * @param type The Event Type to be set. ASCIIZ string. The caller
+ * does not need to preserve the value once the function
+ * returns.
+ *****************************************************************************/
+void evel_threshold_cross_type_set(EVENT_THRESHOLD_CROSS * const tcp, char * type);
+
+/**************************************************************************//**
+ * Add an optional additional alertid value to Alert.
+ *
+ * @param alertid Adds Alert ID
+ *****************************************************************************/
+void evel_threshold_cross_alertid_add(EVENT_THRESHOLD_CROSS * const event,char * alertid);
+
+ /**************************************************************************//**
+ * Set the TCA probable Root cause.
+ *
+ * @param sheader Possible root cause to Threshold
+ *****************************************************************************/
+ void evel_threshold_cross_possible_rootcause_set(EVENT_THRESHOLD_CROSS * const event, char * sheader);
+ /**************************************************************************//**
+ * Set the TCA networking cause.
+ *
+ * @param sheader Possible networking service value to Threshold
+ *****************************************************************************/
+ void evel_threshold_cross_networkservice_set(EVENT_THRESHOLD_CROSS * const event, char * sheader);
+ /**************************************************************************//**
+ * Set the TCA Interface name.
+ *
+ * @param sheader Interface name to threshold
+ *****************************************************************************/
+ void evel_threshold_cross_interfacename_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
+ /**************************************************************************//**
+ * Set the TCA Data element type.
+ *
+ * @param sheader element type of Threshold
+ *****************************************************************************/
+ void evel_threshold_cross_data_elementtype_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
+ /**************************************************************************//**
+ * Set the TCA Data collector value.
+ *
+ * @param sheader Data collector value
+ *****************************************************************************/
+ void evel_threshold_cross_data_collector_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
+ /**************************************************************************//**
+ * Set the TCA alert value.
+ *
+ * @param sheader Possible alert value
+ *****************************************************************************/
+ void evel_threshold_cross_alertvalue_set(EVENT_THRESHOLD_CROSS * const event,char * sheader);
+
+/**************************************************************************//**
+ * Add an additional field name/value pair to the THRESHOLD CROSS event.
+ *
+ * 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 state_change Pointer to the ::EVENT_THRESHOLD_CROSS.
+ * @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.
+ *****************************************************************************/
+void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const tcp,
+ const char * const name,
+ const char * const value);
+
/*****************************************************************************/
/*****************************************************************************/
/* */