aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam/analyse
diff options
context:
space:
mode:
authorAkshayaNadahalli <anadahal@cisco.com>2017-01-23 22:05:35 +0530
committerAkshayaNadahalli <anadahal@cisco.com>2017-03-07 14:08:22 +0000
commit1b563527c143903b6e7e79b5978af5310372f605 (patch)
tree7b673272cb930e03b77dd376f581d903c219a566 /src/plugins/ioam/analyse
parent066f034b903bda6e938bec1b12f01edef65ee9c4 (diff)
In-band OAM active probe (VPP-471)
Change-Id: Icf0ddf76ba1c8b588c79387284cd0349ebc6e45f Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
Diffstat (limited to 'src/plugins/ioam/analyse')
-rw-r--r--src/plugins/ioam/analyse/ioam_analyse.h106
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c13
-rwxr-xr-xsrc/plugins/ioam/analyse/ioam_summary_export.h2
3 files changed, 115 insertions, 6 deletions
diff --git a/src/plugins/ioam/analyse/ioam_analyse.h b/src/plugins/ioam/analyse/ioam_analyse.h
index 3c69d71f349..b7576012e56 100644
--- a/src/plugins/ioam/analyse/ioam_analyse.h
+++ b/src/plugins/ioam/analyse/ioam_analyse.h
@@ -31,6 +31,7 @@ typedef struct
u16 ingress_if;
u16 egress_if;
u32 node_id;
+ u32 state_up;
} ioam_path_map_t;
/** @brief Analysed iOAM trace data.
@@ -176,6 +177,100 @@ ip6_ioam_analyse_calc_delay (ioam_trace_hdr_t * trace, u16 trace_len,
return (f64) (end_time - start_time);
}
+always_inline void
+ip6_ioam_analyse_set_paths_down (ioam_analyser_data_t * data)
+{
+ ioam_analyse_trace_data *trace_data;
+ ioam_analyse_trace_record *trace_record;
+ ioam_path_map_t *path;
+ u8 k, i;
+
+ while (__sync_lock_test_and_set (data->writer_lock, 1))
+ ;
+
+ trace_data = &data->trace_data;
+
+ for (i = 0; i < IOAM_MAX_PATHS_PER_FLOW; i++)
+ {
+ trace_record = trace_data->path_data + i;
+
+ if (trace_record->is_free)
+ continue;
+
+ path = trace_record->path;
+
+ for (k = 0; k < trace_record->num_nodes; k++)
+ path[k].state_up = 0;
+ }
+ *(data->writer_lock) = 0;
+}
+
+always_inline void
+ip6_ioam_analyse_hbh_trace_loopback (ioam_analyser_data_t * data,
+ ioam_trace_hdr_t * trace, u16 trace_len)
+{
+ ioam_analyse_trace_data *trace_data;
+ ioam_analyse_trace_record *trace_record;
+ ioam_path_map_t *path;
+ u8 i, j, k, num_nodes, max_nodes;
+ u8 *ptr;
+ u32 nodeid;
+ u16 ingress_if, egress_if;
+ u16 size_of_traceopt_per_node;
+ u16 size_of_all_traceopts;
+
+ while (__sync_lock_test_and_set (data->writer_lock, 1))
+ ;
+
+ trace_data = &data->trace_data;
+
+ size_of_traceopt_per_node = fetch_trace_data_size (trace->ioam_trace_type);
+ size_of_all_traceopts = trace_len;
+
+ ptr = (u8 *) trace->elts;
+ max_nodes = (u8) (size_of_all_traceopts / size_of_traceopt_per_node);
+ num_nodes = max_nodes - trace->data_list_elts_left;
+
+ for (i = 0; i < IOAM_MAX_PATHS_PER_FLOW; i++)
+ {
+ trace_record = trace_data->path_data + i;
+ path = trace_record->path;
+
+ if (trace_record->is_free)
+ continue;
+
+ for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
+ {
+ ptr =
+ (u8 *) ((u8 *) trace->elts +
+ (size_of_traceopt_per_node * (j - 1)));
+
+ nodeid = clib_net_to_host_u32 (*((u32 *) ptr)) & 0x00ffffff;
+ ptr += 4;
+
+ if (nodeid != path[k].node_id)
+ goto end;
+
+ if ((trace->ioam_trace_type == TRACE_TYPE_IF_TS_APP) ||
+ (trace->ioam_trace_type == TRACE_TYPE_IF))
+ {
+ ingress_if = clib_net_to_host_u16 (*((u16 *) ptr));
+ ptr += 2;
+ egress_if = clib_net_to_host_u16 (*((u16 *) ptr));
+ if ((ingress_if != path[k].ingress_if) ||
+ (egress_if != path[k].egress_if))
+ {
+ goto end;
+ }
+ }
+ /* Found Match - set path hop state to up */
+ path[k].state_up = 1;
+ }
+ }
+end:
+ *(data->writer_lock) = 0;
+}
+
always_inline int
ip6_ioam_analyse_hbh_trace (ioam_analyser_data_t * data,
ioam_trace_hdr_t * trace, u16 pak_len,
@@ -285,6 +380,10 @@ ip6_ioam_analyse_hbh_trace (ioam_analyser_data_t * data,
}
found_match:
+ /* Set path state to UP */
+ for (k = 0; k < num_nodes; k++)
+ path[k].state_up = 1;
+
trace_record->pkt_counter++;
trace_record->bytes_counter += pak_len;
if (trace->ioam_trace_type & BIT_TIMESTAMP)
@@ -328,8 +427,11 @@ format_path_map (u8 * s, va_list * args)
for (i = 0; i < num_of_elts; i++)
{
- s = format (s, "node_id: 0x%x, ingress_if: 0x%x, egress_if:0x%x\n",
- pm->node_id, pm->ingress_if, pm->egress_if);
+ s =
+ format (s,
+ "node_id: 0x%x, ingress_if: 0x%x, egress_if:0x%x, state:%s\n",
+ pm->node_id, pm->ingress_if, pm->egress_if,
+ pm->state_up ? "UP" : "DOWN");
pm++;
}
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index afda3099c9a..17fcf7a5b7e 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -114,7 +114,10 @@ ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
/* Add ioamPathMap manually */
f->e_id_length = ipfix_e_id_length (0 /* enterprise */ ,
- ioamPathMap, (1 * sizeof (ioam_path)));
+ ioamPathMap,
+ (sizeof (ioam_path) +
+ (sizeof (ioam_path_map_t) *
+ IOAM_TRACE_MAX_NODES)));
f++;
/* Back to the template packet... */
@@ -229,8 +232,9 @@ ioam_analyse_add_ipfix_record (flow_report_t * fr,
path->pkt_counter = trace->pkt_counter - trace_cached->pkt_counter;
path->pkt_counter = clib_host_to_net_u32 (path->pkt_counter);
+ offset += sizeof (ioam_path);
- for (j = 0; j < IOAM_TRACE_MAX_NODES; j++)
+ for (j = 0; j < trace->num_nodes; j++)
{
path->path[j].node_id =
clib_host_to_net_u32 (trace->path[j].node_id);
@@ -238,9 +242,11 @@ ioam_analyse_add_ipfix_record (flow_report_t * fr,
clib_host_to_net_u16 (trace->path[j].ingress_if);
path->path[j].egress_if =
clib_host_to_net_u16 (trace->path[j].egress_if);
+ path->path[j].state_up = trace->path[j].state_up;
}
- offset += sizeof (ioam_path);
+ //offset += (sizeof(ioam_path_map_t) * trace->num_nodes);
+ offset += (sizeof (ioam_path_map_t) * IOAM_TRACE_MAX_NODES); //FIXME
}
}
@@ -312,6 +318,7 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
tp = vlib_buffer_get_current (b0);
ip = &tp->ip4;
+ udp = &tp->udp;
h = &tp->ipfix.h;
s = &tp->ipfix.s;
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.h b/src/plugins/ioam/analyse/ioam_summary_export.h
index 9be31d2e5ed..b435506187d 100755
--- a/src/plugins/ioam/analyse/ioam_summary_export.h
+++ b/src/plugins/ioam/analyse/ioam_summary_export.h
@@ -60,7 +60,7 @@ typedef struct
u32 mean_delay;
u32 pkt_counter;
u32 bytes_counter;
- ioam_path_map_t path[IOAM_TRACE_MAX_NODES];
+ ioam_path_map_t path[0];
} ioam_path;
clib_error_t *ioam_flow_create (u8 del);