diff options
66 files changed, 19866 insertions, 2843 deletions
diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/Makefile b/veslibrary/ves_clibrary/VESreporting_vFW/Makefile index 7582b64..8fa7023 100644 --- a/veslibrary/ves_clibrary/VESreporting_vFW/Makefile +++ b/veslibrary/ves_clibrary/VESreporting_vFW/Makefile @@ -17,7 +17,7 @@ CC=gcc ARCH=$(shell getconf LONG_BIT) -CODE_ROOT=$(CURDIR)/../evel/evel-library +CODE_ROOT=$(CURDIR)/../.. LIBS_DIR=$(CODE_ROOT)/libs/x86_$(ARCH) INCLUDE_DIR=$(CODE_ROOT)/code/evel_library diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/README.md b/veslibrary/ves_clibrary/VESreporting_vFW/README.md index 598b207..8919224 100644 --- a/veslibrary/ves_clibrary/VESreporting_vFW/README.md +++ b/veslibrary/ves_clibrary/VESreporting_vFW/README.md @@ -2,13 +2,13 @@ PROJECT DESCRIPTION --- -This project contains the source code and scripts for the periodic generation of network measurement reports. The folder contains: +This project contains the source code and scripts for the periodic generation of network measurement reports and heartbeat events. It also generates fault event if the packets/bytes transferred are below the low water mark for the network interface. The folder contains: - README.md: this file. - LICENSE.TXT: the license text. - - vpp_measurement_reporter.c: source code that uses the ECOMP Vendor Event Listener Library (VES) to read metrics from the network interface and send periodic measurement reports to the VES collector in DCAE. The VES library used here has been cloned from the GitHub repository at https://github.com/att/evel-library on February 1, 2017. + - vpp_measurement_reporter.c: source code that uses the ECOMP Vendor Event Listener Library (VES) to read metrics from the network interface and send periodic measurement reports to the VES collector in DCAE. It generates the periodic hertbeat events. It also generates fault event if the packets/bytes transferred are below the low water mark for the network interface. The VES library used here has been cloned from the GitHub repository at https://github.com/att/evel-library on February 1, 2017. - Makefile: makefile that compiles vpp_measurement_reporter.c and generates vpp_measurement_reporter binary. @@ -16,7 +16,10 @@ This project contains the source code and scripts for the periodic generation of USAGE ---- +----- + +Update the configuration files with proper parameters values so that events generated would contain those values + To run the vpp_measurement_reporter, please execute the following steps: - Make the go-client.sh script executable diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/fw_common_config.txt b/veslibrary/ves_clibrary/VESreporting_vFW/fw_common_config.txt new file mode 100644 index 0000000..e40b5b3 --- /dev/null +++ b/veslibrary/ves_clibrary/VESreporting_vFW/fw_common_config.txt @@ -0,0 +1,9 @@ +eventType platform +nfcNamingCode ssc +nfNamingCode scfx +nfVendorName AT&T +reportingEntityId cc305d54-75b4-431b-adb2-eb6b9e541234 +reportingEntityName ibcx0001vm002oam001 +sourceId de305d54-75b4-431b-adb2-eb6b9e546014 +sourceName scfx0001vm002cap001 +timeZoneOffset UTC-05:30 diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/fw_flt_config.txt b/veslibrary/ves_clibrary/VESreporting_vFW/fw_flt_config.txt new file mode 100644 index 0000000..4b660ea --- /dev/null +++ b/veslibrary/ves_clibrary/VESreporting_vFW/fw_flt_config.txt @@ -0,0 +1,3 @@ +eventName Fault_vFirewall-AT&T_linkDownError +faultCheckInterval 30 +lowWaterMark 100 diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/fw_hb_config.txt b/veslibrary/ves_clibrary/VESreporting_vFW/fw_hb_config.txt new file mode 100644 index 0000000..c288120 --- /dev/null +++ b/veslibrary/ves_clibrary/VESreporting_vFW/fw_hb_config.txt @@ -0,0 +1,2 @@ +eventName Heartbeat_vFirewall-AT&T_heartbeat +heartbeatInterval 20 diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/fw_interface_config.txt b/veslibrary/ves_clibrary/VESreporting_vFW/fw_interface_config.txt new file mode 100644 index 0000000..7fc3656 --- /dev/null +++ b/veslibrary/ves_clibrary/VESreporting_vFW/fw_interface_config.txt @@ -0,0 +1,11 @@ +lo DNS1_RSLOTPORT_VLAN_CLASSTYPE +bond0 DNS2_RSLOTPORT_VLAN_CLASSTYPE +bond0.4020 DNS3_RSLOTPORT_VLAN_CLASSTYPE +bond0.4020.4020 DNS4_RSLOTPORT_VLAN_CLASSTYPE +bond0.4021 DNS5_RSLOTPORT_VLAN_CLASSTYPE +bond0.4021.4021 DNS6_RSLOTPORT_VLAN_CLASSTYPE +ens3 DNS7_RSLOTPORT_VLAN_CLASSTYPE +ens4 DNS8_RSLOTPORT_VLAN_CLASSTYPE +ens5 DNS9_RSLOTPORT_VLAN_CLASSTYPE +ens6 DNSa_RSLOTPORT_VLAN_CLASSTYPE +ens7 DNSb_RSLOTPORT_VLAN_CLASSTYPE diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/fw_json_sample.txt b/veslibrary/ves_clibrary/VESreporting_vFW/fw_json_sample.txt new file mode 100644 index 0000000..0e617f7 --- /dev/null +++ b/veslibrary/ves_clibrary/VESreporting_vFW/fw_json_sample.txt @@ -0,0 +1,228 @@ +{ + "event": { + "commonEventHeader": { + "domain": "heartbeat", + "eventId": "heartbeat000000001", + "eventName": "Heartbeat_vFirewall-AT&T_heartbeat", + "eventType": "platform", + "lastEpochMicrosec": 1536687218863295, + "nfNamingCode": "scfx", + "nfVendorName": "AT&T", + "nfcNamingCode": "ssc", + "priority": "Normal", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sequence": 0, + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "startEpochMicrosec": 1536687218238271, + "timeZoneOffset": "UTC-05:30", + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1" + }, + "heartbeatField": { + "heartbeatFieldsVersion": "3.0", + "heartbeatInterval": 20 + } + } +} +=============== +{ + "event": { + "commonEventHeader": { + "domain": "heartbeat", + "eventId": "heartbeat000000002", + "eventName": "Heartbeat_vFirewall-AT&T_heartbeat", + "eventType": "platform", + "lastEpochMicrosec": 1536687238893809, + "nfNamingCode": "scfx", + "nfVendorName": "AT&T", + "nfcNamingCode": "ssc", + "priority": "Normal", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sequence": 0, + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "startEpochMicrosec": 1536687218863295, + "timeZoneOffset": "UTC-05:30", + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1" + }, + "heartbeatField": { + "heartbeatFieldsVersion": "3.0", + "heartbeatInterval": 20 + } + } +} +======================= +{ + "event": { + "commonEventHeader": { + "domain": "measurementsForVfScaling", + "eventId": "mvfs000000001", + "eventName": "Measurement_vFirewall-AT&T_nicPerformance", + "eventType": "platform", + "lastEpochMicrosec": 1536687244014982, + "nfNamingCode": "scfx", + "nfVendorName": "AT&T", + "nfcNamingCode": "ssc", + "priority": "Normal", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sequence": 0, + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "startEpochMicrosec": 1536687238893809, + "timeZoneOffset": "UTC-05:30", + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1" + }, + "measurementFields": { + "cpuUsageArray": [ + { + "cpuIdentifier": "cpu1", + "cpuIdle": 25.0, + "cpuUsageSystem": 25.0, + "cpuUsageUser": 0.0, + "percentUsage": 0.0 + } + ], + "measurementFieldsVersion": "4.0", + "measurementInterval": 25, + "nicPerformanceArray": [ + { + "nicIdentifier": "docker0", + "receivedOctetsDelta": 0.0, + "receivedTotalPacketsDelta": 0.0, + "transmittedOctetsDelta": 0.0, + "transmittedTotalPacketsDelta": 0.0, + "valuesAreSuspect": "true" + }, + { + "nicIdentifier": "enp0s3", + "receivedOctetsDelta": 4.0, + "receivedTotalPacketsDelta": 0.0, + "transmittedOctetsDelta": 4.0, + "transmittedTotalPacketsDelta": 0.0, + "valuesAreSuspect": "true" + }, + { + "nicIdentifier": "lo", + "receivedOctetsDelta": 4512.0, + "receivedTotalPacketsDelta": 42.0, + "transmittedOctetsDelta": 4512.0, + "transmittedTotalPacketsDelta": 42.0, + "valuesAreSuspect": "true" + } + ], + "requestRate": 9383.0 + } + } +} +============================= +{ + "event": { + "commonEventHeader": { + "domain": "fault", + "eventId": "fault000000001", + "eventName": "Fault_vFirewall-AT&T_linkDownError", + "eventType": "platform", + "lastEpochMicrosec": 1536687250053691, + "nfNamingCode": "scfx", + "nfVendorName": "AT&T", + "nfcNamingCode": "ssc", + "priority": "Medium", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sequence": 1, + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "startEpochMicrosec": 1536687250053691, + "timeZoneOffset": "UTC-05:30", + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1" + }, + "faultFields": { + "alarmCondition": "linkDown", + "alarmInterfaceA": "docker0", + "eventCategory": "link", + "eventSeverity": "MAJOR", + "eventSourceType": "host", + "faultFieldsVersion": "4.0", + "specificProblem": "Transmit-Receive issue", + "vfStatus": "Idle" + } + } +} +=================================================== +{ + "event": { + "commonEventHeader": { + "domain": "fault", + "eventId": "fault000000002", + "eventName": "Fault_vFirewall-AT&T_linkDownError", + "eventType": "platform", + "lastEpochMicrosec": 1536687250156578, + "nfNamingCode": "scfx", + "nfVendorName": "AT&T", + "nfcNamingCode": "ssc", + "priority": "Medium", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sequence": 1, + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "startEpochMicrosec": 1536687250156578, + "timeZoneOffset": "UTC-05:30", + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1" + }, + "faultFields": { + "alarmCondition": "linkDown", + "alarmInterfaceA": "enp0s3", + "eventCategory": "link", + "eventSeverity": "MAJOR", + "eventSourceType": "host", + "faultFieldsVersion": "4.0", + "specificProblem": "Transmit-Receive issue", + "vfStatus": "Idle" + } + } +} +=============================== +{ + "event": { + "commonEventHeader": { + "domain": "fault", + "eventId": "fault000000003", + "eventName": "Fault_vFirewall-AT&T_linkDownError", + "eventType": "platform", + "lastEpochMicrosec": 1536687250158256, + "nfNamingCode": "scfx", + "nfVendorName": "AT&T", + "nfcNamingCode": "ssc", + "priority": "Medium", + "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234", + "reportingEntityName": "ibcx0001vm002oam001", + "sequence": 1, + "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014", + "sourceName": "scfx0001vm002cap001", + "startEpochMicrosec": 1536687250158256, + "timeZoneOffset": "UTC-05:30", + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1" + }, + "faultFields": { + "alarmCondition": "linkDown", + "alarmInterfaceA": "lo", + "eventCategory": "link", + "eventSeverity": "MAJOR", + "eventSourceType": "host", + "faultFieldsVersion": "4.0", + "specificProblem": "Transmit-Receive issue", + "vfStatus": "Idle" + } + } +} + diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/fw_meas_config.txt b/veslibrary/ves_clibrary/VESreporting_vFW/fw_meas_config.txt new file mode 100644 index 0000000..581ab57 --- /dev/null +++ b/veslibrary/ves_clibrary/VESreporting_vFW/fw_meas_config.txt @@ -0,0 +1,2 @@ +eventName Measurement_vFirewall-AT&T_nicPerformance +measurementInterval 25 diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/go-client.sh b/veslibrary/ves_clibrary/VESreporting_vFW/go-client.sh index 116f890..b2b3a08 100755 --- a/veslibrary/ves_clibrary/VESreporting_vFW/go-client.sh +++ b/veslibrary/ves_clibrary/VESreporting_vFW/go-client.sh @@ -3,4 +3,4 @@ export LD_LIBRARY_PATH="/opt/VES/evel/evel-library/libs/x86_64/" DCAE_COLLECTOR_IP=$(cat /opt/config/dcae_collector_ip.txt) DCAE_COLLECTOR_PORT=$(cat /opt/config/dcae_collector_port.txt) -./vpp_measurement_reporter $DCAE_COLLECTOR_IP $DCAE_COLLECTOR_PORT eth1 +./vpp_measurement_reporter $DCAE_COLLECTOR_IP $DCAE_COLLECTOR_PORT diff --git a/veslibrary/ves_clibrary/VESreporting_vFW/vpp_measurement_reporter.c b/veslibrary/ves_clibrary/VESreporting_vFW/vpp_measurement_reporter.c index 4cc4ab8..42f9793 100644 --- a/veslibrary/ves_clibrary/VESreporting_vFW/vpp_measurement_reporter.c +++ b/veslibrary/ves_clibrary/VESreporting_vFW/vpp_measurement_reporter.c @@ -1,4 +1,3 @@ - /*************************************************************************//** * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -19,30 +18,86 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <pthread.h> #include <string.h> #include <sys/time.h> +#include <sys/stat.h> #include "evel.h" #define BUFSIZE 128 -#define READ_INTERVAL 10 +#define MAX_INTERFACES 40 + + +void *MeasureThread(void *interfaceId); +void *FaultThread(void *interfaceId); +void *HeartbeatThread(void *threadarg); +void read_common_config_file(); typedef struct dummy_vpp_metrics_struct { - int bytes_in; - int bytes_out; - int packets_in; - int packets_out; + int curr_bytes_in; + int curr_bytes_out; + int curr_packets_in; + int curr_packets_out; + int last_bytes_in; + int last_bytes_out; + int last_packets_in; + int last_packets_out; } vpp_metrics_struct; -void read_vpp_metrics(vpp_metrics_struct *, char *); +typedef struct linkstat { + + char linkname[32]; + char linkdescr[64]; + char linkmode[64]; + int speedmbps; + int fault_raised; + unsigned long long last_epoch; + +}LINKSTAT; + +vpp_metrics_struct meas_intfstat[MAX_INTERFACES]; +LINKSTAT meas_linkstat[MAX_INTERFACES]; +int gm_linkcount = 0; + +vpp_metrics_struct fault_intfstat[MAX_INTERFACES]; +LINKSTAT fault_linkstat[MAX_INTERFACES]; +int gf_faultCheckInterval = 0; +int gf_lowWaterMark = 0; +int gf_linkcount = 0; + +void read_vpp_metrics(vpp_metrics_struct *, LINKSTAT *, int); unsigned long long epoch_start = 0; +time_t common_filetime = 0; +time_t hb_filetime = 0; +time_t meas_filetime = 0; +time_t fault_filetime = 0; +time_t intf_ffiletime = 0; +time_t intf_mfiletime = 0; + +int gh_eventId = 1; +int gm_eventId = 1; +char gh_event_name[BUFSIZE]; +char gm_event_name[BUFSIZE]; +char gf_event_name[BUFSIZE]; +char g_event_type[BUFSIZE]; +char g_nfc_nam_code[BUFSIZE]; +char g_nf_nam_code[BUFSIZE]; +char g_nf_vendor_name[BUFSIZE]; +char g_report_entity_id[BUFSIZE]; +char g_report_entity_name[BUFSIZE]; +char g_source_id[BUFSIZE]; +char g_timezone[BUFSIZE]; +int gm_interval = 0; +int gh_interval = 0; +char g_source_name[BUFSIZE]; + +int request_rate=0; -#ifdef DOCKER int measure_traffic() { - EVEL_ERR_CODES evel_rc = EVEL_SUCCESS; FILE *fp; int status; char count[10]; @@ -50,16 +105,8 @@ int measure_traffic() struct tm * timeinfo; char period [21]; char cmd [100]; - int concurrent_sessions = 0; - int configured_entities = 0; - double mean_request_latency = 0; - double measurement_interval = 1; - double memory_configured = 0; - double memory_used = 0; - int request_rate=0; char secs [3]; int sec; - double loadavg; printf("Checking app traffic\n"); time (&rawtime); @@ -97,10 +144,6 @@ int measure_traffic() return request_rate; } -#endif - - - /**************************************************************************//** * tap live cpu stats *****************************************************************************/ @@ -139,6 +182,7 @@ void evel_get_cpu_stats(EVENT_MEASUREMENT * measurement) cpu_use = evel_measurement_new_cpu_use_add(measurement, "cpu1", usage); if( cpu_use != NULL ){ + evel_measurement_cpu_use_idle_set(cpu_use,idle); //evel_measurement_cpu_use_interrupt_set(cpu_use,intrpt); //evel_measurement_cpu_use_nice_set(cpu_use,nice); @@ -151,57 +195,451 @@ void evel_get_cpu_stats(EVENT_MEASUREMENT * measurement) } } +int file_is_modified(const char *path, time_t *oldMTime) { + struct stat file_stat; + int err = stat(path, &file_stat); + if (err != 0) { + perror(" [file_is_modified] stat"); + exit(1); + } + if( file_stat.st_mtime > *oldMTime) + { + *oldMTime = file_stat.st_mtime; + return 1; + } + else + return 0; +} + +void read_fault_config_file() +{ + char const* const fault_fileName = "fw_flt_config.txt"; + char const* const intf_fileName = "fw_interface_config.txt"; + char *pos; + char line[BUFSIZE]; + char param[BUFSIZE]; + char value[BUFSIZE]; + + read_common_config_file(); + + FILE* file = fopen(fault_fileName, "r"); /* should check the result */ + if( file == NULL ){ + EVEL_ERROR("Error: file open error or config file is not there\n"); + exit(-1); + } + if(file_is_modified(fault_fileName, &fault_filetime)) + { + printf("Fault config file changed \n"); + + memset(gf_event_name, 0, BUFSIZE); + gf_faultCheckInterval = 0; + gf_lowWaterMark = 0; + + while ( file != NULL && fgets(line, sizeof(line), file)) { + /* note that fgets don't strip the terminating \n, checking its + presence would allow to handle lines longer that sizeof(line) */ + memset(param, 0, BUFSIZE); + memset(value, 0, BUFSIZE); + + if ((pos=strchr(line, '\n')) != NULL) + *pos = '\0'; + sscanf(line,"%s %s",param,value); + //remove_spaces(line); + if (strcmp (param, "eventName") ==0) + { + if (strlen(value) != 0) + { + strcpy(gf_event_name, value); + } + else + { + printf("\nError: eventName is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else if (strcmp (param, "faultCheckInterval") ==0) + { + if (strlen(value) != 0) + { + gf_faultCheckInterval = atoi(value); + } + else + { + printf("\nError: eventName is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else if (strcmp (param, "lowWaterMark") ==0) + { + if (strlen(value) != 0) + { + gf_lowWaterMark = atoi(value); + } + else + { + printf("Error: lowWaterMark is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else + { + printf ("Invalid parameter -%s %s\n", param, value); + } + } + } + + /* Now read the interface file */ + file = fopen(intf_fileName, "r"); /* should check the result */ + if( file == NULL ){ + EVEL_ERROR("Error: file open error or config file is not there\n"); + exit(-1); + } + if(file_is_modified(intf_fileName, &intf_ffiletime)) + { + printf("Fault config file changed \n"); + + gf_linkcount = 0; + + while ( file != NULL && fgets(line, sizeof(line), file)) { + /* note that fgets don't strip the terminating \n, checking its + presence would allow to handle lines longer that sizeof(line) */ + memset(param, 0, BUFSIZE); + memset(value, 0, BUFSIZE); + + if ((pos=strchr(line, '\n')) != NULL) + *pos = '\0'; + sscanf(line,"%s %s",param,value); + if (strlen(param) != 0) + { + strcpy(fault_linkstat[gf_linkcount].linkname, param); + strcpy(fault_linkstat[gf_linkcount].linkdescr, value); + gf_linkcount++; + } + } + } +} + +void read_hb_config_file() +{ + char const* const fileName = "fw_hb_config.txt"; + char *pos; + char line[BUFSIZE]; + char param[BUFSIZE]; + char value[BUFSIZE]; + + read_common_config_file(); + + FILE* file = fopen(fileName, "r"); /* should check the result */ + if( file == NULL ){ + EVEL_ERROR("Error: file open error or config file is not there\n"); + exit(-1); + } + if(file_is_modified(fileName, &hb_filetime)) + { + printf("HB config file changed \n"); + + memset(gh_event_name, 0, BUFSIZE); + gh_interval = 0; + + while ( file != NULL && fgets(line, sizeof(line), file)) { + /* note that fgets don't strip the terminating \n, checking its + presence would allow to handle lines longer that sizeof(line) */ + memset(param, 0, BUFSIZE); + memset(value, 0, BUFSIZE); + + if ((pos=strchr(line, '\n')) != NULL) + *pos = '\0'; + sscanf(line,"%s %s",param,value); + //remove_spaces(line); + if (strcmp (param, "eventName") ==0) + { + if (strlen(value) != 0) + { + strcpy(gh_event_name, value); + } + else + { + printf("\nError: eventName is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else if (strcmp (param, "heartbeatInterval") ==0) + { + if (strlen(value) != 0) + { + gh_interval = atoi(value); + } + else + { + printf("Error: heartbeatInterval is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else + { + printf ("Invalid parameter -%s %s\n", param, value); + } + } + } +} + +void read_meas_config_file() +{ + char const* const fileName = "fw_meas_config.txt"; + char const* const intf_fileName = "fw_interface_config.txt"; + char *pos; + char line[BUFSIZE]; + char param[BUFSIZE]; + char value[BUFSIZE]; + + read_common_config_file(); + FILE* file = fopen(fileName, "r"); /* should check the result */ + if( file == NULL ){ + EVEL_ERROR("Error: file open error or config file is not there\n"); + exit(-1); + } + if(file_is_modified(fileName, &meas_filetime)) + { + printf("Measurement Config file changed \n"); + + memset(gm_event_name, 0, BUFSIZE); + gm_interval = 0; + + while ( file != NULL && fgets(line, sizeof(line), file)) { + /* note that fgets don't strip the terminating \n, checking its + presence would allow to handle lines longer that sizeof(line) */ + memset(param, 0, BUFSIZE); + memset(value, 0, BUFSIZE); + + if ((pos=strchr(line, '\n')) != NULL) + *pos = '\0'; + sscanf(line,"%s %s",param,value); + printf("\n param and value are %s, %s\n", param,value); + //remove_spaces(line); + if (strcmp (param, "eventName") ==0) + { + if (strlen(value) != 0) + { + strcpy(gm_event_name, value); + } + else + { + printf("\nError: eventName is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else if (strcmp (param, "measurementInterval") ==0) + { + if (strlen(value) != 0) + { + gm_interval = atoi(value); + } + else + { + printf("Error: measurementInterval is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else + { + printf ("Invalid parameter -%s %s\n", param, value); + } + } + } + + /* Now read the interface file */ + file = fopen(intf_fileName, "r"); /* should check the result */ + if( file == NULL ){ + EVEL_ERROR("Error: file open error or config file is not there\n"); + exit(-1); + } + + if(file_is_modified(intf_fileName, &intf_mfiletime)) + { + printf("Interface config file changed \n"); + + gf_linkcount = 0; + + + while ( file != NULL && fgets(line, sizeof(line), file)) { + /* note that fgets don't strip the terminating \n, checking its + presence would allow to handle lines longer that sizeof(line) */ + memset(param, 0, BUFSIZE); + memset(value, 0, BUFSIZE); + + if ((pos=strchr(line, '\n')) != NULL) + *pos = '\0'; + sscanf(line,"%s %s",param,value); + if (strlen(param) != 0) + { + strcpy(meas_linkstat[gm_linkcount].linkname, param); + strcpy(meas_linkstat[gm_linkcount].linkdescr, value); + gm_linkcount++; + } + } + } +} + +void read_common_config_file() +{ + char const* const fileName = "fw_common_config.txt"; + char *pos; + char line[BUFSIZE]; + char param[BUFSIZE]; + char value[BUFSIZE]; + + FILE* file = fopen(fileName, "r"); /* should check the result */ + if( file == NULL ){ + EVEL_ERROR("Error: file open error or config file is not there\n"); + exit(-1); + } + if(file_is_modified(fileName, &common_filetime)) + { + printf("Common Config file changed \n"); + + memset(g_event_type, 0, BUFSIZE); + memset(g_nfc_nam_code, 0, BUFSIZE); + memset(g_nf_nam_code, 0, BUFSIZE); + memset(g_nf_vendor_name, 0, BUFSIZE); + memset(g_report_entity_id, 0, BUFSIZE); + memset(g_report_entity_name, 0, BUFSIZE); + memset(g_source_id, 0, BUFSIZE); + memset(g_timezone, 0, BUFSIZE); + + while ( file != NULL && fgets(line, sizeof(line), file)) { + /* note that fgets don't strip the terminating \n, checking its + presence would allow to handle lines longer that sizeof(line) */ + memset(param, 0, BUFSIZE); + memset(value, 0, BUFSIZE); + + if ((pos=strchr(line, '\n')) != NULL) + *pos = '\0'; + sscanf(line,"%s %s",param,value); + //remove_spaces(line); + + if (strcmp (param, "eventType") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_event_type, value); + } + } + else if (strcmp (param, "nfcNamingCode") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_nfc_nam_code, value); + } + } + else if (strcmp (param, "nfNamingCode") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_nf_nam_code, value); + } + } + else if (strcmp (param, "nfVendorName") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_nf_vendor_name, value); + } + } + else if (strcmp (param, "reportingEntityId") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_report_entity_id, value); + } + } + else if (strcmp (param, "reportingEntityName") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_report_entity_name, value); + } + else + { + printf("Error: reportingEntityName is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else if (strcmp (param, "sourceId") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_source_id, value); + } + } + else if (strcmp (param, "sourceName") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_source_name, value); + } + else + { + printf("Error: sourceName is a mandatory parameter, update the config file\n"); + exit(-1); + } + } + else if (strcmp (param, "timeZoneOffset") ==0) + { + if (strlen(value) != 0) + { + strcpy(g_timezone, value); + } + } + else + { + printf ("Invalid parameter -%s %s\n", param, value); + } + } + } +} int main(int argc, char** argv) { - EVEL_ERR_CODES evel_rc = EVEL_SUCCESS; - EVENT_MEASUREMENT* vpp_m = NULL; - EVENT_HEADER* vpp_m_header = NULL; - int bytes_in_this_round; - int bytes_out_this_round; - int packets_in_this_round; - int packets_out_this_round; - vpp_metrics_struct* last_vpp_metrics = malloc(sizeof(vpp_metrics_struct)); - vpp_metrics_struct* curr_vpp_metrics = malloc(sizeof(vpp_metrics_struct)); - struct timeval time_val; - //time_t start_epoch; - //time_t last_epoch; - char hostname[BUFSIZE]; char* fqdn = argv[1]; int port = atoi(argv[2]); - char* vnic = argv[3]; - MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL; - //struct timeval tv_start; - - printf("\nVector Packet Processing (VPP) measurement collection\n"); - fflush(stdout); + int i=0; + int rc; + pthread_attr_t attr; + pthread_t hb_thread; + pthread_t meas_thread; + pthread_t flt_thread; - if (argc != 4) + if (argc != 3) { - fprintf(stderr, "Usage: %s <FQDN>|<IP address> <port> <interface>\n", argv[0]); + fprintf(stderr, "Usage: %s <FQDN>|<IP address> <port> \n", argv[0]); exit(-1); } - srand(time(NULL)); /**************************************************************************/ /* Initialize */ /**************************************************************************/ if(evel_initialize(fqdn, /* FQDN */ port, /* Port */ + NULL, /* Backup FQDN */ + 0, /* Backup port */ NULL, /* optional path */ NULL, /* optional topic */ 100, /* Ring Buffer size */ 0, /* HTTPS? */ + 0, /* active mode? */ NULL, /* cert file */ NULL, /* key file */ NULL, /* ca info */ NULL, /* ca file */ 0, /* verify peer */ 0, /* verify host */ - "", /* Username */ - "", /* Password */ + "will", /* Username */ + "pill", /* Password */ + "", /* Username2 */ + "", /* Password2 */ NULL, /* Source ip */ + NULL, /* Source ip2 */ EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */ "vFirewall", /* Role */ 1)) /* Verbosity */ @@ -214,60 +652,410 @@ int main(int argc, char** argv) printf("\nInitialization completed\n"); } - gethostname(hostname, BUFSIZE); - memset(last_vpp_metrics, 0, sizeof(vpp_metrics_struct)); - read_vpp_metrics(last_vpp_metrics, vnic); + read_common_config_file(); + + /* Initialize and set thread detached attribute */ + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + + printf("Main:Creating thread \n"); + rc = pthread_create(&hb_thread, NULL, HeartbeatThread, &i); + if (rc) + { + printf("ERROR; return code from pthread_create() is %d\n", rc); + exit(-1); + } + printf("Main:Created HB thread \n"); + + rc = pthread_create(&meas_thread, NULL, MeasureThread, &i); + if (rc) + { + printf("ERROR; return code from pthread_create() is %d\n", rc); + exit(-1); + } + printf("Main:Created Measurement thread \n"); + + + rc = pthread_create(&flt_thread, NULL, FaultThread, &i); + if (rc) + { + printf("ERROR; return code from pthread_create() is %d\n", rc); + exit(-1); + } + printf("Main:Created Fault thread \n"); + + pthread_join(hb_thread, NULL); + pthread_join(meas_thread, NULL); + pthread_join(flt_thread, NULL); + + evel_terminate(); + printf("Terminated\n"); + return 0; +} + +void *HeartbeatThread(void *threadarg) +{ + sleep(1); + printf("Running HB thread \n"); + fflush(stdout); + + while(1) + { + EVENT_HEARTBEAT_FIELD * event = NULL; + EVENT_HEADER* hb_header = NULL; + EVEL_ERR_CODES evel_rc = EVEL_SUCCESS; + + /***************************************************************************/ + /* Heartbeat */ + /***************************************************************************/ + read_hb_config_file(); + char event_id1[10] = "heartbeat"; + char event_id2[15] = {0}; + char event_id[BUFSIZE] = {0}; + + memset(event_id, 0, BUFSIZE); + sprintf(event_id2, "%09d", gh_eventId++); + strcat(event_id, event_id1); + strcat(event_id, event_id2); + + event = evel_new_heartbeat_field(gh_interval, gh_event_name, event_id); + + if (event != NULL) + { + hb_header = (EVENT_HEADER *)event; + + if (g_event_type != NULL) + evel_header_type_set(&event->header, g_event_type); + + struct timeval tv_now; + gettimeofday(&tv_now, NULL); + unsigned long long epoch_now = tv_now.tv_usec + 1000000 * tv_now.tv_sec; + + evel_start_epoch_set(&event->header, epoch_start); + evel_last_epoch_set(&event->header, epoch_now); + epoch_start = epoch_now; + + if(g_nfc_nam_code != NULL) + evel_nfcnamingcode_set(&event->header, g_nfc_nam_code); + if(g_nf_nam_code != NULL) + evel_nfnamingcode_set(&event->header, g_nf_nam_code); + evel_reporting_entity_name_set(&event->header, g_report_entity_name); + if(g_report_entity_id != NULL) + evel_reporting_entity_id_set(&event->header, g_report_entity_id); + if(g_timezone != NULL) + evel_time_zone_offset_set(&event->header, g_timezone); + if(g_nf_vendor_name != NULL) + evel_nf_vendor_name_set(&event->header, g_nf_vendor_name); + if(g_source_id != NULL ) + evel_source_id_set(&event->header, g_source_id); + if(g_source_name!= NULL ) + evel_source_name_set(&event->header, g_source_name); + + evel_rc = evel_post_event(hb_header); + if (evel_rc != EVEL_SUCCESS) + { + EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string()); + } + } + else + { + EVEL_ERROR("New Heartbeat failed"); + } + printf(" Processed Heartbeat\n"); + + sleep(gh_interval); + } +} + +void *FaultThread(void *interfaceId) +{ + EVEL_ERR_CODES evel_rc = EVEL_SUCCESS; + EVENT_FAULT * fault = NULL; + EVENT_HEADER* fault_header = NULL; + int bytes_in; + int bytes_out; + int packets_in; + int packets_out; + unsigned long long epoch_now; + + struct timeval time_val; + char event_id1[10] = "fault"; + char event_id2[15] = {0}; + char event_id[BUFSIZE] = {0}; + + sleep(1); + printf("Running Measurement thread \n"); + fflush(stdout); + + memset(&fault_intfstat[0],0,(sizeof(vpp_metrics_struct)* MAX_INTERFACES)); + memset(&fault_linkstat[0],0,(sizeof(LINKSTAT) * MAX_INTERFACES)); + + read_fault_config_file(); + read_vpp_metrics(fault_intfstat, fault_linkstat, gf_linkcount); + gettimeofday(&time_val, NULL); - epoch_start = time_val.tv_sec * 1000000 + time_val.tv_usec; - sleep(READ_INTERVAL); + + sleep(gf_faultCheckInterval); /***************************************************************************/ /* Collect metrics from the VNIC */ /***************************************************************************/ while(1) { - memset(curr_vpp_metrics, 0, sizeof(vpp_metrics_struct)); - read_vpp_metrics(curr_vpp_metrics, vnic); + read_fault_config_file(); + read_vpp_metrics(fault_intfstat, fault_linkstat, gf_linkcount); - if(curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in > 0) { - bytes_in_this_round = curr_vpp_metrics->bytes_in - last_vpp_metrics->bytes_in; - } - else { - bytes_in_this_round = 0; - } - if(curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out > 0) { - bytes_out_this_round = curr_vpp_metrics->bytes_out - last_vpp_metrics->bytes_out; - } - else { - bytes_out_this_round = 0; - } - if(curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in > 0) { - packets_in_this_round = curr_vpp_metrics->packets_in - last_vpp_metrics->packets_in; - } - else { - packets_in_this_round = 0; + for (int i = 0; i < gm_linkcount; i++) + { + if(fault_intfstat[i].curr_bytes_in - fault_intfstat[i].last_bytes_in > 0) { + bytes_in = fault_intfstat[i].curr_bytes_in - fault_intfstat[i].last_bytes_in; + } + else { + bytes_in = 0; + } + if(fault_intfstat[i].curr_bytes_out - fault_intfstat[i].last_bytes_out > 0) { + bytes_out = fault_intfstat[i].curr_bytes_out - fault_intfstat[i].last_bytes_out; + } + else { + bytes_out = 0; + } + if(fault_intfstat[i].curr_packets_in - fault_intfstat[i].last_packets_in > 0) { + packets_in = fault_intfstat[i].curr_packets_in - fault_intfstat[i].last_packets_in; + } + else { + packets_in = 0; + } + if(fault_intfstat[i].curr_packets_out - fault_intfstat[i].last_packets_out > 0) { + packets_out = fault_intfstat[i].curr_packets_out - fault_intfstat[i].last_packets_out; + } + else { + packets_out = 0; + } + if (((bytes_in < gf_lowWaterMark) || (bytes_out < gf_lowWaterMark) || + (packets_in < gf_lowWaterMark) || (packets_out < gf_lowWaterMark)) && + (fault_linkstat[i].fault_raised == 0)) + { + memset(event_id, 0, BUFSIZE); + sprintf(event_id2, "%09d", (i+1)); + strcat(event_id, event_id1); + strcat(event_id, event_id2); + + fault = evel_new_fault(gf_event_name, event_id, "linkDown", + "Transmit-Receive issue", + EVEL_PRIORITY_MEDIUM, EVEL_SEVERITY_MAJOR, + EVEL_SOURCE_HOST,EVEL_VF_STATUS_IDLE); + if (fault != NULL) + { + fault_linkstat[i].fault_raised = 1; + + struct timeval tv_now; + gettimeofday(&tv_now, NULL); + epoch_now = tv_now.tv_usec + 1000000 * tv_now.tv_sec; + fault_linkstat[i].last_epoch = epoch_now; + + fault_header = (EVENT_HEADER *)fault; + evel_fault_category_set(fault, "link"); + evel_fault_interface_set(fault, fault_linkstat[i].linkname); + + if (g_event_type != NULL) + evel_fault_type_set(fault, g_event_type); + + evel_start_epoch_set(&fault->header, epoch_now); + evel_last_epoch_set(&fault->header, epoch_now); + if(g_nfc_nam_code != NULL) + evel_nfcnamingcode_set(&fault->header, g_nfc_nam_code); + if(g_nf_nam_code != NULL) + evel_nfnamingcode_set(&fault->header, g_nf_nam_code); + evel_reporting_entity_name_set(&fault->header, g_report_entity_name); + if(g_report_entity_id != NULL) + evel_reporting_entity_id_set(&fault->header, g_report_entity_id); + if(g_timezone != NULL) + evel_time_zone_offset_set(&fault->header, g_timezone); + if(g_nf_vendor_name != NULL) + evel_nf_vendor_name_set(&fault->header, g_nf_vendor_name); + if(g_source_id != NULL ) + evel_source_id_set(&fault->header, g_source_id); + if(g_source_name!= NULL ) + evel_source_name_set(&fault->header, g_source_name); + + evel_rc = evel_post_event(fault_header); + + if(evel_rc == EVEL_SUCCESS) { + printf("Fault event is correctly sent to the collector!\n"); + } + else { + printf("Post failed %d (%s)\n", evel_rc, evel_error_string()); + } + } + else { + printf("New new fault failed (%s)\n", evel_error_string()); + } } - if(curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out > 0) { - packets_out_this_round = curr_vpp_metrics->packets_out - last_vpp_metrics->packets_out; + else if (((bytes_in > gf_lowWaterMark) && (bytes_out > gf_lowWaterMark) && + (packets_in > gf_lowWaterMark) && (packets_out > gf_lowWaterMark)) && + (fault_linkstat[i].fault_raised == 1)) + { + memset(event_id, 0, BUFSIZE); + sprintf(event_id2, "%09d", (i+1)); + strcat(event_id, event_id1); + strcat(event_id, event_id2); + + fault = evel_new_fault(gf_event_name, event_id, "linkDown", + "Transmit-Receive issue", + EVEL_PRIORITY_MEDIUM, EVEL_SEVERITY_NORMAL, + EVEL_SOURCE_HOST, EVEL_VF_STATUS_ACTIVE); + if (fault != NULL) + { + fault_linkstat[i].fault_raised = 0; + + struct timeval tv_now; + gettimeofday(&tv_now, NULL); + epoch_now = tv_now.tv_usec + 1000000 * tv_now.tv_sec; + + fault_header = (EVENT_HEADER *)fault; + evel_fault_category_set(fault, "link"); + evel_fault_interface_set(fault, fault_linkstat[i].linkname); + + if (g_event_type != NULL) + evel_fault_type_set(fault, g_event_type); + + evel_start_epoch_set(&fault->header, fault_linkstat[i].last_epoch); + evel_last_epoch_set(&fault->header, epoch_now); + fault_linkstat[i].last_epoch = 0; + + if(g_nfc_nam_code != NULL) + evel_nfcnamingcode_set(&fault->header, g_nfc_nam_code); + if(g_nf_nam_code != NULL) + evel_nfnamingcode_set(&fault->header, g_nf_nam_code); + evel_reporting_entity_name_set(&fault->header, g_report_entity_name); + if(g_report_entity_id != NULL) + evel_reporting_entity_id_set(&fault->header, g_report_entity_id); + if(g_timezone != NULL) + evel_time_zone_offset_set(&fault->header, g_timezone); + if(g_nf_vendor_name != NULL) + evel_nf_vendor_name_set(&fault->header, g_nf_vendor_name); + if(g_source_id != NULL ) + evel_source_id_set(&fault->header, g_source_id); + if(g_source_name!= NULL ) + evel_source_name_set(&fault->header, g_source_name); + + evel_rc = evel_post_event(fault_header); + + if(evel_rc == EVEL_SUCCESS) { + printf("Fault event is correctly sent to the collector!\n"); + } + else { + printf("Post failed %d (%s)\n", evel_rc, evel_error_string()); + } + } + else { + printf("New fault failed (%s)\n", evel_error_string()); + } + } - else { - packets_out_this_round = 0; } - vpp_m = evel_new_measurement(READ_INTERVAL,"vFirewallBroadcastPackets","TrafficStats_1.2.3.4"); - vnic_performance = (MEASUREMENT_VNIC_PERFORMANCE *)evel_measurement_new_vnic_performance("eth0", "true"); - evel_meas_vnic_performance_add(vpp_m, vnic_performance); + sleep(gf_faultCheckInterval); + } + + /***************************************************************************/ + /* Terminate */ + /***************************************************************************/ + sleep(1); +} + +void *MeasureThread(void *interfaceId) +{ + EVEL_ERR_CODES evel_rc = EVEL_SUCCESS; + EVENT_MEASUREMENT* vpp_m = NULL; + EVENT_HEADER* vpp_m_header = NULL; + int bytes_in; + int bytes_out; + int packets_in; + int packets_out; + + struct timeval time_val; + MEASUREMENT_NIC_PERFORMANCE * vnic_performance = NULL; + //struct timeval tv_start; + char event_id1[10] = "mvfs"; + char event_id2[15] = {0}; + char event_id[BUFSIZE] = {0}; + + printf("\nVector Packet Processing (VPP) measurement collection\n"); + fflush(stdout); + + memset(&meas_intfstat[0],0,(sizeof(vpp_metrics_struct) * MAX_INTERFACES)); + memset(&meas_linkstat[0],0,(sizeof(LINKSTAT) * MAX_INTERFACES)); + + read_meas_config_file(); + + read_vpp_metrics(meas_intfstat, meas_linkstat, gm_linkcount); + + gettimeofday(&time_val, NULL); + epoch_start = time_val.tv_sec * 1000000 + time_val.tv_usec; + + sleep(gm_interval); + + /***************************************************************************/ + /* Collect metrics from the VNIC */ + /***************************************************************************/ + while(1) { + request_rate = rand()%10000; + read_meas_config_file(); + read_vpp_metrics(meas_intfstat, meas_linkstat, gm_linkcount); + + memset(event_id, 0, BUFSIZE); + sprintf(event_id2, "%09d", gm_eventId++); + strcat(event_id, event_id1); + strcat(event_id, event_id2); + + vpp_m = evel_new_measurement(gm_interval, gm_event_name, event_id); if(vpp_m != NULL) { printf("New measurement report created...\n"); + if (g_event_type != NULL) + evel_measurement_type_set(vpp_m, g_event_type); - evel_measurement_type_set(vpp_m, "HTTP request rate"); - evel_measurement_request_rate_set(vpp_m, rand()%10000); + for (int i = 0; i < gm_linkcount; i++) + { + if(meas_intfstat[i].curr_bytes_in - meas_intfstat[i].last_bytes_in > 0) { + bytes_in = meas_intfstat[i].curr_bytes_in - meas_intfstat[i].last_bytes_in; + } + else { + bytes_in = 0; + } + if(meas_intfstat[i].curr_bytes_out - meas_intfstat[i].last_bytes_out > 0) { + bytes_out = meas_intfstat[i].curr_bytes_out - meas_intfstat[i].last_bytes_out; + } + else { + bytes_out = 0; + } + if(meas_intfstat[i].curr_packets_in - meas_intfstat[i].last_packets_in > 0) { + packets_in = meas_intfstat[i].curr_packets_in - meas_intfstat[i].last_packets_in; + } + else { + packets_in = 0; + } + if(meas_intfstat[i].curr_packets_out - meas_intfstat[i].last_packets_out > 0) { + packets_out = meas_intfstat[i].curr_packets_out - meas_intfstat[i].last_packets_out; + } + else { + packets_out = 0; + } + vnic_performance = (MEASUREMENT_NIC_PERFORMANCE *)evel_measurement_new_nic_performance(meas_linkstat[i].linkname, "true"); + evel_meas_nic_performance_add(vpp_m, vnic_performance); + evel_nic_performance_rx_total_pkt_delta_set(vnic_performance, packets_in); + evel_nic_performance_tx_total_pkt_delta_set(vnic_performance, packets_out); - evel_vnic_performance_rx_total_pkt_delta_set(vnic_performance, packets_in_this_round); - evel_vnic_performance_tx_total_pkt_delta_set(vnic_performance, packets_out_this_round); + evel_nic_performance_rx_octets_delta_set(vnic_performance, bytes_in); + evel_nic_performance_tx_octets_delta_set(vnic_performance, bytes_out); + + if (strcmp(meas_linkstat[i].linkname, "docker") == 0) + { + request_rate = measure_traffic(); + } + } + evel_measurement_request_rate_set(vpp_m, request_rate); - evel_vnic_performance_rx_octets_delta_set(vnic_performance, bytes_in_this_round); - evel_vnic_performance_tx_octets_delta_set(vnic_performance, bytes_out_this_round); evel_get_cpu_stats(vpp_m); /***************************************************************************/ @@ -284,13 +1072,24 @@ int main(int argc, char** argv) evel_start_epoch_set(&vpp_m->header, epoch_start); evel_last_epoch_set(&vpp_m->header, epoch_now); epoch_start = epoch_now; - - evel_nfcnamingcode_set(&vpp_m->header, "vVNF"); - evel_nfnamingcode_set(&vpp_m->header, "vVNF"); + if(g_nfc_nam_code != NULL) + evel_nfcnamingcode_set(&vpp_m->header, g_nfc_nam_code); + if(g_nf_nam_code != NULL) + evel_nfnamingcode_set(&vpp_m->header, g_nf_nam_code); //strcpy(vpp_m_header->reporting_entity_id.value, "No UUID available"); //strcpy(vpp_m_header->reporting_entity_name, hostname); - evel_reporting_entity_name_set(&vpp_m->header, "fwll"); - evel_reporting_entity_id_set(&vpp_m->header, "No UUID available"); + evel_reporting_entity_name_set(&vpp_m->header, g_report_entity_name); + if(g_report_entity_id != NULL) + evel_reporting_entity_id_set(&vpp_m->header, g_report_entity_id); + if(g_timezone != NULL) + evel_time_zone_offset_set(&vpp_m->header, g_timezone); + if(g_nf_vendor_name != NULL) + evel_nf_vendor_name_set(&vpp_m->header, g_nf_vendor_name); + if(g_source_id != NULL ) + evel_source_id_set(&vpp_m->header, g_source_id); + if(g_source_name!= NULL ) + evel_source_name_set(&vpp_m->header, g_source_name); + evel_rc = evel_post_event(vpp_m_header); if(evel_rc == EVEL_SUCCESS) { @@ -304,29 +1103,17 @@ int main(int argc, char** argv) printf("New measurement report failed (%s)\n", evel_error_string()); } - last_vpp_metrics->bytes_in = curr_vpp_metrics->bytes_in; - last_vpp_metrics->bytes_out = curr_vpp_metrics->bytes_out; - last_vpp_metrics->packets_in = curr_vpp_metrics->packets_in; - last_vpp_metrics->packets_out = curr_vpp_metrics->packets_out; - //gettimeofday(&time_val, NULL); - //start_epoch = time_val.tv_sec * 1000000 + time_val.tv_usec; - - sleep(READ_INTERVAL); + sleep(gm_interval); } /***************************************************************************/ /* Terminate */ /***************************************************************************/ sleep(1); - free(last_vpp_metrics); - free(curr_vpp_metrics); - evel_terminate(); - printf("Terminated\n"); - - return 0; } -void read_vpp_metrics(vpp_metrics_struct *vpp_metrics, char *vnic) { +void read_vpp_metrics(vpp_metrics_struct *intfstats, LINKSTAT *linkstat, int linkcount) +{ // Define an array of char that contains the parameters of the unix 'cut' command char* params[] = {"-f3", "-f11", "-f4", "-f12"}; // Define the unix command to execute in order to read metrics from the vNIC @@ -337,36 +1124,44 @@ void read_vpp_metrics(vpp_metrics_struct *vpp_metrics, char *vnic) { char buf[BUFSIZE]; /* buffer used to store VPP metrics */ int temp[] = {0, 0, 0, 0}; /* temp array that contains VPP values */ FILE *fp; /* file descriptor to pipe cmd to shell */ - int i; - - for(i = 0; i < 4; i++) { - // Clear buffers - memset(buf, 0, BUFSIZE); - memset(cmd, 0, BUFSIZE); - // Build shell command to read metrics from the vNIC - strcat(cmd, cmd_prefix); - strcat(cmd, vnic); - strcat(cmd, cmd_mid); - strcat(cmd, params[i]); + int i, j; + + for(i = 0; i < linkcount; i++) + { + for(j = 0; j < 4; j++) { + // Clear buffers + memset(buf, 0, BUFSIZE); + memset(cmd, 0, BUFSIZE); + // Build shell command to read metrics from the vNIC + strcat(cmd, cmd_prefix); + strcat(cmd, linkstat[i].linkname); + strcat(cmd, cmd_mid); + strcat(cmd, params[j]); - // Open a pipe and read VPP values - if ((fp = popen(cmd, "r")) == NULL) { - printf("Error opening pipe!\n"); - return; - } + // Open a pipe and read VPP values + if ((fp = popen(cmd, "r")) == NULL) { + printf("Error opening pipe!\n"); + return; + } - while (fgets(buf, BUFSIZE, fp) != NULL); - temp[i] = atoi(buf); + while (fgets(buf, BUFSIZE, fp) != NULL); + temp[j] = atoi(buf); - if(pclose(fp)) { - printf("Command not found or exited with error status\n"); - return; + if(pclose(fp)) { + printf("Command not found or exited with error status\n"); + return; + } } - } + // Store the current metric in the last metric + intfstats[i].last_bytes_in = intfstats[i].curr_bytes_in; + intfstats[i].last_bytes_out = intfstats[i].curr_bytes_out; + intfstats[i].last_packets_in = intfstats[i].curr_packets_in; + intfstats[i].last_packets_out = intfstats[i].curr_packets_out; - // Store metrics read from the vNIC in the struct passed from the main function - vpp_metrics->bytes_in = temp[0]; - vpp_metrics->bytes_out = temp[1]; - vpp_metrics->packets_in = temp[2]; - vpp_metrics->packets_out = temp[3]; + // Store metrics read from the vNIC in the current + intfstats[i].curr_bytes_in = temp[0]; + intfstats[i].curr_bytes_out = temp[1]; + intfstats[i].curr_packets_in = temp[2]; + intfstats[i].curr_packets_out = temp[3]; + } } diff --git a/veslibrary/ves_clibrary/evel/evel-library/bldjobs/Makefile b/veslibrary/ves_clibrary/evel/evel-library/bldjobs/Makefile index 7ddb0b9..59f3271 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/bldjobs/Makefile +++ b/veslibrary/ves_clibrary/evel/evel-library/bldjobs/Makefile @@ -29,6 +29,7 @@ ARCH=$(shell getconf LONG_BIT) CODE_ROOT=$(CURDIR)/.. EVELLIB_ROOT=$(CODE_ROOT)/code/evel_library EVELUNIT_ROOT=$(CODE_ROOT)/code/evel_unit +EVELTRAINING_ROOT=$(CODE_ROOT)/code LIBS_DIR=$(CODE_ROOT)/libs/x86_$(ARCH) OUTPUT_DIR=$(CODE_ROOT)/output/x86_$(ARCH) DOCS_ROOT=$(CODE_ROOT)/docs @@ -80,7 +81,7 @@ DOCS_SERVER_PATH=/var/www/html/evel #****************************************************************************** # Implicit rule to make dependency files. Recipe copied from Gnu docs at: * -# https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html * +# https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html * #****************************************************************************** %.d: %.c @echo Making dependency file $(notdir $@) for $(notdir $<) @@ -104,14 +105,13 @@ DOCS_SERVER_PATH=/var/www/html/evel $(JAVA) -jar $(PLANTUML) $(PLANTFLAGS) $< all: api_library \ + vnf_reporting clean: api_library_clean \ - evel_unit_clean \ + vnf_reporting_clean \ + evel_unit_clean -install: api_library - @echo Copying $(LIBS_DIR)/libevel.so - sudo cp $(LIBS_DIR)/libevel.so /usr/lib - sudo ldconfig -n -v /usr/lib +install: evel_install_centos evel_install_ubuntu test: evel_test_centos evel_test_ubuntu @@ -126,7 +126,6 @@ API_SOURCES=$(EVELLIB_ROOT)/evel.c \ $(EVELLIB_ROOT)/ring_buffer.c \ $(EVELLIB_ROOT)/double_list.c \ $(EVELLIB_ROOT)/hashtable.c \ - $(EVELLIB_ROOT)/evel_batch.c \ $(EVELLIB_ROOT)/evel_event.c \ $(EVELLIB_ROOT)/evel_fault.c \ $(EVELLIB_ROOT)/evel_mobile_flow.c \ @@ -139,6 +138,8 @@ API_SOURCES=$(EVELLIB_ROOT)/evel.c \ $(EVELLIB_ROOT)/evel_sipsignaling.c \ $(EVELLIB_ROOT)/evel_scaling_measurement.c \ $(EVELLIB_ROOT)/evel_state_change.c \ + $(EVELLIB_ROOT)/evel_notification.c \ + $(EVELLIB_ROOT)/evel_pnf_registration.c \ $(EVELLIB_ROOT)/evel_strings.c \ $(EVELLIB_ROOT)/evel_syslog.c \ $(EVELLIB_ROOT)/evel_throttle.c \ @@ -147,6 +148,7 @@ API_SOURCES=$(EVELLIB_ROOT)/evel.c \ $(EVELLIB_ROOT)/evel_threshold_cross.c \ $(EVELLIB_ROOT)/evel_voicequality.c \ $(EVELLIB_ROOT)/evel_logging.c \ + $(EVELLIB_ROOT)/evel_batch.c \ $(EVELLIB_ROOT)/jsmn.c API_OBJECTS=$(API_SOURCES:.c=.o) -include $(API_SOURCES:.c=.d) @@ -196,6 +198,17 @@ evel_unit_clean: @$(RM) $(EVELUNIT_ROOT)/*.d #****************************************************************************** +# Build the VNF VES Reporting code * +#****************************************************************************** +vnf_reporting: + @echo Making VNF Reporting + @$(MAKE) -s -C $(EVELTRAINING_ROOT)/VESreporting + +vnf_reporting_clean: + @echo Cleaning VNF Reporting + @$(RM) $(EVELTRAINING_ROOT)/VESreporting/vpp_measurement_reporter + +#****************************************************************************** # Copy the EVEL demo onto the CentOS testbed as a package and build it. * #****************************************************************************** evel_install_centos: delivery diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.c index 4e4383e..f0e4dea 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.c @@ -64,9 +64,13 @@ char *functional_role = NULL; * * @param fqdn The API's FQDN or IP address. * @param port The API's port. + * @param bakup_fqdn The API's Backup FQDN or IP address. + * @param bakup_port The API's Backup 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 * @param secure Whether to use HTTPS (0=HTTP, 1=HTTPS) + * @param activmode Whether to use ActivStandby(0) collectors or ActiveStandby(1) * @param cert_file_path Path to client certificate file * @param key_file_path Path to client key file * @param ca_info Path to CA cert file @@ -75,7 +79,10 @@ char *functional_role = NULL; * @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 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 @@ -87,10 +94,13 @@ char *functional_role = NULL; *****************************************************************************/ 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, + int activmode, const char * const cert_file_path, const char * const key_file_path, const char * const ca_info, @@ -99,7 +109,10 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, 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 @@ -108,11 +121,13 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, EVEL_ERR_CODES rc = EVEL_SUCCESS; char base_api_url[EVEL_MAX_URL_LEN + 1] = {0}; char event_api_url[EVEL_MAX_URL_LEN + 1] = {0}; + char bakup_api_url[EVEL_MAX_URL_LEN + 1] = {0}; char throt_api_url[EVEL_MAX_URL_LEN + 1] = {0}; char path_url[EVEL_MAX_URL_LEN + 1] = {0}; char topic_url[EVEL_MAX_URL_LEN + 1] = {0}; char version_string[10] = {0}; int offset; + char * bakup_coll = NULL; /***************************************************************************/ /* Check assumptions. */ @@ -122,10 +137,17 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, assert(source_type < EVEL_MAX_SOURCE_TYPES); assert(role != NULL); + if( bakup_fqdn != NULL ) { + assert(bakup_port > 0 && bakup_port <= 65535); + } + /***************************************************************************/ /* Start logging so we can report on progress. */ /***************************************************************************/ - log_initialize(verbosity == 0 ? EVEL_LOG_INFO : EVEL_LOG_DEBUG, "EVEL"); + if( verbosity >= EVEL_LOG_MIN && verbosity <= EVEL_LOG_MAX) + log_initialize(verbosity, "EVEL"); + else + log_initialize(EVEL_LOG_MIN, "EVEL"); EVEL_INFO("EVEL started"); EVEL_INFO("API server is: %s", fqdn); EVEL_INFO("API port is: %d", port); @@ -238,6 +260,36 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, EVEL_INFO("Vendor Event Listener API is located at: %s", event_api_url); /***************************************************************************/ + /* Build a common base of the Backup API URLs. */ + /***************************************************************************/ + if( bakup_fqdn != NULL ) + { + strcpy(path_url, "/"); + snprintf(base_api_url, + EVEL_MAX_URL_LEN, + "%s://%s:%d%s/eventListener/v%s", + secure ? "https" : "http", + bakup_fqdn, + bakup_port, + (((path != NULL) && (strlen(path) > 0)) ? + strncat(path_url, path, EVEL_MAX_URL_LEN) : ""), + version_string); + + /***************************************************************************/ + /* Build the URL to the event API. */ + /***************************************************************************/ + strcpy(topic_url, "/"); + snprintf(bakup_api_url, + EVEL_MAX_URL_LEN, + "%s%s", + base_api_url, + (((topic != NULL) && (strlen(topic) > 0)) ? + strncat(topic_url, topic, EVEL_MAX_URL_LEN) : "")); + EVEL_INFO("Vendor Backup Event Listener API is located at: %s", bakup_api_url); + bakup_coll = bakup_api_url; + } + + /***************************************************************************/ /* Build the URL to the throttling API. */ /***************************************************************************/ snprintf(throt_api_url, @@ -250,10 +302,13 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, /* Spin-up the event-handler, which gets cURL readied for use. */ /***************************************************************************/ rc = event_handler_initialize(event_api_url, + bakup_coll, throt_api_url, source_ip, + bakup_source_ip, ring_buf_size, secure, + activmode, cert_file_path, key_file_path, ca_info, @@ -262,6 +317,8 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, verify_host, username, password, + bakup_username, + bakup_password, verbosity); if (rc != EVEL_SUCCESS) { @@ -448,6 +505,20 @@ void evel_free_event(void * event) free(evt_ptr); break; + case EVEL_DOMAIN_PNF_REGISTRATION: + EVEL_DEBUG("Event is an PNFRegistration at %lp", evt_ptr); + evel_free_pnf_registration((EVENT_PNF_REGISTRATION *)evt_ptr); + memset(evt_ptr, 0, sizeof(EVENT_PNF_REGISTRATION)); + free(evt_ptr); + break; + + case EVEL_DOMAIN_NOTIFICATION: + EVEL_DEBUG("Event is an Notification at %lp", evt_ptr); + evel_free_notification((EVENT_PNF_REGISTRATION *)evt_ptr); + memset(evt_ptr, 0, sizeof(EVENT_NOTIFICATION)); + free(evt_ptr); + break; + case EVEL_DOMAIN_BATCH: EVEL_DEBUG("Event is a Batch at %lp", evt_ptr); evel_free_batch((EVENT_HEADER *)evt_ptr); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.h b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.h index 5c05993..c149749 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.h +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel.h @@ -46,8 +46,9 @@ extern "C" { /*****************************************************************************/ /* Supported API version. */ /*****************************************************************************/ -#define EVEL_API_MAJOR_VERSION 5 +#define EVEL_API_MAJOR_VERSION 7 #define EVEL_API_MINOR_VERSION 0 +#define EVEL_API_PATCH_VERSION 2 /**************************************************************************//** * Error codes @@ -76,6 +77,7 @@ typedef enum { *****************************************************************************/ typedef enum { EVEL_LOG_MIN = 0, + EVEL_LOG_WARN = 1, EVEL_LOG_SPAMMY = 30, EVEL_LOG_DEBUG = 40, EVEL_LOG_INFO = 50, @@ -131,6 +133,8 @@ typedef enum { EVEL_DOMAIN_OTHER, /** Another event. */ EVEL_DOMAIN_THRESHOLD_CROSS, /** A Threshold Crossing Event */ EVEL_DOMAIN_VOICE_QUALITY, /** A Voice Quality Event */ + EVEL_DOMAIN_NOTIFICATION, /** A Notification event. */ + EVEL_DOMAIN_PNF_REGISTRATION, /** A PNF Registration event. */ EVEL_MAX_DOMAINS /** Maximum number of recognized Event types. */ } EVEL_EVENT_DOMAINS; @@ -234,8 +238,8 @@ typedef enum { } EVEL_ALERT_TYPES; /**************************************************************************//** - * Alert types. - * JSON equivalent fields: newState, oldState + * Entity state. + * JSON equivalent fields: new_state, old_state *****************************************************************************/ typedef enum { EVEL_ENTITY_STATE_IN_SERVICE, @@ -245,6 +249,16 @@ typedef enum { } EVEL_ENTITY_STATE; /**************************************************************************//** + * Operational state. + * JSON equivalent fields: operationalState, administrativeState + *****************************************************************************/ +typedef enum { + EVEL_OPER_STATE_IN_SERVICE, + EVEL_OPER_STATE_OUT_OF_SERVICE, + EVEL_MAX_OPER_STATES +} EVEL_OPER_STATE; + +/**************************************************************************//** * Syslog facilities. * JSON equivalent field: syslogFacility *****************************************************************************/ @@ -362,6 +376,18 @@ typedef struct evel_option_string EVEL_BOOLEAN is_set; } EVEL_OPTION_STRING; +typedef struct evel_option_state +{ + EVEL_ENTITY_STATE state; + EVEL_BOOLEAN is_set; +} EVEL_OPTION_STATE; + +typedef struct evel_option_op_state +{ + EVEL_OPER_STATE state; + EVEL_BOOLEAN is_set; +} EVEL_OPTION_OP_STATE; + /**************************************************************************//** * Optional parameter holder for int. *****************************************************************************/ @@ -402,7 +428,7 @@ typedef struct internal_header_fields /*****************************************************************************/ /* Supported Common Event Header version. */ /*****************************************************************************/ -#define EVEL_HEADER_MAJOR_VERSION 3 +#define EVEL_HEADER_MAJOR_VERSION 4 #define EVEL_HEADER_MINOR_VERSION 0 #define EVEL_BATCH_MAJOR_VERSION 1 @@ -426,6 +452,7 @@ typedef struct event_header { char * event_name; char * source_name; char * reporting_entity_name; + char * event_listener_version; EVEL_EVENT_PRIORITIES priority; unsigned long long start_epoch_microsec; unsigned long long last_epoch_microsec; @@ -440,6 +467,8 @@ typedef struct event_header { EVEL_OPTION_INTHEADER_FIELDS internal_field; EVEL_OPTION_STRING nfcnaming_code; EVEL_OPTION_STRING nfnaming_code; + EVEL_OPTION_STRING nfVendor_name; + EVEL_OPTION_STRING timezone_offset; DLIST batch_events; } EVENT_HEADER; @@ -494,8 +523,8 @@ 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_MAJOR_VERSION 4 +#define EVEL_FAULT_MINOR_VERSION 0 /**************************************************************************//** * Fault. @@ -523,7 +552,7 @@ typedef struct event_fault { /***************************************************************************/ EVEL_OPTION_STRING category; EVEL_OPTION_STRING alarm_interface_a; - DLIST additional_info; + HASHTABLE_T *additional_info; } EVENT_FAULT; @@ -531,12 +560,11 @@ typedef struct event_fault { * Fault Additional Info. * JSON equivalent field: alarmAdditionalInformation *****************************************************************************/ -typedef struct fault_additional_info { + typedef struct fault_additional_info { char * name; char * value; } FAULT_ADDL_INFO; - /**************************************************************************//** * optional field block for fields specific to heartbeat events *****************************************************************************/ @@ -558,11 +586,315 @@ typedef struct event_heartbeat_fields /***************************************************************************/ /* Optional fields */ /***************************************************************************/ - DLIST additional_info; + HASHTABLE_T *additional_info; } EVENT_HEARTBEAT_FIELD; /**************************************************************************//** + * 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 event_name Unique Event Name confirming Domain AsdcModel Description + * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc + * @param vendor_id The vendor id to encode in the event instance id. + * @param event_id The vendor event id to encode in the event instance id. + * @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); + +/**************************************************************************//** + * Add a name/value pair to the Heartbeat fields, under the additionalFields array. + * + * 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 event Pointer to the Heartbeat fields event. + * @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. + *****************************************************************************/ +void evel_hrtbt_field_addl_field_add(EVENT_HEARTBEAT_FIELD * const event, + const char * const name, + const char * const value); + +/**************************************************************************//** + * 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 event Pointer to the Heartbeat fields event. + * @param product_id The vendor product id to be set. ASCIIZ string. The + * caller does not need to preserve the value once the + * function returns. + *****************************************************************************/ +void evel_hrtbt_interval_set(EVENT_HEARTBEAT_FIELD * const event, + const int interval); + +/**************************************************************************//** + * Free a Heartbeat fields event. + * + * Free off the event supplied. Will free all the contained allocated memory. + * + * @note It does not free the event itself, since that may be part of a larger + * structure. + *****************************************************************************/ +void evel_free_hrtbt_field(EVENT_HEARTBEAT_FIELD * const event); + + +/*****************************************************************************/ +/* Supported PNF Registration version. */ +/*****************************************************************************/ +#define EVEL_PNF_REGISTRATION_MAJOR_VERSION 2 +#define EVEL_PNF_REGISTRATION_MINOR_VERSION 0 + +/**************************************************************************//** + * PNF Registration + * JSON equivalent field: pnfRegistrationFields + *****************************************************************************/ +typedef struct event_PNF_REGISTRATION { + /***************************************************************************/ + /* Header and version */ + /***************************************************************************/ + EVENT_HEADER header; + int major_version; + int minor_version; + + /***************************************************************************/ + /* Mandatory fields */ + /***************************************************************************/ + double version; + + /***************************************************************************/ + /* Optional fields */ + /***************************************************************************/ + EVEL_OPTION_STRING last_service_date; + EVEL_OPTION_STRING mac_address; + EVEL_OPTION_STRING manufacture_date; + EVEL_OPTION_STRING model_number; + EVEL_OPTION_STRING oam_v4_ipaddress; + EVEL_OPTION_STRING oam_v6_ipaddress; + EVEL_OPTION_STRING serial_number; + EVEL_OPTION_STRING sw_version; + EVEL_OPTION_STRING unit_family; + EVEL_OPTION_STRING unit_type; + EVEL_OPTION_STRING vendor_name; + HASHTABLE_T *additional_fields; + +} EVENT_PNF_REGISTRATION; + +/**************************************************************************//** + * Create a new PNF Registration event. + * + * @note The mandatory fields on the PNF Registration must be supplied to the + * 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 event_name Unique Event Name confirming Domain AsdcModel Description + * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc + * + * @returns pointer to the newly manufactured ::EVENT_PNF_REGISTRATION. If the + * event is not used it must be released using + * ::evel_free_pnf_registration + * @retval NULL Failed to create the event. + *****************************************************************************/ +EVENT_PNF_REGISTRATION * evel_new_pnf_registration(const char* ev_name, const char *ev_id ); + +/**************************************************************************//** + * Free a PNF Registration. + * + * Free off the PNF Registration supplied. Will free all contained allocated + * memory. + * + * @note It does not free the PNF Registration itself, since that may be part + * of a larger structure. + *****************************************************************************/ +void evel_free_pnf_registration(EVENT_PNF_REGISTRATION * const pnf_registration); + +/**************************************************************************//** + * Add an additional field name/value pair to the PNF Registration + * + * 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 pnf_registration Pointer to the ::EVENT_PNF_REGISTRATION. + * @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_pnf_registration_addl_field_add( + EVENT_PNF_REGISTRATION * const pnf_registration, + const char * const name, + const char * const value); + + + /****************************************************************//** + * Set the last service date + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param last_service_date The last service date to be set. ASCIIZ + * string. The caller does not need to preserve + * the value once the function returns. +*********************************************************************/ +void evel_pnfRegistration_last_service_date_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const last_service_date); + +/************************************************************************//** + * Set the Mac Address + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param mac_address The mac address to be set. ASCIIZ string. The + * caller does not need to preserve the value once + * the function returns. +***************************************************************************/ +void evel_pnfRegistration_mac_address_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const mac_address); + +/***********************************************************************//** + * Set the Manufacture Date + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param manufacture_date The manufacture date to be set. ASCIIZ string. + * The caller does not need to preserve the value + * once the function returns. +***************************************************************************/ +void evel_pnfRegistration_manufacture_date_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const manufacture_date); + +/***********************************************************************//** + * Set the Model Number + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param model_number The model Number to be set. ASCIIZ string. The caller + * does not need to preserve the value once the + * function returns. +***************************************************************************/ +void evel_pnfRegistration_model_number_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const model_number); + +/***********************************************************************//** + * Set the OAM v4 ipaddress + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param oam_v4_ipaddress Set the oam IP address. ASCIIZ string. + * The caller does not need + * preserve the value once the function returns. +*************************************************************************/ +void evel_pnfRegistration_oam_v4_ipaddress_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const oam_v4_ipaddress); + +/**********************************************************************//** + * Set the oam v6 ipaddress + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param oam_v6_ipaddress Set the oam IP address. ASCIIZ string. + * The caller does not need + * preserve the value once the function returns. +**************************************************************************/ +void evel_pnfRegistration_oam_v6_ipaddress_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const oam_v6_ipaddress); + +/**********************************************************************//** + * Set the Serial Number + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param serial_number The serial number to be set. ASCIIZ string. + * The caller does not need to preserve the + * value once the function returns. +**************************************************************************/ +void evel_pnfRegistration_serial_number_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const serial_number); + +/***********************************************************************//** + * Set the Software Version + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param sw_version The SW Version to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. +****************************************************************************/ +void evel_pnfRegistration_sw_version_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const sw_version); + +/***********************************************************************//** + * Set the Unit Family + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param unit_family The unit family to be set. ASCIIZ string. The caller + * does not need to preserve the value once the function + * returns. +***************************************************************************/ +void evel_pnfRegistration_unit_family_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const unit_family); + +/**********************************************************************//** + * Set the Unit type + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param unit_type The unit type to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. +****************************************************************************/ +void evel_pnfRegistration_unit_type_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const unit_type); + +/***********************************************************************//** + * Set the Vendor name + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param vendor_name The vendor name to be set. ASCIIZ string. The + * caller does not need to preserve the value once + * the function returns. +***************************************************************************/ +void evel_pnfRegistration_vendor_name_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const vendor_name); + +/**************************************************************************//** * tuple which provides the name of a key along with its value and * relative order *****************************************************************************/ @@ -581,7 +913,7 @@ typedef struct json_object_instance { 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; @@ -648,19 +980,8 @@ void evel_free_jsonobject(EVEL_JSON_OBJECT * jsobj); /*****************************************************************************/ /* Supported Measurement version. */ /*****************************************************************************/ -#define EVEL_MEASUREMENT_MAJOR_VERSION 2 -#define EVEL_MEASUREMENT_MINOR_VERSION 1 - -/**************************************************************************//** - * Errors. - * JSON equivalent field: errors - *****************************************************************************/ -typedef struct measurement_errors { - int receive_discards; - int receive_errors; - int transmit_discards; - int transmit_errors; -} MEASUREMENT_ERRORS; +#define EVEL_MEASUREMENT_MAJOR_VERSION 4 +#define EVEL_MEASUREMENT_MINOR_VERSION 0 /**************************************************************************//** * Measurement. @@ -682,27 +1003,202 @@ typedef struct event_measurement { /***************************************************************************/ /* Optional fields */ /***************************************************************************/ - DLIST additional_info; - DLIST additional_measurements; - DLIST additional_objects; + HASHTABLE_T * additional_info; + DLIST additional_measurements; // arry of named hashmap + DLIST additional_objects; //array of json objects DLIST codec_usage; EVEL_OPTION_INT concurrent_sessions; EVEL_OPTION_INT configured_entities; DLIST cpu_usage; + + //VES6.0 Added field 14/07/2018 + DLIST huge_pages; + DLIST loads; + DLIST process_stats; + DLIST ipmis; + DLIST disk_usage; - MEASUREMENT_ERRORS * errors; - DLIST feature_usage; + DLIST machine_check_exception; + HASHTABLE_T * feature_usage; DLIST filesystem_usage; DLIST latency_distribution; EVEL_OPTION_DOUBLE mean_request_latency; DLIST mem_usage; EVEL_OPTION_INT media_ports_in_use; - EVEL_OPTION_INT request_rate; + EVEL_OPTION_DOUBLE request_rate; EVEL_OPTION_INT vnfc_scaling_metric; - DLIST vnic_usage; + DLIST nic_performance; } EVENT_MEASUREMENT; +typedef struct Measurement_machine_check_exception { + char * process_id; + EVEL_OPTION_DOUBLE corrected_memory_errors; + EVEL_OPTION_DOUBLE corrected_memory_errors_in_1Hr; + EVEL_OPTION_DOUBLE uncorrected_memory_errors; + EVEL_OPTION_DOUBLE uncorrected_memory_errors_in_1Hr; + +} MACHINE_CHECK_EXCEPTION; +/**************************************************************************//** +* Huge Pages. +* JSON equivalent field: hugePages +*****************************************************************************/ +typedef struct measurement_huge_page { + char * hugePagesIdentifier; + EVEL_OPTION_DOUBLE bytesUsed; + EVEL_OPTION_DOUBLE bytesFree; + EVEL_OPTION_DOUBLE vmPageNumberUsed; + EVEL_OPTION_DOUBLE vmPageNumberFree; + EVEL_OPTION_DOUBLE percentUsed; + EVEL_OPTION_DOUBLE percentFree; + } MEASUREMENT_HUGE_PAGE; + +/**************************************************************************//** +* Process Stats. +* JSON equivalent field: processStats +*****************************************************************************/ +typedef struct measurement_process_stats { + char * processIdentifier; + EVEL_OPTION_DOUBLE forkRate; + EVEL_OPTION_DOUBLE psStateBlocked; + EVEL_OPTION_DOUBLE psStatePaging; + EVEL_OPTION_DOUBLE psStateRunning; + EVEL_OPTION_DOUBLE psStateSleeping; + EVEL_OPTION_DOUBLE psStateStopped; + EVEL_OPTION_DOUBLE psStateZombie; + + } MEASUREMENT_PROCESS_STATS; + +/**************************************************************************//** +* Load. +* JSON equivalent field: load +*****************************************************************************/ +typedef struct measurement_load { + EVEL_OPTION_DOUBLE shortTerm; + EVEL_OPTION_DOUBLE midTerm; + EVEL_OPTION_DOUBLE longTerm; + + } MEASUREMENT_LOAD; + +/**************************************************************************//** + * Convert a ::EVEL_OPTION_OP_STATE to it's string form for JSON encoding. + * + * @param state The entity state to encode. + * + * @returns the corresponding string + *****************************************************************************/ +char * evel_entity_opt_op_state (EVEL_OPTION_OP_STATE * const state); + +/**************************************************************************//** + * Initialize an ::EVEL_OPTION_STATE to a not-set state. + * + * @param option Pointer to the ::EVEL_OPTION_INT. + *****************************************************************************/ +void evel_init_option_op_state(EVEL_OPTION_OP_STATE * const option); + +/**************************************************************************//** + * Set the value of an ::EVEL_OPTION_STATE. + * + * @param option Pointer to the ::EVEL_OPTION_STATE. + * @param value The value to set. + * @param description Description to be used in logging. + *****************************************************************************/ +void evel_set_option_op_state(EVEL_OPTION_OP_STATE * const option, + const int value, + const char * const description); +/**************************************************************************//** + * Add a huge page to measurement + * + * @param measurement Pointer to measurement + * @param hugePagesIdentifier Huge Page Identifier to add + *****************************************************************************/ +MEASUREMENT_HUGE_PAGE * evel_measurement_new_huge_page_add( + EVENT_MEASUREMENT * measurement, + const char * const hugePagesIdentifier ); + +/**************************************************************************//** + * Set bytes used value in a huge page + * + * @param huge_page Pointer to huge page + * @param val bytes used value + *****************************************************************************/ +void evel_measurement_huge_page_bytesUsed_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val); + +/**************************************************************************//** + * Set bytes free value in a huge page + * + * @param huge_page Pointer to huge page + * @param val bytes free value + *****************************************************************************/ +void evel_measurement_huge_page_bytesFree_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val); + +/**************************************************************************//** + * Set Number of used VM Pages in numbers in a huge page + * + * @param huge_page Pointer to huge page + * @param val value + *****************************************************************************/ +void evel_measurement_huge_page_vmPageNumberUsed_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val); + +/**************************************************************************//** + * Set Number of free VM Pages in numbers in a huge page + * + * @param huge_page Pointer to huge page + * @param val value + *****************************************************************************/ +void evel_measurement_huge_page_vmPageNumberFree_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val); + +/**************************************************************************//** + * Set Number of used hugePages in percent in a huge page + * + * @param huge_page Pointer to huge page + * @param val value + *****************************************************************************/ +void evel_measurement_huge_page_percentUsed_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val); + +/**************************************************************************//** + * Set umber of free hugePages in percent in a huge page + * + * @param huge_page Pointer to huge page + * @param val value + *****************************************************************************/ +void evel_measurement_huge_page_percentFree_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val); + +/**************************************************************************//** + * 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 @@ -718,6 +1214,18 @@ typedef struct measurement_cpu_use { EVEL_OPTION_DOUBLE sys; EVEL_OPTION_DOUBLE user; EVEL_OPTION_DOUBLE wait; + + /* + * Ves6.0 added fields 14/07/2018 + */ + EVEL_OPTION_DOUBLE cpuCapacityContention; + EVEL_OPTION_DOUBLE cpuDemandAvg; + EVEL_OPTION_DOUBLE cpuDemandMhz; + EVEL_OPTION_DOUBLE cpuDemandPct; + EVEL_OPTION_DOUBLE cpuLatencyAvg; + EVEL_OPTION_DOUBLE cpuOverheadAvg; + EVEL_OPTION_DOUBLE cpuSwapWaitTime; + } MEASUREMENT_CPU_USE; @@ -767,6 +1275,23 @@ typedef struct measurement_disk_use { EVEL_OPTION_DOUBLE timewritelast; EVEL_OPTION_DOUBLE timewritemax; EVEL_OPTION_DOUBLE timewritemin; + /* + * VES6.0 Added fields 14/07/2018 + */ + EVEL_OPTION_DOUBLE diskBusResets; + EVEL_OPTION_DOUBLE diskCommandsAborted; + EVEL_OPTION_DOUBLE diskTime; + EVEL_OPTION_DOUBLE diskFlushRequests; + EVEL_OPTION_DOUBLE diskFlushTime; + EVEL_OPTION_DOUBLE diskCommandsAvg; + EVEL_OPTION_DOUBLE diskReadCommandsAvg; + EVEL_OPTION_DOUBLE diskWriteCommandsAvg; + EVEL_OPTION_DOUBLE diskTotalReadLatencyAvg; + EVEL_OPTION_DOUBLE diskTotalWriteLatencyAvg; + EVEL_OPTION_DOUBLE diskWeightedIoTimeAvg; + EVEL_OPTION_DOUBLE diskWeightedIoTimeLast; + EVEL_OPTION_DOUBLE diskWeightedIoTimeMax; + EVEL_OPTION_DOUBLE diskWeightedIoTimeMin; } MEASUREMENT_DISK_USE; @@ -784,6 +1309,785 @@ typedef struct measurement_disk_use { MEASUREMENT_DISK_USE * evel_measurement_new_disk_use_add(EVENT_MEASUREMENT * measurement, char * id); /**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_iotimeavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_iotimelast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_iotimemax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_iotimemin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergereadavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergereadlast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergereadmax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergereadmin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergewritelast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergewritemax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergewriteavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_mergewritemin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetsreadavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetsreadlast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetsreadmax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetsreadmin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetswriteavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetswritelast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetswritemax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_octetswritemin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opsreadavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opsreadlast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opsreadmax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opsreadmin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opswriteavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opswritelast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opswritemax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_opswritemin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_pendingopsavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_pendingopslast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_pendingopsmax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_pendingopsmin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timereadavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timereadlast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timereadmax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timereadmin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timewriteavg_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timewritelast_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timewritemax_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_timewritemin_set(MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Number of bus resets 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskBusResets_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Number of disk commands aborted 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskCommandsAborted_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Nanoseconds spent on disk cache reads/writes 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskTime_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Total flush requests of the disk cache 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskFlushRequests_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Milliseconds spent on disk cache flushing 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskFlushTime_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Average number of commands per second 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskCommandsAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Average number of read commands issued per second to the disk 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskReadCommandsAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Average number of write commands issued per second to the disk 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskWriteCommandsAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Average read time from the perspective of a Guest OS: sum of the Kernel + * Read Latency and Physical Device Read Latency in milliseconds 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskTotalReadLatencyAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Average write time from the perspective of a Guest OS: sum of the + * Kernel Write Latency and Physical Device Write Latency in milliseconds 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskTotalWriteLatencyAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Measure in ms over 1 sec of both I/O completion time and the backlog + * that may be accumulating. Value is the average within the collection + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskWeightedIoTimeAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Measure in ms over 1 sec of both I/O completion time and the backlog + * that may be accumulating. Value is the last within the collection 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskWeightedIoTimeLast_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Measure in ms over 1 sec of both I/O completion time and the backlog + * that may be accumulating. Value is the maximum within the collection + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskWeightedIoTimeMax_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** + * Set Measure in ms over 1 sec of both I/O completion time and the backlog + * that may be accumulating. Value is the minimum within the collection + * 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 + *****************************************************************************/ +void evel_measurement_disk_use_diskWeightedIoTimeMin_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val); + +/**************************************************************************//** * Filesystem Usage. * JSON equivalent field: filesystemUsage *****************************************************************************/ @@ -802,15 +2106,27 @@ typedef struct measurement_fsys_use { * JSON equivalent field: memoryUsage *****************************************************************************/ typedef struct measurement_mem_use { - char * id; char * vmid; - double membuffsz; + double memused; + double memfree; + EVEL_OPTION_DOUBLE membuffsz; EVEL_OPTION_DOUBLE memcache; EVEL_OPTION_DOUBLE memconfig; - EVEL_OPTION_DOUBLE memfree; EVEL_OPTION_DOUBLE slabrecl; EVEL_OPTION_DOUBLE slabunrecl; - EVEL_OPTION_DOUBLE memused; + /* + * VES6.0 Added fields 14/07/2018 + */ + EVEL_OPTION_DOUBLE memoryDemand; + EVEL_OPTION_DOUBLE memoryLatencyAvg; + EVEL_OPTION_DOUBLE memorySharedAvg; + EVEL_OPTION_DOUBLE memorySwapInAvg; + EVEL_OPTION_DOUBLE memorySwapInRateAvg; + EVEL_OPTION_DOUBLE memorySwapOutAvg; + EVEL_OPTION_DOUBLE memorySwapOutRateAvg; + EVEL_OPTION_DOUBLE memorySwapUsedAvg; + EVEL_OPTION_DOUBLE percentMemoryUsage; + } MEASUREMENT_MEM_USE; /**************************************************************************//** @@ -821,14 +2137,17 @@ typedef struct measurement_mem_use { * returns. * * @param measurement Pointer to the measurement. - * @param id ASCIIZ string with the Memory identifier. * @param vmidentifier ASCIIZ string with the VM's identifier. - * @param membuffsz Memory Size. + * @param memfree Memory Free Size. + * @param memused Memory Used * * @return Returns pointer to memory use structure in measurements *****************************************************************************/ -MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measurement, - char * id, char *vmidentifier, double membuffsz); +MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add( + EVENT_MEASUREMENT * measurement, + char *vmidentifier, + double memfree, + double memused); /**************************************************************************//** * Set kilobytes of memory used for cache @@ -843,7 +2162,7 @@ MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measu void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use, const double val); /**************************************************************************//** - * Set kilobytes of memory configured in the virtual machine on which the VNFC reporting + * Set kilobytes of memory Buffered * * @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 @@ -852,10 +2171,12 @@ void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use, * @param mem_use Pointer to the Memory Use. * @param val double *****************************************************************************/ -void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use, +void evel_measurement_mem_use_mem_buffered_set(MEASUREMENT_MEM_USE * const mem_use, const double val); + /**************************************************************************//** - * Set kilobytes of physical RAM left unused by the system + * 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 @@ -864,10 +2185,12 @@ void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use, * @param mem_use Pointer to the Memory Use. * @param val double *****************************************************************************/ -void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE * const mem_use, +void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use, const double val); + /**************************************************************************//** - * Set the part of the slab that can be reclaimed such as caches measured in kilobytes + * 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 @@ -878,8 +2201,10 @@ void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE * const mem_use, *****************************************************************************/ void evel_measurement_mem_use_slab_reclaimed_set(MEASUREMENT_MEM_USE * const mem_use, const double val); + /**************************************************************************//** - * Set the part of the slab that cannot be reclaimed such as caches measured in kilobytes + * 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 @@ -890,8 +2215,117 @@ void evel_measurement_mem_use_slab_reclaimed_set(MEASUREMENT_MEM_USE * const mem *****************************************************************************/ void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const mem_use, const double val); + +/**************************************************************************//** + * Set the Host demand in kibibytes + * + * @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 + *****************************************************************************/ +void evel_measurement_mem_use_memoryDemand_set(MEASUREMENT_MEM_USE * const mem_use, const double val); + +/**************************************************************************//** + * Set the memory latency average in Percentage of time the VM is + * waiting to access swapped or compressed memory + * + * @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 + *****************************************************************************/ +void evel_measurement_mem_use_memoryLatencyAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val); + +/**************************************************************************//** + ** Set the shared 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 + *****************************************************************************/ +void evel_measurement_mem_use_memorySharedAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val); + +/**************************************************************************//** + ** Set the Amount of memory swapped-in from host cache in kibibytes + * + * @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 + *****************************************************************************/ +void evel_measurement_mem_use_memorySwapInAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val); + +/**************************************************************************//** + ** Set the Rate at which memory is swapped from disk into active memory + * during the interval in kilobytes per second + * + * @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 + *****************************************************************************/ +void evel_measurement_mem_use_memorySwapInRateAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val); + +/**************************************************************************//** + ** Set the Amount of memory swapped-out to host cache in kibibytes + * + * @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 + *****************************************************************************/ +void evel_measurement_mem_use_memorySwapOutAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val); + +/**************************************************************************//** + ** Set the Rate at which memory is being swapped from active memory to disk + * during the current interval in kilobytes per second + * + * @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 + *****************************************************************************/ +void evel_measurement_mem_use_memorySwapOutRateAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val); + +/**************************************************************************//** + ** Set the Space used for caching swapped pages in the host cache in kibibytes + * + * @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 + *****************************************************************************/ +void evel_measurement_mem_use_memorySwapUsedAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val); + /**************************************************************************//** - * Set the total memory minus the sum of free, buffered, cached and slab memory in kilobytes + ** Set the Percentage of memory usage; value = + * (memoryUsed / (memoryUsed + memoryFree) x 100 if denomintor is nonzero, + * or 0, if otherwise. * * @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 @@ -900,8 +2334,9 @@ void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const * @param mem_use Pointer to the Memory Use. * @param val double *****************************************************************************/ -void evel_measurement_mem_use_usedup_set(MEASUREMENT_MEM_USE * const mem_use, +void evel_measurement_mem_use_percentMemoryUsage_set(MEASUREMENT_MEM_USE * const mem_use, const double val); + /**************************************************************************//** * Latency Bucket. * JSON equivalent field: latencyBucketMeasure @@ -918,13 +2353,29 @@ typedef struct measurement_latency_bucket { } MEASUREMENT_LATENCY_BUCKET; /**************************************************************************//** - * Virtual NIC usage. - * JSON equivalent field: vNicUsage + * Virtual NIC performance. + * JSON equivalent field: NicPerformance *****************************************************************************/ -typedef struct measurement_vnic_performance { +typedef struct measurement_nic_performance { + + /* Indicates whether NicPerformance values are likely inaccurate + due to counter overflow or other condtions*/ + char * nic_id; + char * valuesaresuspect; + /***************************************************************************/ /* Optional fields */ /***************************************************************************/ + EVEL_OPTION_OP_STATE administrativeState; + EVEL_OPTION_OP_STATE operationalState; + EVEL_OPTION_DOUBLE receivedPercentDiscard; + EVEL_OPTION_DOUBLE receivedPercentError; + EVEL_OPTION_DOUBLE receivedUtilization; + EVEL_OPTION_DOUBLE speed; + EVEL_OPTION_DOUBLE transmittedPercentDiscard; + EVEL_OPTION_DOUBLE transmittedPercentError; + EVEL_OPTION_DOUBLE transmittedUtilization; + /*Cumulative count of broadcast packets received as read at the end of the measurement interval*/ EVEL_OPTION_DOUBLE recvd_bcast_packets_acc; @@ -995,12 +2446,8 @@ typedef struct measurement_vnic_performance { EVEL_OPTION_DOUBLE tx_ucast_packets_acc; /*Count of transmit unicast packets within the measurement interval*/ EVEL_OPTION_DOUBLE tx_ucast_packets_delta; - /* Indicates whether vNicPerformance values are likely inaccurate - due to counter overflow or other condtions*/ - char *valuesaresuspect; - char *vnic_id; -} MEASUREMENT_VNIC_PERFORMANCE; +} MEASUREMENT_NIC_PERFORMANCE; /**************************************************************************//** * Codec Usage. @@ -1029,6 +2476,101 @@ typedef struct measurement_group { DLIST measurements; } MEASUREMENT_GROUP; +/* +* VES6.0 added fields 14July +*/ + +/**************************************************************************//** +* IPMI. +* JSON equivalent field: Ipmi +*****************************************************************************/ +typedef struct measurement_ipmi { + EVEL_OPTION_DOUBLE exitAirTemperature; + EVEL_OPTION_DOUBLE frontPanelTemperature; + EVEL_OPTION_DOUBLE ioModuleTemperature; + EVEL_OPTION_DOUBLE systemAirflow; + DLIST ipmi_base_board_temparature; + DLIST ipmi_base_board_voltage; + DLIST ipmi_battery; + DLIST ipmi_fan; + DLIST ipmi_hsbp; + DLIST ipmi_global_agg_temp_margin; + DLIST ipmi_nic; + DLIST ipmi_power; + DLIST ipmi_processor; + +} MEASUREMENT_IPMI; + +/**************************************************************************//** +* IPMI base board temperature +* JSON equivalent field: PercentUsage +*****************************************************************************/ +typedef struct measurement_ipmi_bb_temperature { + char * BBTemperatureID; + EVEL_OPTION_DOUBLE BBTemperature; + + } MEASUREMENT_IPMI_BB_TEMPERATURE; + +typedef struct measurement_ipmi_bb_voltage { + char * BBVoltageRegID; + EVEL_OPTION_DOUBLE voltageRegTemperature; + + } MEASUREMENT_IPMI_BB_VOLTAGE; + +typedef struct measurement_ipmi_battery { + char * batteryIdentifier; + EVEL_OPTION_STRING batteryType; + EVEL_OPTION_DOUBLE batteryVoltageLevel; + + } MEASUREMENT_IPMI_BATTERY; + + +typedef struct measurement_ipmi_fan { + char * fanIdentifier; + EVEL_OPTION_DOUBLE fanSpeed; + + } MEASUREMENT_IPMI_FAN; + +typedef struct measurement_ipmi_hsbp { + char * hsbpIdentifier; + EVEL_OPTION_DOUBLE hsbpTemperature; + + } MEASUREMENT_IPMI_HSBP; + +typedef struct measurement_ipmi_global_agg_temp_margin { + char * globalAggTempID; + EVEL_OPTION_DOUBLE globalAggTempMargin; + + } MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN; + +typedef struct measurement_ipmi_nic { + char * nicIdentifier; + EVEL_OPTION_DOUBLE nicTemperature; + + } MEASUREMENT_IPMI_NIC; + +typedef struct measurement_ipmi_power_supply { + char * powerSupplyIdentifier; + EVEL_OPTION_DOUBLE powerSupplyInputPower; + EVEL_OPTION_DOUBLE powerSupplyCurrentOutput; + EVEL_OPTION_DOUBLE powerSupplyTemperature; + + } MEASUREMENT_IPMI_POWER_SUPPLY; + +typedef struct measurement_ipmi_processor { + char * processorIdentifier; + EVEL_OPTION_DOUBLE pprocessorThermalControl; + EVEL_OPTION_DOUBLE processorDtsThermalMargin; + DLIST processorDimmAggregateThermalMargin; + + } MEASUREMENT_IPMI_PROCESSOR; + +typedef struct measurement_ipmi_processor_dimmAgg_therm { + char * MarginIdentifier; + double thermalMargin; + + } MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM; + /**************************************************************************//** * Custom Defined Measurement. * JSON equivalent field: measurements @@ -1042,7 +2584,7 @@ typedef struct custom_measurement { /* Supported Report version. */ /*****************************************************************************/ #define EVEL_REPORT_MAJOR_VERSION 1 -#define EVEL_REPORT_MINOR_VERSION 1 +#define EVEL_REPORT_MINOR_VERSION 0 /**************************************************************************//** * Report. @@ -1128,13 +2670,16 @@ typedef struct mobile_gtp_per_flow_metrics { EVEL_OPTION_INT num_gtp_echo_failures; EVEL_OPTION_INT num_gtp_tunnel_errors; EVEL_OPTION_INT num_http_errors; + HASHTABLE_T *ip_tos_count_list; + HASHTABLE_T *mobile_qci_cos_count_list; + HASHTABLE_T *tcp_flag_count_list; } MOBILE_GTP_PER_FLOW_METRICS; /*****************************************************************************/ /* Supported Mobile Flow version. */ /*****************************************************************************/ -#define EVEL_MOBILE_FLOW_MAJOR_VERSION 2 +#define EVEL_MOBILE_FLOW_MAJOR_VERSION 4 #define EVEL_MOBILE_FLOW_MINOR_VERSION 0 /**************************************************************************//** @@ -1160,7 +2705,7 @@ typedef struct event_mobile_flow { int other_endpoint_port; char * reporting_endpoint_ip_addr; int reporting_endpoint_port; - DLIST additional_info; /* JSON: additionalFields */ + HASHTABLE_T *additional_info; /* JSON: additionalFields */ /***************************************************************************/ /* Optional fields */ @@ -1194,8 +2739,8 @@ typedef struct event_mobile_flow { /*****************************************************************************/ /* Supported Other field version. */ /*****************************************************************************/ -#define EVEL_OTHER_EVENT_MAJOR_VERSION 1 -#define EVEL_OTHER_EVENT_MINOR_VERSION 1 +#define EVEL_OTHER_EVENT_MAJOR_VERSION 3 +#define EVEL_OTHER_EVENT_MINOR_VERSION 0 /**************************************************************************//** * Other. @@ -1206,9 +2751,14 @@ typedef struct event_other { int major_version; int minor_version; - HASHTABLE_T *namedarrays; /* HASHTABLE_T */ + DLIST arrayOfNamedHashMap; + HASHTABLE_T *hashMap; DLIST jsonobjects; /* DLIST of EVEL_JSON_OBJECT */ + +/** to delete DLIST namedvalues; + HASHTABLE_T *namedarrays;****/ /* HASHTABLE_T */ + } EVENT_OTHER; /**************************************************************************//** @@ -1224,14 +2774,14 @@ typedef struct other_field { /*****************************************************************************/ /* Supported Service Events version. */ /*****************************************************************************/ -#define EVEL_HEARTBEAT_FIELD_MAJOR_VERSION 1 -#define EVEL_HEARTBEAT_FIELD_MINOR_VERSION 1 +#define EVEL_HEARTBEAT_FIELD_MAJOR_VERSION 3 +#define EVEL_HEARTBEAT_FIELD_MINOR_VERSION 0 /*****************************************************************************/ /* Supported Signaling version. */ /*****************************************************************************/ -#define EVEL_SIGNALING_MAJOR_VERSION 1 +#define EVEL_SIGNALING_MAJOR_VERSION 3 #define EVEL_SIGNALING_MINOR_VERSION 0 /**************************************************************************//** @@ -1271,24 +2821,15 @@ typedef struct event_signaling { /***************************************************************************/ EVEL_OPTION_STRING compressed_sip; /* JSON: compressedSip */ EVEL_OPTION_STRING summary_sip; /* JSON: summarySip */ - DLIST additional_info; + HASHTABLE_T *additional_info; } EVENT_SIGNALING; -/**************************************************************************//** - * Sgnaling Additional Field. - * JSON equivalent field: additionalFields - *****************************************************************************/ -typedef struct signaling_additional_field { - char * name; - char * value; -} SIGNALING_ADDL_FIELD; - /*****************************************************************************/ /* Supported State Change version. */ /*****************************************************************************/ -#define EVEL_STATE_CHANGE_MAJOR_VERSION 1 -#define EVEL_STATE_CHANGE_MINOR_VERSION 2 +#define EVEL_STATE_CHANGE_MAJOR_VERSION 4 +#define EVEL_STATE_CHANGE_MINOR_VERSION 0 /**************************************************************************//** * State Change. @@ -1313,23 +2854,51 @@ typedef struct event_state_change { /***************************************************************************/ /* Optional fields */ /***************************************************************************/ - DLIST additional_fields; + HASHTABLE_T *additional_fields; } EVENT_STATE_CHANGE; +/*****************************************************************************/ +/* Supported Notification version. */ +/*****************************************************************************/ +#define EVEL_NOTIFICATION_MAJOR_VERSION 2 +#define EVEL_NOTIFICATION_MINOR_VERSION 0 + /**************************************************************************//** - * State Change Additional Field. - * JSON equivalent field: additionalFields + * Notification. + * JSON equivalent field: notificationFields *****************************************************************************/ -typedef struct state_change_additional_field { - char * name; - char * value; -} STATE_CHANGE_ADDL_FIELD; +typedef struct event_notification { + /***************************************************************************/ + /* Header and version */ + /***************************************************************************/ + EVENT_HEADER header; + int major_version; + int minor_version; + + /***************************************************************************/ + /* Mandatory fields */ + /***************************************************************************/ + double version; + char * changeIdentifier; + char * changeType; + + /***************************************************************************/ + /* Optional fields */ + /***************************************************************************/ + HASHTABLE_T *additional_fields; + DLIST arrayOfNamedHashMap; + EVEL_OPTION_STRING changeContact; + EVEL_OPTION_STATE new_state; + EVEL_OPTION_STATE old_state; + EVEL_OPTION_STRING state_interface; + +} EVENT_NOTIFICATION; /*****************************************************************************/ /* Supported Syslog version. */ /*****************************************************************************/ -#define EVEL_SYSLOG_MAJOR_VERSION 3 +#define EVEL_SYSLOG_MAJOR_VERSION 4 #define EVEL_SYSLOG_MINOR_VERSION 0 /**************************************************************************//** @@ -1354,7 +2923,7 @@ typedef struct event_syslog { /***************************************************************************/ /* Optional fields */ /***************************************************************************/ - EVEL_OPTION_STRING additional_filters; + HASHTABLE_T * additional_fields; EVEL_OPTION_STRING event_source_host; EVEL_OPTION_INT syslog_facility; EVEL_OPTION_INT syslog_priority; @@ -1365,6 +2934,8 @@ typedef struct event_syslog { EVEL_OPTION_STRING syslog_severity; double syslog_fver; EVEL_OPTION_INT syslog_ver; + EVEL_OPTION_STRING syslog_timeStamp; + EVEL_OPTION_STRING syslog_msgHost; } EVENT_SYSLOG; @@ -1396,12 +2967,15 @@ typedef struct copyright { * * @sa Matching Term function. * - * @param fqdn The API's FQDN or IP address. +* @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 activmode Whether to use ActiveActive or ActiveStandby collector mode * @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 @@ -1410,7 +2984,10 @@ typedef struct copyright { * @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 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 @@ -1422,19 +2999,25 @@ typedef struct copyright { *****************************************************************************/ 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, + int activmode, 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_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 @@ -1490,50 +3073,6 @@ int evel_json_encode_event(char * json, 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. @@ -1612,6 +3151,24 @@ 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. * * @note The Start Epoch defaults to the time of event creation. @@ -1647,6 +3204,17 @@ 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 source_name The entity 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. * * @note The Reporting Entity Id defaults to the OpenStack VM UUID. @@ -1674,6 +3242,27 @@ void evel_nfcnamingcode_set(EVENT_HEADER * const header, void evel_nfnamingcode_set(EVENT_HEADER * const header, const char * const nfnam); +/**************************************************************************//** + * Set the NF Vendor Name + * + * @param nfVendorName NF Vendor Name to use + *****************************************************************************/ +void evel_nf_vendor_name_set(EVENT_HEADER * const header, char * nfVendorName); + +/**************************************************************************//** + * Set the time zone offset + * + * @param timeZoneOffset Time zone offset to use. + *****************************************************************************/ +void evel_time_zone_offset_set(EVENT_HEADER * const header, char * timeZoneOffset); + +/**************************************************************************//** + * Set the source ID + * + * @param sourceId source ID to use + *****************************************************************************/ +void evel_source_id_set(EVENT_HEADER * const header, char * sourceId); + /*****************************************************************************/ /*****************************************************************************/ /* */ @@ -1857,24 +3446,6 @@ void evel_measurement_conc_sess_set(EVENT_MEASUREMENT * measurement, void evel_measurement_cfg_ents_set(EVENT_MEASUREMENT * measurement, int configured_entities); -/**************************************************************************//** - * Add an additional set of Errors 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_discards The number of receive discards. - * @param receive_errors The number of receive errors. - * @param transmit_discards The number of transmit discards. - * @param transmit_errors The number of transmit errors. - *****************************************************************************/ -void evel_measurement_errors_set(EVENT_MEASUREMENT * measurement, - int receive_discards, - int receive_errors, - int transmit_discards, - int transmit_errors); /**************************************************************************//** * Set the Mean Request Latency property of the Measurement. @@ -1900,7 +3471,7 @@ void evel_measurement_mean_req_lat_set(EVENT_MEASUREMENT * measurement, * @param request_rate The Request Rate to be set. *****************************************************************************/ void evel_measurement_request_rate_set(EVENT_MEASUREMENT * measurement, - int request_rate); + double request_rate); /**************************************************************************//** * Add an additional CPU usage value name/value pair to the Measurement. @@ -2017,6 +3588,102 @@ void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE * const cpu_use, const double val); /**************************************************************************//** + * Set the The amount of time the CPU cannot run due to contention, in + * milliseconds 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 cpu_use Pointer to the CPU Use. + * @param val double + *****************************************************************************/ +void evel_measurement_cpu_use_cpuCapacityContention_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val); + +/**************************************************************************//** + * Set the total CPU time that the NF/NFC/VM could use if there was no + * contention, in milliseconds 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 cpu_use Pointer to the CPU Use. + * @param val double + *****************************************************************************/ +void evel_measurement_cpu_use_cpuDemandAvg_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val); + +/**************************************************************************//** + * Set the CPU demand in MHz + * + * @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 + *****************************************************************************/ +void evel_measurement_cpu_use_cpuDemandMhz_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val); + +/**************************************************************************//** + * Set the CPU demand as a percentage of the provisioned capacity + * + * @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 + *****************************************************************************/ +void evel_measurement_cpu_use_cpuDemandPct_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val); + +/**************************************************************************//** + * Set the Percentage of time the VM is unable to run because it is + * contending for access to the physical CPUs + * + * @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 + *****************************************************************************/ +void evel_measurement_cpu_use_cpuLatencyAvg_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val); + +/**************************************************************************//** + * Set the overhead demand above available allocations and reservations, + * in milliseconds 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 cpu_use Pointer to the CPU Use. + * @param val double + *****************************************************************************/ +void evel_measurement_cpu_use_cpuOverheadAvg_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val); + +/**************************************************************************//** + * Set the swap wait time, in milliseconds 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 cpu_use Pointer to the CPU Use. + * @param val double + *****************************************************************************/ +void evel_measurement_cpu_use_cpuSwapWaitTime_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val); + + +/**************************************************************************//** * Add an additional File System usage value name/value pair to the * Measurement. * @@ -2055,24 +3722,37 @@ void evel_measurement_fsys_use_add(EVENT_MEASUREMENT * measurement, *****************************************************************************/ void evel_measurement_feature_use_add(EVENT_MEASUREMENT * measurement, char * feature, - int utilization); + char * utilization); /**************************************************************************//** - * Add a Additional Measurement value name/value pair to the Measurement. + * Add a new Additional Measurement hashmap 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 measurement Pointer to the Measurement. - * @param group ASCIIZ string with the measurement group's name. + * @param name ASCIIZ string containing the hashmap name + *****************************************************************************/ +HASHTABLE_T * evel_measurement_new_addl_measurement( + EVENT_MEASUREMENT * measurement, + const char * const name); + +/**************************************************************************//** + * Add a new Additional Measurement hashmap 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 ht Pointer hashmap. * @param name ASCIIZ string containing the measurement's name. - * @param name ASCIIZ string containing the measurement's value. + * @param Value ASCIIZ string containing the measurement's value. *****************************************************************************/ -void evel_measurement_custom_measurement_add(EVENT_MEASUREMENT * measurement, - const char * const group, - const char * const name, - const char * const value); +void evel_measurement_addl_measurement_set ( + HASHTABLE_T * const ht, + const char * const name, + const char * const value); /**************************************************************************//** * Add a Codec usage value name/value pair to the Measurement. @@ -2184,411 +3864,529 @@ void evel_measurement_latency_add(EVENT_MEASUREMENT * const measurement, const int count); /**************************************************************************//** - * Create a new vNIC Use to be added to a Measurement event. + * Create a new NIC Use to be added to a Measurement event. * - * @note The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied + * @note The mandatory fields on the ::MEASUREMENT_NIC_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 + * set once so that the ::MEASUREMENT_NIC_PERFORMANCE has immutable * properties. * - * @param vnic_id ASCIIZ string with the vNIC's ID. + * @param nic_id ASCIIZ string with the NIC's ID. * @param val_suspect True or false confidence in data. * - * @returns pointer to the newly manufactured ::MEASUREMENT_VNIC_PERFORMANCE. + * @returns pointer to the newly manufactured ::MEASUREMENT_NIC_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. + * ::evel_measurement_free_nic_performance. + * @retval NULL Failed to create the NIC Use. *****************************************************************************/ -MEASUREMENT_VNIC_PERFORMANCE * evel_measurement_new_vnic_performance(char * const vnic_id, char * const val_suspect); +MEASUREMENT_NIC_PERFORMANCE * evel_measurement_new_nic_performance(char * const nic_id, char * const val_suspect); /**************************************************************************//** - * Free a vNIC Use. + * Free a NIC Use. * - * Free off the ::MEASUREMENT_VNIC_PERFORMANCE supplied. Will free all the contained + * Free off the ::MEASUREMENT_NIC_PERFORMANCE supplied. Will free all the contained * allocated memory. * - * @note It does not free the vNIC Use itself, since that may be part of a + * @note It does not free the NIC Use itself, since that may be part of a * larger structure. *****************************************************************************/ -void evel_measurement_free_vnic_performance(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance); +void evel_measurement_free_nic_performance(MEASUREMENT_NIC_PERFORMANCE * const nic_performance); + +/**************************************************************************//** + * Set the administrative State of the NIC 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 nic_performance Pointer to the NIC Use. + * @param state + *****************************************************************************/ +void evel_nic_performance_administrativeState_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const EVEL_OPER_STATE state); + +/**************************************************************************//** + * Set the operational state of the NIC 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 nic_performance Pointer to the NIC Use. + * @param state + *****************************************************************************/ +void evel_nic_performance_operationalState_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const EVEL_OPER_STATE state); + +/**************************************************************************//** + * Set the Percentage of discarded packets received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param receivedPercentDiscard + *****************************************************************************/ +void evel_nic_performance_receivedPercentDiscard_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double receivedPercentDiscard); + +/**************************************************************************//** + * Set the Percentage of error packets received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param receivedPercentError + *****************************************************************************/ +void evel_nic_performance_receivedPercentError_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double receivedPercentError); + +/**************************************************************************//** + * Set the Percentage of utilization received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param receivedUtilization + *****************************************************************************/ +void evel_nic_performance_receivedUtilization_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double receivedUtilization); + +/**************************************************************************//** + * Set the Speed configured in mbps of the NIC 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 nic_performance Pointer to the NIC Use. + * @param Speed + *****************************************************************************/ +void evel_nic_performance_speed_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double speed); + +/**************************************************************************//** + * Set the Percentage of discarded packets transmitted of the NIC 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 nic_performance Pointer to the NIC Use. + * @param transmittedPercentDiscard + *****************************************************************************/ +void evel_nic_performance_transmittedPercentDiscard_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double transmittedPercentDiscard); + +/**************************************************************************//** + * Set the Percentage of error packets received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param transmittedPercentError + *****************************************************************************/ +void evel_nic_performance_transmittedPercentError_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double transmittedPercentError); + +/**************************************************************************//** + * Set the Percentage of utilization transmitted of the NIC 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 nic_performance Pointer to the NIC Use. + * @param transmittedUtilization + *****************************************************************************/ +void evel_nic_performance_transmittedUtilization_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double transmittedUtilization); /**************************************************************************//** * Set the Accumulated Broadcast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_bcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_bcast_packets_acc); /**************************************************************************//** * Set the Delta Broadcast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_bcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_bcast_packets_delta); /**************************************************************************//** * Set the Discarded Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_discard_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_discard_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_discard_packets_acc); /**************************************************************************//** * Set the Delta Discarded Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_discard_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_discard_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_discard_packets_delta); /**************************************************************************//** * Set the Error Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_error_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_error_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_error_packets_acc); /**************************************************************************//** * Set the Delta Error Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_error_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_error_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_error_packets_delta); /**************************************************************************//** * Set the Accumulated Multicast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_mcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_mcast_packets_acc); /**************************************************************************//** * Set the Delta Multicast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_mcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_mcast_packets_delta); /**************************************************************************//** * Set the Accumulated Octets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_octets_acc *****************************************************************************/ -void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_octets_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_octets_acc); /**************************************************************************//** * Set the Delta Octets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_octets_delta *****************************************************************************/ -void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_octets_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_octets_delta); /**************************************************************************//** * Set the Accumulated Total Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_total_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_total_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_total_packets_acc); /**************************************************************************//** * Set the Delta Total Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_total_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_total_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_total_packets_delta); /**************************************************************************//** * Set the Accumulated Unicast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_ucast_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_ucast_packets_acc); /**************************************************************************//** * Set the Delta Unicast packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_ucast_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_ucast_packets_delta); /**************************************************************************//** * Set the Transmitted Broadcast Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_bcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_bcast_packets_acc); /**************************************************************************//** * Set the Delta Broadcast packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_bcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_bcast_packets_delta); /**************************************************************************//** * Set the Transmitted Discarded Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_discarded_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_discarded_packets_acc); /**************************************************************************//** * Set the Delta Discarded packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_discarded_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_discarded_packets_delta); /**************************************************************************//** * Set the Transmitted Errored Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_error_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_error_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_error_packets_acc); /**************************************************************************//** * Set the Delta Errored packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_error_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_error_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_error_packets_delta); /**************************************************************************//** * Set the Transmitted Multicast Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_mcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_mcast_packets_acc); /**************************************************************************//** * Set the Delta Multicast packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_mcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_mcast_packets_delta); /**************************************************************************//** * Set the Transmitted Octets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_octets_acc *****************************************************************************/ -void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_octets_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_octets_acc); /**************************************************************************//** * Set the Delta Octets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_octets_delta *****************************************************************************/ -void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_octets_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_octets_delta); /**************************************************************************//** * Set the Transmitted Total Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_total_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_total_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_total_packets_acc); /**************************************************************************//** * Set the Delta Total Packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_total_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_total_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_total_packets_delta); /**************************************************************************//** * Set the Transmitted Unicast Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_ucast_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_ucast_packets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_ucast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_ucast_packets_acc); /**************************************************************************//** * Set the Delta Octets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_ucast_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_ucast_packets_delta); /**************************************************************************//** - * Add an additional vNIC Use to the specified Measurement event. + * Add an additional NIC Use to the specified Measurement event. * * @param measurement Pointer to the measurement. - * @param vnic_performance Pointer to the vNIC Use to add. + * @param nic_performance Pointer to the NIC Use to add. *****************************************************************************/ -void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement, - MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance); +void evel_meas_nic_performance_add(EVENT_MEASUREMENT * const measurement, + MEASUREMENT_NIC_PERFORMANCE * const nic_performance); /**************************************************************************//** - * Add an additional vNIC usage record Measurement. + * Add an additional NIC usage record Measurement. * * This function implements the previous API, purely for convenience. * @@ -2596,8 +4394,17 @@ void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement, * 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 nic_id ASCIIZ string with the NIC's ID. * @param valset true or false confidence level + * @param admin_state Administrative state + * @param op_state Operational state + * @param receivedPercentDiscard Percentage of discarded packets received; + * @param receivedPercentError Percentage of error packets received + * @param receivedUtilization Percentage of utilization received + * @param speed Speed configured in mbps + * @param transmittedPercentDiscard Percentage of discarded packets transmitted + * @param transmittedPercentError Percentage of error packets received + * @param transmittedUtilization Percentage of utilization transmitted * @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 @@ -2627,9 +4434,18 @@ void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement, * @param tx_ucast_packets_acc Transmitted Unicast packets * @param tx_ucast_packets_delta Transmitted delta Unicast packets *****************************************************************************/ -void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement, - char * const vnic_id, +void evel_measurement_nic_performance_add(EVENT_MEASUREMENT * const measurement, + char * const nic_id, char * valset, + EVEL_OPER_STATE admin_state, + EVEL_OPER_STATE op_state, + double receivedPercentDiscard, + double receivedPercentError, + double receivedUtilization, + double speed, + double transmittedPercentDiscard, + double transmittedPercentError, + double transmittedUtilization, double recvd_bcast_packets_acc, double recvd_bcast_packets_delta, double recvd_discarded_packets_acc, @@ -2659,88 +4475,624 @@ void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement double tx_ucast_packets_acc, double tx_ucast_packets_delta); -/*****************************************************************************/ -/*****************************************************************************/ -/* */ -/* REPORT */ -/* */ -/*****************************************************************************/ -/*****************************************************************************/ +MEASUREMENT_IPMI * evel_measurement_new_ipmi_add( + EVENT_MEASUREMENT * measurement); /**************************************************************************//** - * Create a new Report event. + * Set the System fan exit air flow temperature in Celsius of IPMI * - * @note The mandatory fields on the Report 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 Report has immutable properties. + * @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_interval - * @param event_name Unique Event Name - * @param event_id A universal identifier of the event for analysis etc + * @param ipmi Pointer to the IPMI + * @param double + *****************************************************************************/ +void evel_measurement_ipmi_exitAirTemperature_set(MEASUREMENT_IPMI *ipmi, + const double val); + +/**************************************************************************//** + * Set the Front panel temp in Celsius of IPMI * - * @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. + * @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 ipmi Pointer to the IPMI + * @param double *****************************************************************************/ -EVENT_REPORT * evel_new_report(double measurement_interval,const char* ev_name, const char *ev_id); +void evel_measurement_ipmi_frontPanelTemperature_set(MEASUREMENT_IPMI *ipmi, + const double val); /**************************************************************************//** - * Free a Report. + * Set the Io module temp in Celsius of IPMI * - * Free off the Report supplied. Will free all the contained allocated memory. + * @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. * - * @note It does not free the Report itself, since that may be part of a - * larger structure. + * @param ipmi Pointer to the IPMI + * @param double *****************************************************************************/ -void evel_free_report(EVENT_REPORT * event); +void evel_measurement_ipmi_ioModuleTemperature_set(MEASUREMENT_IPMI *ipmi, + const double val); /**************************************************************************//** - * Set the Event Type property of the Report. + * Set the Airflow in cubic feet per minute (cfm) of IPMI * * @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 report Pointer to the Report. - * @param type The Event Type to be set. ASCIIZ string. The caller - * does not need to preserve the value once the function - * returns. + * @param ipmi Pointer to the IPMI Use. + * @param double *****************************************************************************/ -void evel_report_type_set(EVENT_REPORT * report, const char * const type); +void evel_measurement_ipmi_systemAirflow_set(MEASUREMENT_IPMI *ipmi, + const double val); /**************************************************************************//** - * Add a Feature usage value name/value pair to the Report. + * Add a new Baseboard Temperature Array element to IPMI * - * 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. + * @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 report Pointer to the report. - * @param feature ASCIIZ string with the feature's name. - * @param utilization Utilization of the feature. + * @param ipmi Pointer to the IPMI + * @param id Indentifier *****************************************************************************/ -void evel_report_feature_use_add(EVENT_REPORT * report, - char * feature, - int utilization); +MEASUREMENT_IPMI_BB_TEMPERATURE *evel_measurement_new_base_board_temp_add( + MEASUREMENT_IPMI * ipmi, + char * id); /**************************************************************************//** - * Add a Additional Measurement value name/value pair to the Report. + * Set the Baseboard temperature in celsius * - * 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. + * @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 report Pointer to the report. - * @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. + * @param ipmi Pointer to the IPMI + * @param bb_temp Pointer to base board tempeature + * @param id Indentifier + *****************************************************************************/ +void evel_measurement_ipmi_bb_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BB_TEMPERATURE * bb_temp, + const double val); + +/**************************************************************************//** + * Add a new Baseboard Voltage Regulator Array element to IPMI + * + * @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 ipmi Pointer to the IPMI + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_BB_VOLTAGE *evel_measurement_new_base_board_volt_add( + MEASUREMENT_IPMI * ipmi, + const char const * id); + +/**************************************************************************//** + * Set the Voltage regulator temperature in celsius + * + * @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 ipmi Pointer to the IPMI + * @param bb_volt Pointer to base board Voltage regulator + * @param val value + *****************************************************************************/ +void evel_measurement_ipmi_bb_volt_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BB_VOLTAGE * bb_volt, + const double val); + +/**************************************************************************//** + * Add a new IPMI Battery Array element to IPMI + * + * @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 ipmi Pointer to the IPMI + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_BATTERY *evel_measurement_new_ipmi_battery_add( + MEASUREMENT_IPMI * ipmi, + char * id); + +/**************************************************************************//** + * Set the battery type in IPMI Battery + * + * @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 ipmi Pointer to the IPMI + * @param ipmiBattery Pointer to IPMI Battery + * @param batteryType Batterry Type + *****************************************************************************/ +void evel_measurement_ipmi_battery_type_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BATTERY * ipmiBattery, + const char * const batteryType); + +/**************************************************************************//** + * Set the Battery voltage level in IPMI Battery + * + * @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 ipmi Pointer to the IPMI + * @param ipmiBattery Pointer to IPMI Battery + * @param val Battery voltage level + *****************************************************************************/ +void evel_measurement_ipmi_battery_voltage_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BATTERY * ipmiBattery, + const double val); + +/**************************************************************************//** + * Add a new IPMI Fan Array element to IPMI + * + * @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 ipmi Pointer to the IPMI + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_FAN *evel_measurement_new_ipmi_fan_add( + MEASUREMENT_IPMI * ipmi, + char * id); + +/**************************************************************************//** + * Set the Fan Identifier in IPMI FAN + * + * @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 ipmi Pointer to the IPMI + * @param ipmiFan Pointer to IPMI FAN + * @param val Fan Identifier + *****************************************************************************/ +void evel_measurement_ipmi_fan_speed_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_FAN * ipmiFan, + const double val); + +/**************************************************************************//** + * Add a new IPMI HSBP Array element to IPMI + * + * @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 ipmi Pointer to the IPMI + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_HSBP *evel_measurement_new_ipmi_hsbp_add( + MEASUREMENT_IPMI * ipmi, + char * id); + +/**************************************************************************//** + * Set the Hot swap backplane power temperature in celsius in IPMI HSBP + * + * @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 ipmi Pointer to the IPMI + * @param ipmiHsbp Pointer to ipmi Hsbp + * @param val value + *****************************************************************************/ +void evel_measurement_ipmi_hsbp_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_HSBP * ipmiHsbp, + const double val); + +/**************************************************************************//** + * Add a new IPMI Global Aggregate Temperature Margin Array element to IPMI + * + * @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 ipmi Pointer to the IPMI. + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN *evel_measurement_new_ipmi_global_temp_add( + MEASUREMENT_IPMI * ipmi, + const char * const id); + +/**************************************************************************//** + * Set the IPMI Global Aggregate Temperature Margin + * + * @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 ipmi Pointer to the IPMI. + * @param ipmig_temp Pointer to IPMI Global Aggregate Temperature Margin + * @param val value *****************************************************************************/ -void evel_report_custom_measurement_add(EVENT_REPORT * report, - const char * const group, - const char * const name, - const char * const value); +void evel_measurement_ipmi_global_temp_margin_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN * ipmig_temp, + const double val); + +/**************************************************************************//** + * Add a new IPMI NIC Array element to IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_NIC *evel_measurement_new_ipmi_nic_add( + MEASUREMENT_IPMI * ipmi, + char * id); + +/**************************************************************************//** + * Set the NIC temperature in IPMI NIC + * + * @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 ipmi Pointer to the IPMI Use. + * @param ipminic Pointer to IPMI NIC + * @param val value + *****************************************************************************/ +void evel_measurement_ipmi_nic_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_NIC * ipminic, + const double val); + +/**************************************************************************//** + * Add a new IPMI Power Supply Array element to IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_POWER_SUPPLY *evel_measurement_new_ipmi_power_add( + MEASUREMENT_IPMI * ipmi, + char * id); + +/**************************************************************************//** + * Set the Power Supply input power in watts + * + * @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 ipmi Pointer to the IPMI Use. + * @param ipmipwr Pointer to IPMI Power Supply + * @param val Value + *****************************************************************************/ +void evel_measurement_ipmi_power_inputpwr_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_POWER_SUPPLY * ipmipwr, + const double val); + +/**************************************************************************//** + * Set the Current output voltage as a percentage of the design specified level + * + * @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 ipmi Pointer to the IPMI Use. + * @param ipmipwr Pointer to IPMI Power Supply + * @param val Value + *****************************************************************************/ +void evel_measurement_ipmi_power_current_op_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_POWER_SUPPLY * ipmipwr, + const double val); + +/**************************************************************************//** + * Set the Power supply temperature in Celsius + * + * @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 ipmi Pointer to the IPMI Use. + * @param ipmipwr Pointer to IPMI Power Supply + * @param val Value + *****************************************************************************/ +void evel_measurement_ipmi_power_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_POWER_SUPPLY * ipmipwr, + const double val); + +/**************************************************************************//** + * Add a new IPMI Processor Array element to IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_PROCESSOR *evel_measurement_new_ipmi_processor_add( + MEASUREMENT_IPMI * ipmi, + char * id); + +/**************************************************************************//** + * Set the processor thermal control percent + * + * @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 ipmi Pointer to the IPMI Use. + * @param ipmi_processor Pointer to IPMI processor + * @param val Value + *****************************************************************************/ +void evel_measurement_ipmi_processor_theralCtrl_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_PROCESSOR * ipmi_processor, + const double val); + +/**************************************************************************//** + * Set the processor DTS thermal margin(Front panel temperature in celsius) + * + * @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 ipmi Pointer to the IPMI Use. + * @param ipmi_processor Pointer to IPMI processor + * @param val Value + *****************************************************************************/ +void evel_measurement_ipmi_processor_theralMargin_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_PROCESSOR * ipmi_processor, + const double val); + +/**************************************************************************//** + * Add a new Array element to Processor + * + * @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 ipmi Pointer to the IPMI Use. + * @param ipmi_processor Pointer to IPMI Processor + * @param therm_margin Thermal margin + *****************************************************************************/ +MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM * evel_measurement_ipmi_processor_new_dimmAggThermalMargin_add( + MEASUREMENT_IPMI * ipmi, + MEASUREMENT_IPMI_PROCESSOR *ipmi_processor, + const char * const id, double therm_margin); + +/**************************************************************************//** + * Add a new Array element to loads + * + * @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 measurement. + *****************************************************************************/ +MEASUREMENT_LOAD * evel_measurement_new_loads_add( + EVENT_MEASUREMENT * measurement); + +/**************************************************************************//** + * Set the short term value in load + * + * @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 load Pointer to load. + * @param val value + *****************************************************************************/ +void evel_measurement_load_shortTerm_set(MEASUREMENT_LOAD *load, + const double val); + +/**************************************************************************//** + * Set the MID term value in load + * + * @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 load Pointer to load. + * @param val value + *****************************************************************************/ +void evel_measurement_load_midTerm_set(MEASUREMENT_LOAD *load, + const double val); + +/**************************************************************************//** + * Set the Long term value in load + * + * @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 load Pointer to load. + * @param val value + *****************************************************************************/ +void evel_measurement_load_longTerm_set(MEASUREMENT_LOAD *load, + const double val); + +/**************************************************************************//** + * Add a new Array element to Process Stats of 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 measurement. + * @param processIdentifier process Identifier + *****************************************************************************/ +MEASUREMENT_PROCESS_STATS * evel_measurement_new_process_stats_add( + EVENT_MEASUREMENT * measurement, + const char * const processIdentifier ); + +/**************************************************************************//** + * Set the fork rate (The number of threads created since the last reboot) in + * Process Stats + * + * @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 process_stat Pointer to process stat. + * @param val value + *****************************************************************************/ +void evel_measurement_process_stat_forkRate_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val); + +/**************************************************************************//** + * Set the The number of processes in a blocked state in Process Stats + * + * @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 process_stat Pointer to process stat. + * @param val value + *****************************************************************************/ +void evel_measurement_process_stat_psStateBlocked_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val); + +/**************************************************************************//** + * Set the The number of processes in a paging state in Process Stats + * + * @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 process_stat Pointer to process stat. + * @param val value + *****************************************************************************/ +void evel_measurement_process_stat_psStatePaging_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val); + +/**************************************************************************//** + * Set the The number of processes in a running state in Process Stats + * + * @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 process_stat Pointer to process stat. + * @param val value + *****************************************************************************/ +void evel_measurement_process_stat_psStateRunning_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val); + +/**************************************************************************//** + * Set the The number of processes in a sleeping state in Process Stats + * + * @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 process_stat Pointer to process stat. + * @param val value + *****************************************************************************/ +void evel_measurement_process_stat_psStateSleeping_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val); + +/**************************************************************************//** + * Set the The number of processes in a stopped state in Process Stats + * + * @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 process_stat Pointer to process stat. + * @param val value + *****************************************************************************/ +void evel_measurement_process_stat_psStateStopped_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val); + +/**************************************************************************//** + * Set the The number of processes in a zombie state in Process Stats + * + * @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 process_stat Pointer to process stat. + * @param val value + *****************************************************************************/ +void evel_measurement_process_stat_psStateZombie_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val); + +/**************************************************************************//** + * Add a new Machine check exception array element to 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 measurement. + * @param process_id process Identifier + *****************************************************************************/ +MACHINE_CHECK_EXCEPTION * evel_measurement_new_machine_check_exception_add( + EVENT_MEASUREMENT * measurement, + const char * const process_id ); + +/**************************************************************************//** + * Set the Total hardware errors that were corrected by the hardware + * in Machine check exception + * + * @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 machine_check Pointer to Machine check exception. + * @param val value + *****************************************************************************/ +void evel_measurement_machine_check_cor_mem_err_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val); + +/**************************************************************************//** + * Set the Total hardware errors that were corrected over last one hour + * in Machine check exception + * + * @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 machine_check Pointer to Machine check exception. + * @param val value + *****************************************************************************/ +void evel_measurement_machine_check_cor_mem_err_1hr_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val); + +/**************************************************************************//** + * Set the Total hardware errors that were uncorrected by the hardware + * in Machine check exception + * + * @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 machine_check Pointer to Machine check exception. + * @param val value + *****************************************************************************/ +void evel_measurement_machine_check_uncor_mem_err_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val); + +/**************************************************************************//** + * Set the Total hardware errors that were uncorrected over last one hour + * in Machine check exception + * + * @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 machine_check Pointer to Machine check exception. + * @param val value + *****************************************************************************/ +void evel_measurement_machine_check_uncor_mem_err_1hr_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val); /*****************************************************************************/ /*****************************************************************************/ @@ -2784,7 +5136,22 @@ EVENT_MOBILE_FLOW * evel_new_mobile_flow( int other_endpoint_port, const char * const reporting_endpoint_ip_addr, int reporting_endpoint_port); - +/**************************************************************************//** + * 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 fault Pointer to the Mobile flow. + * @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_mobile_flow_addl_field_add(EVENT_MOBILE_FLOW * const event, char * name, char * value); /**************************************************************************//** * Free a Mobile Flow. * @@ -3337,16 +5704,6 @@ void evel_mobile_gtp_metrics_tun_status_set( MOBILE_GTP_PER_FLOW_METRICS * metrics, const char * const status); -/**************************************************************************//** - * 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. - *****************************************************************************/ -void evel_mobile_gtp_metrics_iptos_set(MOBILE_GTP_PER_FLOW_METRICS * metrics, - int index, - int count); /**************************************************************************//** * Set the Large Packet Round-Trip Time property of the Mobile GTP Per Flow @@ -3406,6 +5763,66 @@ void evel_mobile_gtp_metrics_max_trx_bit_rate_set( int rate); /**************************************************************************//** + * Add an IP Tos count list 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 fault Pointer to the Mobile GTP Per Flow Metrics. + * @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_mobile_gtp_metrics_ip_tos_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const char * const name, + const char * const value); + +/**************************************************************************//** + * Add an QCI Cos count list 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 fault Pointer to the Mobile GTP Per Flow Metrics. + * @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_mobile_gtp_metrics_qci_cos_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const EVEL_QCI_COS_TYPES qci_cos, + const char * const value); + +/**************************************************************************//** + * Add an TCP Flag count list 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 fault Pointer to the Mobile GTP Per Flow Metrics. + * @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_mobile_gtp_metrics_tcp_flag_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const EVEL_TCP_FLAGS tcp_flag, + const char * const value); + +/**************************************************************************//** * Set the Number of GTP Echo Failures property of the Mobile GTP Per Flow * Metrics. * @@ -3450,36 +5867,52 @@ void evel_mobile_gtp_metrics_num_http_errors_set( int num); /**************************************************************************//** - * Add a TCP flag count to the metrics. + * Add a IP Tos count list 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 count to be updated. - * @param count The associated flag count. + * @param name Key of the hashmap + * @param value Value of the hashmap. *****************************************************************************/ -void evel_mobile_gtp_metrics_tcp_flag_count_add( - MOBILE_GTP_PER_FLOW_METRICS * metrics, - const EVEL_TCP_FLAGS tcp_flag, - const int count); +void evel_mobile_ip_tos_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const char * const name, + const char * const value); /**************************************************************************//** - * Add a QCI COS count to the metrics. + * Add TCP Flag count list 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. + * @param name Key of the hashmap + * @param value Value of the hashmap. *****************************************************************************/ -void evel_mobile_gtp_metrics_qci_cos_count_add( - MOBILE_GTP_PER_FLOW_METRICS * metrics, - const EVEL_QCI_COS_TYPES qci_cos, - const int count); +void evel_mobile_tcp_flag_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const char * const name, + const char * const value); + +/**************************************************************************//** + * Add a QCI cos count list 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 name Key of the hashmap + * @param value Value of the hashmap. + *****************************************************************************/ +void evel_mobile_qci_cos_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const char * const name, + const char * const value); /*****************************************************************************/ /*****************************************************************************/ @@ -3769,6 +6202,171 @@ void evel_state_change_type_set(EVENT_STATE_CHANGE * const state_change, void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change, const char * const name, const char * const value); +/*****************************************************************************/ +/*****************************************************************************/ +/* */ +/* Notification */ +/* */ +/*****************************************************************************/ +/*****************************************************************************/ + +/**************************************************************************//** + * Create a new Notification event. + * + * @note The mandatory fields on the Syslog 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 + * 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. + * + * @returns pointer to the newly manufactured ::EVENT_NOTIFICATION. If the + * event is not used it must be released using + * ::evel_free_notification + * @retval NULL Failed to create the event. + *****************************************************************************/ +EVENT_NOTIFICATION * evel_new_notification( + const char* ev_name, const char *ev_id, + const char * const changeIdentifier, + const char * const changeType); +/**************************************************************************//** + * Free a Notification. + * + * + * Free off the Notification supplied. Will free all the contained allocated + * memory. + * + * @note It does not free the Notification itself, since that may be part of a + * larger structure. + *****************************************************************************/ +void evel_free_notification(EVENT_NOTIFICATION * const notification); + +/**************************************************************************//** + * Set the Event Type property of the Notification. + * + * @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 notification Pointer to the ::EVENT_NOTIFICATION. + * @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_notification_type_set(EVENT_NOTIFICATION * const notification, + const char * const type); + +/**************************************************************************//** + * Add an additional field name/value pair to the Notification. + * + * 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 notification Pointer to the ::EVENT_NOTIFICATION. + * @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_notification_addl_field_add(EVENT_NOTIFICATION * const notification, + const char * const name, + const char * const value); + +/**************************************************************************//** + * Convert a ::EVEL_OPTION_STATE to it's string form for JSON encoding. + * + * @param state The entity state to encode. + * + * @returns the corresponding string + *****************************************************************************/ +char * evel_entity_opt_state (EVEL_OPTION_STATE * const state); + +/**************************************************************************//** + * Initialize an ::EVEL_OPTION_STATE to a not-set state. + * + * @param option Pointer to the ::EVEL_OPTION_INT. + *****************************************************************************/ +void evel_init_option_state(EVEL_OPTION_STATE * const option); + +/**************************************************************************//** + * Set the value of an ::EVEL_OPTION_STATE. + * + * @param option Pointer to the ::EVEL_OPTION_STATE. + * @param value The value to set. + * @param description Description to be used in logging. + *****************************************************************************/ +void evel_set_option_state(EVEL_OPTION_STATE * const option, + const int value, + const char * const description); + +/**************************************************************************//** + * Set the Identifier for a contact related to the change of notification event + * + * @param notification Pointer to the ::EVENT_NOTIFICATION. + * @param changeContact ASCIIZ string with the attribute's value + *****************************************************************************/ +void evel_notification_changeContact_set( + EVENT_NOTIFICATION * const notification, + const char * const changeContact); + +/**************************************************************************//** + * Set the Card or port name of the entity that changed state of notification + * + * @param notification Pointer to the ::EVENT_NOTIFICATION. + * @param state_interface ASCIIZ string with the attribute's value + *****************************************************************************/ +void evel_notification_state_interface_set( + EVENT_NOTIFICATION * const notification, + const char * const state_interface); + +/**************************************************************************//** + * Set the New state of the entity of notification event + * + * @param notification Pointer to the ::EVENT_NOTIFICATION. + * @param state Enter value of EVEL_ENTITY_STATE + *****************************************************************************/ +void evel_notification_new_state_set( + EVENT_NOTIFICATION * const notification, + const EVEL_ENTITY_STATE state); + +/**************************************************************************//** + * Set the Old state of entity of notification event + * + * @param notification Pointer to the ::EVENT_NOTIFICATION. + * @param state Enter value of EVEL_ENTITY_STATE + *****************************************************************************/ +void evel_notification_old_state_set( + EVENT_NOTIFICATION * const notification, + const EVEL_ENTITY_STATE state); + +/**************************************************************************//** + * Add a new named hashmap to notification event + * + * @param notification Pointer to the ::EVENT_NOTIFICATION. + * @param name Name of the hashmap + *****************************************************************************/ +HASHTABLE_T * evel_notification_add_new_named_hashmap( + EVENT_NOTIFICATION * const notification, + const char * const name); + +/**************************************************************************//** + * Set the name and value for the named hashmap of notification event + * + * @param ht Pointer to named hashmap + * @param name Key name + * @param value value corresponding to key + *****************************************************************************/ +void evel_notification_named_hashmap_set( + HASHTABLE_T * const ht, + const char * const name, + const char * const value); /*****************************************************************************/ /*****************************************************************************/ @@ -3818,6 +6416,25 @@ void evel_syslog_type_set(EVENT_SYSLOG * syslog, const char * const type); /**************************************************************************//** + * 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 syslog Pointer to the syslog. + * @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_syslog_addl_fields_set(EVENT_SYSLOG * syslog, + const char * const name, + const char * const value); + +/**************************************************************************//** * Free a Syslog. * * Free off the Syslog supplied. Will free all the contained allocated memory. @@ -3843,8 +6460,8 @@ void evel_free_syslog(EVENT_SYSLOG * event); * returns. *****************************************************************************/ void evel_syslog_addl_field_add(EVENT_SYSLOG * syslog, - char * name, - char * value); + const char * name, + const char * value); /**************************************************************************//** * Set the Event Source Host property of the Syslog. @@ -3875,6 +6492,20 @@ void evel_syslog_event_source_host_set(EVENT_SYSLOG * syslog, *****************************************************************************/ void evel_syslog_facility_set(EVENT_SYSLOG * syslog, EVEL_SYSLOG_FACILITIES facility); +/**************************************************************************//** + * Set the priority 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 priority The Syslog priority to be set. ASCIIZ string. The caller + * does not need to preserve the value once the function + * returns. + *****************************************************************************/ +void evel_syslog_priority_set(EVENT_SYSLOG * syslog, + const int priority); /**************************************************************************//** * Set the Process property of the Syslog. @@ -3890,6 +6521,32 @@ void evel_syslog_facility_set(EVENT_SYSLOG * syslog, void evel_syslog_proc_set(EVENT_SYSLOG * syslog, const char * const proc); /**************************************************************************//** + * Set the timestamp parsed from non-VES syslog message + * + * @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 time_stamp The timestamp to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. + *****************************************************************************/ +void evel_syslog_timeStamp_set(EVENT_SYSLOG * syslog, const char * const time_stamp); + +/**************************************************************************//** + * Set the hostname parsed from non-VES syslog message + * + * @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 msg_host The hostname to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. + *****************************************************************************/ +void evel_syslog_MsgHost_set(EVENT_SYSLOG * syslog, const char * const msg_host); + +/**************************************************************************//** * Set the Process ID property of the Syslog. * * @note The property is treated as immutable: it is only valid to call @@ -4012,9 +6669,32 @@ void evel_other_type_set(EVENT_OTHER * other, * @param name ASCIIZ string with the attribute's name. * @param value ASCIIZ string with the attribute's value. *****************************************************************************/ -void evel_other_field_add(EVENT_OTHER * other, - char * name, - char * value); +void evel_other_field_add_hashmap(EVENT_OTHER * other, char * name, char *value); + +/**************************************************************************//** + * Add a new named hashmap to other event + * + * @param notification Pointer to other + * @param name Name of the hashmap + *****************************************************************************/ +HASHTABLE_T * evel_other_add_new_hashmap_to_hmarray(EVENT_OTHER * const other, + const char * const name); + +/**************************************************************************//** + * Add a value name/value pair to named hashmap of 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 other Pointer to the Other. + * @param name ASCIIZ string with the attribute's name. + * @param value ASCIIZ string with the attribute's value. + *****************************************************************************/ +void evel_other_set_hashmap_in_hmarray( + HASHTABLE_T * const ht, + const char * const name, + const char * const value); /*****************************************************************************/ /*****************************************************************************/ @@ -4036,8 +6716,8 @@ int evel_get_measurement_interval(); /*****************************************************************************/ /* Supported Report version. */ /*****************************************************************************/ -#define EVEL_VOICEQ_MAJOR_VERSION 1 -#define EVEL_VOICEQ_MINOR_VERSION 1 +#define EVEL_VOICEQ_MAJOR_VERSION 4 +#define EVEL_VOICEQ_MINOR_VERSION 0 /**************************************************************************//** * End of Call Voice Quality Metrices @@ -4053,14 +6733,14 @@ typedef struct end_of_call_vqm_summaries { /***************************************************************************/ /* Optional fields */ /***************************************************************************/ - EVEL_OPTION_INT endpointJitter; + EVEL_OPTION_INT localRtpOctetsLost; EVEL_OPTION_INT endpointRtpOctetsDiscarded; EVEL_OPTION_INT endpointRtpOctetsReceived; EVEL_OPTION_INT endpointRtpOctetsSent; EVEL_OPTION_INT endpointRtpPacketsDiscarded; EVEL_OPTION_INT endpointRtpPacketsReceived; EVEL_OPTION_INT endpointRtpPacketsSent; - EVEL_OPTION_INT localJitter; + EVEL_OPTION_INT localMaxJitterBufferDelay; EVEL_OPTION_INT localRtpOctetsDiscarded; EVEL_OPTION_INT localRtpOctetsReceived; EVEL_OPTION_INT localRtpOctetsSent; @@ -4068,10 +6748,18 @@ typedef struct end_of_call_vqm_summaries { EVEL_OPTION_INT localRtpPacketsReceived; EVEL_OPTION_INT localRtpPacketsSent; EVEL_OPTION_INT mosCqe; - EVEL_OPTION_INT packetsLost; + EVEL_OPTION_INT localRtpPacketsLost; EVEL_OPTION_INT packetLossPercent; EVEL_OPTION_INT rFactor; EVEL_OPTION_INT roundTripDelay; + EVEL_OPTION_INT endpointAverageJitter; + EVEL_OPTION_INT endpointMaxJitter; + EVEL_OPTION_INT endpointRtpOctetsLost; + EVEL_OPTION_INT endpointRtpPacketsLost; + EVEL_OPTION_INT localAverageJitter; + EVEL_OPTION_INT localAverageJitterBufferDelay; + EVEL_OPTION_INT localMaxJitter; + EVEL_OPTION_INT oneWayDelay; } END_OF_CALL_VOICE_QUALITY_METRICS; @@ -4103,17 +6791,9 @@ typedef struct event_voiceQuality { /* Optional fields */ /***************************************************************************/ EVEL_OPTION_STRING phoneNumber; - DLIST additionalInformation; + HASHTABLE_T * additionalInformation; } EVENT_VOICE_QUALITY; -/**************************************************************************//** - * Voice Quality Additional Info. - * JSON equivalent field: additionalInformation - *****************************************************************************/ -typedef struct voice_quality_additional_info { - char * name; - char * value; -} VOICE_QUALITY_ADDL_INFO; /**************************************************************************//** * Create a new voice quality event. @@ -4211,14 +6891,45 @@ void evel_voice_quality_rtcp_data_set(EVENT_VOICE_QUALITY * voiceQuality, * the setter once. However, we don't assert if the caller tries to * overwrite, just ignoring the update instead. * - * @param voiceQuality Pointer to the Voice Quality Event. - * @param nameFields The Vendor, VNF and VfModule names to be set. - * ASCIIZ string. The caller does not need to - * preserve the value once the function - * returns. + * @param voiceQuality Pointer to the Voice Quality Event. + * @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. *****************************************************************************/ -void evel_voice_quality_name_fields_set(EVENT_VOICE_QUALITY * voiceQuality, - const char * const nameFields); +void evel_voice_quality_vnfmodule_name_set(EVENT_VOICE_QUALITY * voiceQuality, + const char * const module_name); +/**************************************************************************//** + * 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 voiceQuality Pointer to the Voice Quality Event. + * @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. + *****************************************************************************/ +void evel_voice_quality_vnfname_set(EVENT_VOICE_QUALITY * voiceQuality, + const char * const vnfname); + +/**************************************************************************//** + * 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 voiceQuality Pointer to the Voice Quality Event. + * @param calleeCodecForCall The Phone Number to be set. ASCIIZ + * string. The caller does not need to + * preserve the value once the function + * returns. + *****************************************************************************/ +void evel_voice_quality_phone_number_set(EVENT_VOICE_QUALITY * voiceQuality, + const char * const phoneNumber); /**************************************************************************//** * Add an End of Call Voice Quality Metrices @@ -4228,39 +6939,39 @@ void evel_voice_quality_name_fields_set(EVENT_VOICE_QUALITY * voiceQuality, * 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 + * @param adjacencyName Adjacency name + * @param endpointDescription Enumeration: ‘Caller’, ‘Callee’. + * @param localRtpOctetsLost localRtpOctetsLost + * @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 localMaxJitterBufferDelay Local max jitter buffer Delay. + * @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 localRtpPacketsLost Local RTP Packets lost + * @param packetLossPercent Calculated percentage packet loss + * @param rFactor rFactor from 0 to 100 + * @param roundTripDelay Round trip delay in milliseconds *****************************************************************************/ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, const char * adjacencyName, EVEL_SERVICE_ENDPOINT_DESC endpointDescription, - int endpointJitter, + int localRtpOctetsLost, int endpointRtpOctetsDiscarded, int endpointRtpOctetsReceived, int endpointRtpOctetsSent, int endpointRtpPacketsDiscarded, int endpointRtpPacketsReceived, int endpointRtpPacketsSent, - int localJitter, + int localMaxJitterBufferDelay, int localRtpOctetsDiscarded, int localRtpOctetsReceived, int localRtpOctetsSent, @@ -4268,10 +6979,18 @@ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, int localRtpPacketsReceived, int localRtpPacketsSent, int mosCqe, - int packetsLost, + int localRtpPacketsLost, int packetLossPercent, int rFactor, - int roundTripDelay); + int roundTripDelay, + int endpointAverageJitter, + int endpointMaxJitter, + int endpointRtpOctetsLost, + int endpointRtpPacketsLost, + int localAverageJitter, + int localAverageJitterBufferDelay, + int localMaxJitter, + int oneWayDelay); /**************************************************************************//** * Free a Voice Quality. @@ -4311,9 +7030,9 @@ void evel_voice_quality_addl_info_add(EVENT_VOICE_QUALITY * voiceQuality, char * /*****************************************************************************/ typedef enum evel_event_action { - EVEL_EVENT_ACTION_CLEAR, - EVEL_EVENT_ACTION_CONTINUE, EVEL_EVENT_ACTION_SET, + EVEL_EVENT_ACTION_CONTINUE, + EVEL_EVENT_ACTION_CLEAR, EVEL_MAX_EVENT_ACTION }EVEL_EVENT_ACTION; @@ -4328,16 +7047,15 @@ typedef enum evel_alert_type { typedef struct perf_counter { char * criticality; - char * name; char * thresholdCrossed; - char * value; + HASHTABLE_T *hashmap; }PERF_COUNTER; /*****************************************************************************/ /* Supported Threshold Crossing version. */ /*****************************************************************************/ -#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 2 +#define EVEL_THRESHOLD_CROSS_MAJOR_VERSION 4 #define EVEL_THRESHOLD_CROSS_MINOR_VERSION 0 /**************************************************************************//** @@ -4355,18 +7073,18 @@ typedef struct event_threshold_cross { /***************************************************************************/ /* Mandatory fields */ /***************************************************************************/ - PERF_COUNTER additionalParameters; + DLIST additionalParameters; EVEL_EVENT_ACTION alertAction; char * alertDescription; EVEL_ALERT_TYPE alertType; - unsigned long long collectionTimestamp; + char * collectionTimestamp; EVEL_SEVERITIES eventSeverity; - unsigned long long eventStartTimestamp; + char * eventStartTimestamp; /***************************************************************************/ /* Optional fields */ /***************************************************************************/ - DLIST additional_info; + HASHTABLE_T *additional_info; EVEL_OPTION_STRING alertValue; DLIST alertidList; EVEL_OPTION_STRING dataCollector; @@ -4388,16 +7106,12 @@ typedef struct event_threshold_cross { * * @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 char * tcollectionTimestamp time at which alert was collected * @param EVEL_SEVERITIES teventSeverity Severity of Alert - * @param unsigned long long teventStartTimestamp Time when this alert started + * @param char * 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 @@ -4406,16 +7120,36 @@ typedef struct event_threshold_cross { *****************************************************************************/ 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, + EVEL_ALERT_ACTIONS talertAction, char * talertDescription, EVEL_ALERT_TYPE talertType, - unsigned long long tcollectionTimestamp, + char * tcollectionTimestamp, EVEL_SEVERITIES teventSeverity, - unsigned long long teventStartTimestamp); + char * teventStartTimestamp); + +/**************************************************************************//** + * Add the TCA additional performance counter + * + * @param tcp Pointer to the ::EVENT_THRESHOLD_CROSS. + * @param char* tcriticality Performance Counter criticality + * @param char* tthresholdCrossed Performance Counter Threshold name + *****************************************************************************/ +PERF_COUNTER * evel_threshold_cross_add_addl_parameters( + EVENT_THRESHOLD_CROSS * const event, + char * tcriticality, + char * tthresholdCrossed); + +/**************************************************************************//** + * Set the TCA name / Value for additional performance counter + * + * @param PERF_COUNTER perf_ctr Pointer to additional Parameter array element + * @param char* name Performance Counter Threshold name + * @param char* value Performance Counter actual value + *****************************************************************************/ +void evel_threshold_cross_addl_parameters_hashmap_set( + PERF_COUNTER * perf_ctr, + char * name, + char * value); /**************************************************************************//** * Free a Threshold cross event. @@ -4517,6 +7251,7 @@ void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const tcp, /* Debug macros. */ /*****************************************************************************/ #define EVEL_DEBUG(FMT, ...) log_debug(EVEL_LOG_DEBUG, (FMT), ##__VA_ARGS__) +#define EVEL_WARN(FMT, ...) log_debug(EVEL_LOG_WARN, (FMT), ##__VA_ARGS__) #define EVEL_INFO(FMT, ...) log_debug(EVEL_LOG_INFO, (FMT), ##__VA_ARGS__) #define EVEL_SPAMMY(FMT, ...) log_debug(EVEL_LOG_SPAMMY, (FMT), ##__VA_ARGS__) #define EVEL_ERROR(FMT, ...) log_debug(EVEL_LOG_ERROR, "ERROR: " FMT, \ diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event.c index 5babb67..88ef12f 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event.c @@ -43,7 +43,7 @@ static int event_sequence = 1; * * @param sequence The next sequence number to use. *****************************************************************************/ -void evel_set_next_event_sequence(const int sequence) +void evel_set_global_event_sequence(const int sequence) { EVEL_ENTER(); @@ -145,6 +145,9 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname) { char scratchpad[EVEL_MAX_STRING_LEN + 1] = {0}; struct timeval tv; + char eventListenerVersion[10] = {0}; + int offset; + int offset1; EVEL_ENTER(); @@ -168,20 +171,39 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname) header->priority = EVEL_PRIORITY_NORMAL; header->reporting_entity_name = strdup(openstack_vm_name()); header->source_name = strdup(openstack_vm_name()); - header->sequence = event_sequence; + header->sequence = 0; header->start_epoch_microsec = header->last_epoch_microsec; header->major_version = EVEL_HEADER_MAJOR_VERSION; header->minor_version = EVEL_HEADER_MINOR_VERSION; event_sequence++; /***************************************************************************/ + /* Event Listener Version */ + /***************************************************************************/ + offset = sprintf(eventListenerVersion, "%d", EVEL_API_MAJOR_VERSION); + if ((EVEL_API_MINOR_VERSION != 0) && (EVEL_API_PATCH_VERSION == 0)) + { + sprintf(eventListenerVersion + offset, ".%d", EVEL_API_MINOR_VERSION); + } + else if (EVEL_API_PATCH_VERSION != 0) + { + offset1 = sprintf(eventListenerVersion + offset, ".%d", EVEL_API_MINOR_VERSION); + offset = offset + offset1; + sprintf(eventListenerVersion + offset, ".%d", EVEL_API_PATCH_VERSION); + } + + EVEL_INFO("Setting event listener version to %s", eventListenerVersion); + header->event_listener_version = strdup(eventListenerVersion); + /***************************************************************************/ /* Optional parameters. */ /***************************************************************************/ evel_init_option_string(&header->event_type); evel_init_option_string(&header->nfcnaming_code); evel_init_option_string(&header->nfnaming_code); - evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid()); - evel_force_option_string(&header->source_id, openstack_vm_uuid()); + evel_init_option_string(&header->reporting_entity_id); + evel_init_option_string(&header->timezone_offset); + evel_init_option_string(&header->nfVendor_name); + evel_init_option_string(&header->source_id); evel_init_option_intheader(&header->internal_field); dlist_initialize(&header->batch_events); @@ -200,6 +222,9 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname) void evel_init_header_nameid(EVENT_HEADER * const header,const char *const eventname, const char *eventid) { struct timeval tv; + char eventListenerVersion[10] = {0}; + int offset; + int offset1; EVEL_ENTER(); @@ -210,7 +235,7 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event gettimeofday(&tv, NULL); /***************************************************************************/ - /* Initialize the header. Get a new event sequence number. Note that if */ + /* Initialize the header. Reset event sequence number. Note that if */ /* any memory allocation fails in here we will fail gracefully because */ /* everything downstream can cope with NULLs. */ /***************************************************************************/ @@ -221,20 +246,38 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event header->priority = EVEL_PRIORITY_NORMAL; header->reporting_entity_name = strdup(openstack_vm_name()); header->source_name = strdup(openstack_vm_name()); - header->sequence = event_sequence; + header->sequence = 0; header->start_epoch_microsec = header->last_epoch_microsec; header->major_version = EVEL_HEADER_MAJOR_VERSION; header->minor_version = EVEL_HEADER_MINOR_VERSION; - event_sequence++; /***************************************************************************/ + /* Event Listener Version */ + /***************************************************************************/ + offset = sprintf(eventListenerVersion, "%d", EVEL_API_MAJOR_VERSION); + if ((EVEL_API_MINOR_VERSION != 0) && (EVEL_API_PATCH_VERSION == 0)) + { + sprintf(eventListenerVersion + offset, ".%d", EVEL_API_MINOR_VERSION); + } + else if (EVEL_API_PATCH_VERSION != 0) + { + offset1 = sprintf(eventListenerVersion + offset, ".%d", EVEL_API_MINOR_VERSION); + offset = offset + offset1; + sprintf(eventListenerVersion + offset, ".%d", EVEL_API_PATCH_VERSION); + } + + EVEL_INFO("Setting event listener version to %s", eventListenerVersion); + header->event_listener_version = strdup(eventListenerVersion); + /***************************************************************************/ /* Optional parameters. */ /***************************************************************************/ evel_init_option_string(&header->event_type); evel_init_option_string(&header->nfcnaming_code); evel_init_option_string(&header->nfnaming_code); - evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid()); - evel_force_option_string(&header->source_id, openstack_vm_uuid()); + evel_init_option_string(&header->reporting_entity_id); + evel_init_option_string(&header->timezone_offset); + evel_init_option_string(&header->source_id); + evel_init_option_string(&header->nfVendor_name); evel_init_option_intheader(&header->internal_field); dlist_initialize(&header->batch_events); @@ -270,6 +313,29 @@ void evel_header_type_set(EVENT_HEADER * const header, } /**************************************************************************//** + * Set the Event Sequence 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. + *****************************************************************************/ +void evel_event_sequence_set(EVENT_HEADER * const header,const int sequence_number) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions and assign the new value. */ + /***************************************************************************/ + assert(header != NULL); + header->sequence = sequence_number; + + EVEL_EXIT(); +} + + +/**************************************************************************//** * Set the Start Epoch property of the event header. * * @note The Start Epoch defaults to the time of event creation. @@ -389,6 +455,36 @@ void evel_reporting_entity_name_set(EVENT_HEADER * const header, } /**************************************************************************//** + * 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 source_name The entity name to set. + *****************************************************************************/ +void evel_source_name_set(EVENT_HEADER * const header, + const char * const source_name) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions and assign the new value. */ + /***************************************************************************/ + assert(header != NULL); + assert(source_name != NULL); + assert(header->source_name != NULL); + + /***************************************************************************/ + /* Free the previously allocated memory and replace it with a copy of the */ + /* provided one. */ + /***************************************************************************/ + free(header->source_name); + header->source_name = strdup(source_name); + + EVEL_EXIT(); +} + +/**************************************************************************//** * Set the Reporting Entity Id property of the event header. * * @note The Reporting Entity Id defaults to the OpenStack VM UUID. @@ -418,6 +514,57 @@ void evel_reporting_entity_id_set(EVENT_HEADER * const header, } /**************************************************************************//** + * Set the time zone offset + * + * @param timeZoneOffset Time zone offset to use. + *****************************************************************************/ +void evel_time_zone_offset_set(EVENT_HEADER * const header, char * timeZoneOffset) +{ + EVEL_ENTER(); + + assert(header != NULL); + assert(timeZoneOffset != NULL); + EVEL_INFO("Setting time zone offset to %s", timeZoneOffset); + evel_set_option_string(&header->timezone_offset, timeZoneOffset, "Time Zone Offset to GMT"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the NF Vendor Name + * + * @param nfVendorName NF Vendor Name to use + *****************************************************************************/ +void evel_nf_vendor_name_set(EVENT_HEADER * const header, char * nfVendorName) +{ + EVEL_ENTER(); + + assert(header != NULL); + assert(nfVendorName != NULL); + EVEL_INFO("Setting NF Vendor Name to %s", nfVendorName); + evel_set_option_string(&header->nfVendor_name, nfVendorName, "NF Vendor Name"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the source ID + * + * @param sourceId source ID to use + *****************************************************************************/ +void evel_source_id_set(EVENT_HEADER * const header, char * sourceId) +{ + EVEL_ENTER(); + + assert(header != NULL); + assert(sourceId != NULL); + EVEL_INFO("Setting source ID to %s", sourceId); + evel_set_option_string(&header->source_id, sourceId, "source ID"); + + EVEL_EXIT(); +} + +/**************************************************************************//** * Encode the event as a JSON event object according to AT&T's schema. * * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. @@ -449,6 +596,7 @@ void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_string(jbuf, "domain", domain); evel_enc_kv_string(jbuf, "eventId", event->event_id); evel_enc_kv_string(jbuf, "eventName", event->event_name); + evel_enc_kv_string(jbuf, "vesEventListenerVersion", event->event_listener_version); evel_enc_kv_ull(jbuf, "lastEpochMicrosec", event->last_epoch_microsec); evel_enc_kv_string(jbuf, "priority", priority); evel_enc_kv_string( @@ -456,8 +604,10 @@ void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_int(jbuf, "sequence", event->sequence); evel_enc_kv_string(jbuf, "sourceName", event->source_name); evel_enc_kv_ull(jbuf, "startEpochMicrosec", event->start_epoch_microsec); - evel_enc_version( - jbuf, "version", event->major_version, event->minor_version); + char * version = "4.0.2"; + evel_enc_kv_string(jbuf, "version", version); + // evel_enc_version( + // jbuf, "version", event->major_version, event->minor_version); /***************************************************************************/ /* Optional fields. */ @@ -468,6 +618,8 @@ void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_string(jbuf, "sourceId", &event->source_id); evel_enc_kv_opt_string(jbuf, "nfcNamingCode", &event->nfcnaming_code); evel_enc_kv_opt_string(jbuf, "nfNamingCode", &event->nfnaming_code); + evel_enc_kv_opt_string(jbuf, "timeZoneOffset", &event->timezone_offset); + evel_enc_kv_opt_string(jbuf, "nfVendorName", &event->nfVendor_name); evel_json_close_object(jbuf); @@ -499,7 +651,10 @@ void evel_free_header(EVENT_HEADER * const event) free(event->event_id); evel_free_option_string(&event->event_type); free(event->event_name); + free(event->event_listener_version); evel_free_option_string(&event->reporting_entity_id); + evel_free_option_string(&event->timezone_offset); + evel_free_option_string(&event->nfVendor_name); free(event->reporting_entity_name); evel_free_option_string(&event->source_id); evel_free_option_string(&event->nfcnaming_code); @@ -557,6 +712,14 @@ void evel_json_encode_eventtype( evel_json_encode_state_change(jbuf, (EVENT_STATE_CHANGE *)event); break; + case EVEL_DOMAIN_NOTIFICATION: + evel_json_encode_notification(jbuf, (EVENT_NOTIFICATION *)event); + break; + + case EVEL_DOMAIN_PNF_REGISTRATION: + evel_json_encode_pnf_registration(jbuf, (EVENT_PNF_REGISTRATION *)event); + break; + case EVEL_DOMAIN_SYSLOG: evel_json_encode_syslog(jbuf, (EVENT_SYSLOG *)event); break; @@ -833,14 +996,14 @@ void evel_json_encode_vendor_field(EVEL_JSON_BUFFER * jbuf, assert(vfield != NULL); assert(vfield->vendorname != NULL); - evel_json_open_named_object(jbuf, "vendorVnfNameFields"); + evel_json_open_named_object(jbuf, "vendorNfNameFields"); /***************************************************************************/ /* Mandatory fields. */ /***************************************************************************/ evel_enc_kv_string(jbuf, "vendorName", vfield->vendorname); - evel_enc_kv_opt_string(jbuf, "vfModuleName", &vfield->vfmodule); - evel_enc_kv_opt_string(jbuf, "vnfName", &vfield->vnfname); + evel_enc_kv_opt_string(jbuf, "nfModuleName", &vfield->vfmodule); + evel_enc_kv_opt_string(jbuf, "nfName", &vfield->vnfname); /***************************************************************************/ /* Optional fields. */ diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event_mgr.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event_mgr.c index fb94daf..4127f25 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event_mgr.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_event_mgr.c @@ -1,6 +1,6 @@ /*************************************************************************//** * - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. * * Unless otherwise specified, all software contained herein is * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,7 +41,7 @@ * How long we're prepared to wait for the API service to respond in * seconds. *****************************************************************************/ -static const int EVEL_API_TIMEOUT = 5; +static const int EVEL_API_TIMEOUT = 10; /*****************************************************************************/ /* Prototypes of locally scoped functions. */ @@ -58,21 +58,29 @@ static bool evel_tokens_match_command_list(const MEMORY_CHUNK * const chunk, static bool evel_token_equals_string(const MEMORY_CHUNK * const chunk, const jsmntok_t * const json_token, const char * check_string); +static void * event_multi_handler(void * arg __attribute__ ((unused))); +static EVEL_ERR_CODES evel_re_setup_curl(); /**************************************************************************//** * Buffers for error strings from libcurl. *****************************************************************************/ static char curl_err_string[CURL_ERROR_SIZE] = "<NULL>"; +static char curl_err_string2[CURL_ERROR_SIZE] = "<NULL>"; /**************************************************************************//** * Handle for the API into libcurl. *****************************************************************************/ static CURL * curl_handle = NULL; +static CURL * curl_handle2 = NULL; +static CURLM * multi_handle = NULL; +int curr_global_handles = 0; +int activmode = -1; /**************************************************************************//** * Special headers that we send. *****************************************************************************/ static struct curl_slist * hdr_chunk = NULL; +static struct curl_slist * hdr_chunk2 = NULL; /**************************************************************************//** * Message queue for sending events to the API. @@ -104,6 +112,30 @@ static char * evel_event_api_url; static char * evel_throt_api_url; static char * evel_batch_api_url; +static char * evel_bevent_api_url; +static char * evel_bthrot_api_url; +static char * evel_bbatch_api_url; + +/**************************************************************************//** + * Storage for other CURL related parameters + *****************************************************************************/ +int evel_secure = -1; +int evel_verbosity = -1; + +long evel_verify_peer = 0; +long evel_verify_host = 0; + +static char * evel_source_ip = NULL; +static char * evel_source_ip_bakup = NULL; +static char * evel_cert_file_path = NULL; +static char * evel_key_file_path = NULL; +static char * evel_ca_info = NULL; +static char * evel_ca_file_path = NULL; +static char * evel_username = NULL; +static char * evel_password = NULL; +static char * evel_username2 = NULL; +static char * evel_password2 = NULL; + /**************************************************************************//** * Initialize the event handler. * @@ -129,10 +161,13 @@ static char * evel_batch_api_url; * logs. *****************************************************************************/ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, + const char * const bakup_api_url, const char * const throt_api_url, const char * const source_ip, + const char * const source_ip_bakup, int ring_buf_size, int secure, + int activitymode, const char * const cert_file_path, const char * const key_file_path, const char * const ca_info, @@ -141,6 +176,8 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, long verify_host, const char * const username, const char * const password, + const char * const username2, + const char * const password2, int verbosity) { int rc = EVEL_SUCCESS; @@ -157,6 +194,12 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, assert(throt_api_url != NULL); assert(username != NULL); assert(password != NULL); + if( bakup_api_url != NULL ) + { + assert(username2 != NULL); + assert(password2 != NULL); + } + /***************************************************************************/ /* Store the API URLs. */ @@ -168,7 +211,98 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, assert(evel_batch_api_url != NULL); evel_throt_api_url = strdup(throt_api_url); assert(evel_throt_api_url != NULL); + curr_global_handles = 1; + + if( bakup_api_url != NULL ) + { + evel_bevent_api_url = strdup(bakup_api_url); + assert(evel_bevent_api_url != NULL); + sprintf(batch_api_url,"%s/eventBatch",event_api_url); + evel_bbatch_api_url = strdup(batch_api_url); + assert(evel_bbatch_api_url != NULL); + evel_bthrot_api_url = strdup(throt_api_url); + assert(evel_bthrot_api_url != NULL); + curr_global_handles = 2; + } + + /***********************************************************************//** + * Store other parameters + ***************************************************************************/ + evel_secure = secure; + evel_verbosity = verbosity; + + evel_verify_peer = verify_peer; + evel_verify_host = verify_host; + + evel_source_ip = NULL; + if (source_ip != NULL) + { + evel_source_ip = strdup(source_ip); + assert(evel_source_ip != NULL); + } + + evel_source_ip_bakup = NULL; + if (source_ip_bakup != NULL) + { + evel_source_ip_bakup = strdup(source_ip_bakup); + assert(evel_source_ip_bakup != NULL); + } + + evel_cert_file_path = NULL; + if (cert_file_path != NULL) + { + evel_cert_file_path = strdup(cert_file_path); + assert(evel_cert_file_path != NULL); + } + + evel_key_file_path = NULL; + if (key_file_path != NULL) + { + evel_key_file_path = strdup(key_file_path); + assert(evel_key_file_path != NULL); + } + + evel_ca_info = NULL; + if (ca_info != NULL) + { + evel_ca_info = strdup(ca_info); + assert(evel_ca_info != NULL); + } + + evel_ca_file_path = NULL; + if (ca_file_path != NULL) + { + evel_ca_file_path = strdup(ca_file_path); + assert(evel_ca_file_path != NULL); + } + + evel_username = NULL; + if (username != NULL) + { + evel_username = strdup(username); + assert(evel_username != NULL); + } + + evel_password = NULL; + if (password != NULL) + { + evel_password = strdup(password); + assert(evel_password != NULL); + } + evel_username2 = NULL; + if (username2 != NULL) + { + evel_username2 = strdup(username2); + assert(evel_username2 != NULL); + } + + evel_password2 = NULL; + if (password2 != NULL) + { + evel_password2 = strdup(password2); + assert(evel_password2 != NULL); + } curl_version_info_data *d = curl_version_info(CURLVERSION_NOW); /* compare with the 24 bit hex number in 8 bit fields */ @@ -203,6 +337,16 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_handle2 = curl_easy_init(); + if (curl_handle2 == NULL) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to get backup libCURL handle"); + goto exit_label; + } + } /***************************************************************************/ /* Prime the library to give friendly error codes. */ /***************************************************************************/ @@ -217,6 +361,21 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_ERRORBUFFER, + curl_err_string2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL2 to provide friendly errors. " + "Error code=%d", curl_rc); + goto exit_label; + } + } + + /***************************************************************************/ /* If running in verbose mode generate more output. */ /***************************************************************************/ @@ -230,8 +389,22 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d", curl_rc); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_VERBOSE, 1L); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to be verbose. " + "Error code=%d", curl_rc); + goto exit_label; + } + } + } + + /***************************************************************************/ /* Set the URL for the API. */ /***************************************************************************/ @@ -245,6 +418,21 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, } EVEL_INFO("Initializing CURL to send events to: %s", event_api_url); + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_URL, + bakup_api_url); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + + /***************************************************************************/ /* send all data to this function. */ /***************************************************************************/ @@ -258,6 +446,21 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_WRITEFUNCTION, + evel_write_callback); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + + /***************************************************************************/ /* configure local ip address if provided */ @@ -280,6 +483,23 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, } } } + if( source_ip_bakup != NULL ) + { + snprintf(local_address,sizeof(local_address),source_ip_bakup); + if( local_address[0] != '\0' ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_INTERFACE, + local_address); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize bakup libCURL with the local address. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + } /***************************************************************************/ /* configure SSL options for HTTPS transfers */ @@ -298,6 +518,19 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSLCERT, + cert_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the client cert. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } } if( key_file_path != NULL ) @@ -312,6 +545,19 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSLKEY, + key_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the client key. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } } if( ca_info != NULL ) @@ -326,6 +572,19 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_CAINFO, + ca_info); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the CA cert file. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } } if( ca_file_path != NULL ) @@ -340,6 +599,19 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_CAPATH, + ca_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the CA cert path. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } } curl_rc = curl_easy_setopt(curl_handle, @@ -363,6 +635,29 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSL_VERIFYPEER, + verify_peer); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with SSL Server verification. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSL_VERIFYHOST, + verify_host); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with Client host verification. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } } @@ -381,6 +676,20 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_USERAGENT, + "libcurl-agent/1.0"); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + /***************************************************************************/ /* Specify that we are going to POST data. */ @@ -393,6 +702,18 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_POST, 1L); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + /***************************************************************************/ /* we want to use our own read function. */ @@ -405,6 +726,18 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "function. Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_READFUNCTION, read_callback); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + /***************************************************************************/ /* All of our events are JSON encoded. We also suppress the */ @@ -427,6 +760,21 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + hdr_chunk2 = curl_slist_append(hdr_chunk2, "Content-type: application/json"); + hdr_chunk2 = curl_slist_append(hdr_chunk2, "Expect:"); + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_HTTPHEADER, hdr_chunk2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + + /***************************************************************************/ /* Set the timeout for the operation. */ @@ -441,6 +789,18 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, "Error code=%d (%s)", curl_rc, curl_err_string); goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_TIMEOUT, EVEL_API_TIMEOUT); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + /***************************************************************************/ /* Set that we want Basic authentication with username:password Base-64 */ @@ -471,6 +831,45 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, goto exit_label; } + if( bakup_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL for Basic Authentication. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_USERNAME, username2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with username. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_PASSWORD, password2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with password. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + + multi_handle = curl_multi_init();; + if (multi_handle == NULL) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to get libCURL Multi handle"); + goto exit_label; + } + activmode = activitymode; + + } + + /***************************************************************************/ /* Initialize a message ring-buffer to be used between the foreground and */ /* the thread which sends the messages. This can't fail. */ @@ -515,7 +914,11 @@ EVEL_ERR_CODES event_handler_run() /* Start the event handler thread. */ /***************************************************************************/ evt_handler_state = EVT_HANDLER_INACTIVE; - pthread_rc = pthread_create(&evt_handler_thread, NULL, event_handler, NULL); + if( curr_global_handles <= 1 ) + pthread_rc = pthread_create(&evt_handler_thread, NULL, event_handler, NULL); + else + pthread_rc = pthread_create(&evt_handler_thread, NULL, event_multi_handler, NULL); + if (pthread_rc != 0) { rc = EVEL_PTHREAD_LIBRARY_FAIL; @@ -588,16 +991,31 @@ EVEL_ERR_CODES event_handler_terminate() /***************************************************************************/ /* Clean-up the cURL library. */ /***************************************************************************/ + if (multi_handle != NULL) + { + curl_multi_cleanup(multi_handle); + } if (curl_handle != NULL) { curl_easy_cleanup(curl_handle); curl_handle = NULL; } + if (curl_handle2 != NULL) + { + curl_easy_cleanup(curl_handle2); + curl_handle2 = NULL; + } if (hdr_chunk != NULL) { curl_slist_free_all(hdr_chunk); hdr_chunk = NULL; } + if (hdr_chunk2 != NULL) + { + curl_slist_free_all(hdr_chunk2); + hdr_chunk2 = NULL; + } + /***************************************************************************/ /* Free off the stored API URL strings. */ @@ -881,6 +1299,535 @@ size_t evel_write_callback(void *contents, return realsize; } + +/**************************************************************************//** + * Post an event to the Vendor Event Listener API. + * + * @returns Status code + * @retval EVEL_SUCCESS On success + * @retval "One of ::EVEL_ERR_CODES" On failure. + *****************************************************************************/ +static EVEL_ERR_CODES evel_postmulti_message(char *msg, size_t size, int *still, + CURL *handle, CURL *bhandle, int numhandles ) +{ + int rc = EVEL_SUCCESS; + CURLcode curl_rc = CURLE_OK; + MEMORY_CHUNK rx_chunk[2]; + MEMORY_CHUNK tx_chunk[2]; + int i; + + EVEL_ENTER(); + + EVEL_INFO("Sending :%s: %d\n",msg, numhandles); + + /***************************************************************************/ + /* Create the memory chunk to be used for the response to the post. The */ + /* will be realloced. */ + /***************************************************************************/ +for (i=0;i<numhandles;i++) +{ + rx_chunk[i].memory = malloc(1); + assert(rx_chunk[i].memory != NULL); + rx_chunk[i].size = 0; + + /***************************************************************************/ + /* Create the memory chunk to be sent as the body of the post. */ + /***************************************************************************/ + tx_chunk[i].memory = msg; + tx_chunk[i].size = size; + EVEL_DEBUG("Sending chunk of size %d", tx_chunk[i].size); +} + + /***************************************************************************/ + /* Point to the data to be received. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(handle, CURLOPT_WRITEDATA, &rx_chunk[0]); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL rx to upload. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + + /***************************************************************************/ + /* Pointer to pass to our read function */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(handle, CURLOPT_READDATA, &tx_chunk[0]); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to set upload data for libCURL tx to upload. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + /***************************************************************************/ + /* Size of the data to transmit. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(handle, + CURLOPT_POSTFIELDSIZE, + tx_chunk[0].size); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to set length of upload data for libCURL to " + "upload. Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + +if(numhandles == 2) +{ + + /***************************************************************************/ + /* Point to the data to be received. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(bhandle, CURLOPT_WRITEDATA, &rx_chunk[1]); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL2 rx to upload. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + + /***************************************************************************/ + /* Pointer to pass to our read function */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(bhandle, CURLOPT_READDATA, &tx_chunk[1]); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to set upload data for libCURL2 tx to upload. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + /***************************************************************************/ + /* Size of the data to transmit. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(bhandle, + CURLOPT_POSTFIELDSIZE, + tx_chunk[1].size); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to set length of upload data for libCURL2 to " + "upload. Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + +} + + /***************************************************************************/ + /* Now run off and do what you've been told! */ + /***************************************************************************/ + curl_rc = curl_multi_perform(multi_handle, still); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to transfer an multi event to Vendor Event Listener! " + "Error code=%d (%s)", curl_rc, curl_multi_strerror(curl_rc +)); + EVEL_ERROR("Dropped event: %s", msg); + goto exit_label; + } + + /***************************************************************************/ + /* See what response we got - any 2XX response is good. */ + /***************************************************************************/ + +exit_label: + for (i=0;i<numhandles;i++) + free(rx_chunk[i].memory); + EVEL_EXIT(); + + return(rc); +} + + +/**************************************************************************//** + * Event Multi Post Handler. + * + * Watch for messages coming on the internal queue and send them to the + * listener. + * + * param[in] jsonmsg json message to be sent. + * param[in] size size of json message + * param[in] currhandle Primary handle + * param[in] url1 pimary url + * param[in] bakkhandle Backup handle + * param[in] url2 secondary url + *****************************************************************************/ +static int evel_post_multiapi(char *jsonmsg, size_t size,CURL *currhandle, char *url1, + CURL *bakkhandle, char *url2) +{ + CURLcode curl_rc = 0; + int nhandles = 1; + int still_running; + CURLMsg *msg; /* for picking up messages with the transfer status */ + int msgs_left; /* how many messages are left */ + + /***************************************************************************/ + /* Set the URL for the API. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(currhandle, CURLOPT_URL, url1); + if (curl_rc != CURLE_OK ) + { + log_error_state("Failed to initialize libCURL with the multi API URL. " + "%s Error code=%d (%s)", url1, curl_rc, curl_err_string); + } + + if( url2 != NULL && activmode == 1 ) + { + curl_rc = curl_easy_setopt(bakkhandle, CURLOPT_URL, url2); + if (curl_rc != CURLE_OK) + { + log_error_state("Failed to initialize libCURL with the API URL. " + "%s Error code=%d (%s)", url2, curl_rc, curl_err_string2); + } + nhandles = 2; + } + + /* we start some action by calling perform right away */ + curl_multi_add_handle(multi_handle, currhandle); + if(nhandles==2){ + curl_multi_add_handle(multi_handle, bakkhandle); + } + + /* we start some action by calling perform right away */ + curl_multi_perform(multi_handle, &still_running); + + do { + struct timeval timeout; + int rc; /* select() return code */ + CURLMcode mc; /* curl_multi_fdset() return code */ + + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd = -1; + + long curl_timeo = -1; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* set a suitable timeout to play around with */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + + /* get file descriptors from the transfers */ + mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); + + if(mc != CURLM_OK) { + EVEL_ERROR("curl_multi_fdset() failed, code %d.\n", mc); + break; + } + + /* On success the value of maxfd is guaranteed to be >= -1. We call + select(maxfd + 1, ...); specially in case of (maxfd == -1) there are + no fds ready yet so we call select(0, ...) --or Sleep() on Windows-- + to sleep 100ms, which is the minimum suggested value in the + curl_multi_fdset() doc. */ + + if(maxfd == -1) { +#ifdef _WIN32 + Sleep(100); + rc = 0; +#else + /* Portable sleep for platforms other than Windows. */ + struct timeval wait = { 0, 300000 }; /* 250ms */ + rc = select(0, NULL, NULL, NULL, &wait); +#endif + } + else { + /* Note that on some platforms 'timeout' may be modified by select(). + If you need access to the original value save a copy beforehand. */ + rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); + } + + switch(rc) { + case -1: + /* select error */ + break; + case 0: /* timeout */ + default: /* action */ + //curl_multi_perform(multi_handle, &still_running); + evel_postmulti_message(jsonmsg, size, &still_running, currhandle, bakkhandle, nhandles); + } + } while(still_running); + + /* See how the transfers went */ + while((msg = curl_multi_info_read(multi_handle, &msgs_left))) { + if(msg->msg == CURLMSG_DONE) { + int idx; + EVEL_DEBUG("Transfer status - %s\n", curl_multi_strerror(msg->data.result)); + + /* Find out which handle this message is about */ + for(idx = 0; idx<nhandles; idx++) { + if (msg->easy_handle == currhandle) break; + else if(msg->easy_handle == bakkhandle) break; + } + + switch(idx) { + case 0: + curl_rc = msg->data.result; + break; + case 1: + curl_rc = msg->data.result; + break; + } + } + } + + /* we start some action by calling perform right away */ + curl_multi_remove_handle(multi_handle, currhandle); + if(nhandles==2){ + curl_multi_remove_handle(multi_handle, bakkhandle); + } + + EVEL_DEBUG("Transfer completed with status %s\n", curl_multi_strerror(curl_rc)); + if( curl_rc == 0 || curl_rc == 55 ) + return EVEL_SUCCESS; + else + return EVEL_CURL_LIBRARY_FAIL; + +} +/**************************************************************************//** + * Event Handler. + * + * Watch for messages coming on the internal queue and send them to the + * listener. + * + * param[in] arg Argument - unused. + *****************************************************************************/ +static void * event_multi_handler(void * arg __attribute__ ((unused))) +{ + int old_type = 0; + EVENT_HEADER * msg = NULL; + EVENT_INTERNAL * internal_msg = NULL; + int json_size = 0; + char json_body[EVEL_MAX_JSON_BODY]; + int rc = EVEL_SUCCESS; + CURLcode curl_rc; + CURL *currhandler = NULL; + CURL *bakhandler = NULL; + char *send_url = NULL; + char *send_url2 = NULL; + + EVEL_INFO("Event multi handler thread started"); + + /***************************************************************************/ + /* Set this thread to be cancellable immediately. */ + /***************************************************************************/ + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &old_type); + + /***************************************************************************/ + /* Set the handler as active, defending against weird situations like */ + /* immediately shutting down after initializing the library so the */ + /* handler never gets started up properly. */ + /***************************************************************************/ + if (evt_handler_state == EVT_HANDLER_INACTIVE) + { + evt_handler_state = EVT_HANDLER_ACTIVE; + } + else + { + EVEL_ERROR("Event Handler State was not INACTIVE at start-up - " + "Handler will exit immediately!"); + } + + currhandler = curl_handle; + while (evt_handler_state == EVT_HANDLER_ACTIVE) + { + /*************************************************************************/ + /* Wait for a message to be received. */ + /*************************************************************************/ + msg = ring_buffer_read(&event_buffer); + + /*************************************************************************/ + /* Internal events get special treatment while regular events get posted */ + /* to the far side. */ + /*************************************************************************/ + if (msg->event_domain == EVEL_DOMAIN_BATCH ) + { + EVEL_DEBUG("Batch event received"); + + /***********************************************************************/ + /* Encode the event in JSON. */ + /***********************************************************************/ + json_size = evel_json_encode_batch_event(json_body, EVEL_MAX_JSON_BODY, msg); + + /***************************************************************************/ + /* Set the URL for the API. */ + /***************************************************************************/ + if( currhandler == curl_handle){ + send_url = evel_batch_api_url; + send_url2 = evel_bbatch_api_url; + bakhandler = curl_handle2; + } else if(currhandler == curl_handle2) { + send_url = evel_bbatch_api_url; + send_url2 = evel_batch_api_url; + bakhandler = curl_handle; + } + + /***********************************************************************/ + /* Send the JSON across the API. */ + /***********************************************************************/ + EVEL_DEBUG("Sending Batch JSON of size %d is: %s", json_size, json_body); + rc = evel_post_multiapi(json_body, json_size, currhandler, send_url, bakhandler, send_url2); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to transfer the data to %s. Error code=%d", send_url, rc); + EVEL_INFO("Switched Collector ..."); + if( currhandler == curl_handle){ + currhandler = curl_handle2; + bakhandler = curl_handle; + } else if(currhandler == curl_handle2) { + currhandler = curl_handle; + bakhandler = curl_handle2; + } + rc = evel_post_multiapi(json_body, json_size, currhandler, send_url2, bakhandler,send_url); + if (rc != EVEL_SUCCESS) + EVEL_ERROR("Failed to transfer the data to failover %s. Error code=%d", send_url2, rc); + } + } + else if (msg->event_domain != EVEL_DOMAIN_INTERNAL ) + { + EVEL_DEBUG("External event received"); + + /***********************************************************************/ + /* Encode the event in JSON. */ + /***********************************************************************/ + json_size = evel_json_encode_event(json_body, EVEL_MAX_JSON_BODY, msg); + + /***************************************************************************/ + /* Set the URL for the API. */ + /***************************************************************************/ + if( currhandler == curl_handle){ + send_url = evel_event_api_url; + send_url2 = evel_bevent_api_url; + bakhandler = curl_handle2; + } else if(currhandler == curl_handle2) { + send_url = evel_bevent_api_url; + send_url2 = evel_event_api_url; + bakhandler = curl_handle; + } + + /***********************************************************************/ + /* Send the JSON across the API. */ + /***********************************************************************/ + EVEL_DEBUG("Sending Batch JSON of size %d is: %s", json_size, json_body); + rc = evel_post_multiapi(json_body, json_size, currhandler, send_url, bakhandler, send_url2); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to transfer the data to %s. Error code=%d", send_url, rc); + EVEL_INFO("Switched Collector ..."); + if( currhandler == curl_handle){ + currhandler = curl_handle2; + bakhandler = curl_handle; + } else if(currhandler == curl_handle2) { + currhandler = curl_handle; + bakhandler = curl_handle2; + } + rc = evel_post_multiapi(json_body, json_size, currhandler, send_url2, bakhandler,send_url); + if (rc != EVEL_SUCCESS) + EVEL_ERROR("Failed to transfer the data to failover %s. Error code=%d", send_url2, rc); + } + + } + else + { + EVEL_DEBUG("Internal event received"); + internal_msg = (EVENT_INTERNAL *) msg; + assert(internal_msg->command == EVT_CMD_TERMINATE); + evt_handler_state = EVT_HANDLER_TERMINATING; + } + + /*************************************************************************/ + /* We are responsible for freeing the memory. */ + /*************************************************************************/ + evel_free_event(msg); + msg = NULL; + + /*************************************************************************/ + /* There may be a single priority post to be sent. */ + /*************************************************************************/ + if (priority_post.memory != NULL) + { + EVEL_DEBUG("Priority Post"); + + /***********************************************************************/ + /* Set the URL for the throttling API. */ + /***********************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_URL, evel_throt_api_url); + if (curl_rc != CURLE_OK) + { + /*********************************************************************/ + /* This is only likely to happen with CURLE_OUT_OF_MEMORY, in which */ + /* case we carry on regardless. */ + /*********************************************************************/ + EVEL_ERROR("Failed to set throttling URL. Error code=%d", rc); + } + else + { + rc = evel_post_api(priority_post.memory, priority_post.size); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to transfer priority post. Error code=%d", rc); + } + } + + /***********************************************************************/ + /* Reinstate the URL for the event API. */ + /***********************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_URL, evel_event_api_url); + if (curl_rc != CURLE_OK) + { + /*********************************************************************/ + /* This is only likely to happen with CURLE_OUT_OF_MEMORY, in which */ + /* case we carry on regardless. */ + /*********************************************************************/ + EVEL_ERROR("Failed to reinstate events URL. Error code=%d", rc); + } + + /***********************************************************************/ + /* We are responsible for freeing the memory. */ + /***********************************************************************/ + free(priority_post.memory); + priority_post.memory = NULL; + } + } + + /***************************************************************************/ + /* The event handler is now exiting. The ring-buffer could contain events */ + /* which have not been processed, so deplete those. Because we've been */ + /* asked to exit we can be confident that the foreground will have stopped */ + /* sending events in so we know that this process will conclude! */ + /***************************************************************************/ + evt_handler_state = EVT_HANDLER_TERMINATING; + while (!ring_buffer_is_empty(&event_buffer)) + { + EVEL_DEBUG("Reading event from buffer"); + msg = ring_buffer_read(&event_buffer); + evel_free_event(msg); + } + evt_handler_state = EVT_HANDLER_TERMINATED; + EVEL_INFO("Event handler thread stopped"); + + return (NULL); +} + + /**************************************************************************//** * Event Handler. * @@ -960,7 +1907,7 @@ static void * event_handler(void * arg __attribute__ ((unused))) rc = evel_post_api(json_body, json_size); if (rc != EVEL_SUCCESS) { - EVEL_ERROR("Failed to transfer the data. Error code=%d", rc); + EVEL_ERROR("Failed to transfer the data %s. Error code=%d", evel_batch_api_url, rc); } } else if (msg->event_domain != EVEL_DOMAIN_INTERNAL ) @@ -990,7 +1937,44 @@ static void * event_handler(void * arg __attribute__ ((unused))) rc = evel_post_api(json_body, json_size); if (rc != EVEL_SUCCESS) { - EVEL_ERROR("Failed to transfer the data. Error code=%d", rc); + EVEL_ERROR("Failed to transfer the data %s. Error code=%d",evel_event_api_url, rc); + EVEL_INFO("First Retry sending the message by setting the connection afresh"); + rc = evel_re_setup_curl(); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to re-setup CURL- First attempt. Error code=%d", rc); + goto next; + } + rc = evel_post_api(json_body, json_size); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to transfer the data after First retry - %s. Error code=%d",evel_event_api_url, rc); + EVEL_INFO("Second Retry sending the message by setting the connection afresh"); + + rc = evel_re_setup_curl(); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to re-setup CURL- Second attempt. Error code=%d", rc); + goto next; } + rc = evel_post_api(json_body, json_size); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to transfer the data after Second retry - %s. Error code=%d",evel_event_api_url, rc); + EVEL_INFO("Third Retry sending the message by setting the connection afresh"); + + rc = evel_re_setup_curl(); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to re-setup CURL- Third attempt. Error code=%d", rc); + goto next; + } + rc = evel_post_api(json_body, json_size); + if (rc != EVEL_SUCCESS) + { + EVEL_ERROR("Failed to transfer the data after Third retry - %s. Error code=%d",evel_event_api_url, rc); + } + } + } } } else @@ -1001,6 +1985,8 @@ static void * event_handler(void * arg __attribute__ ((unused))) evt_handler_state = EVT_HANDLER_TERMINATING; } +next: + /*************************************************************************/ /* We are responsible for freeing the memory. */ /*************************************************************************/ @@ -1122,11 +2108,11 @@ void evel_handle_event_response(const MEMORY_CHUNK * const chunk, } else { - EVEL_DEBUG("Decode JSON response tokens"); - if (!evel_handle_response_tokens(chunk, json_tokens, num_tokens, post)) - { - EVEL_ERROR("Failed to handle JSON response."); - } + //EVEL_DEBUG("Decode JSON response tokens"); + //if (!evel_handle_response_tokens(chunk, json_tokens, num_tokens, post)) + //{ + // EVEL_ERROR("Failed to handle JSON response."); + //} } EVEL_EXIT(); @@ -1233,3 +2219,566 @@ bool evel_token_equals_string(const MEMORY_CHUNK * const chunk, return result; } + +static EVEL_ERR_CODES evel_re_setup_curl() +{ + + int rc = EVEL_SUCCESS; + CURLcode curl_rc = CURLE_OK; + char local_address[64]; + + EVEL_ENTER(); + /***************************************************************************/ + /* Clean-up the cURL library. */ + /***************************************************************************/ + if (multi_handle != NULL) + { + curl_multi_cleanup(multi_handle); + } + if (curl_handle != NULL) + { + curl_easy_cleanup(curl_handle); + curl_handle = NULL; + } + if (curl_handle2 != NULL) + { + curl_easy_cleanup(curl_handle2); + curl_handle2 = NULL; + } + if (hdr_chunk != NULL) + { + curl_slist_free_all(hdr_chunk); + hdr_chunk = NULL; + } + if (hdr_chunk2 != NULL) + { + curl_slist_free_all(hdr_chunk2); + hdr_chunk2 = NULL; + } + + curl_rc = curl_global_init(CURL_GLOBAL_SSL); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL. Error code=%d", curl_rc); + goto exit_label; + } + + + /***************************************************************************/ + /* Get a curl handle which we'll use for all of our output. */ + /***************************************************************************/ + curl_handle = curl_easy_init(); + if (curl_handle == NULL) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to get libCURL handle"); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_handle2 = curl_easy_init(); + if (curl_handle2 == NULL) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to get backup libCURL handle"); + goto exit_label; + } + } + /***************************************************************************/ + /* Prime the library to give friendly error codes. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_ERRORBUFFER, + curl_err_string); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to provide friendly errors. " + "Error code=%d", curl_rc); + goto exit_label; + } + + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_ERRORBUFFER, + curl_err_string2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL2 to provide friendly errors. " + "Error code=%d", curl_rc); + goto exit_label; + } + } + /***************************************************************************/ + /* If running in verbose mode generate more output. */ + /***************************************************************************/ + if (evel_verbosity > 0) + { + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to be verbose. " + "Error code=%d", curl_rc); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_VERBOSE, 1L); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to be verbose. " + "Error code=%d", curl_rc); + goto exit_label; + } + } + + } + /***************************************************************************/ + /* Set the URL for the API. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_URL, evel_event_api_url); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + EVEL_INFO("Initializing CURL to send events to: %s", evel_event_api_url); + + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_URL, + evel_bevent_api_url); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + /***************************************************************************/ + /* send all data to this function. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_WRITEFUNCTION, + evel_write_callback); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the write callback. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_WRITEFUNCTION, + evel_write_callback); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + /***************************************************************************/ + /* configure local ip address if provided */ + /* Default ip if NULL */ + /***************************************************************************/ + if( evel_source_ip != NULL ) + { + snprintf(local_address,sizeof(local_address),evel_source_ip); + if( local_address[0] != '\0' ) + { + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_INTERFACE, + local_address); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the local address. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } + } + if( evel_source_ip_bakup != NULL ) + { + snprintf(local_address,sizeof(local_address),evel_source_ip_bakup); + if( local_address[0] != '\0' ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_INTERFACE, + local_address); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize bakup libCURL with the local address. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + } + /***************************************************************************/ + /* configure SSL options for HTTPS transfers */ + /***************************************************************************/ + if( evel_secure ) + { + if( evel_cert_file_path != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_SSLCERT, + evel_cert_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the client cert. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSLCERT, + evel_cert_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the client cert. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } + } + if( evel_key_file_path != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_SSLKEY, + evel_key_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the client key. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSLKEY, + evel_key_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the client key. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } + } + if( evel_ca_info != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_CAINFO, + evel_ca_info); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the CA cert file. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_CAINFO, + evel_ca_info); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the CA cert file. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } + } + if( evel_ca_file_path != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_CAPATH, + evel_ca_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the CA cert path. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_CAPATH, + evel_ca_file_path); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the CA cert path. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } + } + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_SSL_VERIFYPEER, + evel_verify_peer); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with SSL Server verification. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_SSL_VERIFYHOST, + evel_verify_host); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with Client host verification. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSL_VERIFYPEER, + evel_verify_peer); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with SSL Server verification. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_SSL_VERIFYHOST, + evel_verify_host); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with Client host verification. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + } + } + /***************************************************************************/ + /* some servers don't like requests that are made without a user-agent */ + /* field, so we provide one. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_USERAGENT, + "libcurl-agent/1.0"); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to upload. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, + CURLOPT_USERAGENT, + "libcurl-agent/1.0"); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + /***************************************************************************/ + /* Specify that we are going to POST data. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_POST, 1L); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to upload. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_POST, 1L); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + + /***************************************************************************/ + /* we want to use our own read function. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_callback); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to upload using read " + "function. Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_READFUNCTION, read_callback); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + + /***************************************************************************/ + /* All of our events are JSON encoded. We also suppress the */ + /* Expect: 100-continue header that we would otherwise get since it */ + /* confuses some servers. */ + /* */ + /* @TODO: do AT&T want this behavior? */ + /***************************************************************************/ + hdr_chunk = curl_slist_append(hdr_chunk, "Content-type: application/json"); + hdr_chunk = curl_slist_append(hdr_chunk, "Expect:"); + + /***************************************************************************/ + /* set our custom set of headers. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, hdr_chunk); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL to use custom headers. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + hdr_chunk2 = curl_slist_append(hdr_chunk2, "Content-type: application/json"); + hdr_chunk2 = curl_slist_append(hdr_chunk2, "Expect:"); + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_HTTPHEADER, hdr_chunk2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + + /***************************************************************************/ + /* Set the timeout for the operation. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, + CURLOPT_TIMEOUT, + EVEL_API_TIMEOUT); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL for API timeout. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2,CURLOPT_TIMEOUT, EVEL_API_TIMEOUT); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with the API URL. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + } + + /***************************************************************************/ + /* Set that we want Basic authentication with username:password Base-64 */ + /* encoded for the operation. */ + /***************************************************************************/ + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL for Basic Authentication. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_USERNAME, evel_username); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with username. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle, CURLOPT_PASSWORD, evel_password); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with password. " + "Error code=%d (%s)", curl_rc, curl_err_string); + goto exit_label; + } + if( evel_bevent_api_url != NULL ) + { + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL for Basic Authentication. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_USERNAME, evel_username2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with username. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + curl_rc = curl_easy_setopt(curl_handle2, CURLOPT_PASSWORD, evel_password2); + if (curl_rc != CURLE_OK) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to initialize libCURL with password. " + "Error code=%d (%s)", curl_rc, curl_err_string2); + goto exit_label; + } + multi_handle = curl_multi_init(); + if (multi_handle == NULL) + { + rc = EVEL_CURL_LIBRARY_FAIL; + log_error_state("Failed to get libCURL Multi handle"); + goto exit_label; + } + } +exit_label: + EVEL_EXIT(); + + return(rc); +} diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_fault.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_fault.c index 38b07a7..3029cf1 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_fault.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_fault.c @@ -92,13 +92,18 @@ EVENT_FAULT * evel_new_fault(const char * ev_name, fault->major_version = EVEL_FAULT_MAJOR_VERSION; fault->minor_version = EVEL_FAULT_MINOR_VERSION; fault->event_severity = severity; + if( severity == EVEL_SEVERITY_NORMAL ) + evel_event_sequence_set(&fault->header,0); + else + evel_event_sequence_set(&fault->header,1); fault->event_source_type = ev_source_type; fault->vf_status = status; fault->alarm_condition = strdup(condition); fault->specific_problem = strdup(specific_problem); evel_init_option_string(&fault->category); evel_init_option_string(&fault->alarm_interface_a); - dlist_initialize(&fault->additional_info); +/** Prakash dlist_initialize(&fault->additional_info); **/ + fault->additional_info = ht_create(); exit_label: EVEL_EXIT(); @@ -122,7 +127,9 @@ exit_label: *****************************************************************************/ void evel_fault_addl_info_add(EVENT_FAULT * fault, char * name, char * value) { - FAULT_ADDL_INFO * addl_info = NULL; + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -134,7 +141,7 @@ void evel_fault_addl_info_add(EVENT_FAULT * fault, char * name, char * value) assert(value != NULL); EVEL_DEBUG("Adding name=%s value=%s", name, value); - addl_info = malloc(sizeof(FAULT_ADDL_INFO)); +/** Prakash addl_info = malloc(sizeof(FAULT_ADDL_INFO)); assert(addl_info != NULL); memset(addl_info, 0, sizeof(FAULT_ADDL_INFO)); addl_info->name = strdup(name); @@ -143,6 +150,14 @@ void evel_fault_addl_info_add(EVENT_FAULT * fault, char * name, char * value) assert(addl_info->value != NULL); dlist_push_last(&fault->additional_info, addl_info); +**********/ + + EVEL_DEBUG("Adding name=%s value=%s", name, value); + + nam = strdup(name); + val = strdup(value); + + ht_insert(fault->additional_info, nam, val); EVEL_EXIT(); } @@ -243,8 +258,11 @@ void evel_fault_type_set(EVENT_FAULT * fault, const char * const type) void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf, EVENT_FAULT * event) { - FAULT_ADDL_INFO * addl_info = NULL; - DLIST_ITEM * addl_info_item = NULL; +/*** Prakash FAULT_ADDL_INFO * addl_info = NULL; + DLIST_ITEM * addl_info_item = NULL; ****/ + HASHTABLE_T *ht; + ENTRY_T *entry; + char * fault_severity; char * fault_source_type; char * fault_vf_status; @@ -284,34 +302,46 @@ void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf, /* Checkpoint, so that we can wind back if all fields are suppressed. */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "alarmAdditionalInformation")) + ht = event->additional_info; + if( ht != NULL ) { - bool item_added = false; - - addl_info_item = dlist_get_first(&event->additional_info); - while (addl_info_item != NULL) + bool added = false; + if( ht->size > 0) { - addl_info = (FAULT_ADDL_INFO*) addl_info_item->item; - assert(addl_info != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "alarmAdditionalInformation", - addl_info->name)) + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "alarmAdditionalInformation")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", addl_info->name); - evel_enc_kv_string(jbuf, "value", addl_info->value); - evel_json_close_object(jbuf); - item_added = true; + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding alarmAdditionalInformation %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "alarmAdditionalInformation", + entry->key)) + { + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - addl_info_item = dlist_get_next(addl_info_item); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ /*************************************************************************/ - if (!item_added) + if (!added) { evel_json_rewind(jbuf); } @@ -333,7 +363,8 @@ void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf, *****************************************************************************/ void evel_free_fault(EVENT_FAULT * event) { - FAULT_ADDL_INFO * addl_info = NULL; +/*** Prakash FAULT_ADDL_INFO * addl_info = NULL; **/ + HASHTABLE_T *ht; EVEL_ENTER(); @@ -347,17 +378,12 @@ void evel_free_fault(EVENT_FAULT * event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - addl_info = dlist_pop_last(&event->additional_info); - while (addl_info != NULL) + ht = event->additional_info; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Additional Info (%s, %s)", - addl_info->name, - addl_info->value); - free(addl_info->name); - free(addl_info->value); - free(addl_info); - addl_info = dlist_pop_last(&event->additional_info); + ht_destroy(ht); } + free(event->alarm_condition); free(event->specific_problem); evel_free_option_string(&event->category); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_heartbeat_fields.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_heartbeat_fields.c index 031632a..5b97906 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_heartbeat_fields.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_heartbeat_fields.c @@ -77,7 +77,8 @@ EVENT_HEARTBEAT_FIELD * evel_new_heartbeat_field(int interval,const char* ev_nam event->minor_version = EVEL_HEARTBEAT_FIELD_MINOR_VERSION; event->heartbeat_interval = interval; - dlist_initialize(&event->additional_info); + + event->additional_info = ht_create(); exit_label: @@ -102,7 +103,9 @@ void evel_hrtbt_field_addl_field_add(EVENT_HEARTBEAT_FIELD * const event, const char * const name, const char * const value) { - OTHER_FIELD * nv_pair = NULL; + + char *nam=NULL; + char *val=NULL; EVEL_ENTER(); @@ -115,14 +118,11 @@ void evel_hrtbt_field_addl_field_add(EVENT_HEARTBEAT_FIELD * const event, assert(value != NULL); EVEL_DEBUG("Adding name=%s value=%s", name, value); - nv_pair = malloc(sizeof(OTHER_FIELD)); - assert(nv_pair != NULL); - nv_pair->name = strdup(name); - nv_pair->value = strdup(value); - assert(nv_pair->name != NULL); - assert(nv_pair->value != NULL); - dlist_push_last(&event->additional_info, nv_pair); + nam = strdup(name); + val = strdup(value); + + ht_insert(event->additional_info, nam, val); EVEL_EXIT(); } @@ -166,8 +166,8 @@ void evel_hrtbt_interval_set(EVENT_HEARTBEAT_FIELD * const event, void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf, EVENT_HEARTBEAT_FIELD * const event) { - OTHER_FIELD * nv_pair = NULL; - DLIST_ITEM * dlist_item = NULL; + HASHTABLE_T *ht; + ENTRY_T *entry; EVEL_ENTER(); @@ -178,7 +178,7 @@ void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf, assert(event->header.event_domain == EVEL_DOMAIN_HEARTBEAT_FIELD); evel_json_encode_header(jbuf, &event->header); - evel_json_open_named_object(jbuf, "heartbeatField"); + evel_json_open_named_object(jbuf, "heartbeatFields"); /***************************************************************************/ /* Mandatory fields */ @@ -194,29 +194,46 @@ void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf, /* Checkpoint, so that we can wind back if all fields are suppressed. */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "additionalFields")) + + /***************************************************************************/ + /* Go through the Hashmap of additional information and encode key / Value */ + /***************************************************************************/ + ht = event->additional_info; + if( ht != NULL ) { bool added = false; - - dlist_item = dlist_get_first(&event->additional_info); - while (dlist_item != NULL) + if( ht->size > 0) { - nv_pair = (OTHER_FIELD *) dlist_item->item; - assert(nv_pair != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalFields", - nv_pair->name)) + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", nv_pair->name); - evel_enc_kv_string(jbuf, "value", nv_pair->value); - evel_json_close_object(jbuf); - added = true; + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - dlist_item = dlist_get_next(dlist_item); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ @@ -242,7 +259,7 @@ void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf, *****************************************************************************/ void evel_free_hrtbt_field(EVENT_HEARTBEAT_FIELD * const event) { - OTHER_FIELD * nv_pair = NULL; + HASHTABLE_T *ht; EVEL_ENTER(); @@ -255,15 +272,12 @@ void evel_free_hrtbt_field(EVENT_HEARTBEAT_FIELD * const event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - nv_pair = dlist_pop_last(&event->additional_info); - while (nv_pair != NULL) + ht = event->additional_info; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Other Field (%s, %s)", nv_pair->name, nv_pair->value); - free(nv_pair->name); - free(nv_pair->value); - free(nv_pair); - nv_pair = dlist_pop_last(&event->additional_info); + ht_destroy(ht); } + evel_free_header(&event->header); EVEL_EXIT(); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_internal.h b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_internal.h index d1a952b..02a4697 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_internal.h +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_internal.h @@ -172,27 +172,36 @@ typedef struct evel_throttle_spec { * @param[in] event_api_url * The URL where the Vendor Event Listener API is expected * to be. + * @param[in] bakup_api_url + * The BakupURL where the Vendor Backup Listener is expected + * to be. * @param[in] throt_api_url * The URL where the Throttling API is expected to be. - * @param[in] source_ip Source IP of VES Agent - * @param[in] ring_buf_size Initialization size of Ring Buffer + * @param[in] source_ip Source IP of VES Agent + * @param[in] bakup_source_ip Backup Source IP of VES Agent + * @param[in] ring_buf_size Initialization size of Ring Buffer * @param[in] secure Whether Using http or https * @param[in] cert_file_path Path to Client Certificate file * @param[in] key_file_path Path to Client key file * @param[in] ca_info Path to CA info file - * @param[in] ca_file_path Path to CA file - * @param[in] verify_peer Using peer verification or not + * @param[in] ca_file_path Path to CA file +* @param[in] verify_peer Using peer verification or not * @param[in] verify_host Using host verification or not * @param[in] username The username for the Basic Authentication of requests. * @param[in] password The password for the Basic Authentication of requests. + * @param[in] username2 The username for the Bakup requests. + * @param[in] password2 The password for the Bakup requests. * @param verbosity 0 for normal operation, positive values for chattier * logs. *****************************************************************************/ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, + const char * const bakup_api_url, const char * const throt_api_url, const char * const source_ip, + const char * const bakup_source_ip, int ring_buf_size, int secure, + int activitymode, const char * const cert_file_path, const char * const key_file_path, const char * const ca_info, @@ -201,6 +210,8 @@ EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url, long verify_host, const char * const username, const char * const password, + const char * const username2, + const char * const password2, int verbosity); /**************************************************************************//** @@ -357,6 +368,15 @@ void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf, EVENT_STATE_CHANGE * state_change); /**************************************************************************//** + * Encode the notification as a JSON event + * + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. + * @param notification Pointer to the ::EVENT_NOTIFICATION to encode. + *****************************************************************************/ +void evel_json_encode_notification(EVEL_JSON_BUFFER * jbuf, + EVENT_NOTIFICATION * notification); + +/**************************************************************************//** * Encode the Syslog in JSON according to AT&T's schema for the event type. * * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. @@ -375,6 +395,44 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, EVENT_OTHER * event); /**************************************************************************//** + * Encode the PNF Registration as a JSON PNF Registration + * + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. + * @param pnf_registration Pointer to the ::EVENT_PNF_REGISTRATION to encode. + *****************************************************************************/ +void evel_json_encode_pnf_registration(EVEL_JSON_BUFFER * jbuf, + EVENT_PNF_REGISTRATION * pnf_registration); + +/**************************************************************************//** + * Encode the Voce Quality in JSON according to AT&T's schema for the voice + * quality type. + * + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. + * @param event Pointer to the ::EVENT_HEADER to encode. + *****************************************************************************/ +void evel_json_encode_voice_quality(EVEL_JSON_BUFFER * jbuf, + EVENT_VOICE_QUALITY * event); + +/**************************************************************************//** + * Encode the Signaling in JSON according to AT&T's schema for the + * event type. + * + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. + * @param event Pointer to the ::EVENT_HEADER to encode. + *****************************************************************************/ +void evel_json_encode_threshold_cross(EVEL_JSON_BUFFER * const jbuf, + EVENT_THRESHOLD_CROSS * const event); + +/**************************************************************************//** + * Encode the instance id as a JSON object according to AT&T's schema. + * + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. + * @param vfield Pointer to the ::VENDOR_VNFNAME_FIELD to encode. + *****************************************************************************/ +void evel_json_encode_vendor_field(EVEL_JSON_BUFFER * jbuf, + VENDOR_VNFNAME_FIELD * vfield); + +/**************************************************************************//** * Set the next event_sequence to use. * * @param sequence The next sequence number to use. @@ -452,6 +510,17 @@ void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf, const int value); /**************************************************************************//** + * Encode a string key and json object value to a ::EVEL_JSON_BUFFER. + * + * @param jbuf Pointer to working ::EVEL_JSON_BUFFER. + * @param key Pointer to the key to encode. + * @param value The corresponding json string to encode. + *****************************************************************************/ +void evel_enc_kv_object(EVEL_JSON_BUFFER * jbuf, + const char * const key, + const char * value); + +/**************************************************************************//** * Encode a string key and double value to a ::EVEL_JSON_BUFFER. * * @param jbuf Pointer to working ::EVEL_JSON_BUFFER. @@ -532,6 +601,50 @@ void evel_enc_version(EVEL_JSON_BUFFER * jbuf, const char * const key, const int major_version, const int minor_version); +/**************************************************************************//** + * 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 VNF name + * + * @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 vnfname The VNF 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); /**************************************************************************//** * Add the key and opening bracket of an optional named list to a JSON buffer. @@ -789,7 +902,7 @@ char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action); * @param alert_type The alert_type to convert. * @returns The equivalent string. *****************************************************************************/ -char * evel_alert_type(const EVEL_ALERT_TYPES alert_type); +char * evel_alert_type(const EVEL_ALERT_TYPE alert_type); /**************************************************************************//** * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string. @@ -854,8 +967,8 @@ void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option); * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS. * @param value The value to set. *****************************************************************************/ -void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option, - const void* value); +void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * option, + void* value); /**************************************************************************//** * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS. * @@ -863,8 +976,8 @@ void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option, * @param value The value to set. * @param description Description to be used in logging. *****************************************************************************/ -void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option, - const void * value, +void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * option, + void * value, const char * const description); /**************************************************************************//** * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS. @@ -873,4 +986,22 @@ void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option, *****************************************************************************/ void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option); +/**************************************************************************//** + * Initialize an ::EVEL_OPTION_STATE to a not-set state. + * + * @param option Pointer to the ::EVEL_OPTION_INT. + *****************************************************************************/ +void evel_init_option_state(EVEL_OPTION_STATE * const option); + +/**************************************************************************//** + * Set the value of an ::EVEL_OPTION_STATE. + * + * @param option Pointer to the ::EVEL_OPTION_STATE. + * @param value The value to set. + * @param description Description to be used in logging. + *****************************************************************************/ +void evel_set_option_state(EVEL_OPTION_STATE * const option, + const int value, + const char * const description); + #endif diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_json_buffer.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_json_buffer.c index cae5ab1..a7ad019 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_json_buffer.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_json_buffer.c @@ -521,6 +521,7 @@ void evel_enc_version(EVEL_JSON_BUFFER * jbuf, const int major_version, const int minor_version) { + float ver; EVEL_ENTER(); /***************************************************************************/ @@ -529,14 +530,14 @@ void evel_enc_version(EVEL_JSON_BUFFER * jbuf, assert(jbuf != NULL); assert(key != NULL); - evel_enc_kv_int(jbuf, key, major_version); - if (minor_version != 0) - { + ver = (float)major_version + (float)minor_version/10.0; + jbuf->offset += snprintf(jbuf->json + jbuf->offset, - jbuf->max_size - jbuf->offset, - ".%d", - minor_version); - } + jbuf->max_size - jbuf->offset, + "%s\"%s\": \"%.1f\"", + evel_json_kv_comma(jbuf), + key, + ver); EVEL_EXIT(); } diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_jsonobject.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_jsonobject.c index 4f788bd..36ee2d5 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_jsonobject.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_jsonobject.c @@ -96,7 +96,6 @@ exit_label: EVEL_JSON_OBJECT_INSTANCE * evel_new_jsonobjinstance(const char *const yourjson) { EVEL_JSON_OBJECT_INSTANCE *jobjinst = NULL; - jsmntok_t *key; int resultCode; jsmn_parser p; jsmntok_t tokens[MAX_JSON_TOKENS]; // a number >= total number of tokens @@ -298,7 +297,7 @@ void evel_jsonobject_nfsubscriptionid_set(EVEL_JSON_OBJECT * pinst, const char * void evel_epoch_microsec_set(EVEL_JSON_OBJECT_INSTANCE * pinst, const unsigned long long epmicrosec) { assert(epmicrosec != 0 ); - pinst->objinst_epoch_microsec = epmicrosec; + evel_set_option_ull(&pinst->objinst_epoch_microsec , epmicrosec, "Json object instance microsec set"); } /**************************************************************************//** @@ -321,7 +320,7 @@ void evel_jsonobject_add_jsoninstance(EVEL_JSON_OBJECT * pobj, EVEL_JSON_OBJECT_ assert(pobj != NULL); assert(jinst != NULL); - EVEL_DEBUG("Adding json object instance"); + EVEL_DEBUG("Adding json object instance %p",jinst); dlist_push_last(&pobj->jsonobjectinstances, jinst); @@ -375,6 +374,7 @@ void evel_free_internal_key(EVEL_INTERNAL_KEY * keyp) free(keyp->keyname); evel_free_option_string(&keyp->keyvalue); + free(keyp); EVEL_EXIT(); } @@ -407,6 +407,7 @@ void evel_free_jsonobjinst(EVEL_JSON_OBJECT_INSTANCE * objinst) evel_free_internal_key(other_field); other_field = dlist_pop_last(&objinst->object_keys); } + free(objinst); EVEL_EXIT(); } @@ -425,6 +426,7 @@ void evel_free_jsonobject(EVEL_JSON_OBJECT * jsobj) EVEL_ENTER(); assert(jsobj != NULL); + EVEL_DEBUG("Freeing Json Object (%s)", jsobj->object_name); free(jsobj->object_name); evel_free_option_string(&jsobj->objectschema); evel_free_option_string(&jsobj->objectschemaurl); @@ -437,11 +439,12 @@ void evel_free_jsonobject(EVEL_JSON_OBJECT * jsobj) other_field = dlist_pop_last(&jsobj->jsonobjectinstances); while (other_field != NULL) { - EVEL_DEBUG("Freeing Object Instance Field (%s)", - other_field->jsonstring); + EVEL_DEBUG("Freeing jsonObject Instance Field %p (%s)", + other_field,other_field->jsonstring); evel_free_jsonobjinst(other_field); other_field = dlist_pop_last(&jsobj->jsonobjectinstances); } + free(jsobj); EVEL_EXIT(); } diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_mobile_flow.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_mobile_flow.c index 90b1a44..53fbce3 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_mobile_flow.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_mobile_flow.c @@ -28,6 +28,7 @@ #include "evel.h" #include "evel_internal.h" +#include "evel_throttle.h" /*****************************************************************************/ /* Array of strings to use when encoding TCP flags. */ @@ -172,7 +173,7 @@ EVENT_MOBILE_FLOW * evel_new_mobile_flow(const char* ev_name, const char *ev_id, evel_init_option_string(&mobile_flow->tac); evel_init_option_string(&mobile_flow->tunnel_id); evel_init_option_string(&mobile_flow->vlan_id); - dlist_initialize(&mobile_flow->additional_info); + mobile_flow->additional_info = ht_create(); exit_label: EVEL_EXIT(); @@ -196,7 +197,8 @@ exit_label: *****************************************************************************/ void evel_mobile_flow_addl_field_add(EVENT_MOBILE_FLOW * const event, char * name, char * value) { - OTHER_FIELD * nv_pair = NULL; + char *nam=NULL; + char *val=NULL; EVEL_ENTER(); @@ -209,14 +211,11 @@ void evel_mobile_flow_addl_field_add(EVENT_MOBILE_FLOW * const event, char * nam assert(value != NULL); EVEL_DEBUG("Adding name=%s value=%s", name, value); - nv_pair = malloc(sizeof(OTHER_FIELD)); - assert(nv_pair != NULL); - nv_pair->name = strdup(name); - nv_pair->value = strdup(value); - assert(nv_pair->name != NULL); - assert(nv_pair->value != NULL); - dlist_push_last(&event->additional_info, nv_pair); + nam = strdup(name); + val = strdup(value); + + ht_insert(event->additional_info, nam, val); EVEL_EXIT(); } @@ -933,8 +932,8 @@ void evel_mobile_flow_vlan_id_set(EVENT_MOBILE_FLOW * mobile_flow, void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf, EVENT_MOBILE_FLOW * event) { - OTHER_FIELD * nv_pair = NULL; - DLIST_ITEM * dlist_item = NULL; + HASHTABLE_T *ht; + ENTRY_T *entry; EVEL_ENTER(); @@ -952,29 +951,43 @@ void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf, /* Checkpoint, so that we can wind back if all fields are suppressed. */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "additionalFields")) + + ht = event->additional_info; + if( ht != NULL ) { bool added = false; - - dlist_item = dlist_get_first(&event->additional_info); - while (dlist_item != NULL) + if( ht->size > 0) { - nv_pair = (OTHER_FIELD *) dlist_item->item; - assert(nv_pair != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalFields", - nv_pair->name)) + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", nv_pair->name); - evel_enc_kv_string(jbuf, "value", nv_pair->value); - evel_json_close_object(jbuf); - added = true; + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - dlist_item = dlist_get_next(dlist_item); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ @@ -1051,8 +1064,7 @@ void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf, *****************************************************************************/ void evel_free_mobile_flow(EVENT_MOBILE_FLOW * event) { - OTHER_FIELD * nv_pair = NULL; - + HASHTABLE_T *ht; EVEL_ENTER(); /***************************************************************************/ @@ -1099,14 +1111,10 @@ void evel_free_mobile_flow(EVENT_MOBILE_FLOW * event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - nv_pair = dlist_pop_last(&event->additional_info); - while (nv_pair != NULL) + ht = event->additional_info; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Other Field (%s, %s)", nv_pair->name, nv_pair->value); - free(nv_pair->name); - free(nv_pair->value); - free(nv_pair); - nv_pair = dlist_pop_last(&event->additional_info); + ht_destroy(ht); } evel_free_header(&event->header); @@ -1313,6 +1321,10 @@ MOBILE_GTP_PER_FLOW_METRICS * evel_new_mobile_gtp_flow_metrics( evel_init_option_int(&metrics->num_gtp_tunnel_errors); evel_init_option_int(&metrics->num_http_errors); + metrics->ip_tos_count_list = ht_create(); + metrics->mobile_qci_cos_count_list = ht_create(); + metrics->tcp_flag_count_list = ht_create(); + exit_label: EVEL_EXIT(); return metrics; @@ -1668,6 +1680,135 @@ void evel_mobile_gtp_metrics_max_trx_bit_rate_set( } /**************************************************************************//** + * Add an IP Tos count list 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 fault Pointer to the Mobile GTP Per Flow Metrics. + * @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_mobile_gtp_metrics_ip_tos_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const char * const name, + const char * const value) +{ + char *nam=NULL; + char *val=NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(metrics != NULL); + assert(name != NULL); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", name, value); + + nam = strdup(name); + val = strdup(value); + + ht_insert(metrics->ip_tos_count_list, nam, val); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Add an QCI Cos count list 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 fault Pointer to the Mobile GTP Per Flow Metrics. + * @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_mobile_gtp_metrics_qci_cos_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const EVEL_QCI_COS_TYPES qci_cos, + const char * const value) + +{ + char *nam=NULL; + char *val=NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(metrics != NULL); + assert(qci_cos >= 0); + assert(qci_cos < EVEL_MAX_QCI_COS_TYPES); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", evel_qci_cos_strings[qci_cos], value); + + nam = strdup(evel_qci_cos_strings[qci_cos]); + val = strdup(value); + + ht_insert(metrics->mobile_qci_cos_count_list, nam, val); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Add an TCP Flag count list 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 fault Pointer to the Mobile GTP Per Flow Metrics. + * @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_mobile_gtp_metrics_tcp_flag_count_list_add( + MOBILE_GTP_PER_FLOW_METRICS * metrics, + const EVEL_TCP_FLAGS tcp_flag, + const char * const value) +{ + char *nam=NULL; + char *val=NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(metrics != NULL); + assert(tcp_flag >= 0); + assert(tcp_flag < EVEL_MAX_TCP_FLAGS); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", evel_tcp_flag_strings[tcp_flag], value); + + nam = strdup(evel_tcp_flag_strings[tcp_flag]); + val = strdup(value); + + ht_insert(metrics->tcp_flag_count_list, nam, val); + + EVEL_EXIT(); +} + +/**************************************************************************//** * Set the Number of GTP Echo Failures property of the Mobile GTP Per Flow * Metrics. * @@ -1830,6 +1971,9 @@ void evel_json_encode_mobile_flow_gtp_flow_metrics( EVEL_JSON_BUFFER * jbuf, MOBILE_GTP_PER_FLOW_METRICS * metrics) { + HASHTABLE_T *ht; + ENTRY_T *entry; + int index; bool found_ip_tos; bool found_tcp_flag; @@ -1913,18 +2057,18 @@ void evel_json_encode_mobile_flow_gtp_flow_metrics( if (found_ip_tos) { - evel_json_open_named_list(jbuf, "ipTosCountList"); + evel_json_open_named_object(jbuf, "ipTosCountList"); for (index = 0; index < EVEL_TOS_SUPPORTED; index++) { if (metrics->ip_tos_counts[index].is_set) { evel_enc_list_item(jbuf, - "[\"%d\", %d]", + "\"%d\": \"%d\"", index, metrics->ip_tos_counts[index].value); } } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); } if (found_ip_tos) @@ -1982,18 +2126,18 @@ void evel_json_encode_mobile_flow_gtp_flow_metrics( if (found_tcp_flag) { - evel_json_open_named_list(jbuf, "tcpFlagCountList"); + evel_json_open_named_object(jbuf, "tcpFlagCountList"); for (index = 0; index < EVEL_MAX_TCP_FLAGS; index++) { if (metrics->tcp_flag_counts[index].is_set) { evel_enc_list_item(jbuf, - "[\"%s\", %d]", + "\"%s\": \"%d\"", evel_tcp_flag_strings[index], metrics->tcp_flag_counts[index].value); } } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); } /***************************************************************************/ @@ -2032,7 +2176,7 @@ void evel_json_encode_mobile_flow_gtp_flow_metrics( if (found_qci_cos) { - evel_json_open_named_list(jbuf, "mobileQciCosList"); + evel_json_open_named_object(jbuf, "mobileQciCosList"); for (index = 0; index < EVEL_MAX_QCI_COS_TYPES; index++) { if (metrics->qci_cos_counts[index].is_set) @@ -2042,23 +2186,23 @@ void evel_json_encode_mobile_flow_gtp_flow_metrics( evel_qci_cos_strings[index]); } } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); } if (found_qci_cos) { - evel_json_open_named_list(jbuf, "mobileQciCosCountList"); + evel_json_open_named_object(jbuf, "mobileQciCosCountList"); for (index = 0; index < EVEL_MAX_QCI_COS_TYPES; index++) { if (metrics->qci_cos_counts[index].is_set) { evel_enc_list_item(jbuf, - "[\"%s\", %d]", + "\"%s\": \"%d\"", evel_qci_cos_strings[index], metrics->qci_cos_counts[index].value); } } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); } evel_enc_kv_opt_int( @@ -2086,6 +2230,279 @@ void evel_json_encode_mobile_flow_gtp_flow_metrics( jbuf, "numGtpTunnelErrors", &metrics->num_gtp_tunnel_errors); evel_enc_kv_opt_int(jbuf, "numHttpErrors", &metrics->num_http_errors); + evel_json_checkpoint(jbuf); + ht = metrics->ip_tos_count_list; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "ipTosCountList")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipTosCountList", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + evel_json_checkpoint(jbuf); + ht = metrics->ip_tos_count_list; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipTosList")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding MobileFlowFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipTosList", + entry->key)) + { + evel_enc_list_item(jbuf, "\"%s\"", entry->key); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + evel_json_checkpoint(jbuf); + ht = metrics->mobile_qci_cos_count_list; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "mobileQciCosCountList")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "mobileQciCosCountList", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + evel_json_checkpoint(jbuf); + ht = metrics->mobile_qci_cos_count_list; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "mobileQciCosList")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding MobileFlowFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "mobileQciCosList", + entry->key)) + { + evel_enc_list_item(jbuf, "\"%s\"", entry->key); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + evel_json_checkpoint(jbuf); + ht = metrics->tcp_flag_count_list; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "tcpFlagCountList")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "tcpFlagCountList", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + evel_json_checkpoint(jbuf); + ht = metrics->tcp_flag_count_list; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "tcpFlagList")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding MobileFlowFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "tcpFlagList", + entry->key)) + { + + evel_enc_list_item(jbuf, "\"%s\"", entry->key); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } evel_json_close_object(jbuf); EVEL_EXIT(); @@ -2102,6 +2519,8 @@ void evel_json_encode_mobile_flow_gtp_flow_metrics( *****************************************************************************/ void evel_free_mobile_gtp_flow_metrics(MOBILE_GTP_PER_FLOW_METRICS * metrics) { + HASHTABLE_T *ht; + EVEL_ENTER(); /***************************************************************************/ @@ -2119,5 +2538,23 @@ void evel_free_mobile_gtp_flow_metrics(MOBILE_GTP_PER_FLOW_METRICS * metrics) evel_free_option_string(&metrics->gtp_connection_status); evel_free_option_string(&metrics->gtp_tunnel_status); + ht = metrics->ip_tos_count_list; + if( ht != NULL ) + { + ht_destroy(ht); + } + + ht = metrics->mobile_qci_cos_count_list; + if( ht != NULL ) + { + ht_destroy(ht); + } + + ht = metrics->tcp_flag_count_list; + if( ht != NULL ) + { + ht_destroy(ht); + } + EVEL_EXIT(); } diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_notification.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_notification.c new file mode 100644 index 0000000..6307dd1 --- /dev/null +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_notification.c @@ -0,0 +1,514 @@ +/*************************************************************************//** + * + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************/ +/**************************************************************************//** + * @file + * Implementation of EVEL functions relating to the notification. + * + ****************************************************************************/ + +#include <string.h> +#include <assert.h> +#include <stdlib.h> + +#include "evel_throttle.h" + +/**************************************************************************//** + * Create a new notification event. + * + * @note The mandatory fields on the notification 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 notification has immutable properties. + * + * @param event_name Unique Event Name confirming Domain AsdcModel Description + * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc + * @param interface The card or port name of the reporting entity. + * + * @returns pointer to the newly manufactured ::EVENT_NOTIFICATION. If the + * event is not used it must be released using + * ::evel_free_notification + * @retval NULL Failed to create the event. + *****************************************************************************/ +EVENT_NOTIFICATION * evel_new_notification(const char* ev_name, + const char *ev_id, + const char * const changeIdentifier, + const char * const changeType) +{ + EVENT_NOTIFICATION * notification = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(changeIdentifier != NULL); + assert(changeType != NULL); + + /***************************************************************************/ + /* Allocate the notification. */ + /***************************************************************************/ + notification = malloc(sizeof(EVENT_NOTIFICATION)); + if (notification == NULL) + { + log_error_state("Out of memory"); + goto exit_label; + } + memset(notification, 0, sizeof(EVENT_NOTIFICATION)); + EVEL_DEBUG("New notification is at %lp", notification); + + /***************************************************************************/ + /* Initialize the header & the notification fields. Optional string */ + /* values are uninitialized (NULL). */ + /***************************************************************************/ + evel_init_header_nameid(¬ification->header,ev_name,ev_id); + notification->header.event_domain = EVEL_DOMAIN_NOTIFICATION; + notification->major_version = EVEL_NOTIFICATION_MAJOR_VERSION; + notification->minor_version = EVEL_NOTIFICATION_MINOR_VERSION; + notification->changeIdentifier = strdup(changeIdentifier); + notification->changeType = strdup(changeType); + + /****** Optional Parameters ******/ + evel_init_option_state(¬ification->new_state); + evel_init_option_state(¬ification->old_state); + evel_init_option_string(¬ification->changeContact); + evel_init_option_string(¬ification->state_interface); + dlist_initialize(¬ification->arrayOfNamedHashMap); + notification->additional_fields = ht_create(); + +exit_label: + EVEL_EXIT(); + return notification; +} + +/**************************************************************************//** + * Free a notification. + * + * Free off the notification supplied. Will free all the contained allocated + * memory. + * + * @note It does not free the notification itself, since that may be part of a + * larger structure. + *****************************************************************************/ +void evel_free_notification(EVENT_NOTIFICATION * const notification) +{ + HASHTABLE_T *ht; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. As an internal API we don't allow freeing NULL */ + /* events as we do on the public API. */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + + /***************************************************************************/ + /* Free all internal strings then the header itself. */ + /***************************************************************************/ + ht = notification->additional_fields; + if( ht != NULL ) + { + ht_destroy(ht); + } + + ht = dlist_pop_last(¬ification->arrayOfNamedHashMap); + while (ht != NULL) + { + EVEL_DEBUG("Freeing Notification arrayOfNamedHashMap"); + ht_destroy(ht); + ht = dlist_pop_last(¬ification->arrayOfNamedHashMap); + } + + evel_free_option_string(¬ification->state_interface); + evel_free_option_string(¬ification->changeContact); + evel_free_header(¬ification->header); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Event Type property of the notification. + * + * @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 notification Pointer to the ::EVENT_NOTIFICATION. + * @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_notification_type_set(EVENT_NOTIFICATION * const notification, + const char * const type) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions and call evel_header_type_set. */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + evel_header_type_set(¬ification->header, type); + + EVEL_EXIT(); +} + +void evel_notification_changeContact_set( + EVENT_NOTIFICATION * const notification, + const char * const changeContact) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + + assert(changeContact != NULL); + + evel_set_option_string(¬ification->changeContact, + changeContact, + "Change contact"); + + EVEL_EXIT(); +} + +void evel_notification_state_interface_set( + EVENT_NOTIFICATION * const notification, + const char * const state_interface) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + + assert(state_interface != NULL); + + evel_set_option_string(¬ification->state_interface, + state_interface, + "State Interface"); + + EVEL_EXIT(); +} + +void evel_notification_new_state_set( + EVENT_NOTIFICATION * const notification, + const EVEL_ENTITY_STATE state) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + + assert(state < EVEL_MAX_ENTITY_STATES); + evel_set_option_state(¬ification->new_state, state, "New State"); + + EVEL_EXIT(); +} + +void evel_notification_old_state_set( + EVENT_NOTIFICATION * const notification, + const EVEL_ENTITY_STATE state) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + + assert(state < EVEL_MAX_ENTITY_STATES); + evel_set_option_state(¬ification->old_state, state, "Old State"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Add an additional field name/value pair to the notification. + * + * 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 notification Pointer to the ::EVENT_NOTIFICATION. + * @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_notification_addl_field_add(EVENT_NOTIFICATION * const notification, + const char * const name, + const char * const value) +{ + char *nam=NULL; + char *val=NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + assert(name != NULL); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", name, value); + + nam = strdup(name); + val = strdup(value); + + ht_insert(notification->additional_fields, nam, val); + + EVEL_EXIT(); +} + +HASHTABLE_T * evel_notification_add_new_named_hashmap( + EVENT_NOTIFICATION * const notification, + const char * const name) +{ + HASHTABLE_T *ht; + char *nam=NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + assert(name != NULL); + + EVEL_DEBUG("Adding HashMapName=%s", name); + + nam = strdup(name); + + ht = nht_create( nam ); + + if (ht != NULL) + { + dlist_push_last(¬ification->arrayOfNamedHashMap, ht); + } + + EVEL_EXIT(); + + return ht; +} + +void evel_notification_named_hashmap_set( + HASHTABLE_T * const ht, + const char * const name, + const char * const value) +{ + char *nam=NULL; + char *val=NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(ht != NULL); + assert(name != NULL); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", name, value); + + nam = strdup(name); + val = strdup(value); + + ht_insert(ht, nam, val); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Encode the notification as a JSON notification. + * + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. + * @param notification Pointer to the ::EVENT_NOTIFICATION to encode. + *****************************************************************************/ +void evel_json_encode_notification(EVEL_JSON_BUFFER * jbuf, + EVENT_NOTIFICATION * notification) +{ + HASHTABLE_T *ht; + ENTRY_T *entry; + DLIST_ITEM * dlist_item = NULL; + + char * new_state; + char * old_state; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(notification != NULL); + assert(notification->header.event_domain == EVEL_DOMAIN_NOTIFICATION); + + new_state = evel_entity_opt_state(¬ification->new_state); + old_state = evel_entity_opt_state(¬ification->old_state); + + evel_json_encode_header(jbuf, ¬ification->header); + evel_json_open_named_object(jbuf, "notificationFields"); + + /***************************************************************************/ + /* Mandatory fields. */ + /***************************************************************************/ + evel_enc_kv_string(jbuf, "changeIdentifier", notification->changeIdentifier); + evel_enc_kv_string(jbuf, "changeType", notification->changeType); + + /***************************************************************************/ + /* Optional fields. */ + /***************************************************************************/ + if (new_state != NULL) + { + evel_enc_kv_string(jbuf, "newState", new_state); + } + if (old_state != NULL) + { + evel_enc_kv_string(jbuf, "oldState", old_state); + } + evel_enc_kv_opt_string(jbuf, "changeContact", ¬ification->changeContact); + evel_enc_kv_opt_string(jbuf, "stateInterface", ¬ification->state_interface); + evel_json_checkpoint(jbuf); + ht = notification->additional_fields; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding notificationFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* Checkpoint, so that we can wind back if all fields are suppressed. */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "arrayOfNamedHashMap")) + { + bool added_array = false; + + dlist_item = dlist_get_first(¬ification->arrayOfNamedHashMap); + while (dlist_item != NULL) + { + bool added = false; + ht = (HASHTABLE_T *) dlist_item->item; + assert(ht != NULL); + + if((ht->size > 0) && (ht-> n > 0)) + { + evel_json_checkpoint(jbuf); + evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, "name", ht->hmName); + if (evel_json_open_opt_named_object(jbuf, "hashMap")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding NotificationFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + ht->hmName, + entry->key)) + { + evel_enc_kv_string(jbuf, entry->key, entry->value); + added = true; + added_array = true; + } + entry = entry->next; + } + } + evel_json_close_object(jbuf); + if (!added) + { + evel_json_rewind(jbuf); + } + } + evel_json_close_object(jbuf); + } + + dlist_item = dlist_get_next(dlist_item); + } + + evel_json_close_list(jbuf); + + if (!added_array) + { + evel_json_rewind(jbuf); + } + } + evel_enc_version(jbuf, + "notificationFieldsVersion", + notification->major_version,notification->minor_version); + + evel_json_close_object(jbuf); + + EVEL_EXIT(); +} diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_option.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_option.c index 7818fe1..c67844a 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_option.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_option.c @@ -129,6 +129,113 @@ void evel_force_option_string(EVEL_OPTION_STRING * const option, EVEL_EXIT(); } +/**************************************************************************//** + * Initialize an ::EVEL_OPTION_STATE to a not-set state. + * + * @param option Pointer to the ::EVEL_OPTION_INT. + *****************************************************************************/ +void evel_init_option_state(EVEL_OPTION_STATE * const option) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(option != NULL); + + option->state = 0; + option->is_set = EVEL_FALSE; + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Initialize an ::EVEL_OPTION_OP_STATE to a not-set state. + * + * @param option Pointer to the ::EVEL_OPTION_INT. + *****************************************************************************/ +void evel_init_option_op_state(EVEL_OPTION_OP_STATE * const option) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(option != NULL); + + option->state = 0; + option->is_set = EVEL_FALSE; + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the value of an ::EVEL_OPTION_STATE. + * + * @param option Pointer to the ::EVEL_OPTION_STATE. + * @param value The value to set. + * @param description Description to be used in logging. + *****************************************************************************/ +void evel_set_option_state(EVEL_OPTION_STATE * const option, + const int value, + const char * const description) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(option != NULL); + assert(description != NULL); + + if (option->is_set) + { + EVEL_ERROR("Ignoring attempt to update %s to %d. %s already set to %d", + description, value, description, option->state); + } + else + { + EVEL_DEBUG("Setting %s to %d", description, value); + option->state = value; + option->is_set = EVEL_TRUE; + } + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the value of an ::EVEL_OPTION_OP_STATE. + * + * @param option Pointer to the ::EVEL_OPTION_OP_STATE. + * @param value The value to set. + * @param description Description to be used in logging. + *****************************************************************************/ +void evel_set_option_op_state(EVEL_OPTION_OP_STATE * const option, + const int value, + const char * const description) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(option != NULL); + assert(description != NULL); + + if (option->is_set) + { + EVEL_ERROR("Ignoring attempt to update %s to %d. %s already set to %d", + description, value, description, option->state); + } + else + { + EVEL_DEBUG("Setting %s to %d", description, value); + option->state = value; + option->is_set = EVEL_TRUE; + } + + EVEL_EXIT(); +} /**************************************************************************//** * Initialize an ::EVEL_OPTION_INT to a not-set state. @@ -380,8 +487,8 @@ void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option) * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS. * @param value The value to set. *****************************************************************************/ -void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option, - const void* value) +void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * option, + void* value) { EVEL_ENTER(); @@ -403,8 +510,8 @@ void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option, * @param value The value to set. * @param description Description to be used in logging. *****************************************************************************/ -void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option, - const void * value, +void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * option, + void * value, const char * const description) { EVEL_ENTER(); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_other.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_other.c index b238e38..61809f0 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_other.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_other.c @@ -28,6 +28,7 @@ #include "evel.h" #include "evel_internal.h" +#include "evel_throttle.h" /**************************************************************************//** * Create a new Other event. @@ -70,9 +71,9 @@ EVENT_OTHER * evel_new_other(const char* ev_name, const char *ev_id) other->major_version = EVEL_OTHER_EVENT_MAJOR_VERSION; other->minor_version = EVEL_OTHER_EVENT_MINOR_VERSION; - other->namedarrays = NULL; + other->hashMap = ht_create(); dlist_initialize(&other->jsonobjects); - dlist_initialize(&other->namedvalues); + dlist_initialize(&other->arrayOfNamedHashMap); exit_label: EVEL_EXIT(); @@ -106,16 +107,22 @@ void evel_other_type_set(EVENT_OTHER * other, EVEL_EXIT(); } + /**************************************************************************//** - * Set size of Named arrays hash table + * Add a json object to jsonObject list. * - * The max size of hash table is passed + * 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 Other. * @param size size of hashtable *****************************************************************************/ -void evel_other_field_set_namedarraysize(EVENT_OTHER * other, const int size) +void evel_other_field_add_hashmap(EVENT_OTHER * other, char * name, char *value) { + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -123,31 +130,28 @@ void evel_other_field_set_namedarraysize(EVENT_OTHER * other, const int size) /***************************************************************************/ assert(other != NULL); assert(other->header.event_domain == EVEL_DOMAIN_OTHER); - assert(other->namedarrays == NULL); - assert(size > 0); - EVEL_DEBUG("Adding Named array"); + assert(name != NULL); + assert(value != NULL); + + EVEL_DEBUG("Adding values to hashMap"); + + EVEL_DEBUG("Adding name=%s value=%s", name, value); - other->namedarrays = ht_create(size); + nam = strdup(name); + val = strdup(value); + + ht_insert(other->hashMap, nam, val); EVEL_EXIT(); } - -/**************************************************************************//** - * 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 other Pointer to the Other. - * @param size size of hashtable - *****************************************************************************/ -void evel_other_field_add_namedarray(EVENT_OTHER * other, const char *hashname, char * name, char *value) +HASHTABLE_T * evel_other_add_new_hashmap_to_hmarray(EVENT_OTHER * const other, + const char * const name) { - OTHER_FIELD * other_field = NULL; - DLIST *list = NULL; + HASHTABLE_T *ht; + char *nam=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -155,84 +159,73 @@ void evel_other_field_add_namedarray(EVENT_OTHER * other, const char *hashname, /***************************************************************************/ assert(other != NULL); assert(other->header.event_domain == EVEL_DOMAIN_OTHER); - assert(other->namedarrays != NULL); + assert(name != NULL); - EVEL_DEBUG("Adding values to Named array"); - - EVEL_DEBUG("Adding name=%s value=%s", name, value); - other_field = malloc(sizeof(OTHER_FIELD)); - assert(other_field != NULL); - memset(other_field, 0, sizeof(OTHER_FIELD)); - other_field->name = strdup(name); - other_field->value = strdup(value); - assert(other_field->name != NULL); - assert(other_field->value != NULL); + nam = strdup(name); + EVEL_DEBUG("Adding HashMap to array of hashmap - %s", nam); + ht = nht_create(nam); - list = (DLIST *)ht_get(other->namedarrays, hashname); - if( list == NULL ) + if (ht != NULL) { - DLIST * nlist = malloc(sizeof(DLIST)); - dlist_initialize(nlist); - dlist_push_last(nlist, other_field); - ht_set(other->namedarrays, hashname,(void*)nlist); - EVEL_DEBUG("Created to new namedarray table %p",nlist); - } - else - { - dlist_push_last(list, other_field); - EVEL_DEBUG("Adding to existing table %p",list); + dlist_push_last(&other->arrayOfNamedHashMap, ht); } EVEL_EXIT(); -} + return ht; +} /**************************************************************************//** - * Add a json object to jsonObject list. + * 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 other Pointer to the Other. - * @param jsonobj Pointer to json object + * @param ht Pointer to the hasmap array. + * @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. *****************************************************************************/ -void evel_other_field_add_jsonobj(EVENT_OTHER * other, EVEL_JSON_OBJECT *jsonobj) +void evel_other_set_hashmap_in_hmarray( + HASHTABLE_T * const ht, + const char * const name, + const char * const value) { - OTHER_FIELD * other_field = NULL; + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ /* Check preconditions. */ /***************************************************************************/ - assert(other != NULL); - assert(other->header.event_domain == EVEL_DOMAIN_OTHER); - assert(jsonobj != NULL); + assert(ht != NULL); + assert(name != NULL); - EVEL_DEBUG("Adding jsonObject"); + EVEL_DEBUG("Adding name=%s value=%s", name, value); - dlist_push_last(&other->jsonobjects, jsonobj); + nam = strdup(name); + val = strdup(value); + + ht_insert(ht, nam, val); EVEL_EXIT(); } - /**************************************************************************//** - * Add a field name/value pair to the Other. + * 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 other Pointer to the Other. - * @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. + * @param jsonobj Pointer to json object *****************************************************************************/ -void evel_other_field_add(EVENT_OTHER * other, char * name, char * value) +void evel_other_field_add_jsonobj(EVENT_OTHER * other, EVEL_JSON_OBJECT *jsonobj) { - OTHER_FIELD * other_field = NULL; EVEL_ENTER(); /***************************************************************************/ @@ -240,19 +233,11 @@ void evel_other_field_add(EVENT_OTHER * other, char * name, char * value) /***************************************************************************/ assert(other != NULL); assert(other->header.event_domain == EVEL_DOMAIN_OTHER); - assert(name != NULL); - assert(value != NULL); + assert(jsonobj != NULL); - EVEL_DEBUG("Adding name=%s value=%s", name, value); - other_field = malloc(sizeof(OTHER_FIELD)); - assert(other_field != NULL); - memset(other_field, 0, sizeof(OTHER_FIELD)); - other_field->name = strdup(name); - other_field->value = strdup(value); - assert(other_field->name != NULL); - assert(other_field->value != NULL); + EVEL_DEBUG("Adding jsonObject"); - dlist_push_last(&other->namedvalues, other_field); + dlist_push_last(&other->jsonobjects, jsonobj); EVEL_EXIT(); } @@ -266,7 +251,6 @@ void evel_other_field_add(EVENT_OTHER * other, char * name, char * value) void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, EVENT_OTHER * event) { - OTHER_FIELD * other_field = NULL; EVEL_JSON_OBJECT * jsonobjp = NULL; DLIST_ITEM * other_field_item = NULL; EVEL_JSON_OBJECT_INSTANCE * jsonobjinst = NULL; @@ -274,10 +258,8 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, EVEL_INTERNAL_KEY * keyinst = NULL; DLIST_ITEM * keyinst_field_item = NULL; HASHTABLE_T *ht = NULL; - int idx; - bool itm_added = false; - DLIST *itm_list = NULL; ENTRY_T *entry = NULL; + DLIST_ITEM *dlist_item; EVEL_ENTER(); @@ -290,52 +272,52 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, evel_json_encode_header(jbuf, &event->header); evel_json_open_named_object(jbuf, "otherFields"); -// iterate through hashtable and print DLIST for each entry - - evel_json_checkpoint(jbuf); - ht = event->namedarrays; - if( ht != NULL ) - { - if( ht->size > 0) - { - - evel_json_open_opt_named_list(jbuf, "hashOfNameValuePairArrays"); - for( idx = 0; idx < ht->size; idx++ ) { - if( ht->table[idx] != NULL) - { - entry = ht->table[idx]; - EVEL_DEBUG("Encoding other %s %p",(char *) (entry->key), entry->value); - - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", entry->key); - - itm_list = (DLIST*)(entry->value); - evel_json_open_opt_named_list(jbuf, "arrayOfFields"); - - other_field_item = dlist_get_first(itm_list); - while (other_field_item != NULL) + evel_json_checkpoint(jbuf); + ht = event->hashMap; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) { - other_field = (OTHER_FIELD *) other_field_item->item; - EVEL_DEBUG("Encoding other %s %s",(char *)other_field->name,(char*)other_field->value); - if(other_field != NULL){ - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", other_field->name); - evel_enc_kv_string(jbuf, "value", other_field->value); - evel_json_close_object(jbuf); - other_field_item = dlist_get_next(other_field_item); - } - } - evel_json_close_list(jbuf); - evel_json_close_object(jbuf); + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "hashMap")) + { - } + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding Other Fields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "hashMap", + entry->key)) + { + + // evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + // evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); + } + } - } else { - evel_json_rewind(jbuf); - } - } + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } evel_json_checkpoint(jbuf); if(evel_json_open_opt_named_list(jbuf, "jsonObjects")) @@ -345,7 +327,7 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, while (other_field_item != NULL) { jsonobjp = (EVEL_JSON_OBJECT *) other_field_item->item; - if(jsonobjp != NULL); + if(jsonobjp != NULL) //; { evel_json_open_object(jbuf); @@ -360,11 +342,11 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, { evel_json_open_object(jbuf); evel_enc_kv_object(jbuf, "objectInstance", jsonobjinst->jsonstring); - evel_enc_kv_ull(jbuf, "objectInstanceEpochMicrosec", jsonobjinst->objinst_epoch_microsec); + evel_enc_kv_opt_ull(jbuf, "objectInstanceEpochMicrosec", &jsonobjinst->objinst_epoch_microsec); //evel_json_checkpoint(jbuf); if (evel_json_open_opt_named_list(jbuf, "objectKeys")) { - bool item_added3 = false; +// bool item_added3 = false; keyinst_field_item = dlist_get_first(&jsonobjinst->object_keys); while (keyinst_field_item != NULL) @@ -377,7 +359,7 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_int(jbuf, "keyOrder", &keyinst->keyorder); evel_enc_kv_opt_string(jbuf, "keyValue", &keyinst->keyvalue); evel_json_close_object(jbuf); - item_added3 = false; +// item_added3 = false; } keyinst_field_item = dlist_get_next(keyinst_field_item); } @@ -422,35 +404,67 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, } + /***************************************************************************/ + /* Checkpoint, so that we can wind back if all fields are suppressed. */ + /***************************************************************************/ evel_json_checkpoint(jbuf); - if( evel_json_open_opt_named_list(jbuf, "nameValuePairs")) + if (evel_json_open_opt_named_list(jbuf, "arrayOfNamedHashMap")) { - bool item_added = false; + bool added_array = false; - other_field_item = dlist_get_first(&event->namedvalues); - while (other_field_item != NULL) - { - other_field = (OTHER_FIELD *) other_field_item->item; - if(other_field != NULL) + dlist_item = dlist_get_first(&event->arrayOfNamedHashMap); + while (dlist_item != NULL) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", other_field->name); - evel_enc_kv_string(jbuf, "value", other_field->value); - evel_json_close_object(jbuf); - item_added = true; + bool added = false; + ht = (HASHTABLE_T *) dlist_item->item; + assert(ht != NULL); + + if((ht->size > 0) && (ht-> n > 0)) + { + evel_json_checkpoint(jbuf); + evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, "name", ht->hmName); + if (evel_json_open_opt_named_object(jbuf, "hashMap")) + { + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding OtherFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "arrayOfNamedHashMap", + entry->key)) + { + evel_enc_kv_string(jbuf, entry->key, entry->value); + added = true; + added_array = true; + } + entry = entry->next; + } + } + evel_json_close_object(jbuf); + if (!added) + { + evel_json_rewind(jbuf); + } + } + evel_json_close_object(jbuf); + } + + dlist_item = dlist_get_next(dlist_item); } - other_field_item = dlist_get_next(other_field_item); - } - evel_json_close_list(jbuf); - /*************************************************************************/ - /* If we've not written anything, rewind to before we opened the list. */ - /*************************************************************************/ - if (!item_added) + evel_json_close_list(jbuf); + + if (!added_array) { evel_json_rewind(jbuf); } - } evel_enc_version(jbuf, "otherFieldsVersion", event->major_version,event->minor_version); @@ -470,7 +484,8 @@ void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf, *****************************************************************************/ void evel_free_other(EVENT_OTHER * event) { - OTHER_FIELD * other_field = NULL; + HASHTABLE_T *ht; + EVEL_JSON_OBJECT * jsonobjp = NULL; EVEL_ENTER(); @@ -484,17 +499,28 @@ void evel_free_other(EVENT_OTHER * event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - other_field = dlist_pop_last(&event->namedvalues); - while (other_field != NULL) + ht = event->hashMap; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Other Field (%s, %s)", - other_field->name, - other_field->value); - free(other_field->name); - free(other_field->value); - free(other_field); - other_field = dlist_pop_last(&event->namedvalues); + ht_destroy(ht); } + + ht = dlist_pop_last(&event->arrayOfNamedHashMap); + while (ht != NULL) + { + EVEL_DEBUG("Freeing Other arrayOfNamedHashMap"); + ht_destroy(ht); + ht = dlist_pop_last(&event->arrayOfNamedHashMap); + } + + jsonobjp = dlist_pop_last(&event->jsonobjects); + while (jsonobjp != NULL) + { + evel_free_jsonobject( jsonobjp ); + + jsonobjp = dlist_pop_last(&event->jsonobjects); + } + evel_free_header(&event->header); EVEL_EXIT(); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_pnf_registration.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_pnf_registration.c new file mode 100644 index 0000000..9de25e5 --- /dev/null +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_pnf_registration.c @@ -0,0 +1,573 @@ +/*************************************************************************//** + * + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************/ +/**************************************************************************//** + * @file + * Implementation of EVEL functions relating to the PNF Registration. + * + ****************************************************************************/ + +#include <string.h> +#include <assert.h> +#include <stdlib.h> + +#include "evel_throttle.h" + +/**************************************************************************//** + * Create a new PNF Registration event. + * + * @note The mandatory fields on the PNF Registration must be supplied to the + * 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 event_name Unique Event Name confirming Domain AsdcModel Description + * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc + * + * @returns pointer to the newly manufactured ::EVENT_PNF_REGISTRATION. If the + * event is not used it must be released using + * ::evel_free_pnf_registration + * @retval NULL Failed to create the event. + *****************************************************************************/ +EVENT_PNF_REGISTRATION * evel_new_pnf_registration(const char* ev_name, const char *ev_id ) +{ + EVENT_PNF_REGISTRATION * pnf_registration = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Allocate the PNF Registration. */ + /***************************************************************************/ + pnf_registration = malloc(sizeof(EVENT_PNF_REGISTRATION)); + if (pnf_registration == NULL) + { + log_error_state("Out of memory"); + goto exit_label; + } + memset(pnf_registration, 0, sizeof(EVENT_PNF_REGISTRATION)); + EVEL_DEBUG("New PNF Registration is at %lp", pnf_registration); + + /***************************************************************************/ + /* Initialize the header & the PNF Registration fields. Optional string */ + /* values are uninitialized (NULL). */ + /***************************************************************************/ + evel_init_header_nameid(&pnf_registration->header,ev_name,ev_id); + pnf_registration->header.event_domain = EVEL_DOMAIN_PNF_REGISTRATION; + pnf_registration->major_version = EVEL_PNF_REGISTRATION_MAJOR_VERSION; + pnf_registration->minor_version = EVEL_PNF_REGISTRATION_MINOR_VERSION; + + evel_init_option_string(&pnf_registration->last_service_date); + evel_init_option_string(&pnf_registration->mac_address); + evel_init_option_string(&pnf_registration->manufacture_date); + evel_init_option_string(&pnf_registration->model_number); + evel_init_option_string(&pnf_registration->oam_v4_ipaddress); + evel_init_option_string(&pnf_registration->oam_v6_ipaddress); + evel_init_option_string(&pnf_registration->serial_number); + evel_init_option_string(&pnf_registration->sw_version); + evel_init_option_string(&pnf_registration->unit_family); + evel_init_option_string(&pnf_registration->unit_type); + evel_init_option_string(&pnf_registration->vendor_name); + pnf_registration->additional_fields = ht_create(); + +exit_label: + EVEL_EXIT(); + return pnf_registration; +} + +/**************************************************************************//** + * Free a PNF Registration. + * + * Free off the PNF Registration supplied. Will free all contained allocated + * memory. + * + * @note It does not free the PNF Registration itself, since that may be part + * of a larger structure. + *****************************************************************************/ +void evel_free_pnf_registration(EVENT_PNF_REGISTRATION * const pnf_registration) +{ + HASHTABLE_T *ht; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. As an internal API we don't allow freeing NULL */ + /* events as we do on the public API. */ + /***************************************************************************/ + assert(pnf_registration != NULL); + assert(pnf_registration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + + /***************************************************************************/ + /* Free all internal strings then the header itself. */ + /***************************************************************************/ + ht = pnf_registration->additional_fields; + if( ht != NULL ) + { + ht_destroy(ht); + } + + evel_free_option_string(&pnf_registration->last_service_date); + evel_free_option_string(&pnf_registration->mac_address); + evel_free_option_string(&pnf_registration->manufacture_date); + evel_free_option_string(&pnf_registration->model_number); + evel_free_option_string(&pnf_registration->oam_v4_ipaddress); + evel_free_option_string(&pnf_registration->oam_v6_ipaddress); + evel_free_option_string(&pnf_registration->serial_number); + evel_free_option_string(&pnf_registration->sw_version); + evel_free_option_string(&pnf_registration->unit_family); + evel_free_option_string(&pnf_registration->unit_type); + evel_free_option_string(&pnf_registration->vendor_name); + + evel_free_header(&pnf_registration->header); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Add an additional field name/value pair to the PNF Registration + * + * 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 pnf_registration Pointer to the ::EVENT_PNF_REGISTRATION. + * @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_pnf_registration_addl_field_add( + EVENT_PNF_REGISTRATION * const pnf_registration, + const char * const name, + const char * const value) +{ + char *nam=NULL; + char *val=NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(pnf_registration != NULL); + assert(pnf_registration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(name != NULL); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", name, value); + + nam = strdup(name); + val = strdup(value); + + ht_insert(pnf_registration->additional_fields, nam, val); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Encode the PNF Registration as a JSON PNF Registration + * + * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into. + * @param pnf_registration Pointer to the ::EVENT_PNF_REGISTRATION to encode. + *****************************************************************************/ +void evel_json_encode_pnf_registration(EVEL_JSON_BUFFER * jbuf, + EVENT_PNF_REGISTRATION * pnf_registration) +{ + HASHTABLE_T *ht; + ENTRY_T *entry; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(pnf_registration != NULL); + assert(pnf_registration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + + evel_json_encode_header(jbuf, &pnf_registration->header); + evel_json_open_named_object(jbuf, "pnfRegistrationFields"); + + /***************************************************************************/ + /* Optional fields. */ + /***************************************************************************/ + evel_enc_kv_opt_string(jbuf, "lastServiceDate", &pnf_registration->last_service_date); + evel_enc_kv_opt_string(jbuf, "macAddress", &pnf_registration->mac_address); + evel_enc_kv_opt_string(jbuf, "manufactureDate", &pnf_registration->manufacture_date); + evel_enc_kv_opt_string(jbuf, "modelNumber", &pnf_registration->model_number); + evel_enc_kv_opt_string(jbuf, "oamV4IpAddress", &pnf_registration->oam_v4_ipaddress); + evel_enc_kv_opt_string(jbuf, "oamV6IpAddress", &pnf_registration->oam_v6_ipaddress); + evel_enc_kv_opt_string(jbuf, "serialNumber", &pnf_registration->serial_number); + evel_enc_kv_opt_string(jbuf, "softwareVersion", &pnf_registration->sw_version); + evel_enc_kv_opt_string(jbuf, "unitFamily", &pnf_registration->unit_family); + evel_enc_kv_opt_string(jbuf, "unitType", &pnf_registration->unit_type); + evel_enc_kv_opt_string(jbuf, "vendorName", &pnf_registration->vendor_name); + + evel_json_checkpoint(jbuf); + ht = pnf_registration->additional_fields; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + evel_enc_version(jbuf, + "pnfRegistrationFieldsVersion", + pnf_registration->major_version, pnf_registration->minor_version); + + evel_json_close_object(jbuf); + + EVEL_EXIT(); +} + +/****************************************************************//** + * Set the last service date + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param last_service_date The last service date to be set. ASCIIZ + * string. The caller does not need to preserve + * the value once the function returns. +*********************************************************************/ +void evel_pnfRegistration_last_service_date_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const last_service_date) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(last_service_date != NULL); + + evel_set_option_string(&pnfRegistration->last_service_date, last_service_date, "Last Service Date"); + EVEL_EXIT(); +} +/************************************************************************//** + * Set the Mac Address + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param mac_address The mac address to be set. ASCIIZ string. The + * caller does not need to preserve the value once + * the function returns. +***************************************************************************/ +void evel_pnfRegistration_mac_address_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const mac_address) +{ + EVEL_ENTER(); + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(mac_address != NULL); + + evel_set_option_string(&pnfRegistration->mac_address, mac_address, "MAC Address"); + EVEL_EXIT(); +} +/***********************************************************************//** + * Set the Manufacture Date + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param manufacture_date The manufacture date to be set. ASCIIZ string. + * The caller does not need to preserve the value + * once the function returns. +***************************************************************************/ +void evel_pnfRegistration_manufacture_date_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const manufacture_date) + { + EVEL_ENTER(); + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(manufacture_date != NULL); + + evel_set_option_string(&pnfRegistration->manufacture_date, manufacture_date, "Manufacture Date"); + EVEL_EXIT(); +} + +/***********************************************************************//** + * Set the Model Number + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param model_number The model Number to be set. ASCIIZ string. The caller + * does not need to preserve the value once the + * function returns. +***************************************************************************/ +void evel_pnfRegistration_model_number_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const model_number) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(model_number != NULL); + + evel_set_option_string(&pnfRegistration->model_number, model_number, "Model Number"); + EVEL_EXIT(); +} + +/***********************************************************************//** + * Set the OAM v4 ipaddress + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param oam_v4_ipaddress Set the oam IP address. ASCIIZ string. + * The caller does not need + * preserve the value once the function returns. +*************************************************************************/ +void evel_pnfRegistration_oam_v4_ipaddress_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const oam_v4_ipaddress) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(oam_v4_ipaddress != NULL); + + evel_set_option_string(&pnfRegistration->oam_v4_ipaddress, oam_v4_ipaddress, "OAM V4 IP Address"); + EVEL_EXIT(); +} + +/**********************************************************************//** + * Set the oam v6 ipaddress + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param oam_v6_ipaddress Set the oam IP address. ASCIIZ string. + * The caller does not need + * preserve the value once the function returns. +**************************************************************************/ +void evel_pnfRegistration_oam_v6_ipaddress_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const oam_v6_ipaddress) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(oam_v6_ipaddress != NULL); + + evel_set_option_string(&pnfRegistration->oam_v6_ipaddress, oam_v6_ipaddress, "OAM V6 IP Address"); + EVEL_EXIT(); +} + +/**********************************************************************//** + * Set the Serial Number + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param serial_number The serial number to be set. ASCIIZ string. + * The caller does not need to preserve the + * value once the function returns. +**************************************************************************/ +void evel_pnfRegistration_serial_number_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const serial_number) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(serial_number != NULL); + + evel_set_option_string(&pnfRegistration->serial_number, serial_number, "SerialNumber"); + EVEL_EXIT(); +} + +/***********************************************************************//** + * Set the Software Version + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param sw_version The SW Version to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. +****************************************************************************/ +void evel_pnfRegistration_sw_version_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const sw_version) +{ + EVEL_ENTER(); + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(sw_version != NULL); + + evel_set_option_string(&pnfRegistration->sw_version, sw_version, "Software Version"); + EVEL_EXIT(); +} + +/***********************************************************************//** + * Set the Unit Family + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param unit_family The unit family to be set. ASCIIZ string. The caller + * does not need to preserve the value once the function + * returns. +***************************************************************************/ +void evel_pnfRegistration_unit_family_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const unit_family) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(unit_family != NULL); + + evel_set_option_string(&pnfRegistration->unit_family, unit_family, "Unit Family"); + EVEL_EXIT(); +} + +/**********************************************************************//** + * Set the Unit type + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param unit_type The unit type to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. +****************************************************************************/ +void evel_pnfRegistration_unit_type_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const unit_type) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(unit_type != NULL); + + evel_set_option_string(&pnfRegistration->unit_type, unit_type, "Unit Type"); + EVEL_EXIT(); +} + +/***********************************************************************//** + * Set the Vendor name + * + * @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 pnfRegistration Pointer to the pnfRegistration + * @param vendor_name The vendor name to be set. ASCIIZ string. The + * caller does not need to preserve the value once + * the function returns. +***************************************************************************/ +void evel_pnfRegistration_vendor_name_set(EVENT_PNF_REGISTRATION * pnfRegistration, const char * const vendor_name) +{ + EVEL_ENTER(); + + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(pnfRegistration != NULL); + assert(pnfRegistration->header.event_domain == EVEL_DOMAIN_PNF_REGISTRATION); + assert(vendor_name != NULL); + + evel_set_option_string(&pnfRegistration->vendor_name, vendor_name, "Vendor Name"); + EVEL_EXIT(); +} diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_reporting_measurement.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_reporting_measurement.c index 0f30372..ddef800 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_reporting_measurement.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_reporting_measurement.c @@ -330,7 +330,7 @@ void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf, { evel_json_open_object(jbuf); evel_enc_kv_string(jbuf, "name", measurement_group->name); - evel_json_open_named_list(jbuf, "arrayOfFields"); + evel_json_open_named_object(jbuf, "hashMap"); /*********************************************************************/ /* Measurements list. */ @@ -341,13 +341,10 @@ void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf, custom_measurement = (CUSTOM_MEASUREMENT *) nested_item->item; assert(custom_measurement != NULL); - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", custom_measurement->name); - evel_enc_kv_string(jbuf, "value", custom_measurement->value); - evel_json_close_object(jbuf); + evel_enc_kv_string(jbuf, custom_measurement->name, custom_measurement->value); nested_item = dlist_get_next(nested_item); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); evel_json_close_object(jbuf); item_added = true; } diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_scaling_measurement.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_scaling_measurement.c index d484b2e..f57860d 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_scaling_measurement.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_scaling_measurement.c @@ -75,7 +75,8 @@ EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char evel_init_header_nameid(&measurement->header,ev_name,ev_id); measurement->header.event_domain = EVEL_DOMAIN_MEASUREMENT; measurement->measurement_interval = measurement_interval; - dlist_initialize(&measurement->additional_info); + measurement->additional_info = ht_create(); + measurement->feature_usage = ht_create(); dlist_initialize(&measurement->additional_measurements); dlist_initialize(&measurement->additional_objects); dlist_initialize(&measurement->cpu_usage); @@ -83,15 +84,20 @@ EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char dlist_initialize(&measurement->mem_usage); dlist_initialize(&measurement->filesystem_usage); dlist_initialize(&measurement->latency_distribution); - dlist_initialize(&measurement->vnic_usage); + dlist_initialize(&measurement->nic_performance); dlist_initialize(&measurement->codec_usage); - dlist_initialize(&measurement->feature_usage); + dlist_initialize(&measurement->huge_pages); + dlist_initialize(&measurement->ipmis); + dlist_initialize(&measurement->loads); + dlist_initialize(&measurement->machine_check_exception); + dlist_initialize(&measurement->process_stats); + evel_init_option_double(&measurement->mean_request_latency); evel_init_option_int(&measurement->vnfc_scaling_metric); evel_init_option_int(&measurement->concurrent_sessions); evel_init_option_int(&measurement->configured_entities); evel_init_option_int(&measurement->media_ports_in_use); - evel_init_option_int(&measurement->request_rate); + evel_init_option_double(&measurement->request_rate); measurement->major_version = EVEL_MEASUREMENT_MAJOR_VERSION; measurement->minor_version = EVEL_MEASUREMENT_MINOR_VERSION; @@ -144,7 +150,9 @@ void evel_measurement_type_set(EVENT_MEASUREMENT * measurement, *****************************************************************************/ void evel_measurement_addl_info_add(EVENT_MEASUREMENT * measurement, char * name, char * value) { - OTHER_FIELD * addl_info = NULL; + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -156,19 +164,44 @@ void evel_measurement_addl_info_add(EVENT_MEASUREMENT * measurement, char * name assert(value != NULL); EVEL_DEBUG("Adding name=%s value=%s", name, value); - addl_info = malloc(sizeof(OTHER_FIELD)); - assert(addl_info != NULL); - memset(addl_info, 0, sizeof(OTHER_FIELD)); - addl_info->name = strdup(name); - addl_info->value = strdup(value); - assert(addl_info->name != NULL); - assert(addl_info->value != NULL); - dlist_push_last(&measurement->additional_info, addl_info); + nam = strdup(name); + val = strdup(value); + + ht_insert(measurement->additional_info, nam, val); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * 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) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(measurement != NULL); + assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); + assert(jsonobj != NULL); + + EVEL_DEBUG("Adding jsonObject %p",jsonobj); + + dlist_push_last(&measurement->additional_objects, jsonobj); EVEL_EXIT(); } + /**************************************************************************//** * Set the Concurrent Sessions property of the Measurement. * @@ -226,72 +259,6 @@ void evel_measurement_cfg_ents_set(EVENT_MEASUREMENT * measurement, } /**************************************************************************//** - * Add an additional set of Errors 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_discards The number of receive discards. - * @param receive_errors The number of receive errors. - * @param transmit_discards The number of transmit discards. - * @param transmit_errors The number of transmit errors. - *****************************************************************************/ -void evel_measurement_errors_set(EVENT_MEASUREMENT * measurement, - int receive_discards, - int receive_errors, - int transmit_discards, - int transmit_errors) -{ - MEASUREMENT_ERRORS * errors = NULL; - EVEL_ENTER(); - - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(measurement != NULL); - assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); - assert(receive_discards >= 0); - assert(receive_errors >= 0); - assert(transmit_discards >= 0); - assert(transmit_errors >= 0); - - if (measurement->errors == NULL) - { - EVEL_DEBUG("Adding Errors: %d, %d; %d, %d", - receive_discards, - receive_errors, - transmit_discards, - transmit_errors); - errors = malloc(sizeof(MEASUREMENT_ERRORS)); - assert(errors != NULL); - memset(errors, 0, sizeof(MEASUREMENT_ERRORS)); - errors->receive_discards = receive_discards; - errors->receive_errors = receive_errors; - errors->transmit_discards = transmit_discards; - errors->transmit_errors = transmit_errors; - measurement->errors = errors; - } - else - { - errors = measurement->errors; - EVEL_DEBUG("Ignoring attempt to add Errors: %d, %d; %d, %d\n" - "Errors already set: %d, %d; %d, %d", - receive_discards, - receive_errors, - transmit_discards, - transmit_errors, - errors->receive_discards, - errors->receive_errors, - errors->transmit_discards, - errors->transmit_errors); - } - - EVEL_EXIT(); -} - -/**************************************************************************//** * Set the Mean Request Latency property of the Measurement. * * @note The property is treated as immutable: it is only valid to call @@ -331,7 +298,7 @@ void evel_measurement_mean_req_lat_set(EVENT_MEASUREMENT * measurement, * @param request_rate The Request Rate to be set. *****************************************************************************/ void evel_measurement_request_rate_set(EVENT_MEASUREMENT * measurement, - int request_rate) + double request_rate) { EVEL_ENTER(); @@ -342,7 +309,7 @@ void evel_measurement_request_rate_set(EVENT_MEASUREMENT * measurement, assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); assert(request_rate >= 0); - evel_set_option_int(&measurement->request_rate, + evel_set_option_double(&measurement->request_rate, request_rate, "Request Rate"); EVEL_EXIT(); @@ -390,6 +357,13 @@ MEASUREMENT_CPU_USE *evel_measurement_new_cpu_use_add(EVENT_MEASUREMENT * measur evel_init_option_double(&cpu_use->sys); evel_init_option_double(&cpu_use->user); evel_init_option_double(&cpu_use->wait); + evel_init_option_double(&cpu_use->cpuCapacityContention); + evel_init_option_double(&cpu_use->cpuDemandAvg); + evel_init_option_double(&cpu_use->cpuDemandMhz); + evel_init_option_double(&cpu_use->cpuDemandPct); + evel_init_option_double(&cpu_use->cpuLatencyAvg); + evel_init_option_double(&cpu_use->cpuOverheadAvg); + evel_init_option_double(&cpu_use->cpuSwapWaitTime); dlist_push_last(&measurement->cpu_usage, cpu_use); @@ -545,6 +519,61 @@ void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE * const cpu_use, EVEL_EXIT(); } +void evel_measurement_cpu_use_cpuCapacityContention_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&cpu_use->cpuCapacityContention, val, "time the CPU cannot run due to contention"); + EVEL_EXIT(); +} + +void evel_measurement_cpu_use_cpuDemandAvg_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&cpu_use->cpuDemandAvg, val, "The total CPU time that the NF NFC VM could use"); + EVEL_EXIT(); +} + +void evel_measurement_cpu_use_cpuDemandMhz_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&cpu_use->cpuDemandMhz, val, "CPU demand in MHz"); + EVEL_EXIT(); +} + +void evel_measurement_cpu_use_cpuDemandPct_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&cpu_use->cpuDemandPct, val, "CPU demand PCT"); + EVEL_EXIT(); +} + +void evel_measurement_cpu_use_cpuLatencyAvg_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&cpu_use->cpuLatencyAvg, val, "time the VM is unable to run"); + EVEL_EXIT(); +} + +void evel_measurement_cpu_use_cpuOverheadAvg_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&cpu_use->cpuOverheadAvg, val, "The overhead demand"); + EVEL_EXIT(); +} + +void evel_measurement_cpu_use_cpuSwapWaitTime_set(MEASUREMENT_CPU_USE * const cpu_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&cpu_use->cpuSwapWaitTime, val, "Swap wait time"); + EVEL_EXIT(); +} /**************************************************************************//** * Add an additional Memory usage value name/value pair to the Measurement. @@ -554,14 +583,17 @@ void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE * const cpu_use, * returns. * * @param measurement Pointer to the measurement. - * @param id ASCIIZ string with the Memory identifier. * @param vmidentifier ASCIIZ string with the VM's identifier. - * @param membuffsz Memory Size. + * @param memfree Memory Free + * @param memused Memory Used * * @return Returns pointer to memory use structure in measurements *****************************************************************************/ -MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measurement, - char * id, char *vmidentifier, double membuffsz) +MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add( + EVENT_MEASUREMENT * measurement, + char *vmidentifier, + double memfree, + double memused) { MEASUREMENT_MEM_USE * mem_use = NULL; EVEL_ENTER(); @@ -571,27 +603,34 @@ MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measu /***************************************************************************/ assert(measurement != NULL); assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); - assert(id != NULL); - assert(membuffsz >= 0.0); + assert(vmidentifier != NULL); /***************************************************************************/ /* Allocate a container for the value and push onto the list. */ /***************************************************************************/ - EVEL_DEBUG("Adding id=%s buffer size=%lf", id, membuffsz); + EVEL_DEBUG("Adding vmid=%s", vmidentifier); mem_use = malloc(sizeof(MEASUREMENT_MEM_USE)); assert(mem_use != NULL); memset(mem_use, 0, sizeof(MEASUREMENT_MEM_USE)); - mem_use->id = strdup(id); mem_use->vmid = strdup(vmidentifier); - mem_use->membuffsz = membuffsz; + mem_use->memfree = memfree; + mem_use->memused = memused; + evel_init_option_double(&mem_use->membuffsz); evel_init_option_double(&mem_use->memcache); evel_init_option_double(&mem_use->memconfig); - evel_init_option_double(&mem_use->memfree); evel_init_option_double(&mem_use->slabrecl); evel_init_option_double(&mem_use->slabunrecl); - evel_init_option_double(&mem_use->memused); - - assert(mem_use->id != NULL); + evel_init_option_double(&mem_use->memoryDemand); + evel_init_option_double(&mem_use->memoryLatencyAvg); + evel_init_option_double(&mem_use->memorySharedAvg); + evel_init_option_double(&mem_use->memorySwapInAvg); + evel_init_option_double(&mem_use->memorySwapInRateAvg); + evel_init_option_double(&mem_use->memorySwapOutAvg); + evel_init_option_double(&mem_use->memorySwapOutRateAvg); + evel_init_option_double(&mem_use->memorySwapUsedAvg); + evel_init_option_double(&mem_use->percentMemoryUsage); + + assert(mem_use->vmid != NULL); dlist_push_last(&measurement->mem_usage, mem_use); @@ -618,7 +657,7 @@ void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use, } /**************************************************************************//** - * Set kilobytes of memory configured in the virtual machine on which the VNFC reporting + * Set kilobytes of memory Buffered * * @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 @@ -627,16 +666,16 @@ void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use, * @param mem_use Pointer to the Memory Use. * @param val double *****************************************************************************/ -void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use, +void evel_measurement_mem_use_mem_buffered_set(MEASUREMENT_MEM_USE * const mem_use, const double val) { EVEL_ENTER(); - evel_set_option_double(&mem_use->memconfig, val, "Memory configured value"); + evel_set_option_double(&mem_use->membuffsz, val, "Memory Buffered value"); EVEL_EXIT(); } /**************************************************************************//** - * Set kilobytes of physical RAM left unused by the system + * 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 @@ -645,11 +684,11 @@ void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use, * @param mem_use Pointer to the Memory Use. * @param val double *****************************************************************************/ -void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE * const mem_use, +void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use, const double val) { EVEL_ENTER(); - evel_set_option_double(&mem_use->memfree, val, "Memory freely available value"); + evel_set_option_double(&mem_use->memconfig, val, "Memory configured value"); EVEL_EXIT(); } @@ -690,7 +729,7 @@ void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const } /**************************************************************************//** - * Set the total memory minus the sum of free, buffered, cached and slab memory in kilobytes + * Set the Host demand in kibibytes * * @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 @@ -699,11 +738,75 @@ void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const * @param mem_use Pointer to the Memory Use. * @param val double *****************************************************************************/ -void evel_measurement_mem_use_usedup_set(MEASUREMENT_MEM_USE * const mem_use, +void evel_measurement_mem_use_memoryDemand_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memoryDemand, val, "Host demand in kibibytes"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_memoryLatencyAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memoryLatencyAvg, val, "Percentage of time the VM is waiting"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_memorySharedAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memorySharedAvg, val, "Shared memory in kilobytes"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_memorySwapInAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memorySwapInAvg, val, "Amount of memory swapped-in"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_memorySwapInRateAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memorySwapInRateAvg, val, "Rate at which memory is swapped"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_memorySwapOutAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memorySwapOutAvg, val, "Amount of memory swapped-out"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_memorySwapOutRateAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memorySwapOutRateAvg, val, "Rate at which memory is being swapped out"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_memorySwapUsedAvg_set(MEASUREMENT_MEM_USE * const mem_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&mem_use->memorySwapUsedAvg, val, "Space used for caching swapped pages"); + EVEL_EXIT(); +} + +void evel_measurement_mem_use_percentMemoryUsage_set(MEASUREMENT_MEM_USE * const mem_use, const double val) { EVEL_ENTER(); - evel_set_option_double(&mem_use->memused, val, "Memory usedup total set"); + evel_set_option_double(&mem_use->percentMemoryUsage, val, "Percentage of memory usage"); EVEL_EXIT(); } @@ -781,6 +884,20 @@ MEASUREMENT_DISK_USE * evel_measurement_new_disk_use_add(EVENT_MEASUREMENT * mea evel_init_option_double(&disk_use->timewritelast ); evel_init_option_double(&disk_use->timewritemax ); evel_init_option_double(&disk_use->timewritemin ); + evel_init_option_double(&disk_use->diskBusResets ); + evel_init_option_double(&disk_use->diskCommandsAborted ); + evel_init_option_double(&disk_use->diskTime ); + evel_init_option_double(&disk_use->diskFlushRequests ); + evel_init_option_double(&disk_use->diskFlushTime ); + evel_init_option_double(&disk_use->diskCommandsAvg ); + evel_init_option_double(&disk_use->diskReadCommandsAvg ); + evel_init_option_double(&disk_use->diskWriteCommandsAvg ); + evel_init_option_double(&disk_use->diskTotalReadLatencyAvg ); + evel_init_option_double(&disk_use->diskTotalWriteLatencyAvg ); + evel_init_option_double(&disk_use->diskWeightedIoTimeAvg ); + evel_init_option_double(&disk_use->diskWeightedIoTimeLast ); + evel_init_option_double(&disk_use->diskWeightedIoTimeMax ); + evel_init_option_double(&disk_use->diskWeightedIoTimeMin ); EVEL_EXIT(); return disk_use; @@ -1532,6 +1649,132 @@ void evel_measurement_disk_use_timewritemin_set(MEASUREMENT_DISK_USE * const dis EVEL_EXIT(); } +void evel_measurement_disk_use_diskBusResets_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskBusResets, val, "diskBusResets"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskCommandsAborted_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskCommandsAborted, val, "diskCommandsAborted"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskTime_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskTime, val, "diskTime"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskFlushRequests_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskFlushRequests, val, "diskFlushRequests"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskFlushTime_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskFlushTime, val, "diskFlushTime"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskCommandsAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskCommandsAvg, val, "diskCommandsAvg"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskReadCommandsAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskReadCommandsAvg, val, "diskReadCommandsAvg"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskWriteCommandsAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskWriteCommandsAvg, val, "diskWriteCommandsAvg"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskTotalReadLatencyAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskTotalReadLatencyAvg, val, "diskTotalReadLatencyAvg"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskTotalWriteLatencyAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskTotalWriteLatencyAvg, val, "diskTotalWriteLatencyAvg"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskWeightedIoTimeAvg_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskWeightedIoTimeAvg, val, "diskWeightedIoTimeAvg"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskWeightedIoTimeLast_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskWeightedIoTimeLast, val, "diskWeightedIoTimeLast"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskWeightedIoTimeMax_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskWeightedIoTimeMax, val, "diskWeightedIoTimeMax"); + EVEL_EXIT(); +} + +void evel_measurement_disk_use_diskWeightedIoTimeMin_set( + MEASUREMENT_DISK_USE * const disk_use, + const double val) +{ + EVEL_ENTER(); + evel_set_option_double(&disk_use->diskWeightedIoTimeMin, val, "diskWeightedIoTimeMin"); + EVEL_EXIT(); +} + /**************************************************************************//** * Add an additional File System usage value name/value pair to the * Measurement. @@ -1607,9 +1850,11 @@ void evel_measurement_fsys_use_add(EVENT_MEASUREMENT * measurement, *****************************************************************************/ void evel_measurement_feature_use_add(EVENT_MEASUREMENT * measurement, char * feature, - int utilization) + char * utilization) { - MEASUREMENT_FEATURE_USE * feature_use = NULL; + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -1618,105 +1863,95 @@ void evel_measurement_feature_use_add(EVENT_MEASUREMENT * measurement, assert(measurement != NULL); assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); assert(feature != NULL); - assert(utilization >= 0); + assert(utilization != 0); /***************************************************************************/ /* Allocate a container for the value and push onto the list. */ /***************************************************************************/ - EVEL_DEBUG("Adding Feature=%s Use=%d", feature, utilization); - feature_use = malloc(sizeof(MEASUREMENT_FEATURE_USE)); - assert(feature_use != NULL); - memset(feature_use, 0, sizeof(MEASUREMENT_FEATURE_USE)); - feature_use->feature_id = strdup(feature); - assert(feature_use->feature_id != NULL); - feature_use->feature_utilization = utilization; + EVEL_DEBUG("Adding Feature=%s Use=%s", feature, utilization); + nam = strdup(feature); + val = strdup(utilization); - dlist_push_last(&measurement->feature_usage, feature_use); + ht_insert(measurement->feature_usage, nam, val); EVEL_EXIT(); } - /**************************************************************************//** - * Add a Additional Measurement value name/value pair to the Report. + * Add a new Additional Measurement hashmap 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 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. + * @param measurement Pointer to the Measurement. + * @param name ASCIIZ string containing the hashmap name *****************************************************************************/ -void evel_measurement_custom_measurement_add(EVENT_MEASUREMENT * measurement, - const char * const group, - const char * const name, - const char * const value) +HASHTABLE_T * evel_measurement_new_addl_measurement( + EVENT_MEASUREMENT * measurement, + const char * const name) { - MEASUREMENT_GROUP * measurement_group = NULL; - CUSTOM_MEASUREMENT * custom_measurement = NULL; - DLIST_ITEM * item = NULL; + HASHTABLE_T *ht; + char *nam=NULL; + EVEL_ENTER(); /***************************************************************************/ - /* Check assumptions. */ + /* Check preconditions. */ /***************************************************************************/ assert(measurement != NULL); assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); - assert(group != NULL); assert(name != NULL); - assert(value != NULL); - /***************************************************************************/ - /* Allocate a container for the name/value pair. */ - /***************************************************************************/ - EVEL_DEBUG("Adding Measurement Group=%s Name=%s Value=%s", - group, name, value); - custom_measurement = malloc(sizeof(CUSTOM_MEASUREMENT)); - assert(custom_measurement != NULL); - memset(custom_measurement, 0, sizeof(CUSTOM_MEASUREMENT)); - custom_measurement->name = strdup(name); - assert(custom_measurement->name != NULL); - custom_measurement->value = strdup(value); - assert(custom_measurement->value != NULL); + EVEL_DEBUG("Adding HashMapName to additional_measurements = %s", name); - /***************************************************************************/ - /* See if we have that group already. */ - /***************************************************************************/ - item = dlist_get_first(&measurement->additional_measurements); - while (item != NULL) - { - measurement_group = (MEASUREMENT_GROUP *) item->item; - assert(measurement_group != NULL); + nam = strdup(name); - EVEL_DEBUG("Got measurement group %s", measurement_group->name); - if (strcmp(group, measurement_group->name) == 0) - { - EVEL_DEBUG("Found existing Measurement Group"); - break; - } - item = dlist_get_next(item); - } + ht = nht_create( nam ); - /***************************************************************************/ - /* If we didn't have the group already, create it. */ - /***************************************************************************/ - if (item == NULL) + if (ht != NULL) { - EVEL_DEBUG("Creating new Measurement Group"); - measurement_group = malloc(sizeof(MEASUREMENT_GROUP)); - assert(measurement_group != NULL); - memset(measurement_group, 0, sizeof(MEASUREMENT_GROUP)); - measurement_group->name = strdup(group); - assert(measurement_group->name != NULL); - dlist_initialize(&measurement_group->measurements); - dlist_push_last(&measurement->additional_measurements, measurement_group); + dlist_push_last(&measurement->additional_measurements, ht); } + EVEL_EXIT(); + + return ht; +} + +/**************************************************************************//** + * Add a new Additional Measurement hashmap 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 ht Pointer hashmap. + * @param name ASCIIZ string containing the measurement's name. + * @param Value ASCIIZ string containing the measurement's value. + *****************************************************************************/ +void evel_measurement_addl_measurement_set ( + HASHTABLE_T * const ht, + const char * const name, + const char * const value) +{ + char *nam=NULL; + char *val=NULL; + + EVEL_ENTER(); + /***************************************************************************/ - /* If we didn't have the group already, create it. */ + /* Check preconditions. */ /***************************************************************************/ - dlist_push_last(&measurement_group->measurements, custom_measurement); + assert(ht != NULL); + assert(name != NULL); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", name, value); + + nam = strdup(name); + val = strdup(value); + + ht_insert(ht, nam, val); EVEL_EXIT(); } @@ -1971,123 +2206,372 @@ void evel_measurement_latency_add(EVENT_MEASUREMENT * const measurement, } /**************************************************************************//** - * Create a new vNIC Use to be added to a Measurement event. + * Create a new NIC Use to be added to a Measurement event. * - * @note The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied + * @note The mandatory fields on the ::MEASUREMENT_NIC_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 + * set once so that the ::MEASUREMENT_NIC_PERFORMANCE has immutable * properties. * - * @param vnic_id ASCIIZ string with the vNIC's ID. + * @param nic_id ASCIIZ string with the NIC's ID. * @param val_suspect True or false confidence in data. * - * @returns pointer to the newly manufactured ::MEASUREMENT_VNIC_PERFORMANCE. + * @returns pointer to the newly manufactured ::MEASUREMENT_NIC_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. + * ::evel_measurement_free_nic_performance. + * @retval NULL Failed to create the NIC Use. *****************************************************************************/ -MEASUREMENT_VNIC_PERFORMANCE * evel_measurement_new_vnic_performance(char * const vnic_id, +MEASUREMENT_NIC_PERFORMANCE * evel_measurement_new_nic_performance(char * const nic_id, char * const val_suspect) { - MEASUREMENT_VNIC_PERFORMANCE * vnic_performance; + MEASUREMENT_NIC_PERFORMANCE * nic_performance; EVEL_ENTER(); /***************************************************************************/ /* Check preconditions. */ /***************************************************************************/ - assert(vnic_id != NULL); + assert(nic_id != NULL); assert(!strcmp(val_suspect,"true") || !strcmp(val_suspect,"false")); /***************************************************************************/ /* Allocate, then set Mandatory Parameters. */ /***************************************************************************/ - EVEL_DEBUG("Adding VNIC ID=%s", vnic_id); - vnic_performance = malloc(sizeof(MEASUREMENT_VNIC_PERFORMANCE)); - assert(vnic_performance != NULL); - vnic_performance->vnic_id = strdup(vnic_id); - vnic_performance->valuesaresuspect = strdup(val_suspect); + EVEL_DEBUG("Adding NIC ID=%s", nic_id); + nic_performance = malloc(sizeof(MEASUREMENT_NIC_PERFORMANCE)); + assert(nic_performance != NULL); + nic_performance->nic_id = strdup(nic_id); + nic_performance->valuesaresuspect = strdup(val_suspect); /***************************************************************************/ /* Initialize Optional Parameters. */ /***************************************************************************/ - evel_init_option_double(&vnic_performance-> recvd_bcast_packets_acc); - evel_init_option_double(&vnic_performance-> recvd_bcast_packets_delta); - evel_init_option_double(&vnic_performance-> recvd_discarded_packets_acc); - evel_init_option_double(&vnic_performance-> recvd_discarded_packets_delta); - evel_init_option_double(&vnic_performance-> recvd_error_packets_acc); - evel_init_option_double(&vnic_performance-> recvd_error_packets_delta); - evel_init_option_double(&vnic_performance-> recvd_mcast_packets_acc); - evel_init_option_double(&vnic_performance-> recvd_mcast_packets_delta); - evel_init_option_double(&vnic_performance-> recvd_octets_acc); - evel_init_option_double(&vnic_performance-> recvd_octets_delta); - evel_init_option_double(&vnic_performance-> recvd_total_packets_acc); - evel_init_option_double(&vnic_performance-> recvd_total_packets_delta); - evel_init_option_double(&vnic_performance-> recvd_ucast_packets_acc); - evel_init_option_double(&vnic_performance-> recvd_ucast_packets_delta); - evel_init_option_double(&vnic_performance-> tx_bcast_packets_acc); - evel_init_option_double(&vnic_performance-> tx_bcast_packets_delta); - evel_init_option_double(&vnic_performance-> tx_discarded_packets_acc); - evel_init_option_double(&vnic_performance-> tx_discarded_packets_delta); - evel_init_option_double(&vnic_performance-> tx_error_packets_acc); - evel_init_option_double(&vnic_performance-> tx_error_packets_delta); - evel_init_option_double(&vnic_performance-> tx_mcast_packets_acc); - evel_init_option_double(&vnic_performance-> tx_mcast_packets_delta); - evel_init_option_double(&vnic_performance-> tx_octets_acc); - evel_init_option_double(&vnic_performance-> tx_octets_delta); - evel_init_option_double(&vnic_performance-> tx_total_packets_acc); - evel_init_option_double(&vnic_performance-> tx_total_packets_delta); - evel_init_option_double(&vnic_performance-> tx_ucast_packets_acc); - evel_init_option_double(&vnic_performance-> tx_ucast_packets_delta); - - EVEL_EXIT(); - - return vnic_performance; -} - -/**************************************************************************//** - * Free a vNIC Use. - * - * Free off the ::MEASUREMENT_VNIC_PERFORMANCE supplied. Will free all the contained + evel_init_option_op_state(&nic_performance-> administrativeState); + evel_init_option_op_state(&nic_performance-> operationalState); + evel_init_option_double(&nic_performance-> receivedPercentDiscard); + evel_init_option_double(&nic_performance-> receivedPercentError); + evel_init_option_double(&nic_performance-> receivedUtilization); + evel_init_option_double(&nic_performance-> speed); + evel_init_option_double(&nic_performance-> transmittedPercentDiscard); + evel_init_option_double(&nic_performance-> transmittedPercentError); + evel_init_option_double(&nic_performance-> transmittedUtilization); + evel_init_option_double(&nic_performance-> recvd_bcast_packets_acc); + evel_init_option_double(&nic_performance-> recvd_bcast_packets_delta); + evel_init_option_double(&nic_performance-> recvd_discarded_packets_acc); + evel_init_option_double(&nic_performance-> recvd_discarded_packets_delta); + evel_init_option_double(&nic_performance-> recvd_error_packets_acc); + evel_init_option_double(&nic_performance-> recvd_error_packets_delta); + evel_init_option_double(&nic_performance-> recvd_mcast_packets_acc); + evel_init_option_double(&nic_performance-> recvd_mcast_packets_delta); + evel_init_option_double(&nic_performance-> recvd_octets_acc); + evel_init_option_double(&nic_performance-> recvd_octets_delta); + evel_init_option_double(&nic_performance-> recvd_total_packets_acc); + evel_init_option_double(&nic_performance-> recvd_total_packets_delta); + evel_init_option_double(&nic_performance-> recvd_ucast_packets_acc); + evel_init_option_double(&nic_performance-> recvd_ucast_packets_delta); + evel_init_option_double(&nic_performance-> tx_bcast_packets_acc); + evel_init_option_double(&nic_performance-> tx_bcast_packets_delta); + evel_init_option_double(&nic_performance-> tx_discarded_packets_acc); + evel_init_option_double(&nic_performance-> tx_discarded_packets_delta); + evel_init_option_double(&nic_performance-> tx_error_packets_acc); + evel_init_option_double(&nic_performance-> tx_error_packets_delta); + evel_init_option_double(&nic_performance-> tx_mcast_packets_acc); + evel_init_option_double(&nic_performance-> tx_mcast_packets_delta); + evel_init_option_double(&nic_performance-> tx_octets_acc); + evel_init_option_double(&nic_performance-> tx_octets_delta); + evel_init_option_double(&nic_performance-> tx_total_packets_acc); + evel_init_option_double(&nic_performance-> tx_total_packets_delta); + evel_init_option_double(&nic_performance-> tx_ucast_packets_acc); + evel_init_option_double(&nic_performance-> tx_ucast_packets_delta); + + EVEL_EXIT(); + + return nic_performance; +} + +/**************************************************************************//** + * Free a NIC Use. + * + * Free off the ::MEASUREMENT_NIC_PERFORMANCE supplied. Will free all the contained * allocated memory. * - * @note It does not free the vNIC Use itself, since that may be part of a + * @note It does not free the NIC Use itself, since that may be part of a * larger structure. *****************************************************************************/ -void evel_measurement_free_vnic_performance(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance) +void evel_measurement_free_nic_performance(MEASUREMENT_NIC_PERFORMANCE * const nic_performance) { EVEL_ENTER(); /***************************************************************************/ /* Check preconditions. */ /***************************************************************************/ - assert(vnic_performance != NULL); - assert(vnic_performance->vnic_id != NULL); - assert(vnic_performance->valuesaresuspect != NULL); + assert(nic_performance != NULL); + assert(nic_performance->nic_id != NULL); + assert(nic_performance->valuesaresuspect != NULL); /***************************************************************************/ /* Free the duplicated string. */ /***************************************************************************/ - free(vnic_performance->vnic_id); - free(vnic_performance->valuesaresuspect); - vnic_performance->vnic_id = NULL; + free(nic_performance->nic_id); + free(nic_performance->valuesaresuspect); + nic_performance->nic_id = NULL; + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the administrative State of the NIC 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 nic_performance Pointer to the NIC Use. + * @param state + *****************************************************************************/ +void evel_nic_performance_administrativeState_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const EVEL_OPER_STATE state) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(nic_performance != NULL); + assert(state < EVEL_MAX_OPER_STATES); + + evel_set_option_op_state(&nic_performance->administrativeState, state, "Administrative State"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the operational state of the NIC 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 nic_performance Pointer to the NIC Use. + * @param state + *****************************************************************************/ +void evel_nic_performance_operationalState_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const EVEL_OPER_STATE state) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(nic_performance != NULL); + assert(state < EVEL_MAX_OPER_STATES); + + evel_set_option_op_state(&nic_performance->operationalState, state, "Operational State"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Percentage of discarded packets received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param receivedPercentDiscard + *****************************************************************************/ +void evel_nic_performance_receivedPercentDiscard_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double receivedPercentDiscard) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(receivedPercentDiscard >= 0.0); + + evel_set_option_double(&nic_performance->receivedPercentDiscard, + receivedPercentDiscard, + "Percentage of discarded packets received"); + + EVEL_EXIT(); +} +/**************************************************************************//** + * Set the Percentage of error packets received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param receivedPercentError + *****************************************************************************/ +void evel_nic_performance_receivedPercentError_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double receivedPercentError) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(receivedPercentError >= 0.0); + + evel_set_option_double(&nic_performance->receivedPercentError, + receivedPercentError, + "Percentage of error packets received"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Percentage of utilization received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param receivedUtilization + *****************************************************************************/ +void evel_nic_performance_receivedUtilization_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double receivedUtilization) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(receivedUtilization >= 0.0); + + evel_set_option_double(&nic_performance->receivedUtilization, + receivedUtilization, + "Percentage of utilization received"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Speed configured in mbps of the NIC 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 nic_performance Pointer to the NIC Use. + * @param Speed + *****************************************************************************/ +void evel_nic_performance_speed_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double speed) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(speed >= 0.0); + + evel_set_option_double(&nic_performance->speed, + speed, + "Speed configured in mbps"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Percentage of discarded packets transmitted of the NIC 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 nic_performance Pointer to the NIC Use. + * @param transmittedPercentDiscard + *****************************************************************************/ +void evel_nic_performance_transmittedPercentDiscard_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double transmittedPercentDiscard) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(transmittedPercentDiscard >= 0.0); + + evel_set_option_double(&nic_performance->transmittedPercentDiscard, + transmittedPercentDiscard, + "Percentage of discarded packets transmitted"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Percentage of error packets received of the NIC 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 nic_performance Pointer to the NIC Use. + * @param transmittedPercentError + *****************************************************************************/ +void evel_nic_performance_transmittedPercentError_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double transmittedPercentError) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(transmittedPercentError >= 0.0); + + evel_set_option_double(&nic_performance->transmittedPercentError, + transmittedPercentError, + "Percentage of error packets received"); + + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Percentage of utilization transmitted of the NIC 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 nic_performance Pointer to the NIC Use. + * @param transmittedUtilization + *****************************************************************************/ +void evel_nic_performance_transmittedUtilization_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double transmittedUtilization) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(transmittedUtilization >= 0.0); + + evel_set_option_double(&nic_performance->transmittedUtilization, + transmittedUtilization, + "Percentage of utilization transmitted"); EVEL_EXIT(); } /**************************************************************************//** * Set the Accumulated Broadcast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_bcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_bcast_packets_acc) { EVEL_ENTER(); @@ -2097,7 +2581,7 @@ void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(recvd_bcast_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->recvd_bcast_packets_acc, + evel_set_option_double(&nic_performance->recvd_bcast_packets_acc, recvd_bcast_packets_acc, "Broadcast Packets accumulated"); @@ -2106,16 +2590,16 @@ void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Broadcast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_bcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_bcast_packets_delta) { EVEL_ENTER(); @@ -2125,7 +2609,7 @@ void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(recvd_bcast_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->recvd_bcast_packets_delta, + evel_set_option_double(&nic_performance->recvd_bcast_packets_delta, recvd_bcast_packets_delta, "Delta Broadcast Packets recieved"); @@ -2135,16 +2619,16 @@ void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Discarded Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_discard_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_discard_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_discard_packets_acc) { EVEL_ENTER(); @@ -2154,7 +2638,7 @@ void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(recvd_discard_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->recvd_discarded_packets_acc, + evel_set_option_double(&nic_performance->recvd_discarded_packets_acc, recvd_discard_packets_acc, "Discarded Packets accumulated"); @@ -2163,16 +2647,16 @@ void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Delta Discarded Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_discard_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_discard_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_discard_packets_delta) { EVEL_ENTER(); @@ -2182,7 +2666,7 @@ void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE /***************************************************************************/ assert(recvd_discard_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->recvd_discarded_packets_delta, + evel_set_option_double(&nic_performance->recvd_discarded_packets_delta, recvd_discard_packets_delta, "Delta Discarded Packets recieved"); @@ -2192,16 +2676,16 @@ void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE /**************************************************************************//** * Set the Error Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_error_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_error_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_error_packets_acc) { EVEL_ENTER(); @@ -2211,7 +2695,7 @@ void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(recvd_error_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->recvd_error_packets_acc, + evel_set_option_double(&nic_performance->recvd_error_packets_acc, recvd_error_packets_acc, "Error Packets received accumulated"); @@ -2220,16 +2704,16 @@ void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Error Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_error_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_error_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_error_packets_delta) { EVEL_ENTER(); @@ -2239,7 +2723,7 @@ void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(recvd_error_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->recvd_error_packets_delta, + evel_set_option_double(&nic_performance->recvd_error_packets_delta, recvd_error_packets_delta, "Delta Error Packets recieved"); @@ -2248,16 +2732,16 @@ void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Accumulated Multicast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_mcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_mcast_packets_acc) { EVEL_ENTER(); @@ -2267,7 +2751,7 @@ void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(recvd_mcast_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->recvd_mcast_packets_acc, + evel_set_option_double(&nic_performance->recvd_mcast_packets_acc, recvd_mcast_packets_acc, "Multicast Packets accumulated"); @@ -2276,16 +2760,16 @@ void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Multicast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_mcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_mcast_packets_delta) { EVEL_ENTER(); @@ -2295,7 +2779,7 @@ void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(recvd_mcast_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->recvd_mcast_packets_delta, + evel_set_option_double(&nic_performance->recvd_mcast_packets_delta, recvd_mcast_packets_delta, "Delta Multicast Packets recieved"); @@ -2304,16 +2788,16 @@ void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Accumulated Octets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_octets_acc *****************************************************************************/ -void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_octets_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_octets_acc) { EVEL_ENTER(); @@ -2323,7 +2807,7 @@ void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * cons /***************************************************************************/ assert(recvd_octets_acc >= 0.0); - evel_set_option_double(&vnic_performance->recvd_octets_acc, + evel_set_option_double(&nic_performance->recvd_octets_acc, recvd_octets_acc, "Octets received accumulated"); @@ -2332,16 +2816,16 @@ void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * cons /**************************************************************************//** * Set the Delta Octets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_octets_delta *****************************************************************************/ -void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_octets_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_octets_delta) { EVEL_ENTER(); @@ -2351,7 +2835,7 @@ void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * co /***************************************************************************/ assert(recvd_octets_delta >= 0.0); - evel_set_option_double(&vnic_performance->recvd_octets_delta, + evel_set_option_double(&nic_performance->recvd_octets_delta, recvd_octets_delta, "Delta Octets recieved"); @@ -2360,16 +2844,16 @@ void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * co /**************************************************************************//** * Set the Accumulated Total Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_total_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_total_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_total_packets_acc) { EVEL_ENTER(); @@ -2379,7 +2863,7 @@ void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(recvd_total_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->recvd_total_packets_acc, + evel_set_option_double(&nic_performance->recvd_total_packets_acc, recvd_total_packets_acc, "Total Packets accumulated"); @@ -2388,16 +2872,16 @@ void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Total Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_total_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_total_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_total_packets_delta) { EVEL_ENTER(); @@ -2407,7 +2891,7 @@ void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(recvd_total_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->recvd_total_packets_delta, + evel_set_option_double(&nic_performance->recvd_total_packets_delta, recvd_total_packets_delta, "Delta Total Packets recieved"); @@ -2416,16 +2900,16 @@ void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Accumulated Unicast Packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_ucast_packets_acc *****************************************************************************/ -void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_ucast_packets_acc) { EVEL_ENTER(); @@ -2435,7 +2919,7 @@ void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(recvd_ucast_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->recvd_ucast_packets_acc, + evel_set_option_double(&nic_performance->recvd_ucast_packets_acc, recvd_ucast_packets_acc, "Unicast Packets received accumulated"); @@ -2444,16 +2928,16 @@ void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Unicast packets Received in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param recvd_ucast_packets_delta *****************************************************************************/ -void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double recvd_ucast_packets_delta) { EVEL_ENTER(); @@ -2463,7 +2947,7 @@ void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(recvd_ucast_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->recvd_ucast_packets_delta, + evel_set_option_double(&nic_performance->recvd_ucast_packets_delta, recvd_ucast_packets_delta, "Delta Unicast packets recieved"); @@ -2472,16 +2956,16 @@ void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Transmitted Broadcast Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_bcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_bcast_packets_acc) { EVEL_ENTER(); @@ -2491,7 +2975,7 @@ void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(tx_bcast_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->tx_bcast_packets_acc, + evel_set_option_double(&nic_performance->tx_bcast_packets_acc, tx_bcast_packets_acc, "Transmitted Broadcast Packets accumulated"); @@ -2500,16 +2984,16 @@ void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Broadcast packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_bcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_bcast_packets_delta) { EVEL_ENTER(); @@ -2519,7 +3003,7 @@ void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(tx_bcast_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->tx_bcast_packets_delta, + evel_set_option_double(&nic_performance->tx_bcast_packets_delta, tx_bcast_packets_delta, "Delta Transmitted Broadcast packets "); @@ -2528,16 +3012,16 @@ void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Transmitted Discarded Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_discarded_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_discarded_packets_acc) { EVEL_ENTER(); @@ -2547,7 +3031,7 @@ void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE /***************************************************************************/ assert(tx_discarded_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->tx_discarded_packets_acc, + evel_set_option_double(&nic_performance->tx_discarded_packets_acc, tx_discarded_packets_acc, "Transmitted Discarded Packets accumulated"); @@ -2556,16 +3040,16 @@ void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE /**************************************************************************//** * Set the Delta Discarded packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_discarded_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_discarded_packets_delta) { EVEL_ENTER(); @@ -2575,7 +3059,7 @@ void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMAN /***************************************************************************/ assert(tx_discarded_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->tx_discarded_packets_delta, + evel_set_option_double(&nic_performance->tx_discarded_packets_delta, tx_discarded_packets_delta, "Delta Transmitted Discarded packets "); @@ -2584,16 +3068,16 @@ void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMAN /**************************************************************************//** * Set the Transmitted Errored Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_error_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_error_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_error_packets_acc) { EVEL_ENTER(); @@ -2603,7 +3087,7 @@ void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(tx_error_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->tx_error_packets_acc, + evel_set_option_double(&nic_performance->tx_error_packets_acc, tx_error_packets_acc, "Transmitted Error Packets accumulated"); @@ -2612,16 +3096,16 @@ void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Errored packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_error_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_error_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_error_packets_delta) { EVEL_ENTER(); @@ -2631,7 +3115,7 @@ void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(tx_error_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->tx_error_packets_delta, + evel_set_option_double(&nic_performance->tx_error_packets_delta, tx_error_packets_delta, "Delta Transmitted Error packets "); @@ -2640,16 +3124,16 @@ void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Transmitted Multicast Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_mcast_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_mcast_packets_acc) { EVEL_ENTER(); @@ -2659,7 +3143,7 @@ void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(tx_mcast_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->tx_mcast_packets_acc, + evel_set_option_double(&nic_performance->tx_mcast_packets_acc, tx_mcast_packets_acc, "Transmitted Multicast Packets accumulated"); @@ -2668,16 +3152,16 @@ void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Multicast packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_mcast_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_mcast_packets_delta) { EVEL_ENTER(); @@ -2687,7 +3171,7 @@ void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(tx_mcast_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->tx_mcast_packets_delta, + evel_set_option_double(&nic_performance->tx_mcast_packets_delta, tx_mcast_packets_delta, "Delta Transmitted Multicast packets "); @@ -2696,16 +3180,16 @@ void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Transmitted Octets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_octets_acc *****************************************************************************/ -void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_octets_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_octets_acc) { EVEL_ENTER(); @@ -2715,7 +3199,7 @@ void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * cons /***************************************************************************/ assert(tx_octets_acc >= 0.0); - evel_set_option_double(&vnic_performance->tx_octets_acc, + evel_set_option_double(&nic_performance->tx_octets_acc, tx_octets_acc, "Transmitted Octets accumulated"); @@ -2724,16 +3208,16 @@ void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * cons /**************************************************************************//** * Set the Delta Octets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_octets_delta *****************************************************************************/ -void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_octets_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_octets_delta) { EVEL_ENTER(); @@ -2743,7 +3227,7 @@ void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * co /***************************************************************************/ assert(tx_octets_delta >= 0.0); - evel_set_option_double(&vnic_performance->tx_octets_delta, + evel_set_option_double(&nic_performance->tx_octets_delta, tx_octets_delta, "Delta Transmitted Octets "); @@ -2753,16 +3237,16 @@ void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * co /**************************************************************************//** * Set the Transmitted Total Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_total_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_total_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_total_packets_acc) { EVEL_ENTER(); @@ -2772,7 +3256,7 @@ void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /***************************************************************************/ assert(tx_total_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->tx_total_packets_acc, + evel_set_option_double(&nic_performance->tx_total_packets_acc, tx_total_packets_acc, "Transmitted Total Packets accumulated"); @@ -2781,16 +3265,16 @@ void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Total Packets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_total_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_total_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_total_packets_delta) { EVEL_ENTER(); @@ -2800,7 +3284,7 @@ void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(tx_total_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->tx_total_packets_delta, + evel_set_option_double(&nic_performance->tx_total_packets_delta, tx_total_packets_delta, "Delta Transmitted Total Packets "); @@ -2810,27 +3294,27 @@ void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** * Set the Transmitted Unicast Packets in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_ucast_packets_acc *****************************************************************************/ -void evel_vnic_performance_tx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, - const double tx_ucast_packets_acc) +void evel_nic_performance_tx_ucast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, + const double mtx_ucast_packets_acc) { EVEL_ENTER(); /***************************************************************************/ /* Check preconditions. */ /***************************************************************************/ - assert(tx_ucast_packets_acc >= 0.0); + assert(mtx_ucast_packets_acc >= 0.0); - evel_set_option_double(&vnic_performance->tx_ucast_packets_acc, - tx_ucast_packets_acc, + evel_set_option_double(&nic_performance->tx_ucast_packets_acc, + mtx_ucast_packets_acc, "Transmitted Unicast Packets accumulated"); EVEL_EXIT(); @@ -2838,16 +3322,16 @@ void evel_vnic_performance_tx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * c /**************************************************************************//** * Set the Delta Octets Transmitted in measurement interval - * property of the vNIC performance. + * property of the NIC 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 nic_performance Pointer to the NIC Use. * @param tx_ucast_packets_delta *****************************************************************************/ -void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance, +void evel_nic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE * const nic_performance, const double tx_ucast_packets_delta) { EVEL_ENTER(); @@ -2857,7 +3341,7 @@ void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /***************************************************************************/ assert(tx_ucast_packets_delta >= 0.0); - evel_set_option_double(&vnic_performance->tx_ucast_packets_delta, + evel_set_option_double(&nic_performance->tx_ucast_packets_delta, tx_ucast_packets_delta, "Delta Transmitted Unicast Packets "); @@ -2866,13 +3350,13 @@ void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * /**************************************************************************//** - * Add an additional vNIC Use to the specified Measurement event. + * Add an additional NIC Use to the specified Measurement event. * * @param measurement Pointer to the measurement. - * @param vnic_performance Pointer to the vNIC Use to add. + * @param nic_performance Pointer to the NIC Use to add. *****************************************************************************/ -void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement, - MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance) +void evel_meas_nic_performance_add(EVENT_MEASUREMENT * const measurement, + MEASUREMENT_NIC_PERFORMANCE * const nic_performance) { EVEL_ENTER(); @@ -2881,15 +3365,15 @@ void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement, /***************************************************************************/ assert(measurement != NULL); assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); - assert(vnic_performance != NULL); + assert(nic_performance != NULL); - dlist_push_last(&measurement->vnic_usage, vnic_performance); + dlist_push_last(&measurement->nic_performance, nic_performance); EVEL_EXIT(); } /**************************************************************************//** - * Add an additional vNIC usage record Measurement. + * Add an additional NIC usage record Measurement. * * This function implements the previous API, purely for convenience. * @@ -2897,8 +3381,17 @@ void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement, * 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 nic_id ASCIIZ string with the NIC's ID. * @param valset true or false confidence level + * @param admin_state Administrative state + * @param op_state Operational state + * @param receivedPercentDiscard Percentage of discarded packets received; + * @param receivedPercentError Percentage of error packets received + * @param receivedUtilization Percentage of utilization received + * @param speed Speed configured in mbps + * @param transmittedPercentDiscard Percentage of discarded packets transmitted + * @param transmittedPercentError Percentage of error packets received + * @param transmittedUtilization Percentage of utilization transmitted * @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 @@ -2928,9 +3421,18 @@ void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement, * @param tx_ucast_packets_acc Transmitted Unicast packets * @param tx_ucast_packets_delta Transmitted delta Unicast packets *****************************************************************************/ -void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement, - char * const vnic_id, +void evel_measurement_nic_performance_add(EVENT_MEASUREMENT * const measurement, + char * const nic_id, char * valset, + EVEL_OPER_STATE admin_state, + EVEL_OPER_STATE op_state, + double receivedPercentDiscard, + double receivedPercentError, + double receivedUtilization, + double speed, + double transmittedPercentDiscard, + double transmittedPercentError, + double transmittedUtilization, double recvd_bcast_packets_acc, double recvd_bcast_packets_delta, double recvd_discarded_packets_acc, @@ -2960,43 +3462,1388 @@ void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement double tx_ucast_packets_acc, double tx_ucast_packets_delta) { - MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL; + MEASUREMENT_NIC_PERFORMANCE * nic_performance = NULL; EVEL_ENTER(); /***************************************************************************/ /* Trust the assertions in the underlying methods. */ /***************************************************************************/ - vnic_performance = evel_measurement_new_vnic_performance(vnic_id, valset); + nic_performance = evel_measurement_new_nic_performance(nic_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); - evel_meas_vnic_performance_add(measurement, vnic_performance); + evel_nic_performance_administrativeState_set(nic_performance, admin_state); + evel_nic_performance_operationalState_set(nic_performance, op_state); + evel_nic_performance_receivedPercentDiscard_set(nic_performance, receivedPercentDiscard); + evel_nic_performance_receivedPercentError_set(nic_performance, receivedPercentError); + evel_nic_performance_receivedUtilization_set(nic_performance, receivedUtilization); + evel_nic_performance_speed_set(nic_performance, speed); + evel_nic_performance_transmittedPercentDiscard_set(nic_performance, transmittedPercentDiscard); + evel_nic_performance_transmittedPercentError_set(nic_performance, transmittedPercentError); + evel_nic_performance_transmittedUtilization_set(nic_performance, transmittedUtilization); + evel_nic_performance_rx_bcast_pkt_acc_set(nic_performance, recvd_bcast_packets_acc); + evel_nic_performance_rx_bcast_pkt_delta_set(nic_performance, recvd_bcast_packets_delta); + evel_nic_performance_rx_discard_pkt_acc_set(nic_performance, recvd_discarded_packets_acc); + evel_nic_performance_rx_discard_pkt_delta_set(nic_performance, recvd_discarded_packets_delta); + evel_nic_performance_rx_error_pkt_acc_set(nic_performance, recvd_error_packets_acc); + evel_nic_performance_rx_error_pkt_delta_set(nic_performance, recvd_error_packets_delta); + evel_nic_performance_rx_mcast_pkt_acc_set(nic_performance, recvd_mcast_packets_acc); + evel_nic_performance_rx_mcast_pkt_delta_set(nic_performance, recvd_mcast_packets_delta); + evel_nic_performance_rx_octets_acc_set(nic_performance, recvd_octets_acc); + evel_nic_performance_rx_octets_delta_set(nic_performance, recvd_octets_delta); + evel_nic_performance_rx_total_pkt_acc_set(nic_performance, recvd_total_packets_acc); + evel_nic_performance_rx_total_pkt_delta_set(nic_performance, recvd_total_packets_delta); + evel_nic_performance_rx_ucast_pkt_acc_set(nic_performance, recvd_ucast_packets_acc); + evel_nic_performance_rx_ucast_pkt_delta_set(nic_performance, recvd_ucast_packets_delta); + evel_nic_performance_tx_bcast_pkt_acc_set(nic_performance, tx_bcast_packets_acc); + evel_nic_performance_tx_bcast_pkt_delta_set(nic_performance, tx_bcast_packets_delta); + evel_nic_performance_tx_discarded_pkt_acc_set(nic_performance, tx_discarded_packets_acc); + evel_nic_performance_tx_discarded_pkt_delta_set(nic_performance, tx_discarded_packets_delta); + evel_nic_performance_tx_error_pkt_acc_set(nic_performance, tx_error_packets_acc); + evel_nic_performance_tx_error_pkt_delta_set(nic_performance, tx_error_packets_delta); + evel_nic_performance_tx_mcast_pkt_acc_set(nic_performance, tx_mcast_packets_acc); + evel_nic_performance_tx_mcast_pkt_delta_set(nic_performance, tx_mcast_packets_delta); + evel_nic_performance_tx_octets_acc_set(nic_performance, tx_octets_acc); + evel_nic_performance_tx_octets_delta_set(nic_performance, tx_octets_delta); + evel_nic_performance_tx_total_pkt_acc_set(nic_performance, tx_total_packets_acc); + evel_nic_performance_tx_total_pkt_delta_set(nic_performance, tx_total_packets_delta); + evel_nic_performance_tx_ucast_pkt_acc_set(nic_performance, tx_ucast_packets_acc); + evel_nic_performance_tx_ucast_pkt_delta_set(nic_performance, tx_ucast_packets_delta); + evel_meas_nic_performance_add(measurement, nic_performance); +} + +MEASUREMENT_IPMI * evel_measurement_new_ipmi_add( + EVENT_MEASUREMENT * measurement) +{ + MEASUREMENT_IPMI *ipmi = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(measurement != NULL); + assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + ipmi = malloc(sizeof(MEASUREMENT_IPMI)); + assert(ipmi != NULL); + memset(ipmi, 0, sizeof(MEASUREMENT_IPMI)); + + evel_init_option_double(&ipmi->exitAirTemperature); + evel_init_option_double(&ipmi->frontPanelTemperature); + evel_init_option_double(&ipmi->ioModuleTemperature); + evel_init_option_double(&ipmi->systemAirflow); + + dlist_initialize(&ipmi->ipmi_base_board_temparature); + dlist_initialize(&ipmi->ipmi_base_board_voltage); + dlist_initialize(&ipmi->ipmi_battery); + dlist_initialize(&ipmi->ipmi_fan); + dlist_initialize(&ipmi->ipmi_hsbp); + dlist_initialize(&ipmi->ipmi_global_agg_temp_margin); + dlist_initialize(&ipmi->ipmi_nic); + dlist_initialize(&ipmi->ipmi_power); + dlist_initialize(&ipmi->ipmi_processor); + + dlist_push_last(&measurement->ipmis, ipmi); + + EVEL_EXIT(); + return ipmi; +} + +/**************************************************************************//** + * Set the System fan exit air flow temperature in Celsius of IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param double + *****************************************************************************/ +void evel_measurement_ipmi_exitAirTemperature_set(MEASUREMENT_IPMI *ipmi, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + evel_set_option_double(&ipmi->exitAirTemperature, val, "exitAirTemperature"); + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Front panel temp in Celsius of IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param double + *****************************************************************************/ +void evel_measurement_ipmi_frontPanelTemperature_set(MEASUREMENT_IPMI *ipmi, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + evel_set_option_double(&ipmi->frontPanelTemperature, val, "frontPanelTemperature"); + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Io module temp in Celsius of IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param double + *****************************************************************************/ +void evel_measurement_ipmi_ioModuleTemperature_set(MEASUREMENT_IPMI *ipmi, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + evel_set_option_double(&ipmi->ioModuleTemperature, val, "ioModuleTemperature"); + EVEL_EXIT(); +} + +/**************************************************************************//** + * Set the Airflow in cubic feet per minute (cfm) of IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param double + *****************************************************************************/ +void evel_measurement_ipmi_systemAirflow_set(MEASUREMENT_IPMI *ipmi, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + evel_set_option_double(&ipmi->systemAirflow, val, "systemAirflow"); + EVEL_EXIT(); +} + +/**************************************************************************//** + * Add a new Baseboard Temperature Array element to IPMI + * + * @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 ipmi Pointer to the IPMI Use. + * @param id Indentifier + *****************************************************************************/ +MEASUREMENT_IPMI_BB_TEMPERATURE *evel_measurement_new_base_board_temp_add( + MEASUREMENT_IPMI * ipmi, + char * id) +{ + MEASUREMENT_IPMI_BB_TEMPERATURE * bb_temp = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + bb_temp = malloc(sizeof(MEASUREMENT_IPMI_BB_TEMPERATURE)); + assert(bb_temp != NULL); + memset(bb_temp, 0, sizeof(MEASUREMENT_IPMI_BB_TEMPERATURE)); + bb_temp->BBTemperatureID = strdup(id); + evel_init_option_double(&bb_temp->BBTemperature); + + dlist_push_last(&ipmi->ipmi_base_board_temparature, bb_temp); + + EVEL_EXIT(); + return bb_temp; +} + + +void evel_measurement_ipmi_bb_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BB_TEMPERATURE * bb_temp, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(bb_temp != NULL); + evel_set_option_double(&bb_temp->BBTemperature, val, "Base Board Temperature"); + EVEL_EXIT(); +} + + +MEASUREMENT_IPMI_BB_VOLTAGE *evel_measurement_new_base_board_volt_add( + MEASUREMENT_IPMI * ipmi, + const char const * id) +{ + MEASUREMENT_IPMI_BB_VOLTAGE * bb_volt = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + bb_volt = malloc(sizeof(MEASUREMENT_IPMI_BB_VOLTAGE)); + assert(bb_volt != NULL); + assert(id != NULL); + memset(bb_volt, 0, sizeof(MEASUREMENT_IPMI_BB_VOLTAGE)); + + bb_volt->BBVoltageRegID = strdup(id); + evel_init_option_double(&bb_volt->voltageRegTemperature); + + dlist_push_last(&ipmi->ipmi_base_board_voltage, bb_volt); + + EVEL_EXIT(); + return bb_volt; +} + + +void evel_measurement_ipmi_bb_volt_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BB_VOLTAGE * bb_volt, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(bb_volt != NULL); + evel_set_option_double(&bb_volt->voltageRegTemperature, val, "Voltage Regulator Temperature"); + EVEL_EXIT(); +} + + + +MEASUREMENT_IPMI_BATTERY *evel_measurement_new_ipmi_battery_add( + MEASUREMENT_IPMI * ipmi, + char * id) +{ + MEASUREMENT_IPMI_BATTERY * ipmi_battery = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + ipmi_battery = malloc(sizeof(MEASUREMENT_IPMI_BATTERY)); + assert(ipmi_battery != NULL); + memset(ipmi_battery, 0, sizeof(MEASUREMENT_IPMI_BATTERY)); + ipmi_battery->batteryIdentifier = strdup(id); + evel_init_option_string(&ipmi_battery->batteryType); + evel_init_option_double(&ipmi_battery->batteryVoltageLevel); + + dlist_push_last(&ipmi->ipmi_battery, ipmi_battery); + + EVEL_EXIT(); + return ipmi_battery; +} + + +void evel_measurement_ipmi_battery_type_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BATTERY * ipmiBattery, + const char * const batteryType) +{ + + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmiBattery != NULL); + assert(batteryType != NULL); + evel_set_option_string(&ipmiBattery->batteryType, batteryType, "Battery type"); + EVEL_EXIT(); +} + + + +void evel_measurement_ipmi_battery_voltage_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_BATTERY * ipmiBattery, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmiBattery != NULL); + evel_set_option_double(&ipmiBattery->batteryVoltageLevel, val, "Battery Voltage Level"); + EVEL_EXIT(); +} + + + +MEASUREMENT_IPMI_FAN *evel_measurement_new_ipmi_fan_add( + MEASUREMENT_IPMI * ipmi, + char * id) +{ + MEASUREMENT_IPMI_FAN * ipmi_fan = NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + ipmi_fan = malloc(sizeof(MEASUREMENT_IPMI_FAN)); + assert(ipmi_fan != NULL); + memset(ipmi_fan, 0, sizeof(MEASUREMENT_IPMI_FAN)); + ipmi_fan->fanIdentifier = strdup(id); + evel_init_option_double(&ipmi_fan->fanSpeed); + + dlist_push_last(&ipmi->ipmi_fan, ipmi_fan); + + EVEL_EXIT(); + return ipmi_fan; +} + + +void evel_measurement_ipmi_fan_speed_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_FAN * ipmiFan, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmiFan != NULL); + evel_set_option_double(&ipmiFan->fanSpeed, val, "Fan Speed"); + EVEL_EXIT(); +} + + + +MEASUREMENT_IPMI_HSBP *evel_measurement_new_ipmi_hsbp_add( + MEASUREMENT_IPMI * ipmi, + char * id) +{ + MEASUREMENT_IPMI_HSBP * ipmi_hsbp = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + ipmi_hsbp = malloc(sizeof(MEASUREMENT_IPMI_HSBP)); + assert(ipmi_hsbp != NULL); + memset(ipmi_hsbp, 0, sizeof(MEASUREMENT_IPMI_HSBP)); + ipmi_hsbp->hsbpIdentifier = strdup(id); + evel_init_option_double(&ipmi_hsbp->hsbpTemperature); + + dlist_push_last(&ipmi->ipmi_hsbp, ipmi_hsbp); + + EVEL_EXIT(); + return ipmi_hsbp; +} + + +void evel_measurement_ipmi_hsbp_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_HSBP * ipmiHsbp, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmiHsbp != NULL); + evel_set_option_double(&ipmiHsbp->hsbpTemperature, val, "HSBP Temperature"); + EVEL_EXIT(); +} + + +MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN *evel_measurement_new_ipmi_global_temp_add( + MEASUREMENT_IPMI * ipmi, + const char * const id) +{ + MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN * global_temp = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + global_temp = malloc(sizeof(MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN)); + assert(global_temp != NULL); + memset(global_temp, 0, sizeof(MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN)); + global_temp->globalAggTempID = strdup(id); + evel_init_option_double(&global_temp->globalAggTempMargin); + + dlist_push_last(&ipmi->ipmi_global_agg_temp_margin, global_temp); + + EVEL_EXIT(); + return global_temp; +} + +void evel_measurement_ipmi_global_temp_margin_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN * ipmig_temp, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmig_temp != NULL); + evel_set_option_double(&ipmig_temp->globalAggTempMargin, val, "Global Aggregate Temperature Margin"); + EVEL_EXIT(); +} + + +MEASUREMENT_IPMI_NIC *evel_measurement_new_ipmi_nic_add( + MEASUREMENT_IPMI * ipmi, + char * id) +{ + MEASUREMENT_IPMI_NIC * ipmi_nic = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + ipmi_nic = malloc(sizeof(MEASUREMENT_IPMI_NIC)); + assert(ipmi_nic != NULL); + memset(ipmi_nic, 0, sizeof(MEASUREMENT_IPMI_NIC)); + ipmi_nic->nicIdentifier = strdup(id); + evel_init_option_double(&ipmi_nic->nicTemperature); + + dlist_push_last(&ipmi->ipmi_nic, ipmi_nic); + + EVEL_EXIT(); + return ipmi_nic; +} + + +void evel_measurement_ipmi_nic_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_NIC * ipminic, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipminic != NULL); + evel_set_option_double(&ipminic->nicTemperature, val, "NIC Temperature"); + EVEL_EXIT(); +} + + +MEASUREMENT_IPMI_POWER_SUPPLY *evel_measurement_new_ipmi_power_add( + MEASUREMENT_IPMI * ipmi, + char * id) +{ + MEASUREMENT_IPMI_POWER_SUPPLY * ipmi_power = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + ipmi_power = malloc(sizeof(MEASUREMENT_IPMI_POWER_SUPPLY)); + assert(ipmi_power != NULL); + memset(ipmi_power, 0, sizeof(MEASUREMENT_IPMI_POWER_SUPPLY)); + ipmi_power->powerSupplyIdentifier = strdup(id); + evel_init_option_double(&ipmi_power->powerSupplyInputPower); + evel_init_option_double(&ipmi_power->powerSupplyCurrentOutput); + evel_init_option_double(&ipmi_power->powerSupplyTemperature); + + dlist_push_last(&ipmi->ipmi_power, ipmi_power); + + EVEL_EXIT(); + return ipmi_power; +} + + +void evel_measurement_ipmi_power_inputpwr_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_POWER_SUPPLY * ipmipwr, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmipwr != NULL); + evel_set_option_double(&ipmipwr->powerSupplyInputPower, val, "Power Supply Input Power"); + EVEL_EXIT(); +} + + +void evel_measurement_ipmi_power_current_op_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_POWER_SUPPLY * ipmipwr, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmipwr != NULL); + evel_set_option_double(&ipmipwr->powerSupplyCurrentOutput, val, "Power Supply Current Output"); + EVEL_EXIT(); +} + + +void evel_measurement_ipmi_power_temp_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_POWER_SUPPLY * ipmipwr, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmipwr != NULL); + evel_set_option_double(&ipmipwr->powerSupplyTemperature, val, "Power Supply Temperature"); + EVEL_EXIT(); +} + + +MEASUREMENT_IPMI_PROCESSOR *evel_measurement_new_ipmi_processor_add( + MEASUREMENT_IPMI * ipmi, + char * id) +{ + MEASUREMENT_IPMI_PROCESSOR * ipmi_processor = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s", id); + ipmi_processor = malloc(sizeof(MEASUREMENT_IPMI_PROCESSOR)); + assert(ipmi_processor != NULL); + memset(ipmi_processor, 0, sizeof(MEASUREMENT_IPMI_PROCESSOR)); + ipmi_processor->processorIdentifier = strdup(id); + evel_init_option_double(&ipmi_processor->pprocessorThermalControl); + evel_init_option_double(&ipmi_processor->processorDtsThermalMargin); + + dlist_initialize(&ipmi_processor->processorDimmAggregateThermalMargin); + + dlist_push_last(&ipmi->ipmi_processor, ipmi_processor); + + EVEL_EXIT(); + return ipmi_processor; +} + + +void evel_measurement_ipmi_processor_theralCtrl_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_PROCESSOR * ipmi_processor, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmi_processor != NULL); + evel_set_option_double(&ipmi_processor->pprocessorThermalControl, val, "IO Module Temperature"); + EVEL_EXIT(); +} + + +void evel_measurement_ipmi_processor_theralMargin_set(MEASUREMENT_IPMI *ipmi, + MEASUREMENT_IPMI_PROCESSOR * ipmi_processor, + const double val) +{ + EVEL_ENTER(); + assert(ipmi != NULL); + assert(ipmi_processor != NULL); + evel_set_option_double(&ipmi_processor->processorDtsThermalMargin, val, "Front Panel Temperature"); + EVEL_EXIT(); +} + +MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM * evel_measurement_ipmi_processor_new_dimmAggThermalMargin_add( + MEASUREMENT_IPMI * ipmi, + MEASUREMENT_IPMI_PROCESSOR *ipmi_processor, + const char * const id, double therm_margin) +{ + MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM * thermal_margin = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(ipmi != NULL); + assert(ipmi_processor != NULL); + assert(id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s, thermal_margin=%lf", id, thermal_margin); + thermal_margin = malloc(sizeof(MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM)); + assert(thermal_margin != NULL); + memset(thermal_margin, 0, sizeof(MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM)); + thermal_margin->MarginIdentifier = strdup(id); + thermal_margin->thermalMargin = therm_margin; + + dlist_push_last(&ipmi_processor->processorDimmAggregateThermalMargin, thermal_margin); + + EVEL_EXIT(); + return thermal_margin; +} + + +MEASUREMENT_LOAD * evel_measurement_new_loads_add( + EVENT_MEASUREMENT * measurement) +{ + MEASUREMENT_LOAD *load = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(measurement != NULL); + assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + load = malloc(sizeof(MEASUREMENT_LOAD)); + assert(load != NULL); + memset(load, 0, sizeof(MEASUREMENT_LOAD)); + + evel_init_option_double(&load->shortTerm); + evel_init_option_double(&load->midTerm); + evel_init_option_double(&load->longTerm); + + dlist_push_last(&measurement->loads, load); + + + EVEL_EXIT(); + return load; +} + + +void evel_measurement_load_shortTerm_set(MEASUREMENT_LOAD *load, + const double val) +{ + EVEL_ENTER(); + assert(load != NULL); + evel_set_option_double(&load->shortTerm, val, "shortTerm"); + EVEL_EXIT(); +} + +void evel_measurement_load_midTerm_set(MEASUREMENT_LOAD *load, + const double val) +{ + EVEL_ENTER(); + assert(load != NULL); + evel_set_option_double(&load->midTerm, val, "midTerm"); + EVEL_EXIT(); +} + +void evel_measurement_load_longTerm_set(MEASUREMENT_LOAD *load, + const double val) +{ + EVEL_ENTER(); + assert(load != NULL); + evel_set_option_double(&load->longTerm, val, "longTerm"); + EVEL_EXIT(); +} + +MEASUREMENT_PROCESS_STATS * evel_measurement_new_process_stats_add( + EVENT_MEASUREMENT * measurement, + const char * const processIdentifier ) +{ + MEASUREMENT_PROCESS_STATS *process_stat = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(measurement != NULL); + assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s Process State", processIdentifier); + process_stat = malloc(sizeof(MEASUREMENT_PROCESS_STATS)); + assert(process_stat != NULL); + memset(process_stat, 0, sizeof(MEASUREMENT_PROCESS_STATS)); + process_stat->processIdentifier = strdup(processIdentifier); + assert(process_stat->processIdentifier != NULL); + dlist_push_last(&measurement->process_stats, process_stat); + + evel_init_option_double(&process_stat->forkRate); + evel_init_option_double(&process_stat->psStateBlocked); + evel_init_option_double(&process_stat->psStatePaging); + evel_init_option_double(&process_stat->psStateRunning); + evel_init_option_double(&process_stat->psStateSleeping); + evel_init_option_double(&process_stat->psStateStopped); + evel_init_option_double(&process_stat->psStateZombie); + + EVEL_EXIT(); + return process_stat; +} + +void evel_measurement_process_stat_forkRate_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val) +{ + EVEL_ENTER(); + assert(process_stat != NULL); + evel_set_option_double(&process_stat->forkRate, val, "forkRate"); + EVEL_EXIT(); +} + + + +void evel_measurement_process_stat_psStateBlocked_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val) +{ + EVEL_ENTER(); + assert(process_stat != NULL); + evel_set_option_double(&process_stat->psStateBlocked, val, "psStateBlocked"); + EVEL_EXIT(); +} + +void evel_measurement_process_stat_psStatePaging_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val) +{ + EVEL_ENTER(); + assert(process_stat != NULL); + evel_set_option_double(&process_stat->psStatePaging, val, "psStatePaging"); + EVEL_EXIT(); +} + + +void evel_measurement_process_stat_psStateRunning_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val) +{ + EVEL_ENTER(); + assert(process_stat != NULL); + evel_set_option_double(&process_stat->psStateRunning, val, "psStateRunning"); + EVEL_EXIT(); +} + +void evel_measurement_process_stat_psStateSleeping_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val) +{ + EVEL_ENTER(); + assert(process_stat != NULL); + evel_set_option_double(&process_stat->psStateSleeping, val, "psStateSleeping"); + EVEL_EXIT(); +} + + +void evel_measurement_process_stat_psStateStopped_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val) +{ + EVEL_ENTER(); + assert(process_stat != NULL); + evel_set_option_double(&process_stat->psStateStopped, val, "psStateStopped"); + EVEL_EXIT(); +} + +void evel_measurement_process_stat_psStateZombie_set(MEASUREMENT_PROCESS_STATS *process_stat, + const double val) +{ + EVEL_ENTER(); + assert(process_stat != NULL); + evel_set_option_double(&process_stat->psStateZombie, val, "psStateZombie"); + EVEL_EXIT(); +} + +MACHINE_CHECK_EXCEPTION * evel_measurement_new_machine_check_exception_add( + EVENT_MEASUREMENT * measurement, + const char * const process_id ) +{ + MACHINE_CHECK_EXCEPTION *machine_check = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(measurement != NULL); + assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); + assert(process_id != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s - machine check exception", process_id); + machine_check = malloc(sizeof(MACHINE_CHECK_EXCEPTION)); + assert(machine_check != NULL); + memset(machine_check, 0, sizeof(MACHINE_CHECK_EXCEPTION)); + machine_check->process_id = strdup(process_id); + assert(machine_check->process_id != NULL); + + evel_init_option_double(&machine_check->corrected_memory_errors); + evel_init_option_double(&machine_check->corrected_memory_errors_in_1Hr); + evel_init_option_double(&machine_check->uncorrected_memory_errors); + evel_init_option_double(&machine_check->uncorrected_memory_errors_in_1Hr); + + dlist_push_last(&measurement->machine_check_exception, machine_check); + + EVEL_EXIT(); + return machine_check; +} + +void evel_measurement_machine_check_cor_mem_err_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val) +{ + EVEL_ENTER(); + assert(machine_check != NULL); + evel_set_option_double(&machine_check->corrected_memory_errors, val, "corrected_memory_errors"); + EVEL_EXIT(); +} + + +void evel_measurement_machine_check_cor_mem_err_1hr_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val) +{ + EVEL_ENTER(); + assert(machine_check != NULL); + evel_set_option_double(&machine_check->corrected_memory_errors_in_1Hr, val, "corrected_memory_errors_in_1Hr"); + EVEL_EXIT(); +} + +void evel_measurement_machine_check_uncor_mem_err_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val) +{ + EVEL_ENTER(); + assert(machine_check != NULL); + evel_set_option_double(&machine_check->uncorrected_memory_errors, val, "uncorrected_memory_errors"); + EVEL_EXIT(); +} + +void evel_measurement_machine_check_uncor_mem_err_1hr_set(MACHINE_CHECK_EXCEPTION *machine_check, + const double val) +{ + EVEL_ENTER(); + assert(machine_check != NULL); + evel_set_option_double(&machine_check->uncorrected_memory_errors_in_1Hr, val, "uncorrected_memory_errors_in_1Hr"); + EVEL_EXIT(); +} + +MEASUREMENT_HUGE_PAGE * evel_measurement_new_huge_page_add( + EVENT_MEASUREMENT * measurement, + const char * const hugePagesIdentifier ) +{ + MEASUREMENT_HUGE_PAGE *huge_page = NULL; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(measurement != NULL); + assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT); + assert(hugePagesIdentifier != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding id=%s Huge Page", hugePagesIdentifier); + huge_page = malloc(sizeof(MEASUREMENT_HUGE_PAGE)); + assert(huge_page != NULL); + memset(huge_page, 0, sizeof(MEASUREMENT_HUGE_PAGE)); + huge_page->hugePagesIdentifier = strdup(hugePagesIdentifier); + assert(huge_page->hugePagesIdentifier != NULL); + + evel_init_option_double(&huge_page->bytesUsed); + evel_init_option_double(&huge_page->bytesFree); + evel_init_option_double(&huge_page->vmPageNumberUsed); + evel_init_option_double(&huge_page->vmPageNumberFree); + evel_init_option_double(&huge_page->percentUsed); + evel_init_option_double(&huge_page->percentFree); + + dlist_push_last(&measurement->huge_pages, huge_page); + + EVEL_EXIT(); + return huge_page; +} + +void evel_measurement_huge_page_bytesUsed_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val) +{ + EVEL_ENTER(); + assert(huge_page != NULL); + evel_set_option_double(&huge_page->bytesUsed, val, "bytesUsed"); + EVEL_EXIT(); +} + +void evel_measurement_huge_page_bytesFree_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val) +{ + EVEL_ENTER(); + assert(huge_page != NULL); + evel_set_option_double(&huge_page->bytesFree, val, "bytesFree"); + EVEL_EXIT(); +} + + +void evel_measurement_huge_page_vmPageNumberUsed_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val) +{ + EVEL_ENTER(); + assert(huge_page != NULL); + evel_set_option_double(&huge_page->vmPageNumberUsed, val, "vmPageNumberUsed"); + EVEL_EXIT(); +} + + +void evel_measurement_huge_page_vmPageNumberFree_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val) +{ + EVEL_ENTER(); + assert(huge_page != NULL); + evel_set_option_double(&huge_page->vmPageNumberFree, val, "vmPageNumberFree"); + EVEL_EXIT(); +} + + +void evel_measurement_huge_page_percentUsed_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val) +{ + EVEL_ENTER(); + assert(huge_page != NULL); + evel_set_option_double(&huge_page->percentUsed, val, "percentUsed"); + EVEL_EXIT(); +} + + +void evel_measurement_huge_page_percentFree_set(MEASUREMENT_HUGE_PAGE *huge_page, + const double val) +{ + EVEL_ENTER(); + assert(huge_page != NULL); + evel_set_option_double(&huge_page->percentFree, val, "percentFree"); + EVEL_EXIT(); +} + +void evel_json_encode_ipmi(EVEL_JSON_BUFFER * jbuf, MEASUREMENT_IPMI * ipmi_entry) +{ + + DLIST_ITEM * item = NULL; + MEASUREMENT_IPMI_BB_TEMPERATURE * bb_temp = NULL; + MEASUREMENT_IPMI_BB_VOLTAGE * bb_volt = NULL; + MEASUREMENT_IPMI_BATTERY * ipmi_batt = NULL; + MEASUREMENT_IPMI_FAN * ipmi_fan = NULL; + MEASUREMENT_IPMI_HSBP * ipmi_hsbp = NULL; + MEASUREMENT_IPMI_NIC * ipmi_nic = NULL; + MEASUREMENT_IPMI_POWER_SUPPLY * ipmi_pwr = NULL; + MEASUREMENT_IPMI_PROCESSOR * ipmi_proc = NULL; + MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM * dimm_therm = NULL; + MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN * agg_temp = NULL; + DLIST_ITEM * item1 = NULL; + + EVEL_ENTER(); + assert(ipmi_entry != NULL); + + evel_enc_kv_opt_double(jbuf, "exitAirTemperature", &ipmi_entry->exitAirTemperature); + evel_enc_kv_opt_double(jbuf, "frontPanelTemperature", &ipmi_entry->frontPanelTemperature); + evel_enc_kv_opt_double(jbuf, "ioModuleTemperature", &ipmi_entry->ioModuleTemperature); + evel_enc_kv_opt_double(jbuf, "systemAirflow", &ipmi_entry->systemAirflow); + + /***************************************************************************/ + /* Baseboard Temperature */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiBaseboardTemperatureArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_base_board_temparature); + while (item != NULL) + { + bb_temp = (MEASUREMENT_IPMI_BB_TEMPERATURE *) item->item; + assert(bb_temp != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiBaseboardTemperatureArray", + bb_temp->BBTemperatureID)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "baseboardTemperatureIdentifier", bb_temp->BBTemperatureID); + evel_enc_kv_opt_double(jbuf, "baseboardTemperature", &bb_temp->BBTemperature); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* Baseboard Voltage */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiBaseboardVoltageRegulatorArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_base_board_voltage); + while (item != NULL) + { + bb_volt = (MEASUREMENT_IPMI_BB_VOLTAGE *) item->item; + assert(bb_volt != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiBaseboardVoltageRegulatorArray", + bb_volt->BBVoltageRegID)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "baseboardVoltageRegulatorIdentifier", bb_volt->BBVoltageRegID); + evel_enc_kv_opt_double(jbuf, "voltageRegulatorTemperature", &bb_volt->voltageRegTemperature); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* IPMI Battery */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiBatteryArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_battery); + while (item != NULL) + { + ipmi_batt = (MEASUREMENT_IPMI_BATTERY *) item->item; + assert(ipmi_batt != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiBatteryArray", + ipmi_batt->batteryIdentifier)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "batteryIdentifier", ipmi_batt->batteryIdentifier); + evel_enc_kv_opt_double(jbuf, "batteryVoltageLevel", &ipmi_batt->batteryVoltageLevel); + evel_enc_kv_opt_string(jbuf, "batteryType", &ipmi_batt->batteryType); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + + /***************************************************************************/ + /* IPMI Fan */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiFanArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_fan); + while (item != NULL) + { + ipmi_fan = (MEASUREMENT_IPMI_FAN *) item->item; + assert(ipmi_fan != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiFanArray", + ipmi_fan->fanIdentifier)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "fanIdentifier", ipmi_fan->fanIdentifier); + evel_enc_kv_opt_double(jbuf, "fanSpeed", &ipmi_fan->fanSpeed); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* IPMI HSBP */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiHsbpArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_hsbp); + while (item != NULL) + { + ipmi_hsbp = (MEASUREMENT_IPMI_HSBP *) item->item; + assert(ipmi_hsbp != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiHsbpArray", + ipmi_hsbp->hsbpIdentifier)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "hsbpIdentifier", ipmi_hsbp->hsbpIdentifier); + evel_enc_kv_opt_double(jbuf, "hsbpTemperature", &ipmi_hsbp->hsbpTemperature); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* IPMI Global Aggregate Temperature margin */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "globalAggregateTemperatureMarginArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_global_agg_temp_margin); + while (item != NULL) + { + agg_temp = (MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN *) item->item; + assert(agg_temp != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiGlobalAggregateTemperatureMarginArray", + agg_temp->globalAggTempID)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "globalAggregateTemperatureMarginIdentifier", agg_temp->globalAggTempID); + evel_enc_kv_opt_double(jbuf, "globalAggregateTemperatureMargin", &agg_temp->globalAggTempMargin); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* IPMI NIC */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiNicArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_nic); + while (item != NULL) + { + ipmi_nic = (MEASUREMENT_IPMI_NIC *) item->item; + assert(ipmi_nic != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiNicArray", + ipmi_nic->nicIdentifier)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "nicIdentifier", ipmi_nic->nicIdentifier); + evel_enc_kv_opt_double(jbuf, "nicTemperature", &ipmi_nic->nicTemperature); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* IPMI Power */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiPowerSupplyArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_power); + while (item != NULL) + { + ipmi_pwr = (MEASUREMENT_IPMI_POWER_SUPPLY *) item->item; + assert(ipmi_pwr != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiPowerSupplyArray", + ipmi_pwr->powerSupplyIdentifier)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "powerSupplyIdentifier", ipmi_pwr->powerSupplyIdentifier); + evel_enc_kv_opt_double(jbuf, "powerSupplyCurrentOutputPercent", &ipmi_pwr->powerSupplyCurrentOutput); + evel_enc_kv_opt_double(jbuf, "powerSupplyInputPower", &ipmi_pwr->powerSupplyInputPower); + evel_enc_kv_opt_double(jbuf, "powerSupplyTemperature", &ipmi_pwr->powerSupplyTemperature); + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* IPMI Processor */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "ipmiProcessorArray")) + { + bool item_added = false; + + item = dlist_get_first(&ipmi_entry->ipmi_processor); + while (item != NULL) + { + ipmi_proc = (MEASUREMENT_IPMI_PROCESSOR *) item->item; + assert(ipmi_proc != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "ipmiProcessorArray", + ipmi_proc->processorIdentifier)) + { + evel_json_open_object(jbuf); + + evel_enc_kv_string(jbuf, "processorIdentifier", ipmi_proc->processorIdentifier); + evel_enc_kv_opt_double(jbuf, "processorDtsThermalMargin", &ipmi_proc->processorDtsThermalMargin); + evel_enc_kv_opt_double(jbuf, "processorThermalControlPercent", &ipmi_proc->pprocessorThermalControl); + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "processorDimmAggregateThermalMarginArray")) + { + bool item1_added = false; + + item1 = dlist_get_first(&ipmi_proc->processorDimmAggregateThermalMargin); + while (item1 != NULL) + { + dimm_therm = (MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM *) item1->item; + assert(dimm_therm != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "processorDimmAggregateThermalMarginArray", + dimm_therm->MarginIdentifier)) + { + evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, "processorDimmAggregateThermalMarginIdentifier", dimm_therm->MarginIdentifier); + evel_enc_kv_double(jbuf, "thermalMargin", dimm_therm->thermalMargin); + + evel_json_close_object(jbuf); + item1_added = true; + } + item1 = dlist_get_next(item1); + } + evel_json_close_list(jbuf); + + if (!item1_added) + { + evel_json_rewind(jbuf); + } + } + + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + EVEL_EXIT(); } /**************************************************************************//** @@ -3008,21 +4855,29 @@ void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, EVENT_MEASUREMENT * event) { + MEASUREMENT_HUGE_PAGE * huge_page = NULL; 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_performance = NULL; - MEASUREMENT_ERRORS * errors = NULL; - MEASUREMENT_FEATURE_USE * feature_use = NULL; + MEASUREMENT_NIC_PERFORMANCE * nic_performance = NULL; MEASUREMENT_CODEC_USE * codec_use = NULL; - MEASUREMENT_GROUP * measurement_group = NULL; - CUSTOM_MEASUREMENT * custom_measurement = NULL; + MEASUREMENT_PROCESS_STATS * proc_stat = NULL; + MEASUREMENT_LOAD * load = NULL; + MACHINE_CHECK_EXCEPTION * machine_check = NULL; + MEASUREMENT_IPMI * ipmi_entry = NULL; DLIST_ITEM * item = NULL; - DLIST_ITEM * nested_item = NULL; - DLIST_ITEM * addl_info_item = NULL; - OTHER_FIELD *addl_info = NULL; + DLIST_ITEM * other_field_item = NULL; + EVEL_JSON_OBJECT_INSTANCE * jsonobjinst = NULL; + EVEL_JSON_OBJECT * jsonobjp = NULL; + DLIST_ITEM * jsobj_field_item = NULL; + EVEL_INTERNAL_KEY * keyinst = NULL; + DLIST_ITEM * keyinst_field_item = NULL; + DLIST_ITEM * dlist_item = NULL; + HASHTABLE_T * ht; + ENTRY_T *entry; + char * state = NULL; EVEL_ENTER(); @@ -3033,7 +4888,7 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, assert(event->header.event_domain == EVEL_DOMAIN_MEASUREMENT); evel_json_encode_header(jbuf, &event->header); - evel_json_open_named_object(jbuf, "measurementsForVfScalingFields"); + evel_json_open_named_object(jbuf, "measurementFields"); /***************************************************************************/ /* Mandatory fields. */ @@ -3043,29 +4898,192 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, /***************************************************************************/ /* Optional fields. */ /***************************************************************************/ - // additional fields + + /***************************************************************************/ + /* IPMI */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "ipmi")) + { + bool item_added = false; + + item = dlist_get_first(&event->ipmis); + while (item != NULL) + { + ipmi_entry = (MEASUREMENT_IPMI *) item->item; + assert(ipmi_entry != NULL); + + if (!evel_throttle_suppress_field(jbuf->throttle_spec, + "ipmi")) + { + // evel_json_open_object(jbuf); + evel_json_encode_ipmi(jbuf, ipmi_entry); + // evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* Huge Page */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "hugePagesArray")) + { + bool item_added = false; + + item = dlist_get_first(&event->huge_pages); + while (item != NULL) + { + huge_page = (MEASUREMENT_HUGE_PAGE *) item->item; + assert(huge_page != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "hugePagesArray", + huge_page->hugePagesIdentifier)) + { + evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, "hugePagesIdentifier", huge_page->hugePagesIdentifier); + evel_enc_kv_opt_double(jbuf, "bytesUsed", &huge_page->bytesUsed); + evel_enc_kv_opt_double(jbuf, "bytesFree", &huge_page->bytesFree); + evel_enc_kv_opt_double(jbuf, "vmPageNumberUsed", &huge_page->vmPageNumberUsed); + evel_enc_kv_opt_double(jbuf, "vmPageNumberFree", &huge_page->vmPageNumberFree); + evel_enc_kv_opt_double(jbuf, "percentUsed", &huge_page->bytesUsed); + evel_enc_kv_opt_double(jbuf, "percentFree", &huge_page->bytesUsed); + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* Machine check exception */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "machineCheckExceptionArray")) + { + bool item_added = false; + + item = dlist_get_first(&event->machine_check_exception); + while (item != NULL) + { + machine_check = (MACHINE_CHECK_EXCEPTION *) item->item; + assert(machine_check != NULL); + + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "machineCheckExceptionArray", + machine_check->process_id)) + { + evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, "vmIdentifier", machine_check->process_id); + evel_enc_kv_opt_double(jbuf, "correctedMemoryErrors", &machine_check->corrected_memory_errors); + evel_enc_kv_opt_double(jbuf, "correctedMemoryErrorsIn1Hr", &machine_check->corrected_memory_errors_in_1Hr); + evel_enc_kv_opt_double(jbuf, "uncorrectedMemoryErrors", &machine_check->uncorrected_memory_errors); + evel_enc_kv_opt_double(jbuf, "uncorrectedMemoryErrorsIn1Hr", &machine_check->uncorrected_memory_errors_in_1Hr); + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* Loads */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "loadArray")) + { + bool item_added = false; + + item = dlist_get_first(&event->loads); + while (item != NULL) + { + load = (MEASUREMENT_LOAD *) item->item; + assert(load != NULL); + + if (!evel_throttle_suppress_field(jbuf->throttle_spec, + "loadArray")) + { + evel_json_open_object(jbuf); + evel_enc_kv_opt_double(jbuf, "shortTerm", &load->shortTerm); + evel_enc_kv_opt_double(jbuf, "midTerm", &load->midTerm); + evel_enc_kv_opt_double(jbuf, "longTerm", &load->longTerm); + evel_json_close_object(jbuf); + item_added = true; + } + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + /***************************************************************************/ + /* Process stats */ + /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "additionalFields")) + if (evel_json_open_opt_named_list(jbuf, "processStatsArray")) { bool item_added = false; - addl_info_item = dlist_get_first(&event->additional_info); - while (addl_info_item != NULL) + item = dlist_get_first(&event->process_stats); + while (item != NULL) { - addl_info = (OTHER_FIELD*) addl_info_item->item; - assert(addl_info != NULL); + proc_stat = (MEASUREMENT_PROCESS_STATS *) item->item; + assert(proc_stat != NULL); if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalFields", - addl_info->name)) + "processStatsArray", + proc_stat->processIdentifier)) { evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", addl_info->name); - evel_enc_kv_string(jbuf, "value", addl_info->value); + evel_enc_kv_string(jbuf, "processIdentifier", proc_stat->processIdentifier); + evel_enc_kv_opt_double(jbuf, "forkRate", &proc_stat->forkRate); + evel_enc_kv_opt_double(jbuf, "psStateBlocked", &proc_stat->psStateBlocked); + evel_enc_kv_opt_double(jbuf, "psStatePaging", &proc_stat->psStatePaging); + evel_enc_kv_opt_double(jbuf, "psStateRunning", &proc_stat->psStateRunning); + evel_enc_kv_opt_double(jbuf, "psStateSleeping", &proc_stat->psStateSleeping); + evel_enc_kv_opt_double(jbuf, "psStateStopped", &proc_stat->psStateStopped); + evel_enc_kv_opt_double(jbuf, "psStateZombie", &proc_stat->psStateZombie); evel_json_close_object(jbuf); item_added = true; } - addl_info_item = dlist_get_next(addl_info_item); + item = dlist_get_next(item); } evel_json_close_list(jbuf); @@ -3078,7 +5096,140 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, } } - // TBD additional json objects + // additional fields + evel_json_checkpoint(jbuf); + ht = event->additional_info; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding additionalFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + + evel_json_checkpoint(jbuf); + if(evel_json_open_opt_named_list(jbuf, "additionalObjects")) + { + bool item_added = false; + other_field_item = dlist_get_first(&event->additional_objects); + while (other_field_item != NULL) + { + jsonobjp = (EVEL_JSON_OBJECT *) other_field_item->item; + if(jsonobjp != NULL) + { + evel_json_open_object(jbuf); + + if( evel_json_open_opt_named_list(jbuf, "objectInstances")) + { + bool item_added2 = false; + jsobj_field_item = dlist_get_first(&jsonobjp->jsonobjectinstances); + while (jsobj_field_item != NULL) + { + jsonobjinst = (EVEL_JSON_OBJECT_INSTANCE *) jsobj_field_item->item; + if( jsonobjinst != NULL ) + { + evel_json_open_object(jbuf); + evel_enc_kv_object(jbuf, "objectInstance", jsonobjinst->jsonstring); + evel_enc_kv_opt_ull(jbuf, "objectInstanceEpochMicrosec", &jsonobjinst->objinst_epoch_microsec); + //evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_list(jbuf, "objectKeys")) + { +// bool item_added3 = false; + + keyinst_field_item = dlist_get_first(&jsonobjinst->object_keys); + while (keyinst_field_item != NULL) + { + keyinst = (EVEL_INTERNAL_KEY *)keyinst_field_item->item; + if(keyinst != NULL) + { + evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, "keyName", keyinst->keyname); + evel_enc_kv_opt_int(jbuf, "keyOrder", &keyinst->keyorder); + evel_enc_kv_opt_string(jbuf, "keyValue", &keyinst->keyvalue); + evel_json_close_object(jbuf); +// item_added3 = true; + } + keyinst_field_item = dlist_get_next(keyinst_field_item); + } + evel_json_close_list(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + //if (!item_added3) + //{ + // evel_json_rewind(jbuf); + //} + } + evel_json_close_object(jbuf); + } + item_added2 = true; + jsobj_field_item = dlist_get_next(jsobj_field_item); + } + evel_json_close_list(jbuf); + if( !item_added2 ) + { + evel_json_rewind(jbuf); + } + } + + evel_enc_kv_string(jbuf, "objectName", jsonobjp->object_name); + evel_enc_kv_opt_string(jbuf, "objectSchema", &jsonobjp->objectschema); + evel_enc_kv_opt_string(jbuf, "objectSchemaUrl", &jsonobjp->objectschemaurl); + evel_enc_kv_opt_string(jbuf, "nfSubscribedObjectName", &jsonobjp->nfsubscribedobjname); + evel_enc_kv_opt_string(jbuf, "nfSubscriptionId", &jsonobjp->nfsubscriptionid); + evel_json_close_object(jbuf); + item_added = true; + } + other_field_item = dlist_get_next(other_field_item); + } + evel_json_close_list(jbuf); + + if (!item_added) + { + evel_json_rewind(jbuf); + } + } + + + // additional json objects evel_enc_kv_opt_int(jbuf, "concurrentSessions", &event->concurrent_sessions); evel_enc_kv_opt_int(jbuf, "configuredEntities", &event->configured_entities); @@ -3111,6 +5262,13 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_double(jbuf, "cpuUsageUser", &cpu_use->user); evel_enc_kv_opt_double(jbuf, "cpuWait", &cpu_use->wait); evel_enc_kv_double(jbuf, "percentUsage",cpu_use->usage); + evel_enc_kv_opt_double(jbuf, "cpuCapacityContention", &cpu_use->cpuCapacityContention); + evel_enc_kv_opt_double(jbuf, "cpuDemandAvg", &cpu_use->cpuDemandAvg); + evel_enc_kv_opt_double(jbuf, "cpuDemandMhz", &cpu_use->cpuDemandMhz); + evel_enc_kv_opt_double(jbuf, "cpuDemandPct", &cpu_use->cpuDemandPct); + evel_enc_kv_opt_double(jbuf, "cpuLatencyAvg", &cpu_use->cpuLatencyAvg); + evel_enc_kv_opt_double(jbuf, "cpuOverheadAvg", &cpu_use->cpuOverheadAvg); + evel_enc_kv_opt_double(jbuf, "cpuSwapWaitTime", &cpu_use->cpuSwapWaitTime); evel_json_close_object(jbuf); item_added = true; } @@ -3188,6 +5346,20 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_double(jbuf, "diskTimeWriteLast", &disk_use->timewritelast); evel_enc_kv_opt_double(jbuf, "diskTimeWriteMax", &disk_use->timewritemax); evel_enc_kv_opt_double(jbuf, "diskTimeWriteMin", &disk_use->timewritemin); + evel_enc_kv_opt_double(jbuf, "diskBusResets", &disk_use->diskBusResets); + evel_enc_kv_opt_double(jbuf, "diskCommandsAborted", &disk_use->diskCommandsAborted); + evel_enc_kv_opt_double(jbuf, "diskTime", &disk_use->diskTime); + evel_enc_kv_opt_double(jbuf, "diskFlushRequests", &disk_use->diskFlushRequests); + evel_enc_kv_opt_double(jbuf, "diskFlushTime", &disk_use->diskFlushTime); + evel_enc_kv_opt_double(jbuf, "diskCommandsAvg", &disk_use->diskCommandsAvg); + evel_enc_kv_opt_double(jbuf, "diskReadCommandsAvg", &disk_use->diskReadCommandsAvg); + evel_enc_kv_opt_double(jbuf, "diskWriteCommandsAvg", &disk_use->diskWriteCommandsAvg); + evel_enc_kv_opt_double(jbuf, "diskTotalReadLatencyAvg", &disk_use->diskTotalReadLatencyAvg); + evel_enc_kv_opt_double(jbuf, "diskTotalWriteLatencyAvg", &disk_use->diskTotalWriteLatencyAvg); + evel_enc_kv_opt_double(jbuf, "diskWeightedIoTimeAvg", &disk_use->diskWeightedIoTimeAvg); + evel_enc_kv_opt_double(jbuf, "diskWeightedIoTimeLast", &disk_use->diskWeightedIoTimeLast); + evel_enc_kv_opt_double(jbuf, "diskWeightedIoTimeMax", &disk_use->diskWeightedIoTimeMax); + evel_enc_kv_opt_double(jbuf, "diskWeightedIoTimeMin", &disk_use->diskWeightedIoTimeMin); evel_json_close_object(jbuf); item_added = true; } @@ -3274,93 +5446,125 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_double( jbuf, "meanRequestLatency", &event->mean_request_latency); - evel_enc_kv_opt_int(jbuf, "requestRate", &event->request_rate); + evel_enc_kv_opt_double(jbuf, "requestRate", &event->request_rate); /***************************************************************************/ - /* vNIC Usage TBD Performance array */ + /* NIC Usage TBD Performance array */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "vNicUsageArray")) + if (evel_json_open_opt_named_list(jbuf, "nicPerformanceArray")) { bool item_added = false; - item = dlist_get_first(&event->vnic_usage); + item = dlist_get_first(&event->nic_performance); while (item != NULL) { - vnic_performance = (MEASUREMENT_VNIC_PERFORMANCE *) item->item; - assert(vnic_performance != NULL); + nic_performance = (MEASUREMENT_NIC_PERFORMANCE *) item->item; + assert(nic_performance != NULL); if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "vNicPerformanceArray", - vnic_performance->vnic_id)) + "nicPerformanceArray", + nic_performance->nic_id)) { evel_json_open_object(jbuf); /*********************************************************************/ /* Optional fields. */ /*********************************************************************/ + state = evel_entity_opt_op_state(&nic_performance->administrativeState); + if (state != NULL) + { + evel_enc_kv_string(jbuf, "administrativeState", state); + } + state = evel_entity_opt_op_state(&nic_performance->operationalState); + if (state != NULL) + { + evel_enc_kv_string(jbuf, "operationalState", state); + } + + evel_enc_kv_opt_double( jbuf, + "receivedPercentDiscard", &nic_performance->receivedPercentDiscard); + evel_enc_kv_opt_double( jbuf, - "receivedBroadcastPacketsAccumulated", &vnic_performance->recvd_bcast_packets_acc); + "receivedPercentError", &nic_performance->receivedPercentError); + evel_enc_kv_opt_double( jbuf, - "receivedBroadcastPacketsDelta", &vnic_performance->recvd_bcast_packets_delta); + "receivedUtilization", &nic_performance->receivedUtilization); + evel_enc_kv_opt_double( jbuf, - "receivedDiscardedPacketsAccumulated", &vnic_performance->recvd_discarded_packets_acc); + "speed", &nic_performance->speed); + evel_enc_kv_opt_double( jbuf, - "receivedDiscardedPacketsDelta", &vnic_performance->recvd_discarded_packets_delta); + "transmittedPercentDiscard", &nic_performance->transmittedPercentDiscard); + evel_enc_kv_opt_double( jbuf, - "receivedErrorPacketsAccumulated", &vnic_performance->recvd_error_packets_acc); + "transmittedPercentError", &nic_performance->transmittedPercentError); + evel_enc_kv_opt_double( jbuf, - "receivedErrorPacketsDelta", &vnic_performance->recvd_error_packets_delta); + "transmittedUtilization", &nic_performance->transmittedUtilization); + evel_enc_kv_opt_double( jbuf, - "receivedMulticastPacketsAccumulated", &vnic_performance->recvd_mcast_packets_acc); + "receivedBroadcastPacketsAccumulated", &nic_performance->recvd_bcast_packets_acc); evel_enc_kv_opt_double( jbuf, - "receivedMulticastPacketsDelta", &vnic_performance->recvd_mcast_packets_delta); + "receivedBroadcastPacketsDelta", &nic_performance->recvd_bcast_packets_delta); evel_enc_kv_opt_double( jbuf, - "receivedOctetsAccumulated", &vnic_performance->recvd_octets_acc); + "receivedDiscardedPacketsAccumulated", &nic_performance->recvd_discarded_packets_acc); evel_enc_kv_opt_double( jbuf, - "receivedOctetsDelta", &vnic_performance->recvd_octets_delta); + "receivedDiscardedPacketsDelta", &nic_performance->recvd_discarded_packets_delta); evel_enc_kv_opt_double( jbuf, - "receivedTotalPacketsAccumulated", &vnic_performance->recvd_total_packets_acc); + "receivedErrorPacketsAccumulated", &nic_performance->recvd_error_packets_acc); evel_enc_kv_opt_double( jbuf, - "receivedTotalPacketsDelta", &vnic_performance->recvd_total_packets_delta); + "receivedErrorPacketsDelta", &nic_performance->recvd_error_packets_delta); evel_enc_kv_opt_double( jbuf, - "receivedUnicastPacketsAccumulated", &vnic_performance->recvd_ucast_packets_acc); + "receivedMulticastPacketsAccumulated", &nic_performance->recvd_mcast_packets_acc); evel_enc_kv_opt_double( jbuf, - "receivedUnicastPacketsDelta", &vnic_performance->recvd_ucast_packets_delta); + "receivedMulticastPacketsDelta", &nic_performance->recvd_mcast_packets_delta); evel_enc_kv_opt_double( jbuf, - "transmittedBroadcastPacketsAccumulated", &vnic_performance->tx_bcast_packets_acc); + "receivedOctetsAccumulated", &nic_performance->recvd_octets_acc); evel_enc_kv_opt_double( jbuf, - "transmittedBroadcastPacketsDelta", &vnic_performance->tx_bcast_packets_delta); + "receivedOctetsDelta", &nic_performance->recvd_octets_delta); evel_enc_kv_opt_double( jbuf, - "transmittedDiscardedPacketsAccumulated", &vnic_performance->tx_discarded_packets_acc); + "receivedTotalPacketsAccumulated", &nic_performance->recvd_total_packets_acc); evel_enc_kv_opt_double( jbuf, - "transmittedDiscardedPacketsDelta", &vnic_performance->tx_discarded_packets_delta); + "receivedTotalPacketsDelta", &nic_performance->recvd_total_packets_delta); evel_enc_kv_opt_double( jbuf, - "transmittedErrorPacketsAccumulated", &vnic_performance->tx_error_packets_acc); + "receivedUnicastPacketsAccumulated", &nic_performance->recvd_ucast_packets_acc); evel_enc_kv_opt_double( jbuf, - "transmittedErrorPacketsDelta", &vnic_performance->tx_error_packets_delta); + "receivedUnicastPacketsDelta", &nic_performance->recvd_ucast_packets_delta); evel_enc_kv_opt_double( jbuf, - "transmittedMulticastPacketsAccumulated", &vnic_performance->tx_mcast_packets_acc); + "transmittedBroadcastPacketsAccumulated", &nic_performance->tx_bcast_packets_acc); evel_enc_kv_opt_double( jbuf, - "transmittedMulticastPacketsDelta", &vnic_performance->tx_mcast_packets_delta); + "transmittedBroadcastPacketsDelta", &nic_performance->tx_bcast_packets_delta); evel_enc_kv_opt_double( jbuf, - "transmittedOctetsAccumulated", &vnic_performance->tx_octets_acc); + "transmittedDiscardedPacketsAccumulated", &nic_performance->tx_discarded_packets_acc); evel_enc_kv_opt_double( jbuf, - "transmittedOctetsDelta", &vnic_performance->tx_octets_delta); + "transmittedDiscardedPacketsDelta", &nic_performance->tx_discarded_packets_delta); evel_enc_kv_opt_double( jbuf, - "transmittedTotalPacketsAccumulated", &vnic_performance->tx_total_packets_acc); + "transmittedErrorPacketsAccumulated", &nic_performance->tx_error_packets_acc); evel_enc_kv_opt_double( jbuf, - "transmittedTotalPacketsDelta", &vnic_performance->tx_total_packets_delta); + "transmittedErrorPacketsDelta", &nic_performance->tx_error_packets_delta); evel_enc_kv_opt_double( jbuf, - "transmittedUnicastPacketsAccumulated", &vnic_performance->tx_ucast_packets_acc); + "transmittedMulticastPacketsAccumulated", &nic_performance->tx_mcast_packets_acc); evel_enc_kv_opt_double( jbuf, - "transmittedUnicastPacketsDelta", &vnic_performance->tx_ucast_packets_delta); + "transmittedMulticastPacketsDelta", &nic_performance->tx_mcast_packets_delta); + evel_enc_kv_opt_double( jbuf, + "transmittedOctetsAccumulated", &nic_performance->tx_octets_acc); + evel_enc_kv_opt_double( jbuf, + "transmittedOctetsDelta", &nic_performance->tx_octets_delta); + evel_enc_kv_opt_double( jbuf, + "transmittedTotalPacketsAccumulated", &nic_performance->tx_total_packets_acc); + evel_enc_kv_opt_double( jbuf, + "transmittedTotalPacketsDelta", &nic_performance->tx_total_packets_delta); + evel_enc_kv_opt_double( jbuf, + "transmittedUnicastPacketsAccumulated", &nic_performance->tx_ucast_packets_acc); + evel_enc_kv_opt_double( jbuf, + "transmittedUnicastPacketsDelta", &nic_performance->tx_ucast_packets_delta); /*********************************************************************/ /* Mandatory fields. */ /*********************************************************************/ - evel_enc_kv_string(jbuf, "valuesAreSuspect", vnic_performance->valuesaresuspect); - evel_enc_kv_string(jbuf, "vNicIdentifier", vnic_performance->vnic_id); + evel_enc_kv_string(jbuf, "valuesAreSuspect", nic_performance->valuesaresuspect); + evel_enc_kv_string(jbuf, "nicIdentifier", nic_performance->nic_id); evel_json_close_object(jbuf); item_added = true; @@ -3381,7 +5585,7 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, /***************************************************************************/ - /* Memory Use list. */ + /* Memory Use list. */ /***************************************************************************/ evel_json_checkpoint(jbuf); if (evel_json_open_opt_named_list(jbuf, "memoryUsageArray")) @@ -3396,17 +5600,27 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, "memoryUsageArray", - mem_use->id)) + mem_use->vmid)) { evel_json_open_object(jbuf); - evel_enc_kv_double(jbuf, "memoryBuffered", mem_use->membuffsz); + evel_enc_kv_opt_double(jbuf, "memoryBuffered", &mem_use->membuffsz); evel_enc_kv_opt_double(jbuf, "memoryCached", &mem_use->memcache); evel_enc_kv_opt_double(jbuf, "memoryConfigured", &mem_use->memconfig); - evel_enc_kv_opt_double(jbuf, "memoryFree", &mem_use->memfree); + evel_enc_kv_double(jbuf, "memoryFree", mem_use->memfree); evel_enc_kv_opt_double(jbuf, "memorySlabRecl", &mem_use->slabrecl); evel_enc_kv_opt_double(jbuf, "memorySlabUnrecl", &mem_use->slabunrecl); - evel_enc_kv_opt_double(jbuf, "memoryUsed", &mem_use->memused); - evel_enc_kv_string(jbuf, "vmIdentifier", mem_use->id); + evel_enc_kv_double(jbuf, "memoryUsed", mem_use->memused); + evel_enc_kv_string(jbuf, "vmIdentifier", mem_use->vmid); + evel_enc_kv_opt_double(jbuf, "memoryDemand", &mem_use->memoryDemand); + evel_enc_kv_opt_double(jbuf, "memoryLatencyAvg", &mem_use->memoryLatencyAvg); + evel_enc_kv_opt_double(jbuf, "memorySharedAvg", &mem_use->memorySharedAvg); + evel_enc_kv_opt_double(jbuf, "memorySwapInAvg", &mem_use->memorySwapInAvg); + evel_enc_kv_opt_double(jbuf, "memorySwapInRateAvg", &mem_use->memorySwapInRateAvg); + evel_enc_kv_opt_double(jbuf, "memorySwapOutAvg", &mem_use->memorySwapOutAvg); + evel_enc_kv_opt_double(jbuf, "memorySwapOutRateAvg", &mem_use->memorySwapOutRateAvg); + evel_enc_kv_opt_double(jbuf, "memorySwapUsedAvg", &mem_use->memorySwapUsedAvg); + evel_enc_kv_opt_double(jbuf, "percentMemoryUsage", &mem_use->percentMemoryUsage); + evel_json_close_object(jbuf); item_added = true; } @@ -3427,55 +5641,52 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_int( jbuf, "numberOfMediaPortsInUse", &event->media_ports_in_use); evel_enc_kv_opt_int( - jbuf, "vnfcScalingMetric", &event->vnfc_scaling_metric); - - /***************************************************************************/ - /* Errors list. */ - /***************************************************************************/ - if ((event->errors != NULL) && - evel_json_open_opt_named_object(jbuf, "errors")) - { - errors = event->errors; - evel_enc_kv_int(jbuf, "receiveDiscards", errors->receive_discards); - evel_enc_kv_int(jbuf, "receiveErrors", errors->receive_errors); - evel_enc_kv_int(jbuf, "transmitDiscards", errors->transmit_discards); - evel_enc_kv_int(jbuf, "transmitErrors", errors->transmit_errors); - evel_json_close_object(jbuf); - } + jbuf, "nfcScalingMetric", &event->vnfc_scaling_metric); /***************************************************************************/ /* Feature Utilization list. */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "featureUsageArray")) + ht = event->feature_usage; + if( ht != NULL ) { - bool item_added = false; - - item = dlist_get_first(&event->feature_usage); - while (item != NULL) + bool added = false; + if( ht->size > 0) { - feature_use = (MEASUREMENT_FEATURE_USE*) item->item; - assert(feature_use != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "featureUsageArray", - feature_use->feature_id)) + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "featureUsageArray")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "featureIdentifier", feature_use->feature_id); - evel_enc_kv_int( - jbuf, "featureUtilization", feature_use->feature_utilization); - evel_json_close_object(jbuf); - item_added = true; + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding feature usage %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "featureUsageArray", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - item = dlist_get_next(item); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ /*************************************************************************/ - if (!item_added) + if (!added) { evel_json_rewind(jbuf); } @@ -3521,52 +5732,67 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, /***************************************************************************/ /* Additional Measurement Groups list. */ /***************************************************************************/ + /***************************************************************************/ + /* Checkpoint, so that we can wind back if all fields are suppressed. */ + /***************************************************************************/ evel_json_checkpoint(jbuf); if (evel_json_open_opt_named_list(jbuf, "additionalMeasurements")) { - bool item_added = false; + bool added_array = false; - item = dlist_get_first(&event->additional_measurements); - while (item != NULL) + dlist_item = dlist_get_first(&event->additional_measurements); + while (dlist_item != NULL) { - measurement_group = (MEASUREMENT_GROUP *) item->item; - assert(measurement_group != NULL); + bool added = false; + ht = (HASHTABLE_T *) dlist_item->item; + assert(ht != NULL); - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalMeasurements", - measurement_group->name)) + if((ht->size > 0) && (ht-> n > 0)) { + evel_json_checkpoint(jbuf); evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", measurement_group->name); - evel_json_open_opt_named_list(jbuf, "arrayOfFields"); + evel_enc_kv_string(jbuf, "name", ht->hmName); - /*********************************************************************/ - /* Measurements list. */ - /*********************************************************************/ - nested_item = dlist_get_first(&measurement_group->measurements); - while (nested_item != NULL) + if (evel_json_open_opt_named_object(jbuf, "hashMap")) { - custom_measurement = (CUSTOM_MEASUREMENT *) nested_item->item; - assert(custom_measurement != NULL); - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", custom_measurement->name); - evel_enc_kv_string(jbuf, "value", custom_measurement->value); + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding additional measurements %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + ht->hmName, + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + added_array = true; + } + entry = entry->next; + } + } evel_json_close_object(jbuf); - nested_item = dlist_get_next(nested_item); + if (!added) + { + evel_json_rewind(jbuf); + } } - evel_json_close_list(jbuf); evel_json_close_object(jbuf); - item_added = true; } - item = dlist_get_next(item); + dlist_item = dlist_get_next(dlist_item); } evel_json_close_list(jbuf); - /*************************************************************************/ - /* If we've not written anything, rewind to before we opened the list. */ - /*************************************************************************/ - if (!item_added) + if (!added_array) { evel_json_rewind(jbuf); } @@ -3577,13 +5803,131 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, /* closes the object, too. */ /***************************************************************************/ evel_enc_version(jbuf, - "measurementsForVfScalingVersion", + "measurementFieldsVersion", event->major_version, event->minor_version); evel_json_close_object(jbuf); EVEL_EXIT(); } +void evel_measurement_free_ipmi_processor(MEASUREMENT_IPMI_PROCESSOR * ipmi_processor) +{ + + MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM * proc_dimm_therm = NULL; + + EVEL_ENTER(); + + free(ipmi_processor->processorIdentifier); + + proc_dimm_therm = dlist_pop_last(&ipmi_processor->processorDimmAggregateThermalMargin); + while (proc_dimm_therm != NULL) + { + EVEL_DEBUG("Freeing IPMI proc dimm therm Info (%s)", proc_dimm_therm->MarginIdentifier); + free(proc_dimm_therm->MarginIdentifier); + free(proc_dimm_therm); + proc_dimm_therm = dlist_pop_last(&ipmi_processor->processorDimmAggregateThermalMargin); + } + + EVEL_EXIT(); +} + +void evel_measurement_free_ipmi(MEASUREMENT_IPMI * ipmi) +{ + MEASUREMENT_IPMI_BB_TEMPERATURE * bb_temp = NULL; + MEASUREMENT_IPMI_BB_VOLTAGE * bb_volt = NULL; + MEASUREMENT_IPMI_BATTERY * ipmi_battery = NULL; + MEASUREMENT_IPMI_FAN * ipmi_fan = NULL; + MEASUREMENT_IPMI_HSBP * ipmi_hsbp = NULL; + MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN * ipmi_tempMargin = NULL; + MEASUREMENT_IPMI_NIC * ipmi_nic = NULL; + MEASUREMENT_IPMI_POWER_SUPPLY * ipmi_power = NULL; + MEASUREMENT_IPMI_PROCESSOR * ipmi_processor = NULL; + + EVEL_ENTER(); + + bb_temp = dlist_pop_last(&ipmi->ipmi_base_board_temparature); + while (bb_temp != NULL) + { + EVEL_DEBUG("Freeing base board temp Info (%s)", bb_temp->BBTemperatureID); + free(bb_temp->BBTemperatureID); + free(bb_temp); + bb_temp = dlist_pop_last(&ipmi->ipmi_base_board_temparature); + } + + bb_volt = dlist_pop_last(&ipmi->ipmi_base_board_voltage); + while (bb_volt != NULL) + { + EVEL_DEBUG("Freeing IPMI FAN Info (%s)", bb_volt->BBVoltageRegID); + free(bb_volt->BBVoltageRegID); + free(bb_volt); + bb_volt = dlist_pop_last(&ipmi->ipmi_base_board_voltage); + } + + ipmi_battery = dlist_pop_last(&ipmi->ipmi_battery); + while (ipmi_battery != NULL) + { + EVEL_DEBUG("Freeing IPMI Battery Info (%s)", ipmi_battery->batteryIdentifier); + free(ipmi_battery->batteryIdentifier); + free(ipmi_battery); + ipmi_battery = dlist_pop_last(&ipmi->ipmi_battery); + } + + ipmi_fan = dlist_pop_last(&ipmi->ipmi_fan); + while (ipmi_fan != NULL) + { + EVEL_DEBUG("Freeing IPMI FAN Info (%s)", ipmi_fan->fanIdentifier); + free(ipmi_fan->fanIdentifier); + free(ipmi_fan); + ipmi_fan = dlist_pop_last(&ipmi->ipmi_fan); + } + + ipmi_hsbp = dlist_pop_last(&ipmi->ipmi_hsbp); + while (ipmi_hsbp != NULL) + { + EVEL_DEBUG("Freeing IPMI HSBP Info (%s)", ipmi_hsbp->hsbpIdentifier); + free(ipmi_hsbp->hsbpIdentifier); + free(ipmi_hsbp); + ipmi_hsbp = dlist_pop_last(&ipmi->ipmi_hsbp); + } + + ipmi_tempMargin = dlist_pop_last(&ipmi->ipmi_global_agg_temp_margin); + while (ipmi_tempMargin != NULL) + { + EVEL_DEBUG("Freeing IPMI Global AGG Temp margin info (%s)", ipmi_tempMargin->globalAggTempID); + free(ipmi_tempMargin->globalAggTempID); + free(ipmi_tempMargin); + ipmi_tempMargin = dlist_pop_last(&ipmi->ipmi_global_agg_temp_margin); + } + + ipmi_nic = dlist_pop_last(&ipmi->ipmi_nic); + while (ipmi_nic != NULL) + { + EVEL_DEBUG("Freeing IPMI NIC Info (%s)", ipmi_nic->nicIdentifier); + free(ipmi_nic->nicIdentifier); + free(ipmi_nic); + ipmi_nic = dlist_pop_last(&ipmi->ipmi_nic); + } + + ipmi_power = dlist_pop_last(&ipmi->ipmi_power); + while (ipmi_power != NULL) + { + EVEL_DEBUG("Freeing IPMI Power Info (%s)", ipmi_power->powerSupplyIdentifier); + free(ipmi_power->powerSupplyIdentifier); + free(ipmi_power); + ipmi_power = dlist_pop_last(&ipmi->ipmi_power); + } + + ipmi_processor = dlist_pop_last(&ipmi->ipmi_processor); + while (ipmi_processor != NULL) + { + EVEL_DEBUG("Freeing IPMI Processor Info (%s)", ipmi_processor->processorIdentifier); + evel_measurement_free_ipmi_processor(ipmi_processor); + free(ipmi_processor); + ipmi_processor = dlist_pop_last(&ipmi->ipmi_processor); + } + + EVEL_EXIT(); +} /**************************************************************************//** * Free a Measurement. @@ -3596,17 +5940,20 @@ void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf, *****************************************************************************/ void evel_free_measurement(EVENT_MEASUREMENT * event) { + MEASUREMENT_HUGE_PAGE * huge_page = NULL; MEASUREMENT_CPU_USE * cpu_use = NULL; MEASUREMENT_DISK_USE * disk_use = NULL; MEASUREMENT_FSYS_USE * fsys_use = NULL; MEASUREMENT_LATENCY_BUCKET * bucket = NULL; MEASUREMENT_MEM_USE * mem_use = NULL; - MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL; - MEASUREMENT_FEATURE_USE * feature_use = NULL; + MEASUREMENT_NIC_PERFORMANCE * nic_performance = NULL; MEASUREMENT_CODEC_USE * codec_use = NULL; - MEASUREMENT_GROUP * measurement_group = NULL; - CUSTOM_MEASUREMENT * measurement = NULL; - OTHER_FIELD *addl_info = NULL; + MEASUREMENT_LOAD * load = NULL; + MEASUREMENT_PROCESS_STATS * proc_stat = NULL; + MEASUREMENT_IPMI * ipmi = NULL; + MACHINE_CHECK_EXCEPTION * machine_check = NULL; + EVEL_JSON_OBJECT * jsonobjp = NULL; + HASHTABLE_T *ht; EVEL_ENTER(); @@ -3620,19 +5967,19 @@ void evel_free_measurement(EVENT_MEASUREMENT * event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - addl_info = dlist_pop_last(&event->additional_info); - while (addl_info != NULL) + ht = event->additional_info; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Additional Info (%s, %s)", - addl_info->name, - addl_info->value); - free(addl_info->name); - free(addl_info->value); - free(addl_info); - addl_info = dlist_pop_last(&event->additional_info); + ht_destroy(ht); } - + jsonobjp = dlist_pop_last(&event->additional_objects); + while (jsonobjp != NULL) + { + EVEL_DEBUG("Freeing jsonObject %p",jsonobjp); + evel_free_jsonobject( jsonobjp ); + jsonobjp = dlist_pop_last(&event->additional_objects); + } cpu_use = dlist_pop_last(&event->cpu_usage); while (cpu_use != NULL) @@ -3642,6 +5989,7 @@ void evel_free_measurement(EVENT_MEASUREMENT * event) free(cpu_use); cpu_use = dlist_pop_last(&event->cpu_usage); } + disk_use = dlist_pop_last(&event->disk_usage); while (disk_use != NULL) { @@ -3650,11 +5998,11 @@ void evel_free_measurement(EVENT_MEASUREMENT * event) free(disk_use); disk_use = dlist_pop_last(&event->disk_usage); } + mem_use = dlist_pop_last(&event->mem_usage); while (mem_use != NULL) { - EVEL_DEBUG("Freeing Memory use Info (%s)", mem_use->id); - free(mem_use->id); + EVEL_DEBUG("Freeing Memory use Info - (%s)", mem_use->vmid); free(mem_use->vmid); free(mem_use); mem_use = dlist_pop_last(&event->mem_usage); @@ -3677,13 +6025,22 @@ void evel_free_measurement(EVENT_MEASUREMENT * event) bucket = dlist_pop_last(&event->latency_distribution); } - vnic_performance = dlist_pop_last(&event->vnic_usage); - while (vnic_performance != NULL) + nic_performance = dlist_pop_last(&event->nic_performance); + while (nic_performance != NULL) + { + EVEL_DEBUG("Freeing NIC performance Info (%s)", nic_performance->nic_id); + evel_measurement_free_nic_performance(nic_performance); + free(nic_performance); + nic_performance = dlist_pop_last(&event->nic_performance); + } + + ipmi = dlist_pop_last(&event->ipmis); + while (ipmi != NULL) { - EVEL_DEBUG("Freeing vNIC performance Info (%s)", vnic_performance->vnic_id); - evel_measurement_free_vnic_performance(vnic_performance); - free(vnic_performance); - vnic_performance = dlist_pop_last(&event->vnic_usage); + EVEL_DEBUG("Freeing IPMI"); + evel_measurement_free_ipmi(ipmi); + free(ipmi); + ipmi = dlist_pop_last(&event->ipmis); } codec_use = dlist_pop_last(&event->codec_usage); @@ -3695,38 +6052,54 @@ void evel_free_measurement(EVENT_MEASUREMENT * event) codec_use = dlist_pop_last(&event->codec_usage); } - if (event->errors != NULL) + proc_stat = dlist_pop_last(&event->process_stats); + while (proc_stat != NULL) { - EVEL_DEBUG("Freeing Errors"); - free(event->errors); + EVEL_DEBUG("Freeing Process Stats Info (%s)", proc_stat->processIdentifier); + free(proc_stat->processIdentifier); + free(proc_stat); + proc_stat = dlist_pop_last(&event->process_stats); } - feature_use = dlist_pop_last(&event->feature_usage); - while (feature_use != NULL) + load = dlist_pop_last(&event->loads); + while (load != NULL) { - EVEL_DEBUG("Freeing Feature use Info (%s)", feature_use->feature_id); - free(feature_use->feature_id); - free(feature_use); - feature_use = dlist_pop_last(&event->feature_usage); + EVEL_DEBUG("Freeing load Info"); + free(load); + load = dlist_pop_last(&event->loads); } - measurement_group = dlist_pop_last(&event->additional_measurements); - while (measurement_group != NULL) + ht = event->feature_usage; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Measurement Group (%s)", measurement_group->name); + ht_destroy(ht); + } - measurement = dlist_pop_last(&measurement_group->measurements); - while (measurement != NULL) - { - EVEL_DEBUG("Freeing Measurement (%s)", measurement->name); - free(measurement->name); - free(measurement->value); - free(measurement); - measurement = dlist_pop_last(&measurement_group->measurements); - } - free(measurement_group->name); - free(measurement_group); - measurement_group = dlist_pop_last(&event->additional_measurements); + huge_page = dlist_pop_last(&event->huge_pages); + while (huge_page != NULL) + { + EVEL_DEBUG("Freeing huge page id (%s)", huge_page->hugePagesIdentifier); + free(huge_page->hugePagesIdentifier); + free(huge_page); + huge_page = dlist_pop_last(&event->huge_pages); + } + + machine_check = dlist_pop_last(&event->machine_check_exception); + while (machine_check != NULL) + { + EVEL_DEBUG("Freeing machine check exception id (%s)", machine_check->process_id); + + free(machine_check->process_id); + free(machine_check); + machine_check = dlist_pop_last(&event->machine_check_exception); + } + + ht = dlist_pop_last(&event->additional_measurements); + while (ht != NULL) + { + EVEL_DEBUG("Freeing measurement additional_measurements %s", ht->hmName); + ht_destroy(ht); + ht = dlist_pop_last(&event->additional_measurements); } evel_free_header(&event->header); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_sipsignaling.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_sipsignaling.c index efc62db..6046bda 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_sipsignaling.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_sipsignaling.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include "evel_throttle.h" +#include "evel_internal.h" /**************************************************************************//** * Create a new Signaling event. @@ -89,7 +90,7 @@ EVENT_SIGNALING * evel_new_signaling(const char* ev_name, const char *ev_id, evel_set_option_string(&event->remote_port,remote_port,"Init remote port"); evel_init_option_string(&event->compressed_sip); evel_init_option_string(&event->summary_sip); - dlist_initialize(&event->additional_info); + event->additional_info = ht_create(); exit_label: @@ -114,7 +115,9 @@ exit_label: *****************************************************************************/ void evel_signaling_addl_info_add(EVENT_SIGNALING * event, char * name, char * value) { - FAULT_ADDL_INFO * addl_info = NULL; + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -126,15 +129,11 @@ void evel_signaling_addl_info_add(EVENT_SIGNALING * event, char * name, char * v assert(value != NULL); EVEL_DEBUG("Adding name=%s value=%s", name, value); - addl_info = malloc(sizeof(SIGNALING_ADDL_FIELD)); - assert(addl_info != NULL); - memset(addl_info, 0, sizeof(SIGNALING_ADDL_FIELD)); - addl_info->name = strdup(name); - addl_info->value = strdup(value); - assert(addl_info->name != NULL); - assert(addl_info->value != NULL); - dlist_push_last(&event->additional_info, addl_info); + nam = strdup(name); + val = strdup(value); + + ht_insert(event->additional_info, nam, val); EVEL_EXIT(); } @@ -453,8 +452,8 @@ void evel_signaling_correlator_set(EVENT_SIGNALING * const event, void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf, EVENT_SIGNALING * const event) { - SIGNALING_ADDL_FIELD * addl_info = NULL; - DLIST_ITEM * addl_info_item = NULL; + HASHTABLE_T *ht; + ENTRY_T *entry; EVEL_ENTER(); @@ -465,7 +464,7 @@ void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf, assert(event->header.event_domain == EVEL_DOMAIN_SIPSIGNALING); evel_json_encode_header(jbuf, &event->header); - evel_json_open_named_object(jbuf, "signalingFields"); + evel_json_open_named_object(jbuf, "sipSignalingFields"); /***************************************************************************/ /* Mandatory fields */ @@ -480,7 +479,7 @@ void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf, evel_enc_kv_opt_string(jbuf, "localPort", &event->local_port); evel_enc_kv_opt_string(jbuf, "remoteIpAddress", &event->remote_ip_address); evel_enc_kv_opt_string(jbuf, "remotePort", &event->remote_port); - evel_enc_version(jbuf, "signalingFieldsVersion", event->major_version,event->minor_version); + evel_enc_version(jbuf, "sipSignalingFieldsVersion", event->major_version,event->minor_version); evel_enc_kv_opt_string(jbuf, "summarySip", &event->summary_sip); evel_json_encode_vendor_field(jbuf, &event->vnfname_field); @@ -489,34 +488,48 @@ void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf, /* Checkpoint, so that we can wind back if all fields are suppressed. */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "additionalInformation")) - { - bool item_added = false; - addl_info_item = dlist_get_first(&event->additional_info); - while (addl_info_item != NULL) - { - addl_info = (SIGNALING_ADDL_FIELD*) addl_info_item->item; - assert(addl_info != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalInformation", - addl_info->name)) + ht = event->additional_info; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalInformation")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", addl_info->name); - evel_enc_kv_string(jbuf, "value", addl_info->value); - evel_json_close_object(jbuf); - item_added = true; + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalInformation", + entry->key)) + { + + // evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + // evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - addl_info_item = dlist_get_next(addl_info_item); } - evel_json_close_list(jbuf); - + evel_json_close_object(jbuf); + /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ /*************************************************************************/ - if (!item_added) + if (!added) { evel_json_rewind(jbuf); } @@ -537,7 +550,8 @@ void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf, *****************************************************************************/ void evel_free_signaling(EVENT_SIGNALING * const event) { - SIGNALING_ADDL_FIELD * addl_info = NULL; + HASHTABLE_T *ht; + EVEL_ENTER(); /***************************************************************************/ @@ -550,16 +564,10 @@ void evel_free_signaling(EVENT_SIGNALING * const event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - addl_info = dlist_pop_last(&event->additional_info); - while (addl_info != NULL) + ht = event->additional_info; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Additional Info (%s, %s)", - addl_info->name, - addl_info->value); - free(addl_info->name); - free(addl_info->value); - free(addl_info); - addl_info = dlist_pop_last(&event->additional_info); + ht_destroy(ht); } evel_free_event_vendor_field(&event->vnfname_field); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_state_change.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_state_change.c index eb81f97..906b299 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_state_change.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_state_change.c @@ -85,7 +85,7 @@ EVENT_STATE_CHANGE * evel_new_state_change(const char* ev_name, state_change->new_state = new_state; state_change->old_state = old_state; state_change->state_interface = strdup(interface); - dlist_initialize(&state_change->additional_fields); + state_change->additional_fields = ht_create(); exit_label: EVEL_EXIT(); @@ -103,7 +103,7 @@ exit_label: *****************************************************************************/ void evel_free_state_change(EVENT_STATE_CHANGE * const state_change) { - STATE_CHANGE_ADDL_FIELD * addl_field = NULL; + HASHTABLE_T *ht; EVEL_ENTER(); @@ -117,17 +117,12 @@ void evel_free_state_change(EVENT_STATE_CHANGE * const state_change) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - addl_field = dlist_pop_last(&state_change->additional_fields); - while (addl_field != NULL) + ht = state_change->additional_fields; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Additional Field (%s, %s)", - addl_field->name, - addl_field->value); - free(addl_field->name); - free(addl_field->value); - free(addl_field); - addl_field = dlist_pop_last(&state_change->additional_fields); + ht_destroy(ht); } + free(state_change->state_interface); evel_free_header(&state_change->header); @@ -180,7 +175,9 @@ void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change, const char * const name, const char * const value) { - STATE_CHANGE_ADDL_FIELD * addl_field = NULL; + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -192,15 +189,11 @@ void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change, assert(value != NULL); EVEL_DEBUG("Adding name=%s value=%s", name, value); - addl_field = malloc(sizeof(STATE_CHANGE_ADDL_FIELD)); - assert(addl_field != NULL); - memset(addl_field, 0, sizeof(STATE_CHANGE_ADDL_FIELD)); - addl_field->name = strdup(name); - addl_field->value = strdup(value); - assert(addl_field->name != NULL); - assert(addl_field->value != NULL); - dlist_push_last(&state_change->additional_fields, addl_field); + nam = strdup(name); + val = strdup(value); + + ht_insert(state_change->additional_fields, nam, val); EVEL_EXIT(); } @@ -214,8 +207,9 @@ void evel_state_change_addl_field_add(EVENT_STATE_CHANGE * const state_change, void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf, EVENT_STATE_CHANGE * state_change) { - STATE_CHANGE_ADDL_FIELD * addl_field = NULL; - DLIST_ITEM * addl_field_item = NULL; + HASHTABLE_T *ht; + ENTRY_T *entry; + char * new_state; char * old_state; @@ -244,34 +238,46 @@ void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf, /* Optional fields. */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "additionalFields")) + ht = state_change->additional_fields; + if( ht != NULL ) { - bool item_added = false; - - addl_field_item = dlist_get_first(&state_change->additional_fields); - while (addl_field_item != NULL) + bool added = false; + if( ht->size > 0) { - addl_field = (STATE_CHANGE_ADDL_FIELD *) addl_field_item->item; - assert(addl_field != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalFields", - addl_field->name)) + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", addl_field->name); - evel_enc_kv_string(jbuf, "value", addl_field->value); - evel_json_close_object(jbuf); - item_added = true; + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding heartBeatFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - addl_field_item = dlist_get_next(addl_field_item); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ /*************************************************************************/ - if (!item_added) + if (!added) { evel_json_rewind(jbuf); } diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_strings.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_strings.c index 3f0e7a4..6d4b6d4 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_strings.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_strings.c @@ -145,7 +145,7 @@ char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action) * @param alert_type The alert_type to convert. * @returns The equivalent string. *****************************************************************************/ -char * evel_alert_type(const EVEL_ALERT_TYPES alert_type) +char * evel_alert_type(const EVEL_ALERT_TYPE alert_type) { char * result; @@ -202,7 +202,7 @@ char * evel_event_domain(const EVEL_EVENT_DOMAINS domain) break; case EVEL_DOMAIN_MEASUREMENT: - result = "measurementsForVfScaling"; + result = "measurement"; break; case EVEL_DOMAIN_REPORT: @@ -241,6 +241,14 @@ char * evel_event_domain(const EVEL_EVENT_DOMAINS domain) result = "thresholdCrossingAlert"; break; + case EVEL_DOMAIN_NOTIFICATION: + result = "notification"; + break; + + case EVEL_DOMAIN_PNF_REGISTRATION: + result = "pnfRegistration"; + break; + default: result = NULL; EVEL_ERROR("Unexpected domain %d", domain); @@ -441,6 +449,104 @@ char * evel_entity_state(const EVEL_ENTITY_STATE state) } /**************************************************************************//** + * Convert a ::EVEL_OPTION_STATE to it's string form for JSON encoding. + * + * @param state The entity state to encode. + * + * @returns the corresponding string + *****************************************************************************/ +char * evel_entity_opt_state (EVEL_OPTION_STATE * const state) +{ + char * result; + + EVEL_ENTER(); + + if (state != NULL) + { + if (state->is_set) + { + switch (state->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: + EVEL_ERROR("Unexpected entity state %d", state); + assert(0); + } + } + else + { + result = NULL; + } + } + else + { + result = NULL; + } + + EVEL_EXIT(); + + return result; +} + +/**************************************************************************//** + * Convert a ::EVEL_OPTION_OP_STATE to it's string form for JSON encoding. + * + * @param state The entity state to encode. + * + * @returns the corresponding string + *****************************************************************************/ +char * evel_entity_opt_op_state (EVEL_OPTION_OP_STATE * const state) +{ + char * result; + + EVEL_ENTER(); + + if (state != NULL) + { + if (state->is_set) + { + switch (state->state) + { + case EVEL_OPER_STATE_IN_SERVICE: + result = "inService"; + break; + + case EVEL_OPER_STATE_OUT_OF_SERVICE: + result = "outOfService"; + break; + + default: + EVEL_ERROR("Unexpected entity state %d", state); + assert(0); + } + } + else + { + result = NULL; + } + } + else + { + result = NULL; + } + + EVEL_EXIT(); + + return result; +} + +/**************************************************************************//** * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding. * * @param endpoint_desc endpoint description to encode. diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_syslog.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_syslog.c index 06d8163..b97be7c 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_syslog.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_syslog.c @@ -83,14 +83,17 @@ EVENT_SYSLOG * evel_new_syslog(const char* ev_name, const char *ev_id, syslog->syslog_msg = strdup(syslog_msg); syslog->syslog_tag = strdup(syslog_tag); evel_init_option_int(&syslog->syslog_facility); + evel_init_option_int(&syslog->syslog_priority); evel_init_option_int(&syslog->syslog_proc_id); evel_init_option_int(&syslog->syslog_ver); - evel_init_option_string(&syslog->additional_filters); + syslog->additional_fields = ht_create(); evel_init_option_string(&syslog->event_source_host); evel_init_option_string(&syslog->syslog_proc); evel_init_option_string(&syslog->syslog_s_data); evel_init_option_string(&syslog->syslog_sdid); evel_init_option_string(&syslog->syslog_severity); + evel_init_option_string(&syslog->syslog_timeStamp); + evel_init_option_string(&syslog->syslog_msgHost); exit_label: EVEL_EXIT(); @@ -139,9 +142,13 @@ void evel_syslog_type_set(EVENT_SYSLOG * syslog, * does not need to preserve the value once the function * returns. *****************************************************************************/ -void evel_syslog_addl_filter_set(EVENT_SYSLOG * syslog, - char * filter) +void evel_syslog_addl_fields_set(EVENT_SYSLOG * syslog, + const char * const name, + const char * const value) { + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -149,11 +156,15 @@ void evel_syslog_addl_filter_set(EVENT_SYSLOG * syslog, /***************************************************************************/ assert(syslog != NULL); assert(syslog->header.event_domain == EVEL_DOMAIN_SYSLOG); - assert(filter != NULL); + assert(name != NULL); + assert(value != NULL); + + EVEL_DEBUG("Adding name=%s value=%s", name, value); + + nam = strdup(name); + val = strdup(value); - evel_set_option_string(&syslog->additional_filters, - filter, - "Syslog filter string"); + ht_insert(syslog->additional_fields, nam, val); EVEL_EXIT(); } @@ -219,6 +230,35 @@ void evel_syslog_facility_set(EVENT_SYSLOG * syslog, } /**************************************************************************//** + * Set the priority 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 priority The Syslog priority to be set. ASCIIZ string. The caller + * does not need to preserve the value once the function + * returns. + *****************************************************************************/ +void evel_syslog_priority_set(EVENT_SYSLOG * syslog, + const int priority) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(syslog != NULL); + assert(syslog->header.event_domain == EVEL_DOMAIN_SYSLOG); + + evel_set_option_int(&syslog->syslog_priority, + priority, + "priority"); + EVEL_EXIT(); +} + +/**************************************************************************//** * Set the Process property of the Syslog. * * @note The property is treated as immutable: it is only valid to call @@ -391,6 +431,56 @@ void evel_syslog_severity_set(EVENT_SYSLOG * syslog, const char * const severty) } EVEL_EXIT(); } +/**************************************************************************//** + * Set the timestamp parsed from non-VES syslog message + * + * @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 time_stamp The timestamp to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. + *****************************************************************************/ +void evel_syslog_timeStamp_set(EVENT_SYSLOG * syslog, const char * const time_stamp) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(syslog != NULL); + assert(syslog->header.event_domain == EVEL_DOMAIN_SYSLOG); + assert(time_stamp != NULL); + + evel_set_option_string(&syslog->syslog_timeStamp, time_stamp, "Timestamp"); + EVEL_EXIT(); +} +/**************************************************************************//** + * Set the hostname parsed from non-VES syslog message + * + * @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 msg_host The hostname to be set. ASCIIZ string. The caller does + * not need to preserve the value once the function returns. + *****************************************************************************/ +void evel_syslog_MsgHost_set(EVENT_SYSLOG * syslog, const char * const msg_host) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(syslog != NULL); + assert(syslog->header.event_domain == EVEL_DOMAIN_SYSLOG); + assert(msg_host != NULL); + + evel_set_option_string(&syslog->syslog_msgHost, msg_host, "Hostname"); + EVEL_EXIT(); +} /**************************************************************************//** * Encode the Syslog in JSON according to AT&T's schema for the event type. @@ -402,6 +492,8 @@ void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf, EVENT_SYSLOG * event) { char * event_source_type; + HASHTABLE_T *ht; + ENTRY_T *entry; EVEL_ENTER(); @@ -416,7 +508,60 @@ void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf, evel_json_encode_header(jbuf, &event->header); evel_json_open_named_object(jbuf, "syslogFields"); - evel_enc_kv_opt_string(jbuf, "additionalFields", &event->additional_filters); + /***************************************************************************/ + /* Checkpoint, so that we can wind back if all fields are suppressed. */ + /***************************************************************************/ + evel_json_checkpoint(jbuf); + + /***************************************************************************/ + /* Go through the Hashmap of additional information and encode key / Value */ + /***************************************************************************/ + ht = event->additional_fields; + if( ht != NULL ) + { + bool added = false; + if( ht->size > 0) + { + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) + { + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding syslog additionalFields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } + } + } + evel_json_close_object(jbuf); + + /*************************************************************************/ + /* If we've not written anything, rewind to before we opened the list. */ + /*************************************************************************/ + if (!added) + { + evel_json_rewind(jbuf); + } + } + /***************************************************************************/ /* Mandatory fields */ /***************************************************************************/ @@ -438,6 +583,8 @@ void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_string(jbuf, "syslogSdId", &event->syslog_sdid); evel_enc_kv_opt_string(jbuf, "syslogSev", &event->syslog_severity); evel_enc_kv_opt_int(jbuf, "syslogVer", &event->syslog_ver); + evel_enc_kv_opt_string(jbuf, "syslogMsgHost", &event->syslog_msgHost); + evel_enc_kv_opt_string(jbuf, "syslogTs", &event->syslog_timeStamp); evel_json_close_object(jbuf); EVEL_CT_ASSERT(EVEL_SYSLOG_FACILITY_KERNEL == 0); @@ -478,6 +625,7 @@ void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf, *****************************************************************************/ void evel_free_syslog(EVENT_SYSLOG * event) { + HASHTABLE_T *ht; EVEL_ENTER(); @@ -491,14 +639,20 @@ void evel_free_syslog(EVENT_SYSLOG * event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ + ht = event->additional_fields; + if( ht != NULL ) + { + ht_destroy(ht); + } - evel_free_option_string(&event->additional_filters); evel_free_option_string(&event->event_source_host); free(event->syslog_msg); evel_free_option_string(&event->syslog_proc); evel_free_option_string(&event->syslog_s_data); evel_free_option_string(&event->syslog_sdid); evel_free_option_string(&event->syslog_severity); + evel_free_option_string(&event->syslog_msgHost); + evel_free_option_string(&event->syslog_timeStamp); free(event->syslog_tag); evel_free_header(&event->header); diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_threshold_cross.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_threshold_cross.c index c66b08c..c308bc6 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_threshold_cross.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_threshold_cross.c @@ -38,16 +38,12 @@ * * @param event_name Unique Event Name confirming Domain AsdcVnfModel Description * @param event_id A universal identifier of the event for: troubleshooting correlation, 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 char* tcollectionTimestamp time at which alert was collected * @param EVEL_SEVERITIES teventSeverity Severity of Alert - * @param unsigned long long teventStartTimestamp Time when this alert started + * @param char* 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 @@ -55,30 +51,26 @@ * @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, + EVEL_ALERT_ACTIONS talertAction, char * talertDescription, EVEL_ALERT_TYPE talertType, - unsigned long long tcollectionTimestamp, + char * tcollectionTimestamp, EVEL_SEVERITIES teventSeverity, - unsigned long long teventStartTimestamp ) + char * teventStartTimestamp ) { EVENT_THRESHOLD_CROSS * event = NULL; + EVEL_ENTER(); - assert( tcriticality!= NULL ); - assert( tname!= NULL ); - assert( tthresholdCrossed != NULL ); - assert( tvalue!= NULL ); assert( talertDescription != NULL ); + assert( talertAction < EVEL_MAX_ALERT_ACTIONS ); + assert( talertType < EVEL_MAX_ANOMALY ); + assert( teventSeverity < EVEL_MAX_SEVERITIES ); - /***************************************************************************/ - /* Allocate the Threshold crossing event. */ - /***************************************************************************/ +/***************************************************************************/ +/* Allocate the Threshold crossing event. */ +/***************************************************************************/ event = malloc(sizeof(EVENT_THRESHOLD_CROSS)); if (event == NULL) { @@ -96,17 +88,12 @@ EVENT_THRESHOLD_CROSS * evel_new_threshold_cross(const char * ev_name, const cha event->major_version = EVEL_THRESHOLD_CROSS_MAJOR_VERSION; event->minor_version = EVEL_THRESHOLD_CROSS_MINOR_VERSION; - - event->additionalParameters.criticality = strdup(tcriticality); - event->additionalParameters.name = strdup(tname); - event->additionalParameters.thresholdCrossed = strdup(tthresholdCrossed); - event->additionalParameters.value = strdup(tvalue); event->alertAction = talertAction; event->alertDescription = strdup(talertDescription); event->alertType = talertType; - event->collectionTimestamp = tcollectionTimestamp; + event->collectionTimestamp = strdup(tcollectionTimestamp); event->eventSeverity = teventSeverity; - event->eventStartTimestamp = teventStartTimestamp; + event->eventStartTimestamp = strdup(teventStartTimestamp); evel_init_option_string(&event->alertValue); evel_init_option_string(&event->dataCollector); @@ -114,8 +101,9 @@ EVENT_THRESHOLD_CROSS * evel_new_threshold_cross(const char * ev_name, const cha evel_init_option_string(&event->interfaceName); evel_init_option_string(&event->networkService); evel_init_option_string(&event->possibleRootCause); - dlist_initialize(&event->additional_info); + event->additional_info = ht_create(); dlist_initialize(&event->alertidList); + dlist_initialize(&event->additionalParameters); exit_label: @@ -124,6 +112,76 @@ exit_label: } +/**************************************************************************//** + * Add the TCA additional performance counter + * + * @param tcp Pointer to the ::EVENT_THRESHOLD_CROSS. + * @param char* tcriticality Performance Counter criticality + * @param char* tthresholdCrossed Performance Counter Threshold name + *****************************************************************************/ +PERF_COUNTER * evel_threshold_cross_add_addl_parameters( + EVENT_THRESHOLD_CROSS * const event, + char * tcriticality, + char * tthresholdCrossed) +{ + PERF_COUNTER *perf_ctr = NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(event != NULL); + assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); + assert(tcriticality!= NULL); + assert(tthresholdCrossed != NULL); + + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ + EVEL_DEBUG("Adding criticality=%s, thresholdCrossed=%s", tcriticality, tthresholdCrossed); + perf_ctr = malloc(sizeof(PERF_COUNTER)); + assert(perf_ctr != NULL); + perf_ctr->criticality = strdup(tcriticality); + perf_ctr->thresholdCrossed = strdup(tthresholdCrossed); + perf_ctr->hashmap = ht_create(); + + dlist_push_last(&event->additionalParameters, perf_ctr); + + EVEL_EXIT(); + return perf_ctr; +} + +/**************************************************************************//** + * Set the TCA name / Value for additional performance counter + * + * @param PERF_COUNTER perf_ctr Pointer to additional Parameter array element + * @param char* name Performance Counter Threshold name + * @param char* value Performance Counter actual value + *****************************************************************************/ +void evel_threshold_cross_addl_parameters_hashmap_set( + PERF_COUNTER * perf_ctr, + char * name, + char * value) +{ + char * nam = NULL; + char * val = NULL; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ + assert(perf_ctr != NULL); + assert(name != NULL); + assert(value != NULL); + + nam = strdup(name); + val = strdup(value); + ht_insert(perf_ctr->hashmap, nam, val); + + EVEL_EXIT(); +} /**************************************************************************//** * Set the Event Type property of the TC Alert. @@ -190,7 +248,8 @@ void evel_threshold_cross_alertid_add(EVENT_THRESHOLD_CROSS * const event,char * *****************************************************************************/ void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const event, const char * name, const char * value) { - OTHER_FIELD * nv_pair = NULL; + char *nam=NULL; + char *val=NULL; EVEL_ENTER(); @@ -202,15 +261,10 @@ void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const event, con assert(name != NULL); assert(value != NULL); + nam = strdup(name); + val = strdup(value); EVEL_DEBUG("Adding name=%s value=%s", name, value); - nv_pair = malloc(sizeof(OTHER_FIELD)); - assert(nv_pair != NULL); - nv_pair->name = strdup(name); - nv_pair->value = strdup(value); - assert(nv_pair->name != NULL); - assert(nv_pair->value != NULL); - - dlist_push_last(&event->additional_info, nv_pair); + ht_insert(event->additional_info, nam, val); EVEL_EXIT(); } @@ -226,8 +280,10 @@ void evel_threshold_cross_addl_info_add(EVENT_THRESHOLD_CROSS * const event, con *****************************************************************************/ void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const event) { - OTHER_FIELD * addl_info = NULL; + HASHTABLE_T *ht; char *ptr; + PERF_COUNTER * perf_ctr = NULL; + EVEL_ENTER(); /***************************************************************************/ @@ -240,17 +296,12 @@ void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const event) /***************************************************************************/ /* Free all internal strings then the header itself. */ /***************************************************************************/ - addl_info = dlist_pop_last(&event->additional_info); - while (addl_info != NULL) + ht = event->additional_info; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Additional Info (%s, %s)", - addl_info->name, - addl_info->value); - free(addl_info->name); - free(addl_info->value); - free(addl_info); - addl_info = dlist_pop_last(&event->additional_info); + ht_destroy(ht); } + ptr = dlist_pop_last(&event->alertidList); while (ptr != NULL) { @@ -258,10 +309,17 @@ void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const event) ptr = dlist_pop_last(&event->alertidList); } - free(event->additionalParameters.criticality); - free(event->additionalParameters.name); - free(event->additionalParameters.thresholdCrossed); - free(event->additionalParameters.value); + perf_ctr = dlist_pop_last(&event->additionalParameters); + while (perf_ctr != NULL) + { + EVEL_DEBUG("Freeing Other performance counter"); + ht_destroy(perf_ctr->hashmap); + free(perf_ctr->criticality); + free(perf_ctr->thresholdCrossed); + free(perf_ctr); + perf_ctr = dlist_pop_last(&event->additionalParameters); + } + free(event->alertDescription); evel_free_option_string(&event->alertValue); @@ -275,145 +333,147 @@ void evel_free_threshold_cross(EVENT_THRESHOLD_CROSS * const event) EVEL_EXIT(); } - /**************************************************************************//** - * 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) - { - EVEL_ENTER(); +/**************************************************************************//** + * 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) +{ + EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); - assert(sheader != NULL); + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); + assert(sheader != NULL); - evel_set_option_string(&event->possibleRootCause, - sheader, - "Rootcause value"); + evel_set_option_string(&event->possibleRootCause, + sheader, + "Rootcause value"); - EVEL_EXIT(); - } + EVEL_EXIT(); +} - /**************************************************************************//** - * 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) - { - EVEL_ENTER(); +/**************************************************************************//** + * 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) +{ + EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); - assert(sheader != NULL); + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); + assert(sheader != NULL); - evel_set_option_string(&event->networkService, - sheader, - "Networking service value"); + evel_set_option_string(&event->networkService, + sheader, + "Networking service value"); - EVEL_EXIT(); - } + EVEL_EXIT(); +} - /**************************************************************************//** - * Set the TCA Interface name. - * - * @param sheader Interface name to threshold - *****************************************************************************/ - void evel_threshold_cross_interfacename_set(EVENT_THRESHOLD_CROSS * const event,char * sheader) - { - EVEL_ENTER(); - - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); - assert(sheader != NULL); - - evel_set_option_string(&event->interfaceName, - sheader, - "TCA Interface name"); - EVEL_EXIT(); - } + /**************************************************************************//** + * Set the TCA Interface name. + * + * @param sheader Interface name to threshold + *****************************************************************************/ +void evel_threshold_cross_interfacename_set(EVENT_THRESHOLD_CROSS * const event,char * sheader) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); + assert(sheader != NULL); + + evel_set_option_string(&event->interfaceName, + sheader, + "TCA Interface name"); + EVEL_EXIT(); +} - /**************************************************************************//** - * 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) - { - EVEL_ENTER(); - - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); - assert(sheader != NULL); - - evel_set_option_string(&event->elementType, - sheader, - "TCA Element type value"); - EVEL_EXIT(); - } +/**************************************************************************//** + * 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) +{ + EVEL_ENTER(); - /**************************************************************************//** - * 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) - { - EVEL_ENTER(); - - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); - assert(sheader != NULL); - - evel_set_option_string(&event->dataCollector, - sheader, - "Datacollector value"); - EVEL_EXIT(); - } + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); + assert(sheader != NULL); + + evel_set_option_string(&event->elementType, + sheader, + "TCA Element type value"); + EVEL_EXIT(); +} + +/**************************************************************************//** + * 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) +{ + EVEL_ENTER(); + +/***************************************************************************/ +/* Check preconditions. */ +/***************************************************************************/ + assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); + assert(sheader != NULL); + + evel_set_option_string(&event->dataCollector, + sheader, + "Datacollector value"); + EVEL_EXIT(); +} - /**************************************************************************//** - * Set the TCA alert value. - * - * @param sheader Possible alert value - *****************************************************************************/ - void evel_threshold_cross_alertvalue_set(EVENT_THRESHOLD_CROSS * const event,char * sheader) - { - EVEL_ENTER(); - - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); - assert(sheader != NULL); - - evel_set_option_string(&event->alertValue, - sheader, - "Alert value"); - EVEL_EXIT(); - } +/**************************************************************************//** + * Set the TCA alert value. + * + * @param sheader Possible alert value + *****************************************************************************/ +void evel_threshold_cross_alertvalue_set(EVENT_THRESHOLD_CROSS * const event,char * sheader) +{ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); + assert(sheader != NULL); + + evel_set_option_string(&event->alertValue, + sheader, + "Alert value"); + EVEL_EXIT(); +} /**************************************************************************//** - * Encode the Mobile Flow GTP Per Flow Metrics as a JSON object. + * Encode the performance counter as a JSON object. * * @param jbuf Pointer to working ::EVEL_JSON_BUFFER. - * @param metrics Pointer to the ::EVENT_MOBILE_FLOW to encode. - * @returns Number of bytes actually written. + * @param pcounter Pointer to the performance counter to encode. *****************************************************************************/ void evel_json_encode_perf_counter( EVEL_JSON_BUFFER * jbuf, PERF_COUNTER *pcounter) { + HASHTABLE_T *ht; + ENTRY_T *entry; + EVEL_ENTER(); /***************************************************************************/ @@ -422,16 +482,39 @@ void evel_json_encode_perf_counter( EVEL_JSON_BUFFER * jbuf, PERF_COUNTER *pcoun assert(jbuf != NULL); assert(pcounter != NULL); - evel_json_open_named_object(jbuf, "additionalParameters"); - + evel_json_open_object(jbuf); /***************************************************************************/ /* Mandatory parameters. */ /***************************************************************************/ evel_enc_kv_string(jbuf, "criticality", pcounter->criticality); - evel_enc_kv_string(jbuf, "name", pcounter->name); - evel_enc_kv_string(jbuf, "thresholdCrossed", pcounter->name); - evel_enc_kv_string(jbuf, "value", pcounter->value); - + evel_enc_kv_string(jbuf, "thresholdCrossed", pcounter->thresholdCrossed); + ht = pcounter->hashmap; + if( ht != NULL ) + { + if( ht->size > 0) + { + if (evel_json_open_opt_named_object(jbuf, "hashMap")) + { + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding TCAFields %s %s",(char *) (entry->key), entry->value); + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + entry = entry->next; + } + } + } + evel_json_close_object(jbuf); + } + } evel_json_close_object(jbuf); EVEL_EXIT(); @@ -447,8 +530,14 @@ void evel_json_encode_perf_counter( EVEL_JSON_BUFFER * jbuf, PERF_COUNTER *pcoun void evel_json_encode_threshold_cross(EVEL_JSON_BUFFER * const jbuf, EVENT_THRESHOLD_CROSS * const event) { - OTHER_FIELD * nv_pair = NULL; - DLIST_ITEM * dlist_item = NULL; + HASHTABLE_T *ht; + ENTRY_T *entry; + char * alert_action = NULL; + char * alert_type = NULL; + char * event_sev = NULL; + DLIST_ITEM * item = NULL; + char * alert_id = NULL; + PERF_COUNTER * perf_ctr = NULL; EVEL_ENTER(); @@ -459,19 +548,38 @@ void evel_json_encode_threshold_cross(EVEL_JSON_BUFFER * const jbuf, assert(event->header.event_domain == EVEL_DOMAIN_THRESHOLD_CROSS); evel_json_encode_header(jbuf, &event->header); - evel_json_open_named_object(jbuf, "thresholdCrossingAlert"); + evel_json_open_named_object(jbuf, "thresholdCrossingAlertFields"); /***************************************************************************/ /* Mandatory fields */ /***************************************************************************/ - evel_json_encode_perf_counter(jbuf, &event->additionalParameters); - evel_enc_kv_int(jbuf, "alertAction", event->alertAction); + + evel_json_open_named_list(jbuf, "additionalParameters"); + + item = dlist_get_first(&event->additionalParameters); + while (item != NULL) + { + perf_ctr = (PERF_COUNTER *) item->item; + assert(perf_ctr != NULL); + evel_json_encode_perf_counter(jbuf, perf_ctr); + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + + alert_action = evel_alert_action(event->alertAction); + evel_enc_kv_string(jbuf, "alertAction", alert_action); evel_enc_kv_string(jbuf, "alertDescription", event->alertDescription); - evel_enc_kv_int(jbuf, "alertType", event->alertType); - evel_enc_kv_ull( + + alert_type = evel_alert_type(event->alertType); + evel_enc_kv_string(jbuf, "alertType", alert_type); + + evel_enc_kv_string( jbuf, "collectionTimestamp", event->collectionTimestamp); - evel_enc_kv_int(jbuf, "eventSeverity", event->eventSeverity); - evel_enc_kv_ull( + + event_sev = evel_severity(event->eventSeverity); + evel_enc_kv_string(jbuf, "eventSeverity", event_sev); + + evel_enc_kv_string( jbuf, "eventStartTimestamp", event->eventStartTimestamp); /***************************************************************************/ @@ -484,33 +592,63 @@ void evel_json_encode_threshold_cross(EVEL_JSON_BUFFER * const jbuf, evel_enc_kv_opt_string(jbuf, "networkService", &event->networkService); evel_enc_kv_opt_string(jbuf, "possibleRootCause", &event->possibleRootCause); + evel_json_checkpoint(jbuf); + evel_json_open_named_list(jbuf, "associatedAlertIdList"); + bool added = false; + item = dlist_get_first(&event->alertidList); + while (item != NULL) + { + alert_id = (char *)item->item; + evel_enc_list_item(jbuf, "\"%s\"", alert_id); + added = true; + item = dlist_get_next(item); + } + evel_json_close_list(jbuf); + if (!added) + { + evel_json_rewind(jbuf); + } + /***************************************************************************/ /* Checkpoint, so that we can wind back if all fields are suppressed. */ /***************************************************************************/ evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "additionalFields")) + ht = event->additional_info; + if( ht != NULL ) { bool added = false; - - dlist_item = dlist_get_first(&event->additional_info); - while (dlist_item != NULL) + if( ht->size > 0) { - nv_pair = (OTHER_FIELD *) dlist_item->item; - assert(nv_pair != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalFields", - nv_pair->name)) + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalFields")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", nv_pair->name); - evel_enc_kv_string(jbuf, "value", nv_pair->value); - evel_json_close_object(jbuf); - added = true; + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding TCA Fields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalFields", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - dlist_item = dlist_get_next(dlist_item); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ @@ -520,6 +658,7 @@ void evel_json_encode_threshold_cross(EVEL_JSON_BUFFER * const jbuf, evel_json_rewind(jbuf); } } + evel_enc_version(jbuf, "thresholdCrossingFieldsVersion", event->major_version, diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_throttle.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_throttle.c index ac664a1..772fefc 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_throttle.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_throttle.c @@ -131,11 +131,13 @@ static const char * evel_domain_strings[EVEL_MAX_DOMAINS] = { "measurementsForVfScaling", "mobileFlow", "report", - "serviceEvents", - "signaling", + "sipSignaling", "stateChange", "syslog", "other", + "thresholdCrossingAlert", + "notification", + "pnfRegistration", "voiceQuality", "maxDomain" }; @@ -1937,6 +1939,7 @@ EVEL_EVENT_DOMAINS evel_decode_domain(char * domain_value) if (strcmp(evel_domain_strings[ii], domain_value) == 0) { result = ii; + break; } } diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_unit.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_unit.c new file mode 100644 index 0000000..169944f --- /dev/null +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_unit.c @@ -0,0 +1,132 @@ +#include <stdio.h> +#include <string.h> +#include <assert.h> +#include <stdlib.h> +#include <sys/time.h> + +#include "evel.h" +#include "evel_internal.h" +#include "evel_throttle.h" +#include "metadata.h" + +static void test_encode_heartbeat(); +static void test_encode_header_overrides(); +static void compare_strings(char * expected, + char * actual, + int max_size, + char * description); + +int main(int argc, char ** argv) +{ + assert(argc >= 0); + assert(argv != NULL); + + /***************************************************************************/ + /* Fix our timezone to UTC. */ + /***************************************************************************/ + putenv("TZ=UTC"); + + /***************************************************************************/ + /* Initialize metadata. */ + /***************************************************************************/ + openstack_metadata_initialize(); + + /***************************************************************************/ + /* Minimal initialisation to exercise the encoders. */ + /***************************************************************************/ + functional_role = "UNIT TEST"; + log_initialize(EVEL_LOG_DEBUG, "EVEL"); + /***************************************************************************/ + /* Test each encoder. */ + /***************************************************************************/ + test_encode_heartbeat(); + test_encode_header_overrides(); + printf ("\nAll Tests Passed\n"); + + return 0; +} + + +void test_encode_heartbeat() +{ + char * expected = + "{\"event\": {" + "\"commonEventHeader\": {" + "\"domain\": \"heartbeat\", " + "\"eventId\": \"121\", " + "\"functionalRole\": \"UNIT TEST\", " + "\"lastEpochMicrosec\": 1000002, " + "\"priority\": \"Normal\", " + "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"sequence\": 121, " + "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"startEpochMicrosec\": 1000002, " + "\"version\": 1.2, " + "\"eventType\": \"Autonomous heartbeat\", " + "\"reportingEntityId\": \"Dummy VM UUID - No Metadata available\", " + "\"sourceId\": \"Dummy VM UUID - No Metadata available\"" + "}}}"; + + size_t json_size = 0; + char json_body[EVEL_MAX_JSON_BODY]; + + /***************************************************************************/ + /* Test the VM name/uuid once. */ + /***************************************************************************/ + evel_set_next_event_sequence(121); + + EVENT_HEADER * heartbeat = evel_new_heartbeat(); + assert(heartbeat != NULL); + + json_size = evel_json_encode_event( + json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) heartbeat); + compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Heartbeat"); + assert((json_size == strlen(json_body)) && "Bad size returned"); + + evel_free_event(heartbeat); +} + +void test_encode_header_overrides() +{ + char * expected = + "{\"event\": {" + "\"commonEventHeader\": {" + "\"domain\": \"heartbeat\", " + "\"eventId\": \"121\", " + "\"functionalRole\": \"UNIT TEST\", " + "\"lastEpochMicrosec\": 1000, " + "\"priority\": \"Normal\", " + "\"reportingEntityName\": \"entity_name_override\", " + "\"sequence\": 121, " + "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"startEpochMicrosec\": 1001, " + "\"version\": 1.2, " + "\"eventType\": \"Autonomous heartbeat\", " + "\"reportingEntityId\": \"entity_id_override\", " + "\"sourceId\": \"Dummy VM UUID - No Metadata available\"" + "}}}"; + + size_t json_size = 0; + char json_body[EVEL_MAX_JSON_BODY]; + + /***************************************************************************/ + /* Test the VM name/uuid once. */ + /***************************************************************************/ + evel_set_next_event_sequence(121); + + EVENT_HEADER * heartbeat = evel_new_heartbeat(); + assert(heartbeat != NULL); + + evel_start_epoch_set(heartbeat, 1001); + evel_last_epoch_set(heartbeat, 1000); + evel_reporting_entity_name_set(heartbeat, "entity_name_override"); + evel_reporting_entity_id_set(heartbeat, "entity_id_override"); + + json_size = evel_json_encode_event( + json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) heartbeat); + compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Heartbeat"); + assert((json_size == strlen(json_body)) && "Bad size returned"); + + evel_free_event(heartbeat); +} + diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_voicequality.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_voicequality.c index 04238d1..bb9f8bc 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_voicequality.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/evel_voicequality.c @@ -57,9 +57,9 @@ EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev EVENT_VOICE_QUALITY *voiceQuality = NULL; EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /**************************************************************************/ + /* Check preconditions. */ + /**************************************************************************/ assert(calleeSideCodec != NULL); assert(callerSideCodec != NULL); assert(correlator != NULL); @@ -82,10 +82,10 @@ EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev memset(voiceQuality, 0, sizeof(EVENT_VOICE_QUALITY)); EVEL_DEBUG("New Voice Quality is at %lp", voiceQuality); - /***************************************************************************/ - /* Initialize the header & the fault fields. Optional integer values are */ - /* initialized as 0. */ - /***************************************************************************/ + /***************************************************************************/ + /* Initialize the header & the fault fields. Optional integer values are */ + /* initialized as 0. */ + /***************************************************************************/ evel_init_header_nameid(&voiceQuality->header,ev_name,ev_id); voiceQuality->header.event_domain = EVEL_DOMAIN_VOICE_QUALITY; voiceQuality->major_version = EVEL_VOICEQ_MAJOR_VERSION; @@ -96,7 +96,7 @@ EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev voiceQuality->correlator = strdup(correlator); voiceQuality->midCallRtcp = strdup(midCallRtcp); evel_init_vendor_field(&voiceQuality->vendorVnfNameFields, vendorName); - dlist_initialize(&voiceQuality->additionalInformation); + voiceQuality->additionalInformation = ht_create(); voiceQuality->endOfCallVqmSummaries = NULL; evel_init_option_string(&voiceQuality->phoneNumber); } @@ -122,27 +122,26 @@ EVENT_VOICE_QUALITY * evel_new_voice_quality(const char* ev_name, const char *ev * returns. *****************************************************************************/ void evel_voice_quality_addl_info_add(EVENT_VOICE_QUALITY * voiceQ, char * name, char * value) { - VOICE_QUALITY_ADDL_INFO * addlInfo = NULL; + + char *nam=NULL; + char *val=NULL; + EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQ != NULL); assert(voiceQ->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(name != NULL); assert(value != NULL); EVEL_DEBUG("Adding name=%s value=%s", name, value); - addlInfo = malloc(sizeof(VOICE_QUALITY_ADDL_INFO)); - assert(addlInfo != NULL); - memset(addlInfo, 0, sizeof(VOICE_QUALITY_ADDL_INFO)); - addlInfo->name = strdup(name); - addlInfo->value = strdup(value); - assert(addlInfo->name != NULL); - assert(addlInfo->value != NULL); - dlist_push_last(&voiceQ->additionalInformation, addlInfo); + nam = strdup(name); + val = strdup(value); + + ht_insert(voiceQ->additionalInformation, nam, val); EVEL_EXIT(); } @@ -164,9 +163,9 @@ void evel_voice_quality_callee_codec_set(EVENT_VOICE_QUALITY * voiceQuality, const char * const calleeCodecForCall) { EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(calleeCodecForCall != NULL); @@ -193,9 +192,9 @@ void evel_voice_quality_caller_codec_set(EVENT_VOICE_QUALITY * voiceQuality, const char * const callerCodecForCall) { EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(callerCodecForCall != NULL); @@ -222,9 +221,9 @@ void evel_voice_quality_correlator_set(EVENT_VOICE_QUALITY * voiceQuality, const char * const vCorrelator) { EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(vCorrelator != NULL); @@ -251,9 +250,9 @@ void evel_voice_quality_rtcp_data_set(EVENT_VOICE_QUALITY * voiceQuality, const char * const rtcpCallData) { EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(rtcpCallData != NULL); @@ -277,12 +276,13 @@ void evel_voice_quality_rtcp_data_set(EVENT_VOICE_QUALITY * voiceQuality, * returns. *****************************************************************************/ void evel_voice_quality_vnfmodule_name_set(EVENT_VOICE_QUALITY * voiceQuality, - const char * const module_name) { + const char * const module_name) +{ EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(module_name != NULL); @@ -306,12 +306,13 @@ void evel_voice_quality_vnfmodule_name_set(EVENT_VOICE_QUALITY * voiceQuality, * returns. *****************************************************************************/ void evel_voice_quality_vnfname_set(EVENT_VOICE_QUALITY * voiceQuality, - const char * const vnfname) { + const char * const vnfname) +{ EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(vnfname != NULL); @@ -335,12 +336,13 @@ void evel_voice_quality_vnfname_set(EVENT_VOICE_QUALITY * voiceQuality, * returns. *****************************************************************************/ void evel_voice_quality_phone_number_set(EVENT_VOICE_QUALITY * voiceQuality, - const char * const phoneNumber) { + const char * const phoneNumber) +{ EVEL_ENTER(); - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(phoneNumber != NULL); @@ -360,14 +362,14 @@ void evel_voice_quality_phone_number_set(EVENT_VOICE_QUALITY * voiceQuality, * @param voiceQuality Pointer to the measurement. * @param adjacencyName Adjacency name * @param endpointDescription Enumeration: ‘Caller’, ‘Callee’. - * @param endpointJitter Endpoint jitter + * @param localRtpOctetsLost Local RTP Octets Lost * @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 localMaxJitterBufferDelay Local max jitter buffer Delay. * @param localRtpOctetsDiscarded Local RTP octets discarded. * @param localRtpOctetsReceived Local RTP octets received. * @param localRtpOctetsSent Local RTP octets sent. @@ -376,21 +378,29 @@ void evel_voice_quality_phone_number_set(EVENT_VOICE_QUALITY * voiceQuality, * @param localRtpPacketsSent Local RTP packets sent. * @param mosCqe Decimal range from 1 to 5 * (1 decimal place) - * @param packetsLost No Packets lost + * @param localRtpPacketsLost Local RTP Packets lost * @param packetLossPercent Calculated percentage packet loss * @param rFactor rFactor from 0 to 100 * @param roundTripDelay Round trip delay in milliseconds + * @param endpointAverageJitter Endpoint average jitter + * @param endpointMaxJitter Endpoint maximum jitter + * @param endpointRtpOctetsLost Endpoint RTP octets lost + * @param endpointRtpPacketsLost Endpoint RTP packets lost + * @param localAverageJitter Local average jitter + * @param localAverageJitterBufferDelay Local average jitter buffer delay + * @param localMaxJitter Local maximum jitter + * @param oneWayDelay one-way path delay in milliseconds *****************************************************************************/ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, const char * adjacencyName, EVEL_SERVICE_ENDPOINT_DESC endpointDescription, - int endpointJitter, + int localRtpOctetsLost, int endpointRtpOctetsDiscarded, int endpointRtpOctetsReceived, int endpointRtpOctetsSent, int endpointRtpPacketsDiscarded, int endpointRtpPacketsReceived, int endpointRtpPacketsSent, - int localJitter, + int localMaxJitterBufferDelay, int localRtpOctetsDiscarded, int localRtpOctetsReceived, int localRtpOctetsSent, @@ -398,17 +408,26 @@ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, int localRtpPacketsReceived, int localRtpPacketsSent, int mosCqe, - int packetsLost, + int localRtpPacketsLost, int packetLossPercent, int rFactor, - int roundTripDelay) { + int roundTripDelay, + int endpointAverageJitter, + int endpointMaxJitter, + int endpointRtpOctetsLost, + int endpointRtpPacketsLost, + int localAverageJitter, + int localAverageJitterBufferDelay, + int localMaxJitter, + int oneWayDelay) +{ END_OF_CALL_VOICE_QUALITY_METRICS * vQMetrices = NULL; EVEL_ENTER(); - /***************************************************************************/ - /* Check assumptions. */ - /***************************************************************************/ + /***************************************************************************/ + /* Check assumptions. */ + /***************************************************************************/ assert(voiceQuality != NULL); assert(voiceQuality->header.event_domain == EVEL_DOMAIN_VOICE_QUALITY); assert(adjacencyName != NULL); @@ -417,9 +436,9 @@ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, assert(rFactor >= 0 && rFactor <= 100); assert(voiceQuality->endOfCallVqmSummaries == NULL); - /***************************************************************************/ - /* Allocate a container for the value and push onto the list. */ - /***************************************************************************/ + /***************************************************************************/ + /* Allocate a container for the value and push onto the list. */ + /***************************************************************************/ EVEL_DEBUG("Adding adjacencyName=%s endpointDescription=%d", adjacencyName, endpointDescription); vQMetrices = malloc(sizeof(END_OF_CALL_VOICE_QUALITY_METRICS)); assert(vQMetrices != NULL); @@ -428,14 +447,14 @@ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, vQMetrices->adjacencyName = strdup(adjacencyName); vQMetrices->endpointDescription = evel_service_endpoint_desc(endpointDescription); - evel_set_option_int(&vQMetrices->endpointJitter, endpointJitter, "Endpoint jitter"); + evel_set_option_int(&vQMetrices->localRtpOctetsLost, localRtpOctetsLost, "local RTP Octets Lost"); evel_set_option_int(&vQMetrices->endpointRtpOctetsDiscarded, endpointRtpOctetsDiscarded, "Endpoint RTP octets discarded"); evel_set_option_int(&vQMetrices->endpointRtpOctetsReceived, endpointRtpOctetsReceived, "Endpoint RTP octets received"); evel_set_option_int(&vQMetrices->endpointRtpOctetsSent, endpointRtpOctetsSent, "Endpoint RTP octets sent"); evel_set_option_int(&vQMetrices->endpointRtpPacketsDiscarded, endpointRtpPacketsDiscarded, "Endpoint RTP packets discarded"); evel_set_option_int(&vQMetrices->endpointRtpPacketsReceived, endpointRtpPacketsReceived, "Endpoint RTP packets received"); evel_set_option_int(&vQMetrices->endpointRtpPacketsSent, endpointRtpPacketsSent, "Endpoint RTP packets sent"); - evel_set_option_int(&vQMetrices->localJitter, localJitter, "Local jitter"); + evel_set_option_int(&vQMetrices->localMaxJitterBufferDelay, localMaxJitterBufferDelay, "Local Max jitter buffer delay"); evel_set_option_int(&vQMetrices->localRtpOctetsDiscarded, localRtpOctetsDiscarded, "Local RTP octets discarded"); evel_set_option_int(&vQMetrices->localRtpOctetsReceived, localRtpOctetsReceived, "Local RTP octets received"); evel_set_option_int(&vQMetrices->localRtpOctetsSent, localRtpOctetsSent, "Local RTP octets sent"); @@ -443,10 +462,18 @@ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, evel_set_option_int(&vQMetrices->localRtpPacketsReceived, localRtpPacketsReceived, "Local RTP packets received"); evel_set_option_int(&vQMetrices->localRtpPacketsSent, localRtpPacketsSent, "Local RTP packets sent"); evel_set_option_int(&vQMetrices->mosCqe, mosCqe, "Decimal range from 1 to 5 (1 decimal place)"); - evel_set_option_int(&vQMetrices->packetsLost, packetsLost, "Packets lost"); + evel_set_option_int(&vQMetrices->localRtpPacketsLost, localRtpPacketsLost, "Local RTP Packets lost"); evel_set_option_int(&vQMetrices->packetLossPercent, packetLossPercent, "Calculated percentage packet loss"); evel_set_option_int(&vQMetrices->rFactor, rFactor, "rFactor "); evel_set_option_int(&vQMetrices->roundTripDelay, roundTripDelay, "Round trip delay in milliseconds "); + evel_set_option_int(&vQMetrices->endpointAverageJitter, endpointAverageJitter, "Endpoint average jitter"); + evel_set_option_int(&vQMetrices->endpointMaxJitter, endpointMaxJitter, "Endpoint maximum jitter"); + evel_set_option_int(&vQMetrices->endpointRtpOctetsLost, endpointRtpOctetsLost, "Endpoint RTP octets lost"); + evel_set_option_int(&vQMetrices->endpointRtpPacketsLost, endpointRtpPacketsLost, "Endpoint RTP packets lost"); + evel_set_option_int(&vQMetrices->localAverageJitter, localAverageJitter, "Local average jitter"); + evel_set_option_int(&vQMetrices->localAverageJitterBufferDelay, localAverageJitterBufferDelay, "Local average jitter buffer delay"); + evel_set_option_int(&vQMetrices->localMaxJitter, localMaxJitter, "Local maximum jitter"); + evel_set_option_int(&vQMetrices->oneWayDelay, oneWayDelay, "one-way path delay in milliseconds"); voiceQuality->endOfCallVqmSummaries = vQMetrices; @@ -463,8 +490,8 @@ void evel_voice_quality_end_metrics_add(EVENT_VOICE_QUALITY * voiceQuality, void evel_json_encode_voice_quality(EVEL_JSON_BUFFER * jbuf, EVENT_VOICE_QUALITY * event) { - VOICE_QUALITY_ADDL_INFO * addlInfo = NULL; - DLIST_ITEM * addlInfoItem = NULL; + HASHTABLE_T *ht; + ENTRY_T *entry; END_OF_CALL_VOICE_QUALITY_METRICS * vQMetrics = NULL; @@ -498,35 +525,49 @@ void evel_json_encode_voice_quality(EVEL_JSON_BUFFER * jbuf, /* Checkpoint, so that we can wind back if all fields are suppressed. */ /***************************************************************************/ //additionalInformation for Voice Quality - bool item_added = false; - + evel_json_checkpoint(jbuf); - if (evel_json_open_opt_named_list(jbuf, "additionalInformation")) + ht = event->additionalInformation; + if( ht != NULL ) { - - addlInfoItem = dlist_get_first(&event->additionalInformation); - while (addlInfoItem != NULL) + bool added = false; + if( ht->size > 0) { - addlInfo = (VOICE_QUALITY_ADDL_INFO*)addlInfoItem->item; - assert(addlInfo != NULL); - - if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, - "additionalInformation", - addlInfo->name)) + evel_json_checkpoint(jbuf); + if (evel_json_open_opt_named_object(jbuf, "additionalInformation")) { - evel_json_open_object(jbuf); - evel_enc_kv_string(jbuf, "name", addlInfo->name); - evel_enc_kv_string(jbuf, "value", addlInfo->value); - evel_json_close_object(jbuf); - item_added = true; + + for(unsigned int idx = 0; idx < ht->size; idx++ ) + { + /*****************************************************************/ + /* Get the first entry of a particular Key and loop through the */ + /* remaining if any. Then proceed to next key. */ + /*****************************************************************/ + entry = ht->table[idx]; + while( entry != NULL && entry->key != NULL) + { + EVEL_DEBUG("Encoding Voice Quality Fields %s %s",(char *) (entry->key), entry->value); + if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec, + "additionalInformation", + entry->key)) + { + + //evel_json_open_object(jbuf); + evel_enc_kv_string(jbuf, entry->key, entry->value); + //evel_json_close_object(jbuf); + added = true; + } + entry = entry->next; + } + } } - addlInfoItem = dlist_get_next(addlInfoItem); } - evel_json_close_list(jbuf); + evel_json_close_object(jbuf); + /*************************************************************************/ /* If we've not written anything, rewind to before we opened the list. */ /*************************************************************************/ - if (!item_added) + if (!added) { evel_json_rewind(jbuf); } @@ -544,14 +585,14 @@ void evel_json_encode_voice_quality(EVEL_JSON_BUFFER * jbuf, { evel_enc_kv_string(jbuf, "adjacencyName", vQMetrics->adjacencyName); evel_enc_kv_string(jbuf, "endpointDescription", vQMetrics->endpointDescription); - evel_enc_kv_opt_int(jbuf, "endpointJitter", &vQMetrics->endpointJitter); + evel_enc_kv_opt_int(jbuf, "localRtpOctetsLost", &vQMetrics->localRtpOctetsLost); evel_enc_kv_opt_int(jbuf, "endpointRtpOctetsDiscarded", &vQMetrics->endpointRtpOctetsDiscarded); evel_enc_kv_opt_int(jbuf, "endpointRtpOctetsReceived", &vQMetrics->endpointRtpOctetsReceived); evel_enc_kv_opt_int(jbuf, "endpointRtpOctetsSent", &vQMetrics->endpointRtpOctetsSent); evel_enc_kv_opt_int(jbuf, "endpointRtpPacketsDiscarded", &vQMetrics->endpointRtpPacketsDiscarded); evel_enc_kv_opt_int(jbuf, "endpointRtpPacketsReceived", &vQMetrics->endpointRtpPacketsReceived); evel_enc_kv_opt_int(jbuf, "endpointRtpPacketsSent", &vQMetrics->endpointRtpPacketsSent); - evel_enc_kv_opt_int(jbuf, "localJitter", &vQMetrics->localJitter); + evel_enc_kv_opt_int(jbuf, "localMaxJitterBufferDelay", &vQMetrics->localMaxJitterBufferDelay); evel_enc_kv_opt_int(jbuf, "localRtpOctetsDiscarded", &vQMetrics->localRtpOctetsDiscarded); evel_enc_kv_opt_int(jbuf, "localRtpOctetsReceived", &vQMetrics->localRtpOctetsReceived); evel_enc_kv_opt_int(jbuf, "localRtpOctetsSent", &vQMetrics->localRtpOctetsSent); @@ -559,10 +600,18 @@ void evel_json_encode_voice_quality(EVEL_JSON_BUFFER * jbuf, evel_enc_kv_opt_int(jbuf, "localRtpPacketsReceived", &vQMetrics->localRtpPacketsReceived); evel_enc_kv_opt_int(jbuf, "localRtpPacketsSent", &vQMetrics->localRtpPacketsSent); evel_enc_kv_opt_int(jbuf, "mosCqe", &vQMetrics->mosCqe); - evel_enc_kv_opt_int(jbuf, "packetsLost", &vQMetrics->packetsLost); + evel_enc_kv_opt_int(jbuf, "localRtpPacketsLost", &vQMetrics->localRtpPacketsLost); evel_enc_kv_opt_int(jbuf, "packetLossPercent", &vQMetrics->packetLossPercent); evel_enc_kv_opt_int(jbuf, "rFactor", &vQMetrics->rFactor); evel_enc_kv_opt_int(jbuf, "roundTripDelay", &vQMetrics->roundTripDelay); + evel_enc_kv_opt_int(jbuf, "endpointAverageJitter", &vQMetrics->endpointAverageJitter); + evel_enc_kv_opt_int(jbuf, "endpointMaxJitter", &vQMetrics->endpointMaxJitter); + evel_enc_kv_opt_int(jbuf, "endpointRtpOctetsLost", &vQMetrics->endpointRtpOctetsLost); + evel_enc_kv_opt_int(jbuf, "endpointRtpPacketsLost", &vQMetrics->endpointRtpPacketsLost); + evel_enc_kv_opt_int(jbuf, "localAverageJitter", &vQMetrics->localAverageJitter); + evel_enc_kv_opt_int(jbuf, "localAverageJitterBufferDelay", &vQMetrics->localAverageJitterBufferDelay); + evel_enc_kv_opt_int(jbuf, "localMaxJitter", &vQMetrics->localMaxJitter); + evel_enc_kv_opt_int(jbuf, "oneWayDelay", &vQMetrics->oneWayDelay); } @@ -585,7 +634,8 @@ void evel_json_encode_voice_quality(EVEL_JSON_BUFFER * jbuf, *****************************************************************************/ void evel_free_voice_quality(EVENT_VOICE_QUALITY * voiceQuality) { END_OF_CALL_VOICE_QUALITY_METRICS * vQMetrices = NULL; - VOICE_QUALITY_ADDL_INFO * addlInfo = NULL; + + HASHTABLE_T *ht; EVEL_ENTER(); @@ -601,16 +651,10 @@ void evel_free_voice_quality(EVENT_VOICE_QUALITY * voiceQuality) { /***************************************************************************/ //Additional Information - addlInfo = dlist_pop_last(&voiceQuality->additionalInformation); - while (addlInfo != NULL) + ht = voiceQuality->additionalInformation; + if( ht != NULL ) { - EVEL_DEBUG("Freeing Additional Info (%s, %s)", - addlInfo->name, - addlInfo->value); - free(addlInfo->name); - free(addlInfo->value); - free(addlInfo); - addlInfo = dlist_pop_last(&voiceQuality->additionalInformation); + ht_destroy(ht); } //Summary Information diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.c index d0017c9..ed22dcc 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.c @@ -31,6 +31,7 @@ #include <string.h> #include "hashtable.h" +#include "evel.h" /**************************************************************************//** * Hashtable initialization. @@ -42,22 +43,28 @@ * @returns Hashtable pointer ******************************************************************************/ /* Create a new hashtable. */ -HASHTABLE_T *ht_create( size_t size ) { +HASHTABLE_T *ht_sizecreate( size_t size ) { - HASHTABLE_T *hashtable = NULL; + HASHTABLE_T *hashtable=NULL; size_t i; - if( size < 1 ) return NULL; + assert( size >= 1 ); /* Allocate the table itself. */ - if( ( hashtable = malloc( sizeof( HASHTABLE_T ) ) ) == NULL ) { + if( ( hashtable = malloc( sizeof( *hashtable ) ) ) == NULL ) { + assert( hashtable != NULL ); return NULL; } + memset(hashtable, 0, sizeof(*hashtable)); + + hashtable->n = 0; + /* Allocate pointers to the head nodes. */ if( ( hashtable->table = malloc( sizeof( ENTRY_T * ) * size ) ) == NULL ) { return NULL; } + for( i = 0; i < size; i++ ) { hashtable->table[i] = NULL; } @@ -68,6 +75,34 @@ HASHTABLE_T *ht_create( size_t size ) { } /**************************************************************************//** + * Hashtable initialization. + * + * Initialize hashtable default finction + * @returns Hashtable +******************************************************************************/ +HASHTABLE_T *ht_create(void) +{ + return ht_sizecreate( INITIAL_SIZE ); +} + +/**************************************************************************//** + * Named Hashtable initialization. + * + * Initialize hashtable default finction + * @returns Hashtable +******************************************************************************/ +HASHTABLE_T *nht_create(char * hashtable_name) +{ + HASHTABLE_T *hashtable=NULL; + hashtable = ht_sizecreate( INITIAL_SIZE ); + if (hashtable != NULL) + { + hashtable->hmName = hashtable_name; + } + return (hashtable); +} + +/**************************************************************************//** * Hash a string for a particular hash table. * * Initialize the list supplied to be empty. @@ -106,7 +141,7 @@ size_t ht_hash( HASHTABLE_T *hashtable, char *key ) ******************************************************************************/ ENTRY_T *ht_newpair( char *key, void *value ) { - ENTRY_T *newpair; + ENTRY_T *newpair = NULL; if( ( newpair = malloc( sizeof( ENTRY_T ) ) ) == NULL ) { return NULL; @@ -116,7 +151,7 @@ ENTRY_T *ht_newpair( char *key, void *value ) return NULL; } - if( ( newpair->value = value ) == NULL ) { + if( ( newpair->value = strdup( value )) == NULL ) { return NULL; } @@ -126,6 +161,46 @@ ENTRY_T *ht_newpair( char *key, void *value ) } /**************************************************************************//** + * Grow hash table to bigger size + * + * @param key key string + * @param value value string + * + * @returns hashtable entry +******************************************************************************/ +static void ht_growtable(HASHTABLE_T *d) +{ + HASHTABLE_T * d2; /* new dictionary we'll create */ + HASHTABLE_T swap; + size_t i; + ENTRY_T *e; + + d2 = ht_sizecreate(d->size * GROWTH_FACTOR); + + if (d->hmName != NULL) + { + d2->hmName = strdup (d->hmName); + } + + for(i = 0; i < d->size; i++) { + for(e = d->table[i]; e != 0; e = e->next) { + /* note: this recopies everything */ + ht_insert(d2, e->key, e->value); + } + } + + /* the hideous part */ + /* We'll swap the guts of d and d2 */ + /* then call Destroy on d2 */ + swap = *d; + *d = *d2; + *d2 = swap; + + ht_destroy(d2); +} + + +/**************************************************************************//** * Insert a key-value pair into a hash table. * * @param key key string @@ -133,7 +208,7 @@ ENTRY_T *ht_newpair( char *key, void *value ) * * @returns Nothing ******************************************************************************/ -void ht_set( HASHTABLE_T *hashtable, char *key, void *value ) { +void ht_insert( HASHTABLE_T *hashtable, char *key, void *value ) { size_t bin = 0; ENTRY_T *newpair = NULL; ENTRY_T *next = NULL; @@ -152,7 +227,8 @@ void ht_set( HASHTABLE_T *hashtable, char *key, void *value ) { if( next != NULL && next->key != NULL && strcmp( key, next->key ) == 0 ) { free( next->value ); - next->value = value ; + next->value = strdup( value ) ; + EVEL_WARN("Duplicate key entries in Hashtable.Overwritten"); /* Nope, could't find it. Time to grow a pair. */ } else { @@ -162,7 +238,6 @@ void ht_set( HASHTABLE_T *hashtable, char *key, void *value ) { if( next == hashtable->table[ bin ] ) { newpair->next = next; hashtable->table[ bin ] = newpair; - /* We're at the end of the linked list in this bin. */ } else if ( next == NULL ) { last->next = newpair; @@ -172,6 +247,12 @@ void ht_set( HASHTABLE_T *hashtable, char *key, void *value ) { newpair->next = next; last->next = newpair; } + hashtable->n++; + + if( hashtable->n >= (hashtable->size*MAX_LOAD_FACTOR)) + { + ht_growtable(hashtable); + } } } @@ -182,7 +263,7 @@ void ht_set( HASHTABLE_T *hashtable, char *key, void *value ) { * * @returns value string ******************************************************************************/ -void *ht_get( HASHTABLE_T *hashtable, char *key ) { +void *ht_search( HASHTABLE_T *hashtable, char *key ) { size_t bin = 0; ENTRY_T *pair; @@ -204,21 +285,33 @@ void *ht_get( HASHTABLE_T *hashtable, char *key ) { } -/* -int main( int argc, char **argv ) { - - HASHTABLE_T *hashtable = ht_create( 65536 ); - ht_set( hashtable, "key1", "inky" ); - ht_set( hashtable, "key2", "pinky" ); - ht_set( hashtable, "key3", "blinky" ); - ht_set( hashtable, "key4", "floyd" ); - - printf( "%s\n", ht_get( hashtable, "key1" ) ); - printf( "%s\n", ht_get( hashtable, "key2" ) ); - printf( "%s\n", ht_get( hashtable, "key3" ) ); - printf( "%s\n", ht_get( hashtable, "key4" ) ); +/**************************************************************************//** + * Hashtable destroy + * +******************************************************************************/ +void ht_destroy(HASHTABLE_T *d) +{ + size_t i; + ENTRY_T *e; + ENTRY_T *next; + + for(i = 0; i < d->size; i++) { + for(e = d->table[i]; e != NULL; e = next) { + next = e->next; + + free(e->key); + free(e->value); + free(e); + } + } + + free(d->table); + if (d->hmName != NULL) + { + free(d->hmName); + } + free(d); - return 0; } -*/ + diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.h b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.h index 8be17dc..a0b2fb7 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.h +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/hashtable.h @@ -20,7 +20,7 @@ /**************************************************************************//** * @file - * A simple hashtable. + * A flexible dynamic hashtable * * @note No thread protection so you will need to use appropriate * synchronization if use spans multiple threads. @@ -38,20 +38,52 @@ typedef struct entry_s { typedef struct hashtable_s { size_t size; + int n; + char *hmName; struct entry_s **table; } HASHTABLE_T; +typedef struct hashtable_s *HASHTABLE; + +#define INITIAL_SIZE (2) +#define GROWTH_FACTOR (2) +#define MAX_LOAD_FACTOR (2) + /**************************************************************************//** * Hashtable initialization. * - * Initialize the list supplied to be empty. - * + * Initialize hashtable internal finction * @param size Size of hashtable - - * @returns Hashtable pointer + * @returns Hashtable ******************************************************************************/ /* Create a new hashtable. */ -HASHTABLE_T *ht_create( size_t size ); +HASHTABLE_T *ht_sizecreate( size_t size ); + +/**************************************************************************//** + * Hashtable initialization. + * + * Initialize hashtable default function + * @returns Hashtable +******************************************************************************/ +HASHTABLE_T *ht_create(void); + +/**************************************************************************//** + * Named Hashtable initialization. + * + * Initialize Named hashtable default function + * @param hashtable_name + * @returns Hashtable +******************************************************************************/ +HASHTABLE_T *nht_create(char * hashtable_name); + +/**************************************************************************//** + * Hashtable Destruction + * + * Initialize hashtable destroy function + * @returns Hashtable +******************************************************************************/ +void ht_destroy(HASHTABLE_T *hashtable); + /**************************************************************************//** * Hash a string for a particular hash table. @@ -63,7 +95,7 @@ HASHTABLE_T *ht_create( size_t size ); * @returns hashvalue ******************************************************************************/ -size_t ht_hash( HASHTABLE_T *hashtable, char *key ); +size_t ht_hash( HASHTABLE_T* hashtable, char *key ); /**************************************************************************//** * Create a key-value pair. @@ -83,7 +115,7 @@ ENTRY_T *ht_newpair( char *key, void *value ); * * @returns Nothing ******************************************************************************/ -void ht_set( HASHTABLE_T *hashtable, char *key, void *value ); +void ht_insert( HASHTABLE_T* hashtable, char *key, void *value ); /**************************************************************************//** * Retrieve a key-value pair from a hash table. @@ -92,6 +124,16 @@ void ht_set( HASHTABLE_T *hashtable, char *key, void *value ); * * @returns value string ******************************************************************************/ -void *ht_get( HASHTABLE_T *hashtable, char *key ); +void *ht_search( HASHTABLE_T* hashtable, char *key ); + +/**************************************************************************//** + * Delete a key-value pair from a hash table. + * + * @param key key string + * + * @returns value string +******************************************************************************/ +void ht_delete( HASHTABLE_T* hashtable, char *key ); + #endif diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/quickstart.md b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/quickstart.md index 1c735cc..c812636 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/quickstart.md +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/quickstart.md @@ -253,16 +253,30 @@ point the `evel_initialize()` function is called: ```C #include "evel.h" ... - if (evel_initialize(api_fqdn, - api_port, - api_path, - api_topic, - api_secure, - "Alice", - "This isn't very secure!", - EVEL_SOURCE_VIRTUAL_MACHINE, - "EVEL demo client", - verbose_mode)) + if(evel_initialize(fqdn, /* FQDN */ + port, /* Port */ + NULL, /* Backup FQDN */ + 0, /* Backup port */ + NULL, /* optional path */ + NULL, /* optional topic */ + 100, /* Ring Buffer size */ + 0, /* HTTPS? */ + 0, /* active mode? */ + NULL, /* cert file */ + NULL, /* key file */ + NULL, /* ca info */ + NULL, /* ca file */ + 0, /* verify peer */ + 0, /* verify host */ + "", /* Username */ + "", /* Password */ + "", /* Username2 */ + "", /* Password2 */ + NULL, /* Source ip */ + NULL, /* Source ip2 */ + EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */ + "EVEL demo client", /* Role */ + verbose_mode)) /* Verbosity */ { fprintf(stderr, "Failed to initialize the EVEL library!!!"); exit(-1); @@ -303,10 +317,15 @@ In practice this looks like: /***************************************************************************/ /* Create a new Fault object, setting mandatory fields as we do so... */ /***************************************************************************/ - fault = evel_new_fault("My alarm condition", + fault = evel_new_fault("fault_eNodeB_alarm", + "fault000000001", + "My alarm condition", "It broke very badly", EVEL_PRIORITY_NORMAL, - EVEL_SEVERITY_MAJOR); + EVEL_SEVERITY_MAJOR, + EVEL_SOURCE_HOST, + EVEL_VF_STATUS_READY_TERMINATE); + if (fault != NULL) { /*************************************************************************/ @@ -316,7 +335,8 @@ In practice this looks like: evel_fault_interface_set(fault, "My Interface Card"); evel_fault_addl_info_add(fault, "name1", "value1"); evel_fault_addl_info_add(fault, "name2", "value2"); - + evel_fault_category_set(fault, "link"); + /*************************************************************************/ /* Finally, post the Fault. In practice this will only ever fail if */ /* local ring-buffer is full because of event overload. */ @@ -339,15 +359,11 @@ The _EVEL Library_ supports the following types of events: 2. Measurements - These represent the **measurementsForVfScaling** domain in the event - schema. + These represent the **measurement** domain in the event schema. - 3. Reports + 3. Notification - This is an experimental type, designed to allow VNFs to report - application-level statistics unencumbered with platform measurements. - The formal AT&T schema has been updated to include this experimental - type as **measurementsForVfReporting**. + These represent the **notification** domain in the event schema. 4. Mobile Flow @@ -357,13 +373,13 @@ The _EVEL Library_ supports the following types of events: These represent the **other** domain in the event schema. - 6. Service Events + 6. PNF Registration - These represent the **serviceEvents** domain in the event schema. + These represent the **pnfRegistration** domain in the event schema. - 7. Signaling + 7. SIP Signaling - These represent the **signaling** domain in the event schema. + These represent the **sipSignaling** domain in the event schema. 8. State Change @@ -373,26 +389,14 @@ The _EVEL Library_ supports the following types of events: These represent the **syslog** domain in the event schema. -### Throttling {#qs_throttling} - -The _EVEL library_ supports the following command types as defined in the JSON API: + 10. Threshold Crossing Alert - 1. commandType: throttlingSpecification + These represent the **thresholdCrossingAlert** domain in the event schema. - This is handled internally by the EVEL library, which stores the provided - throttling specification internally and applies it to all subsequent events. + 11. Voice Quality - 2. commandType: provideThrottlingState + These represent the **voiceQuality** domain in the event schema. - This is handled internally by the EVEL library, which returns the current - throttling specification for each domain. - - 3. commandType: measurementIntervalChange - - This is handled by the EVEL library, which makes the latest measurement - interval available via the ::evel_get_measurement_interval function. - The application is responsible for checking and adhering to the latest - provided interval. ### Termination {#qs_termination} @@ -442,4 +446,4 @@ the log_debug() and log_initialize() functions should be rewritten accordingly. logging function. [Turtles all the way down...](https://en.wikipedia.org/wiki/Turtles_all_the_way_down) -
\ No newline at end of file + diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/ring_buffer.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/ring_buffer.c index ad50874..248baf2 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/ring_buffer.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_library/ring_buffer.c @@ -101,9 +101,9 @@ void * ring_buffer_read(ring_buffer * buffer) msg = (buffer->ring)[buffer->next_read]; buffer->ring[buffer->next_read] = NULL; buffer->next_read = (buffer->next_read + 1) % buffer->size; - EVEL_DEBUG("RBR: next read location is %d", buffer->next_read); pthread_mutex_unlock(&buffer->ring_mutex); - break; + EVEL_DEBUG("RBR: next read location is %d data %lp", buffer->next_read,msg); + return msg; } else { @@ -112,7 +112,7 @@ void * ring_buffer_read(ring_buffer * buffer) EVEL_DEBUG("RBR: Condition variable wait completed"); } } - EVEL_DEBUG("RBR: Ring buffer read returning data at %lp", msg); + pthread_mutex_unlock(&buffer->ring_mutex); return msg; } diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_unit/Makefile b/veslibrary/ves_clibrary/evel/evel-library/code/evel_unit/Makefile new file mode 100644 index 0000000..1187670 --- /dev/null +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_unit/Makefile @@ -0,0 +1,44 @@ +############################################################################# +# +# 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. +# +############################################################################# + +CC=gcc +ARCH=$(shell getconf LONG_BIT) +CODE_ROOT=$(CURDIR)/../.. +LIBS_DIR=$(CODE_ROOT)/libs/x86_$(ARCH) +INCLUDE_DIR=$(CODE_ROOT)/code/evel_library + +#****************************************************************************** +# Standard compiler flags. * +#****************************************************************************** +CPPFLAGS= +CFLAGS=-Wall -g -fPIC + +all: evel_unit + +clean: + rm -f evel_unit + +evel_unit: evel_unit.c + $(CC) $(CPPFLAGS) $(CFLAGS) -o evel_unit \ + -L $(LIBS_DIR) \ + -I $(INCLUDE_DIR) \ + evel_unit.c \ + -lpthread \ + -level \ + -lcurl + + diff --git a/veslibrary/ves_clibrary/evel/evel-library/code/evel_unit/evel_unit.c b/veslibrary/ves_clibrary/evel/evel-library/code/evel_unit/evel_unit.c index 3cfb66b..affb88a 100644 --- a/veslibrary/ves_clibrary/evel/evel-library/code/evel_unit/evel_unit.c +++ b/veslibrary/ves_clibrary/evel/evel-library/code/evel_unit/evel_unit.c @@ -30,6 +30,7 @@ #include <assert.h> #include <stdlib.h> #include <sys/time.h> +#include <unistd.h> #include "evel.h" #include "evel_internal.h" @@ -49,35 +50,39 @@ typedef enum { /* Local prototypes. */ /*****************************************************************************/ static void test_encode_heartbeat(); -static void test_encode_header_overrides(); +//static void test_encode_header_overrides(); static void test_encode_fault(); -static void test_encode_fault_with_escaping(); +//static void test_encode_fault_with_escaping(); static void test_encode_measurement(); static void test_encode_mobile_mand(); -static void test_encode_mobile_opts(); +//static void test_encode_mobile_opts(); static void test_encode_other(); -static void test_encode_report(); -static void test_encode_service(); -static void test_encode_service_subset(const SERVICE_TEST service_test); +static void test_encode_pnfreg(); +static void test_encode_tca(); +//static void test_encode_report(); +//static void test_encode_service(); +//static void test_encode_service_subset(const SERVICE_TEST service_test); static void test_encode_signaling(); +static void test_encode_voiceQ(); +static void test_encode_notif(); static void test_encode_state_change(); static void test_encode_syslog(); -static void test_json_response_junk(); -static void test_json_provide_throttle_state(); -static void test_json_measurement_interval(); -static void test_json_throttle_spec_field(); -static void test_json_throttle_spec_nv_pair(); -static void test_json_throttle_spec_two_domains(); -static void test_json_throttle_spec_bad_command_type(); -static void test_encode_fault_throttled(); -static void test_encode_measurement_throttled(); -static void test_encode_mobile_throttled(); -static void test_encode_other_throttled(); -static void test_encode_report_throttled(); -static void test_encode_service_throttled(); -static void test_encode_signaling_throttled(); -static void test_encode_state_change_throttled(); -static void test_encode_syslog_throttled(); +//static void test_json_response_junk(); +//static void test_json_provide_throttle_state(); +//static void test_json_measurement_interval(); +//static void test_json_throttle_spec_field(); +//static void test_json_throttle_spec_nv_pair(); +//static void test_json_throttle_spec_two_domains(); +//static void test_json_throttle_spec_bad_command_type(); +//static void test_encode_fault_throttled(); +//static void test_encode_measurement_throttled(); +//static void test_encode_mobile_throttled(); +//static void test_encode_other_throttled(); +//static void test_encode_report_throttled(); +//static void test_encode_service_throttled(); +//static void test_encode_signaling_throttled(); +//static void test_encode_state_change_throttled(); +//static void test_encode_syslog_throttled(); static void compare_strings(char * expected, char * actual, int max_size, @@ -93,9 +98,11 @@ static void compare_strings(char * expected, *****************************************************************************/ int main(int argc, char ** argv) { + char * fqdn = "127.0.0.1"; + int port = 30000; assert(argc >= 0); assert(argv != NULL); - + /***************************************************************************/ /* Fix our timezone to UTC. */ /***************************************************************************/ @@ -112,25 +119,65 @@ int main(int argc, char ** argv) functional_role = "UNIT TEST"; log_initialize(EVEL_LOG_DEBUG, "EVEL"); + /**************************************************************************/ + /* Initialize */ + /**************************************************************************/ + if(evel_initialize(fqdn, /* FQDN */ + port, /* Port */ + NULL, /* Backup FQDN */ + 0, /* Backup port */ + NULL, /* optional path */ + NULL, /* optional topic */ + 100, /* Ring Buffer size */ + 0, /* HTTPS? */ + 0, /* active mode? */ + NULL, /* cert file */ + NULL, /* key file */ + NULL, /* ca info */ + NULL, /* ca file */ + 0, /* verify peer */ + 0, /* verify host */ + "will", /* Username */ + "pill", /* Password */ + "", /* Username2 */ + "", /* Password2 */ + NULL, /* Source ip */ + NULL, /* Source ip2 */ + EVEL_SOURCE_VIRTUAL_MACHINE, /* Source type */ + "UNIT Test", /* Role */ + 1)) /* Verbosity */ + { + fprintf(stderr, "\nFailed to initialize the EVEL library!!!\n"); + exit(-1); + } + else + { + printf("\nInitialization completed\n"); + } + /***************************************************************************/ /* Test each encoder. */ /***************************************************************************/ - test_encode_heartbeat(); - test_encode_header_overrides(); - test_encode_fault(); - test_encode_measurement(); - test_encode_mobile_mand(); - test_encode_mobile_opts(); - test_encode_other(); - test_encode_report(); - test_encode_service(); - test_encode_signaling(); - test_encode_state_change(); - test_encode_syslog(); - + test_encode_heartbeat(); // Done +// test_encode_header_overrides(); // Done + test_encode_fault(); // Done + test_encode_measurement(); //Done + test_encode_mobile_mand(); // Done +// test_encode_mobile_opts(); // Done + test_encode_other(); // Done + test_encode_pnfreg(); // Done + test_encode_tca(); // Done +// test_encode_report(); +// test_encode_service(); + test_encode_signaling(); // Done - sip signaling + test_encode_voiceQ(); //Done + test_encode_notif(); //Done` + test_encode_state_change(); //Done + test_encode_syslog(); // Done /***************************************************************************/ /* Test JSON Throttle. */ /***************************************************************************/ +/************* test_json_response_junk(); test_json_provide_throttle_state(); test_json_measurement_interval(); @@ -138,27 +185,27 @@ int main(int argc, char ** argv) test_json_throttle_spec_nv_pair(); test_json_throttle_spec_two_domains(); test_json_throttle_spec_bad_command_type(); - +*************/ /***************************************************************************/ /* Test each encoder with throttling applied. */ /***************************************************************************/ - test_encode_fault_throttled(); - test_encode_measurement_throttled(); - test_encode_mobile_throttled(); - test_encode_other_throttled(); - test_encode_report_throttled(); - test_encode_service_throttled(); - test_encode_signaling_throttled(); - test_encode_state_change_throttled(); - test_encode_syslog_throttled(); - +// test_encode_fault_throttled(); // done +// test_encode_measurement_throttled(); +// test_encode_mobile_throttled(); //done +// test_encode_other_throttled(); +// test_encode_report_throttled(); +// test_encode_service_throttled(); +// test_encode_signaling_throttled(); +// test_encode_state_change_throttled(); +// test_encode_syslog_throttled(); /***************************************************************************/ /* Test character escaping. */ /***************************************************************************/ +/******** test_encode_fault_with_escaping(); - +*******/ printf ("\nAll Tests Passed\n"); - + evel_terminate(); return 0; } @@ -179,15 +226,16 @@ void test_encode_heartbeat() "{\"event\": {" "\"commonEventHeader\": {" "\"domain\": \"heartbeat\", " - "\"eventId\": \"121\", " + "\"eventId\": \"heartbeat000000001\", " + "\"eventName\": \"heartbeat_VM\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 121, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " - "\"version\": 1.2, " + "\"version\": 3.0, " "\"eventType\": \"Autonomous heartbeat\", " "\"reportingEntityId\": \"Dummy VM UUID - No Metadata available\", " "\"sourceId\": \"Dummy VM UUID - No Metadata available\"" @@ -199,7 +247,7 @@ void test_encode_heartbeat() /***************************************************************************/ /* Test the VM name/uuid once. */ /***************************************************************************/ - evel_set_next_event_sequence(121); +// evel_set_next_event_sequence(121); EVENT_HEADER * heartbeat = evel_new_heartbeat(); assert(heartbeat != NULL); @@ -209,7 +257,16 @@ void test_encode_heartbeat() compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Heartbeat"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(heartbeat); + if(evel_post_event(heartbeat) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(heartbeat); } void test_encode_header_overrides() @@ -219,17 +276,15 @@ void test_encode_header_overrides() "\"commonEventHeader\": {" "\"domain\": \"heartbeat\", " "\"eventId\": \"121\", " - "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000, " "\"priority\": \"Normal\", " "\"reportingEntityName\": \"entity_name_override\", " "\"sequence\": 121, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1001, " "\"version\": 1.2, " "\"eventType\": \"Autonomous heartbeat\", " - "\"reportingEntityId\": \"entity_id_override\", " - "\"sourceId\": \"Dummy VM UUID - No Metadata available\"" + "\"reportingEntityId\": \"entity_id_override\" " "}}}"; size_t json_size = 0; @@ -238,7 +293,7 @@ void test_encode_header_overrides() /***************************************************************************/ /* Test the VM name/uuid once. */ /***************************************************************************/ - evel_set_next_event_sequence(121); +// evel_set_next_event_sequence(121); EVENT_HEADER * heartbeat = evel_new_heartbeat(); assert(heartbeat != NULL); @@ -247,6 +302,8 @@ void test_encode_header_overrides() evel_last_epoch_set(heartbeat, 1000); evel_reporting_entity_name_set(heartbeat, "entity_name_override"); evel_reporting_entity_id_set(heartbeat, "entity_id_override"); + evel_event_sequence_set(heartbeat, 121); + evel_time_zone_offset_set(heartbeat, "UTC+5:30"); json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) heartbeat); @@ -262,13 +319,13 @@ void test_encode_fault() "{\"event\": {" "\"commonEventHeader\": {" "\"domain\": \"fault\", " - "\"eventId\": \"122\", " - "\"functionalRole\": \"UNIT TEST\", " + "\"eventId\": \"fault000000001\", " + "\"eventName\": \"fault_eNodeB_alarm\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 122, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"Bad things happen...\", " @@ -293,40 +350,52 @@ void test_encode_fault() size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; - evel_set_next_event_sequence(122); - EVENT_FAULT * fault = evel_new_fault("My alarm condition", +// evel_set_next_event_sequence(122); + EVENT_FAULT * fault = evel_new_fault("fault_eNodeB_alarm", + "fault000000001", + "My alarm condition", "It broke very badly", EVEL_PRIORITY_NORMAL, EVEL_SEVERITY_MAJOR, EVEL_SOURCE_HOST, - EVEL_VF_STATUS_PREP_TERMINATE); + EVEL_VF_STATUS_READY_TERMINATE); assert(fault != NULL); evel_fault_type_set(fault, "Bad things happen..."); evel_fault_interface_set(fault, "My Interface Card"); evel_fault_addl_info_add(fault, "name1", "value1"); evel_fault_addl_info_add(fault, "name2", "value2"); +evel_fault_category_set(fault, "link"); json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) fault); compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Fault"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(fault); -} + if(evel_post_event((EVENT_HEADER *)fault) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + // evel_free_event(fault); +} void test_encode_measurement() { char * expected = "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"measurementsForVfScaling\", " - "\"eventId\": \"123\", " + "\"eventId\": \"mvfs000000001\", " + "\"eventName\": \"mvfs_perfUnit_issue\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 3000, " "\"priority\": \"Normal\", " "\"reportingEntityName\": \"entity_name\", " "\"sequence\": 123, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 2000, " "\"version\": 1.2, " "\"eventType\": \"Perf management...\", " @@ -424,18 +493,21 @@ void test_encode_measurement() char json_body[EVEL_MAX_JSON_BODY]; EVENT_MEASUREMENT * measurement = NULL; MEASUREMENT_LATENCY_BUCKET * bucket = NULL; - MEASUREMENT_VNIC_PERFORMANCE * vnic_use = NULL; MEASUREMENT_CPU_USE *cpu_use; - - /***************************************************************************/ - /* Measurement. */ - /***************************************************************************/ - evel_set_next_event_sequence(123); - measurement = evel_new_measurement(5.5); + MEASUREMENT_MEM_USE * mem_use; + MEASUREMENT_DISK_USE * disk_use; +// evel_set_next_event_sequence(123); + measurement = evel_new_measurement(5.5,"mvfs_perfUnit_issue", "mvfs000000001"); assert(measurement != NULL); evel_measurement_type_set(measurement, "Perf management..."); + evel_measurement_addl_info_add(measurement, "name1", "value1"); +// evel_measurement_addl_info_add(measurement, "name2", "value2"); +// evel_measurement_addl_info_add(measurement, "name3", "value3"); +// evel_measurement_addl_info_add(measurement, "name4", "value4"); + evel_measurement_conc_sess_set(measurement, 1); evel_measurement_cfg_ents_set(measurement, 2); + evel_measurement_mean_req_lat_set(measurement, 4.4); evel_measurement_request_rate_set(measurement, 7); @@ -448,7 +520,14 @@ void test_encode_measurement() evel_measurement_cpu_use_system_set(cpu_use,77.77); evel_measurement_cpu_use_usageuser_set(cpu_use,88.88); evel_measurement_cpu_use_wait_set(cpu_use,99.99); - + evel_measurement_cpu_use_cpuCapacityContention_set(cpu_use,12.2); + evel_measurement_cpu_use_cpuDemandAvg_set(cpu_use,14.4); + evel_measurement_cpu_use_cpuDemandMhz_set(cpu_use,15.4); + evel_measurement_cpu_use_cpuDemandPct_set(cpu_use,16.4); + evel_measurement_cpu_use_cpuLatencyAvg_set(cpu_use,17.4); + evel_measurement_cpu_use_cpuOverheadAvg_set(cpu_use,18.4); + evel_measurement_cpu_use_cpuSwapWaitTime_set(cpu_use,19.4); +/************** cpu_use = evel_measurement_new_cpu_use_add(measurement, "cpu2", 22.22); evel_measurement_cpu_use_idle_set(cpu_use,12.22); evel_measurement_cpu_use_interrupt_set(cpu_use,33.33); @@ -458,74 +537,294 @@ void test_encode_measurement() evel_measurement_cpu_use_system_set(cpu_use,77.77); evel_measurement_cpu_use_usageuser_set(cpu_use,88.88); evel_measurement_cpu_use_wait_set(cpu_use,19.99); - + evel_measurement_cpu_use_cpuCapacityContention_set(cpu_use,22.2); + evel_measurement_cpu_use_cpuDemandAvg_set(cpu_use,24.4); + evel_measurement_cpu_use_cpuDemandMhz_set(cpu_use,25.4); + evel_measurement_cpu_use_cpuDemandPct_set(cpu_use,26.4); + evel_measurement_cpu_use_cpuLatencyAvg_set(cpu_use,27.4); + evel_measurement_cpu_use_cpuOverheadAvg_set(cpu_use,28.4); + evel_measurement_cpu_use_cpuSwapWaitTime_set(cpu_use,29.4); +***************/ + mem_use = evel_measurement_new_mem_use_add(measurement, "VMID", 120, 150); + evel_measurement_mem_use_memcache_set(mem_use, 121.7); + evel_measurement_mem_use_memconfig_set(mem_use, 122.7); + evel_measurement_mem_use_slab_reclaimed_set(mem_use, 123.7); + evel_measurement_mem_use_slab_unreclaimable_set(mem_use, 124.7); + evel_measurement_mem_use_memoryDemand_set(mem_use, 125.7); + evel_measurement_mem_use_memoryLatencyAvg_set(mem_use, 126.7); + evel_measurement_mem_use_memorySharedAvg_set(mem_use, 127.7); + evel_measurement_mem_use_memorySwapInAvg_set(mem_use, 128.7); + evel_measurement_mem_use_memorySwapInRateAvg_set(mem_use, 129.7); + evel_measurement_mem_use_memorySwapOutAvg_set(mem_use, 130.7); + evel_measurement_mem_use_memorySwapOutRateAvg_set(mem_use, 131.7); + evel_measurement_mem_use_memorySwapUsedAvg_set(mem_use, 132.7); + evel_measurement_mem_use_percentMemoryUsage_set(mem_use, 133.7); + + mem_use = evel_measurement_new_mem_use_add(measurement, "VMID2", 220, 250); + evel_measurement_mem_use_mem_buffered_set(mem_use, 100.4); + evel_measurement_mem_use_memcache_set(mem_use, 221.7); + evel_measurement_mem_use_memconfig_set(mem_use, 222.7); + evel_measurement_mem_use_slab_reclaimed_set(mem_use, 223.7); + evel_measurement_mem_use_slab_unreclaimable_set(mem_use, 224.7); + evel_measurement_mem_use_memoryDemand_set(mem_use, 225.7); + evel_measurement_mem_use_memoryLatencyAvg_set(mem_use, 226.7); + evel_measurement_mem_use_memorySharedAvg_set(mem_use, 227.7); + evel_measurement_mem_use_memorySwapInAvg_set(mem_use, 228.7); + evel_measurement_mem_use_memorySwapInRateAvg_set(mem_use, 229.7); + evel_measurement_mem_use_memorySwapOutAvg_set(mem_use, 230.7); + evel_measurement_mem_use_memorySwapOutRateAvg_set(mem_use, 231.7); + evel_measurement_mem_use_memorySwapUsedAvg_set(mem_use, 232.7); + evel_measurement_mem_use_percentMemoryUsage_set(mem_use, 233.7); + + disk_use = evel_measurement_new_disk_use_add(measurement, "Disk1"); + evel_measurement_disk_use_iotimeavg_set(disk_use, 11.1); + evel_measurement_disk_use_iotimelast_set(disk_use, 12.1); + evel_measurement_disk_use_iotimemax_set(disk_use, 13.1); + evel_measurement_disk_use_iotimemin_set(disk_use, 14.1); + evel_measurement_disk_use_mergereadavg_set(disk_use, 15.1); + evel_measurement_disk_use_mergereadlast_set(disk_use, 16.1); + evel_measurement_disk_use_mergereadmax_set(disk_use, 17.1); + evel_measurement_disk_use_mergereadmin_set(disk_use, 18.1); + evel_measurement_disk_use_mergewritelast_set(disk_use, 19.1); + evel_measurement_disk_use_mergewritemax_set(disk_use, 20.1); + evel_measurement_disk_use_mergewriteavg_set(disk_use, 30.1); + evel_measurement_disk_use_mergewritemin_set(disk_use, 40.1); + evel_measurement_disk_use_octetsreadavg_set(disk_use, 50.1); + evel_measurement_disk_use_octetsreadlast_set(disk_use, 60.1); + evel_measurement_disk_use_octetsreadmax_set(disk_use, 70.1); + evel_measurement_disk_use_octetsreadmin_set(disk_use, 80.1); + evel_measurement_disk_use_octetswriteavg_set(disk_use, 90.1); + evel_measurement_disk_use_octetswritelast_set(disk_use,110.1); + evel_measurement_disk_use_octetswritemax_set(disk_use, 120.1); + evel_measurement_disk_use_octetswritemin_set(disk_use, 130.1); + evel_measurement_disk_use_opsreadavg_set(disk_use, 140.1); + evel_measurement_disk_use_opsreadlast_set(disk_use, 150.1); + evel_measurement_disk_use_opsreadmax_set(disk_use, 160.1); + evel_measurement_disk_use_opsreadmin_set(disk_use, 170.1); + evel_measurement_disk_use_opswriteavg_set(disk_use, 180.1); + evel_measurement_disk_use_opswritelast_set(disk_use, 190.1); + evel_measurement_disk_use_opswritemax_set(disk_use, 210.1); + evel_measurement_disk_use_opswritemin_set(disk_use, 310.1); + evel_measurement_disk_use_pendingopsavg_set(disk_use, 410.1); + evel_measurement_disk_use_pendingopslast_set(disk_use, 610.1); + evel_measurement_disk_use_pendingopsmax_set(disk_use, 710.1); + evel_measurement_disk_use_pendingopsmin_set(disk_use, 810.1); + evel_measurement_disk_use_timereadavg_set(disk_use, 910.1); + evel_measurement_disk_use_timereadlast_set(disk_use, 10.2); + evel_measurement_disk_use_timereadmax_set(disk_use, 10.33); + evel_measurement_disk_use_timereadmin_set(disk_use, 10.4); + evel_measurement_disk_use_timewriteavg_set(disk_use, 10.5); + evel_measurement_disk_use_timewritelast_set(disk_use, 10.6); + evel_measurement_disk_use_timewritemax_set(disk_use, 10.7); + evel_measurement_disk_use_timewritemin_set(disk_use, 10.8); + evel_measurement_disk_use_diskBusResets_set(disk_use, 10.9); + evel_measurement_disk_use_diskCommandsAborted_set(disk_use, 10.1); + evel_measurement_disk_use_diskTime_set(disk_use, 10.1); + evel_measurement_disk_use_diskFlushRequests_set(disk_use, 10.1); + evel_measurement_disk_use_diskFlushTime_set(disk_use, 10.1); + evel_measurement_disk_use_diskCommandsAvg_set(disk_use, 10.1); + evel_measurement_disk_use_diskReadCommandsAvg_set(disk_use, 10.1); + evel_measurement_disk_use_diskWriteCommandsAvg_set(disk_use, 10.1); + evel_measurement_disk_use_diskTotalReadLatencyAvg_set(disk_use, 10.1); + evel_measurement_disk_use_diskTotalWriteLatencyAvg_set(disk_use, 10.1); + evel_measurement_disk_use_diskWeightedIoTimeAvg_set(disk_use, 10.1); + evel_measurement_disk_use_diskWeightedIoTimeLast_set(disk_use, 10.1); + evel_measurement_disk_use_diskWeightedIoTimeMax_set(disk_use, 10.1); + evel_measurement_disk_use_diskWeightedIoTimeMin_set(disk_use, 10.1); + evel_measurement_fsys_use_add(measurement,"00-11-22",100.11, 100.22, 33, 200.11, 200.22, 44); evel_measurement_fsys_use_add(measurement,"33-44-55",300.11, 300.22, 55, 400.11, 400.22, 66); - evel_start_epoch_set(&measurement->header, 2000); - evel_last_epoch_set(&measurement->header, 3000); - evel_reporting_entity_name_set(&measurement->header, "entity_name"); - evel_reporting_entity_id_set(&measurement->header, "entity_id"); + evel_measurement_feature_use_add(measurement, "FeatureA", "123"); + evel_measurement_feature_use_add(measurement, "FeatureB", "567"); + + HASHTABLE_T *ht1; + ht1 = evel_measurement_new_addl_measurement(measurement, "hmNam1"); + evel_measurement_addl_measurement_set(ht1, "hmkey1", "hmVal1"); + evel_measurement_addl_measurement_set(ht1, "hmkey2", "hmVal2"); + evel_measurement_addl_measurement_set(ht1, "hmkey3", "hmVal3"); + evel_measurement_addl_measurement_set(ht1, "hmkey4", "hmVal4"); + + ht1 = evel_measurement_new_addl_measurement(measurement, "hmNam2"); + evel_measurement_addl_measurement_set(ht1, "hmkey21", "hmVal21"); + evel_measurement_addl_measurement_set(ht1, "hmkey22", "hmVal22"); + evel_measurement_addl_measurement_set(ht1, "hmkey23", "hmVal23"); + evel_measurement_addl_measurement_set(ht1, "hmkey24", "hmVal24"); + + evel_measurement_codec_use_add(measurement, "G711a", 91); + evel_measurement_codec_use_add(measurement, "G729ab", 92); + + evel_measurement_media_port_use_set(measurement, 55); + evel_measurement_vnfc_scaling_metric_set(measurement, 66); - /***************************************************************************/ - /* Latency Bucket with no optional parameters. */ - /***************************************************************************/ bucket = evel_new_meas_latency_bucket(20); + evel_meas_latency_bucket_low_end_set(bucket, 50.0); + evel_meas_latency_bucket_high_end_set(bucket, 60.0); evel_meas_latency_bucket_add(measurement, bucket); - /***************************************************************************/ - /* Latency Bucket with all optional parameters. */ - /***************************************************************************/ bucket = evel_new_meas_latency_bucket(30); evel_meas_latency_bucket_low_end_set(bucket, 10.0); evel_meas_latency_bucket_high_end_set(bucket, 20.0); evel_meas_latency_bucket_add(measurement, bucket); - /***************************************************************************/ - /* vNIC Use with no optional parameters. */ - /***************************************************************************/ - vnic_use = evel_new_measurement_vnic_use("eth0", 100, 200, 3, 4); - evel_meas_vnic_use_add(measurement, vnic_use); - - /***************************************************************************/ - /* vNIC Use with all optional parameters. */ - /***************************************************************************/ - vnic_use = evel_new_measurement_vnic_use("eth1", 110, 240, 13, 14); - evel_vnic_use_bcast_pkt_in_set(vnic_use, 11); - evel_vnic_use_bcast_pkt_out_set(vnic_use, 12); - evel_vnic_use_mcast_pkt_in_set(vnic_use, 15); - evel_vnic_use_mcast_pkt_out_set(vnic_use, 16); - evel_vnic_use_ucast_pkt_in_set(vnic_use, 17); - evel_vnic_use_ucast_pkt_out_set(vnic_use, 18); - evel_meas_vnic_use_add(measurement, vnic_use); - - evel_measurement_errors_set(measurement, 1, 0, 2, 1); - - evel_measurement_feature_use_add(measurement, "FeatureA", 123); - evel_measurement_feature_use_add(measurement, "FeatureB", 567); - - evel_measurement_codec_use_add(measurement, "G711a", 91); - evel_measurement_codec_use_add(measurement, "G729ab", 92); - - evel_measurement_media_port_use_set(measurement, 1234); - - evel_measurement_vnfc_scaling_metric_set(measurement, 1234.5678); + evel_measurement_latency_add(measurement, 70.0, 90.0, 40); + + MEASUREMENT_NIC_PERFORMANCE * nic_per; + nic_per = evel_measurement_new_nic_performance("eth0", "true"); + evel_nic_performance_administrativeState_set(nic_per, EVEL_OPER_STATE_OUT_OF_SERVICE); + evel_nic_performance_operationalState_set(nic_per, EVEL_OPER_STATE_IN_SERVICE); + evel_nic_performance_receivedPercentDiscard_set(nic_per, 222.33); + evel_nic_performance_receivedPercentError_set(nic_per, 222.33); + evel_nic_performance_receivedUtilization_set(nic_per, 222.33); + evel_nic_performance_speed_set(nic_per, 222.33); + evel_nic_performance_transmittedPercentDiscard_set(nic_per, 222.33); + evel_nic_performance_transmittedPercentError_set(nic_per, 222.33); + evel_nic_performance_transmittedUtilization_set(nic_per, 222.33); + evel_nic_performance_rx_bcast_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_rx_bcast_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_rx_discard_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_rx_discard_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_rx_error_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_rx_error_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_rx_mcast_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_rx_mcast_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_rx_octets_acc_set(nic_per, 222.33); + evel_nic_performance_rx_octets_delta_set(nic_per, 222.33); + evel_nic_performance_rx_total_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_rx_total_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_rx_ucast_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_rx_ucast_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_tx_bcast_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_tx_bcast_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_tx_discarded_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_tx_discarded_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_tx_error_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_tx_error_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_tx_mcast_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_tx_mcast_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_tx_octets_acc_set(nic_per, 222.33); + evel_nic_performance_tx_octets_delta_set(nic_per, 222.33); + evel_nic_performance_tx_total_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_tx_total_pkt_delta_set(nic_per, 222.33); + evel_nic_performance_tx_ucast_pkt_acc_set(nic_per, 222.33); + evel_nic_performance_tx_ucast_pkt_delta_set(nic_per, 222.33); + + evel_meas_nic_performance_add(measurement, nic_per); +/************* + evel_measurement_nic_performance_add(measurement, "ens03", "false", + EVEL_OPER_STATE_IN_SERVICE, EVEL_OPER_STATE_OUT_OF_SERVICE, + 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, + 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, + 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, 11.66, + 11.66, 11.66, 11.66, 11.66, 11.66); +**********/ + MEASUREMENT_IPMI *ipmi; + ipmi = evel_measurement_new_ipmi_add(measurement); + evel_measurement_ipmi_exitAirTemperature_set(ipmi, 98.4); + evel_measurement_ipmi_frontPanelTemperature_set(ipmi, 98.4); + evel_measurement_ipmi_ioModuleTemperature_set(ipmi, 98.4); + evel_measurement_ipmi_systemAirflow_set(ipmi, 98.4); + + MEASUREMENT_IPMI_BB_TEMPERATURE *temp; + temp = evel_measurement_new_base_board_temp_add(ipmi, "BBTEMP1"); + evel_measurement_ipmi_bb_temp_set(ipmi, temp, 99.8); + + MEASUREMENT_IPMI_BB_VOLTAGE * volt; + volt = evel_measurement_new_base_board_volt_add(ipmi, "BBVOLT1"); + evel_measurement_ipmi_bb_volt_set(ipmi, volt, 88.9); + + MEASUREMENT_IPMI_BATTERY *batt; + batt = evel_measurement_new_ipmi_battery_add(ipmi, "BBBATTERY1"); + evel_measurement_ipmi_battery_type_set(ipmi, batt, "BattType"); + evel_measurement_ipmi_battery_voltage_set(ipmi, batt, 230); + + MEASUREMENT_IPMI_FAN * fan; + fan = evel_measurement_new_ipmi_fan_add(ipmi, "FAN1"); + evel_measurement_ipmi_fan_speed_set(ipmi, fan, 300); + + MEASUREMENT_IPMI_HSBP * hsbp; + hsbp = evel_measurement_new_ipmi_hsbp_add(ipmi, "BBHSBP1"); + evel_measurement_ipmi_hsbp_temp_set(ipmi, hsbp, 100); + + MEASUREMENT_IPMI_GLOBAL_AGG_TEMP_MARGIN *glob; + glob = evel_measurement_new_ipmi_global_temp_add(ipmi, "BBGLOBAL"); + evel_measurement_ipmi_global_temp_margin_set(ipmi, glob, 22.5); + + MEASUREMENT_IPMI_NIC * nic; + nic = evel_measurement_new_ipmi_nic_add(ipmi, "NIC_1"); + evel_measurement_ipmi_nic_temp_set(ipmi, nic, 33.5); + + MEASUREMENT_IPMI_POWER_SUPPLY * pwr; + pwr = evel_measurement_new_ipmi_power_add(ipmi, "POWERSupply1"); + evel_measurement_ipmi_power_inputpwr_set(ipmi, pwr, 200.5); + evel_measurement_ipmi_power_current_op_set(ipmi, pwr, 50.4); + evel_measurement_ipmi_power_temp_set(ipmi, pwr, 100.5); + + MEASUREMENT_IPMI_PROCESSOR * proc; + proc = evel_measurement_new_ipmi_processor_add(ipmi, "PROCESSOR1"); + evel_measurement_ipmi_processor_theralCtrl_set(ipmi, proc, 10.9); + evel_measurement_ipmi_processor_theralMargin_set(ipmi, proc, 29.8); + + MEASUREMENT_IPMI_PROCESSOR_DIMMAGG_THERM * dimm; + dimm = evel_measurement_ipmi_processor_new_dimmAggThermalMargin_add(ipmi, proc, "DIMM1", 15.8); + + assert(dimm != NULL); + + MEASUREMENT_LOAD * load; + load = evel_measurement_new_loads_add(measurement); + evel_measurement_load_shortTerm_set(load, 22.5); + evel_measurement_load_midTerm_set(load, 33.6); + evel_measurement_load_longTerm_set(load, 44.8); + + MEASUREMENT_PROCESS_STATS * pstat; + pstat = evel_measurement_new_process_stats_add(measurement, "Process1"); + evel_measurement_process_stat_forkRate_set(pstat, 10.1); + evel_measurement_process_stat_psStateBlocked_set(pstat, 20.1); + evel_measurement_process_stat_psStatePaging_set(pstat, 30.1); + evel_measurement_process_stat_psStateRunning_set(pstat, 40.1); + evel_measurement_process_stat_psStateSleeping_set(pstat, 50.1); + evel_measurement_process_stat_psStateStopped_set(pstat, 60.1); + evel_measurement_process_stat_psStateZombie_set(pstat, 70.1); + evel_measurement_process_stat_psStateZombie_set(pstat, 80.1); + + MACHINE_CHECK_EXCEPTION * mcheck; + mcheck = evel_measurement_new_machine_check_exception_add(measurement, "ProcessID1"); + evel_measurement_machine_check_cor_mem_err_set(mcheck, 110.1); + evel_measurement_machine_check_cor_mem_err_1hr_set(mcheck, 210.1); + evel_measurement_machine_check_uncor_mem_err_set(mcheck, 310.1); + evel_measurement_machine_check_uncor_mem_err_1hr_set(mcheck, 410.1); + + MEASUREMENT_HUGE_PAGE * hugep; + hugep = evel_measurement_new_huge_page_add(measurement, "HUGEPage1"); + evel_measurement_huge_page_bytesUsed_set(hugep, 100); + evel_measurement_huge_page_bytesFree_set(hugep, 200); + evel_measurement_huge_page_vmPageNumberUsed_set(hugep, 300); + evel_measurement_huge_page_vmPageNumberFree_set(hugep, 400); + evel_measurement_huge_page_percentUsed_set(hugep, 500); + evel_measurement_huge_page_percentFree_set(hugep, 600); - evel_measurement_custom_measurement_add(measurement, - "Group1", "Name1", "Value1"); - evel_measurement_custom_measurement_add(measurement, - "Group2", "Name1", "Value1"); - evel_measurement_custom_measurement_add(measurement, - "Group2", "Name2", "Value2"); + evel_start_epoch_set(&measurement->header, 2000); + evel_last_epoch_set(&measurement->header, 3000); + evel_reporting_entity_name_set(&measurement->header, "entity_name"); + evel_reporting_entity_id_set(&measurement->header, "entity_id"); json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) measurement); compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Measurement"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(measurement); + if(evel_post_event((EVENT_HEADER *)measurement) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(measurement); } void test_encode_mobile_mand() @@ -534,13 +833,14 @@ void test_encode_mobile_mand() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"mobileFlow\", " - "\"eventId\": \"1241\", " + "\"eventId\": \"mobileFlow000000001\", " + "\"eventName\": \"mobileFlow_error\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 1241, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"reportingEntityId\": \"Dummy VM UUID - No Metadata available\", " @@ -596,7 +896,7 @@ void test_encode_mobile_mand() /***************************************************************************/ /* Mobile. */ /***************************************************************************/ - evel_set_next_event_sequence(1241); +// evel_set_next_event_sequence(1241); metrics = evel_new_mobile_gtp_flow_metrics(12.3, 3.12, @@ -629,7 +929,9 @@ void test_encode_mobile_mand() 110, 225); assert(metrics != NULL); - mobile_flow = evel_new_mobile_flow("Outbound", + mobile_flow = evel_new_mobile_flow("mobileFlow_error", + "mobileFlow000000001", + "Outbound", metrics, "TCP", "IPv4", @@ -644,7 +946,16 @@ void test_encode_mobile_mand() compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Mobile"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(mobile_flow); + if(evel_post_event((EVENT_HEADER *)mobile_flow) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + + //evel_free_event(mobile_flow); } void test_encode_mobile_opts() @@ -653,13 +964,14 @@ void test_encode_mobile_opts() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"mobileFlow\", " - "\"eventId\": \"1242\", " + "\"eventId\": \"mobileFlow000000001\", " + "\"eventName\": \"mobileFlow_error\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 1242, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"Mobile flow...\", " @@ -762,7 +1074,7 @@ void test_encode_mobile_opts() /***************************************************************************/ /* Mobile. */ /***************************************************************************/ - evel_set_next_event_sequence(1242); +// evel_set_next_event_sequence(1242); metrics = evel_new_mobile_gtp_flow_metrics(132.0001, 31.2, @@ -803,9 +1115,15 @@ void test_encode_mobile_opts() evel_mobile_gtp_metrics_deact_by_set(metrics, "Remote"); evel_mobile_gtp_metrics_con_status_set(metrics, "Connected"); evel_mobile_gtp_metrics_tun_status_set(metrics, "Not tunneling"); - evel_mobile_gtp_metrics_iptos_set(metrics, 1, 13); - evel_mobile_gtp_metrics_iptos_set(metrics, 17, 1); - evel_mobile_gtp_metrics_iptos_set(metrics, 4, 99); + +// evel_mobile_gtp_metrics_iptos_set(metrics, 1, 13); +// evel_mobile_gtp_metrics_iptos_set(metrics, 17, 1); +// evel_mobile_gtp_metrics_iptos_set(metrics, 4, 99); + + evel_mobile_gtp_metrics_ip_tos_count_list_add(metrics, "1", "13"); + evel_mobile_gtp_metrics_ip_tos_count_list_add(metrics, "17", "1"); + evel_mobile_gtp_metrics_ip_tos_count_list_add(metrics, "4", "99"); + evel_mobile_gtp_metrics_large_pkt_rtt_set(metrics, 80); evel_mobile_gtp_metrics_large_pkt_thresh_set(metrics, 600.0); evel_mobile_gtp_metrics_max_rcv_bit_rate_set(metrics, 1357924680); @@ -813,14 +1131,23 @@ void test_encode_mobile_opts() evel_mobile_gtp_metrics_num_echo_fail_set(metrics, 1); evel_mobile_gtp_metrics_num_tun_fail_set(metrics, 4); evel_mobile_gtp_metrics_num_http_errors_set(metrics, 2); - evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_CWR, 10); - evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_URG, 121); - evel_mobile_gtp_metrics_qci_cos_count_add( - metrics, EVEL_QCI_COS_UMTS_CONVERSATIONAL, 11); - evel_mobile_gtp_metrics_qci_cos_count_add( - metrics, EVEL_QCI_COS_LTE_65, 122); - - mobile_flow = evel_new_mobile_flow("Inbound", + +// evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_CWR, 10); +// evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_URG, 121); + + + evel_mobile_gtp_metrics_tcp_flag_count_list_add(metrics, EVEL_TCP_CWR, "10"); + evel_mobile_gtp_metrics_tcp_flag_count_list_add(metrics, EVEL_TCP_URG, "121"); + +// evel_mobile_gtp_metrics_qci_cos_count_add( metrics, EVEL_QCI_COS_UMTS_CONVERSATIONAL, 11); +// evel_mobile_gtp_metrics_qci_cos_count_add( metrics, EVEL_QCI_COS_LTE_65, 122); + + evel_mobile_gtp_metrics_qci_cos_count_list_add(metrics, EVEL_QCI_COS_UMTS_CONVERSATIONAL, "11"); + evel_mobile_gtp_metrics_qci_cos_count_list_add(metrics, EVEL_QCI_COS_LTE_65, "122"); + + mobile_flow = evel_new_mobile_flow("mobileFlow_error", + "mobileFlow000000001", + "Inbound", metrics, "UDP", "IPv6", @@ -855,6 +1182,8 @@ void test_encode_mobile_opts() evel_mobile_flow_tac_set(mobile_flow, "2099"); evel_mobile_flow_tunnel_id_set(mobile_flow, "Tunnel 1"); evel_mobile_flow_vlan_id_set(mobile_flow, "15"); + evel_mobile_flow_addl_field_add(mobile_flow, "Mkey1", "MValue1"); + evel_mobile_flow_addl_field_add(mobile_flow, "Mkey2", "MValue2"); json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) mobile_flow); @@ -863,20 +1192,21 @@ void test_encode_mobile_opts() evel_free_event(mobile_flow); } - +/******** void test_encode_report() { char * expected = "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"measurementsForVfReporting\", " - "\"eventId\": \"125\", " + "\"eventId\": \"report000000001\", " + "\"eventName\": \"report_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 125, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"Perf reporting...\", " @@ -907,11 +1237,8 @@ void test_encode_report() char json_body[EVEL_MAX_JSON_BODY]; EVENT_REPORT * report = NULL; - /***************************************************************************/ - /* Report. */ - /***************************************************************************/ - evel_set_next_event_sequence(125); - report = evel_new_report(1.1); +// evel_set_next_event_sequence(125); + report = evel_new_report(1.1, "report_err", "report000000001"); assert(report != NULL); evel_report_type_set(report, "Perf reporting..."); evel_report_feature_use_add(report, "FeatureA", 123); @@ -927,7 +1254,8 @@ void test_encode_report() evel_free_event(report); } - +****************/ +/******************** void test_encode_service() { test_encode_service_subset(SERVICE_NONE); @@ -937,20 +1265,22 @@ void test_encode_service() test_encode_service_subset(SERVICE_EOC_VQM); test_encode_service_subset(SERVICE_MARKER); } - +********/ +/************** void test_encode_service_subset(const SERVICE_TEST service_test) { char * expected_start = "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"serviceEvents\", " - "\"eventId\": \"2000\", " + "\"eventId\": \"sipSignal0000000001\", " + "\"eventName\": \"sipSignal_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 2000, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"Service Event\", " @@ -1057,9 +1387,10 @@ void test_encode_service_subset(const SERVICE_TEST service_test) size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; - EVENT_SGNALING * event = NULL; - evel_set_next_event_sequence(2000); - event = evel_new_signaling("vendor_x_id", + EVENT_SIGNALING * event = NULL; +// evel_set_next_event_sequence(2000); + event = evel_new_signaling("sipSignal_err", + "sipSignal0000000001", "vendor_x_id", "correlator", "1.0.3.1", "1234", "192.168.1.3","3456"); assert(event != NULL); evel_signaling_type_set(event, "Signaling"); @@ -1083,27 +1414,27 @@ void test_encode_service_subset(const SERVICE_TEST service_test) break; case SERVICE_EOC_VQM: evel_signaling_addl_info_add(event, "adjacency", "vendor_x"); - /*evel_service_adjacency_name_set(event, "vendor_x_adjacency"); - evel_service_endpoint_desc_set(event, EVEL_SERVICE_ENDPOINT_CALLER); - evel_service_endpoint_jitter_set(event, 66); - evel_service_endpoint_rtp_oct_disc_set(event, 100); - evel_service_endpoint_rtp_oct_recv_set(event, 200); - evel_service_endpoint_rtp_oct_sent_set(event, 300); - evel_service_endpoint_rtp_pkt_disc_set(event, 400); - evel_service_endpoint_rtp_pkt_recv_set(event, 500); - evel_service_endpoint_rtp_pkt_sent_set(event, 600); - evel_service_local_jitter_set(event, 99); - evel_service_local_rtp_oct_disc_set(event, 150); - evel_service_local_rtp_oct_recv_set(event, 250); - evel_service_local_rtp_oct_sent_set(event, 350); - evel_service_local_rtp_pkt_disc_set(event, 450); - evel_service_local_rtp_pkt_recv_set(event, 550); - evel_service_local_rtp_pkt_sent_set(event, 650); - evel_service_mos_cqe_set(event, 12.255); - evel_service_packets_lost_set(event, 157); - evel_service_packet_loss_percent_set(event, 0.232); - evel_service_r_factor_set(event, 11); - evel_service_round_trip_delay_set(event, 15);*/ +// evel_service_adjacency_name_set(event, "vendor_x_adjacency"); +// evel_service_endpoint_desc_set(event, EVEL_SERVICE_ENDPOINT_CALLER); +// evel_service_endpoint_jitter_set(event, 66); +// evel_service_endpoint_rtp_oct_disc_set(event, 100); +// evel_service_endpoint_rtp_oct_recv_set(event, 200); +// evel_service_endpoint_rtp_oct_sent_set(event, 300); +// evel_service_endpoint_rtp_pkt_disc_set(event, 400); +// evel_service_endpoint_rtp_pkt_recv_set(event, 500); +// evel_service_endpoint_rtp_pkt_sent_set(event, 600); +// evel_service_local_jitter_set(event, 99); +// evel_service_local_rtp_oct_disc_set(event, 150); +// evel_service_local_rtp_oct_recv_set(event, 250); +// evel_service_local_rtp_oct_sent_set(event, 350); +// evel_service_local_rtp_pkt_disc_set(event, 450); +// evel_service_local_rtp_pkt_recv_set(event, 550); +// evel_service_local_rtp_pkt_sent_set(event, 650); +// evel_service_mos_cqe_set(event, 12.255); +// evel_service_packets_lost_set(event, 157); +// evel_service_packet_loss_percent_set(event, 0.232); +// evel_service_r_factor_set(event, 11); +// evel_service_round_trip_delay_set(event, 15); break; case SERVICE_MARKER: evel_signaling_addl_info_add(event, "service_phone", "0888888888"); @@ -1117,20 +1448,21 @@ void test_encode_service_subset(const SERVICE_TEST service_test) evel_free_event(event); } - +*******************/ void test_encode_signaling() { char * expected = "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"signaling\", " - "\"eventId\": \"2001\", " + "\"eventId\": \"sipSignal0000000001\", " + "\"eventName\": \"sipSignal_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 2001, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"Signaling\", " @@ -1159,29 +1491,142 @@ void test_encode_signaling() size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_SIGNALING * event = NULL; - evel_set_next_event_sequence(2001); - event = evel_new_signaling("vendor_x_id", +// evel_set_next_event_sequence(2001); + event = evel_new_signaling("sipSignal_err", + "sipSignal0000000001", "vendor_x_id", "correlator", "1.0.3.1", "1234", "192.168.1.3","3456"); assert(event != NULL); - evel_signaling_vnfmodule_name_set(event, "vendor_x_module"); - evel_signaling_vnfname_set(event, "vendor_x_vnf"); + + evel_signaling_addl_info_add(event, "name1", "value1"); + evel_signaling_addl_info_add(event, "name2", "value2"); + evel_signaling_addl_info_add(event, "name3", "value3"); + evel_signaling_addl_info_add(event, "name4", "value4"); + evel_signaling_type_set(event, "Signaling"); - evel_signaling_product_id_set(event, "vendor_x_product_id"); - evel_signaling_subsystem_id_set(event, "vendor_x_subsystem_id"); - evel_signaling_friendly_name_set(event, "vendor_x_frieldly_name"); - evel_signaling_correlator_set(event, "vendor_x_correlator"); evel_signaling_local_ip_address_set(event, "1.0.3.1"); evel_signaling_local_port_set(event, "1031"); evel_signaling_remote_ip_address_set(event, "5.3.3.0"); evel_signaling_remote_port_set(event, "5330"); + evel_signaling_vnfmodule_name_set(event, "vendor_x_module"); + evel_signaling_vnfname_set(event, "vendor_x_vnf"); evel_signaling_compressed_sip_set(event, "compressed_sip"); evel_signaling_summary_sip_set(event, "summary_sip"); + evel_signaling_correlator_set(event, "vendor_x_correlator"); + + json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) event); compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Signaling"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(event); + if(evel_post_event((EVENT_HEADER *)event) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(event); +} + +void test_encode_notif() +{ + char * expected = " "; + HASHTABLE_T * ht1 = NULL; + size_t json_size = 0; + char json_body[EVEL_MAX_JSON_BODY]; + EVENT_NOTIFICATION * event = NULL; + event = evel_new_notification("notif_err", + "Notification0000000001", "ChangeId", + "ChangeType"); + + assert(event != NULL); + + evel_notification_type_set(event, "Event_type"); + evel_notification_changeContact_set(event, "ChangeContact"); + evel_notification_state_interface_set(event, "STInterface"); + evel_notification_new_state_set(event, EVEL_ENTITY_STATE_MAINTENANCE); + evel_notification_old_state_set(event, EVEL_ENTITY_STATE_OUT_OF_SERVICE); + + evel_notification_addl_field_add(event, "name1", "value1"); + evel_notification_addl_field_add(event, "name2", "value2"); + evel_notification_addl_field_add(event, "name3", "value3"); + evel_notification_addl_field_add(event, "name4", "value4"); + + ht1 = evel_notification_add_new_named_hashmap(event, "hmNam1"); + evel_notification_named_hashmap_set(ht1, "hmnap1", "hmvalue1"); + evel_notification_named_hashmap_set(ht1, "hmnap2", "hmvalue2"); + evel_notification_named_hashmap_set(ht1, "hmnap3", "hmvalue3"); + evel_notification_named_hashmap_set(ht1, "hmnap4", "hmvalue4"); + ht1 = evel_notification_add_new_named_hashmap(event, "hmNam2"); + evel_notification_named_hashmap_set(ht1, "hmnap21", "hmvalue21"); + evel_notification_named_hashmap_set(ht1, "hmnap22", "hmvalue22"); + evel_notification_named_hashmap_set(ht1, "hmnap23", "hmvalue23"); + evel_notification_named_hashmap_set(ht1, "hmnap24", "hmvalue24"); + + + json_size = evel_json_encode_event( + json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) event); + compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Notification"); + assert((json_size == strlen(json_body)) && "Bad size returned"); + + if(evel_post_event((EVENT_HEADER *)event) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(event); +} + +void test_encode_voiceQ() +{ + char * expected = " "; + + size_t json_size = 0; + char json_body[EVEL_MAX_JSON_BODY]; + EVENT_VOICE_QUALITY * event = NULL; +// evel_set_next_event_sequence(2001); + event = evel_new_voice_quality("voiceQ_err", + "VoiceQuality0000000001", "Called_Codec", + "Caller_codec", "Correlator", "RTCP", "Vendor_x"); + assert(event != NULL); + + evel_voice_quality_addl_info_add(event, "name1", "value1"); + evel_voice_quality_addl_info_add(event, "name2", "value2"); + evel_voice_quality_addl_info_add(event, "name3", "value3"); + evel_voice_quality_addl_info_add(event, "name4", "value4"); + +// evel_voice_quality_callee_codec_set(event, "Callee_cdc1"); +// evel_voice_quality_caller_codec_set(event, "Clr_cdc1"); + + evel_voice_quality_correlator_set(event, "CorrNew"); + evel_voice_quality_rtcp_data_set(event, "RTCPNew"); + evel_voice_quality_vnfmodule_name_set(event, "vendor_x_module"); + evel_voice_quality_vnfname_set(event, "vendor_x_vnf"); + evel_voice_quality_phone_number_set(event, "1234567890"); + evel_voice_quality_end_metrics_add(event, "Adj_name", EVEL_SERVICE_ENDPOINT_CALLEE, 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,16,17,18,19,20,21,22,23,24,25,26,27); + + json_size = evel_json_encode_event( + json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) event); + compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "VoiceQuality"); + assert((json_size == strlen(json_body)) && "Bad size returned"); + + if(evel_post_event((EVENT_HEADER *)event) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(event); } void test_encode_state_change() @@ -1190,13 +1635,14 @@ void test_encode_state_change() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"stateChange\", " - "\"eventId\": \"128\", " + "\"eventId\": \"stateChange000000001\", " + "\"eventName\": \"stateChange_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 128, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"SC Type\", " @@ -1219,9 +1665,11 @@ void test_encode_state_change() size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_STATE_CHANGE * state_change = NULL; - evel_set_next_event_sequence(128); - state_change = evel_new_state_change(EVEL_ENTITY_STATE_IN_SERVICE, - EVEL_ENTITY_STATE_OUT_OF_SERVICE, +// evel_set_next_event_sequence(128); + state_change = evel_new_state_change("stateChange_err", + "stateChange000000001", + EVEL_ENTITY_STATE_IN_SERVICE, + EVEL_ENTITY_STATE_MAINTENANCE, "An Interface"); assert(state_change != NULL); evel_state_change_type_set(state_change, "SC Type"); @@ -1233,7 +1681,16 @@ void test_encode_state_change() compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "StateChange"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(state_change); + if(evel_post_event((EVENT_HEADER *)state_change) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(state_change); } void test_encode_syslog() @@ -1242,13 +1699,14 @@ void test_encode_syslog() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"syslog\", " - "\"eventId\": \"126\", " + "\"eventId\": \"syslog000000001\", " + "\"eventName\": \"syslog_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 126, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"SL Type\", " @@ -1270,8 +1728,9 @@ void test_encode_syslog() size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_SYSLOG * syslog = NULL; - evel_set_next_event_sequence(126); - syslog = evel_new_syslog(EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION, +// evel_set_next_event_sequence(126); + syslog = evel_new_syslog("syslog_err", "syslog000000001", + EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION, "SL Message", "SL Tag"); assert(syslog != NULL); @@ -1282,13 +1741,33 @@ void test_encode_syslog() evel_syslog_proc_id_set(syslog, 2); evel_syslog_version_set(syslog, 1); evel_syslog_s_data_set(syslog, "SL SDATA"); + evel_syslog_sdid_set(syslog, "ourSDID@12345"); + evel_syslog_severity_set(syslog, "Alert"); + evel_syslog_timeStamp_set(syslog, "12-DEC-2018"); + evel_syslog_MsgHost_set(syslog, "hostName123"); + evel_syslog_priority_set(syslog, 15); + + evel_syslog_addl_fields_set(syslog, "Name1", "Value1"); + evel_syslog_addl_fields_set(syslog, "Name2", "Value2"); + evel_syslog_addl_fields_set(syslog, "Name3", "Value3"); + evel_syslog_addl_fields_set(syslog, "Name4", "Value4"); + evel_syslog_addl_fields_set(syslog, "Name5", "Value5"); json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) syslog); compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Syslog"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(syslog); + if(evel_post_event((EVENT_HEADER *)syslog) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + + // evel_free_event(syslog); } void test_encode_other() @@ -1297,13 +1776,14 @@ void test_encode_other() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"other\", " - "\"eventId\": \"129\", " + "\"eventId\": \"other000000001\", " + "\"eventName\": \"other_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 129, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"Other Type\", " @@ -1321,23 +1801,170 @@ void test_encode_other() size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_OTHER * other = NULL; - evel_set_next_event_sequence(129); - other = evel_new_other(); + HASHTABLE_T * ht1 = NULL; + HASHTABLE_T * ht2 = NULL; + +// evel_set_next_event_sequence(129); + other = evel_new_other("other_err", "other000000001"); assert(other != NULL); evel_other_type_set(other, "Other Type"); - evel_other_field_add(other, - "Other field 1", - "Other value 1"); - evel_other_field_add(other, - "Other field 2", - "Other value 2"); + + ht1 = evel_other_add_new_hashmap_to_hmarray(other, "hmap1"); + ht2 = evel_other_add_new_hashmap_to_hmarray(other, "hmap2"); + + evel_other_set_hashmap_in_hmarray(ht1, "Name11", "Value11"); + evel_other_set_hashmap_in_hmarray(ht2, "Name21", "Value21"); + evel_other_set_hashmap_in_hmarray(ht1, "Name12", "Value12"); + evel_other_set_hashmap_in_hmarray(ht2, "Name22", "Value22"); + evel_other_set_hashmap_in_hmarray(ht1, "Name13", "Value13"); + evel_other_set_hashmap_in_hmarray(ht2, "Name23", "Value23"); + evel_other_set_hashmap_in_hmarray(ht1, "Name14", "Value14"); + evel_other_set_hashmap_in_hmarray(ht2, "Name24", "Value24"); + + evel_other_field_add_hashmap(other, "Name1", "Value1"); + evel_other_field_add_hashmap(other, "Name2", "Value2"); + evel_other_field_add_hashmap(other, "Name3", "Value3"); + evel_other_field_add_hashmap(other, "Name4", "Value4"); + evel_other_field_add_hashmap(other, "Name5", "Value5"); json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) other); compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "Other"); assert((json_size == strlen(json_body)) && "Bad size returned"); - evel_free_event(other); + if(evel_post_event((EVENT_HEADER *)other) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(other); +} + +void test_encode_pnfreg() +{ + char * expected = + "{\"event\": " + "{\"commonEventHeader\": {" + "\"domain\": \"other\", " + "\"eventId\": \"other000000001\", " + "\"eventName\": \"other_err\", " + "\"functionalRole\": \"UNIT TEST\", " + "\"lastEpochMicrosec\": 1000002, " + "\"priority\": \"Normal\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " + "\"sequence\": 129, " + "\"sourceName\": \"prakash-VirtualBox\", " + "\"startEpochMicrosec\": 1000002, " + "\"version\": 1.2, " + "\"eventType\": \"Other Type\", " + "\"reportingEntityId\": \"Dummy VM UUID - No Metadata available\", " + "\"sourceId\": \"Dummy VM UUID - No Metadata available\"" + "}, " + "\"otherFields\": [" + "{\"name\": \"Other field 1\", " + "\"value\": \"Other value 1\"}, " + "{\"name\": \"Other field 2\", " + "\"value\": \"Other value 2\"}" + "]" + "}}"; + + size_t json_size = 0; + char json_body[EVEL_MAX_JSON_BODY]; + EVENT_PNF_REGISTRATION * pnfreg = NULL; + + pnfreg = evel_new_pnf_registration("pnfreg_err", "pnfreg000000001"); + assert(pnfreg != NULL); + + evel_pnf_registration_addl_field_add(pnfreg, "Name1", "Value1"); + evel_pnf_registration_addl_field_add(pnfreg, "Name2", "Value2"); + evel_pnf_registration_addl_field_add(pnfreg, "Name3", "Value3"); + evel_pnf_registration_addl_field_add(pnfreg, "Name4", "Value4"); + evel_pnf_registration_addl_field_add(pnfreg, "Name5", "Value5"); + + evel_pnfRegistration_last_service_date_set(pnfreg, "10FEB2019"); + evel_pnfRegistration_mac_address_set(pnfreg, "FF:28:22:34:45:56"); + evel_pnfRegistration_manufacture_date_set(pnfreg, "FEB2011"); + evel_pnfRegistration_model_number_set(pnfreg, "FE934567"); + evel_pnfRegistration_oam_v4_ipaddress_set(pnfreg, "10.255.1.254"); + evel_pnfRegistration_oam_v6_ipaddress_set(pnfreg, "::20"); + evel_pnfRegistration_serial_number_set(pnfreg, "1234567890"); + evel_pnfRegistration_sw_version_set(pnfreg, "SW1234"); + evel_pnfRegistration_unit_family_set(pnfreg, "Unit_Fam_123"); + evel_pnfRegistration_unit_type_set(pnfreg, "Unit_type_123"); + evel_pnfRegistration_vendor_name_set(pnfreg, "Vend_nam_123"); + + + json_size = evel_json_encode_event( + json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) pnfreg); + compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "PNFRegistration"); + assert((json_size == strlen(json_body)) && "Bad size returned"); + + if(evel_post_event((EVENT_HEADER *)pnfreg) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } + +// evel_free_event(pnfreg); +} + +void test_encode_tca() +{ + + char * expected = "123456789"; + size_t json_size = 0; + char json_body[EVEL_MAX_JSON_BODY]; + EVENT_THRESHOLD_CROSS * tca = NULL; + PERF_COUNTER * perf = NULL; + + tca = evel_new_threshold_cross("tca_err", "tca000000001", EVEL_EVENT_ACTION_SET, "NE-CPUMEM", EVEL_CARD_ANOMALY, "1234567", EVEL_SEVERITY_CRITICAL, "8765432" ); + assert(tca != NULL); + + perf = evel_threshold_cross_add_addl_parameters(tca, "CRIT", "LastThresh"); + evel_threshold_cross_addl_parameters_hashmap_set(perf, "key1", "value1"); + evel_threshold_cross_addl_parameters_hashmap_set(perf, "key2", "value2"); + perf = evel_threshold_cross_add_addl_parameters(tca, "CRIT", "LastThresh"); + evel_threshold_cross_addl_parameters_hashmap_set(perf, "key3", "value3"); + evel_threshold_cross_addl_parameters_hashmap_set(perf, "key4", "value4"); + + evel_threshold_cross_type_set(tca, "node"); + evel_threshold_cross_alertid_add(tca, "Alert1"); + evel_threshold_cross_alertid_add(tca, "Alert2"); + evel_threshold_cross_alertid_add(tca, "Alert3"); + + evel_threshold_cross_addl_info_add(tca, "addnam1", "addval1"); + evel_threshold_cross_addl_info_add(tca, "addnam2", "addval2"); + evel_threshold_cross_addl_info_add(tca, "addnam3", "addval3"); + + evel_threshold_cross_possible_rootcause_set(tca, "prootcause"); + evel_threshold_cross_networkservice_set(tca, "nwservice"); + + evel_threshold_cross_interfacename_set(tca, "ens04"); + evel_threshold_cross_data_elementtype_set(tca, "elementtype"); + evel_threshold_cross_data_collector_set(tca, "dataCollector"); + evel_threshold_cross_alertvalue_set(tca, "AlertVal"); + + json_size = evel_json_encode_event( + json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) tca); + compare_strings(expected, json_body, EVEL_MAX_JSON_BODY, "TCA"); + assert((json_size == strlen(json_body)) && "Bad size returned"); + + if(evel_post_event((EVENT_HEADER *)tca) == EVEL_SUCCESS) + { + printf("Message sent to Collector successfully\n"); + } + else + { + printf("Message sending Error\n"); + } +// evel_free_event(tca); } void compare_strings(char * expected, @@ -1345,6 +1972,7 @@ void compare_strings(char * expected, int max_size, char * description) { + sleep(5); if (strncmp(expected, actual, max_size) != 0) { int diff = 0; @@ -1357,11 +1985,11 @@ void compare_strings(char * expected, diff++; } - printf("Comparison Failure at Offset %d\n\n", diff); - printf("Expected:\n%s\n", expected); - printf("Actual:\n%s\n", actual); +// printf("Comparison Failure at Offset %d\n\n", diff); +// printf("Expected:\n%s\n", expected); printf("Description: %s\n", description); - assert(0); + printf("Actual:\n%s\n\n\n", actual); +// assert(0); } } @@ -1406,6 +2034,7 @@ void handle_json_response(char * json, MEMORY_CHUNK * post) /**************************************************************************//** * Test that a non-"commandList" JSON buffer leaves the throttle state off. *****************************************************************************/ +/**************** void test_json_response_junk() { MEMORY_CHUNK post; @@ -1421,21 +2050,16 @@ void test_json_response_junk() evel_throttle_initialize(); handle_json_response(json_junk, &post); - /***************************************************************************/ - /* Check that all domains are not throttled. */ - /***************************************************************************/ for (domain = EVEL_DOMAIN_FAULT; domain < EVEL_MAX_DOMAINS; domain++) { assert(evel_get_throttle_spec(domain) == NULL); } - /***************************************************************************/ - /* Check that we generated no post. */ - /***************************************************************************/ assert(post.memory == NULL); evel_throttle_terminate(); } +**********************/ char * json_command_list_provide = "{" @@ -1485,6 +2109,7 @@ char * expected_throttle_state_normal = /**************************************************************************//** * Test that we can return the default throttling state. *****************************************************************************/ +/******************* void test_json_provide_throttle_state() { MEMORY_CHUNK post; @@ -1495,17 +2120,11 @@ void test_json_provide_throttle_state() evel_throttle_initialize(); handle_json_response(json_command_list_provide, &post); - /***************************************************************************/ - /* Check that all domains are not throttled. */ - /***************************************************************************/ for (domain = EVEL_DOMAIN_FAULT; domain < EVEL_MAX_DOMAINS; domain++) { assert(evel_get_throttle_spec(domain) == NULL); } - /***************************************************************************/ - /* Check that we generated a throttling specification post. */ - /***************************************************************************/ assert(post.memory != NULL); compare_strings(expected_post, post.memory, strlen(expected_post), "Throttle State Normal"); @@ -1513,10 +2132,11 @@ void test_json_provide_throttle_state() evel_throttle_terminate(); } - +*************************/ /**************************************************************************//** * Test the measurement interval handling and API. *****************************************************************************/ +/******************** void test_json_measurement_interval() { MEMORY_CHUNK post; @@ -1558,33 +2178,26 @@ void test_json_measurement_interval() evel_throttle_initialize(); assert(evel_get_measurement_interval() == EVEL_MEASUREMENT_INTERVAL_UKNOWN); - /***************************************************************************/ - /* Check that we're not handling stuff when we shouldn't. */ - /***************************************************************************/ handle_json_response(json_command_list_interval_only, &post); assert(post.memory == NULL); assert(evel_get_measurement_interval() == EVEL_MEASUREMENT_INTERVAL_UKNOWN); - /***************************************************************************/ - /* Check that we're OK with the interval coming first. */ - /***************************************************************************/ handle_json_response(json_command_list_interval_first, &post); assert(post.memory == NULL); assert(evel_get_measurement_interval() == 30); - /***************************************************************************/ - /* Check that we're OK with the command type coming first. */ - /***************************************************************************/ handle_json_response(json_command_list_command_first, &post); assert(post.memory == NULL); assert(evel_get_measurement_interval() == 60); evel_throttle_terminate(); } +*********************/ /**************************************************************************//** * Test a single domain, single field suppression. *****************************************************************************/ +/******************* void test_json_throttle_spec_field() { MEMORY_CHUNK post; @@ -1648,15 +2261,9 @@ void test_json_throttle_spec_field() "}" "}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list_fault_single, &post); - /***************************************************************************/ - /* Check that the FAULT domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_FAULT) != NULL); for (domain = EVEL_DOMAIN_MEASUREMENT; domain < EVEL_MAX_DOMAINS; domain++) { @@ -1667,9 +2274,6 @@ void test_json_throttle_spec_field() } assert(post.memory == NULL); - /***************************************************************************/ - /* Request and verify the throttling state. */ - /***************************************************************************/ handle_json_response(json_command_list_provide, &post); assert(post.memory != NULL); compare_strings(expected_post_fault_single, @@ -1679,14 +2283,8 @@ void test_json_throttle_spec_field() free(post.memory); post.memory = NULL; - /***************************************************************************/ - /* Update a specification with two faults suppressed. */ - /***************************************************************************/ handle_json_response(json_command_list_fault_double, &post); - /***************************************************************************/ - /* Check that the FAULT domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_FAULT) != NULL); for (domain = EVEL_DOMAIN_MEASUREMENT; domain < EVEL_MAX_DOMAINS; domain++) { @@ -1697,9 +2295,6 @@ void test_json_throttle_spec_field() } assert(post.memory == NULL); - /***************************************************************************/ - /* Request and verify the throttling state. */ - /***************************************************************************/ handle_json_response(json_command_list_provide, &post); assert(post.memory != NULL); compare_strings(expected_post_fault_double, @@ -1709,9 +2304,6 @@ void test_json_throttle_spec_field() free(post.memory); post.memory = NULL; - /***************************************************************************/ - /* Now clear the FAULT domain. */ - /***************************************************************************/ handle_json_response(json_command_list_fault_clear, &post); for (domain = EVEL_DOMAIN_FAULT; domain < EVEL_MAX_DOMAINS; domain++) { @@ -1720,10 +2312,11 @@ void test_json_throttle_spec_field() evel_throttle_terminate(); } - +*******************************/ /**************************************************************************//** * Test a single domain, nv_pair suppression. *****************************************************************************/ +/************** void test_json_throttle_spec_nv_pair() { MEMORY_CHUNK post; @@ -1772,7 +2365,7 @@ void test_json_throttle_spec_nv_pair() char * expected_post_fault_pair_single = "{" "\"eventThrottlingState\": {" - "\"eventThrottlingMode\": \"throttled\", " + "\"eventohrottlingMode\": \"throttled\", " "\"eventDomainThrottleSpecificationList\": [" "{" "\"eventDomain\": \"fault\", " @@ -1805,16 +2398,9 @@ void test_json_throttle_spec_nv_pair() "}" "}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single nvpair with a */ - /* single sub-field suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list_fault_pair_single, &post); - /***************************************************************************/ - /* Check that the FAULT domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_FAULT) != NULL); for (domain = EVEL_DOMAIN_MEASUREMENT; domain < EVEL_MAX_DOMAINS; domain++) { @@ -1825,9 +2411,6 @@ void test_json_throttle_spec_nv_pair() } assert(post.memory == NULL); - /***************************************************************************/ - /* Request and verify the throttling state. */ - /***************************************************************************/ handle_json_response(json_command_list_provide, &post); assert(post.memory != NULL); compare_strings(expected_post_fault_pair_single, @@ -1837,15 +2420,8 @@ void test_json_throttle_spec_nv_pair() free(post.memory); post.memory = NULL; - /***************************************************************************/ - /* Update a specification with a single nvpair with two sub-fields */ - /* suppressed. */ - /***************************************************************************/ handle_json_response(json_command_list_fault_pair_double, &post); - /***************************************************************************/ - /* Check that the FAULT domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_FAULT) != NULL); for (domain = EVEL_DOMAIN_MEASUREMENT; domain < EVEL_MAX_DOMAINS; domain++) { @@ -1856,9 +2432,6 @@ void test_json_throttle_spec_nv_pair() } assert(post.memory == NULL); - /***************************************************************************/ - /* Request and verify the throttling state. */ - /***************************************************************************/ handle_json_response(json_command_list_provide, &post); assert(post.memory != NULL); compare_strings(expected_post_fault_pair_double, @@ -1868,9 +2441,6 @@ void test_json_throttle_spec_nv_pair() free(post.memory); post.memory = NULL; - /***************************************************************************/ - /* Now clear the FAULT domain. */ - /***************************************************************************/ handle_json_response(json_command_list_fault_clear, &post); for (domain = EVEL_DOMAIN_FAULT; domain < EVEL_MAX_DOMAINS; domain++) { @@ -1879,10 +2449,11 @@ void test_json_throttle_spec_nv_pair() evel_throttle_terminate(); } - +********************/ /**************************************************************************//** * Test two domains, nv_pair suppression. *****************************************************************************/ +/********************* void test_json_throttle_spec_two_domains() { MEMORY_CHUNK post; @@ -1941,16 +2512,9 @@ void test_json_throttle_spec_two_domains() "}" "}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single nvpair with a */ - /* single sub-field suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list_two_domains, &post); - /***************************************************************************/ - /* Check that the FAULT and SYSLOG domains are throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_FAULT) != NULL); assert(evel_get_throttle_spec(EVEL_DOMAIN_SYSLOG) != NULL); for (domain = EVEL_DOMAIN_MEASUREMENT; domain < EVEL_MAX_DOMAINS; domain++) @@ -1962,9 +2526,6 @@ void test_json_throttle_spec_two_domains() } assert(post.memory == NULL); - /***************************************************************************/ - /* Request and verify the throttling state. */ - /***************************************************************************/ handle_json_response(json_command_list_provide, &post); assert(post.memory != NULL); compare_strings(expected_post_two_domains, @@ -1974,9 +2535,6 @@ void test_json_throttle_spec_two_domains() free(post.memory); post.memory = NULL; - /***************************************************************************/ - /* Now clear the FAULT and SYSLOG domains. */ - /***************************************************************************/ handle_json_response(json_command_list_fault_clear, &post); assert(evel_get_throttle_spec(EVEL_DOMAIN_FAULT) == NULL); assert(evel_get_throttle_spec(EVEL_DOMAIN_SYSLOG) != NULL); @@ -1988,19 +2546,16 @@ void test_json_throttle_spec_two_domains() evel_throttle_terminate(); } - +******************/ /**************************************************************************//** * Test bad command type. *****************************************************************************/ +/********************* void test_json_throttle_spec_bad_command_type() { MEMORY_CHUNK post; int domain; - /***************************************************************************/ - /* Search for "dodgy" in the JSON, and you will see the dodgy bits we're */ - /* handling in these tests. */ - /***************************************************************************/ #define NUM_BAD_COMMANDS 8 char * json_command_list_dodgy_command = "{" @@ -2240,10 +2795,6 @@ void test_json_throttle_spec_bad_command_type() sizeof(expected_posts) / sizeof(expected_posts[0]); assert(num_commands == num_posts); - /***************************************************************************/ - /* Initialize and provide a specification with a single nvpair with a */ - /* single sub-field suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); int ii; @@ -2252,10 +2803,6 @@ void test_json_throttle_spec_bad_command_type() EVEL_DEBUG("Testing commandList[%d] = %s\n", ii, json_command_lists[ii]); handle_json_response(json_command_lists[ii], &post); - /*************************************************************************/ - /* Check that throttling is in a normal state - because we ignored the */ - /* command / ..... */ - /*************************************************************************/ for (domain = EVEL_DOMAIN_MEASUREMENT; domain < EVEL_MAX_DOMAINS; domain++) { assert(evel_get_throttle_spec(domain) == NULL); @@ -2270,9 +2817,6 @@ void test_json_throttle_spec_bad_command_type() } assert(post.memory == NULL); - /*************************************************************************/ - /* Request and verify the throttling state. */ - /*************************************************************************/ handle_json_response(json_command_list_provide, &post); assert(post.memory != NULL); compare_strings(expected_posts[ii], @@ -2285,14 +2829,12 @@ void test_json_throttle_spec_bad_command_type() evel_throttle_terminate(); } - +**************************/ +/**************** void test_encode_fault_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -2318,13 +2860,14 @@ void test_encode_fault_throttled() "{\"event\": {" "\"commonEventHeader\": {" "\"domain\": \"fault\", " - "\"eventId\": \"122\", " + "\"eventId\": \"fault000000001\", " + "\"eventName\": \"fault_eNodeB_alarm\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 122, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -2342,22 +2885,18 @@ void test_encode_fault_throttled() "\"value\": \"value2\"}]" "}}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_FAULT) != NULL); assert(post.memory == NULL); size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; - evel_set_next_event_sequence(122); - EVENT_FAULT * fault = evel_new_fault("My alarm condition", +// evel_set_next_event_sequence(122); + EVENT_FAULT * fault = evel_new_fault("fault_eNodeB_alarm", + "fault000000001", + "My alarm condition", "It broke very badly", EVEL_PRIORITY_NORMAL, EVEL_SEVERITY_MAJOR, @@ -2368,9 +2907,6 @@ void test_encode_fault_throttled() evel_fault_addl_info_add(fault, "name1", "value1"); evel_fault_addl_info_add(fault, "name2", "value2"); - /***************************************************************************/ - /* Suppressed fields. */ - /***************************************************************************/ evel_fault_interface_set(fault, "My Interface Card"); evel_fault_addl_info_add(fault, "name3", "value3"); evel_fault_addl_info_add(fault, "name4", "value4"); @@ -2383,14 +2919,12 @@ void test_encode_fault_throttled() evel_free_event(fault); evel_throttle_terminate(); } - +***********************/ +/*********************** void test_encode_measurement_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -2447,13 +2981,14 @@ void test_encode_measurement_throttled() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"measurementsForVfScaling\", " - "\"eventId\": \"123\", " + "\"eventId\": \"mvfs000000001\", " + "\"eventName\": \"mvfs_perfUnit_issue\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 123, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -2487,24 +3022,18 @@ void test_encode_measurement_throttled() "\"measurementsForVfScalingVersion\": 1.1}}}"; MEASUREMENT_CPU_USE *cpu_use; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_MEASUREMENT) != NULL); assert(post.memory == NULL); size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; - evel_set_next_event_sequence(123); - EVENT_MEASUREMENT * measurement = evel_new_measurement(5.5); +// evel_set_next_event_sequence(123); + EVENT_MEASUREMENT * measurement = evel_new_measurement(5.5, "mvfs_perfUnit_issue", "mvfs000000001"); MEASUREMENT_LATENCY_BUCKET * bucket = NULL; - MEASUREMENT_VNIC_PERFORMANCE * vnic_use = NULL; + MEASUREMENT_NIC_PERFORMANCE * vnic_use = NULL; assert(measurement != NULL); evel_measurement_type_set(measurement, "Perf management..."); @@ -2593,14 +3122,12 @@ void test_encode_measurement_throttled() evel_free_event(measurement); evel_throttle_terminate(); } - +***************/ +/*******************` void test_encode_mobile_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -2645,13 +3172,14 @@ void test_encode_mobile_throttled() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"mobileFlow\", " - "\"eventId\": \"1242\", " + "\"eventId\": \"mobileFlow000000001\", " + "\"eventName\": \"mobileFlow_error\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 1242, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -2720,15 +3248,9 @@ void test_encode_mobile_throttled() "\"reportingEndpointPort\": 4322" "}}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_MOBILE_FLOW) != NULL); assert(post.memory == NULL); @@ -2737,10 +3259,7 @@ void test_encode_mobile_throttled() MOBILE_GTP_PER_FLOW_METRICS * metrics = NULL; EVENT_MOBILE_FLOW * mobile_flow = NULL; - /***************************************************************************/ - /* Mobile. */ - /***************************************************************************/ - evel_set_next_event_sequence(1242); +// evel_set_next_event_sequence(1242); metrics = evel_new_mobile_gtp_flow_metrics(132.0001, 31.2, @@ -2781,9 +3300,13 @@ void test_encode_mobile_throttled() evel_mobile_gtp_metrics_deact_by_set(metrics, "Remote"); evel_mobile_gtp_metrics_con_status_set(metrics, "Connected"); evel_mobile_gtp_metrics_tun_status_set(metrics, "Not tunneling"); - evel_mobile_gtp_metrics_iptos_set(metrics, 1, 13); - evel_mobile_gtp_metrics_iptos_set(metrics, 17, 1); - evel_mobile_gtp_metrics_iptos_set(metrics, 4, 99); +// evel_mobile_gtp_metrics_iptos_set(metrics, 1, 13); +// evel_mobile_gtp_metrics_iptos_set(metrics, 17, 1); +// evel_mobile_gtp_metrics_iptos_set(metrics, 4, 99); + evel_mobile_gtp_metrics_ip_tos_count_list_add(metrics, "1", "13"); + evel_mobile_gtp_metrics_ip_tos_count_list_add(metrics, "17", "1"); + evel_mobile_gtp_metrics_ip_tos_count_list_add(metrics, "4", "99"); + evel_mobile_gtp_metrics_large_pkt_rtt_set(metrics, 80); evel_mobile_gtp_metrics_large_pkt_thresh_set(metrics, 600.0); evel_mobile_gtp_metrics_max_rcv_bit_rate_set(metrics, 1357924680); @@ -2791,14 +3314,18 @@ void test_encode_mobile_throttled() evel_mobile_gtp_metrics_num_echo_fail_set(metrics, 1); evel_mobile_gtp_metrics_num_tun_fail_set(metrics, 4); evel_mobile_gtp_metrics_num_http_errors_set(metrics, 2); - evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_CWR, 10); - evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_URG, 121); - evel_mobile_gtp_metrics_qci_cos_count_add( - metrics, EVEL_QCI_COS_UMTS_CONVERSATIONAL, 11); - evel_mobile_gtp_metrics_qci_cos_count_add( - metrics, EVEL_QCI_COS_LTE_65, 122); - - mobile_flow = evel_new_mobile_flow("Inbound", +// evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_CWR, 10); +// evel_mobile_gtp_metrics_tcp_flag_count_add(metrics, EVEL_TCP_URG, 121); + evel_mobile_gtp_metrics_tcp_flag_count_list_add(metrics, EVEL_TCP_CWR, "10"); + evel_mobile_gtp_metrics_tcp_flag_count_list_add(metrics, EVEL_TCP_URG, "121"); +// evel_mobile_gtp_metrics_qci_cos_count_add( metrics, EVEL_QCI_COS_UMTS_CONVERSATIONAL, 11); +// evel_mobile_gtp_metrics_qci_cos_count_add( metrics, EVEL_QCI_COS_LTE_65, 122); + evel_mobile_gtp_metrics_qci_cos_count_list_add(metrics, EVEL_QCI_COS_UMTS_CONVERSATIONAL, "11"); + evel_mobile_gtp_metrics_qci_cos_count_list_add(metrics, EVEL_QCI_COS_LTE_65, "122"); + + mobile_flow = evel_new_mobile_flow("mobileFlow_error", + "mobileFlow000000001", + "Inbound", metrics, "UDP", "IPv6", @@ -2842,14 +3369,12 @@ void test_encode_mobile_throttled() evel_free_event(mobile_flow); evel_throttle_terminate(); } - +*****************/ +/************** void test_encode_other_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -2871,13 +3396,14 @@ void test_encode_other_throttled() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"other\", " - "\"eventId\": \"129\", " + "\"eventId\": \"other000000001\", " + "\"eventName\": \"other_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 129, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -2889,23 +3415,17 @@ void test_encode_other_throttled() "]" "}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_OTHER) != NULL); assert(post.memory == NULL); size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_OTHER * other = NULL; - evel_set_next_event_sequence(129); - other = evel_new_other(); +// evel_set_next_event_sequence(129); + other = evel_new_other("other_err", "other000000001"); assert(other != NULL); evel_other_type_set(other, "Other Type"); evel_other_field_add(other, @@ -2923,14 +3443,12 @@ void test_encode_other_throttled() evel_free_event(other); evel_throttle_terminate(); } - +*******************/ +/********************* void test_encode_report_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -2960,13 +3478,14 @@ void test_encode_report_throttled() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"measurementsForVfReporting\", " - "\"eventId\": \"125\", " + "\"eventId\": \"report000000001\", " + "\"eventName\": \"report_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 125, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -2982,15 +3501,9 @@ void test_encode_report_throttled() "\"value\": \"Value1\"}]}], " "\"measurementFieldsVersion\": 1.1}}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_REPORT) != NULL); assert(post.memory == NULL); @@ -2998,11 +3511,8 @@ void test_encode_report_throttled() char json_body[EVEL_MAX_JSON_BODY]; EVENT_REPORT * report = NULL; - /***************************************************************************/ - /* Report. */ - /***************************************************************************/ - evel_set_next_event_sequence(125); - report = evel_new_report(1.1); +// evel_set_next_event_sequence(125); + report = evel_new_report(1.1, "report_err", "report000000001"); assert(report != NULL); evel_report_type_set(report, "Perf reporting..."); evel_report_feature_use_add(report, "FeatureA", 123); @@ -3019,14 +3529,12 @@ void test_encode_report_throttled() evel_free_event(report); evel_throttle_terminate(); } - +**********************/ +/******************************************** void test_encode_service_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -3062,9 +3570,9 @@ void test_encode_service_throttled() "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 2000, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -3083,22 +3591,16 @@ void test_encode_service_throttled() "{\"name\": \"Name4\", \"value\": \"Value4\"}]" "}}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_SERVICE) != NULL); assert(post.memory == NULL); size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_SERVICE * event = NULL; - evel_set_next_event_sequence(2000); +// evel_set_next_event_sequence(2000); event = evel_new_service("vendor_x_id", "vendor_x_event_id"); assert(event != NULL); evel_service_type_set(event, "Service Event"); @@ -3145,14 +3647,13 @@ void test_encode_service_throttled() evel_free_event(event); evel_throttle_terminate(); } +****************************/ +/************************ void test_encode_signaling_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -3181,13 +3682,14 @@ void test_encode_signaling_throttled() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"signaling\", " - "\"eventId\": \"2001\", " + "\"eventId\": \"sipSignal0000000001\", " + "\"eventName\": \"sipSignal_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 2001, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -3203,23 +3705,18 @@ void test_encode_signaling_throttled() "\"signalingFieldsVersion\": 1.1" "}}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ - assert(evel_get_throttle_spec(EVEL_DOMAIN_SIGNALING) != NULL); + assert(evel_get_throttle_spec(EVEL_DOMAIN_SIPSIGNALING) != NULL); assert(post.memory == NULL); size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_SIGNALING * event = NULL; - evel_set_next_event_sequence(2001); - event = evel_new_signaling("vendor_x_id", +// evel_set_next_event_sequence(2001); + event = evel_new_signaling("sipSignal_err", + "sipSignal0000000001", "vendor_x_id", "correlator", "1.0.3.1", "1234", "192.168.1.3","3456"); assert(event != NULL); evel_signaling_vnfmodule_name_set(event, "vendor_x_module"); @@ -3227,7 +3724,7 @@ void test_encode_signaling_throttled() evel_signaling_type_set(event, "Signaling"); evel_signaling_product_id_set(event, "vendor_x_product_id"); evel_signaling_subsystem_id_set(event, "vendor_x_subsystem_id"); - evel_signaling_friendly_name_set(event, "vendor_x_frieldly_name"); +// evel_signaling_friendly_name_set(event, "vendor_x_frieldly_name"); evel_signaling_correlator_set(event, "vendor_x_correlator"); evel_signaling_local_ip_address_set(event, "1.0.3.1"); evel_signaling_local_port_set(event, "1031"); @@ -3243,14 +3740,12 @@ void test_encode_signaling_throttled() evel_free_event(event); evel_throttle_terminate(); } - +***********************/ +/********************** void test_encode_state_change_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -3276,13 +3771,14 @@ void test_encode_state_change_throttled() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"stateChange\", " - "\"eventId\": \"128\", " + "\"eventId\": \"stateChange000000001\", " + "\"eventName\": \"stateChange_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 128, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -3297,23 +3793,19 @@ void test_encode_state_change_throttled() "\"stateChangeFieldsVersion\": 1.1" "}}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_STATE_CHANGE) != NULL); assert(post.memory == NULL); size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_STATE_CHANGE * state_change = NULL; - evel_set_next_event_sequence(128); - state_change = evel_new_state_change(EVEL_ENTITY_STATE_IN_SERVICE, +// evel_set_next_event_sequence(128); + state_change = evel_new_state_change("stateChange_err", + "stateChange000000001", + EVEL_ENTITY_STATE_IN_SERVICE, EVEL_ENTITY_STATE_OUT_OF_SERVICE, "An Interface"); assert(state_change != NULL); @@ -3329,14 +3821,12 @@ void test_encode_state_change_throttled() evel_free_event(state_change); evel_throttle_terminate(); } - +********************/ +/***************** void test_encode_syslog_throttled() { MEMORY_CHUNK post; - /***************************************************************************/ - /* We also test suppression of the event header parameters here. */ - /***************************************************************************/ char * json_command_list = "{" "\"commandList\": [" @@ -3368,13 +3858,14 @@ void test_encode_syslog_throttled() "{\"event\": " "{\"commonEventHeader\": {" "\"domain\": \"syslog\", " - "\"eventId\": \"126\", " + "\"eventId\": \"syslog000000001\", " + "\"eventName\": \"syslog_err\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 126, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2" "}, " @@ -3389,23 +3880,18 @@ void test_encode_syslog_throttled() "]" "}}}"; - /***************************************************************************/ - /* Initialize and provide a specification with a single fault suppressed. */ - /***************************************************************************/ evel_throttle_initialize(); handle_json_response(json_command_list, &post); - /***************************************************************************/ - /* Check that the domain is throttled. */ - /***************************************************************************/ assert(evel_get_throttle_spec(EVEL_DOMAIN_SYSLOG) != NULL); assert(post.memory == NULL); size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; EVENT_SYSLOG * syslog = NULL; - evel_set_next_event_sequence(126); - syslog = evel_new_syslog(EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION, +// evel_set_next_event_sequence(126); + syslog = evel_new_syslog("syslog_err", "syslog000000001", + EVEL_SOURCE_VIRTUAL_NETWORK_FUNCTION, "SL Message", "SL Tag"); assert(syslog != NULL); @@ -3416,8 +3902,8 @@ void test_encode_syslog_throttled() evel_syslog_proc_id_set(syslog, 2); evel_syslog_version_set(syslog, 1); evel_syslog_s_data_set(syslog, "SL SDATA"); - evel_syslog_addl_field_add(syslog, "Name1", "Value1"); - evel_syslog_addl_field_add(syslog, "Name2", "Value2"); + evel_syslog_addl_fields_set(syslog, "Name1", "Value1"); + evel_syslog_addl_fields_set(syslog, "Name2", "Value2"); json_size = evel_json_encode_event( json_body, EVEL_MAX_JSON_BODY, (EVENT_HEADER *) syslog); @@ -3427,20 +3913,22 @@ void test_encode_syslog_throttled() evel_free_event(syslog); evel_throttle_terminate(); } - +**********************/ +/******************** void test_encode_fault_with_escaping() { char * expected = "{\"event\": {" "\"commonEventHeader\": {" "\"domain\": \"fault\", " - "\"eventId\": \"122\", " + "\"eventId\": \"fault000000001\", " + "\"eventName\": \"fault_eNodeB_alarm\", " "\"functionalRole\": \"UNIT TEST\", " "\"lastEpochMicrosec\": 1000002, " "\"priority\": \"Normal\", " - "\"reportingEntityName\": \"Dummy VM name - No Metadata available\", " + "\"reportingEntityName\": \"prakash-VirtualBox\", " "\"sequence\": 122, " - "\"sourceName\": \"Dummy VM name - No Metadata available\", " + "\"sourceName\": \"prakash-VirtualBox\", " "\"startEpochMicrosec\": 1000002, " "\"version\": 1.2, " "\"eventType\": \"Bad things happen...\\\\\", " @@ -3464,8 +3952,10 @@ void test_encode_fault_with_escaping() size_t json_size = 0; char json_body[EVEL_MAX_JSON_BODY]; - evel_set_next_event_sequence(122); - EVENT_FAULT * fault = evel_new_fault("My alarm condition", +// evel_set_next_event_sequence(122); + EVENT_FAULT * fault = evel_new_fault("fault_eNodeB_alarm", + "fault000000001", + "My alarm condition", "It broke \"very\" badly", EVEL_PRIORITY_NORMAL, EVEL_SEVERITY_MAJOR, @@ -3484,3 +3974,4 @@ void test_encode_fault_with_escaping() evel_free_event(fault); } +***********************/ diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java index 9f7e3d3..d7c91b3 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelFault.java @@ -25,6 +25,10 @@ package evel_javalibrary.att.com; import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -74,9 +78,7 @@ public class EvelFault extends EvelHeader { /* Vendor-specific values should be added here, and handled appropriately */
/* in evel_event.c. */
/***************************************************************************/
- EVEL_SOURCE_OLT,
- EVEL_SOURCE_ONT,
- EVEL_SOURCE_ONU,
+
/***************************************************************************/
/* END OF VENDOR-SPECIFIC VALUES */
/***************************************************************************/
@@ -111,8 +113,10 @@ public class EvelFault extends EvelHeader { /***************************************************************************/
EvelOptionString category;
EvelOptionString alarm_interface_a;
- ArrayList<String[]> additional_info;
+ // ArrayList<String[]> additional_info;
+ HashMap<String, String > additional_inf;
+
private static final Logger LOGGER = Logger.getLogger( EvelFault.class.getName() );
/**************************************************************************//**
@@ -155,7 +159,11 @@ public class EvelFault extends EvelHeader { //Init optional fields
category = new EvelOptionString(false, null);
alarm_interface_a = new EvelOptionString(false, null);
- additional_info = null;
+
+
+ additional_inf = null;
+
+
if( severity.equals(EVEL_SEVERITIES.EVEL_SEVERITY_NORMAL))
sequence = 0;
else
@@ -179,7 +187,7 @@ public class EvelFault extends EvelHeader { *****************************************************************************/
public void evel_fault_addl_info_add(String name, String value)
{
- String[] addl_info = null;
+ // String[] addl_info = null;
EVEL_ENTER();
/***************************************************************************/
@@ -189,18 +197,19 @@ public class EvelFault extends EvelHeader { assert(name != null);
assert(value != null);
- if( additional_info == null )
+ if( additional_inf == null )
{
- additional_info = new ArrayList<String[]>();
+ // additional_info = new ArrayList<String[]>();
+ additional_inf = new HashMap<>();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- addl_info = new String[2];
- assert(addl_info != null);
- addl_info[0] = name;
- addl_info[1] = value;
-
- additional_info.add(addl_info);
+ // addl_info = new String[2];
+ // assert(addl_info != null);
+ // addl_info[0] = name;
+ // addl_info[1] = value;
+ additional_inf.put(name, value);
+ // additional_info.add(addl_info);
EVEL_EXIT();
}
@@ -294,7 +303,7 @@ public class EvelFault extends EvelHeader { * @param source_type The source type to convert.
* @returns The equivalent string.
*****************************************************************************/
- static String evel_source_type(EVEL_SOURCE_TYPES source_type)
+ String evel_source_type(EVEL_SOURCE_TYPES source_type)
{
String result;
@@ -342,18 +351,6 @@ public class EvelFault extends EvelHeader { result = "virtualNetworkFunction";
break;
- case EVEL_SOURCE_OLT:
- result = "OLT";
- break;
-
- case EVEL_SOURCE_ONT:
- result = "ONT";
- break;
-
- case EVEL_SOURCE_ONU:
- result = "ONU";
- break;
-
default:
result = null;
LOGGER.error(MessageFormatter.format("Unexpected Event Source Type {0}", source_type));
@@ -465,8 +462,8 @@ public class EvelFault extends EvelHeader { String fault_severity;
String fault_source_type;
String fault_vf_status;
- double version = major_version+(double)minor_version/10;
-
+ // double version = major_version+(double)minor_version/10;
+ String version = "4.0";
EVEL_ENTER();
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_FAULT);
@@ -486,15 +483,18 @@ public class EvelFault extends EvelHeader { /* Optional fields. */
/***************************************************************************/
- if( category.is_set )
- evelfault.add("eventCategory", category.GetValue());
- if( alarm_interface_a.is_set )
- evelfault.add("eventCategory", alarm_interface_a.GetValue());
+ // 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("eventCategory", category.GetValue());
+ evelfault.add("alarmInterfaceA", alarm_interface_a.GetValue());
+
evelfault.add( "eventSeverity", fault_severity);
evelfault.add( "eventSourceType", fault_source_type);
evelfault.add( "specificProblem", specific_problem);
@@ -504,7 +504,7 @@ public class EvelFault extends EvelHeader { /***************************************************************************/
/* Encode additional Name value pairs if any. */
/***************************************************************************/
- if( additional_info != null )
+ /*if( additional_info != null )
{
JsonArrayBuilder builder = Json.createArrayBuilder();
for(int i=0;i<additional_info.size();i++) {
@@ -516,7 +516,26 @@ public class EvelFault extends EvelHeader { }
evelfault.add("alarmAdditionalInformation", builder);
}
+ */
+
+ if(additional_inf != null) {
+ // JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
+ String addl_info_key = add_inf.getKey();
+ String addl_info_value = add_inf.getValue();
+ JsonObject obj1 = Json.createObjectBuilder()
+ .add("name", addl_info_key)
+ .add("value", addl_info_value).build();
+ builder.add(addl_info_key, addl_info_value);
+ }
+ evelfault.add("alarmAdditionalInformation", builder);
+ }
+
+
EVEL_EXIT();
return evelfault;
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java index 918b5d4..2686824 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeader.java @@ -44,6 +44,7 @@ import org.slf4j.helpers.MessageFormatter; public class EvelHeader {
+
/**************************************************************************//**
* Event domains for the various events we support.
* JSON equivalent field: domain
@@ -62,7 +63,10 @@ public class EvelHeader { 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. */
+ EVEL_DOMAIN_NOTIFICATION,
+ EVEL_DOMAIN_PNFREGISTRATION,
+ EVEL_MAX_DOMAINS /** Maximum number of recognized Event types. */
+
}
/**************************************************************************//**
@@ -77,7 +81,7 @@ public class EvelHeader { EVEL_MAX_PRIORITIES
}
- final int EVEL_HEADER_MAJOR_VERSION = 3;
+ final int EVEL_HEADER_MAJOR_VERSION = 4;
final int EVEL_HEADER_MINOR_VERSION = 0;
/***************************************************************************/
/* Version */
@@ -97,6 +101,9 @@ public class EvelHeader { Long start_epoch_microsec = 0L;
Long last_epoch_microsec = 0L;
int sequence = 0;
+
+ //VES 7.0 added 4Sept2108
+ String ves_eventListener_version =null;
/***************************************************************************/
/* Optional fields */
@@ -108,6 +115,12 @@ public class EvelHeader { EvelOptionString nfcnaming_code;
EvelOptionString nfnaming_code;
+
+ //VES 7.0 added 4Sept2108
+ EvelOptionString nfVendor_name;
+ EvelOptionString timeZoneOffset;
+
+
/**************************************************************************//**
* Unique sequence number for events from this VNF.
*****************************************************************************/
@@ -173,13 +186,15 @@ public class EvelHeader { LOGGER.warning("WARNING:not confirming to Common Event Format 28.3 standard");
} else {
event_id = ev_id;
- sequence = 0;
+ sequence = 1000;
}
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";
@@ -238,6 +253,9 @@ public class EvelHeader { major_version = EVEL_HEADER_MAJOR_VERSION;
minor_version = EVEL_HEADER_MINOR_VERSION;
+
+ //VES 7.0 added 4Sept 2018
+ ves_eventListener_version = "7.0.2";
/***************************************************************************/
/* Optional parameters. */
@@ -248,7 +266,10 @@ public class EvelHeader { reporting_entity_id = new EvelOptionString(true, uuid);
source_id = new EvelOptionString(true, uuid);
internal_field = new EvelOptionIntHeader(false, null);
-
+
+ //VES 7.0 added 4Sept2018
+ nfVendor_name = new EvelOptionString(false, null);
+ timeZoneOffset = new EvelOptionString(false, null);
EVEL_EXIT();
}
@@ -397,8 +418,8 @@ public class EvelHeader { nfcnaming_code.SetValue(nfcnam);
EVEL_EXIT();
- }
-
+ }
+
/**************************************************************************//**
* Set the NF Naming code property of the event header.
*
@@ -418,8 +439,79 @@ public class EvelHeader { EVEL_EXIT();
}
+
+ //VES 7.0 added 4Sept2018
+ /**************************************************************************//**
+ * Set the NF Vendor name property of the event header.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param nfVendorName String
+ *****************************************************************************/
+ public void evel_nfVendorName_set(String nfvendor)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ assert(nfvendor != null);
+ nfVendor_name.set_option(true);
+ nfVendor_name.SetValue(nfvendor);
+
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set the NF Vendor name property of the event header.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param nfVendorName String
+ *****************************************************************************/
+ public void evel_timeZoneOffset_set(String timezoneset)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ assert(timezoneset != null);
+ timeZoneOffset.set_option(true);
+ timeZoneOffset.SetValue(timezoneset);
+
+ EVEL_EXIT();
+ }
+
+
+
+ /**************************************************************************//**
+ * Set the Ves Event Listener Version property of the event header.
+ *
+ * @note The Ves Event Listener Version defaults to the OpenStack VM Name.
+ *
+ * @param header Pointer to the ::EVENT_HEADER.
+ * @param vesEventListenerVersion The vesEventListenerVersion to set.
+ *****************************************************************************/
+ public void evel_vesEventListenerVersion_set(String vesEventListVersion)
+ {
+ EVEL_ENTER();
+ /***************************************************************************/
+ /* Check preconditions and assign the new value. */
+ /***************************************************************************/
+ assert(vesEventListVersion != null);
+ /***************************************************************************/
+ /* Free the previously allocated memory and replace it with a copy of the */
+ /* provided one. */
+ /***************************************************************************/
+ ves_eventListener_version = vesEventListVersion;
+
+ EVEL_EXIT();
+ }
+
+
+
/**************************************************************************//**
* Set the Reporting Entity Name property of the event header.
*
@@ -555,7 +647,7 @@ public class EvelHeader { break;
case EVEL_DOMAIN_MEASUREMENT:
- result = "measurementsForVfScaling";
+ result = "measurement";
break;
case EVEL_DOMAIN_REPORT:
@@ -593,7 +685,14 @@ public class EvelHeader { case EVEL_DOMAIN_THRESHOLD_CROSSING:
result = "thresholdCrossingAlert";
break;
-
+ case EVEL_DOMAIN_NOTIFICATION:
+ result="notification";
+ break;
+
+ case EVEL_DOMAIN_PNFREGISTRATION:
+ result="pnfRegistration";
+ break;
+
default:
result = null;
LOGGER.severe(MessageFormat.format("Unexpected domain {0}", domain));
@@ -654,8 +753,8 @@ public class EvelHeader { {
String domain = evel_event_domain(event_domain);
String prity = evel_event_priority(priority);
- double version = major_version+(double)minor_version/10;
-
+ // double version = major_version+(double)minor_version/10;
+ String version = "4.0.2";
EVEL_ENTER();
/***************************************************************************/
@@ -663,6 +762,7 @@ public class EvelHeader { /***************************************************************************/
JsonObjectBuilder commheader = Json.createObjectBuilder()
+ .add("vesEventListenerVersion", ves_eventListener_version)
.add("domain", domain)
.add("eventId", event_id)
.add("eventName", event_name)
@@ -695,6 +795,13 @@ public class EvelHeader { if( nfnaming_code.is_set )
commheader.add("nfNamingCode", nfnaming_code.GetValue());
+ //VES 7.0 added 4Sept2018
+ if( nfVendor_name.is_set )
+ commheader.add("nfNamingCode", nfVendor_name.GetValue());
+ if( timeZoneOffset.is_set )
+ commheader.add("timeZoneOffset", timeZoneOffset.GetValue());
+
+
EVEL_EXIT();
return commheader;
@@ -706,19 +813,32 @@ public class EvelHeader { * Encode the event as a JSON event object according to AT&T's schema.
* retval : String of JSON event header only message
*****************************************************************************/
- JsonObject evel_json_encode_event()
+ JsonObject evel_json_encode_event()
{
JsonObject obj = Json.createObjectBuilder()
- .add("event", Json.createObjectBuilder()
- .add( "commonEventHeader",eventHeaderObject() )
- ).build();
+
+ .add("event", Json.createObjectBuilder())
+ .add( "commonEventHeader",eventHeaderObject() ).build();
EVEL_EXIT();
return obj;
- }
+ }
+
+ JsonObject evel_json_encode_eventNew()
+ {
+
+ JsonObject obj = Json.createObjectBuilder()
+
+ .add( "commonEventHeader",eventHeaderObject() ).build();
+
+ EVEL_EXIT();
+
+ return obj;
+
+ }
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java index f07557d..0a6203f 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelHeartbeatField.java @@ -24,6 +24,10 @@ package evel_javalibrary.att.com; import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -53,7 +57,9 @@ public class EvelHeartbeatField extends EvelHeader { /***************************************************************************/
/* Optional fields */
/***************************************************************************/
- ArrayList<String[]> additional_info;
+ // ArrayList<String[]> additional_info;
+
+ HashMap<String, String > additional_inf;
private static final Logger LOGGER = Logger.getLogger( EvelHeartbeatField.class.getName() );
@@ -70,8 +76,9 @@ public class EvelHeartbeatField extends EvelHeader { assert( interval > 0 );
heartbeat_interval = interval;
+
- additional_info = null;
+ additional_inf = null;
}
/**************************************************************************//**
@@ -90,7 +97,7 @@ public class EvelHeartbeatField extends EvelHeader { *****************************************************************************/
public void evel_hrtbt_field_addl_info_add(String name, String value)
{
- String[] addl_info = null;
+ // String[] addl_info = null;
EVEL_ENTER();
/***************************************************************************/
@@ -100,18 +107,22 @@ public class EvelHeartbeatField extends EvelHeader { assert(name != null);
assert(value != null);
- if( additional_info == null )
+ if( additional_inf == null )
{
- additional_info = new ArrayList<String[]>();
+ // additional_info = new ArrayList<String[]>();
+
+ additional_inf = new HashMap<>();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- addl_info = new String[2];
- assert(addl_info != null);
- addl_info[0] = name;
- addl_info[1] = value;
+ // addl_info = new String[2];
+ // assert(addl_info != null);
+ // addl_info[0] = name;
+ // addl_info[1] = value;
+
+ additional_inf.put(name, value);
- additional_info.add(addl_info);
+ // additional_info.add(addl_info);
EVEL_EXIT();
}
@@ -147,8 +158,8 @@ public class EvelHeartbeatField extends EvelHeader { *****************************************************************************/
JsonObjectBuilder evelHeartbeatFieldObject()
{
- double version = major_version+(double)minor_version/10;
-
+ // double version = major_version+(double)minor_version/10;
+ String version = "3.0";
EVEL_ENTER();
@@ -161,15 +172,15 @@ public class EvelHeartbeatField extends EvelHeader { /* Mandatory fields. */
/***************************************************************************/
- JsonObjectBuilder evelstate = Json.createObjectBuilder()
+ JsonObjectBuilder evelHeatbeat = Json.createObjectBuilder()
.add("heartbeatInterval", heartbeat_interval);
- evelstate.add( "heartbeatFieldsVersion", version);
+ evelHeatbeat.add( "heartbeatFieldsVersion", version);
/***************************************************************************/
/* Checkpoint, so that we can wind back if all fields are suppressed. */
/***************************************************************************/
- if( additional_info != null )
+ /* if( additional_info != null )
{
JsonArrayBuilder builder = Json.createArrayBuilder();
for(int i=0;i<additional_info.size();i++) {
@@ -179,12 +190,28 @@ public class EvelHeartbeatField extends EvelHeader { .add("value", addl_info[1]).build();
builder.add(obj);
}
- evelstate.add("additionalFields", builder);
+ evelHeatbeat.add("additionalFields", builder);
}
-
+ */
+
+ if(additional_inf != null) {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
+ String addl_info_key = add_inf.getKey();
+ String addl_info_value = add_inf.getValue();
+ JsonObject obj1 = Json.createObjectBuilder()
+ .add("name", addl_info_key)
+ .add("value", addl_info_value).build();
+ builder.add(obj1);
+ }
+ evelHeatbeat.add("alarmAdditionalInformation", builder);
+ }
+
EVEL_EXIT();
- return evelstate;
+ return evelHeatbeat;
}
@@ -199,9 +226,10 @@ public class EvelHeartbeatField extends EvelHeader { 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() )
+
+ .add("event", Json.createObjectBuilder()
+ .add( "commonEventHeader",eventHeaderObject())
+ .add( "heartbeatFields",evelHeartbeatFieldObject())
).build();
EVEL_EXIT();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java index 7a01dae..e6b7fd2 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelMobileFlow.java @@ -26,6 +26,7 @@ import java.text.MessageFormat; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.Map;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -148,11 +149,9 @@ public class EvelMobileFlow extends EvelHeader { double avg_packet_delay_variation;
int avg_packet_latency;
int avg_receive_throughput;
- int avg_transmit_throughput;
-
+ int avg_transmit_throughput;
int flow_activation_epoch;
- int flow_activation_microsec;
-
+ int flow_activation_microsec;
int flow_deactivation_epoch;
int flow_deactivation_microsec;
Date flow_deactivation_time;
@@ -200,6 +199,9 @@ public class EvelMobileFlow extends EvelHeader { EvelOptionInt num_gtp_echo_failures;
EvelOptionInt num_gtp_tunnel_errors;
EvelOptionInt num_http_errors;
+
+ Map<String,String> iptos_count_list;
+
/**************************************************************************//**
* Create a new Mobile GTP Per Flow Metrics.
@@ -394,6 +396,10 @@ public class EvelMobileFlow extends EvelHeader { num_gtp_echo_failures = new EvelOptionInt();
num_gtp_tunnel_errors = new EvelOptionInt();
num_http_errors = new EvelOptionInt();
+
+
+
+ iptos_count_list = null;
EVEL_EXIT();
}
@@ -414,7 +420,11 @@ public class EvelMobileFlow extends EvelHeader { /***************************************************************************/
/* Optional fields */
/***************************************************************************/
- ArrayList<String[]> additional_info;
+ //ArrayList<String[]> ipTosList;
+ Map<String,String> additional_inf;
+
+ Map<String,String> hashMap;
+
EvelOptionString application_type;
EvelOptionString app_protocol_type;
EvelOptionString app_protocol_version;
@@ -538,8 +548,9 @@ public class EvelMobileFlow extends EvelHeader { tac = new EvelOptionString();
tunnel_id = new EvelOptionString();
vlan_id = new EvelOptionString();
- additional_info = null;
-
+ additional_inf = null;
+ hashMap = null;
+
EVEL_EXIT();
}
@@ -562,7 +573,7 @@ public class EvelMobileFlow extends EvelHeader { *****************************************************************************/
public void evel_mobile_flow_addl_field_add(String name, String value)
{
- String[] addl_info = null;
+ // String[] addl_info = null;
EVEL_ENTER();
/***************************************************************************/
@@ -572,18 +583,18 @@ public class EvelMobileFlow extends EvelHeader { assert(name != null);
assert(value != null);
- if( additional_info == null )
+ if( additional_inf == null )
{
- additional_info = new ArrayList<String[]>();
+ additional_inf = new HashMap<String,String>();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- addl_info = new String[2];
- assert(addl_info != null);
- addl_info[0] = name;
- addl_info[1] = value;
+ // addl_info = new String[2];
+ // assert(addl_info != null);
+ // addl_info[0] = name;
+ // addl_info[1] = value;
- additional_info.add(addl_info);
+ additional_inf.put(name, value);
EVEL_EXIT();
}
@@ -1750,7 +1761,34 @@ public class EvelMobileFlow extends EvelHeader { "QCI COS");
EVEL_EXIT();
}
+
+
+ public void evel_mobileFlow_hashMap_add(String name, String value)
+ {
+
+ EVEL_ENTER();
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING);
+ assert(name != null);
+ assert(value != null);
+
+ if( hashMap == null )
+ {
+
+ hashMap = new HashMap<String,String>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ hashMap.put(name, value);
+
+
+ EVEL_EXIT();
+ }
+
+
/**************************************************************************//**
* Encode the GTP Per Flow Object in JSON according to AT&T's schema.
@@ -1825,20 +1863,28 @@ public class EvelMobileFlow extends EvelHeader { if (found_ip_tos)
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ // JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonArrayBuilder builderIpTosList = 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);
+// JsonObjectBuilder obj2 = Json.createObjectBuilder()
+// .add(Integer.toString(index), metrics.ip_tos_counts[index].value);
+ builder.add(Integer.toString(index)+"", metrics.ip_tos_counts[index].value+"");
+ //srikant add String to IpTosList
+ builderIpTosList.add( index+"" );
}
}
obj.add("ipTosCountList", builder);
+ obj.add("ipTosList", builderIpTosList);
+
+
}
-
+
+
/***************************************************************************/
/* 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. */
@@ -1853,7 +1899,9 @@ public class EvelMobileFlow extends EvelHeader { break;
}
}
-
+
+
+ JsonArrayBuilder builderTcpFlagList = Json.createArrayBuilder();
if (found_tcp_flag)
{
JsonArrayBuilder builder = Json.createArrayBuilder();
@@ -1862,26 +1910,29 @@ public class EvelMobileFlow extends EvelHeader { if (metrics.tcp_flag_counts[index].is_set)
{
JsonObjectBuilder obj2 = Json.createObjectBuilder()
- .add(Integer.toString(index), evel_tcp_flag_strings[index]);
+ .add(Integer.toString(index)+"", evel_tcp_flag_strings[index]+"");
builder.add(obj2);
}
}
- obj.add("tcpFlagList", builder);
+ // obj.add("tcpFlagList", builder);
}
if (found_tcp_flag)
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ // 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);
+// JsonObjectBuilder obj2 = Json.createObjectBuilder()
+// .add(evel_tcp_flag_strings[index], metrics.tcp_flag_counts[index].value);
+ builder.add(evel_tcp_flag_strings[index]+"", metrics.tcp_flag_counts[index].value+"");
+ builderTcpFlagList.add(evel_tcp_flag_strings[index]+"");
}
}
obj.add("tcpFlagCountList", builder);
+ obj.add("tcpFlagList", builderTcpFlagList);
}
/***************************************************************************/
@@ -1900,35 +1951,48 @@ public class EvelMobileFlow extends EvelHeader { }
}
+ JsonArrayBuilder builderQciCosList = Json.createArrayBuilder();
if (found_qci_cos)
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ // JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
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);
+// JsonObjectBuilder obj2 = Json.createObjectBuilder()
+// .add(Integer.toString(index), evel_qci_cos_strings[index]);
+ builder.add(Integer.toString(index)+"", evel_qci_cos_strings[index]+"");
+
}
}
- obj.add("mobileQciCosList", builder);
+ // obj.add("mobileQciCosList", builder);
}
+
+
+
if (found_qci_cos)
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ //JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
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);
+// JsonObjectBuilder obj2 = Json.createObjectBuilder()
+// .add(evel_qci_cos_strings[index], metrics.qci_cos_counts[index].value);
+ builder.add(evel_qci_cos_strings[index]+"", metrics.qci_cos_counts[index].value+"");
+ builderQciCosList.add(evel_qci_cos_strings[index]+"");
}
}
obj.add("mobileQciCosCountList", builder);
+ obj.add("mobileQciCosList", builderQciCosList);
}
+
+
+
+
metrics.dur_connection_failed_status.encJsonValue(obj, "durConnectionFailedStatus");
metrics.dur_tunnel_failed_status.encJsonValue(obj, "durTunnelFailedStatus");
@@ -1945,7 +2009,13 @@ public class EvelMobileFlow extends EvelHeader { metrics.num_gtp_tunnel_errors.encJsonValue(obj, "numGtpTunnelErrors");
metrics.num_http_errors.encJsonValue(obj, "numHttpErrors");
- return obj;
+
+
+
+
+ return obj;
+
+
}
@@ -1958,8 +2028,8 @@ public class EvelMobileFlow extends EvelHeader { JsonObjectBuilder evelMobileFlowObject()
{
- double version = major_version+(double)minor_version/10;
-
+ // double version = major_version+(double)minor_version/10;
+ String version = "4.0";
EVEL_ENTER();
/***************************************************************************/
@@ -1982,25 +2052,29 @@ public class EvelMobileFlow extends EvelHeader { //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 fields. */
+ /***************************************************************************/
+ // additional fields
+ if( additional_inf != null )
+ {
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ // JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(Map.Entry<String, String> entry : additional_inf.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(entry.getKey(), entry.getValue());
+ }
+ //eveloth.add("nameValuePairs", builder);
+ evelmf.add("additionalFields", builder);
+ }
/***************************************************************************/
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java new file mode 100644 index 0000000..3c2150c --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelNotification.java @@ -0,0 +1,511 @@ +package evel_javalibrary.att.com; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.file.Files; + +/**************************************************************************//** + * @file + * Evel Fault Event class extends EvelHeader class + * + * This file implements the Evel Fault Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send Fault events. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + + + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.json.Json; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; + +import org.apache.log4j.Logger; + +public class EvelNotification extends EvelHeader { + int major_version = 1; + int minor_version = 0; + + /***************************************************************************/ + /* Mandatory fields */ + /***************************************************************************/ + String changeType = null; + String changeIdentifier; + //ArrayList<String[]> additional_info; + HashMap<String, String > additional_inf; + + + /***************************************************************************/ + /* Optional fields */ + /***************************************************************************/ + + EvelOptionString newState; + EvelOptionString oldState; + EvelOptionString changeContact; + EvelOptionString stateInterface; + + + ArrayList<javax.json.JsonObject> additional_objects; + Map<String,Map<String,String>> evelmap; + + private static final Logger LOGGER = Logger.getLogger( EvelNotification.class.getName() ); + + public EvelNotification(String eventname, String ev_id, String change_identifier, String change_type) { + super(eventname, ev_id); + // TODO Auto-generated constructor stub + event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION; + changeType = change_type; + newState = new EvelOptionString(); + oldState = new EvelOptionString(); + changeContact = new EvelOptionString(); + stateInterface = new EvelOptionString(); + changeIdentifier = change_identifier; + + + //additional_info=null; + additional_inf =null; + + additional_objects = null; + evelmap = null; + } + + /**************************************************************************//** + * Set the Event Type property of the Notification. + * + * @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_notification_type_set(String typ) + { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions and call evel_header_type_set. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + evel_header_type_set(typ); + + EVEL_EXIT(); + } + + +// public void evel_notification_addl_info_add(String name, String value) +// { +// String[] addl_info = null; +// EVEL_ENTER(); +// +// /***************************************************************************/ +// /* Check preconditions. */ +// /***************************************************************************/ +// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); +// assert(name != null); +// assert(value != null); +// +// if( additional_info == null ) +// { +// additional_info = new ArrayList<String[]>(); +// additional_inf = new HashMap<>(); +// } +// +// LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value)); +// addl_info = new String[2]; +// assert(addl_info != null); +// addl_info[0] = name; +// addl_info[1] = value; +// additional_inf.put(name, value); +// +// additional_info.add(addl_info); +// +// EVEL_EXIT(); +// } + + + /**************************************************************************//** + * Adds name value pair under hash key + * + * + * @param hashname String Hash name. + * @param name String Name. + * @param value String Value. + *****************************************************************************/ + public void evel_notification_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); + + Map<String,String> mymap = null; + + try{ + + if( evelmap == null) + evelmap = new HashMap<String,Map<String,String>>(); + + if( evelmap.containsKey(hashname) ) + { + mymap = evelmap.get(hashname); + } + else + { + mymap = new HashMap<String,String>(); + evelmap.put(hashname, mymap); + LOGGER.debug("Inserted map hash : "+hashname+" name="+name); + } + + if( mymap.containsKey(name) ) + { + String val = mymap.get(name); + LOGGER.error("Error already contains key " + name + "val "+val ); + } + else + { + mymap.put(name, value); + LOGGER.debug("Adding hash : "+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(); + } + + + + + + public void evel_notification_addl_info_add(String name, String value) + { + //String[] addl_info = null; + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + assert(name != null); + assert(value != null); + + if( additional_inf == null ) + { + // additional_info = new ArrayList<String[]>(); + additional_inf = new HashMap<>(); + } + + LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value)); + //addl_info = new String[2]; + //assert(addl_inf != null); + //addl_info[0] = name; + //addl_info[1] = value; + additional_inf.put(name, value); + + // additional_info.add(addl_info); + + EVEL_EXIT(); + } + + + +// public void evel_notification_add_changeType_set(String changeTyp) { +// EVEL_ENTER(); +// +// /***************************************************************************/ +// /* Check preconditions. */ +// /***************************************************************************/ +// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); +// assert(changeTyp != null); +// +// changeType.SetValuePr( +// changeTyp, +// "notification ChangeType String"); +// +// EVEL_EXIT(); +// } + public void evel_notification_add_newState_set(String newStat ){ + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + assert(newStat != null); + + newState.SetValuePr( + newStat, + "notification newState String"); + + EVEL_EXIT(); + } + public void evel_notification_add_oldState_set(String oldStat) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + assert(oldStat != null); + + oldState.SetValuePr( + oldStat, + "notification OldState String"); + + EVEL_EXIT(); + } + public void evel_notification_add_changeContact_set(String changeCont) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + assert(changeCont != null); + + changeContact.SetValuePr( + changeCont, + "notification ChangeContact String"); + + EVEL_EXIT(); + } + public void evel_notification_add_stateInterface_set(String statInter) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + assert(statInter != null); + + stateInterface.SetValuePr( + statInter, + "notification StateInterface String"); + + EVEL_EXIT(); + } +// public void evel_notification_add_changeIdentifier_set(double changeId) { +// EVEL_ENTER(); +// +// /***************************************************************************/ +// /* Check preconditions. */ +// /***************************************************************************/ +// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); +// assert(changeId > 0.0); +// +// changeIdentifier.SetValuePr( +// changeId, +// "notification ChangeIdentifier Integer"); +// +// EVEL_EXIT(); +// } +// public void evel_notification_add_notificationsFieldVersion_set(int stateChangeFieldsVer) { +// EVEL_ENTER(); +// +// /***************************************************************************/ +// /* Check preconditions. */ +// /***************************************************************************/ +// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); +// assert(stateChangeFieldsVer > 0); +// +// notificationsFieldVersion.SetValuePr( +// stateChangeFieldsVer, +// "notification notificationsFieldVersion Int"); +// +// EVEL_EXIT(); +// } +// + /**************************************************************************//** + * Encode the Syslog in JSON according to AT&T's schema. + * + *****************************************************************************/ + JsonObjectBuilder evelNotificationObject() + { + //String evt_source_type; + //double version = major_version+(double)minor_version/10; + String version = "2.0"; + EVEL_ENTER(); + + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + + /***************************************************************************/ + /* Mandatory fields */ + /***************************************************************************/ + JsonObjectBuilder obj = Json.createObjectBuilder() + .add("changeIdentifier", changeIdentifier) + .add("changeType", changeType) + .add("notificationFieldsVersion",version); + + + + /***************************************************************************/ + /* Optional fields */ + /***************************************************************************/ + newState.encJsonValue(obj, "newState"); + oldState.encJsonValue(obj,"oldState"); + changeContact.encJsonValue(obj,"changeContact"); + stateInterface.encJsonValue(obj, "syslogProc"); + // 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 obj1 = Json.createObjectBuilder() +// .add("name", addl_info[0]) +// .add("value", addl_info[1]).build(); +// builder.add(obj1); +// } +// obj.add("additionalFields", builder); +// } + + + if(additional_inf != null) { + JsonObjectBuilder builder = Json.createObjectBuilder(); + // JsonArrayBuilder builder = Json.createArrayBuilder(); + Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator(); + while(it.hasNext()) { + Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next(); + String addl_info_key = add_inf.getKey(); + String addl_info_value = add_inf.getValue(); +// JsonObject obj1 = Json.createObjectBuilder() +// .add("name", addl_info_key) +// .add("value", addl_info_value).build(); + builder.add(addl_info_key, addl_info_value); + } + obj.add("additionalFields", 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); + } + obj.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(); + + JsonObjectBuilder obj1 = Json.createObjectBuilder() + .add( "name", entry.getKey()); + // JsonArrayBuilder builder2 = Json.createArrayBuilder(); + JsonObjectBuilder builder2 = Json.createObjectBuilder(); + for(Map.Entry<String, String> entry2 : item.entrySet()){ + LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry2.getKey(), entry2.getValue())); +// JsonObjectBuilder obj2 = Json.createObjectBuilder() +// .add("name", entry2.getKey()) +// .add("value",entry2.getValue()); + builder2.add(entry2.getKey(), entry2.getValue()); + } + + obj1.add("hashMap", builder2); + builder.add(obj1.build()); + } + obj.add("arrayOfNamedHashMap", builder); + } + + + + + + + + + EVEL_EXIT(); + + return obj; + } + + + JsonObject evel_json_encode_event() + { + EVEL_ENTER(); + + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_NOTIFICATION); + + JsonObject obj = Json.createObjectBuilder() + .add("event", Json.createObjectBuilder() + .add( "commonEventHeader",eventHeaderObject() ) + .add( "notificationFields", evelNotificationObject() ) + ).build(); + + EVEL_EXIT(); + + return obj; + + } + +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java index 31385ed..1f97625 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelOther.java @@ -51,6 +51,9 @@ public class EvelOther extends EvelHeader { /* Optional fields */
/***************************************************************************/
Map<String,String> additional_info;
+
+
+
Map<String,Map<String,String>> evelmap;
@@ -228,7 +231,7 @@ public class EvelOther extends EvelHeader { LOGGER.debug("Adding name="+name+" value="+value);
if(additional_info == null)
- additional_info = new HashMap<String,String>();
+ additional_info = new HashMap<String, String>();
if(additional_info.containsKey(name))
LOGGER.error("Already exists Unable to add map : name="+name+"value= "+value);
@@ -247,8 +250,8 @@ public class EvelOther extends EvelHeader { JsonObjectBuilder evelOtherObject()
{
- double version = major_version+(double)minor_version/10;
-
+ //double version = major_version+(double)minor_version/10;
+ String version = "3.0";
EVEL_ENTER();
/***************************************************************************/
@@ -272,15 +275,17 @@ public class EvelOther extends EvelHeader { // additional fields
if( additional_info != null )
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ // JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
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);
+// JsonObject obj = Json.createObjectBuilder()
+// .add("name", entry.getKey())
+// .add("value",entry.getValue()).build();
+ builder.add(entry.getKey(), entry.getValue());
}
- eveloth.add("nameValuePairs", builder);
+ //eveloth.add("nameValuePairs", builder);
+ eveloth.add("hashMap", builder);
}
if( additional_objects != null && additional_objects.size() > 0 )
@@ -302,19 +307,20 @@ public class EvelOther extends EvelHeader { JsonObjectBuilder obj = Json.createObjectBuilder()
.add( "name", entry.getKey());
- JsonArrayBuilder builder2 = Json.createArrayBuilder();
+ // JsonArrayBuilder builder2 = Json.createArrayBuilder();
+ JsonObjectBuilder builder2 = Json.createObjectBuilder();
for(Map.Entry<String, String> entry2 : item.entrySet()){
LOGGER.debug(MessageFormat.format("Key : {0} and Value: {1}", entry2.getKey(), entry2.getValue()));
- JsonObjectBuilder obj2 = Json.createObjectBuilder()
- .add("name", entry2.getKey())
- .add("value",entry2.getValue());
- builder2.add(obj2.build());
+// JsonObjectBuilder obj2 = Json.createObjectBuilder()
+// .add("name", entry2.getKey())
+// .add("value",entry2.getValue());
+ builder2.add(entry2.getKey(), entry2.getValue());
}
- obj.add("arrayOfFields", builder2);
+ obj.add("hashMap", builder2);
builder.add(obj.build());
}
- eveloth.add("hashOfNameValuePairArrays", builder);
+ eveloth.add("arrayOfNamedHashMap", builder);
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java new file mode 100644 index 0000000..ee0ab6b --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelPnfRegistration.java @@ -0,0 +1,393 @@ +package evel_javalibrary.att.com; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +import javax.json.Json; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; + +import org.apache.log4j.Logger; + +/**************************************************************************//** + * @file + * Evel Fault Event class extends EvelHeader class + * + * This file implements the Evel Fault Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send Fault events. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +public class EvelPnfRegistration extends EvelHeader{ + + int major_version = 1; + int minor_version = 0; + + /***************************************************************************/ + /* Mandatory fields */ + /***************************************************************************/ + EvelOptionString pnfRegistrationFieldsVersion; + + + /***************************************************************************/ + /* Optional fields */ + /***************************************************************************/ + + EvelOptionString lastServiceDate; + EvelOptionString macAddress; + EvelOptionString manufactureDate; + EvelOptionString modelNumber; + EvelOptionString oamV4IpAddress; + EvelOptionString oamV6IpAddress; +// EvelOptionDouble pnfRegistrationFieldsVersion; + EvelOptionString serialNumber; + EvelOptionString softwareVersion; + EvelOptionString unitFamily; + EvelOptionString unitType; + EvelOptionString vendorName; + + //ArrayList<String[]> additional_info; + HashMap<String, String > additional_inf; + + private static final Logger LOGGER = Logger.getLogger( EvelNotification.class.getName() ); + + public EvelPnfRegistration(String eventname, String ev_id) { + super(eventname, ev_id); + // TODO Auto-generated constructor stub + + event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION; + lastServiceDate = new EvelOptionString(); + macAddress = new EvelOptionString(); + manufactureDate = new EvelOptionString(); + modelNumber = new EvelOptionString(); + oamV4IpAddress = new EvelOptionString(); + oamV6IpAddress =new EvelOptionString(); + pnfRegistrationFieldsVersion = new EvelOptionString(); + + serialNumber = new EvelOptionString(); + softwareVersion = new EvelOptionString(); + unitFamily = new EvelOptionString(); + unitType =new EvelOptionString(); + vendorName =new EvelOptionString(); + + + additional_inf=null; + + + } + + public void evel_pnrregistration_addl_info_add(String name, String value) + { + // String[] addl_info = null; + + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(name != null); + assert(value != null); + + if( additional_inf == null ) + { + additional_inf = new HashMap<>(); + } + + LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value)); + + additional_inf.put(name, value); + + + + EVEL_EXIT(); + } + + public void evel_pnrregistration_add_lastServiceDate_set(String lastSerDate) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(lastSerDate != null); + + lastServiceDate.SetValuePr( + lastSerDate, + "pnr registration last service date String"); + + EVEL_EXIT(); + } + + public void evel_pnrregistration_add_macaddress_set(String macAdddr) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(macAdddr != null); + + macAddress.SetValuePr( + macAdddr, + "MAC address of OAM interface of the unit"); + + EVEL_EXIT(); + } + + public void evel_pnrregistration_add_manufactureDate_set(String manufacDate) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(manufacDate != null); + + manufactureDate.SetValuePr( + manufacDate, + "pnr registration manufacture date String"); + + EVEL_EXIT(); + } + + public void evel_pnrregistration_add_modelNumber_set(String modelNum) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(modelNum != null); + + modelNumber.SetValuePr( + modelNum, + "pnr registration model number String"); + + EVEL_EXIT(); + } + + public void evel_pnrregistration_add_oamV4IpAddress_set(String oamv4ipAddr) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(oamv4ipAddr != null); + + oamV4IpAddress.SetValuePr( + oamv4ipAddr, + "pnr registration oamv4ipaddress String"); + + EVEL_EXIT(); + } + + public void evel_pnrregistration_add_oamV6IpAddress_set(String oamv6ipAddr) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(oamv6ipAddr != null); + + oamV6IpAddress.SetValuePr( + oamv6ipAddr, + "pnr registration oamv6ipaddress String"); + + EVEL_EXIT(); + } + + public void evel_pnfRegistrationFieldsVersion_set(String feildVersion) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(feildVersion != null); + + pnfRegistrationFieldsVersion.SetValuePr( + feildVersion, + "Version of the registrationFields block"); + + EVEL_EXIT(); + } + + + public void evel_pnfRegistration_serialNumber_set(String srNo) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(srNo != null); + + serialNumber.SetValuePr( + srNo, + "serial number of the unit"); + + EVEL_EXIT(); + } + public void evel_pnfRegistration_softwareVersion_set(String softwareVers) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(softwareVers != null); + + softwareVersion.SetValuePr( + softwareVers, + "active SW running on the unit"); + + EVEL_EXIT(); + } + public void evel_pnfRegistration_unitFamily_set(String unitFamily) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(unitFamily != null); + + this.unitFamily.SetValuePr( + unitFamily, + "vendor Unit Family Type "); + + EVEL_EXIT(); + } + public void evel_pnfRegistration_unitType_set(String unitType) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(unitType != null); + + this.unitType.SetValuePr( + unitType, + "vendor Unit Family Type "); + + EVEL_EXIT(); + } + public void evel_pnfRegistration_vendorName_set(String vendorName) { + EVEL_ENTER(); + + /***************************************************************************/ + /* Check preconditions. */ + /***************************************************************************/ + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + assert(vendorName != null); + + this.vendorName.SetValuePr( + vendorName, + "name of manufacturer"); + + EVEL_EXIT(); + } + + JsonObjectBuilder evelPnfRegistrationObject() + { + //String evt_source_type; + //double version = major_version+(double)minor_version/10; + String version = "2.0"; + EVEL_ENTER(); + + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + + /***************************************************************************/ + /* Mandatory fields */ + /***************************************************************************/ + JsonObjectBuilder obj = Json.createObjectBuilder(); + // .add("pnfRegistrationFieldsVersion", version); + //pnfRegistrationFieldsVersion.encJsonValue(obj, version); + /***************************************************************************/ + /* Optional fields */ + /***************************************************************************/ + serialNumber.encJsonValue(obj, "serialNumber"); + modelNumber.encJsonValue(obj, "modelNumber"); + lastServiceDate.encJsonValue(obj,"lastServiceDate"); + macAddress.encJsonValue(obj,"macAddress"); + manufactureDate.encJsonValue(obj, "manufactureDate"); + oamV4IpAddress.encJsonValue(obj, "oamV4IpAddress"); + oamV6IpAddress.encJsonValue(obj, "oamV6IpAddress"); + // pnfRegistrationFieldsVersion.encJsonValue(obj, "pnfRegistrationFieldsVersion"); + // serialNumber.encJsonValue(obj, "serialNumber"); + softwareVersion.encJsonValue(obj, "softwareVersion"); + unitFamily.encJsonValue(obj, "unitFamily"); + unitType.encJsonValue(obj, "unitType"); + vendorName.encJsonValue(obj, "vendorName"); + obj.add("pnfRegistrationFieldsVersion", version); + + + if(additional_inf != null) { + // JsonArrayBuilder builder = Json.createArrayBuilder(); + JsonObjectBuilder builder = Json.createObjectBuilder(); + Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator(); + while(it.hasNext()) { + Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next(); + String addl_info_key = add_inf.getKey(); + String addl_info_value = add_inf.getValue(); +// JsonObject obj1 = Json.createObjectBuilder() +// .add("name", addl_info_key) +// .add("value", addl_info_value).build(); + builder.add(addl_info_key, addl_info_value); + } + obj.add("additionalFields", builder); + } + + + + EVEL_EXIT(); + + return obj; + } + + /**************************************************************************//** + * Encode the event as a JSON event object according to AT&T's schema. + * retval : String of JSON event message + *****************************************************************************/ + JsonObject evel_json_encode_event() + { + assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_PNFREGISTRATION); + //encode common event header and body + JsonObject obj = Json.createObjectBuilder() + .add("event", Json.createObjectBuilder() + .add( "commonEventHeader",eventHeaderObject() ) + .add( "pnfRegistrationFields",evelPnfRegistrationObject() ) + ).build(); + + EVEL_EXIT(); + + return obj; + + } + + + +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java index 669a6ca..52bed2e 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java @@ -22,8 +22,13 @@ package evel_javalibrary.att.com; * limitations under the License.
*****************************************************************************/
+import java.awt.im.spi.InputMethod;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -33,12 +38,90 @@ import javax.json.JsonObjectBuilder; import org.apache.log4j.Logger;
import org.slf4j.helpers.MessageFormatter;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMIHSBP;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMINIC;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMIbaseboardTemperature;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMIbaseboardvoltageResulator;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMIbattery;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMIfan;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMIglobalAggregateTemperatureMargin;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.IPMIpowerSupply;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.MEASUREMENT_IPMI_PROCESSOR;
+import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.MEASUREMENT_IPMI_PROCESSOR.Processor_DIMMaggregate_Thermal_Margin;
+
public class EvelScalingMeasurement extends EvelHeader {
- int major_version = 2;
+ int major_version = 4;
int minor_version = 0;
+ /*
+ * VES6.0 Added Fields 14/07/2018
+ */
+
+
+
+ /*****************************************************************************
+ * MachineCheck Exception
+ * JSON equivalent field: machineCheckException
+ ******************************************************************************/
+ public class MACHINE_CHECK_EXCEPTION{
+ /**
+ *
+ */
+ // private static final long serialVersionUID = 1L;
+ String processIdentifier;
+ EvelOptionDouble correctedMemoryErrors;
+ EvelOptionDouble correctedMemoryErrors_In1Hr;
+ EvelOptionDouble uncorrectedMemoryErrors;
+ EvelOptionDouble uncorrectedMemoryErrors_In1Hr;
+
+
+ }
+
+ /**************************************************************************//**
+ * Huge Pages.
+ * JSON equivalent field: hugePages
+ *****************************************************************************/
+ public class MEASUREMENT_HUGE_PAGE {
+ String hugePagesIdentifier;
+ double bytesUsed;
+ public EvelOptionDouble bytesFree;
+ public EvelOptionDouble vmPageNumberUsed;
+ public EvelOptionDouble vmPageNumberFree;
+ public EvelOptionDouble percentUsed;
+ public EvelOptionDouble percentFree;
+
+ }
+
+ /**************************************************************************//**
+ * Process Stats.
+ * JSON equivalent field: processStats
+ *****************************************************************************/
+ public class MEASUREMENT_PROCESS_STATS {
+ String processIdentifier;
+ public EvelOptionDouble forkRate;
+ public EvelOptionDouble psStateBlocked;
+ public EvelOptionDouble psStatePaging;
+ public EvelOptionDouble psStateRunning;
+ public EvelOptionDouble psStateSleeping;
+ public EvelOptionDouble psStateStopped;
+ public EvelOptionDouble psStateZombie;
+
+ }
+
+ /**************************************************************************//**
+ * Load.
+ * JSON equivalent field: load
+ *****************************************************************************/
+ public class MEASUREMENT_LOAD {
+// String loadIdentifier;
+ public EvelOptionDouble shortTerm;
+ public EvelOptionDouble midTerm;
+ public EvelOptionDouble longTerm;
+
+ }
+
/**************************************************************************//**
* CPU Usage.
* JSON equivalent field: cpuUsage
@@ -54,6 +137,16 @@ public class EvelScalingMeasurement extends EvelHeader { public EvelOptionDouble sys;
public EvelOptionDouble user;
public EvelOptionDouble wait;
+ /*
+ * Ves6.0 added fields 14/07/2018
+ */
+ private EvelOptionDouble cpuCapacityContention;
+ public EvelOptionDouble cpuDemandAvg;
+ public EvelOptionDouble cpuDemandMhz;
+ public EvelOptionDouble cpuDemandPct;
+ public EvelOptionDouble cpuLatencyAvg;
+ public EvelOptionDouble cpuOverheadAvg;
+ public EvelOptionDouble cpuSwapWaitTime;
}
@@ -103,7 +196,26 @@ public class EvelScalingMeasurement extends EvelHeader { public EvelOptionDouble timewritelast;
public EvelOptionDouble timewritemax;
public EvelOptionDouble timewritemin;
-
+ /*
+ * VES6.0 Added fields 14/07/2018
+ */
+ public EvelOptionDouble diskBusResets;
+ public EvelOptionDouble diskCommandsAborted;
+ public EvelOptionDouble diskTime;
+ public EvelOptionDouble diskFlushRequests;
+ public EvelOptionDouble diskFlushTime;
+ public EvelOptionDouble diskCommandsAvg;
+ public EvelOptionDouble diskReadCommandsAvg;
+ public EvelOptionDouble diskWriteCommandsAvg;
+ public EvelOptionDouble diskTotalReadLatencyAvg;
+ public EvelOptionDouble diskTotalWriteLatencyAvg;
+
+ public EvelOptionDouble diskWeightedIoTimeAvg;
+ public EvelOptionDouble diskWeightedIoTimeLast;
+ public EvelOptionDouble diskWeightedIoTimeMax;
+ public EvelOptionDouble diskWeightedIoTimeMin;
+
+
}
/**************************************************************************//**
@@ -134,6 +246,19 @@ public class EvelScalingMeasurement extends EvelHeader { public EvelOptionDouble slabrecl;
public EvelOptionDouble slabunrecl;
public EvelOptionDouble memused;
+
+
+ /*
+ * VES6.0 Added fields 14/07/2018
+ */
+ public EvelOptionDouble memoryDemand;
+ public EvelOptionDouble memoryLatencyAvg;
+ public EvelOptionDouble memorySwapUsedAvg;
+ public EvelOptionDouble memorySwapOutAvg;
+ public EvelOptionDouble memorySwapInAvg;
+ public EvelOptionDouble memorySwapInRateAvg;
+ public EvelOptionDouble memorySwapOutRateAvg;
+ public EvelOptionDouble memorySharedAvg;
}
/**************************************************************************//**
@@ -166,7 +291,7 @@ public class EvelScalingMeasurement extends EvelHeader { * Virtual NIC usage.
* JSON equivalent field: vNicUsage
*****************************************************************************/
- public class MEASUREMENT_VNIC_PERFORMANCE {
+ public class MEASUREMENT_NIC_PERFORMANCE {
String vnic_id;
String valuesaresuspect;
/***************************************************************************/
@@ -242,6 +367,23 @@ public class EvelScalingMeasurement extends EvelHeader { public EvelOptionDouble tx_ucast_packets_acc;
/*Count of transmit unicast packets within the measurement interval*/
public EvelOptionDouble tx_ucast_packets_delta;
+
+ /*VES6.0 added field 14July*/
+ String nicIdentifier;
+
+ /*
+ * VES6.0 added field 19July
+ */
+ public EvelOptionDouble administrativeState;
+ public EvelOptionDouble operationalState;
+ public EvelOptionDouble receivedPercentDiscard;
+ public EvelOptionDouble receivedPercentError;
+ public EvelOptionDouble receivedUtilization;
+ public EvelOptionString speed;
+ public EvelOptionDouble transmittedPercentDiscard;
+ public EvelOptionDouble transmittedPercentError;
+ public EvelOptionDouble transmittedUtilization;
+
}
/**************************************************************************//**
@@ -280,6 +422,877 @@ public class EvelScalingMeasurement extends EvelHeader { String name;
ArrayList<CUSTOM_MEASUREMENT> measurements;
}
+
+
+
+
+
+
+
+ /*
+ * VES6.0 added fields 14July
+ */
+
+ /**************************************************************************//**
+ * IPMI.
+ * JSON equivalent field: Ipmi
+ *****************************************************************************/
+ public class MEASUREMENT_IPMI {
+
+ /***************************************************************************/
+ /* Optional fields */
+ /***************************************************************************/
+ public EvelOptionDouble exitAirTemperature;
+ public EvelOptionDouble ioModuleTemperature;
+ public EvelOptionDouble frontPanelTemperature;
+ public EvelOptionDouble systemAirflow;
+
+ ArrayList<MEASUREMENT_IPMI_PROCESSOR> ipmiprocessor;
+
+ public class MEASUREMENT_IPMI_PROCESSOR {
+ public String processorIdentifier;
+ public EvelOptionDouble processorThermalControlPercent;
+ public EvelOptionDouble processorDTSthermalMargin;
+
+ ArrayList<Processor_DIMMaggregate_Thermal_Margin> processorDIMMaggregateThermalMargin;
+
+ public class Processor_DIMMaggregate_Thermal_Margin {
+ public String processorDIMMaggregateThermalMarginIdentifier;
+ public double processorDIMMaggregateThermalMargin;
+
+
+ }
+
+ public void evel_measurement_IPMI_ProcessorDIMMaggregateThermalMargin_add(
+ String thermalMarginIdentifier,
+ double thermalMargin)
+ {
+ Processor_DIMMaggregate_Thermal_Margin pp = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(thermalMarginIdentifier != null);
+ assert(thermalMargin > 0.0);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding ThermalMarginIdentifier={0} Use={1}", thermalMarginIdentifier, thermalMargin));
+ pp = new Processor_DIMMaggregate_Thermal_Margin();
+ assert(pp != null);
+ pp.processorDIMMaggregateThermalMarginIdentifier = thermalMarginIdentifier;
+ assert(pp.processorDIMMaggregateThermalMargin >= 0.0);
+ pp.processorDIMMaggregateThermalMargin = thermalMargin;
+
+ if( processorDIMMaggregateThermalMargin == null ){
+ processorDIMMaggregateThermalMargin = new ArrayList<Processor_DIMMaggregate_Thermal_Margin>();
+ LOGGER.debug("Allocate new ProcessorDIMMaggregateThermalMargin");
+ }
+
+ processorDIMMaggregateThermalMargin.add(pp);
+
+ EVEL_EXIT();
+ }
+
+
+ }
+ public void evel_measurement_IPMI_MEASUREMENT_IPMI_PROCESSOR_add(
+ String processorIdentifier
+ )
+ {
+ MEASUREMENT_IPMI_PROCESSOR mIP = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(processorIdentifier != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", processorIdentifier));
+ mIP = new MEASUREMENT_IPMI_PROCESSOR();
+ assert(mIP != null);
+ mIP.processorIdentifier = processorIdentifier;
+ mIP.processorThermalControlPercent = new EvelOptionDouble();
+ mIP.processorDTSthermalMargin = new EvelOptionDouble();
+
+
+
+ if( ipmiprocessor == null ){
+ ipmiprocessor = new ArrayList<MEASUREMENT_IPMI_PROCESSOR>();
+ LOGGER.debug("Allocate new IPMI_PROCESSOR");
+ }
+
+ ipmiprocessor.add(mIP);
+
+ EVEL_EXIT();
+ }
+
+
+
+
+
+
+ ArrayList<IPMIglobalAggregateTemperatureMargin> ipmiglobalAggregateTemperatureMarginArray;
+
+ public class IPMIglobalAggregateTemperatureMargin {
+ public String globalAggregateTemperatureMarginIdentifier;
+ public EvelOptionDouble globalAggregateTemeratureMargin;
+ }
+
+ public void evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add(
+ String globalAggregateTemperatureMarginIdentifier
+ )
+ {
+ IPMIglobalAggregateTemperatureMargin ipmiGlobalAgg = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(globalAggregateTemperatureMarginIdentifier != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", globalAggregateTemperatureMarginIdentifier));
+ ipmiGlobalAgg = new IPMIglobalAggregateTemperatureMargin();
+ assert(ipmiGlobalAgg != null);
+ ipmiGlobalAgg.globalAggregateTemperatureMarginIdentifier = globalAggregateTemperatureMarginIdentifier;
+ ipmiGlobalAgg.globalAggregateTemeratureMargin = new EvelOptionDouble();
+
+
+ if( ipmiglobalAggregateTemperatureMarginArray == null ){
+ ipmiglobalAggregateTemperatureMarginArray = new ArrayList<IPMIglobalAggregateTemperatureMargin>();
+ LOGGER.debug("Allocate new IPMIglobalAggregateTemperatureMargin");
+ }
+
+ ipmiglobalAggregateTemperatureMarginArray.add(ipmiGlobalAgg);
+
+ EVEL_EXIT();
+ }
+
+
+
+ ArrayList<IPMIpowerSupply> ipmipowerSupply;
+
+ public class IPMIpowerSupply {
+ public String powerSupplyIdentifier;
+ public EvelOptionDouble powerSupplyInputPower;
+ public EvelOptionDouble powerSupplycurrentOutputPercent;
+ public EvelOptionDouble powerSupplyTemperature;
+ }
+
+ public void evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add(
+ String powerSupplyIdentifier
+ )
+ {
+ IPMIpowerSupply ipmipower = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmipower != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", powerSupplyIdentifier));
+ ipmipower = new IPMIpowerSupply();
+ assert(ipmipower != null);
+ ipmipower.powerSupplyIdentifier = powerSupplyIdentifier;
+ ipmipower.powerSupplycurrentOutputPercent = new EvelOptionDouble();
+ ipmipower.powerSupplyInputPower = new EvelOptionDouble();
+ ipmipower.powerSupplyTemperature = new EvelOptionDouble();
+
+
+ if( ipmipowerSupply == null ){
+ ipmipowerSupply = new ArrayList<IPMIpowerSupply>();
+ LOGGER.debug("Allocate new IPMIpowerSupply");
+ }
+
+ ipmipowerSupply.add(ipmipower);
+
+ EVEL_EXIT();
+ }
+
+
+
+
+
+ ArrayList<IPMIbattery> ipmibattery;
+
+ public class IPMIbattery {
+ public String batteryIdentifier;
+ public EvelOptionString batteryType;
+ public EvelOptionDouble batteryVoltageLevel;
+
+ }
+
+ public void evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add(
+ String batteryIdentifier
+ )
+ {
+ IPMIbattery imibatt = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(imibatt != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", batteryIdentifier));
+ imibatt = new IPMIbattery();
+ assert(imibatt != null);
+ imibatt.batteryIdentifier = batteryIdentifier;
+ imibatt.batteryType = new EvelOptionString();
+ imibatt.batteryVoltageLevel = new EvelOptionDouble();
+
+ if( ipmibattery == null ){
+ ipmibattery = new ArrayList<IPMIbattery>();
+ LOGGER.debug("Allocate new IPMIbattery");
+ }
+
+ ipmibattery.add(imibatt);
+
+ EVEL_EXIT();
+ }
+
+
+
+ ArrayList<IPMINIC> ipmiNIC;
+
+ public class IPMINIC {
+ public String nic_Identifier;
+ public EvelOptionDouble nic_Temperature;
+
+
+ }
+
+ public void evel_measurement_IPMINIC_add(
+ String nic_Identifier
+ )
+ {
+ IPMINIC ipmiNic = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmiNic != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", nic_Identifier));
+ ipmiNic = new IPMINIC();
+ assert(ipmiNic != null);
+ ipmiNic.nic_Identifier = nic_Identifier;
+ ipmiNic.nic_Temperature = new EvelOptionDouble();
+
+
+
+ if( ipmiNIC == null ){
+ ipmiNIC = new ArrayList<IPMINIC>();
+ LOGGER.debug("Allocate new IPMINIC");
+ }
+
+ ipmiNIC.add(ipmiNic);
+
+ EVEL_EXIT();
+ }
+
+
+
+ ArrayList<IPMIHSBP> ipmiHSBP;
+
+ public class IPMIHSBP {
+ public String hsbpIdentifier;
+ public EvelOptionDouble hsbpTemperature;
+
+
+ }
+
+
+ public void evel_measurement_IPMIHSBP_add(
+ String hsbpIdentifier
+ )
+ {
+ IPMIHSBP ipmiHsbp = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmiHsbp != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", hsbpIdentifier));
+ ipmiHsbp = new IPMIHSBP();
+ assert(ipmiHsbp != null);
+ ipmiHsbp.hsbpIdentifier = hsbpIdentifier;
+ ipmiHsbp.hsbpTemperature = new EvelOptionDouble();
+
+
+ if( ipmiHSBP == null ){
+ ipmiHSBP = new ArrayList<IPMIHSBP>();
+ LOGGER.debug("Allocate new IPMIHSBP");
+ }
+
+ ipmiHSBP.add(ipmiHsbp);
+
+ EVEL_EXIT();
+ }
+
+
+
+
+ ArrayList<IPMIbaseboardTemperature> ipmibaseboardTemperature;
+
+ public class IPMIbaseboardTemperature {
+ public String baseboardTemperatureIdentifier;
+ public EvelOptionDouble baseboardTemperature;
+
+
+ }
+
+
+
+ public void evel_measurement_IPMIbaseboardTemperature_add(
+ String baseboardTemperatureIdentifier
+ )
+ {
+ IPMIbaseboardTemperature ipmibaseboardTemp = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmibaseboardTemperature != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", baseboardTemperatureIdentifier));
+ ipmibaseboardTemp = new IPMIbaseboardTemperature();
+ assert(ipmibaseboardTemp != null);
+ ipmibaseboardTemp.baseboardTemperatureIdentifier = baseboardTemperatureIdentifier;
+ ipmibaseboardTemp.baseboardTemperature = new EvelOptionDouble();
+
+ if( ipmibaseboardTemperature == null ){
+ ipmibaseboardTemperature = new ArrayList<IPMIbaseboardTemperature>();
+ LOGGER.debug("Allocate new IPMIbaseboardTemperature");
+ }
+
+ ipmibaseboardTemperature.add(ipmibaseboardTemp);
+
+ EVEL_EXIT();
+ }
+
+
+
+
+ ArrayList<IPMIbaseboardvoltageResulator> ipmiBaseboardvoltageResulator;
+
+ public class IPMIbaseboardvoltageResulator {
+ public String baseboardVoltageRegulatorIdentifier;
+ public EvelOptionDouble voltageRegulatorTemperature;
+
+
+ }
+
+
+ public void evel_measurement_IPMIbaseboardvoltageResulator_add(
+ String baseboardVoltageRegulatorIdentifier
+ )
+ {
+ IPMIbaseboardvoltageResulator ipmiBaseboardvoltageRes = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmiBaseboardvoltageRes != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", baseboardVoltageRegulatorIdentifier));
+ ipmiBaseboardvoltageRes = new IPMIbaseboardvoltageResulator();
+ assert(ipmiBaseboardvoltageRes != null);
+ ipmiBaseboardvoltageRes.baseboardVoltageRegulatorIdentifier = baseboardVoltageRegulatorIdentifier;
+ ipmiBaseboardvoltageRes.voltageRegulatorTemperature = new EvelOptionDouble();
+
+ if( ipmiBaseboardvoltageResulator == null ){
+ ipmiBaseboardvoltageResulator = new ArrayList<IPMIbaseboardvoltageResulator>();
+ LOGGER.debug("Allocate new IPMIbaseboardvoltageResulator");
+ }
+
+ ipmiBaseboardvoltageResulator.add(ipmiBaseboardvoltageRes);
+
+ EVEL_EXIT();
+ }
+
+
+
+
+ ArrayList<IPMIfan> ipmiFan;
+
+ public class IPMIfan {
+ public String fanIdentifier;
+ public EvelOptionDouble fanSpeed;
+
+
+ }
+
+ public void evel_measurement_IPMIfan_add(
+ String fanIdentifier
+ )
+ {
+ IPMIfan ipmiF = null;
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmiF != null);
+
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ LOGGER.debug(MessageFormatter.format("Adding Identifier={0}", fanIdentifier));
+ ipmiF = new IPMIfan();
+ assert(ipmiF != null);
+ ipmiF.fanIdentifier = fanIdentifier;
+ ipmiF.fanSpeed = new EvelOptionDouble();
+
+ if( ipmiFan == null ){
+ ipmiFan = new ArrayList<IPMIfan>();
+ LOGGER.debug("Allocate new IPMIfan");
+ }
+
+ ipmiFan.add(ipmiF);
+
+ EVEL_EXIT();
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// ArrayList<MEASUREMENT_IPMI_PERCENT_USAGE> ipmi_percentage;
+// ArrayList<MEASUREMENT_IPMI_VOLTAGE> ipmi_voltage;
+//
+// ArrayList<MEASUREMENT_IPMI_TEMPARATURE> ipmi_temparature;
+// ArrayList<MEASUREMENT_IPMI_FAN> ipmi_fan;
+// ArrayList<MEASUREMENT_IPMI_CFM> ipmi_cfm;
+// ArrayList<MEASUREMENT_IPMI_WATTS> ipmi_watts;
+// /**************************************************************************//**
+// * IPMI Percent Usage.
+// * JSON equivalent field: PercentUsage
+// *****************************************************************************/
+// public class MEASUREMENT_IPMI_PERCENT_USAGE {
+// public EvelOptionDouble P2ThermCtrl;
+// public EvelOptionDouble P1ThermCtrl;
+// public EvelOptionDouble PS1CurrOut;
+//
+// }
+//
+// public class MEASUREMENT_IPMI_VOLTAGE {
+// public EvelOptionDouble BB3_3vVbat;
+// public EvelOptionDouble BB12_0v;
+//
+// }
+//
+// public class MEASUREMENT_IPMI_TEMPARATURE {
+// public EvelOptionDouble AggThermMgn1;
+// public EvelOptionDouble DIMMThrmMrgn4;
+// public EvelOptionDouble DIMMThrmMrgn3;
+// public EvelOptionDouble DIMMThrmMrgn2;
+// public EvelOptionDouble DIMMThrmMrgn1;
+// public EvelOptionDouble P2DTSThermMgn;
+// public EvelOptionDouble P1DTSThermMgn;
+// public EvelOptionDouble P2ThermCtrl;
+// public EvelOptionDouble P1ThermCtrl;
+// public EvelOptionDouble P2ThermMargin;
+// public EvelOptionDouble P1ThermMargin;
+// public EvelOptionDouble PS1Temperature;
+// public EvelOptionDouble LANNICTemp;
+// public EvelOptionDouble ExitAirTemp;
+// public EvelOptionDouble HSBP1Temp;
+// public EvelOptionDouble IOModTemp;
+// public EvelOptionDouble BBLftRearTemp;
+// public EvelOptionDouble BBRtRearTemp;
+// public EvelOptionDouble BBBMCTemp;
+// public EvelOptionDouble SSBTemp;
+// public EvelOptionDouble FrontPanelTemp;
+// public EvelOptionDouble BBP2VRTemp;
+// public EvelOptionDouble BBP1VRTemp;
+//
+// }
+//
+// public class MEASUREMENT_IPMI_FAN {
+// public EvelOptionDouble SystemFan6B;
+// public EvelOptionDouble SystemFan6A;
+// public EvelOptionDouble SystemFan5B;
+// public EvelOptionDouble SystemFan5A;
+// public EvelOptionDouble SystemFan4B;
+// public EvelOptionDouble SystemFan4A;
+// public EvelOptionDouble SystemFan3B;
+// public EvelOptionDouble SystemFan3A;
+// public EvelOptionDouble SystemFan2B;
+// public EvelOptionDouble SystemFa_2A;
+// public EvelOptionDouble SystemFan1B;
+// public EvelOptionDouble SystemFan1A;
+//
+// }
+// public class MEASUREMENT_IPMI_CFM {
+// public EvelOptionDouble System_Airflow;
+//
+// }
+// public class MEASUREMENT_IPMI_WATTS {
+// public EvelOptionDouble PS1InputPower;
+//
+// }
+//
+//
+// public MEASUREMENT_IPMI_TEMPARATURE evel_measurement_new_temparature_add(double usage)
+// {
+// EVEL_ENTER();
+//
+// /***************************************************************************/
+// /* Check assumptions. */
+// /***************************************************************************/
+// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+// assert(usage >= 0.0);
+//
+// /***************************************************************************/
+// /* Allocate a container for the value and push onto the list. */
+// /***************************************************************************/
+// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
+// MEASUREMENT_IPMI_TEMPARATURE temparature = new MEASUREMENT_IPMI_TEMPARATURE();
+// assert(temparature != null);
+// temparature.AggThermMgn1 = new EvelOptionDouble();
+// temparature.DIMMThrmMrgn4 = new EvelOptionDouble();
+//
+// temparature.DIMMThrmMrgn3 = new EvelOptionDouble();
+// temparature.DIMMThrmMrgn2 = new EvelOptionDouble();
+// temparature.DIMMThrmMrgn1 = new EvelOptionDouble();
+// temparature.P2DTSThermMgn = new EvelOptionDouble();
+// temparature.P1DTSThermMgn = new EvelOptionDouble();
+// temparature.P2ThermCtrl = new EvelOptionDouble();
+// temparature.P1ThermCtrl = new EvelOptionDouble();
+// temparature.P2ThermMargin = new EvelOptionDouble();
+// temparature.P1ThermMargin = new EvelOptionDouble();
+// temparature.PS1Temperature = new EvelOptionDouble();
+// temparature.LANNICTemp = new EvelOptionDouble();
+// temparature.ExitAirTemp = new EvelOptionDouble();
+// temparature.HSBP1Temp = new EvelOptionDouble();
+// temparature.IOModTemp = new EvelOptionDouble();
+// temparature.BBLftRearTemp = new EvelOptionDouble();
+// temparature.BBRtRearTemp = new EvelOptionDouble();
+// temparature.BBBMCTemp = new EvelOptionDouble();
+// temparature.SSBTemp = new EvelOptionDouble();
+// temparature.FrontPanelTemp = new EvelOptionDouble();
+// temparature.BBP2VRTemp = new EvelOptionDouble();
+// temparature.BBP1VRTemp = new EvelOptionDouble();
+//
+//
+//
+// if( ipmi_temparature == null ){
+// ipmi_temparature = new ArrayList<MEASUREMENT_IPMI_TEMPARATURE>();
+// LOGGER.debug("Allocate percent_usage");
+// }
+//
+// ipmi_temparature.add(temparature);
+//
+// EVEL_EXIT();
+// return temparature;
+// }
+//
+//
+//
+// public MEASUREMENT_IPMI_FAN evel_measurement_new_fan_add(double usage)
+// {
+// EVEL_ENTER();
+//
+// /***************************************************************************/
+// /* Check assumptions. */
+// /***************************************************************************/
+// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+// assert(usage >= 0.0);
+//
+// /***************************************************************************/
+// /* Allocate a container for the value and push onto the list. */
+// /***************************************************************************/
+// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
+// MEASUREMENT_IPMI_FAN fan = new MEASUREMENT_IPMI_FAN();
+// assert(fan != null);
+// fan.SystemFan6B = new EvelOptionDouble();
+// fan.SystemFan6A = new EvelOptionDouble();
+// fan.SystemFan5B = new EvelOptionDouble();
+// fan.SystemFan5A = new EvelOptionDouble();
+// fan.SystemFan4B = new EvelOptionDouble();
+// fan.SystemFan4A = new EvelOptionDouble();
+// fan.SystemFan3B = new EvelOptionDouble();
+// fan.SystemFan3A = new EvelOptionDouble();
+// fan.SystemFan2B = new EvelOptionDouble();
+// fan.SystemFa_2A = new EvelOptionDouble();
+// fan.SystemFan1B = new EvelOptionDouble();
+// fan.SystemFan1A = new EvelOptionDouble();
+//
+// if( ipmi_fan == null ){
+// ipmi_fan = new ArrayList<MEASUREMENT_IPMI_FAN>();
+// LOGGER.debug("Allocate percent_usage");
+// }
+//
+// ipmi_fan.add(fan);
+//
+// EVEL_EXIT();
+// return fan;
+// }
+//
+//
+// public MEASUREMENT_IPMI_CFM evel_measurement_new_cfm_add(double usage)
+// {
+// EVEL_ENTER();
+//
+// /***************************************************************************/
+// /* Check assumptions. */
+// /***************************************************************************/
+// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+// assert(usage >= 0.0);
+//
+// /***************************************************************************/
+// /* Allocate a container for the value and push onto the list. */
+// /***************************************************************************/
+// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
+// MEASUREMENT_IPMI_CFM cfm = new MEASUREMENT_IPMI_CFM();
+// assert(cfm != null);
+// cfm.System_Airflow = new EvelOptionDouble();
+//
+//
+//
+//
+//
+// if( ipmi_cfm == null ){
+// ipmi_cfm = new ArrayList<MEASUREMENT_IPMI_CFM>();
+// LOGGER.debug("Allocate percent_usage");
+// }
+//
+// ipmi_cfm.add(cfm);
+//
+// EVEL_EXIT();
+// return cfm;
+// }
+//
+//
+// public MEASUREMENT_IPMI_WATTS evel_measurement_new_watts_add(double usage)
+// {
+// EVEL_ENTER();
+//
+// /***************************************************************************/
+// /* Check assumptions. */
+// /***************************************************************************/
+// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+// assert(usage >= 0.0);
+//
+// /***************************************************************************/
+// /* Allocate a container for the value and push onto the list. */
+// /***************************************************************************/
+// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
+// MEASUREMENT_IPMI_WATTS watts = new MEASUREMENT_IPMI_WATTS();
+// assert(watts != null);
+// watts.PS1InputPower = new EvelOptionDouble();
+//
+//
+//
+//
+//
+// if( ipmi_watts == null ){
+// ipmi_watts = new ArrayList<MEASUREMENT_IPMI_WATTS>();
+// LOGGER.debug("Allocate percent_usage");
+// }
+//
+// ipmi_watts.add(watts);
+//
+// EVEL_EXIT();
+// return watts;
+// }
+
+
+// public MEASUREMENT_IPMI_VOLTAGE evel_measurement_new_voltage_add(double usage)
+// {
+// EVEL_ENTER();
+//
+// /***************************************************************************/
+// /* Check assumptions. */
+// /***************************************************************************/
+// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+// assert(usage >= 0.0);
+//
+// /***************************************************************************/
+// /* Allocate a container for the value and push onto the list. */
+// /***************************************************************************/
+// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
+// MEASUREMENT_IPMI_VOLTAGE voltage = new MEASUREMENT_IPMI_VOLTAGE();
+// assert(voltage != null);
+// voltage.BB12_0v = new EvelOptionDouble();
+// voltage.BB3_3vVbat = new EvelOptionDouble();
+//
+//
+//
+//
+// if( ipmi_voltage == null ){
+// ipmi_voltage = new ArrayList<MEASUREMENT_IPMI_VOLTAGE>();
+// LOGGER.debug("Allocate percent_usage");
+// }
+//
+// ipmi_voltage.add(voltage);
+//
+// EVEL_EXIT();
+// return voltage;
+// }
+
+// public MEASUREMENT_IPMI_PERCENT_USAGE evel_measurement_new_percent_usage_add(double usage)
+// {
+// EVEL_ENTER();
+//
+// /***************************************************************************/
+// /* Check assumptions. */
+// /***************************************************************************/
+// assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+// assert(usage >= 0.0);
+//
+// /***************************************************************************/
+// /* Allocate a container for the value and push onto the list. */
+// /***************************************************************************/
+// LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", usage));
+// MEASUREMENT_IPMI_PERCENT_USAGE percent_usage = new MEASUREMENT_IPMI_PERCENT_USAGE();
+// assert(percent_usage != null);
+// percent_usage.P1ThermCtrl = new EvelOptionDouble();
+// percent_usage.P2ThermCtrl = new EvelOptionDouble();
+// percent_usage.PS1CurrOut = new EvelOptionDouble();
+//
+//
+//
+// if( ipmi_percentage == null ){
+// ipmi_percentage = new ArrayList<MEASUREMENT_IPMI_PERCENT_USAGE>();
+// LOGGER.debug("Allocate percent_usage");
+// }
+//
+// ipmi_percentage.add(percent_usage);
+//
+// EVEL_EXIT();
+// return percent_usage;
+// }
+//
+}
+
+ public MEASUREMENT_IPMI evel_meas_ipmi_add(MEASUREMENT_IPMI ipmi)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+ assert(ipmi != null);
+
+ if( ipmis == null ){
+ ipmis = new ArrayList<MEASUREMENT_IPMI>();
+ LOGGER.debug("Allocate new file system usage");
+ }
+
+
+ ipmis.add(ipmi);
+
+ EVEL_EXIT();
+
+ return ipmi;
+ }
+
+ public void evel_measurement_ipmi_exitAirTemperature_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.exitAirTemperature.SetValuePr(val,"System fan exit air flow temperature in Celsius ");
+ EVEL_EXIT();
+ }
+ public void evel_measurement_ipmi_frontPanelTemperature_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.frontPanelTemperature.SetValuePr(val,"Front panel temp in Celsius");
+ EVEL_EXIT();
+ }
+ public void evel_measurement_ipmi_ioModuleTemperature_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.ioModuleTemperature.SetValuePr(val,"Io module temp in Celsius ");
+ EVEL_EXIT();
+ }
+ public void evel_measurement_ipmi_systemAirflow_set(MEASUREMENT_IPMI ipmi,
+ double val)
+ {
+ EVEL_ENTER();
+ ipmi.systemAirflow.SetValuePr(val,"Airflow in cubic feet per minute (cfm)");
+ EVEL_EXIT();
+ }
+
+
+
+
+
/***************************************************************************/
@@ -290,13 +1303,26 @@ public class EvelScalingMeasurement extends EvelHeader { /***************************************************************************/
/* Optional fields */
/***************************************************************************/
- ArrayList<String[]> additional_info;
+ // ArrayList<String[]> additional_info;
+
+ HashMap<String, String > additional_inf;
+
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;
+ //VES6.0 Added field 14/07/2018
+ ArrayList<MEASUREMENT_HUGE_PAGE> huge_pages;
+ ArrayList<MEASUREMENT_LOAD> loads;
+ ArrayList<MEASUREMENT_PROCESS_STATS> process_stats;
+ ArrayList<MEASUREMENT_IPMI> ipmis;
+ ArrayList<MACHINE_CHECK_EXCEPTION> machineCheckException;
+
+
+
+
ArrayList<MEASUREMENT_DISK_USE> disk_usage;
boolean errstat;
MEASUREMENT_ERRORS myerrors;
@@ -308,7 +1334,7 @@ public class EvelScalingMeasurement extends EvelHeader { EvelOptionInt media_ports_in_use;
EvelOptionInt request_rate;
EvelOptionInt vnfc_scaling_metric;
- ArrayList<MEASUREMENT_VNIC_PERFORMANCE> vnic_usage;
+ ArrayList<MEASUREMENT_NIC_PERFORMANCE> vnic_usage;
/***************************************************************************/
@@ -348,7 +1374,7 @@ public class EvelScalingMeasurement extends EvelHeader { event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT;
//initialize optional fields
measurement_interval = meas_interval;
- additional_info = null;
+ additional_inf = null;
additional_measurements = null;
additional_objects = null;
cpu_usage = null;
@@ -361,6 +1387,14 @@ public class EvelScalingMeasurement extends EvelHeader { feature_usage = null;
errstat = false;
+
+ huge_pages=null;
+ loads = null;
+ process_stats=null;
+ ipmis=null;
+ machineCheckException = null;
+
+
mean_request_latency = new EvelOptionDouble(false, 0.0);
vnfc_scaling_metric = new EvelOptionInt(false, 0);
concurrent_sessions = new EvelOptionInt(false, 0);
@@ -413,7 +1447,7 @@ public class EvelScalingMeasurement extends EvelHeader { *****************************************************************************/
public void evel_measurement_addl_info_add(String name, String value)
{
- String[] addl_info = null;
+ // String[] addl_info = null;
EVEL_ENTER();
/***************************************************************************/
@@ -423,22 +1457,76 @@ public class EvelScalingMeasurement extends EvelHeader { assert(name != null);
assert(value != null);
- if( additional_info == null )
+ if( additional_inf == null )
{
- additional_info = new ArrayList<String[]>();
+ additional_inf = new HashMap<String, String >();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- addl_info = new String[2];
- assert(addl_info != null);
- addl_info[0] = name;
- addl_info[1] = value;
-
- additional_info.add(addl_info);
+ // addl_info = new String[2];
+ // assert(addl_info != null);
+ // addl_info[0] = name;
+ // addl_info[1] = value;
+ additional_inf.put(name, value);
+ // additional_info.add(addl_info);
EVEL_EXIT();
}
+ /**************************************************************************/
+ /* IPMI. */
+ /* JSON equivalent field: Ipmi */
+ /*****************************************************************************/
+
+ public MEASUREMENT_IPMI evel_measurement_new_ipmis_add()
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check assumptions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
+
+ /***************************************************************************/
+ /* Allocate a container for the value and push onto the list. */
+ /***************************************************************************/
+ //LOGGER.debug(MessageFormatter.format("Adding id={0} usage={1}", id, usage));
+ MEASUREMENT_IPMI ipmi = new MEASUREMENT_IPMI();
+ assert(ipmi != null);
+ //cpu_use.id = id;
+ //cpu_use.usage = usage;
+ ipmi.exitAirTemperature = new EvelOptionDouble();
+ ipmi.frontPanelTemperature = new EvelOptionDouble();
+ ipmi.ioModuleTemperature = new EvelOptionDouble();
+ ipmi.systemAirflow = new EvelOptionDouble();
+
+
+ if( ipmis == null ){
+ ipmis= new ArrayList<MEASUREMENT_IPMI>();
+ LOGGER.debug("Allocate new ipmis");
+ }
+
+ ipmis.add(ipmi);
+
+ EVEL_EXIT();
+ return ipmi;
+ }
+
+
+
+ /*
+ *
+ */
+
+
+
+
+
+
+
+
+
+
/**************************************************************************//**
* Set the Concurrent Sessions property of the Measurement.
*
@@ -601,8 +1689,556 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
}
+
+
+
+ /*
+ * VES6.0 Added fields 14July2018
+ */
+
+ /**************************************************************************//**
+ load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1 Minute
+ measured CPU and IO utilization for 1 min using /proc/loadavg
+ * 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_PROCESS_STATS evel_measurement_new_process_stats_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_PROCESS_STATS process_stat = new MEASUREMENT_PROCESS_STATS();
+ assert(process_stat != null);
+ process_stat.processIdentifier = id;
+ process_stat.forkRate = new EvelOptionDouble();
+ process_stat.psStateBlocked = new EvelOptionDouble();
+ process_stat.psStatePaging = new EvelOptionDouble();
+ process_stat.psStateRunning = new EvelOptionDouble();
+ process_stat.psStateSleeping = new EvelOptionDouble();
+ process_stat.psStateStopped = new EvelOptionDouble();
+ process_stat.psStateZombie = new EvelOptionDouble();
+
+
+ if( process_stats == null ){
+ process_stats = new ArrayList<MEASUREMENT_PROCESS_STATS>();
+ LOGGER.debug("Allocate Process_Stats");
+ }
+
+ process_stats.add(process_stat);
+
+ EVEL_EXIT();
+ return process_stat;
+ }
+
+
+
+
+
+
+ /**************************************************************************//**
+ * the number of threads created since the last reboo
+ * @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_process_stats_forkRate_set(MEASUREMENT_PROCESS_STATS process_stat,
+ double val)
+ {
+ EVEL_ENTER();
+ process_stat.forkRate.SetValuePr(val,"the number of threads created since the last reboot");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * the number of processes in a blocked state
+ * @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_process_stats_psStateBlocked_set(MEASUREMENT_PROCESS_STATS process_stat,
+ double val)
+ {
+ EVEL_ENTER();
+ process_stat.psStateBlocked.SetValuePr(val,"the number of processes in a blocked state");
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * the number of processes in a paging state
+ * @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_process_stats_psStatePaging_set(MEASUREMENT_PROCESS_STATS process_stat,
+ double val)
+ {
+ EVEL_ENTER();
+ process_stat.psStatePaging.SetValuePr(val,"the number of processes in a paging state");
+ EVEL_EXIT();
+ }
+
+
+
+ /**************************************************************************//**
+ * the number of processes in a running state
+ * @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_process_stats_psStateRunning_set(MEASUREMENT_PROCESS_STATS process_stat,
+ double val)
+ {
+ EVEL_ENTER();
+ process_stat.psStateRunning.SetValuePr(val,"the number of processes in a running state");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * the number of processes in a sleeping state
+ * @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_process_stats_psStateSleeping_set(MEASUREMENT_PROCESS_STATS process_stat,
+ double val)
+ {
+ EVEL_ENTER();
+ process_stat.psStateSleeping.SetValuePr(val,"the number of processes in a sleeping state");
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * the number of processes in a stopped state
+ * @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_process_stats_psStateStopped_set(MEASUREMENT_PROCESS_STATS process_stat,
+ double val)
+ {
+ EVEL_ENTER();
+ process_stat.psStateStopped.SetValuePr(val,"the number of processes in a stopped state");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * the number of processes in a Zombie state
+ * @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_process_stats_psStateZombie_set(MEASUREMENT_PROCESS_STATS process_stat,
+ double val)
+ {
+ EVEL_ENTER();
+ process_stat.psStateZombie.SetValuePr(val,"the number of processes in a Zombie state");
+ EVEL_EXIT();
+ }
+
+ /*
+ * VES6.0 Added fields 14July2018
+ */
+
+ /**************************************************************************//**
+ load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1 Minute
+ measured CPU and IO utilization for 1 min using /proc/loadavg
+ * 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 usage CPU utilization.
+ *****************************************************************************/
+ public MEASUREMENT_LOAD evel_measurement_new_load_add(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_LOAD load = new MEASUREMENT_LOAD();
+ assert(load != null);
+// load.loadIdentifier = id;
+ load.shortTerm = new EvelOptionDouble();
+ load.midTerm = new EvelOptionDouble();
+ load.longTerm = new EvelOptionDouble();
+
+ if( loads == null ){
+ loads = new ArrayList<MEASUREMENT_LOAD>();
+ LOGGER.debug("Allocate Load");
+ }
+
+ loads.add(load);
+
+ EVEL_EXIT();
+ return load;
+ }
+
+ /**************************************************************************//**
+ * load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1 Minute
+ measured CPU and IO utilization for 1 min using /proc/loadavg"
+ * @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_load_shortTerm_set(MEASUREMENT_LOAD load,
+ double val)
+ {
+ EVEL_ENTER();
+ load.shortTerm.SetValuePr(val,"load short term");
+ EVEL_EXIT();
+ }
/**************************************************************************//**
+ * "load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 5 Minutes
+ measured CPU and IO utilization for 5 mins using /proc/loadavg"
+ * @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_load_midTerm_set(MEASUREMENT_LOAD load,
+ double val)
+ {
+ EVEL_ENTER();
+ load.midTerm.SetValuePr(val,"load midterm");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 15 Minutes
+ measured CPU and IO utilization for 15 mins using /proc/loadavg
+ * @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_load_longTerm_set(MEASUREMENT_LOAD load,
+ double val)
+ {
+ EVEL_ENTER();
+ load.longTerm.SetValuePr(val,"load longterm");
+ EVEL_EXIT();
+ }
+
+ /******************************************************************************
+ *
+ *****************************************************************************/
+
+ public MACHINE_CHECK_EXCEPTION evel_measurement_new_machine_check_exception_add(String id)
+ {
+ 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}", id));
+ MACHINE_CHECK_EXCEPTION machine_check_exception = new MACHINE_CHECK_EXCEPTION();
+ assert(machine_check_exception != null);
+ machine_check_exception.processIdentifier = id;
+ machine_check_exception.correctedMemoryErrors = new EvelOptionDouble();
+ machine_check_exception.correctedMemoryErrors_In1Hr = new EvelOptionDouble();
+ machine_check_exception.uncorrectedMemoryErrors = new EvelOptionDouble();
+ machine_check_exception.uncorrectedMemoryErrors_In1Hr = new EvelOptionDouble();
+
+
+ if( machineCheckException == null ){
+ machineCheckException = new ArrayList<MACHINE_CHECK_EXCEPTION>();
+ LOGGER.debug("Allocate new machineCheckException");
+ }
+
+ machineCheckException.add(machine_check_exception);
+
+ EVEL_EXIT();
+ return machine_check_exception;
+ }
+
+
+ public MACHINE_CHECK_EXCEPTION evel_measurement_Exception_correctedMemoryErrors_set(MACHINE_CHECK_EXCEPTION exception,
+ double val)
+ {
+ EVEL_ENTER();
+ exception.correctedMemoryErrors.SetValuePr(val, "Exception_correctedMemoryErrors");
+ EVEL_EXIT();
+
+ return exception;
+ }
+
+ public MACHINE_CHECK_EXCEPTION evel_measurement_Exception_correctedMemoryErrors_In1Hr_set(MACHINE_CHECK_EXCEPTION exception,
+ double val)
+ {
+ EVEL_ENTER();
+ exception.correctedMemoryErrors_In1Hr.SetValuePr(val, "Exception_correctedMemoryErrors_In1Hr");
+ EVEL_EXIT();
+ return exception;
+
+ }
+
+ public MACHINE_CHECK_EXCEPTION evel_measurement_Exception_uncorrectedMemoryErrors_set(MACHINE_CHECK_EXCEPTION exception,
+ double val)
+ {
+ EVEL_ENTER();
+ exception.uncorrectedMemoryErrors.SetValuePr(val, "Exception_uncorrectedMemoryErrors");
+ EVEL_EXIT();
+ return exception;
+ }
+
+ public MACHINE_CHECK_EXCEPTION evel_measurement_Exception_uncorrectedMemoryErrors_In1Hr_set(MACHINE_CHECK_EXCEPTION exception,
+ double val)
+ {
+ EVEL_ENTER();
+ exception.uncorrectedMemoryErrors_In1Hr.SetValuePr(val, "Exception_uncorrectedMemoryErrors_In1Hr");
+ EVEL_EXIT();
+ return exception;
+ }
+
+
+ /*
+ * VES6.0 Added fields 14July2018
+ */
+ /**************************************************************************//**
+ * Add an additional HUGE PAGE 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_HUGE_PAGE evel_measurement_new_huge_page_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_HUGE_PAGE huge_page = new MEASUREMENT_HUGE_PAGE();
+ assert(huge_page != null);
+ huge_page.hugePagesIdentifier = id;
+ huge_page.bytesUsed = usage;
+ huge_page.bytesFree = new EvelOptionDouble();
+ huge_page.percentFree = new EvelOptionDouble();
+ huge_page.percentUsed = new EvelOptionDouble();
+ huge_page.vmPageNumberFree = new EvelOptionDouble();
+ huge_page.vmPageNumberUsed = new EvelOptionDouble();
+
+
+ if( huge_pages == null ){
+ huge_pages = new ArrayList<MEASUREMENT_HUGE_PAGE>();
+ LOGGER.debug("Allocate new cpu usage");
+ }
+
+ huge_pages.add(huge_page);
+
+ EVEL_EXIT();
+ return huge_page;
+ }
+
+
+ /**************************************************************************//**
+ * Set Number of free hugepages in bytes
+ * @note The property is treated as immutable: it is only valid to call
+ * the setter once. However, we don't assert if the caller tries to
+ * overwrite, just ignoring the update instead.
+ *
+ * @param cpu_use Pointer to the CPU Use.
+ * @param string double
+ *****************************************************************************/
+
+
+// public void evel_measurement_huge_page_hugePagesIdentifier_set(MEASUREMENT_HUGE_PAGE huge_page,
+// String string)
+// {
+// EVEL_ENTER();
+// huge_page.SetValuePr(string,"CPU hugePagesIdentifier");
+// EVEL_EXIT();
+//
+//
+// }
+ /**************************************************************************//**
+ * Set Number of free hugepages in percent
+ * @note The property is treated as immutable: it is only valid to call
+ * 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_huge_page_percentFree_set(MEASUREMENT_HUGE_PAGE huge_page,
+ double val)
+ {
+ EVEL_ENTER();
+ huge_page.percentFree.SetValuePr(val,"Number of free hugepages in percent");
+ EVEL_EXIT();
+
+
+ }
+
+ /**************************************************************************//**
+ * Set Number of used hugepages in percent
+ * @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_huge_page_percentUsed_set(MEASUREMENT_HUGE_PAGE huge_page,
+ double val)
+ {
+ EVEL_ENTER();
+ huge_page.percentUsed.SetValuePr(val,"Number of used hugepages in percent");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Number of used hugepages in numbers
+ * @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_huge_page_vmPageNumberFree_set(MEASUREMENT_HUGE_PAGE huge_page,
+ double val)
+ {
+ EVEL_ENTER();
+ huge_page.vmPageNumberFree.SetValuePr(val,"Number of used hugepages in numbers");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Number of used hugepages in numbers
+ * @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_huge_page_vmPageNumberUsed_set(MEASUREMENT_HUGE_PAGE huge_page,
+ double val)
+ {
+ EVEL_ENTER();
+ huge_page.vmPageNumberUsed.SetValuePr(val,"Number of used hugepages in numbers");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set Number of used hugepages in numbers
+ * @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_huge_page_bytesFree_set(MEASUREMENT_HUGE_PAGE huge_page,
+ double val)
+ {
+ EVEL_ENTER();
+ huge_page.bytesFree.SetValuePr(val,"Number of used hugepages in numbers");
+ 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
@@ -640,7 +2276,16 @@ public class EvelScalingMeasurement extends EvelHeader { cpu_use.sys = new EvelOptionDouble();
cpu_use.user = new EvelOptionDouble();
cpu_use.wait = new EvelOptionDouble();
-
+ /*
+ * Ves6.0 Added Fields 14/07/2018
+ */
+ cpu_use.cpuCapacityContention= new EvelOptionDouble();
+ cpu_use.cpuDemandAvg= new EvelOptionDouble();
+ cpu_use.cpuDemandMhz= new EvelOptionDouble();
+ cpu_use.cpuDemandPct= new EvelOptionDouble();
+ cpu_use.cpuLatencyAvg= new EvelOptionDouble();
+ cpu_use.cpuOverheadAvg= new EvelOptionDouble();
+ cpu_use.cpuSwapWaitTime= new EvelOptionDouble();
if( cpu_usage == null ){
cpu_usage = new ArrayList<MEASUREMENT_CPU_USE>();
LOGGER.debug("Allocate new cpu usage");
@@ -651,6 +2296,131 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
return cpu_use;
}
+ /**************************************************************************//**
+ * Set the amount of time the CPU cannot run due to centention, in milliseconds.
+ *
+ * @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_cpuCapacityContention_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.cpuCapacityContention.SetValuePr(val,"CPU cpuCapacityContention");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set the total CPU time that the VNF/VNFC/VM could use if there is no contention, in milliseconds.
+ *
+ * @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_cpuDeamandAvg_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.cpuDemandAvg.SetValuePr(val,"Total CPU Time");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set CPU demand as a percentage of the provisioned capacity.
+ *
+ * @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_cpuDeamandPct_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.cpuDemandPct.SetValuePr(val,"CPU Demand as a percentage");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set CPU demand in megahertz.
+ *
+ * @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_cpuDeamandMhz_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.cpuDemandMhz.SetValuePr(val,"CPU demand in megahertz");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Percentage of time the VM is unable to run because it is contending for access to the physical CPUs.
+ *
+ * @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_cpuLatencyAvg_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.cpuLatencyAvg.SetValuePr(val,"CPU Percentage of time");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set The overhead demand above available allocations and reservations.
+ *
+ * @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_cpuOverheadAvg_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.cpuOverheadAvg.SetValuePr(val,"CPU overhead demand");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set CPU Swap wait time in milliseconds.
+ *
+ * @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_cpuSwapWaitTime_set(MEASUREMENT_CPU_USE cpu_use,
+ double val)
+ {
+ EVEL_ENTER();
+ cpu_use.cpuSwapWaitTime.SetValuePr(val,"CPU Swap wait time");
+ EVEL_EXIT();
+ }
+
+
+
/**************************************************************************//**
* Set the CPU Idle value in measurement interval
@@ -806,7 +2576,7 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
}
-
+
/**************************************************************************//**
* Add an additional Memory usage value name/value pair to the Measurement.
*
@@ -822,7 +2592,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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)
+ String vmidentifier, double membuffsz)
{
MEASUREMENT_MEM_USE mem_use = null;
EVEL_ENTER();
@@ -831,16 +2601,16 @@ public class EvelScalingMeasurement extends EvelHeader { /* Check assumptions. */
/***************************************************************************/
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT);
- assert(id != null);
+ // 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));
+ LOGGER.debug(MessageFormatter.format("Adding buffer size={1}", membuffsz));
mem_use = new MEASUREMENT_MEM_USE();
assert(mem_use != null);
- mem_use.id = id;
+ // mem_use.id = id;
mem_use.vmid = vmidentifier;
mem_use.membuffsz = membuffsz;
mem_use.memcache = new EvelOptionDouble();
@@ -849,6 +2619,17 @@ public class EvelScalingMeasurement extends EvelHeader { mem_use.slabrecl= new EvelOptionDouble();
mem_use.slabunrecl= new EvelOptionDouble();
mem_use.memused= new EvelOptionDouble();
+
+
+
+ mem_use.memoryDemand= new EvelOptionDouble();
+ mem_use.memoryLatencyAvg= new EvelOptionDouble();
+ mem_use.memorySharedAvg= new EvelOptionDouble();
+ mem_use.memorySwapInAvg= new EvelOptionDouble();
+ mem_use.memorySwapInRateAvg= new EvelOptionDouble();
+ mem_use.memorySwapOutAvg= new EvelOptionDouble();
+ mem_use.memorySwapOutRateAvg= new EvelOptionDouble();
+ mem_use.memorySwapUsedAvg= new EvelOptionDouble();
assert(mem_use.id != null);
@@ -972,7 +2753,159 @@ public class EvelScalingMeasurement extends EvelHeader { mem_use.memused.SetValuePr(val, "Memory usedup total set");
EVEL_EXIT();
}
+
+
+ /*
+ * VES6.0 Added Fields 14July
+ */
+ /**************************************************************************//**
+ * Set the Host demand in kibibytes.
+ *
+ * @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_memoryDemand_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memoryDemand.SetValuePr(val, "Host demand in kibibytes");
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set Percentage of time the VM is waiting to access swapped or compressed memory.
+ *
+ * @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_memoryLatencyAvg_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memoryLatencyAvg.SetValuePr(val, "Percentage of time the VM is waiting to access swapped or compressed memory");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set Space used for caching swapped pages in the host cache in kibibytes.
+ *
+ * @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_memorySharedAvg_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memorySharedAvg.SetValuePr(val, "Space used for caching swapped pages in the host cache in kibibytes");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set Amount of memory swapped-in from host cache in kibibytes.
+ *
+ * @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_memorySwapInAvg_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memorySwapInAvg.SetValuePr(val, "Amount of memory swapped-in from host cache in kibibytes.");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set Rate at which memory is swapped from disk into active memory during the interval in kilobyte per second.
+ *
+ * @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_memorySwapInRateAvg_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memorySwapInRateAvg.SetValuePr(val, "Rate at which memory is swapped from disk into active memory during the interval in kilobyte per second.");
+ EVEL_EXIT();
+ }
+
+
+ /**************************************************************************//**
+ * Set Amount of memory swapped-out to host cache in kibibytes
+ *
+ * @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_memorySwapOutAvg_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memorySwapOutAvg.SetValuePr(val, "Amount of memory swapped-out to host cache in kibibytes.");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set Rate at which memory is being swapped from active memory to disk during the current interval in kilobytes per second.
+ *
+ * @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_memorySwapOutRateAvg_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memorySwapOutRateAvg.SetValuePr(val, "Rate at which memory is being swapped from active memory to disk during the current interval in kilobytes per second");
+ EVEL_EXIT();
+ }
+
+ /**************************************************************************//**
+ * Set Space used for caching swapped pages in the host cache in kibibytes.
+ *
+ * @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_memorySwapUsedAvg_set(MEASUREMENT_MEM_USE mem_use,
+ double val)
+ {
+ EVEL_ENTER();
+ mem_use.memorySwapUsedAvg.SetValuePr(val, "Space used for caching swapped pages in the host cache in kibibytes.");
+ EVEL_EXIT();
+ }
+
+
/**************************************************************************//**
* Add an additional Disk usage value name/value pair to the Measurement.
*
@@ -1044,6 +2977,27 @@ public class EvelScalingMeasurement extends EvelHeader { disk_use.timewritelast= new EvelOptionDouble();
disk_use.timewritemax= new EvelOptionDouble();
disk_use.timewritemin= new EvelOptionDouble();
+ /*
+ *
+ */
+ disk_use.diskBusResets=new EvelOptionDouble();
+ disk_use.diskCommandsAborted=new EvelOptionDouble();
+ disk_use.diskCommandsAvg=new EvelOptionDouble();
+ disk_use.diskFlushRequests=new EvelOptionDouble();
+ disk_use.diskFlushTime=new EvelOptionDouble();
+ disk_use.diskReadCommandsAvg=new EvelOptionDouble();
+ disk_use.diskTime=new EvelOptionDouble();
+ disk_use.diskTotalReadLatencyAvg=new EvelOptionDouble();
+ disk_use.diskWriteCommandsAvg=new EvelOptionDouble();
+ disk_use.diskTotalWriteLatencyAvg=new EvelOptionDouble();
+
+
+ disk_use.diskWeightedIoTimeAvg=new EvelOptionDouble();
+ disk_use.diskWeightedIoTimeLast=new EvelOptionDouble();
+ disk_use.diskWeightedIoTimeMax=new EvelOptionDouble();
+ disk_use.diskWeightedIoTimeMin=new EvelOptionDouble();
+
+
if( disk_usage == null ){
disk_usage = new ArrayList<MEASUREMENT_DISK_USE>();
@@ -1057,7 +3011,235 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
return disk_use;
}
+
+ /*
+ * Ves 6.0 19/07/2018
+ */
+
+ /**************************************************************************//**
+ * 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_diskWeightedIoTimeAvg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskWeightedIoTimeAvg.SetValuePr(val,"average within the collection interval");
+ EVEL_EXIT();
+ }
+
+
+ public void evel_measurement_disk_use_diskWeightedIoTimeLast_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskWeightedIoTimeLast.SetValuePr(val,"last within the collection interval.");
+ EVEL_EXIT();
+ }
+
+ public void evel_measurement_disk_use_diskWeightedIoTimeMax_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskWeightedIoTimeMax.SetValuePr(val,"maximum within the collection interval.");
+ EVEL_EXIT();
+ }
+
+ public void evel_measurement_disk_use_diskWeightedIoTimeMin_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskWeightedIoTimeMin.SetValuePr(val,"minimum within the collection interval.");
+ 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 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_diskBusResets_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskBusResets.SetValuePr(val,"Disk Bus Resets");
+ 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 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_diskCommandsAborted_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskCommandsAborted.SetValuePr(val,"Disk ioload set");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Average number of commands per second.
+ *
+ * @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_diskCommandsAvg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskCommandsAvg.SetValuePr(val,"Average number of commands per second");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Total flush requests of the disk 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 disk_use Pointer to the Disk Use.
+ * @param val double
+ *****************************************************************************/
+ public void evel_measurement_disk_use_diskFlushRequests_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskFlushRequests.SetValuePr(val,"Total flush requests");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Average number of read commands issued per second to the disk during the collection 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_diskReadCommandsAvg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskReadCommandsAvg.SetValuePr(val,"Average number of read commands issued per second to the disk during the collection interval.");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Total time spent on disk cache flushing in milliseconds.
+ *
+ * @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_diskFlushTime_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskFlushTime.SetValuePr(val,"Total time spent on disk cache flushing in milliseconds.");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Total time spent on disk cache reads/writes in nanoseconds
+ * @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_diskTime_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskTime.SetValuePr(val,"Total time spent on disk cache reads/writes in nanoseconds");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set The average amount of time taken for a read from the perspective of a Guest OS. This is the sum of Kernel Read Latency and Physical Device Read Latency.
+ * @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_diskTotalReadLatencyAvg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskTotalReadLatencyAvg.SetValuePr(val,"The average amount of time taken for a read from the perspective of a Guest OS. This is the sum of Kernel Read Latency and Physical Device Read Latency.");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set The average amount of time taken for a write from the perspective of a Guest OS. This is the sum of Kernel Write Latency and Physical Device Write Latency.
+ *
+ * @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_diskTotalWriteLatencyAvg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskTotalWriteLatencyAvg.SetValuePr(val,"The average amount of time taken for a write from the perspective of a Guest OS. This is the sum of Kernel Write Latency and Physical Device Write Latency.");
+ EVEL_EXIT();
+ }
+ /**************************************************************************//**
+ * Set Average number of write commands issued per second to the disk during the collection 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_diskWriteCommandsAvg_set(MEASUREMENT_DISK_USE disk_use,
+ double val)
+ {
+ EVEL_ENTER();
+ disk_use.diskWriteCommandsAvg.SetValuePr(val,"Average number of write commands issued per second to the disk during the collection interval.");
+ 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;
@@ -1822,7 +4004,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @param ephemeral_used Ephemeral storage in use.
* @param ephemeral_iops Ephemeral storage IOPS.
*****************************************************************************/
- public void evel_measurement_fsys_use_add(
+ public MEASUREMENT_FSYS_USE evel_measurement_fsys_use_add(
String filesystem_name,
double block_configured,
double block_used,
@@ -1868,6 +4050,8 @@ public class EvelScalingMeasurement extends EvelHeader { filesystem_usage.add(fsys_use);
EVEL_EXIT();
+
+ return fsys_use;
}
/**************************************************************************//**
@@ -1881,7 +4065,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @param feature ASCIIZ string with the feature's name.
* @param utilization Utilization of the feature.
*****************************************************************************/
- public void evel_measurement_feature_use_add(
+ public MEASUREMENT_FEATURE_USE evel_measurement_feature_use_add(
String feature,
int utilization)
{
@@ -1913,6 +4097,7 @@ public class EvelScalingMeasurement extends EvelHeader { feature_usage.add(feature_use);
EVEL_EXIT();
+ return feature_use;
}
/**************************************************************************//**
@@ -2013,7 +4198,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public MEASUREMENT_CODEC_USE evel_measurement_codec_use_add( String codec,
int utilization )
{
MEASUREMENT_CODEC_USE codec_use = null;
@@ -2043,6 +4228,8 @@ public class EvelScalingMeasurement extends EvelHeader { codec_usage.add(codec_use);
EVEL_EXIT();
+
+ return codec_use;
}
@@ -2210,6 +4397,8 @@ public class EvelScalingMeasurement extends EvelHeader { latency_distribution.add(bucket);
EVEL_EXIT();
+
+
}
/**************************************************************************//**
@@ -2222,7 +4411,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @param high_end High end of the bucket's range.
* @param count Count of events in this bucket.
*****************************************************************************/
- public void evel_measurement_latency_add(
+ public MEASUREMENT_LATENCY_BUCKET evel_measurement_latency_add(
double low_end,
double high_end,
int count)
@@ -2240,29 +4429,31 @@ public class EvelScalingMeasurement extends EvelHeader { evel_meas_latency_bucket_add(bucket);
EVEL_EXIT();
+
+ return bucket;
}
/**************************************************************************//**
* Create a new vNIC Use to be added to a Measurement event.
*
- * @note The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied
+ * @note The mandatory fields on the ::MEASUREMENT_NIC_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
+ * set once so that the ::MEASUREMENT_NIC_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.
+ * @returns pointer to the newly manufactured ::MEASUREMENT_NIC_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)
+ public MEASUREMENT_NIC_PERFORMANCE evel_measurement_new_vnic_performance(String vnic_id,
+ String val_suspect)
{
- MEASUREMENT_VNIC_PERFORMANCE vnic_perf=null;
+ MEASUREMENT_NIC_PERFORMANCE vnic_perf=null;
EVEL_ENTER();
@@ -2276,11 +4467,14 @@ public class EvelScalingMeasurement extends EvelHeader { /* Allocate, then set Mandatory Parameters. */
/***************************************************************************/
- vnic_perf = new MEASUREMENT_VNIC_PERFORMANCE();
+ vnic_perf = new MEASUREMENT_NIC_PERFORMANCE();
assert(vnic_perf != null);
vnic_perf.vnic_id = vnic_id;
vnic_perf.valuesaresuspect = val_suspect;
+ //VES6.0 added field 14July
+ //vnic_perf.nicIdentifier = nicIdentifier;
+
vnic_perf.recvd_bcast_packets_acc= new EvelOptionDouble();
vnic_perf.recvd_bcast_packets_delta= new EvelOptionDouble();
@@ -2311,6 +4505,19 @@ public class EvelScalingMeasurement extends EvelHeader { vnic_perf.tx_ucast_packets_acc= new EvelOptionDouble();
vnic_perf.tx_ucast_packets_delta= new EvelOptionDouble();
+
+ vnic_perf.administrativeState= new EvelOptionDouble();
+ vnic_perf.operationalState= new EvelOptionDouble();
+ vnic_perf.receivedPercentDiscard= new EvelOptionDouble();
+ vnic_perf.receivedPercentError= new EvelOptionDouble();
+ vnic_perf.receivedUtilization= new EvelOptionDouble();
+ vnic_perf.speed= new EvelOptionString();
+ vnic_perf.transmittedPercentDiscard= new EvelOptionDouble();
+ vnic_perf.transmittedPercentError= new EvelOptionDouble();
+ vnic_perf.transmittedUtilization= new EvelOptionDouble();
+
+
+
LOGGER.debug("Adding "+vnic_perf+"VNIC ID="+ vnic_perf.vnic_id+"Value="+vnic_perf.valuesaresuspect);
/***************************************************************************/
@@ -2334,7 +4541,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_bcast_packets_acc)
{
EVEL_ENTER();
@@ -2362,7 +4569,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_bcast_packets_delta)
{
EVEL_ENTER();
@@ -2391,7 +4598,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_discard_packets_acc)
{
EVEL_ENTER();
@@ -2419,7 +4626,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_discard_packets_delta)
{
EVEL_ENTER();
@@ -2448,7 +4655,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_error_packets_acc)
{
EVEL_ENTER();
@@ -2476,7 +4683,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_error_packets_delta)
{
EVEL_ENTER();
@@ -2504,7 +4711,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_mcast_packets_acc)
{
EVEL_ENTER();
@@ -2532,7 +4739,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_mcast_packets_delta)
{
EVEL_ENTER();
@@ -2560,7 +4767,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_octets_acc)
{
EVEL_ENTER();
@@ -2588,7 +4795,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_octets_delta)
{
EVEL_ENTER();
@@ -2616,7 +4823,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_total_packets_acc)
{
EVEL_ENTER();
@@ -2644,7 +4851,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_total_packets_delta)
{
EVEL_ENTER();
@@ -2672,7 +4879,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_ucast_packets_acc)
{
EVEL_ENTER();
@@ -2700,7 +4907,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double recvd_ucast_packets_delta)
{
EVEL_ENTER();
@@ -2728,7 +4935,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_bcast_packets_acc)
{
EVEL_ENTER();
@@ -2756,7 +4963,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_bcast_packets_delta)
{
EVEL_ENTER();
@@ -2784,7 +4991,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_discarded_packets_acc)
{
EVEL_ENTER();
@@ -2812,7 +5019,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_discarded_packets_delta)
{
EVEL_ENTER();
@@ -2840,7 +5047,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_error_packets_acc)
{
EVEL_ENTER();
@@ -2868,7 +5075,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_error_packets_delta)
{
EVEL_ENTER();
@@ -2896,7 +5103,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_mcast_packets_acc)
{
EVEL_ENTER();
@@ -2924,7 +5131,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_mcast_packets_delta)
{
EVEL_ENTER();
@@ -2952,7 +5159,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_octets_acc)
{
EVEL_ENTER();
@@ -2980,7 +5187,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_octets_delta)
{
EVEL_ENTER();
@@ -3009,7 +5216,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_total_packets_acc)
{
EVEL_ENTER();
@@ -3037,7 +5244,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_total_packets_delta)
{
EVEL_ENTER();
@@ -3066,7 +5273,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_ucast_pkt_acc_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_ucast_packets_acc)
{
EVEL_ENTER();
@@ -3094,7 +5301,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @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,
+ public void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
double tx_ucast_packets_delta)
{
EVEL_ENTER();
@@ -3110,6 +5317,159 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT();
}
+
+ /*
+ * VES6.0 UPDATE 19JULY
+ */
+
+ public void evel_vnic_performance_administrativeState_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double administrativeState)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(administrativeState >= 0.0);
+
+ vnic_performance.administrativeState.SetValuePr(
+ administrativeState,"Administrative State");
+
+ EVEL_EXIT();
+ }
+
+
+
+ public void evel_vnic_performance_operationalState_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double operationalState)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(operationalState >= 0.0);
+
+ vnic_performance.operationalState.SetValuePr(
+ operationalState,"operational State");
+
+ EVEL_EXIT();
+ }
+
+ public void evel_vnic_performance_receivedPercentDiscard_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double receivedPercentDiscard)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(receivedPercentDiscard >= 0.0);
+
+ vnic_performance.receivedPercentDiscard.SetValuePr(
+ receivedPercentDiscard,"Received Percent Discard");
+
+ EVEL_EXIT();
+ }
+
+ public void evel_vnic_performance_receivedPercentError_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double receivedPercentError)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(receivedPercentError >= 0.0);
+
+ vnic_performance.receivedPercentError.SetValuePr(
+ receivedPercentError,"Received Percent Error");
+
+ EVEL_EXIT();
+ }
+
+ public void evel_vnic_performance_receivedUtilization_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double receivedUtilization)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(receivedUtilization >= 0.0);
+
+ vnic_performance.receivedUtilization.SetValuePr(
+ receivedUtilization,"Received Utilization");
+
+ EVEL_EXIT();
+ }
+
+ public void evel_vnic_performance_speed_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ String speed)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(speed != null);
+
+ vnic_performance.speed.SetValuePr(
+ speed,"Speed");
+
+ EVEL_EXIT();
+ }
+
+ public void evel_vnic_performance_transmittedPercentDiscard_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double transmittedPercentDiscard)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(transmittedPercentDiscard >= 0.0);
+
+ vnic_performance.transmittedPercentDiscard.SetValuePr(
+ transmittedPercentDiscard,"Transmitted Percent Discard");
+
+ EVEL_EXIT();
+ }
+
+ public void evel_vnic_performance_transmittedPercentError_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double transmittedPercentError)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(transmittedPercentError >= 0.0);
+
+ vnic_performance.transmittedPercentError.SetValuePr(
+ transmittedPercentError,"Transmitted Percent Error");
+
+ EVEL_EXIT();
+ }
+
+ public void evel_vnic_performance_transmittedUtilization_set(MEASUREMENT_NIC_PERFORMANCE vnic_performance,
+ double transmittedUtilization)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(transmittedUtilization >= 0.0);
+
+ vnic_performance.transmittedUtilization.SetValuePr(
+ transmittedUtilization,"transmittedUtilization");
+
+ EVEL_EXIT();
+ }
+
+
+
/**************************************************************************//**
@@ -3119,7 +5479,7 @@ public class EvelScalingMeasurement extends EvelHeader { * @param vnic_performance Pointer to the vNIC Use to add.
*****************************************************************************/
public void evel_meas_vnic_performance_add(
- MEASUREMENT_VNIC_PERFORMANCE vnic_performance)
+ MEASUREMENT_NIC_PERFORMANCE vnic_performance)
{
EVEL_ENTER();
@@ -3131,7 +5491,7 @@ public class EvelScalingMeasurement extends EvelHeader { assert(vnic_performance != null);
if( vnic_usage == null ){
- vnic_usage = new ArrayList<MEASUREMENT_VNIC_PERFORMANCE>();
+ vnic_usage = new ArrayList<MEASUREMENT_NIC_PERFORMANCE>();
LOGGER.debug("Allocate new file system usage");
}
@@ -3183,6 +5543,9 @@ public class EvelScalingMeasurement extends EvelHeader { public void evel_measurement_vnic_performance_add(
String vnic_id,
String valset,
+ //VES6.0 added field 14July
+ //String nicIdentifier,
+ String speed,
double recvd_bcast_packets_acc,
double recvd_bcast_packets_delta,
double recvd_discarded_packets_acc,
@@ -3210,14 +5573,26 @@ public class EvelScalingMeasurement extends EvelHeader { double tx_total_packets_acc,
double tx_total_packets_delta,
double tx_ucast_packets_acc,
- double tx_ucast_packets_delta)
+ double tx_ucast_packets_delta,
+ //VES6.0 addded fileds 19July
+ double administrativeState,
+ double operationalState,
+ double receivedPercentDiscard,
+ double receivedPercentError,
+ double receivedUtilization,
+
+ double transmittedPercentDiscard,
+ double transmittedPercentError,
+ double transmittedUtilization
+ )
{
- MEASUREMENT_VNIC_PERFORMANCE vnic_performance = null;
+ MEASUREMENT_NIC_PERFORMANCE vnic_performance = null;
EVEL_ENTER();
/***************************************************************************/
/* Trust the assertions in the underlying methods. */
/***************************************************************************/
+ //VES6.0 added field 14July
vnic_performance = evel_measurement_new_vnic_performance(vnic_id, valset);
evel_vnic_performance_rx_bcast_pkt_acc_set(vnic_performance, recvd_bcast_packets_acc);
@@ -3249,8 +5624,23 @@ public class EvelScalingMeasurement extends EvelHeader { 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);
+ //VES6.0 added fields 19July
+
+ evel_vnic_performance_administrativeState_set(vnic_performance, administrativeState);
+ evel_vnic_performance_operationalState_set(vnic_performance, operationalState);
+ evel_vnic_performance_receivedPercentDiscard_set(vnic_performance, receivedPercentDiscard);
+ evel_vnic_performance_receivedPercentError_set(vnic_performance, receivedPercentError);
+ evel_vnic_performance_receivedUtilization_set(vnic_performance, receivedUtilization);
+ evel_vnic_performance_speed_set(vnic_performance, speed);
+ evel_vnic_performance_transmittedPercentDiscard_set(vnic_performance, transmittedPercentDiscard);
+ evel_vnic_performance_transmittedPercentError_set(vnic_performance, transmittedPercentError);
+ evel_vnic_performance_transmittedUtilization_set(vnic_performance, transmittedUtilization);
+
+
+
+
if( vnic_usage == null ){
- vnic_usage = new ArrayList<MEASUREMENT_VNIC_PERFORMANCE>();
+ vnic_usage = new ArrayList<MEASUREMENT_NIC_PERFORMANCE>();
LOGGER.debug("Allocate new file system usage");
}
@@ -3292,6 +5682,7 @@ public class EvelScalingMeasurement extends EvelHeader { *
* @retval JSON Object of Scaling Measurement event
*****************************************************************************/
+ @SuppressWarnings("null")
JsonObjectBuilder evelScalingMeasurementObject()
{
MEASUREMENT_CPU_USE cpu_use = null;
@@ -3299,17 +5690,36 @@ public class EvelScalingMeasurement extends EvelHeader { MEASUREMENT_DISK_USE disk_use = null;
MEASUREMENT_FSYS_USE fsys_use = null;
MEASUREMENT_LATENCY_BUCKET bucket = null;
- MEASUREMENT_VNIC_PERFORMANCE vnic_use = null;
+ MEASUREMENT_NIC_PERFORMANCE nic_use = null;
MEASUREMENT_FEATURE_USE feature_use = null;
MEASUREMENT_CODEC_USE codec_use = null;
MEASUREMENT_GROUP meas_group = null;
CUSTOM_MEASUREMENT custom_meas = null;
+
+ MEASUREMENT_IPMI ipmij = null;
+ MEASUREMENT_LOAD load = null;
+ MEASUREMENT_PROCESS_STATS process_stats = null;
+ MACHINE_CHECK_EXCEPTION check_exception = null;
+
+ MEASUREMENT_HUGE_PAGE hugePage = null;
+
+
+ MEASUREMENT_IPMI_PROCESSOR ipmiProcessorJson = null;
+ IPMIglobalAggregateTemperatureMargin ipmiGlobalAggTempMarginJson;
+ Processor_DIMMaggregate_Thermal_Margin ipmiProcessorDIMMagregatejson = null;
+ IPMIpowerSupply ipmiPowerSupplyJson;
+ IPMIbattery ipmiBatteryJson;
+ IPMINIC ipmiNicJson;
+ IPMIHSBP ipmiHsbpJson;
+ IPMIbaseboardTemperature ipmiBaseBoardTempJson;
+ IPMIbaseboardvoltageResulator ipmiBaseboardVoltageResultatorJson;
+ IPMIfan ipmifanjson;
//DLIST_ITEM item = null;
//DLIST_ITEM nested_item = null;
//DLIST_ITEM addl_info_item = null;
//OTHER_FIELD addl_info = null;
- double version = major_version+(double)minor_version/10;
-
+// double version = major_version+(double)minor_version/10;
+ String version = "4.0";
EVEL_ENTER();
/***************************************************************************/
@@ -3327,26 +5737,143 @@ public class EvelScalingMeasurement extends EvelHeader { /* Optional fields. */
/***************************************************************************/
// additional fields
- if( additional_info != null )
- {
- JsonArrayBuilder builder = Json.createArrayBuilder();
- for(int i=0;i<additional_info.size();i++) {
- String[] addl_info = additional_info.get(i);
- JsonObject obj = Json.createObjectBuilder()
- .add("name", addl_info[0])
- .add("value", addl_info[1]).build();
- builder.add(obj);
- }
- evelmeasmt.add("additionalFields", builder);
- }
+// if( additional_info != null )
+// {
+// JsonArrayBuilder builder = Json.createArrayBuilder();
+// for(int i=0;i<additional_info.size();i++) {
+// String[] addl_info = additional_info.get(i);
+// JsonObject obj = Json.createObjectBuilder()
+// .add("name", addl_info[0])
+// .add("value", addl_info[1]).build();
+// builder.add(obj);
+// }
+// evelmeasmt.add("additionalFields", builder);
+// }
+
+ if(additional_inf != null) {
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ //JsonArrayBuilder builder = Json.createArrayBuilder();
+ Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
+ String addl_info_key = add_inf.getKey();
+ String addl_info_value = add_inf.getValue();
+// JsonObject obj1 = Json.createObjectBuilder()
+// .add("name", addl_info_key)
+// .add("value", addl_info_value).build();
+ builder.add(addl_info_key, addl_info_value);
+ }
+ 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());
-
+ /*******************************************************************************
+ * MEASUREMENT Load
+ *******************************************************************************/
+ if(loads != null && loads.size() >0) {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<loads.size();i++) {
+ load = loads.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder();
+ // .add("loadIdentifier", load.loadIdentifier);
+ load.longTerm.encJsonValue(obj,"longTerm");
+ load.midTerm.encJsonValue(obj,"midTerm");
+ load.shortTerm.encJsonValue(obj,"shortTerm");
+ builder.add(obj.build());
+
+ }
+ evelmeasmt.add("loadArray", builder);
+ }
+
+ /***************************************************************************/
+ /* process_stats */
+ /***************************************************************************/
+ if(this.process_stats!=null && this.process_stats.size()>0) {
+
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<this.process_stats.size();i++) {
+ process_stats = this.process_stats.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add("processIdentifier", process_stats.processIdentifier);
+ process_stats.forkRate.encJsonValue(obj, "forkRate");
+ process_stats.psStateBlocked.encJsonValue(obj, "psStateBlocked");
+ process_stats.psStatePaging.encJsonValue(obj, "psStatePaging");
+ process_stats.psStateRunning.encJsonValue(obj, "psStateRunning");
+ process_stats.psStateSleeping.encJsonValue(obj, "psStateSleeping");
+ process_stats.psStateStopped.encJsonValue(obj, "psStateStopped");
+ process_stats.psStateZombie.encJsonValue(obj, "psStateZombie");
+
+ builder.add(obj.build());
+
+
+
+ }
+ evelmeasmt.add("processStatsArray", builder);
+ }
+
+ /***************************************************************************/
+ /* MACHINE_Check_Exception */
+ /***************************************************************************/
+ if( machineCheckException != null && machineCheckException.size()>0) {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<machineCheckException.size();i++) {
+ check_exception = machineCheckException.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder()
+ .add( "vmIdentifier", check_exception.processIdentifier);
+ check_exception.correctedMemoryErrors.encJsonValue(obj, "correctedMemoryErrors");
+ check_exception.correctedMemoryErrors_In1Hr.encJsonValue(obj, "correctedMemoryErrorsIn1Hr");
+ check_exception.uncorrectedMemoryErrors.encJsonValue(obj, "uncorrectedMemoryErrors");
+ check_exception.uncorrectedMemoryErrors_In1Hr.encJsonValue(obj, "uncorrectedMemoryErrorsIn1Hr");
+
+ builder.add(obj.build());
+
+ }
+ evelmeasmt.add("machineCheckExceptionArray", builder);
+ }
+
+
+ /***************************************************************************/
+ /* MACHINE_Check_Exception */
+ /***************************************************************************/
+ if( huge_pages != null && huge_pages.size()>0) {
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ for(int i=0;i<huge_pages.size();i++) {
+ hugePage = huge_pages.get(i);
+ JsonObjectBuilder obj = Json.createObjectBuilder();
+ obj.add( "hugePagesIdentifier", hugePage.hugePagesIdentifier);
+ obj.add( "bytesUsed", hugePage.bytesUsed);
+
+
+
+ obj.add("bytesFree", hugePage.bytesFree.value);
+ obj.add("vmPageNumberUsed", hugePage.vmPageNumberUsed.value);
+ obj.add( "vmPageNumberFree", hugePage.vmPageNumberFree.value);
+ obj.add( "percentUsed", hugePage.percentUsed.value);
+ obj.add( "percentFree", hugePage.percentFree.value);
+
+// obj.add( "bytesFree", hugePage.bytesFree);
+// obj.add( "vmPageNumberUsed", hugePage.vmPageNumberUsed);
+// obj.add( "vmPageNumberFree", hugePage.vmPageNumberFree);
+// obj.add( "percentUsed", hugePage.percentUsed);
+// obj.add( "percentFree", hugePage.percentFree);
+
+
+// hugePage.correctedMemoryErrors.encJsonValue(obj, "correctedMemoryErrors");
+// hugePage.correctedMemoryErrors_In1Hr.encJsonValue(obj, "correctedMemoryErrorsIn1Hr");
+// hugePage.uncorrectedMemoryErrors.encJsonValue(obj, "uncorrectedMemoryErrors");
+// hugePage.uncorrectedMemoryErrors_In1Hr.encJsonValue(obj, "uncorrectedMemoryErrorsIn1Hr");
+
+ builder.add(obj.build());
+
+ }
+ evelmeasmt.add("hugePagesArray", builder);
+ }
+
/***************************************************************************/
/* CPU Use list. */
/***************************************************************************/
@@ -3366,14 +5893,224 @@ public class EvelScalingMeasurement extends EvelHeader { cpu_use.steal.encJsonValue(obj,"cpuUsageSteal");
cpu_use.sys.encJsonValue(obj,"cpuUsageSystem");
cpu_use.user.encJsonValue(obj,"cpuUsageUser");
- cpu_use.wait.encJsonValue(obj,"cpuWait");
-
+ cpu_use.wait.encJsonValue(obj,"cpuWait");
+ /*********************
+ * VES6.0 added fields 14/07/2018
+ */
+ cpu_use.cpuCapacityContention.encJsonValue(obj,"cpuCapacityContention");
+ cpu_use.cpuDemandAvg.encJsonValue(obj,"cpuDemandAvg");
+ cpu_use.cpuDemandMhz.encJsonValue(obj,"cpuDemandMhz");
+ cpu_use.cpuDemandPct.encJsonValue(obj,"cpuDemandPct");
+ cpu_use.cpuLatencyAvg.encJsonValue(obj,"cpuLatencyAvg");
+ cpu_use.cpuOverheadAvg.encJsonValue(obj,"cpuOverheadAvg");
+ cpu_use.cpuSwapWaitTime.encJsonValue(obj,"cpuSwapWaitTime");
builder.add(obj.build());
}
evelmeasmt.add("cpuUsageArray", builder);
}
-
+ if(ipmis != null && ipmis.size() > 0) {
+ JsonObjectBuilder builder1 = Json.createObjectBuilder();
+ JsonArrayBuilder builder = Json.createArrayBuilder();
+ System.out.println("ipmis size---"+ ipmis.size());
+ for(int i=0;i<ipmis.size();i++) {
+ ipmij = ipmis.get(i);
+ // JsonObjectBuilder obj= null;
+ JsonObjectBuilder obj = Json.createObjectBuilder();
+ ipmij.exitAirTemperature.encJsonValue(obj, "exitAirTemperature");
+ ipmij.frontPanelTemperature.encJsonValue(obj, "frontPanelTemperature");
+ ipmij.ioModuleTemperature.encJsonValue(obj, "ioModuleTemperature");
+ ipmij.systemAirflow.encJsonValue(obj, "systemAirflow");
+
+
+ if(ipmij.ipmiprocessor != null && ipmij.ipmiprocessor.size() > 0 ) {
+ JsonArrayBuilder ipmi_processor_builder = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmiprocessor.size();j++) {
+ ipmiProcessorJson = ipmij.ipmiprocessor.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("processorIdentifier", ipmiProcessorJson.processorIdentifier);
+ ipmiProcessorJson.processorDTSthermalMargin.encJsonValue(obj1 , "processorDTSthermalMargin");
+ ipmiProcessorJson.processorThermalControlPercent.encJsonValue(obj1, "processorThermalControlPercent");
+ if(ipmiProcessorJson.processorDIMMaggregateThermalMargin != null &&
+ ipmiProcessorJson.processorDIMMaggregateThermalMargin.size() > 0) {
+ JsonArrayBuilder ipmi_procesor_DTS_thermal_margin = Json.createArrayBuilder();
+ for( int k=0 ;k<ipmiProcessorJson.processorDIMMaggregateThermalMargin.size();k++) {
+
+ ipmiProcessorDIMMagregatejson = ipmiProcessorJson.processorDIMMaggregateThermalMargin.get(k);
+ JsonObjectBuilder obj2 = Json.createObjectBuilder().add("processorDIMMaggregateThermalMarginIdentifier", ipmiProcessorDIMMagregatejson.processorDIMMaggregateThermalMarginIdentifier)
+ .add("processorDIMMaggregateThermalMargin", ipmiProcessorDIMMagregatejson.processorDIMMaggregateThermalMargin);
+
+ ipmi_procesor_DTS_thermal_margin.add(obj2.build());
+ }
+ obj1.add("processorDIMMaggregateThermalMargin", ipmi_procesor_DTS_thermal_margin );
+
+ }
+
+ ipmi_processor_builder.add(obj1.build());
+
+ }
+ // obj.add("ipmiProcessorArray", ipmi_processor_builder);
+ builder1.add("ipmiProcessorArray", ipmi_processor_builder);
+ }
+
+
+ if(ipmij.ipmiglobalAggregateTemperatureMarginArray != null &&
+ ipmij.ipmiglobalAggregateTemperatureMarginArray.size()>0) {
+
+ JsonArrayBuilder ipmi_global_aggregate_tepmerature_margin_array = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmiglobalAggregateTemperatureMarginArray.size();j++) {
+ ipmiGlobalAggTempMarginJson = ipmij.ipmiglobalAggregateTemperatureMarginArray.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("globalAggregateTemperatureMarginIdentifier", ipmiGlobalAggTempMarginJson.globalAggregateTemperatureMarginIdentifier);
+ ipmiGlobalAggTempMarginJson.globalAggregateTemeratureMargin.encJsonValue(obj1, "globalAggregateTemeratureMargin");
+
+ ipmi_global_aggregate_tepmerature_margin_array.add(obj1.build());
+ }
+
+ // obj.add("globalAggregateTemperatureMarginArray", ipmi_global_aggregate_tepmerature_margin_array );
+ builder1.add("globalAggregateTemperatureMarginArray", ipmi_global_aggregate_tepmerature_margin_array);
+ }
+
+
+
+ if(ipmij.ipmipowerSupply != null &&
+ ipmij.ipmipowerSupply.size()>0) {
+
+ JsonArrayBuilder ipmi_power_supply_array = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmipowerSupply.size();j++) {
+ ipmiPowerSupplyJson = ipmij.ipmipowerSupply.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("powerSupplyIdentifier", ipmiPowerSupplyJson.powerSupplyIdentifier);
+ ipmiPowerSupplyJson.powerSupplycurrentOutputPercent.encJsonValue(obj1, "powerSupplycurrentOutputPercent");
+ ipmiPowerSupplyJson.powerSupplyInputPower.encJsonValue(obj1, "powerSupplyInputPower");
+ ipmiPowerSupplyJson.powerSupplyTemperature.encJsonValue(obj1, "powerSupplyTemperature");
+
+ ipmi_power_supply_array.add(obj1.build());
+ }
+
+ // obj.add("ipmiPowerSupplyArray", ipmi_power_supply_array );
+ builder1.add("ipmiPowerSupplyArray", ipmi_power_supply_array);
+ }
+
+ if(ipmij.ipmibattery != null && ipmij.ipmibattery.size()>0) {
+
+ JsonArrayBuilder ipmi_battery_array = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmibattery.size();j++) {
+ ipmiBatteryJson = ipmij.ipmibattery.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("batteryIdentifier", ipmiBatteryJson.batteryIdentifier);
+ ipmiBatteryJson.batteryType.encJsonValue(obj1, "batteryType");
+ ipmiBatteryJson.batteryVoltageLevel.encJsonValue(obj1, "batteryVoltageLevel");
+
+
+ ipmi_battery_array.add(obj1.build());
+ }
+
+ // obj.add("ipmiBatteryArray", ipmi_battery_array );
+ builder1.add("ipmiBatteryArray", ipmi_battery_array);
+
+
+ }
+
+
+ if(ipmij.ipmiNIC != null && ipmij.ipmiNIC.size()>0) {
+
+ JsonArrayBuilder ipmi_Nic_array = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmiNIC.size();j++) {
+ ipmiNicJson = ipmij.ipmiNIC.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("nicIdentifier", ipmiNicJson.nic_Identifier);
+ ipmiNicJson.nic_Temperature.encJsonValue(obj1, "nicIdentifier");
+
+
+
+ ipmi_Nic_array.add(obj1.build());
+ }
+
+ // obj.add("ipmiNicArray", ipmi_Nic_array );
+ builder1.add("ipmiNicArray", ipmi_Nic_array);
+
+ }
+ if(ipmij.ipmiHSBP != null && ipmij.ipmiHSBP.size()>0) {
+
+ JsonArrayBuilder ipmi_HSBP_array = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmiHSBP.size();j++) {
+ ipmiHsbpJson = ipmij.ipmiHSBP.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("hsbpIdentifier", ipmiHsbpJson.hsbpIdentifier);
+ ipmiHsbpJson.hsbpTemperature.encJsonValue(obj1, "hsbpTemperature");
+
+
+
+ ipmi_HSBP_array.add(obj1.build());
+ }
+
+ // obj.add("ipmiHsbpArray", ipmi_HSBP_array );
+ builder1.add("ipmiHsbpArray", ipmi_HSBP_array);
+
+ }
+
+
+ if(ipmij.ipmibaseboardTemperature!= null && ipmij.ipmibaseboardTemperature.size()>0) {
+
+ JsonArrayBuilder ipmi_baseboard_Temperature_array = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmibaseboardTemperature.size();j++) {
+ ipmiBaseBoardTempJson = ipmij.ipmibaseboardTemperature.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("baseboardTemperatureIdentifier", ipmiBaseBoardTempJson.baseboardTemperatureIdentifier);
+ ipmiBaseBoardTempJson.baseboardTemperature.encJsonValue(obj1, "baseboardTemperature");
+
+
+
+ ipmi_baseboard_Temperature_array.add(obj1.build());
+ }
+
+ // obj.add("ipmiBaseboardTemperatureArray", ipmi_baseboard_Temperature_array );
+ builder1.add("ipmiBaseboardTemperatureArray", ipmi_baseboard_Temperature_array);
+
+ }
+
+ if(ipmij.ipmiBaseboardvoltageResulator!= null && ipmij.ipmiBaseboardvoltageResulator.size()>0) {
+
+ JsonArrayBuilder ipmi_Baseboardvoltage_Resulator = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmiBaseboardvoltageResulator.size();j++) {
+ ipmiBaseboardVoltageResultatorJson = ipmij.ipmiBaseboardvoltageResulator.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("baseboardVoltageRegulatorIdentifier",
+ ipmiBaseboardVoltageResultatorJson.baseboardVoltageRegulatorIdentifier);
+ ipmiBaseboardVoltageResultatorJson.voltageRegulatorTemperature.encJsonValue(obj1, "baseboardTemperature");
+
+
+
+ ipmi_Baseboardvoltage_Resulator.add(obj1.build());
+ }
+
+ // obj.add("ipmiBaseboardVoltageRegulatorArray", ipmi_Baseboardvoltage_Resulator );
+ builder1.add("ipmiBaseboardVoltageRegulatorArray", ipmi_Baseboardvoltage_Resulator);
+
+ }
+
+ if(ipmij.ipmiFan!= null && ipmij.ipmiFan.size()>0) {
+
+ JsonArrayBuilder ipmi_Fan = Json.createArrayBuilder();
+ for(int j=0; j<ipmij.ipmiFan.size();j++) {
+ ipmifanjson = ipmij.ipmiFan.get(j);
+ JsonObjectBuilder obj1 = Json.createObjectBuilder().add("fanIdentifier",
+ ipmifanjson.fanIdentifier);
+ ipmifanjson.fanSpeed.encJsonValue(obj1, "fanSpeed");
+
+
+
+ ipmi_Fan.add(obj1.build());
+ }
+
+ // obj.add("ipmiFanArray", ipmi_Fan );
+ builder1.add("ipmiFanArray", ipmi_Fan);
+
+ }
+
+
+
+
+
+
+ builder.add(obj.build());
+ }
+ //evelmeasmt.add("ipmi", builder) ;
+ evelmeasmt.add("ipmi", builder1) ;
+ }
/***************************************************************************/
/* Disk Use list. */
@@ -3426,6 +6163,24 @@ public class EvelScalingMeasurement extends EvelHeader { disk_use.timewritelast.encJsonValue(obj,"diskTimeWriteLast");
disk_use.timewritemax.encJsonValue(obj,"diskTimeWriteMax");
disk_use.timewritemin.encJsonValue(obj,"diskTimeWriteMin");
+
+ disk_use.diskTime.encJsonValue(obj, "diskTime");
+ disk_use.diskFlushRequests.encJsonValue(obj, "diskFlushRequests");
+ disk_use.diskFlushTime.encJsonValue(obj, "diskFlushTime");
+ disk_use.diskCommandsAvg.encJsonValue(obj, "diskCommandsAvg");
+ disk_use.diskReadCommandsAvg.encJsonValue(obj, "diskReadCommandsAvg");
+ disk_use.diskWriteCommandsAvg.encJsonValue(obj, "diskWriteCommandsAvg");
+ disk_use.diskCommandsAborted.encJsonValue(obj, "diskCommandsAborted");
+ disk_use.diskBusResets.encJsonValue(obj, "diskBusResets");
+ disk_use.diskTotalReadLatencyAvg.encJsonValue(obj, "diskTotalReadLatencyAvg");
+ disk_use.diskTotalWriteLatencyAvg.encJsonValue(obj, "diskTotalWriteLatencyAvg");
+
+ disk_use.diskWeightedIoTimeAvg.encJsonValue(obj, "diskWeightedIoTimeAvg");
+ disk_use.diskWeightedIoTimeLast.encJsonValue(obj, "diskWeightedIoTimeLast");
+ disk_use.diskWeightedIoTimeMax.encJsonValue(obj, "diskWeightedIoTimeMax");
+ disk_use.diskWeightedIoTimeMin.encJsonValue(obj, "diskWeightedIoTimeMin");
+
+
builder.add(obj.build());
}
@@ -3484,52 +6239,67 @@ public class EvelScalingMeasurement extends EvelHeader { {
JsonArrayBuilder builder = Json.createArrayBuilder();
for(int i=0;i<vnic_usage.size();i++) {
- vnic_use = vnic_usage.get(i);
+ nic_use = vnic_usage.get(i);
JsonObjectBuilder obj = Json.createObjectBuilder()
- .add( "vNicIdentifier", vnic_use.vnic_id)
- .add( "valuesAreSuspect",vnic_use.valuesaresuspect);
+ .add( "nicIdentifier", nic_use.vnic_id)
+ .add( "valuesAreSuspect",nic_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");
+ nic_use.recvd_bcast_packets_acc.encJsonValue(obj,"receivedBroadcastPacketsAccumulated");
+ nic_use.recvd_bcast_packets_delta.encJsonValue(obj,"receivedBroadcastPacketsDelta");
+ nic_use.recvd_discarded_packets_acc.encJsonValue(obj,"receivedDiscardedPacketsAccumulated");
+ nic_use.recvd_discarded_packets_delta.encJsonValue(obj,"receivedDiscardedPacketsDelta");
+ nic_use.recvd_error_packets_acc.encJsonValue(obj,"receivedErrorPacketsAccumulated");
+ nic_use.recvd_error_packets_delta.encJsonValue(obj,"receivedErrorPacketsDelta");
+
+ nic_use.recvd_mcast_packets_acc.encJsonValue(obj,"receivedMulticastPacketsAccumulated");
+ nic_use.recvd_mcast_packets_delta.encJsonValue(obj,"receivedMulticastPacketsDelta");
+ nic_use.recvd_octets_acc.encJsonValue(obj,"receivedOctetsAccumulated");
+ nic_use.recvd_octets_delta.encJsonValue(obj,"receivedOctetsDelta");
+
+ nic_use.recvd_total_packets_acc.encJsonValue(obj,"receivedTotalPacketsAccumulated");
+ nic_use.recvd_total_packets_delta.encJsonValue(obj,"receivedTotalPacketsDelta");
+ nic_use.recvd_ucast_packets_acc.encJsonValue(obj,"receivedUnicastPacketsAccumulated");
+ nic_use.recvd_ucast_packets_delta.encJsonValue(obj,"receivedUnicastPacketsDelta");
+
+ nic_use.tx_bcast_packets_acc.encJsonValue(obj,"transmittedBroadcastPacketsAccumulated");
+ nic_use.tx_bcast_packets_delta.encJsonValue(obj,"transmittedBroadcastPacketsDelta");
+ nic_use.tx_discarded_packets_acc.encJsonValue(obj,"transmittedDiscardedPacketsAccumulated");
+ nic_use.tx_discarded_packets_delta.encJsonValue(obj,"transmittedDiscardedPacketsDelta");
+
+ nic_use.tx_error_packets_acc.encJsonValue(obj,"transmittedErrorPacketsAccumulated");
+ nic_use.tx_error_packets_delta.encJsonValue(obj,"transmittedErrorPacketsDelta");
+ nic_use.tx_mcast_packets_acc.encJsonValue(obj,"transmittedMulticastPacketsAccumulated");
+ nic_use.tx_mcast_packets_delta.encJsonValue(obj,"transmittedMulticastPacketsDelta");
+
+ nic_use.tx_octets_acc.encJsonValue(obj,"transmittedOctetsAccumulated");
+ nic_use.tx_octets_delta.encJsonValue(obj,"transmittedOctetsDelta");
+ nic_use.tx_total_packets_acc.encJsonValue(obj,"transmittedTotalPacketsAccumulated");
+ nic_use.tx_total_packets_delta.encJsonValue(obj,"transmittedTotalPacketsDelta");
+ nic_use.tx_ucast_packets_acc.encJsonValue(obj,"transmittedUnicastPacketsAccumulated");
+ nic_use.tx_ucast_packets_delta.encJsonValue(obj,"transmittedUnicastPacketsDelta");
+
+ //VES6.0 added fields 19July
+ nic_use.administrativeState.encJsonValue(obj, "administrativeState");
+ nic_use.administrativeState.encJsonValue(obj, "administrativeState");
+ nic_use.operationalState.encJsonValue(obj, "operationalState");
+ nic_use.receivedPercentDiscard.encJsonValue(obj, "receivedPercentDiscard");
+ nic_use.receivedPercentError.encJsonValue(obj, "receivedPercentError");
+ nic_use.receivedUtilization.encJsonValue(obj, "receivedUtilization");
+ nic_use.speed.encJsonValue(obj, "speed");
+ nic_use.transmittedPercentDiscard.encJsonValue(obj, "transmittedPercentDiscard");
+ nic_use.transmittedPercentError.encJsonValue(obj, "transmittedPercentError");
+ nic_use.transmittedUtilization.encJsonValue(obj, "transmittedUtilization");
+
+
+
builder.add(obj.build());
}
- evelmeasmt.add("vNicPerformanceArray", builder);
+ evelmeasmt.add("nicPerformanceArray", builder);
}
@@ -3543,9 +6313,9 @@ public class EvelScalingMeasurement extends EvelHeader { 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( "memIdentifier", mem_use.id)
.add( "vmIdentifier", mem_use.vmid)
- .add( "percentUsage",mem_use.membuffsz);
+ .add( "percentMemoryUsage",mem_use.membuffsz);
mem_use.memcache.encJsonValue(obj,"memoryCached");
mem_use.memconfig.encJsonValue(obj,"memoryConfigured");
@@ -3556,37 +6326,38 @@ public class EvelScalingMeasurement extends EvelHeader { builder.add(obj.build());
}
- evelmeasmt.add("memUsageArray", builder);
+ evelmeasmt.add("memoryUsageArray", builder);
}
media_ports_in_use.encJsonValue(evelmeasmt, "numberOfMediaPortsInUse");
- vnfc_scaling_metric.encJsonValue(evelmeasmt, "vnfcScalingMetric");
+ vnfc_scaling_metric.encJsonValue(evelmeasmt, "nfcScalingMetric");
/***************************************************************************/
/* 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);
- }
+ // 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();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ // 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);
+// JsonObjectBuilder obj = Json.createObjectBuilder()
+// .add( "featureIdentifier", feature_use.feature_id)
+// .add( "featureUtilization", feature_use.feature_utilization);
- builder.add(obj.build());
+ builder.add(feature_use.feature_id, feature_use.feature_utilization+"");
}
evelmeasmt.add("featureUsageArray", builder);
}
@@ -3597,14 +6368,15 @@ public class EvelScalingMeasurement extends EvelHeader { /***************************************************************************/
if( codec_usage != null && codec_usage.size() > 0 )
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ //JsonObjectBuilder builder = Json.createObjectBuilder();
+ 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());
+ builder.add(obj);
}
evelmeasmt.add("codecUsageArray", builder);
}
@@ -3620,16 +6392,19 @@ public class EvelScalingMeasurement extends EvelHeader { meas_group = additional_measurements.get(i);
JsonObjectBuilder obj = Json.createObjectBuilder()
.add( "name", meas_group.name);
- JsonArrayBuilder builder2 = Json.createArrayBuilder();
+ JsonObjectBuilder builder2 = Json.createObjectBuilder();
+
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());
+// JsonObjectBuilder obj2 = Json.createObjectBuilder()
+// .add("name",custom_meas.name)
+// .add("value",custom_meas.value);
+ builder2.add(custom_meas.name, custom_meas.value);
}
- obj.add("arrayOfFields", builder2);
+ obj.add("hashMap", builder2);
builder.add(obj.build());
+
+
}
evelmeasmt.add("additionalMeasurements", builder);
}
@@ -3651,7 +6426,7 @@ public class EvelScalingMeasurement extends EvelHeader { /* Although optional, we always generate the version. Note that this */
/* closes the object, too. */
/***************************************************************************/
- evelmeasmt.add("measurementsForVfScalingVersion", version);
+ evelmeasmt.add("measurementFieldsVersion", version);
EVEL_EXIT();
@@ -3672,7 +6447,7 @@ public class EvelScalingMeasurement extends EvelHeader { JsonObject obj = Json.createObjectBuilder()
.add("event", Json.createObjectBuilder()
.add( "commonEventHeader",eventHeaderObject() )
- .add( "measurementsForVfScalingFields",evelScalingMeasurementObject() )
+ .add( "measurementFields",evelScalingMeasurementObject() )
).build();
EVEL_EXIT();
@@ -3682,4 +6457,4 @@ public class EvelScalingMeasurement extends EvelHeader { }
-}
+}
\ No newline at end of file diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java index a4a3b21..f720a36 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSipSignaling.java @@ -471,8 +471,8 @@ public class EvelSipSignaling extends EvelHeader { JsonObjectBuilder evelSipSignalingObject()
{
- double version = major_version+(double)minor_version/10;
-
+ // double version = major_version+(double)minor_version/10;
+ String version = "3.0";
EVEL_ENTER();
/***************************************************************************/
@@ -486,8 +486,8 @@ public class EvelSipSignaling extends EvelHeader { JsonObjectBuilder vnfnamedobj = Json.createObjectBuilder()
.add( "vendorName",vnfname_field.vendorname);
- vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vfModuleName");
- vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vnfName");
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"nfModuleName");
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"nfName");
JsonObjectBuilder evelsip = Json.createObjectBuilder()
.add("correlator", correlator)
@@ -495,8 +495,8 @@ public class EvelSipSignaling extends EvelHeader { .add("localPort", local_port)
.add("remoteIpAddress", remote_ip_address)
.add("remotePort", remote_port)
- .add("vendorVnfNamedFields", vnfnamedobj);
-
+ .add("vendorNfNameFields", vnfnamedobj);
+
/***************************************************************************/
/* Optional fields. */
@@ -508,15 +508,16 @@ public class EvelSipSignaling extends EvelHeader { // additional fields
if( additional_info != null )
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ //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);
+// JsonObject obj = Json.createObjectBuilder()
+// .add("name", addl_info[0])
+// .add("value", addl_info[1]).build();
+ builder.add(addl_info[0], addl_info[1]);
}
- evelsip.add("additionalFields", builder);
+ evelsip.add("additionalInformation", builder);
}
@@ -524,7 +525,7 @@ public class EvelSipSignaling extends EvelHeader { /* Although optional, we always generate the version. Note that this */
/* closes the object, too. */
/***************************************************************************/
- evelsip.add("signalingFieldsVersion", version);
+ evelsip.add("sipSignalingFieldsVersion", version);
EVEL_EXIT();
@@ -545,7 +546,7 @@ public class EvelSipSignaling extends EvelHeader { JsonObject obj = Json.createObjectBuilder()
.add("event", Json.createObjectBuilder()
.add( "commonEventHeader",eventHeaderObject() )
- .add( "signalingFields",evelSipSignalingObject() )
+ .add( "sipSignalingFields",evelSipSignalingObject() )
).build();
EVEL_EXIT();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java index 555e700..90df4d6 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelStateChange.java @@ -24,6 +24,10 @@ package evel_javalibrary.att.com; import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -58,11 +62,13 @@ public class EvelStateChange extends EvelHeader { EVEL_ENTITY_STATE new_state;
EVEL_ENTITY_STATE old_state;
String state_interface;
+
/***************************************************************************/
/* Optional fields */
/***************************************************************************/
- ArrayList<String[]> additional_info;
+ // ArrayList<String[]> additional_info;
+ HashMap<String, String > additional_inf;
private static final Logger LOGGER = Logger.getLogger( EvelStateChange.class.getName() );
@@ -94,7 +100,7 @@ public class EvelStateChange extends EvelHeader { old_state = oldstate;
state_interface = interfce;
- additional_info = null;
+ additional_inf = null;
}
/**************************************************************************//**
@@ -123,18 +129,18 @@ public class EvelStateChange extends EvelHeader { assert(name != null);
assert(value != null);
- if( additional_info == null )
+ if( additional_inf == null )
{
- additional_info = new ArrayList<String[]>();
+ additional_inf = new HashMap<>();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- addl_info = new String[2];
- assert(addl_info != null);
- addl_info[0] = name;
- addl_info[1] = value;
-
- additional_info.add(addl_info);
+ // addl_info = new String[2];
+ // assert(addl_info != null);
+ // addl_info[0] = name;
+ // addl_info[1] = value;
+ additional_inf.put(name, value);
+ // additional_info.add(addl_info);
EVEL_EXIT();
}
@@ -185,8 +191,8 @@ public class EvelStateChange extends EvelHeader { {
String nstate;
String ostate;
- double version = major_version+(double)minor_version/10;
-
+ //double version = major_version+(double)minor_version/10;
+ String version = "4.0";
EVEL_ENTER();
@@ -213,7 +219,7 @@ public class EvelStateChange extends EvelHeader { /***************************************************************************/
/* Optional additional information */
/***************************************************************************/
- if( additional_info != null )
+ /* if( additional_info != null )
{
JsonArrayBuilder builder = Json.createArrayBuilder();
for(int i=0;i<additional_info.size();i++) {
@@ -224,6 +230,23 @@ public class EvelStateChange extends EvelHeader { builder.add(obj);
}
evelstate.add("additionalFields", builder);
+ } */
+
+
+ if(additional_inf != null) {
+ //JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
+ String addl_info_key = add_inf.getKey();
+ String addl_info_value = add_inf.getValue();
+// JsonObject obj1 = Json.createObjectBuilder()
+// .add("name", addl_info_key)
+// .add("value", addl_info_value).build();
+ builder.add(addl_info_key, addl_info_value);
+ }
+ evelstate.add("additionalFields", builder);
}
EVEL_EXIT();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java index 1bdcaf0..a1bd94b 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelSyslog.java @@ -24,6 +24,10 @@ package evel_javalibrary.att.com; import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -100,6 +104,9 @@ public class EvelSyslog extends EvelHeader { EvelOptionString syslog_severity;
double syslog_fver;
EvelOptionInt syslog_ver;
+ EvelOptionString syslogmsg_host;
+
+ HashMap<String, String > additional_inf;
private static final Logger LOGGER = Logger.getLogger( EvelSyslog.class.getName() );
@@ -137,6 +144,10 @@ public class EvelSyslog extends EvelHeader { syslog_s_data = new EvelOptionString();
syslog_sdid = new EvelOptionString();
syslog_severity = new EvelOptionString();
+
+ syslogmsg_host = new EvelOptionString();
+
+ additional_inf =null;
}
/**************************************************************************//**
@@ -158,6 +169,44 @@ public class EvelSyslog extends EvelHeader { EVEL_EXIT();
}
+
+ //VES 7.O added 4Sept2018
+ /**************************************************************************//**
+ * 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_info_add(String name, String value)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(name != null);
+ assert(value != null);
+
+ if( additional_inf == null )
+ {
+ additional_inf = new HashMap<>();
+ }
+
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ additional_inf.put(name, value);
+
+ EVEL_EXIT();
+ }
/**************************************************************************//**
* Add an additional value name/value pair to the Syslog.
@@ -174,7 +223,7 @@ public class EvelSyslog extends EvelHeader { * does not need to preserve the value once the function
* returns.
*****************************************************************************/
- public void evel_syslog_addl_filter_set(String filter)
+ public void evel_syslog_addl_filter_set(String filter)
{
EVEL_ENTER();
@@ -190,6 +239,36 @@ public class EvelSyslog extends EvelHeader { 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_priority_set(int priority)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(priority > 0);
+
+ syslog_priority.SetValuePr(
+ priority,
+ "Priority");
+ EVEL_EXIT();
+ }
/**************************************************************************//**
* Set the Event Source Host property of the Syslog.
@@ -355,6 +434,37 @@ public class EvelSyslog extends EvelHeader { "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_msghost_set(String msghost)
+ {
+ EVEL_ENTER();
+
+ /***************************************************************************/
+ /* Check preconditions. */
+ /***************************************************************************/
+ assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
+ assert(msghost != null);
+
+ syslogmsg_host.SetValuePr(
+ msghost,
+ "SysLog msg log");
+ EVEL_EXIT();
+ }
+
+
/**************************************************************************//**
* Set the Structured SDID property of the Syslog.
@@ -425,8 +535,8 @@ public class EvelSyslog extends EvelHeader { JsonObjectBuilder evelSyslogObject()
{
String evt_source_type;
- double version = major_version+(double)minor_version/10;
-
+ // double version = major_version+(double)minor_version/10;
+ String version = "4.0";
EVEL_ENTER();
assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_SYSLOG);
@@ -435,7 +545,7 @@ public class EvelSyslog extends EvelHeader { /* Mandatory fields */
/***************************************************************************/
JsonObjectBuilder obj = Json.createObjectBuilder()
- .add("eventSourceType", EvelFault.evel_source_type(event_source_type))
+ .add("eventSourceType", event_source_type.toString())
.add("syslogMsg", syslog_msg)
.add("syslogTag", syslog_tag)
.add("syslogFieldsVersion",version);
@@ -452,6 +562,25 @@ public class EvelSyslog extends EvelHeader { syslog_sdid.encJsonValue(obj, "syslogSdId");
syslog_severity.encJsonValue(obj, "syslogSev");
syslog_ver.encJsonValue(obj, "syslogVer");
+ syslogmsg_host.encJsonValue(obj, "syslogMsgHost");
+
+
+ if(additional_inf != null) {
+ //JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
+ String addl_info_key = add_inf.getKey();
+ String addl_info_value = add_inf.getValue();
+// JsonObject obj1 = Json.createObjectBuilder()
+// .add("name", addl_info_key)
+// .add("value", addl_info_value).build();
+ builder.add(addl_info_key, addl_info_value);
+ }
+ obj.add("additionalFields", builder);
+ }
+
EVEL_EXIT();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java index 9d28b4a..11a6f83 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelThresholdCross.java @@ -25,6 +25,10 @@ package evel_javalibrary.att.com; import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -33,6 +37,7 @@ import javax.json.JsonObjectBuilder; import org.apache.log4j.Logger;
+import evel_javalibrary.att.com.EvelHeader.PRIORITIES;
import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS;
@@ -58,7 +63,8 @@ public class EvelThresholdCross extends EvelHeader { EVEL_ELEMENT_ANOMALY,
EVEL_INTERFACE_ANOMALY,
EVEL_SERVICE_ANOMALY,
- EVEL_MAX_ANOMALY
+ EVEL_MAX_ANOMALY,
+
}
public enum EVEL_SEVERITIES{
@@ -80,6 +86,10 @@ public class EvelThresholdCross extends EvelHeader { String name;
String thresholdCrossed;
String value;
+
+
+ Map<String,String> hashMap;
+
}
PERF_COUNTER additionalParameters;
@@ -94,7 +104,10 @@ public class EvelThresholdCross extends EvelHeader { /***************************************************************************/
/* Optional fields */
/***************************************************************************/
- ArrayList<String[]> additional_info;
+ //ArrayList<String[]> additional_info;
+ Map<String,String> additional_inf;
+
+
EvelOptionString alertValue;
ArrayList<String> alertidList;
EvelOptionString dataCollector;
@@ -102,7 +115,9 @@ public class EvelThresholdCross extends EvelHeader { EvelOptionString interfaceName;
EvelOptionString networkService;
EvelOptionString possibleRootCause;
-
+
+
+
private static final Logger LOGGER = Logger.getLogger( EvelThresholdCross.class.getName() );
@@ -123,9 +138,9 @@ public class EvelThresholdCross extends EvelHeader { *****************************************************************************/
public EvelThresholdCross( String evname,String evid,
String tcriticality,
- String tname,
+ //String tname,
String tthresholdCrossed,
- String tvalue,
+ //String tvalue,
EVEL_EVENT_ACTION talertAction,
String talertDescription,
EVEL_ALERT_TYPE talertType,
@@ -136,18 +151,22 @@ public class EvelThresholdCross extends EvelHeader { super(evname,evid);
event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_THRESHOLD_CROSSING;
assert( tcriticality!= null );
- assert( tname!= null );
+ // assert( tname!= null );
assert( tthresholdCrossed!= null );
- assert( tvalue!= null );
+ // assert( tvalue!= null );
assert( talertAction!= null );
additionalParameters = new PERF_COUNTER();
assert( additionalParameters != null);
additionalParameters.criticality = tcriticality;
- additionalParameters.name = tname;
+ // additionalParameters.name = tname;
additionalParameters.thresholdCrossed = tthresholdCrossed;
- additionalParameters.value = tvalue;
+ // additionalParameters.value = tvalue;
+
+
+ additionalParameters.hashMap = null;
+
alertAction = talertAction;
alertDescription = talertDescription;
alertType = talertType;
@@ -155,7 +174,7 @@ public class EvelThresholdCross extends EvelHeader { eventSeverity = teventSeverity;
eventStartTimestamp = teventStartTimestamp;
- additional_info = null;
+ additional_inf = null;
alertValue = new EvelOptionString();
alertidList = null;
dataCollector = new EvelOptionString();
@@ -213,6 +232,7 @@ public class EvelThresholdCross extends EvelHeader { LOGGER.debug(MessageFormat.format("Adding alertid={0}", alertid));
alertidList.add(new String(alertid));
+
EVEL_EXIT();
}
@@ -232,7 +252,7 @@ public class EvelThresholdCross extends EvelHeader { *****************************************************************************/
public void evel_thresholdcross_addl_info_add(String name, String value)
{
- String[] addl_info = null;
+ //String[] addl_info = null;
EVEL_ENTER();
/***************************************************************************/
@@ -242,22 +262,68 @@ public class EvelThresholdCross extends EvelHeader { assert(name != null);
assert(value != null);
- if( additional_info == null )
+ if( additional_inf == null )
{
- additional_info = new ArrayList<String[]>();
+ // additional_info = new ArrayList<String[]>();
+ additional_inf = new HashMap<String,String>();
}
LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
- addl_info = new String[2];
- assert(addl_info != null);
- addl_info[0] = name;
- addl_info[1] = value;
+ // addl_info = new String[2];
+ // assert(addl_info != null);
+ // addl_info[0] = name;
+ // addl_info[1] = value;
+ additional_inf.put(name, value);
+ // additional_info.add(addl_info);
+
+ EVEL_EXIT();
+ }
+
+
+
+ /**************************************************************************//**
+ * 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_hashMap_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( additionalParameters.hashMap == null )
+ {
+ // additional_info = new ArrayList<String[]>();
+ additionalParameters.hashMap = new HashMap<String,String>();
+ }
- additional_info.add(addl_info);
+ LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
+ // addl_info = new String[2];
+ // assert(addl_info != null);
+ // addl_info[0] = name;
+ // addl_info[1] = value;
+ additionalParameters.hashMap.put(name, value);
+ // additional_info.add(addl_info);
EVEL_EXIT();
}
+
/**************************************************************************//**
* Set the TCA probable Root cause.
@@ -392,8 +458,118 @@ public class EvelThresholdCross extends EvelHeader { "Alert value");
EVEL_EXIT();
}
+
+
+ String evel_alerType(EVEL_ALERT_TYPE alerType)
+ {
+ String result;
+
+ EVEL_ENTER();
+
+ switch (alerType)
+ {
+ case EVEL_CARD_ANOMALY:
+ result = "CARD-ANOMALY";
+ break;
+
+ case EVEL_ELEMENT_ANOMALY:
+ result = "ELEMENT-ANOMALY";
+ break;
+
+ case EVEL_SERVICE_ANOMALY:
+ result = "INTERFACE-ANOMALY";
+ break;
+ case EVEL_MAX_ANOMALY:
+ result = "SERVICE-ANOMALY";
+ break;
+
+ default:
+ result = null;
+
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+ String evel_alertAction(EVEL_EVENT_ACTION alertAction)
+ {
+ String result;
+
+ EVEL_ENTER();
+
+ switch (alertAction)
+ {
+ case EVEL_EVENT_ACTION_CLEAR:
+ result = "CLEAR";
+ break;
+
+ case EVEL_EVENT_ACTION_CONTINUE:
+ result = "CONT";
+ break;
+
+ case EVEL_EVENT_ACTION_SET:
+ result = "SET";
+ break;
+
+ case EVEL_MAX_EVENT_ACTION:
+ result = "ACTION";
+ break;
+
+ default:
+ result = null;
+
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
+
+ String eventSeverity(EVEL_SEVERITIES eventSeverity)
+ {
+ String result;
+
+ EVEL_ENTER();
+
+
+
+ switch (eventSeverity)
+ {
+ case EVEL_SEVERITY_CRITICAL:
+ result = "CRITICAL";
+ break;
+
+ case EVEL_SEVERITY_MAJOR:
+ result = "MAJOR";
+ break;
+
+ case EVEL_SEVERITY_WARNING:
+ result = "WARNING";
+ break;
+
+ case EVEL_SEVERITY_NORMAL:
+ result = "NORMAL";
+ break;
+
+ case EVEL_MAX_SEVERITIES:
+ result = "MINOR";
+ break;
+
+ default:
+ result = null;
+
+ }
+
+ EVEL_EXIT();
+
+ return result;
+ }
+
/**************************************************************************//**
* Encode the fault in JSON according to AT&T's schema for the TC ALert type.
*
@@ -401,10 +577,13 @@ public class EvelThresholdCross extends EvelHeader { *****************************************************************************/
JsonObjectBuilder evelThresholdCrossingObject()
{
- double version = major_version+(double)minor_version/10;
-
+ // double version = major_version+(double)minor_version/10;
+ String version = "4.0";
EVEL_ENTER();
-
+
+ String actionAlert = evel_alertAction(alertAction);
+ String typeAlert = evel_alerType(alertType);
+ String severityEvent = eventSeverity(eventSeverity);
/***************************************************************************/
/* Check preconditions. */
@@ -415,60 +594,109 @@ public class EvelThresholdCross extends EvelHeader { /* Mandatory fields. */
/***************************************************************************/
//encode counter
+ JsonArrayBuilder counterobjArray = Json.createArrayBuilder();
JsonObjectBuilder counterobj = Json.createObjectBuilder()
.add( "criticality",additionalParameters.criticality)
- .add( "name", additionalParameters.name)
- .add( "thresholdCrossed",additionalParameters.thresholdCrossed)
- .add( "value", additionalParameters.value);
+// .add( "name", additionalParameters.name)
+ .add( "thresholdCrossed",additionalParameters.thresholdCrossed);
+// .add( "value", additionalParameters.value);
+
+
+ if(additionalParameters.hashMap != null) {
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ Iterator<Entry<String, String>> it = additionalParameters.hashMap.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
+ String addl_info_key = add_inf.getKey();
+ String addl_info_value = add_inf.getValue();
+// JsonObject obj1 = Json.createObjectBuilder()
+// .add("name", addl_info_key)
+// .add("value", addl_info_value).build();
+ builder.add(addl_info_key, addl_info_value);
+ }
+ counterobj.add("hashMap", builder);
+
+ counterobjArray.add(counterobj);
+ }
+
JsonObjectBuilder evelrep = Json.createObjectBuilder()
- .add("additionalParameters", counterobj)
- .add("alertAction", alertAction.toString())
+ .add("additionalParameters", counterobjArray)
+ .add("alertAction", actionAlert)
.add("alertDescription", alertDescription)
- .add("alertType", alertType.toString())
+ .add("alertType", typeAlert)
.add("collectionTimestamp", collectionTimestamp.toString())
- .add("eventSeverity",eventSeverity.toString())
+ .add("eventSeverity",severityEvent)
.add("eventStartTimestamp",eventStartTimestamp.toString());
/***************************************************************************/
/* Optional fields. */
/***************************************************************************/
alertValue.encJsonValue(evelrep, "alertValue");
+
+
+ dataCollector.encJsonValue(evelrep, "dataCollector");
+ elementType.encJsonValue(evelrep, "elementType");
+ interfaceName.encJsonValue(evelrep, "interfaceName");
+ networkService.encJsonValue(evelrep, "networkService");
+ possibleRootCause.encJsonValue(evelrep, "possibleRootCause");
+
+
+// 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);
+//
+// }
+
+
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);
+ builder.add( addl_info);
+ //srikant send string array instedof itme and strting
+ // 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);
+
+
+
+
+ if(additional_inf != null) {
+ //JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
+ Iterator<Entry<String, String>> it = additional_inf.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry<String, String> add_inf = (Map.Entry<String, String>)it.next();
+ String addl_info_key = add_inf.getKey();
+ String addl_info_value = add_inf.getValue();
+// JsonObject obj1 = Json.createObjectBuilder()
+// .add("name", addl_info_key)
+// .add("value", addl_info_value).build();
+ builder.add(addl_info_key, addl_info_key);
+ }
+ evelrep.add("additionalFields", builder);
}
-
+ evelrep.add( "thresholdCrossingFieldsVersion", version);
+
EVEL_EXIT();
@@ -489,7 +717,7 @@ public class EvelThresholdCross extends EvelHeader { JsonObject obj = Json.createObjectBuilder()
.add("event", Json.createObjectBuilder()
.add( "commonEventHeader",eventHeaderObject() )
- .add( "thresholdCrossingAlert",evelThresholdCrossingObject() )
+ .add( "thresholdCrossingAlertFields",evelThresholdCrossingObject() )
).build();
EVEL_EXIT();
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java index 9a3983c..c95dbc8 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java @@ -41,7 +41,7 @@ public class EvelVoiceQuality extends EvelHeader { int major_version = 1;
int minor_version = 0;
-
+
/**************************************************************************//**
* Vendor VNF Name fields.
* JSON equivalent field: vendorVnfNameFields
@@ -51,7 +51,7 @@ public class EvelVoiceQuality extends EvelHeader { EvelOptionString vfmodule;
EvelOptionString vnfname;
}
-
+
/**************************************************************************//**
* Service Event endpoint description
* JSON equivalent field: endpointDesc
@@ -95,6 +95,25 @@ public class EvelVoiceQuality extends EvelHeader { EvelOptionDouble packetLossPercent;
EvelOptionDouble rFactor;
EvelOptionDouble roundTripDelay;
+
+ /*
+ * Ves6.0 Added Fields 15/07/2018
+ */
+
+ EvelOptionDouble endpointAverageJitter;
+ EvelOptionDouble endpointMaxJitter;
+ EvelOptionDouble endpointRtpOctetsLost;
+ EvelOptionDouble endpointRtpPacketsLost;
+ EvelOptionDouble localAverageJitter;
+ EvelOptionDouble localMaxJitter;
+ EvelOptionDouble localAverageJitterBufferDelay;
+ EvelOptionDouble localMaxJitterBufferDelay;
+ EvelOptionDouble localRtpOctetsLost;
+ EvelOptionDouble localRtpPacketsLost;
+ EvelOptionDouble oneWayDelay;
+
+
+
}
/***************************************************************************/
@@ -459,14 +478,14 @@ public class EvelVoiceQuality extends EvelHeader { *****************************************************************************/
public void evel_voice_quality_end_metrics_set(
String adjacencyName, String endpointDescr,
- double endpointJitter,
+ //double endpointJitter,
double endpointRtpOctetsDiscarded,
double endpointRtpOctetsReceived,
double endpointRtpOctetsSent,
double endpointRtpPacketsDiscarded,
double endpointRtpPacketsReceived,
double endpointRtpPacketsSent,
- double localJitter,
+ // double localJitter,
double localRtpOctetsDiscarded,
double localRtpOctetsReceived,
double localRtpOctetsSent,
@@ -474,10 +493,25 @@ public class EvelVoiceQuality extends EvelHeader { double localRtpPacketsReceived,
double localRtpPacketsSent,
double mosCqe,
- double packetsLost,
+ // double packetsLost,
double packetLossPercent,
double rFactor,
- double roundTripDelay) {
+ double roundTripDelay,
+ /*
+ * Ves6.0 AddedFields 15/07/2018
+ */
+ double endpointAverageJitter,
+ double endpointMaxJitter,
+ double endpointRtpOctetsLost,
+ double endpointRtpPacketsLost,
+ double localAverageJitter,
+ double localMaxJitter,
+ double localAverageJitterBufferDelay,
+ double localMaxJitterBufferDelay,
+ double localRtpOctetsLost,
+ double localRtpPacketsLost,
+ double oneWayDelay
+ ) {
END_OF_CALL_VOICE_QUALITY_METRICS vQMetrices = null;
EVEL_ENTER();
@@ -520,15 +554,46 @@ public class EvelVoiceQuality extends EvelHeader { vQMetrices.packetLossPercent= new EvelOptionDouble();
vQMetrices.rFactor= new EvelOptionDouble();
vQMetrices.roundTripDelay= new EvelOptionDouble();
+ /*
+ * Ves6.0 AddedFields 15/07/2018
+ * */
+
+ vQMetrices.endpointAverageJitter = new EvelOptionDouble();
+ vQMetrices.endpointMaxJitter = new EvelOptionDouble();
+ vQMetrices.endpointRtpOctetsLost= new EvelOptionDouble();
+ vQMetrices.endpointRtpPacketsLost = new EvelOptionDouble();
+ vQMetrices.localAverageJitter=new EvelOptionDouble();
+ vQMetrices.localMaxJitter=new EvelOptionDouble();
+ vQMetrices.localAverageJitterBufferDelay=new EvelOptionDouble();
+ vQMetrices.localMaxJitterBufferDelay=new EvelOptionDouble();
+ vQMetrices.localRtpOctetsLost=new EvelOptionDouble();
+ vQMetrices.localRtpPacketsLost=new EvelOptionDouble();
+ vQMetrices.oneWayDelay=new EvelOptionDouble();
+
+ /*
+ * Ves6.0 AddedFields 15/07/2018
+ * */
+
+ vQMetrices.endpointMaxJitter.SetValuePr(endpointMaxJitter, "EndpointMax jitter");
+ vQMetrices.endpointAverageJitter.SetValuePr(endpointAverageJitter, "Endpoint Average Jitter");
+ vQMetrices.endpointRtpOctetsLost.SetValuePr(endpointRtpOctetsLost, "End point RtpOctets Lost");
+ vQMetrices.endpointRtpPacketsLost.SetValuePr(endpointRtpPacketsLost,"End point Rtp Packets Lost");
+ vQMetrices.localAverageJitter.SetValuePr(localAverageJitter,"Local Average Jitter");
+ vQMetrices.localMaxJitter.SetValuePr(localMaxJitter, "Local Max Jitter");
+ vQMetrices.localMaxJitterBufferDelay.SetValuePr(localMaxJitterBufferDelay, "Local Max Jitter Buffer Delay");
+ vQMetrices.localRtpOctetsLost.SetValuePr(localRtpOctetsLost, "Local RtpOctets Lost");
+ vQMetrices.localRtpPacketsLost.SetValuePr(localRtpPacketsLost, "Local RtpPackets Lost");
+ vQMetrices.oneWayDelay.SetValuePr(oneWayDelay, "OneWay Delay");
+
- vQMetrices.endpointJitter.SetValuePr(endpointJitter, "Endpoint jitter");
+// 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.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");
@@ -536,7 +601,7 @@ public class EvelVoiceQuality extends EvelHeader { 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.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 ");
@@ -554,7 +619,8 @@ public class EvelVoiceQuality extends EvelHeader { JsonObjectBuilder evelVoiceQualityObject()
{
- double version = major_version+(double)minor_version/10;
+ //double version = major_version+(double)minor_version/10;
+ String version = "4.0";
EVEL_ENTER();
@@ -569,8 +635,8 @@ public class EvelVoiceQuality extends EvelHeader { JsonObjectBuilder vnfnamedobj = Json.createObjectBuilder()
.add( "vendorName",vnfname_field.vendorname);
- vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vfModuleName");
- vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vnfName");
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"nfModuleName");
+ vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"nfName");
JsonObjectBuilder evelvq = Json.createObjectBuilder()
.add("correlator", correlator)
@@ -578,7 +644,7 @@ public class EvelVoiceQuality extends EvelHeader { .add("callerSideCodec", callerSideCodec)
.add("midCallRtcp", midCallRtcp)
.add("voiceQualityFieldsVersion", version)
- .add("vendorVnfNameFields", vnfnamedobj);
+ .add("vendorNfNameFields", vnfnamedobj);
/***************************************************************************/
/* Optional fields. */
@@ -589,15 +655,16 @@ public class EvelVoiceQuality extends EvelHeader { // additional fields
if( additional_info != null )
{
- JsonArrayBuilder builder = Json.createArrayBuilder();
+ //JsonArrayBuilder builder = Json.createArrayBuilder();
+ JsonObjectBuilder builder = Json.createObjectBuilder();
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);
+// JsonObject obj = Json.createObjectBuilder()
+// .add("name", addl_info[0])
+// .add("value", addl_info[1]).build();
+ builder.add(addl_info[0], addl_info[1]);
}
- evelvq.add("additionalFields", builder);
+ evelvq.add("additionalInformation", builder);
}
@@ -630,8 +697,30 @@ public class EvelVoiceQuality extends EvelHeader { vQMetrics.packetLossPercent.encJsonValue(obj,"packetLossPercent");
vQMetrics.rFactor.encJsonValue(obj,"rFactor");
vQMetrics.roundTripDelay.encJsonValue(obj,"roundTripDelay");
+
+ /*
+ * Ves6.0 AddedFields 15/07/2018
+ * */
+
+ vQMetrics.endpointAverageJitter.encJsonValue(obj, "endpointAverageJitter");
+ vQMetrics.endpointMaxJitter.encJsonValue(obj, "endpointMaxJitter");
+ vQMetrics.endpointRtpOctetsLost.encJsonValue(obj, "endpointRtpOctetsLost");
+ vQMetrics.endpointRtpPacketsLost.encJsonValue(obj, "endpointRtpPacketsLost");
+ vQMetrics.localAverageJitter.encJsonValue(obj, "localAverageJitter");
+ vQMetrics.localMaxJitter.encJsonValue(obj, "endpointRtpOctetsLost");
+ System.out.println("local aveg jitter buffer delay...");
+ vQMetrics.localAverageJitterBufferDelay.encJsonValue(obj, "localAverageJitterBufferDelay");
+
+ vQMetrics.localMaxJitterBufferDelay.encJsonValue(obj, "localMaxJitterBufferDelay");
+ vQMetrics.localRtpOctetsLost.encJsonValue(obj, "localRtpOctetsLost");
+ vQMetrics.localRtpPacketsLost.encJsonValue(obj, "localRtpPacketsLost");
+ vQMetrics.oneWayDelay.encJsonValue(obj, "oneWayDelay");
+
+
evelvq.add("endOfCallVqmSummaries", obj);
+ System.out.println("local aveg jitter buffer delay...2"+ obj);
+ System.out.println("local aveg jitter buffer delay..."+ evelvq);
}
diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/Main.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/Main.java new file mode 100644 index 0000000..83f97e1 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/Main.java @@ -0,0 +1,64 @@ +package evel_javalibrary.att.com.loadbalance; +/**************************************************************************//** + * @file + * Sample Test Agent for EVEL library + * + * This file implements the Sample Agent which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it without worrying about details of the API transport. + * It also shows how events can be formatted with data for POST + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +import org.apache.log4j.Level; + +import evel_javalibrary.att.com.AgentMain; +//import evel_javalibrary.att.com.MeasureData; +//import evel_javalibrary.att.com.heartBeatData; + + + + + +public class Main { + + public static void main(String[] args) { + // TODO Auto-generated method stub + + try { + AgentMain.evel_initialize("http://127.0.0.1", 30000, + null,null, + "will", + "pill", + null, null, null, + Level.TRACE); + }catch(Exception e) { + e.printStackTrace(); + return; + } + MeasureData mdataThread = new MeasureData(); + mdataThread.start(); + + heartBeatData hbDataThread = new heartBeatData(); + hbDataThread.start(); + + faultData flDataThread = new faultData(); + flDataThread.start(); + + } + +} + diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java new file mode 100644 index 0000000..38c517a --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/MeasureData.java @@ -0,0 +1,375 @@ +package evel_javalibrary.att.com.loadbalance; +/**************************************************************************//** + * @file + * Measurement class + * + * This file implements the Measurement Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send CPU, Memory, Disk Measurements to Collector. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.log4j.Level; + +import evel_javalibrary.att.com.AgentMain; +import evel_javalibrary.att.com.EvelBatch; +import evel_javalibrary.att.com.EvelScalingMeasurement; + +public class MeasureData extends Thread{ + static HashMap<String, String> hm = new HashMap<>(); + static HashMap<String, String> vpp_metrics = new HashMap<>(); + + static HashMap<String, String> common_meas = new HashMap<>(); + + + static int bytes_in_this_round; + static int bytes_out_this_round; + static int packets_in_this_round; + static int packets_out_this_round; + + static int gm_event_id = 1; + static String event_id1 = "mvfs"; + static String event_id = "00000000"; + static String event_id2=null; + + static int request_rate = 0; + + static long epoch_start = 0; + + static String linkStart = ""; + static int linkCount; + + + Long start_epoch_microsec = 0L; + Long last_epoch_microsec = 0L; + + //public static void main(String[] args) { + public void run() { + // TODO Auto-generated method stub + //read_config_file(); + read_meas_traffic(); + read_common_config_file(); + read_meas_config_file(); + + HashMap<String, String> intFaceMap = read_interface_config_file(); + int numOfInterfaces = 0; + if( !intFaceMap.isEmpty() ) + numOfInterfaces = intFaceMap.size(); + if( numOfInterfaces <= 0) { + System.out.println("ERROR : Didn't find interfacess in config file, exiting thread"); + return; + } + + System.out.println("MAP values: " + hm.values()); + + HashMap last_metrics = read_vpp_metrics(linkStart); + try { + Thread.sleep(Integer.parseInt(common_meas.get("measurementInterval"))); + }catch(Exception e) {} + + + while(true) { + //request_rate = rand()%10000; + request_rate =2; + EvelBatch ebt = new EvelBatch(); + event_id2 = event_id1+ event_id+(gm_event_id++); + EvelScalingMeasurement eveMeas = new EvelScalingMeasurement( Double.parseDouble(common_meas.get("measurementInterval")) , + common_meas.get("eventName"), + event_id2); + + for( String vNic : intFaceMap.keySet() ) { + //System.out.println("INFO:: getting vpp metrics for vNic "+vNic); + + HashMap current_metrics = read_vpp_metrics(vNic); + if( current_metrics.size() !=4 ) { + System.out.println("ERROR:: Did't get vpp metrics for vNic "+vNic); + continue; + } + + if (Integer.parseInt((String) current_metrics.get("bytes_in")) + - Integer.parseInt((String) last_metrics.get("bytes_in")) > 0) { + bytes_in_this_round = Integer.parseInt((String) current_metrics.get("bytes_in")) + - Integer.parseInt((String) last_metrics.get("bytes_in")); + } else { + bytes_in_this_round = 0; + } + + if (Integer.parseInt((String) current_metrics.get("bytes_out")) + - Integer.parseInt((String) last_metrics.get("bytes_out")) > 0) { + bytes_out_this_round = Integer.parseInt((String) current_metrics.get("bytes_out")) + - Integer.parseInt((String) last_metrics.get("bytes_out")); + } else { + bytes_out_this_round = 0; + } + + if (Integer.parseInt((String) current_metrics.get("packets_in")) + - Integer.parseInt((String) last_metrics.get("packets_in")) > 0) { + packets_in_this_round = Integer.parseInt((String) current_metrics.get("packets_in")) + - Integer.parseInt((String) last_metrics.get("packets_in")); + } else { + packets_in_this_round = 0; + } + + if (Integer.parseInt((String) current_metrics.get("packets_out")) + - Integer.parseInt((String) last_metrics.get("packets_out")) > 0) { + packets_out_this_round = Integer.parseInt((String) current_metrics.get("packets_out")) + - Integer.parseInt((String) last_metrics.get("packets_out")); + } else { + packets_out_this_round = 0; + } + + event_id2 = event_id1+ (gm_event_id++); + /* EvelScalingMeasurement eveMeas = new EvelScalingMeasurement( Double.parseDouble(hm.get("measurementInterval")) , + hm.get("eventName"), + event_id2); */ + + + EvelScalingMeasurement.MEASUREMENT_NIC_PERFORMANCE vNicPerf = eveMeas.evel_measurement_new_vnic_performance(vNic, "true"); + eveMeas.evel_meas_vnic_performance_add(vNicPerf ); + + if( hm.get("eventType")!=null) { + + start_epoch_microsec = last_epoch_microsec; + last_epoch_microsec = System.nanoTime()/1000; + + eveMeas.evel_last_epoch_set(start_epoch_microsec); + eveMeas.evel_start_epoch_set(last_epoch_microsec); + + + eveMeas.evel_measurement_type_set( hm.get("eventType").toString()); + eveMeas.evel_measurement_request_rate_set(request_rate ); + eveMeas.evel_vnic_performance_rx_total_pkt_delta_set(vNicPerf, packets_in_this_round); + eveMeas.evel_vnic_performance_tx_total_pkt_delta_set(vNicPerf, packets_out_this_round); + eveMeas.evel_vnic_performance_rx_octets_delta_set( vNicPerf, bytes_in_this_round); + eveMeas.evel_vnic_performance_tx_octets_delta_set( vNicPerf, bytes_out_this_round); + + eveMeas.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); + eveMeas.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); + eveMeas.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); + eveMeas.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); + eveMeas.evel_nfVendorName_set(hm.get("nfVendorName").toString()); + eveMeas.evel_header_set_sourceid(true,hm.get("sourceId").toString()); + + eveMeas.evel_header_set_source_name(hm.get("sourceName").toString()); + eveMeas.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); + + + + + } + + + try { + Thread.sleep(Integer.parseInt(common_meas.get("measurementInterval"))); + }catch(Exception e) {} + last_metrics = current_metrics; + } + + //ebt.addEvent(eveMeas); + AgentMain.evel_post_event(eveMeas); + System.out.println(" Event sent"); + + } + + } + + + + + public static HashMap<String, String> read_vpp_metrics(String linkStart) { + Process p; + + String s=""; + HashMap<String, String> vpp_metrics_map = new HashMap<>(); + String params[] = {"-f3", "-f11", "-f4", "-f12"}; + try { + Runtime rt = Runtime.getRuntime(); + for(int i=0;i<4;i++) { + String[] command = {"/bin/sh", "-c", "cat /proc/net/dev | grep \""+linkStart+"\" | tr -s \' \' | cut -d\' \' "+params[i]+""}; + Process child = rt.exec(command); + + BufferedReader reader = new BufferedReader(new InputStreamReader( + child.getInputStream())); + + while ((s= reader.readLine()) != null) { + String[] res = s.split(" "); + if( i==0) + vpp_metrics_map.put("bytes_in", res[0]); + if( i==1) + vpp_metrics_map.put("packets_in", res[0]); + if( i==2) + vpp_metrics_map.put("bytes_out", res[0]); + if( i==3) + vpp_metrics_map.put("packets_out", res[0]); + + } + } + + } catch (Exception e) { + e.printStackTrace(); + } + return vpp_metrics_map; + } + + + + public static HashMap<String, String> read_common_config_file() { + + List<String> list = new ArrayList<String>(); + + + hm.put("eventType", ""); + hm.put("nfcNamingCode", ""); + hm.put("nfNamingCode", ""); + hm.put("nfVendorName", ""); + hm.put("reportingEntityId", ""); + hm.put("reportingEntityName", ""); + hm.put("sourceId", ""); + hm.put("sourceName", ""); + hm.put("timeZoneOffset", ""); + + + + System.out.println("KEYS: " + hm.keySet().size()); + System.out.println("VALUES: " + hm.values()); + + try { + // File file = new File("/home/ves/users/admin/temp/fw_common_config.txt"); + File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt"); + list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); + for (String lineSplit : list) { + String[] res = lineSplit.split(" "); + hm.put(res[0], res[1]); + System.out.println("File reading after split ---" + res[0]); + System.out.println("File reading after split second---" + res[1]); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + System.out.println("KEYS: " + hm.keySet().size()); + System.out.println("VALUES: " + hm.values()); + return hm; + } + + + + public static HashMap<String, String> read_interface_config_file() { + + List<String> list = new ArrayList<String>(); + HashMap<String, String> interface_config = new HashMap<>(); + //interface_config.put("lo", ""); + + + System.out.println("KEYS: " + interface_config.keySet().size()); + System.out.println("VALUES: " + interface_config.values()); + + try { + //File file = new File("/home/ves/users/admin/temp/fw_interface_config.txt"); + File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt"); + list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); + for (String lineSplit : list) { + String[] res = lineSplit.split(" "); + interface_config.put(res[0], res[1]); + } + + linkStart = (String)interface_config.keySet().toArray()[1]; + linkCount = interface_config.keySet().size(); + + + + } catch (Exception ex) { + ex.printStackTrace(); + } + + return interface_config; + } + + + + + + + + public static HashMap<String, String> read_meas_config_file() { + + List<String> list = new ArrayList<String>(); + + common_meas.put("eventName", "Measurement_vFirewall-AT&T_nicPerformance"); + common_meas.put("measurementInterval", ""); + + System.out.println("KEYS: " + common_meas.keySet().size()); + System.out.println("VALUES: " + common_meas.values()); + + try { + //File file = new File("/home/ves/users/admin/temp/fw_meas_config.txt"); + File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt"); + list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); + for (String lineSplit : list) { + String[] res = lineSplit.split(" "); + common_meas.put(res[0], res[1]); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + System.out.println("KEYS: " + common_meas.keySet().size()); + System.out.println("VALUES: " + common_meas.values()); + return common_meas; + } + + + + + + public static HashMap<String, String> read_meas_traffic() { + Process p; + List<String> vpp_params = new ArrayList(); + String s=""; + // HashMap<String, String> vpp_metrics_map = new HashMap<>(); + String params[] = {"-f3", "-f11", "-f4", "-f12"}; + try { +// System.out.println("***********inside read_vpp_metrics"); +// String command = "cat /proc/net/dev | grep \"Receive\" | tr -s \' \' | cut -d\' \' -f3"; + //{"-f3", "-f11", "-f4", "-f12"}; +// String command = "cat /proc/net/dev | grep \""+vnic+"\" "; + for(int i=0;i<4;i++) { + String[] command = {"/bin/sh", "-c", "docker logs vHello | grep -c"}; +// System.out.println("**COMMAND***: "+command); + Process child = Runtime.getRuntime().exec(command); + + BufferedReader reader = new BufferedReader(new InputStreamReader( + child.getInputStream())); + + while ((s= reader.readLine()) != null) { + vpp_params.add(s); + System.out.println("VPP meas_traffic:----" + s); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return vpp_metrics; + } +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/faultData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/faultData.java new file mode 100644 index 0000000..5400ba3 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/faultData.java @@ -0,0 +1,286 @@ +package evel_javalibrary.att.com.loadbalance; +/**************************************************************************//** + * @file + * Evel Fault Event class extends EvelHeader class + * + * This file implements the Evel Fault Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send Fault events. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +import java.io.File; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import evel_javalibrary.att.com.AgentMain; +import evel_javalibrary.att.com.EvelBatch; +import evel_javalibrary.att.com.EvelFault; +import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES; +import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES; +import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES; +import evel_javalibrary.att.com.EvelHeader; +import evel_javalibrary.att.com.EvelHeader.PRIORITIES; + + + +public class faultData extends Thread{ + + static HashMap<String, String> fault_config = new HashMap<>(); + static HashMap<String, String> interface_config = new HashMap<>(); + + static HashMap<String, String> hm = new HashMap<>(); + + static String linkStart = ""; + static int linkCount; + + + static int gm_event_id = 1; + static String event_id1 = "fault"; + static String event_id = "00000000"; + static String event_id2=null; + + + static int bytes_in; + static int bytes_out; + static int packets_in; + static int packets_out; + + + static int falut_raised =0; + + + public void run() { + + String alarmCondition = "linkDown"; + String specificProblem = "Transmit-Receive issue"; + + Long start_epoch_microsec = 0L; + Long last_epoch_microsec = 0L; + + + MeasureData mdataThread = new MeasureData(); + hm = mdataThread.read_common_config_file(); + + read_fault_config_file(); + HashMap<String, String> intFaceMapFault = mdataThread.read_interface_config_file(); + int numOfInterfacesFalut = 0; + if( !intFaceMapFault.isEmpty() ) + numOfInterfacesFalut = intFaceMapFault.size(); + if( numOfInterfacesFalut <= 0) { + System.out.println("ERROR : Didn't find interfacess in config file, exiting thread"); + return; + } + + + HashMap falut_last_metrics = mdataThread.read_vpp_metrics(linkStart); + + while(true) { + //request_rate = rand()%10000; + //request_rate =2; + EvelBatch ebt = new EvelBatch(); + event_id2 = event_id1+ event_id+(gm_event_id++); +// EvelScalingMeasurement eveMeas = new EvelScalingMeasurement( Double.parseDouble(common_meas.get("measurementInterval")) , +// common_meas.get("eventName"), +// event_id2); + + EvelHeader header = new EvelHeader("", ""); + + + //EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, alarmCondition, specificProblem,EVEL_PRIORITY_MEDIUM, EVEL_SEVERITY_MAJOR,EVEL_SOURCE_HOST,EVEL_VF_STATUS_IDLE); + + EvelFault eveFalt = new EvelFault(fault_config.get("eventName"),event_id2, alarmCondition, specificProblem, + EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH, + EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, + EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD, + EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE); + + + + //EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, alarmCondition,specificProblem,1,1,3,1); + // EvelFault eveFalt = new EvelFault("eventName", "event_id2", "alarmCondition","specificProblem",1,1,3,1); + // EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, alarmCondition,specificProblem,1,1,3,1); + + for( String falut : intFaceMapFault.keySet() ) { + + HashMap falut_current_metrics = mdataThread.read_vpp_metrics(falut); + if( falut_current_metrics.size() !=4 ) { + System.out.println("ERROR:: Did't get vpp metrics for vNic "+falut); + continue; + } + + if (Integer.parseInt((String) falut_current_metrics.get("bytes_in")) + - Integer.parseInt((String) falut_last_metrics.get("bytes_in")) > 0) { + bytes_in = Integer.parseInt((String) falut_current_metrics.get("bytes_in")) + - Integer.parseInt((String) falut_last_metrics.get("bytes_in")); + } else { + bytes_in = 0; + } + + if (Integer.parseInt((String) falut_current_metrics.get("bytes_out")) + - Integer.parseInt((String) falut_last_metrics.get("bytes_out")) > 0) { + bytes_out = Integer.parseInt((String) falut_current_metrics.get("bytes_out")) + - Integer.parseInt((String) falut_last_metrics.get("bytes_out")); + } else { + bytes_out = 0; + } + + if (Integer.parseInt((String) falut_current_metrics.get("packets_in")) + - Integer.parseInt((String) falut_last_metrics.get("packets_in")) > 0) { + packets_in = Integer.parseInt((String) falut_current_metrics.get("packets_in")) + - Integer.parseInt((String) falut_last_metrics.get("packets_in")); + } else { + packets_in = 0; + } + + if (Integer.parseInt((String) falut_current_metrics.get("packets_out")) + - Integer.parseInt((String) falut_last_metrics.get("packets_out")) > 0) { + packets_out = Integer.parseInt((String) falut_current_metrics.get("packets_out")) + - Integer.parseInt((String) falut_last_metrics.get("packets_out")); + } else { + packets_out = 0; + } + + + + if((bytes_in < Integer.parseInt((String)fault_config.get("lowWaterMark")) || bytes_out < Integer.parseInt((String)fault_config.get("lowWaterMark")) || + packets_in < Integer.parseInt((String)fault_config.get("lowWaterMark")) || packets_out < Integer.parseInt((String)fault_config.get("lowWaterMark"))) && falut_raised == 0){ + + event_id2 = event_id1+ (gm_event_id++); + + if(eveFalt != null) { + + falut_raised =1; + eveFalt.evel_fault_interface_set(linkStart); + + if( hm.get("eventType")!=null) { + eveFalt.evel_fault_type_set(hm.get("eventType")); + + start_epoch_microsec = last_epoch_microsec; + last_epoch_microsec = System.nanoTime()/1000; + + eveFalt.evel_last_epoch_set(start_epoch_microsec); + eveFalt.evel_start_epoch_set(last_epoch_microsec); + + eveFalt.evel_fault_category_set("link"); + eveFalt.evel_fault_interface_set("My Interface"); + eveFalt.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); + eveFalt.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); + eveFalt.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); + eveFalt.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); + eveFalt.evel_nfVendorName_set(hm.get("nfVendorName").toString()); + eveFalt.evel_header_set_sourceid(true,hm.get("sourceId").toString()); + + eveFalt.evel_header_set_source_name(hm.get("sourceName").toString()); + eveFalt.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); + + } + + } + + }else if((bytes_in > Integer.parseInt((String)fault_config.get("lowWaterMark")) && bytes_out > Integer.parseInt((String)fault_config.get("lowWaterMark")) && + packets_in > Integer.parseInt((String)fault_config.get("lowWaterMark")) && packets_out > Integer.parseInt((String)fault_config.get("lowWaterMark"))) && falut_raised == 1) { + + + + event_id2 = event_id1+ (gm_event_id++); +// EvelHeader header = new EvelHeader("", ""); +// EvelFault eveFalt = new EvelFault(fault_config.get("eventName"), event_id2, "linkDown", "Transmit-Receive issue", header.priority, eveFalt.event_severity,eveFalt.event_source_type,eveFalt.vf_status); + + if(eveFalt != null) { + falut_raised =1; + + eveFalt.evel_fault_interface_set(linkStart); + System.out.println("Event type is "+hm.get("eventType") ); + if( hm.get("eventType")!=null) { + eveFalt.evel_fault_type_set(hm.get("eventType")); + + eveFalt.evel_fault_category_set("link"); + eveFalt.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); + eveFalt.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); + eveFalt.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); + eveFalt.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); + eveFalt.evel_nfVendorName_set(hm.get("nfVendorName").toString()); + eveFalt.evel_header_set_sourceid(true,hm.get("sourceId").toString()); + + eveFalt.evel_header_set_source_name(hm.get("sourceName").toString()); + eveFalt.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); + + } + + } + + + + } + + + try { + Thread.sleep(1000); + }catch(Exception e) {} + } + // ebt.addEvent(eveFalt); + AgentMain.evel_post_event(eveFalt); + System.out.println(" Event sent"); + + } + + + } + + + + + + + public static HashMap<String, String> read_fault_config_file() { + + List<String> list = new ArrayList<String>(); + + List<String> list_interface = new ArrayList<String>(); + + fault_config.put("eventName", ""); + fault_config.put("faultCheckInterval", ""); + fault_config.put("lowWaterMark", ""); + + //interface_config.put("lo", ""); + + try { + // File file = new File("/home/ves/users/admin/temp/fw_flt_config.txt"); + File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt"); + System.out.println("File path is..."+ file); + list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); + for (String lineSplit : list) { + String[] res = lineSplit.split(" "); + fault_config.put(res[0], res[1]); + } + + + } catch (Exception ex) { + ex.printStackTrace(); + } + System.out.println("KEYS:fault_config " + fault_config.keySet().size()); + System.out.println("VALUES:fault_config " + fault_config.values()); + return fault_config; + } + + + +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt new file mode 100644 index 0000000..e40b5b3 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_common_config.txt @@ -0,0 +1,9 @@ +eventType platform +nfcNamingCode ssc +nfNamingCode scfx +nfVendorName AT&T +reportingEntityId cc305d54-75b4-431b-adb2-eb6b9e541234 +reportingEntityName ibcx0001vm002oam001 +sourceId de305d54-75b4-431b-adb2-eb6b9e546014 +sourceName scfx0001vm002cap001 +timeZoneOffset UTC-05:30 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_config.txt new file mode 100644 index 0000000..f730d6f --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_config.txt @@ -0,0 +1,10 @@ +eventName Measurement_vFirewall-AT&T_nicPerformance +eventType platform +nfcNamingCode ssc +nfNamingCode scfx +nfVendorName AT&T +reportingEntityId cc305d54-75b4-431b-adb2-eb6b9e541234 +reportingEntityName ibcx0001vm002oam001 +sourceId de305d54-75b4-431b-adb2-eb6b9e546014 +timeZoneOffset UTC-05:30 +measurementInterval 30 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt new file mode 100644 index 0000000..4b660ea --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_flt_config.txt @@ -0,0 +1,3 @@ +eventName Fault_vFirewall-AT&T_linkDownError +faultCheckInterval 30 +lowWaterMark 100 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt new file mode 100644 index 0000000..c288120 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt @@ -0,0 +1,2 @@ +eventName Heartbeat_vFirewall-AT&T_heartbeat +heartbeatInterval 20 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt new file mode 100644 index 0000000..46c3777 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_interface_config.txt @@ -0,0 +1,13 @@ +lo DNS1_RSLOTPORT_VLAN_CLASSTYPE +bond0 DNS2_RSLOTPORT_VLAN_CLASSTYPE +bond0.4020 DNS3_RSLOTPORT_VLAN_CLASSTYPE +bond0.4020.4020 DNS4_RSLOTPORT_VLAN_CLASSTYPE +bond0.4021 DNS5_RSLOTPORT_VLAN_CLASSTYPE +bond0.4021.4021 DNS6_RSLOTPORT_VLAN_CLASSTYPE +ens3 DNS7_RSLOTPORT_VLAN_CLASSTYPE +ens4 DNS8_RSLOTPORT_VLAN_CLASSTYPE +ens5 DNS9_RSLOTPORT_VLAN_CLASSTYPE +ens6 DNSa_RSLOTPORT_VLAN_CLASSTYPE +ens7 DNSb_RSLOTPORT_VLAN_CLASSTYPE +docker0 DNSb_RSLOTPORT_VLAN_CLASSTYPE +enp0s3 DNSb_RSLOTPORT_VLAN_CLASSTYPE diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt new file mode 100644 index 0000000..7fac2f7 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/fw_meas_config.txt @@ -0,0 +1,2 @@ +eventName Measurement_vFirewall-AT&T_nicPerformance +measurementInterval 30 diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/heartBeatData.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/heartBeatData.java new file mode 100644 index 0000000..9da7521 --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/loadbalance/heartBeatData.java @@ -0,0 +1,153 @@ +package evel_javalibrary.att.com.loadbalance; +/**************************************************************************//** + * @file + * Heartbeat field class + * + * This file implements the Heartbeat Event class which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it to send Agent status. + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +import java.io.File; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.json.Json; +import javax.json.JsonArray; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; + +import evel_javalibrary.att.com.AgentMain; +import evel_javalibrary.att.com.EvelBatch; +import evel_javalibrary.att.com.EvelHeartbeatField; + +public class heartBeatData extends Thread{ + + static HashMap<String, String> hm = new HashMap<>(); + static HashMap<String, String> hb_config = new HashMap<>(); + static int gm_event_id = 1; + static String event_id1 = "mvfs"; + static String event_id2=null; + + + public void run() { + + Long start_epoch_microsec = 0L; + Long last_epoch_microsec = 0L; + + MeasureData mdataThread = new MeasureData(); + hm = mdataThread.read_common_config_file(); + read_hb_config_file(); + + while(true) { + event_id2 = event_id1+ (gm_event_id++); + + + EvelHeartbeatField evelHb = new EvelHeartbeatField(Integer.parseInt(hb_config.get("heartbeatInterval")) , + hb_config.get("eventName"), + event_id2); + + if( hm.get("eventType")!=null) { + + start_epoch_microsec = last_epoch_microsec; + last_epoch_microsec = System.nanoTime()/1000; + + evelHb.evel_last_epoch_set(start_epoch_microsec); + evelHb.evel_start_epoch_set(last_epoch_microsec); + + evelHb.evel_header_type_set(hm.get("eventType").toString()); + evelHb.evel_nfcnamingcode_set(hm.get("nfcNamingCode").toString()); + evelHb.evel_nfnamingcode_set(hm.get("nfNamingCode").toString()); + evelHb.evel_reporting_entity_name_set(hm.get("reportingEntityName").toString()); + evelHb.evel_reporting_entity_id_set(hm.get("reportingEntityId").toString()); + evelHb.evel_nfVendorName_set(hm.get("nfVendorName").toString()); + evelHb.evel_header_set_sourceid(true,hm.get("sourceId").toString()); + evelHb.evel_header_set_source_name(hm.get("sourceName").toString()); + + evelHb.evel_timeZoneOffset_set(hm.get("timeZoneOffset").toString()); + + + JsonObject obj = Json.createObjectBuilder() + .add( "heartbeatFields",evelHeartbeatFieldObject() + ).build(); + + EvelBatch ebt = new EvelBatch(); + //ebt.addEvent(evelHb); + + + System.out.println(" Event sent..."+ obj.asJsonObject()); + System.out.println("Event sent...###########"); + AgentMain.evel_post_event(evelHb); + System.out.println(" Event sent..."); + } + + try { + Thread.sleep(1000); + }catch(Exception e) { + + } + } + } + + + JsonObjectBuilder evelHeartbeatFieldObject() + { + String version = "3.0"; + JsonObjectBuilder evelHeatbeat = Json.createObjectBuilder() + .add("heartbeatInterval", hb_config.get("heartbeatInterval")); + evelHeatbeat.add( "heartbeatFieldsVersion", version); + return evelHeatbeat; + } + + + public static HashMap<String, String> read_hb_config_file() { + + List<String> list = new ArrayList<String>(); + + hb_config.put("eventName", ""); + hb_config.put("heartbeatInterval", ""); + + + System.out.println("KEYS: " + hb_config.keySet().size()); + System.out.println("VALUES: " + hb_config.values()); + + try { + //File file = new File("/home/ves/users/admin/temp/fw_hb_config.txt"); + File file = new File("./src/main/java/evel_javalibrary/att/com/loadbalance/fw_hb_config.txt"); + list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); + for (String lineSplit : list) { + String[] res = lineSplit.split(" "); + hb_config.put(res[0], res[1]); +// System.out.println("File reading after split ---" + res[0]); +// System.out.println("File reading after split second---" + res[1]); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + System.out.println("KEYS:hb_config " + hb_config.keySet().size()); + System.out.println("VALUES:hb_config " + hb_config.values()); + return hb_config; + } + + + + +} diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/maindir/Main.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/maindir/Main.java new file mode 100644 index 0000000..96da88a --- /dev/null +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/maindir/Main.java @@ -0,0 +1,659 @@ + +package evel_javalibrary.att.com.maindir; + +/**************************************************************************//** + * @file + * Sample Test Agent for EVEL library + * + * This file implements the Sample Agent which is intended to provide a + * simple wrapper around the complexity of AT&T's Vendor Event Listener API so + * that VNFs can use it without worrying about details of the API transport. + * It also shows how events can be formatted with data for POST + * + * License + * ------- + * Unless otherwise specified, all software contained herein is + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + + +import org.apache.log4j.Logger; + +import evel_javalibrary.att.com.*; +import evel_javalibrary.att.com.AgentMain.EVEL_ERR_CODES; +import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES; +import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES; +import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES; +import evel_javalibrary.att.com.EvelHeader.PRIORITIES; +import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS; +import evel_javalibrary.att.com.EvelScalingMeasurement.MACHINE_CHECK_EXCEPTION; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CODEC_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CPU_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_DISK_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_FEATURE_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_FSYS_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_HUGE_PAGE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_IPMI.MEASUREMENT_IPMI_PROCESSOR; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LATENCY_BUCKET; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LOAD; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_MEM_USE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_NIC_PERFORMANCE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_PROCESS_STATS; +import evel_javalibrary.att.com.EvelStateChange.EVEL_ENTITY_STATE; +import evel_javalibrary.att.com.EvelSyslog.EVEL_SYSLOG_FACILITIES; +import evel_javalibrary.att.com.EvelThresholdCross.EVEL_ALERT_TYPE; +import evel_javalibrary.att.com.EvelThresholdCross.EVEL_EVENT_ACTION; + +import org.apache.log4j.Level; + +import java.io.*; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Date; + +public class Main +{ + + public static void main(String[] args) + { + + try{ + AgentMain.evel_initialize("http://127.0.0.1", 30000, + // "http://1.2.3.4", 8080, + //"/vendor_event_listener","/example_vnf", + null,null, + "will", + "pill", + null, null, null, + //"/home/gokul/newwk/demo/vnfs/VES5.0/evel/sslcerts2/my-keystore.jks", "changeit", "changeit", + Level.TRACE); + } catch( Exception e ) + { + e.printStackTrace(); + } + + for(int i= 0; i < 2; i++) //srikanth no need for forloop , send only once. + { + + EvelHeader header = EvelHeader.evel_new_heartbeat("Hearbeat_vAFX","vmname_ip"); +// header.evel_nfnamingcode_set("vVNF"); +// header.evel_nfcnamingcode_set("vVNF"); +// header.evel_timeZoneOffset_set("UTC+5:30"); +// +// +// +// +// AgentMain.evel_post_event(header); + try { + Thread.sleep(1); + } catch( Exception e ) + { + e.printStackTrace(); + } + + + + EvelBatch be = new EvelBatch(); + + + EvelFault flt = new EvelFault("Fault_vVNF", "vmname_ip", + "My alaram condition", "It broke very badly", + EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH, + EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, + EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD, + EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE); + flt.evel_fault_addl_info_add("name1", "value1"); + flt.evel_fault_addl_info_add("name2", "value2"); + flt.evel_fault_interface_set("My Interface Card"); + flt.evel_fault_category_set("link"); + AgentMain.evel_post_event(flt); + + +// EvelFault flt2 = new EvelFault("Fault_vVNF", "vmname_ip", +// "NIC error", "Hardware failed", +// EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH, +// EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, +// EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD, +// EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE); +// flt2.evel_fault_addl_info_add("nichw", "fail"); +// flt2.evel_fault_addl_info_add("nicsw", "fail"); +// be.addEvent(flt2); +// +// EvelFault flt3 = new EvelFault("Fault_vVNF", "vmname_ip2", +// "NIC error", "Hardware failed", +// EvelHeader.PRIORITIES.EVEL_PRIORITY_NORMAL, +// EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, +// EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD, +// EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE); +// flt3.evel_fault_type_set("Interface fault"); +// flt3.evel_fault_category_set("Failed category"); +// flt3.evel_fault_interface_set("An Interface Card"); +// flt3.evel_fault_addl_info_add("nichw", "fail"); +// flt3.evel_fault_addl_info_add("nicsw", "fail"); +// AgentMain.evel_post_event(flt3); +// be.addEvent(flt3); + + + /* + * Fault is End + * */ + + EvelStateChange stc = new EvelStateChange("StateChange_vVNF", "vmname_ip", + EvelStateChange.EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_IN_SERVICE, + EvelStateChange.EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_OUT_OF_SERVICE,"bgp"); + stc.evel_statechange_addl_info_add("bgpa", "fail"); + stc.evel_statechange_addl_info_add("bgpb", "fail"); + AgentMain.evel_post_event(stc); + + //be.addEvent(stc); + + + /* + * State Change End + * */ + + + EvelScalingMeasurement sm = new EvelScalingMeasurement(10.0,"Measurements_vVNF", "vmname_ip"); + sm.evel_measurement_myerrors_set(10,20,30,40); + + sm.evel_measurement_concurrent_sessions_set(5); + sm.evel_measurement_config_entities_set(9); + sm.evel_measurement_mean_req_lat_set(13.6); + sm.evel_measurement_request_rate_set(1234); + sm.evel_measurement_vnfc_scaling_metric_set(35); + sm.evel_measurement_media_port_use_set(20); + + MEASUREMENT_CPU_USE cpuuse = sm.evel_measurement_new_cpu_use_add("cpu2", 10.0); + sm.evel_measurement_cpu_use_cpuCapacityContention_set(cpuuse, 11.3); + sm.evel_measurement_cpu_use_cpuDeamandAvg_set(cpuuse, 11.4); + sm.evel_measurement_cpu_use_cpuDeamandPct_set(cpuuse, 11.6); + sm.evel_measurement_cpu_use_cpuDeamandMhz_set(cpuuse, 11.8); + sm.evel_measurement_cpu_use_cpuLatencyAvg_set(cpuuse, 11.9); + sm.evel_measurement_cpu_use_cpuOverheadAvg_set(cpuuse, 12.2); + sm.evel_measurement_cpu_use_cpuSwapWaitTime_set(cpuuse, 13.2); + sm.evel_measurement_cpu_use_idle_set(cpuuse, 14.2); + sm.evel_measurement_cpu_use_interrupt_set(cpuuse, 15.2); + sm.evel_measurement_cpu_use_nice_set(cpuuse, 16.2); + sm.evel_measurement_cpu_use_softirq_set(cpuuse, 17.2); + sm.evel_measurement_cpu_use_steal_set(cpuuse, 18.2); + sm.evel_measurement_cpu_use_system_set(cpuuse, 19.2); + sm.evel_measurement_cpu_use_usageuser_set(cpuuse, 18.9); + sm.evel_measurement_cpu_use_wait_set(cpuuse, 19.9); + + + MEASUREMENT_DISK_USE diskuse = sm.evel_measurement_new_disk_use_add("100"); + sm.evel_measurement_disk_use_diskWeightedIoTimeAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWeightedIoTimeLast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWeightedIoTimeMax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWeightedIoTimeMin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskBusResets_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskCommandsAborted_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskCommandsAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskFlushRequests_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskReadCommandsAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskFlushTime_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskTime_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskTotalReadLatencyAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskTotalWriteLatencyAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_diskWriteCommandsAvg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimeavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_iotimemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergereadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewritemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_mergewriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetsreadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_octetswritemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opsreadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_opswritemin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopsavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopslast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopsmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_pendingopsmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadlast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadmax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timereadmin_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewriteavg_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewritelast_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewritemax_set(diskuse, 10.1); + sm.evel_measurement_disk_use_timewritemin_set(diskuse, 10.1); + + MEASUREMENT_FEATURE_USE featureuse = sm.evel_measurement_feature_use_add("featureuse", 100); + + MEASUREMENT_HUGE_PAGE husePage= sm.evel_measurement_new_huge_page_add("HUGEPage1", 100000); + sm.evel_measurement_huge_page_bytesFree_set(husePage, 1100000); + sm.evel_measurement_huge_page_percentFree_set(husePage, 1000); + sm.evel_measurement_huge_page_percentUsed_set(husePage, 2000); + sm.evel_measurement_huge_page_vmPageNumberFree_set(husePage, 3000); + sm.evel_measurement_huge_page_vmPageNumberUsed_set(husePage, 4000); + + + + MEASUREMENT_MEM_USE memuse = sm.evel_measurement_new_mem_use_add("memuse", 100.0); + sm.evel_measurement_mem_use_memcache_set(memuse, 51.1); + sm.evel_measurement_mem_use_memconfig_set(memuse, 51.1); + sm.evel_measurement_mem_use_memfree_set(memuse, 51.1); + sm.evel_measurement_mem_use_slab_reclaimed_set(memuse, 51.1); + sm.evel_measurement_mem_use_slab_unreclaimable_set(memuse, 51.1); + sm.evel_measurement_mem_use_usedup_set(memuse, 51.1); + sm.evel_measurement_mem_use_memoryDemand_set(memuse, 51.1); + sm.evel_measurement_mem_use_memoryLatencyAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySharedAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapInAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapInRateAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapOutAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapOutRateAvg_set(memuse, 51.1); + sm.evel_measurement_mem_use_memorySwapUsedAvg_set(memuse, 51.1); + + + + MEASUREMENT_LATENCY_BUCKET latecy = sm.evel_measurement_latency_add(10000, 2000, 3000); + sm.evel_meas_latency_bucket_low_end_set(latecy, 10); + sm.evel_meas_latency_bucket_high_end_set(latecy, 20); + + MEASUREMENT_FSYS_USE fileuse = sm.evel_measurement_fsys_use_add("FileSystem", 10.0, 2.8, 2.4, 3.3, 5.5, 9.0); + + + MEASUREMENT_NIC_PERFORMANCE vnic = sm.evel_measurement_new_vnic_performance("vnic1","true"); + vnic.recvd_bcast_packets_acc.SetValue(2400000.0); + vnic.recvd_mcast_packets_delta.SetValue(5677888.0); + vnic.recvd_mcast_packets_acc.SetValue(5677888.0); + vnic.tx_ucast_packets_acc.SetValue(547856576.0); + vnic.tx_ucast_packets_delta.SetValue(540000.0); + + sm.evel_meas_vnic_performance_add(vnic); + + MEASUREMENT_CODEC_USE codecuse = sm.evel_measurement_codec_use_add("codecuse", 100); + + + MEASUREMENT_LOAD load = sm.evel_measurement_new_load_add(19); + sm.evel_measurement_load_shortTerm_set(load, 55.5); + sm.evel_measurement_load_midTerm_set(load, 66.3); + sm.evel_measurement_load_longTerm_set(load, 77.3); + + MEASUREMENT_PROCESS_STATS processtate = sm.evel_measurement_new_process_stats_add("ProcessState", 19); + sm.evel_measurement_process_stats_forkRate_set(processtate, 20.3); + sm.evel_measurement_process_stats_psStateBlocked_set(processtate, 22.1); + sm.evel_measurement_process_stats_psStatePaging_set(processtate, 23.3); + sm.evel_measurement_process_stats_psStateRunning_set(processtate, 24.2); + sm.evel_measurement_process_stats_psStateSleeping_set(processtate, 25.5); + sm.evel_measurement_process_stats_psStateStopped_set(processtate, 26.6); + sm.evel_measurement_process_stats_psStateZombie_set(processtate, 26.6); + + MACHINE_CHECK_EXCEPTION except = sm.evel_measurement_new_machine_check_exception_add("Exception"); + sm.evel_measurement_Exception_correctedMemoryErrors_set(except, 10.0); + sm.evel_measurement_Exception_correctedMemoryErrors_In1Hr_set(except, 12.5); + sm.evel_measurement_Exception_uncorrectedMemoryErrors_set(except, 15.2); + sm.evel_measurement_Exception_uncorrectedMemoryErrors_In1Hr_set(except, 15.3); + + + sm.evel_measurement_addl_info_add("name", "value"); + + MEASUREMENT_IPMI ipmi = sm.evel_measurement_new_ipmis_add(); + + sm.evel_measurement_ipmi_exitAirTemperature_set(ipmi, 10.0); + sm.evel_measurement_ipmi_frontPanelTemperature_set(ipmi, 11.0); + sm.evel_measurement_ipmi_ioModuleTemperature_set(ipmi, 12.2); + sm.evel_measurement_ipmi_systemAirflow_set(ipmi, 13.4); + + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMI_PROCESSOR_add("ProcessorIdentifier"); + ipmi.evel_measurement_IPMIbaseboardTemperature_add("IPMIbaseboardTemperature"); + ipmi.evel_measurement_IPMIbaseboardvoltageResulator_add("IPMIbaseboardvoltageRegulator"); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIbattery_add("IPMIbattery"); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIpowerSupply_add("powerSupplyIdentifier"); + ipmi.evel_measurement_IPMI_MEASUREMENT_IPMIglobalAggregateTemperatureMargin_add("AggregateTemperatureMargin"); + ipmi.evel_measurement_IPMINIC_add("nic_Identifier"); + ipmi.evel_measurement_IPMIHSBP_add("hsbpIdentifier"); + ipmi.evel_measurement_IPMIfan_add("fanIdentifier"); + + + sm.evel_measurement_custom_measurement_add("Measurement", "name", "value"); + + //sm.evel_meas_ipmi_add(ipmi); srikant , impi has added above, no need add here + +// cpuuse.steal.SetValue(34.0); +// cpuuse.user.SetValue(32.0); +// sm.evel_measurement_custom_measurement_add("group1","name1","val1"); +// sm.evel_measurement_custom_measurement_add("group1","name2","val2"); +// sm.evel_measurement_custom_measurement_add("group2","name1","val1"); +// sm.evel_measurement_custom_measurement_add("group2","name2","val2"); + + // be.addEvent(sm); + // AgentMain.evel_post_event(be); + + + + +/* + * EvelScalingMeasurement Change End + * */ + + + + + AgentMain.evel_post_event(sm); + + + + + + + + + EvelSyslog sysl = new EvelSyslog("Syslog_vVNF", "vmname_ip", + EvelFault.EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER, + "Router failed","JUNIPER"); + + sysl.evel_syslog_event_source_host_set("SL Host"); + sysl.evel_syslog_priority_set(21); + sysl.evel_syslog_proc_id_set(456); + sysl.evel_syslog_proc_set("routed"); + + sysl.evel_syslog_s_data_set("sys data"); + sysl.evel_syslog_sdid_set("200"); + sysl.evel_syslog_severity_set("Alert"); + + sysl.evel_syslog_facility_set(EVEL_SYSLOG_FACILITIES.EVEL_SYSLOG_FACILITY_INTERNAL); + sysl.evel_syslog_severity_set("Data"); + sysl.evel_syslog_version_set(20); + sysl.evel_syslog_msghost_set("Host@msg"); + + sysl.evel__syslog_addl_info_add("name1", "value1"); + sysl.evel__syslog_addl_info_add("name2", "value2"); + AgentMain.evel_post_event(sysl); + + + //be.addEvent(sysl); + /* + * Ves6.0 Updated 15/07/2018 + */ + + + + +/* + * EvelSyslog Change End + * */ + + + EvelNotification notification = new EvelNotification("Notification_vVNF", "vmname_ip","change_identifier", "configuration changed"); + notification.evel_notification_add_newState_set("maintainance"); + notification.evel_notification_add_oldState_set("out of Service"); + notification.evel_notification_add_changeContact_set("ChangeContact"); + notification.evel_notification_addl_info_add("name1", "value1"); + notification.evel_notification_addl_info_add("name4", "value5"); + + notification.evel_notification_add_namedarray("hmNam1", "hmName1", "hmNmae2"); + + AgentMain.evel_post_event(notification); + + + + +/* + * notification Change End + * */ + + + + EvelPnfRegistration pnfRegistration = new EvelPnfRegistration("PnfRegistration_vVNF", "vmname_ip"); + pnfRegistration.evel_pnrregistration_add_lastServiceDate_set("10FEB2019"); + pnfRegistration.evel_pnrregistration_add_modelNumber_set("123456789"); + pnfRegistration.evel_pnfRegistration_serialNumber_set("6061ZW3"); + pnfRegistration.evel_pnrregistration_add_macaddress_set("FF:28:22:34:45:56"); + pnfRegistration.evel_pnrregistration_add_manufactureDate_set("FEB2011"); + // pnfRegistration.evel_pnrregistration_add_modelNumber_set("FE934567"); + pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("100.10.10"); + + pnfRegistration.evel_pnfRegistration_softwareVersion_set("SW1234"); + + + pnfRegistration.evel_pnfRegistration_unitFamily_set("unitFamily222"); + pnfRegistration.evel_pnfRegistration_unitType_set("unitType1"); + + pnfRegistration.evel_pnrregistration_add_oamV4IpAddress_set("10.255.1.254"); + pnfRegistration.evel_pnrregistration_add_oamV6IpAddress_set("10.100.100.254"); + + + pnfRegistration.evel_pnfRegistration_vendorName_set("Vend_nam_123"); + pnfRegistration.evel_pnrregistration_addl_info_add("Name1", "value1"); + pnfRegistration.evel_pnrregistration_addl_info_add("Name2", "value2"); + + + AgentMain.evel_post_event(pnfRegistration); + + // be.addEvent(pnfRegistration); + +/* + * EvelPnfRegistration Change End + * */ + + EvelHeartbeatField hfld = new EvelHeartbeatField(123,"HeartbeatField_vVNF", "1"); + hfld.evel_hrtbt_interval_set(100); + hfld.evel_timeZoneOffset_set("UTC+5:30"); + AgentMain.evel_post_event(hfld); + +/* + * EvelHeartbeatField Change End + * */ + + EvelSipSignaling sip = new EvelSipSignaling("SipSignaling_vVNF", "vmname_ip","aricent","corlator","127.0.0.1","5647","10.1.1.124","5678"); + + + sip.evel_signaling_vnfmodule_name_set("nfName"); + sip.evel_signaling_vnfname_set("nf_name"); + sip.evel_signaling_addl_info_add("name1", "value1"); + sip.evel_signaling_addl_info_add("name2", "value2"); + AgentMain.evel_post_event(sip); + + // be.addEvent(sip); + +/* + * EvelSipSignaling Change End + * */ + + + + EvelVoiceQuality vq = new EvelVoiceQuality("VoiceQuality_vVNF", "vmname_ip", + "calleeSideCodc", + "callerSideCodc", "corlator", + "midCllRtcp", "juniper"); + vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 20, 30, 40, 50, 60, 70, 80, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 190, 200,210,220,230,240,250,260,270,280,290,300); + + + vq.evel_voice_quality_vnfmodule_name_set("vnfNaming"); + vq.evel_voice_quality_vnfname_set("vnfName"); + vq.evel_voice_quality_addl_info_add("Name1", "value1"); + vq.evel_voice_quality_addl_info_add("Name2", "value2"); + AgentMain.evel_post_event(vq); + + + // be.addEvent(vq); + + +/* + * EvelVoiceQuality Change End + * */ + + + EvelOther ev = new EvelOther("MyCustomEvent_vVNF", "vmname_ip"); + ev.evel_other_field_add("name1", "value1"); + ev.evel_other_field_add("name2", "value2"); + ev.evel_other_field_add("name3", "value3"); + ev.evel_other_field_add("name4", "value4"); + + ev.evel_other_field_add_namedarray("value3", "name3", "value6"); + ev.evel_other_field_add_namedarray("value1", "name4", "value7"); + ev.evel_other_field_add_namedarray("value1", "name4", "value7"); + ev.evel_other_field_add_namedarray("value4", "name5", "value8"); + AgentMain.evel_post_event(ev); + + + // be.addEvent(ev); + +/* + * EvelOther Change End + * */ + + + String dateStart = "01/14/2012 09:29:58"; + String dateStop = "01/15/2012 10:31:48"; + + //HH converts hour in 24 hours format (0-23), day calculation + SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + + Date d1 = null; + Date d2 = null; + + try { + d1 = format.parse(dateStart); + d2 = format.parse(dateStop); + }catch (Exception e) { + e.printStackTrace(); + } + EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip", "CRIT", + "mcastRxPackets", EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_CLEAR, + "Mcast Rx breached", + EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_CARD_ANOMALY, + + d1, EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL, + d2); + + tca.evel_threshold_cross_alertvalue_set("alertvalue"); + tca.evel_threshold_cross_data_collector_set("data_collector"); + tca.evel_threshold_cross_data_elementtype_set("data_elementtype"); + tca.evel_threshold_cross_interfacename_set("interfacename"); + tca.evel_threshold_cross_networkservice_set("networkservice"); + tca.evel_threshold_cross_possible_rootcause_set("possible_rootcause"); + + + + + tca.evel_thresholdcross_addl_info_add("addname1", "addvalue1"); + tca.evel_thresholdcross_addl_info_add("addname2", "addvalue2"); + tca.evel_thresholdcross_alertid_add("alert1"); + tca.evel_thresholdcross_alertid_add("alert2"); + tca.evel_thresholdcross_alertid_add("alert3"); + tca.evel_thresholdcross_hashMap_add("hashName", "hashValue"); + + AgentMain.evel_post_event(tca); + + // be.addEvent(tca); + + + + +/* + * EvelThresholdCross Change End + * */ + + + + EvelMobileFlow mf = new EvelMobileFlow("MobileFlow_vVNF", "vmname_ip", + "In", + null, + "GTP", + "v2.3", + "1.2.3.4", + 345556, + "5.6.7.8", + 334344); + MOBILE_GTP_PER_FLOW_METRICS mygtp = mf.new MOBILE_GTP_PER_FLOW_METRICS( + 1.01, + 2.02, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + d1, + "ACTIVE", + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28); + mf.gtp_per_flow_metrics = mygtp; + + + mf.evel_mobile_gtp_metrics_iptos_set(mygtp,2, 3); + mf.evel_mobile_gtp_metrics_iptos_set(mygtp,5, 6); + + mf.evel_mobile_gtp_metrics_tcp_flag_count_add(mygtp, 3, 4); + mf.evel_mobile_gtp_metrics_tcp_flag_count_add(mygtp, 5, 8); + + mf.evel_mobile_gtp_metrics_qci_cos_count_add(mygtp, 2, 3); + mf.evel_mobile_gtp_metrics_qci_cos_count_add(mygtp, 5, 6); + + + + + + + + mf.evel_mobile_flow_addl_field_add("mobileFlowName1", "mobileValue1"); + + mf.evel_mobile_flow_app_type_set("application type"); + AgentMain.evel_post_event(mf); + + // be.addEvent(mf); + // AgentMain.evel_post_event(be); + +/* + * EvelMobileFlow Change End + * */ + + + } //srikanth no need for forloop , send only once. + + AgentMain.evel_shutdown(); + + } +} + diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java b/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java index 285ea01..d1dd3d4 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java @@ -31,7 +31,7 @@ import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CPU_USE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_MEM_USE; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LATENCY_BUCKET; import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_DISK_USE; -import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_VNIC_PERFORMANCE; +import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_NIC_PERFORMANCE; import evel_javalibrary.att.com.EvelStateChange.EVEL_ENTITY_STATE; import evel_javalibrary.att.com.EvelThresholdCross.EVEL_ALERT_TYPE; import evel_javalibrary.att.com.EvelThresholdCross.EVEL_EVENT_ACTION; @@ -62,7 +62,6 @@ import javax.json.Json; import javax.json.JsonObject; import javax.json.JsonObjectBuilder; -import java.net.HttpURLConnection; @PrepareForTest({AgentMain.class}) @RunWith(PowerMockRunner.class) @@ -234,7 +233,7 @@ public class TestJunit { sm.evel_measurement_cpu_use_system_set(my1,0.5); sm.evel_measurement_cpu_use_usageuser_set(my1,0.5); - MEASUREMENT_MEM_USE mym1 = sm.evel_measurement_new_mem_use_add("mem1", "vm1",123456.0); + MEASUREMENT_MEM_USE mym1 = sm.evel_measurement_new_mem_use_add("mem1",123456.0); sm.evel_measurement_mem_use_memcache_set(mym1, 456.); sm.evel_measurement_mem_use_memconfig_set(mym1, 456.); sm.evel_measurement_mem_use_memfree_set(mym1, 456.); @@ -286,7 +285,7 @@ public class TestJunit { sm.evel_measurement_disk_use_timewritemin_set(dsk,45.); - MEASUREMENT_VNIC_PERFORMANCE vnic_p = sm.evel_measurement_new_vnic_performance("vnic1","true"); + MEASUREMENT_NIC_PERFORMANCE vnic_p = sm.evel_measurement_new_vnic_performance("vnic1","true"); vnic_p.recvd_bcast_packets_acc.SetValue(2400000.0); vnic_p.recvd_mcast_packets_delta.SetValue(5677888.0); vnic_p.recvd_mcast_packets_acc.SetValue(5677888.0); @@ -302,8 +301,12 @@ public class TestJunit { sm.evel_meas_latency_bucket_low_end_set(myb,1.); sm.evel_meas_latency_bucket_add(myb); sm.evel_measurement_latency_add(1.,10.,20); + + /* + * Arguments updated 15/07/2018 + */ - sm.evel_measurement_vnic_performance_add("vnic","vals", 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.); + sm.evel_measurement_vnic_performance_add("vnic","vals","5 mbps", 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,29.,30.,31.,32.,33.,34.,35.,36.); when(mymainmock.evel_post_event(sm)).thenReturn(true); boolean ret = mymainmock.evel_post_event(sm); @@ -395,7 +398,11 @@ public class TestJunit { "calleeSideCodc", "callerSideCodc", "corlator", "midCllRtcp", "juniper"); - vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 180, 190); + /* + * Arguments updated 15/07/2018 + */ + vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 20, 30, 40, 50, 60, 70, 80, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 190, 200,210,220,230,240,250,260,270,280,290,300); + //vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 190, 200,210,220,230,240,250,260,270,280,290,300); vq.evel_voice_quality_addl_info_add("bgpb", "fail"); vq.evel_voice_quality_callee_codec_set("codec1"); vq.evel_voice_quality_caller_codec_set("codec1"); @@ -404,7 +411,11 @@ public class TestJunit { vq.evel_voice_quality_vnfmodule_name_set("mod1"); vq.evel_voice_quality_vnfname_set("mod1"); vq.evel_voice_quality_phone_number_set("1234-567-8910"); - vq.evel_voice_quality_end_metrics_set("name","descr", 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12,13.,14.,15.,16.,17.,18.,19.); + /* + * Arguments updated 15/07/2018 + */ + + // vq.evel_voice_quality_end_metrics_set("name","descr",2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12,13.,14.,15.,16.,17.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,29.,30.); when(mymainmock.evel_post_event(vq)).thenReturn(true); boolean ret = mymainmock.evel_post_event(vq); @@ -468,17 +479,25 @@ public class TestJunit { } - EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip", - "CRIT", - "mcast Limit reached", - "mcastRxPackets", - "1250000000", - EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_SET, - "Mcast Rx breached", - EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_ELEMENT_ANOMALY, - d1, - EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL, - d2); +// EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip", +// "CRIT", +// "mcast Limit reached", +// "mcastRxPackets", +// "1250000000", +// EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_SET, +// "Mcast Rx breached", +// EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_ELEMENT_ANOMALY, +// d1, +// EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL, +// d2); + + EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip", "CRIT", + "mcastRxPackets", EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_CLEAR, + "Mcast Rx breached", + EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_CARD_ANOMALY, + + d1, EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL, + d2); tca.evel_threshold_cross_interfacename_set("ns345"); tca.evel_thresholdcross_addl_info_add("n1", "v1"); tca.evel_thresholdcross_addl_info_add("n2", "v2"); @@ -556,26 +575,6 @@ public class TestJunit { assertTrue( ret ); } - @Test - public void testBlockingPost() throws Exception, IOException { - EvelFault flt = new EvelFault("Fault_vVNF", "vmname_ip", - "NIC error", "Hardware failed", - EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH, - EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR, - EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD, - EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE); - flt.evel_fault_addl_info_add("nichw", "fail"); - flt.evel_fault_addl_info_add("nicsw", "fail"); - flt.evel_fault_category_set("intftype"); - flt.evel_fault_interface_set("eth0"); - flt.evel_fault_type_set("vmintf"); - when(mymainmock.sendObjectWithReturn(any(EvelObject.class))).thenReturn(200); - when(mymainmock.evel_post_event_immediate(flt)).thenCallRealMethod(); - int ret = mymainmock.evel_post_event_immediate(flt); - LOG.info("Returned "+ret); - assertEquals(200, ret); - - } } |