From a32d00252c79f0e54b5d0b4dc090916b4d011f55 Mon Sep 17 00:00:00 2001 From: Gokul Singaraju Date: Fri, 29 Sep 2017 14:38:28 -0400 Subject: Add java util funcs for EvelHeader fix custom meas Issue-Id: VNFSDK-101 Change-Id: I849958f30abf003fb7ea5a8764d97e9ad5fd6e4f Signed-Off-by: Gokul Singaraju --- .gitreview | 4 ++ veslibrary/.README.swp | Bin 16384 -> 0 bytes .../src/evel_javalibrary/att/com/EvelFault.java | 5 +- .../src/evel_javalibrary/att/com/EvelHeader.java | 59 +++++++++++++++++++++ .../att/com/EvelScalingMeasurement.java | 7 ++- .../evel_javalib2/src_test/maindir/Main.java | 6 ++- 6 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 .gitreview delete mode 100644 veslibrary/.README.swp diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..148ca16 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=gerrit.onap.org +port=29418 +project=vnfsdk/compliance diff --git a/veslibrary/.README.swp b/veslibrary/.README.swp deleted file mode 100644 index 67e26f3..0000000 Binary files a/veslibrary/.README.swp and /dev/null differ diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java index a252378..584a8de 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelFault.java @@ -129,7 +129,7 @@ public class EvelFault extends EvelHeader { *****************************************************************************/ public EvelFault(String evname, String ev_id, String condition, String specproblem, - EvelHeader.PRIORITIES priority, + EvelHeader.PRIORITIES tpriority, EVEL_SEVERITIES severity, EVEL_SOURCE_TYPES ev_source_type, EVEL_VF_STATUSES status) @@ -140,7 +140,7 @@ public class EvelFault extends EvelHeader { //Validate inputs assert( condition != null); assert( specific_problem != null); - assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(priority) < 0 ); + assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(tpriority) < 0 ); assert(EVEL_SEVERITIES.EVEL_MAX_SEVERITIES.compareTo(severity) < 0 ); assert(EVEL_VF_STATUSES.EVEL_MAX_VF_STATUSES.compareTo(status) < 0 ); //Init mandatory fields @@ -149,6 +149,7 @@ public class EvelFault extends EvelHeader { alarm_condition = condition; specific_problem = specproblem; vf_status = status; + priority = tpriority; //Init optional fields category = new EvelOptionString(false, null); alarm_interface_a = new EvelOptionString(false, null); diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java index 8b5538b..cd1ac0b 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelHeader.java @@ -471,6 +471,65 @@ public class EvelHeader { EVEL_EXIT(); } + /**************************************************************************//** + * Set the Priority property of the event header. + * + * @note The Priority of event being reported. + * + * @param priorityval Value of priority. + * + *****************************************************************************/ + public void evel_header_set_priority(PRIORITIES priority_val) + { + EVEL_ENTER(); + + assert(EvelHeader.PRIORITIES.EVEL_MAX_PRIORITIES.compareTo(priority_val) < 0 ); + + priority = priority_val; + + EVEL_EXIT(); + } + + /**************************************************************************//** + * Set the Priority property of the event header. + * + * @note The Reporting Entity Id defaults to the OpenStack VM UUID. + * + * @param val Optional true or false. + * @param srcid The source id to set. + *****************************************************************************/ + public void evel_header_set_sourceid(boolean val, String srcid) + { + EVEL_ENTER(); + + assert(srcid != null); + + source_id.set_option(val); + + source_id.SetValue(srcid); + + EVEL_EXIT(); + } + + /**************************************************************************//** + * Set the Source name property of the event header. + * + * @note Source name should identify the IP address or Source Event originator + * for inventory + * + * @param srcname String for sourcename. + *****************************************************************************/ + public void evel_header_set_source_name(String srcname) + { + EVEL_ENTER(); + + assert(srcname != null); + + source_name = srcname; + + EVEL_EXIT(); + } + /**************************************************************************//** * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string. * diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java index 392de48..89897e9 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/evel_javalibrary/att/com/EvelScalingMeasurement.java @@ -1946,7 +1946,7 @@ public class EvelScalingMeasurement extends EvelHeader { for(int i=0;i(); if( additional_measurements == null){ + LOGGER.debug("Creating new Measurement Group list"+group); additional_measurements = new ArrayList(); if( additional_measurements == null ){ LOGGER.error("Unable to allocate additional measurements "); @@ -1977,6 +1979,7 @@ public class EvelScalingMeasurement extends EvelHeader { /***************************************************************************/ /* If we didn't have the group already, create it. */ /***************************************************************************/ + LOGGER.debug("Adding custom measurement"); measurement_group.measurements.add(custom_measurement); EVEL_EXIT(); @@ -3620,7 +3623,7 @@ public class EvelScalingMeasurement extends EvelHeader { .add("value",custom_meas.value); builder2.add(obj2.build()); } - obj.add("measurements", builder2); + obj.add("arrayOfFields", builder2); builder.add(obj.build()); } evelmeasmt.add("additionalMeasurements", builder); diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src_test/maindir/Main.java b/veslibrary/ves_javalibrary/evel_javalib2/src_test/maindir/Main.java index 756bac0..f3c676d 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src_test/maindir/Main.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src_test/maindir/Main.java @@ -57,6 +57,7 @@ public class Main AgentMain.evel_initialize("http://127.0.0.1", 30000, "/vendor_event_listener","/example_vnf", + //null,null "pill", "will", Level.DEBUG); @@ -106,7 +107,10 @@ public class Main MEASUREMENT_CPU_USE my2 = sm.evel_measurement_new_cpu_use_add("cpu2", 10.0); my2.steal.SetValue(34.0); my2.user.SetValue(32.0); - + sm.evel_measurement_custom_measurement_add("group1","name1","val1"); + sm.evel_measurement_custom_measurement_add("group1","name2","val2"); + sm.evel_measurement_custom_measurement_add("group2","name1","val1"); + sm.evel_measurement_custom_measurement_add("group2","name2","val2"); MEASUREMENT_VNIC_PERFORMANCE vnic_p = sm.evel_measurement_new_vnic_performance("vnic1","true"); vnic_p.recvd_bcast_packets_acc.SetValue(2400000.0); -- cgit 1.2.3-korg