diff options
author | Gokul Singaraju <goksing@gmail.com> | 2017-09-29 14:38:28 -0400 |
---|---|---|
committer | Gokul Singaraju <goksing@gmail.com> | 2017-09-29 14:43:57 -0400 |
commit | a32d00252c79f0e54b5d0b4dc090916b4d011f55 (patch) | |
tree | cd7edefaa39eae902d4c41193fcd99e7942b958d /veslibrary/ves_javalibrary/evel_javalib2/src | |
parent | a43e38e7bdc183709399bc49179b7137c6debe23 (diff) |
Add java util funcs for EvelHeader fix custom meas
Issue-Id: VNFSDK-101
Change-Id: I849958f30abf003fb7ea5a8764d97e9ad5fd6e4f
Signed-Off-by: Gokul Singaraju <goksing@gmail.com>
Diffstat (limited to 'veslibrary/ves_javalibrary/evel_javalib2/src')
3 files changed, 67 insertions, 4 deletions
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 @@ -472,6 +472,65 @@ public class EvelHeader { }
/**************************************************************************//**
+ * 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.
*
* @param domain The domain to convert.
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<additional_measurements.size();i++)
{
item = additional_measurements.get(i);
- if( item.name.equals(name))
+ if( item.name.equals(group))
{
LOGGER.debug("Found existing Measurement Group");
measurement_group = item;
@@ -1965,7 +1965,9 @@ public class EvelScalingMeasurement extends EvelHeader { assert(measurement_group != null);
measurement_group.name = group;
assert(measurement_group.name != null);
+ measurement_group.measurements = new ArrayList<CUSTOM_MEASUREMENT>();
if( additional_measurements == null){
+ LOGGER.debug("Creating new Measurement Group list"+group);
additional_measurements = new ArrayList<MEASUREMENT_GROUP>();
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);
|