X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vpp-api-test%2Fvat%2Fapi_format.c;h=50153fe3202e156ecbe787f7444fb8d444869851;hb=00bbf276be22fa0458366d4dd3f4daf4e55d13e7;hp=a1a023be28b231789a89a364744a388fbca72ce2;hpb=ef65cb0696b3ee42834a72a35c1eb08da75eed99;p=vpp.git diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index a1a023be28b..50153fe3202 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -587,6 +587,7 @@ static void vl_api_sw_interface_details_t_handler_json vat_json_object_add_uint(node, "link_up_down", mp->link_up_down); vat_json_object_add_uint(node, "link_duplex", mp->link_duplex); vat_json_object_add_uint(node, "link_speed", mp->link_speed); + vat_json_object_add_uint(node, "mtu", ntohs(mp->link_mtu)); vat_json_object_add_uint(node, "sub_id", ntohl(mp->sub_id)); vat_json_object_add_uint(node, "sub_dot1ad", mp->sub_dot1ad); vat_json_object_add_uint(node, "sub_number_of_tags", mp->sub_number_of_tags); @@ -619,7 +620,7 @@ static void vl_api_sw_interface_set_flags_t_handler_json /* JSON output not supported */ } -static void vl_api_cli_reply_t_handler +static void vl_api_cli_reply_t_handler (vl_api_cli_reply_t * mp) { vat_main_t * vam = &vat_main; @@ -1895,7 +1896,8 @@ _(map_add_del_rule_reply) \ _(want_interface_events_reply) \ _(want_stats_reply) \ _(cop_interface_enable_disable_reply) \ -_(cop_whitelist_enable_disable_reply) +_(cop_whitelist_enable_disable_reply) \ +_(sw_interface_clear_stats_reply) #define _(n) \ static void vl_api_##n##_t_handler \ @@ -2048,7 +2050,8 @@ _(WANT_STATS_REPLY, want_stats_reply) \ _(GET_FIRST_MSG_ID_REPLY, get_first_msg_id_reply) \ _(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) +_(GET_NODE_GRAPH_REPLY, get_node_graph_reply) \ +_(SW_INTERFACE_CLEAR_STATS_REPLY, sw_interface_clear_stats_reply) /* M: construct, but don't yet send a message */ @@ -2427,7 +2430,8 @@ int exec (vat_main_t * vam) while (vat_time_now (vam) < timeout) { if (vam->result_ready == 1) { u8 * free_me; - fformat (vam->ofp, "%s", vam->shmem_result); + if (vam->shmem_result != NULL) + fformat (vam->ofp, "%s", vam->shmem_result); pthread_mutex_lock (&am->vlib_rp->mutex); oldheap = svm_push_data_heap (am->vlib_rp); @@ -2668,6 +2672,39 @@ static int api_sw_interface_set_flags (vat_main_t * vam) W; } +static int api_sw_interface_clear_stats (vat_main_t * vam) +{ + unformat_input_t * i = vam->input; + vl_api_sw_interface_clear_stats_t *mp; + f64 timeout; + u32 sw_if_index; + u8 sw_if_index_set = 0; + + /* Parse args required to build the message */ + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { + if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index)) + sw_if_index_set = 1; + else if (unformat (i, "sw_if_index %d", &sw_if_index)) + sw_if_index_set = 1; + else + break; + } + + /* Construct the API message */ + M(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats); + + if (sw_if_index_set == 1) + mp->sw_if_index = ntohl (sw_if_index); + else + mp->sw_if_index = ~0; + + /* send it... */ + S; + + /* Wait for a reply, return the good/bad news... */ + W; +} + static int api_sw_interface_add_del_address (vat_main_t * vam) { unformat_input_t * i = vam->input; @@ -9062,7 +9099,8 @@ _(get_first_msg_id, "client ") \ _(cop_interface_enable_disable, " | sw_if_index [disable]") \ _(cop_whitelist_enable_disable, " | sw_if_index \n" \ "fib-id [ip4][ip6][default]") \ -_(get_node_graph, " ") +_(get_node_graph, " ") \ +_(sw_interface_clear_stats," | sw_if_index ") /* List of command functions, CLI names map directly to functions */ #define foreach_cli_function \