X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=vnfs%2FVES5.0%2Fevel%2Fevel-library%2Fcode%2Fevel_library%2Fevel.h;h=119fa793ef95c15c10ceb244b5b5590ff2745c34;hb=e40e164479222fbfd9f7728c5b62683d5b8e4ab8;hp=be0c5f0e3cfe387579c847e4ee0ee00a6ccc4126;hpb=572472c6c2d9f2a279008fa11f68f8176ba55ac7;p=demo.git diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h index be0c5f0e..119fa793 100644 --- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h +++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h @@ -1,5 +1,3 @@ -#ifndef EVEL_INCLUDED -#define EVEL_INCLUDED /*************************************************************************//** * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -29,6 +27,9 @@ * be one of ::EVEL_ERR_CODES. *****************************************************************************/ +#ifndef EVEL_INCLUDED +#define EVEL_INCLUDED + #ifdef __cplusplus extern "C" { #endif @@ -86,7 +87,7 @@ typedef enum { /* 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 @@ -117,6 +118,7 @@ static const int EVEL_EVENT_BUFFER_DEPTH = 100; *****************************************************************************/ 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. */ @@ -400,9 +402,11 @@ typedef struct internal_header_fields /*****************************************************************************/ /* 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 @@ -436,9 +440,57 @@ typedef struct event_header { 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. */ /*****************************************************************************/ @@ -738,10 +790,10 @@ MEASUREMENT_DISK_USE * evel_measurement_new_disk_use_add(EVENT_MEASUREMENT * mea 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; @@ -1082,8 +1134,8 @@ typedef struct mobile_gtp_per_flow_metrics { /*****************************************************************************/ /* 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. @@ -1179,8 +1231,8 @@ typedef struct other_field { /*****************************************************************************/ /* 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. @@ -1277,8 +1329,8 @@ typedef struct state_change_additional_field { /*****************************************************************************/ /* 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. @@ -1349,8 +1401,15 @@ typedef struct copyright { * @param path The optional path (may be NULL). * @param topic The optional topic part of the URL (may be NULL). * @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 source_ip The ip of node we represent.(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 @@ -1365,8 +1424,15 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, const char * const path, const char * const topic, 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 source_ip, EVEL_SOURCE_TYPES source_type, const char * const role, int verbosity @@ -1400,6 +1466,7 @@ void evel_free_event(void * event); * 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. @@ -1407,7 +1474,9 @@ void evel_free_event(void * event); 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. * @@ -1485,6 +1554,21 @@ size_t evel_write_callback(void *contents, *****************************************************************************/ 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); + + /**************************************************************************//** * Free an event header. * @@ -1560,6 +1644,23 @@ void evel_reporting_entity_name_set(EVENT_HEADER * const header, void evel_reporting_entity_id_set(EVENT_HEADER * const header, const char * const entity_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); + /*****************************************************************************/ /*****************************************************************************/ /* */ @@ -1575,6 +1676,8 @@ void evel_reporting_entity_id_set(EVENT_HEADER * const header, * 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. @@ -1586,7 +1689,8 @@ void evel_reporting_entity_id_set(EVENT_HEADER * const header, * 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, @@ -1678,13 +1782,15 @@ void evel_fault_type_set(EVENT_FAULT * fault, const char * const type); * 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. @@ -1918,10 +2024,10 @@ void evel_measurement_fsys_use_add(EVENT_MEASUREMENT * 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. @@ -2557,13 +2663,15 @@ void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const 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. @@ -2637,6 +2745,8 @@ void evel_report_custom_measurement_add(EVENT_REPORT * 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 @@ -2652,6 +2762,7 @@ void evel_report_custom_measurement_add(EVENT_REPORT * report, * @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, @@ -3372,6 +3483,8 @@ void evel_mobile_gtp_metrics_qci_cos_count_add( * 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. @@ -3380,7 +3493,8 @@ void evel_mobile_gtp_metrics_qci_cos_count_add( * ::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, @@ -3582,6 +3696,8 @@ void evel_signaling_summary_sip_set(EVENT_SIGNALING * const event, * 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. @@ -3591,7 +3707,8 @@ void evel_signaling_summary_sip_set(EVENT_SIGNALING * const event, * ::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); @@ -3656,6 +3773,8 @@ void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change, * 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 @@ -3665,7 +3784,8 @@ void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change, * 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); @@ -3834,12 +3954,14 @@ void evel_syslog_severity_set(EVENT_SYSLOG * syslog, const char * const severty) /**************************************************************************//** * 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. @@ -3987,6 +4109,8 @@ typedef struct voice_quality_additional_info { * 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. @@ -3998,7 +4122,8 @@ typedef struct voice_quality_additional_info { ::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); @@ -4199,8 +4324,8 @@ typedef struct perf_counter { /*****************************************************************************/ /* Supported Threshold Crossing version. */ /*****************************************************************************/ -#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 1 -#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 1 +#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 2 +#define EVEL_THRESHOLD_CROSS_MINOR_VERSION 0 /**************************************************************************//** * Threshold Crossing. @@ -4248,6 +4373,8 @@ typedef struct event_threshold_cross { * 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 @@ -4265,6 +4392,7 @@ typedef struct event_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,