aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/VES5.0/evel/evel-library/code
diff options
context:
space:
mode:
authorMarco Platania <platania@research.att.com>2018-06-11 14:12:09 +0000
committerGerrit Code Review <gerrit@onap.org>2018-06-11 14:12:09 +0000
commit12f6d79d758048a7acd0615d1eee01686f05fd06 (patch)
treebf22a87ae3a99c54a9b3f2ec60c6e03125a7922b /vnfs/VES5.0/evel/evel-library/code
parent287b9b36c979a20a33f158c4b68e063896f5526c (diff)
parent14193fcf7c0529eaed7b6197bde976a900db8415 (diff)
Merge "Implement sequencing for faults only"
Diffstat (limited to 'vnfs/VES5.0/evel/evel-library/code')
-rw-r--r--vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h36
-rw-r--r--vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c40
-rw-r--r--vnfs/VES5.0/evel/evel-library/code/evel_library/evel_fault.c4
-rw-r--r--vnfs/VES5.0/evel/evel-library/code/evel_library/evel_json_buffer.c15
-rw-r--r--vnfs/VES5.0/evel/evel-library/code/evel_library/evel_jsonobject.c2
-rw-r--r--vnfs/VES5.0/evel/evel-library/code/evel_library/evel_other.c2
-rw-r--r--vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c2
7 files changed, 73 insertions, 28 deletions
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h
index b483b1f0..8f497987 100644
--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h
+++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h
@@ -495,7 +495,7 @@ void evel_free_batch(EVENT_HEADER * event);
/* Supported Fault version. */
/*****************************************************************************/
#define EVEL_FAULT_MAJOR_VERSION 2
-#define EVEL_FAULT_MINOR_VERSION 1
+#define EVEL_FAULT_MINOR_VERSION 0
/**************************************************************************//**
* Fault.
@@ -581,7 +581,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;
@@ -649,7 +649,7 @@ void evel_free_jsonobject(EVEL_JSON_OBJECT * jsobj);
/* Supported Measurement version. */
/*****************************************************************************/
#define EVEL_MEASUREMENT_MAJOR_VERSION 2
-#define EVEL_MEASUREMENT_MINOR_VERSION 1
+#define EVEL_MEASUREMENT_MINOR_VERSION 0
/**************************************************************************//**
* Errors.
@@ -1073,7 +1073,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.
@@ -1226,7 +1226,7 @@ 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_MINOR_VERSION 0
/**************************************************************************//**
* Other.
@@ -1256,7 +1256,7 @@ 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_MINOR_VERSION 0
/*****************************************************************************/
@@ -1318,8 +1318,8 @@ typedef struct signaling_additional_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 2
+#define EVEL_STATE_CHANGE_MINOR_VERSION 0
/**************************************************************************//**
* State Change.
@@ -1643,6 +1643,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.
@@ -4068,7 +4086,7 @@ int evel_get_measurement_interval();
/* Supported Report version. */
/*****************************************************************************/
#define EVEL_VOICEQ_MAJOR_VERSION 1
-#define EVEL_VOICEQ_MINOR_VERSION 1
+#define EVEL_VOICEQ_MINOR_VERSION 0
/**************************************************************************//**
* End of Call Voice Quality Metrices
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c
index 5babb67c..1656fa75 100644
--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c
+++ b/vnfs/VES5.0/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();
@@ -168,7 +168,7 @@ 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;
@@ -180,8 +180,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname)
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->source_id);
evel_init_option_intheader(&header->internal_field);
dlist_initialize(&header->batch_events);
@@ -210,7 +210,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,11 +221,10 @@ 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++;
/***************************************************************************/
/* Optional parameters. */
@@ -233,8 +232,8 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event
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->source_id);
evel_init_option_intheader(&header->internal_field);
dlist_initialize(&header->batch_events);
@@ -270,6 +269,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.
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_fault.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_fault.c
index 38b07a74..401e4ad0 100644
--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_fault.c
+++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_fault.c
@@ -92,6 +92,10 @@ 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);
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_json_buffer.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_json_buffer.c
index cae5ab17..cf1323d7 100644
--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_json_buffer.c
+++ b/vnfs/VES5.0/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/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_jsonobject.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_jsonobject.c
index 8bf2b70f..df0b03cc 100644
--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_jsonobject.c
+++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_jsonobject.c
@@ -298,7 +298,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");
}
/**************************************************************************//**
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_other.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_other.c
index 360f5b91..5f59c1df 100644
--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_other.c
+++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_other.c
@@ -359,7 +359,7 @@ 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"))
{
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c
index 84d2564b..677cb8ea 100644
--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c
+++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c
@@ -3138,7 +3138,7 @@ void evel_json_encode_measurement(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"))
{