diff options
Diffstat (limited to 'vpp-api-test/vat')
-rw-r--r-- | vpp-api-test/vat/api_format.c | 101 |
1 files changed, 98 insertions, 3 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 4776e2adca1..ceda982d645 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -2231,7 +2231,9 @@ _(lisp_enable_disable_reply) \ _(vxlan_gpe_add_del_tunnel_reply) \ _(af_packet_create_reply) \ _(af_packet_delete_reply) \ -_(policer_add_del_reply) +_(policer_add_del_reply) \ +_(netmap_create_reply) \ +_(netmap_delete_reply) #define _(n) \ static void vl_api_##n##_t_handler \ @@ -2412,7 +2414,9 @@ _(LISP_ENABLE_DISABLE_STATUS_DETAILS, \ lisp_enable_disable_status_details) \ _(AF_PACKET_CREATE_REPLY, af_packet_create_reply) \ _(AF_PACKET_DELETE_REPLY, af_packet_delete_reply) \ -_(POLICER_ADD_DEL_REPLY, policer_add_del_reply) +_(POLICER_ADD_DEL_REPLY, policer_add_del_reply) \ +_(NETMAP_CREATE_REPLY, netmap_create_reply) \ +_(NETMAP_DELETE_REPLY, netmap_delete_reply) /* M: construct, but don't yet send a message */ @@ -10328,6 +10332,94 @@ api_policer_add_del (vat_main_t * vam) return 0; } +static int +api_netmap_create (vat_main_t * vam) +{ + unformat_input_t * i = vam->input; + vl_api_netmap_create_t * mp; + f64 timeout; + u8 * if_name = 0; + u8 hw_addr[6]; + u8 random_hw_addr = 1; + u8 is_pipe = 0; + u8 is_master = 0; + + memset (hw_addr, 0, sizeof (hw_addr)); + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { + if (unformat (i, "name %s", &if_name)) + vec_add1 (if_name, 0); + else if (unformat (i, "hw_addr %U", unformat_ethernet_address, hw_addr)) + random_hw_addr = 0; + else if (unformat (i, "pipe")) + is_pipe = 1; + else if (unformat (i, "master")) + is_master = 1; + else if (unformat (i, "slave")) + is_master = 0; + else + break; + } + + if (!vec_len (if_name)) { + errmsg ("interface name must be specified"); + return -99; + } + + if (vec_len (if_name) > 64) { + errmsg ("interface name too long"); + return -99; + } + + M(NETMAP_CREATE, netmap_create); + + clib_memcpy (mp->if_name, if_name, vec_len (if_name)); + clib_memcpy (mp->hw_addr, hw_addr, 6); + mp->use_random_hw_addr = random_hw_addr; + mp->is_pipe = is_pipe; + mp->is_master = is_master; + vec_free (if_name); + + S; W; + /* NOTREACHED */ + return 0; +} + +static int +api_netmap_delete (vat_main_t * vam) +{ + unformat_input_t * i = vam->input; + vl_api_netmap_delete_t * mp; + f64 timeout; + u8 * if_name = 0; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { + if (unformat (i, "name %s", &if_name)) + vec_add1 (if_name, 0); + else + break; + } + + if (!vec_len (if_name)) { + errmsg ("interface name must be specified"); + return -99; + } + + if (vec_len (if_name) > 64) { + errmsg ("interface name too long"); + return -99; + } + + M(NETMAP_DELETE, netmap_delete); + + clib_memcpy (mp->if_name, if_name, vec_len (if_name)); + vec_free (if_name); + + S; W; + /* NOTREACHED */ + return 0; +} + static int q_or_quit (vat_main_t * vam) { longjmp (vam->jump_buf, 1); @@ -10814,7 +10906,10 @@ _(lisp_map_resolver_dump, "") \ _(lisp_enable_disable_status_dump, "") \ _(af_packet_create, "name <host interface name> [hw_addr <mac>]") \ _(af_packet_delete, "name <host interface name>") \ -_(policer_add_del, "name <policer name> <params> [del]") +_(policer_add_del, "name <policer name> <params> [del]") \ +_(netmap_create, "name <interface name> [hw-addr <mac>] [pipe] " \ + "[master|slave]") \ +_(netmap_delete, "name <interface name>") /* List of command functions, CLI names map directly to functions */ #define foreach_cli_function \ |