From 20a64f5f8a3dc6132c79da074adc7de1f037a154 Mon Sep 17 00:00:00 2001 From: Shwetha Date: Fri, 25 Mar 2016 10:55:01 +0000 Subject: iOAM trace configuration APIs Change-Id: I6d31f0ddb812d148ad065e27775440d09f402def Signed-off-by: Shwetha --- vpp/api/api.c | 63 ++++++++++++++++++++++++++++++++++++++++++++- vpp/api/vpe.api | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 1 deletion(-) (limited to 'vpp') diff --git a/vpp/api/api.c b/vpp/api/api.c index 40cfa27b..aae8a19d 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -70,6 +70,7 @@ #include #include #include +#include #undef BIHASH_TYPE #undef __included_bihash_template_h__ @@ -312,7 +313,10 @@ _(MAP_SUMMARY_STATS, map_summary_stats) \ _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \ _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \ _(GET_NODE_GRAPH, get_node_graph) \ -_(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) +_(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \ +_(TRACE_PROFILE_ADD, trace_profile_add) \ +_(TRACE_PROFILE_APPLY, trace_profile_apply) \ +_(TRACE_PROFILE_DEL, trace_profile_del) #define QUOTE_(x) #x #define QUOTE(x) QUOTE_(x) @@ -4997,6 +5001,63 @@ static void vl_api_get_node_graph_t_handler rmp->reply_in_shmem = (uword) vector); } +static void vl_api_trace_profile_add_t_handler +(vl_api_trace_profile_add_t *mp) +{ + int rv = 0; + vl_api_trace_profile_add_reply_t * rmp; + clib_error_t *error; + + /* Ignoring the profile id as currently a single profile + * is supported */ + error = ip6_ioam_trace_profile_set(mp->trace_num_elt, mp->trace_type, + ntohl(mp->node_id), ntohl(mp->trace_app_data), + mp->pow_enable, mp->trace_tsp, + mp->trace_ppc); + if (error) { + clib_error_report(error); + rv = clib_error_get_code(error); + } + + REPLY_MACRO(VL_API_TRACE_PROFILE_ADD_REPLY); +} + +static void vl_api_trace_profile_apply_t_handler +(vl_api_trace_profile_apply_t *mp) +{ + int rv = 0; + vl_api_trace_profile_apply_reply_t * rmp; + + if (mp->enable != 0) { + rv = ip6_ioam_set_destination ((ip6_address_t *)(&mp->dest_ipv6), + ntohl(mp->prefix_length), + ntohl(mp->vrf_id), + mp->trace_op == IOAM_HBYH_ADD, + mp->trace_op == IOAM_HBYH_POP, + mp->trace_op == IOAM_HBYH_MOD); + } else { + //ip6_ioam_clear_destination(&ip6, mp->prefix_length, mp->vrf_id); + } + REPLY_MACRO(VL_API_TRACE_PROFILE_APPLY_REPLY); +} + +static void vl_api_trace_profile_del_t_handler +(vl_api_trace_profile_del_t *mp) +{ + int rv = 0; + vl_api_trace_profile_del_reply_t * rmp; + clib_error_t *error; + + error = clear_ioam_rewrite_fn(); + if (error) { + clib_error_report(error); + rv = clib_error_get_code(error); + } + + REPLY_MACRO(VL_API_TRACE_PROFILE_DEL_REPLY); +} + + #define BOUNCE_HANDLER(nn) \ static void vl_api_##nn##_t_handler ( \ vl_api_##nn##_t *mp) \ diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api index 29cd1bad..dd20a0b8 100644 --- a/vpp/api/vpe.api +++ b/vpp/api/vpe.api @@ -2862,3 +2862,83 @@ define sw_interface_clear_stats_reply { u32 context; i32 retval; }; + +/** \brief IOAM Trace : Set TRACE profile + @param id - profile id + @param trace_type - Trace type + @param trace_num_elt - Number of nodes in trace path + @param trace_ppc - Trace PPC (none/encap/decap) + @param trace_tsp - Trace timestamp precision (0-sec,1-ms,2-us,3-ns) + @param trace_app_data - Trace application data, can be any 4 bytes + @param pow_enable - Proof of Work enabled or not flag + @param node_id - Id of this node +*/ +define trace_profile_add { + u32 client_index; + u32 context; + u16 id; + u8 trace_type; + u8 trace_num_elt; + u8 trace_ppc; + u8 trace_tsp; + u32 trace_app_data; + u8 pow_enable; + u32 node_id; +}; + +/** \brief Trace profile add / del response + @param context - sender context, to match reply w/ request + @param retval - return value for request +*/ +define trace_profile_add_reply { + u32 context; + i32 retval; +}; + +/** \brief IOAM Trace enable trace profile for a flow + @param id - id of the trace profile to be applied + @param dest_ipv6 - Destination IPv6 address + @param prefix_length - prefix mask + @param vrf_id - VRF ID + @param trace_op - Trace operation (add/mod/del) + @param enable - apply/remove the trace profile for the flow +*/ +define trace_profile_apply { + u32 client_index; + u32 context; + u16 id; + u8 dest_ipv6[16]; + u32 prefix_length; + u32 vrf_id; + u8 trace_op; + u8 enable; +}; + +/** \brief Trace profile apply response + @param context - sender context, to match reply w/ request + @param retval - return value for request +*/ +define trace_profile_apply_reply { + u32 context; + i32 retval; +}; + +/** \brief Delete Trace Profile + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + @param index - MAP Domain index +*/ +define trace_profile_del { + u32 client_index; + u32 context; + u16 id; +}; + +/** \brief Trace profile add / del response + @param context - sender context, to match reply w/ request + @param retval - return value for request +*/ +define trace_profile_del_reply { + u32 context; + i32 retval; +}; -- cgit