From 07d2f84907e776383572fa5cc89071d90a8be36b Mon Sep 17 00:00:00 2001 From: Vengada Govindan Date: Thu, 25 Aug 2016 10:34:34 -0700 Subject: Move iOAM Trace as a plugin Change-Id: I78322e91485e5429871bd356f668b8ed90f4265a Signed-off-by: Vengada Govindan --- vpp-api-test/vat/api_format.c | 110 ++++++------------------------------------ 1 file changed, 16 insertions(+), 94 deletions(-) (limited to 'vpp-api-test/vat') diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 7458ae3c21d..3b93c985791 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -3407,9 +3407,8 @@ _(want_stats_reply) \ _(cop_interface_enable_disable_reply) \ _(cop_whitelist_enable_disable_reply) \ _(sw_interface_clear_stats_reply) \ -_(trace_profile_add_reply) \ -_(trace_profile_apply_reply) \ -_(trace_profile_del_reply) \ +_(ioam_enable_reply) \ +_(ioam_disable_reply) \ _(lisp_add_del_locator_reply) \ _(lisp_add_del_local_eid_reply) \ _(lisp_add_del_remote_mapping_reply) \ @@ -3599,9 +3598,8 @@ _(COP_INTERFACE_ENABLE_DISABLE_REPLY, cop_interface_enable_disable_reply) \ _(COP_WHITELIST_ENABLE_DISABLE_REPLY, cop_whitelist_enable_disable_reply) \ _(GET_NODE_GRAPH_REPLY, get_node_graph_reply) \ _(SW_INTERFACE_CLEAR_STATS_REPLY, sw_interface_clear_stats_reply) \ -_(TRACE_PROFILE_ADD_REPLY, trace_profile_add_reply) \ -_(TRACE_PROFILE_APPLY_REPLY, trace_profile_apply_reply) \ -_(TRACE_PROFILE_DEL_REPLY, trace_profile_del_reply) \ +_(IOAM_ENABLE_REPLY, ioam_enable_reply) \ +_(IOAM_DISABLE_REPLY, ioam_disable_reply) \ _(LISP_ADD_DEL_LOCATOR_SET_REPLY, lisp_add_del_locator_set_reply) \ _(LISP_ADD_DEL_LOCATOR_REPLY, lisp_add_del_locator_reply) \ _(LISP_ADD_DEL_LOCAL_EID_REPLY, lisp_add_del_local_eid_reply) \ @@ -7172,24 +7170,20 @@ api_l2_patch_add_del (vat_main_t * vam) } static int -api_trace_profile_add (vat_main_t * vam) +api_ioam_enable (vat_main_t * vam) { unformat_input_t *input = vam->input; - vl_api_trace_profile_add_t *mp; + vl_api_ioam_enable_t *mp; f64 timeout; u32 id = 0; - u32 trace_option_elts = 0; - u32 trace_type = 0, node_id = 0, app_data = 0, trace_tsp = 2; + int has_trace_option = 0; int has_pow_option = 0; int has_ppc_option = 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { - if (unformat (input, "id %d trace-type 0x%x trace-elts %d " - "trace-tsp %d node-id 0x%x app-data 0x%x", - &id, &trace_type, &trace_option_elts, &trace_tsp, - &node_id, &app_data)) - ; + if (unformat (input, "trace")) + has_trace_option = 1; else if (unformat (input, "pow")) has_pow_option = 1; else if (unformat (input, "ppc encap")) @@ -7201,15 +7195,11 @@ api_trace_profile_add (vat_main_t * vam) else break; } - M (TRACE_PROFILE_ADD, trace_profile_add); + M (IOAM_ENABLE, ioam_enable); mp->id = htons (id); - mp->trace_type = trace_type; - mp->trace_num_elt = trace_option_elts; mp->trace_ppc = has_ppc_option; - mp->trace_app_data = htonl (app_data); mp->pow_enable = has_pow_option; - mp->trace_tsp = trace_tsp; - mp->node_id = htonl (node_id); + mp->trace_enable = has_trace_option; S; W; @@ -7218,78 +7208,14 @@ api_trace_profile_add (vat_main_t * vam) } -static int -api_trace_profile_apply (vat_main_t * vam) -{ - unformat_input_t *input = vam->input; - vl_api_trace_profile_apply_t *mp; - f64 timeout; - ip6_address_t addr; - u32 mask_width = ~0; - int is_add = 0; - int is_pop = 0; - int is_none = 0; - u32 vrf_id = 0; - u32 id = 0; - - while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) - { - if (unformat (input, "%U/%d", unformat_ip6_address, &addr, &mask_width)) - ; - else if (unformat (input, "id %d", &id)) - ; - else if (unformat (input, "vrf-id %d", &vrf_id)) - ; - else if (unformat (input, "add")) - is_add = 1; - else if (unformat (input, "pop")) - is_pop = 1; - else if (unformat (input, "none")) - is_none = 1; - else - break; - } - - if ((is_add + is_pop + is_none) != 1) - { - errmsg ("One of (add, pop, none) required"); - return -99; - } - if (mask_width == ~0) - { - errmsg ("
/ required"); - return -99; - } - M (TRACE_PROFILE_APPLY, trace_profile_apply); - clib_memcpy (mp->dest_ipv6, &addr, sizeof (mp->dest_ipv6)); - mp->id = htons (id); - mp->prefix_length = htonl (mask_width); - mp->vrf_id = htonl (vrf_id); - if (is_add) - mp->trace_op = IOAM_HBYH_ADD; - else if (is_pop) - mp->trace_op = IOAM_HBYH_POP; - else - mp->trace_op = IOAM_HBYH_MOD; - - if (is_none) - mp->enable = 0; - else - mp->enable = 1; - - S; - W; - - return 0; -} static int -api_trace_profile_del (vat_main_t * vam) +api_ioam_disable (vat_main_t * vam) { - vl_api_trace_profile_del_t *mp; + vl_api_ioam_disable_t *mp; f64 timeout; - M (TRACE_PROFILE_DEL, trace_profile_del); + M (IOAM_DISABLE, ioam_disable); S; W; return 0; @@ -15879,12 +15805,8 @@ _(cop_whitelist_enable_disable, " | sw_if_index \n" \ "fib-id [ip4][ip6][default]") \ _(get_node_graph, " ") \ _(sw_interface_clear_stats," | sw_if_index ") \ -_(trace_profile_add, "id trace-type <0x1f|0x3|0x9|0x11|0x19> " \ - "trace-elts trace-tsp <0|1|2|3> node-id " \ - "app-data [pow] [ppc ]") \ -_(trace_profile_apply, "id /" \ - " vrf_id add | pop | none") \ -_(trace_profile_del, "") \ +_(ioam_enable, "[trace] [pow] [ppc ]") \ +_(ioam_disable, "") \ _(lisp_add_del_locator_set, "locator-set [iface |"\ " sw_if_index p " \ "w ] [del]") \ -- cgit 1.2.3-korg