X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvat%2Fapi_format.c;h=cc0f5bef8e44a6fedcfd32b059389bd806865417;hb=4c4223edf;hp=7d16441f03b399f568ee7300ec8a7da96e724ac7;hpb=7784140f2bd2d5ae44f2be1507ac25f102006155;p=vpp.git diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 7d16441f03b..cc0f5bef8e4 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -2,7 +2,7 @@ *------------------------------------------------------------------ * api_format.c * - * Copyright (c) 2014-2016 Cisco and/or its affiliates. + * Copyright (c) 2014-2020 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -1931,7 +1930,7 @@ static void vl_api_bond_delete_reply_t_handler_json } static void -vl_api_bond_enslave_reply_t_handler (vl_api_bond_enslave_reply_t * mp) +vl_api_bond_add_member_reply_t_handler (vl_api_bond_add_member_reply_t * mp) { vat_main_t *vam = &vat_main; i32 retval = ntohl (mp->retval); @@ -1947,8 +1946,8 @@ vl_api_bond_enslave_reply_t_handler (vl_api_bond_enslave_reply_t * mp) } } -static void vl_api_bond_enslave_reply_t_handler_json - (vl_api_bond_enslave_reply_t * mp) +static void vl_api_bond_add_member_reply_t_handler_json + (vl_api_bond_add_member_reply_t * mp) { vat_main_t *vam = &vat_main; vat_json_node_t node; @@ -1964,8 +1963,8 @@ static void vl_api_bond_enslave_reply_t_handler_json } static void -vl_api_bond_detach_slave_reply_t_handler (vl_api_bond_detach_slave_reply_t * - mp) +vl_api_bond_detach_member_reply_t_handler (vl_api_bond_detach_member_reply_t * + mp) { vat_main_t *vam = &vat_main; i32 retval = ntohl (mp->retval); @@ -1981,8 +1980,8 @@ vl_api_bond_detach_slave_reply_t_handler (vl_api_bond_detach_slave_reply_t * } } -static void vl_api_bond_detach_slave_reply_t_handler_json - (vl_api_bond_detach_slave_reply_t * mp) +static void vl_api_bond_detach_member_reply_t_handler_json + (vl_api_bond_detach_member_reply_t * mp) { vat_main_t *vam = &vat_main; vat_json_node_t node; @@ -2040,8 +2039,8 @@ api_sw_interface_set_bond_weight (vat_main_t * vam) return ret; } -static void vl_api_sw_interface_bond_details_t_handler - (vl_api_sw_interface_bond_details_t * mp) +static void vl_api_sw_bond_interface_details_t_handler + (vl_api_sw_bond_interface_details_t * mp) { vat_main_t *vam = &vat_main; @@ -2049,11 +2048,11 @@ static void vl_api_sw_interface_bond_details_t_handler "%-16s %-12d %-12U %-13U %-14u %-14u", mp->interface_name, ntohl (mp->sw_if_index), format_bond_mode, ntohl (mp->mode), format_bond_load_balance, - ntohl (mp->lb), ntohl (mp->active_slaves), ntohl (mp->slaves)); + ntohl (mp->lb), ntohl (mp->active_members), ntohl (mp->members)); } -static void vl_api_sw_interface_bond_details_t_handler_json - (vl_api_sw_interface_bond_details_t * mp) +static void vl_api_sw_bond_interface_details_t_handler_json + (vl_api_sw_bond_interface_details_t * mp) { vat_main_t *vam = &vat_main; vat_json_node_t *node = NULL; @@ -2071,24 +2070,38 @@ static void vl_api_sw_interface_bond_details_t_handler_json mp->interface_name); vat_json_object_add_uint (node, "mode", ntohl (mp->mode)); vat_json_object_add_uint (node, "load_balance", ntohl (mp->lb)); - vat_json_object_add_uint (node, "active_slaves", ntohl (mp->active_slaves)); - vat_json_object_add_uint (node, "slaves", ntohl (mp->slaves)); + vat_json_object_add_uint (node, "active_members", + ntohl (mp->active_members)); + vat_json_object_add_uint (node, "members", ntohl (mp->members)); } static int -api_sw_interface_bond_dump (vat_main_t * vam) +api_sw_bond_interface_dump (vat_main_t * vam) { - vl_api_sw_interface_bond_dump_t *mp; + unformat_input_t *i = vam->input; + vl_api_sw_bond_interface_dump_t *mp; vl_api_control_ping_t *mp_ping; int ret; + u32 sw_if_index = ~0; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) + ; + else if (unformat (i, "sw_if_index %d", &sw_if_index)) + ; + else + break; + } print (vam->ofp, "\n%-16s %-12s %-12s %-13s %-14s %-14s", "interface name", "sw_if_index", "mode", "load balance", - "active slaves", "slaves"); + "active members", "members"); /* Get list of bond interfaces */ - M (SW_INTERFACE_BOND_DUMP, mp); + M (SW_BOND_INTERFACE_DUMP, mp); + mp->sw_if_index = ntohl (sw_if_index); S (mp); /* Use a control ping for synchronization */ @@ -2099,8 +2112,8 @@ api_sw_interface_bond_dump (vat_main_t * vam) return ret; } -static void vl_api_sw_interface_slave_details_t_handler - (vl_api_sw_interface_slave_details_t * mp) +static void vl_api_sw_member_interface_details_t_handler + (vl_api_sw_member_interface_details_t * mp) { vat_main_t *vam = &vat_main; @@ -2110,8 +2123,8 @@ static void vl_api_sw_interface_slave_details_t_handler ntohl (mp->weight), mp->is_local_numa); } -static void vl_api_sw_interface_slave_details_t_handler_json - (vl_api_sw_interface_slave_details_t * mp) +static void vl_api_sw_member_interface_details_t_handler_json + (vl_api_sw_member_interface_details_t * mp) { vat_main_t *vam = &vat_main; vat_json_node_t *node = NULL; @@ -2134,10 +2147,10 @@ static void vl_api_sw_interface_slave_details_t_handler_json } static int -api_sw_interface_slave_dump (vat_main_t * vam) +api_sw_member_interface_dump (vat_main_t * vam) { unformat_input_t *i = vam->input; - vl_api_sw_interface_slave_dump_t *mp; + vl_api_sw_member_interface_dump_t *mp; vl_api_control_ping_t *mp_ping; u32 sw_if_index = ~0; u8 sw_if_index_set = 0; @@ -2162,11 +2175,11 @@ api_sw_interface_slave_dump (vat_main_t * vam) print (vam->ofp, "\n%-25s %-12s %-7s %-12s %-10s %-10s", - "slave interface name", "sw_if_index", "passive", "long_timeout", + "member interface name", "sw_if_index", "passive", "long_timeout", "weight", "local numa"); /* Get list of bond interfaces */ - M (SW_INTERFACE_SLAVE_DUMP, mp); + M (SW_MEMBER_INTERFACE_DUMP, mp); mp->sw_if_index = ntohl (sw_if_index); S (mp); @@ -2901,7 +2914,7 @@ unformat_nsh_address (unformat_input_t * input, va_list * args) return unformat (input, "SPI:%d SI:%d", &nsh->spi, &nsh->si); } -u8 * +static u8 * format_nsh_address_vat (u8 * s, va_list * args) { nsh_t *a = va_arg (*args, nsh_t *); @@ -2958,7 +2971,7 @@ vl_api_one_eid_table_details_t_handler (vl_api_one_eid_table_details_t * mp) s = format (0, "%d", clib_net_to_host_u32 (mp->locator_set_index)); eid = format (0, "%U", format_lisp_eid_vat, - mp->deid, mp->seid, mp->is_src_dst); + &mp->deid, &mp->seid, mp->is_src_dst); vec_add1 (eid, 0); print (vam->ofp, "[%d] %-35s%-20s%-30s%-20d%-20d%-10d%-20s", @@ -3007,7 +3020,7 @@ vl_api_one_eid_table_details_t_handler_json (vl_api_one_eid_table_details_t else { eid = format (0, "%U", format_lisp_eid_vat, - mp->deid, mp->seid, mp->is_src_dst); + &mp->deid, &mp->seid, mp->is_src_dst); vec_add1 (eid, 0); vat_json_object_add_string_copy (node, "eid", eid); vec_free (eid); @@ -3031,9 +3044,9 @@ vl_api_one_stats_details_t_handler (vl_api_one_stats_details_t * mp) u8 *seid = 0, *deid = 0; ip46_address_t lloc, rloc; - deid = format (0, "%U", format_lisp_eid_vat, mp->deid, 0); + deid = format (0, "%U", format_lisp_eid_vat, &mp->deid, 0, 0); - seid = format (0, "%U", format_lisp_eid_vat, mp->seid, 0); + seid = format (0, "%U", format_lisp_eid_vat, &mp->seid, 0, 0); vec_add1 (deid, 0); vec_add1 (seid, 0); @@ -3079,9 +3092,9 @@ vl_api_one_stats_details_t_handler_json (vl_api_one_stats_details_t * mp) node = vat_json_array_add (&vam->json_tree); vat_json_init_object (node); - deid = format (0, "%U", format_lisp_eid_vat, mp->deid, 0); + deid = format (0, "%U", format_lisp_eid_vat, &mp->deid, 0, 0); - seid = format (0, "%U", format_lisp_eid_vat, mp->seid, 0); + seid = format (0, "%U", format_lisp_eid_vat, &mp->seid, 0, 0); vec_add1 (deid, 0); vec_add1 (seid, 0); @@ -5231,11 +5244,11 @@ _(VIRTIO_PCI_DELETE_REPLY, virtio_pci_delete_reply) \ _(SW_INTERFACE_VIRTIO_PCI_DETAILS, sw_interface_virtio_pci_details) \ _(BOND_CREATE_REPLY, bond_create_reply) \ _(BOND_DELETE_REPLY, bond_delete_reply) \ -_(BOND_ENSLAVE_REPLY, bond_enslave_reply) \ -_(BOND_DETACH_SLAVE_REPLY, bond_detach_slave_reply) \ +_(BOND_ADD_MEMBER_REPLY, bond_add_member_reply) \ +_(BOND_DETACH_MEMBER_REPLY, bond_detach_member_reply) \ _(SW_INTERFACE_SET_BOND_WEIGHT_REPLY, sw_interface_set_bond_weight_reply) \ -_(SW_INTERFACE_BOND_DETAILS, sw_interface_bond_details) \ -_(SW_INTERFACE_SLAVE_DETAILS, sw_interface_slave_details) \ +_(SW_BOND_INTERFACE_DETAILS, sw_bond_interface_details) \ +_(SW_MEMBER_INTERFACE_DETAILS, sw_member_interface_details) \ _(IP_ROUTE_ADD_DEL_REPLY, ip_route_add_del_reply) \ _(IP_TABLE_ADD_DEL_REPLY, ip_table_add_del_reply) \ _(IP_TABLE_REPLACE_BEGIN_REPLY, ip_table_replace_begin_reply) \ @@ -7748,10 +7761,10 @@ api_bond_delete (vat_main_t * vam) } static int -api_bond_enslave (vat_main_t * vam) +api_bond_add_member (vat_main_t * vam) { unformat_input_t *i = vam->input; - vl_api_bond_enslave_t *mp; + vl_api_bond_add_member_t *mp; u32 bond_sw_if_index; int ret; u8 is_passive; @@ -7782,12 +7795,12 @@ api_bond_enslave (vat_main_t * vam) } if (sw_if_index_is_set == 0) { - errmsg ("Missing slave sw_if_index. "); + errmsg ("Missing member sw_if_index. "); return -99; } /* Construct the API message */ - M (BOND_ENSLAVE, mp); + M (BOND_ADD_MEMBER, mp); mp->bond_sw_if_index = ntohl (bond_sw_if_index); mp->sw_if_index = ntohl (sw_if_index); @@ -7803,10 +7816,10 @@ api_bond_enslave (vat_main_t * vam) } static int -api_bond_detach_slave (vat_main_t * vam) +api_bond_detach_member (vat_main_t * vam) { unformat_input_t *i = vam->input; - vl_api_bond_detach_slave_t *mp; + vl_api_bond_detach_member_t *mp; u32 sw_if_index = ~0; u8 sw_if_index_set = 0; int ret; @@ -7829,7 +7842,7 @@ api_bond_detach_slave (vat_main_t * vam) } /* Construct the API message */ - M (BOND_DETACH_SLAVE, mp); + M (BOND_DETACH_MEMBER, mp); mp->sw_if_index = ntohl (sw_if_index); @@ -12675,15 +12688,28 @@ static void vl_api_sw_interface_vhost_user_details_t_handler_json static int api_sw_interface_vhost_user_dump (vat_main_t * vam) { + unformat_input_t *i = vam->input; vl_api_sw_interface_vhost_user_dump_t *mp; vl_api_control_ping_t *mp_ping; int ret; + u32 sw_if_index = ~0; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) + ; + else if (unformat (i, "sw_if_index %d", &sw_if_index)) + ; + else + break; + } + print (vam->ofp, "Interface name idx hdr_sz features server regions filename"); /* Get list of vhost-user interfaces */ M (SW_INTERFACE_VHOST_USER_DUMP, mp); - mp->sw_if_index = ntohl (~0); + mp->sw_if_index = ntohl (sw_if_index); S (mp); /* Use a control ping for synchronization */ @@ -20606,13 +20632,13 @@ _(bond_create, \ "[id ]") \ _(bond_delete, \ " | sw_if_index ") \ -_(bond_enslave, \ +_(bond_add_member, \ "sw_if_index bond [is_passive] [is_long_timeout]") \ -_(bond_detach_slave, \ +_(bond_detach_member, \ "sw_if_index ") \ _(sw_interface_set_bond_weight, " | sw_if_index weight ") \ -_(sw_interface_bond_dump, "") \ -_(sw_interface_slave_dump, \ + _(sw_bond_interface_dump, " | sw_if_index ") \ + _(sw_member_interface_dump, \ " | sw_if_index ") \ _(ip_table_add_del, \ "table [ipv6] [add | del]\n") \ @@ -20729,7 +20755,7 @@ _(modify_vhost_user_if, \ " | sw_if_index socket \n" \ "[server] [renumber ] [gso] [packed]") \ _(delete_vhost_user_if, " | sw_if_index ") \ -_(sw_interface_vhost_user_dump, "") \ +_(sw_interface_vhost_user_dump, " | sw_if_index ") \ _(show_version, "") \ _(show_threads, "") \ _(vxlan_gpe_add_del_tunnel, \