X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vpp-api-test%2Fvat%2Fapi_format.c;h=0926dfb0a206b51640440407731a79b55223148d;hb=1edfba9a6394128ee5fad2b413e9e0a05972ef48;hp=7dcd0597a64838ec2add9e345a6d40f7c435e7e8;hpb=07e7eab371951c41b413a689779258a619565a13;p=vpp.git diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 7dcd0597a64..0926dfb0a20 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -1134,6 +1134,21 @@ vl_api_ip4_arp_event_t_handler_json (vl_api_ip4_arp_event_t * mp) /* JSON output not supported */ } +static void +vl_api_ip6_nd_event_t_handler (vl_api_ip6_nd_event_t * mp) +{ + vat_main_t *vam = &vat_main; + errmsg ("ip6 nd event: address %U new mac %U sw_if_index %d\n", + format_ip6_address, mp->address, + format_ethernet_address, mp->new_mac, mp->sw_if_index); +} + +static void +vl_api_ip6_nd_event_t_handler_json (vl_api_ip6_nd_event_t * mp) +{ + /* JSON output not supported */ +} + /* * Special-case: build the bridge domain table, maintain * the next bd id vbl. @@ -2361,40 +2376,37 @@ static void } static void -vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp) +add_lisp_eid_table_entry (vat_main_t * vam, + vl_api_lisp_eid_table_details_t * mp) { - vat_main_t *vam = &vat_main; eid_table_t eid_table; memset (&eid_table, 0, sizeof (eid_table)); eid_table.is_local = mp->is_local; - eid_table.locator_set_index = mp->locator_set_index; + eid_table.locator_set_index = clib_net_to_host_u32 (mp->locator_set_index); eid_table.eid_type = mp->eid_type; - eid_table.vni = mp->vni; + eid_table.vni = clib_net_to_host_u32 (mp->vni); eid_table.eid_prefix_len = mp->eid_prefix_len; - eid_table.ttl = mp->ttl; + eid_table.ttl = clib_net_to_host_u32 (mp->ttl); + eid_table.action = mp->action; eid_table.authoritative = mp->authoritative; clib_memcpy (eid_table.eid, mp->eid, sizeof (eid_table.eid)); vec_add1 (vam->eid_tables, eid_table); } +static void +vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp) +{ + vat_main_t *vam = &vat_main; + add_lisp_eid_table_entry (vam, mp); +} + static void vl_api_lisp_eid_table_details_t_handler_json (vl_api_lisp_eid_table_details_t * mp) { vat_main_t *vam = &vat_main; - eid_table_t eid_table; - - memset (&eid_table, 0, sizeof (eid_table)); - eid_table.is_local = mp->is_local; - eid_table.locator_set_index = mp->locator_set_index; - eid_table.eid_type = mp->eid_type; - eid_table.vni = mp->vni; - eid_table.eid_prefix_len = mp->eid_prefix_len; - eid_table.ttl = mp->ttl; - eid_table.authoritative = mp->authoritative; - clib_memcpy (eid_table.eid, mp->eid, sizeof (eid_table.eid)); - vec_add1 (vam->eid_tables, eid_table); + add_lisp_eid_table_entry (vam, mp); } static void @@ -2405,7 +2417,7 @@ static void u8 *line = format (0, "%=10d%=10d", clib_net_to_host_u32 (mp->vni), - clib_net_to_host_u32 (mp->vrf)); + clib_net_to_host_u32 (mp->dp_table)); fformat (vam->ofp, "%v\n", line); vec_free (line); } @@ -2424,7 +2436,8 @@ static void } node = vat_json_array_add (&vam->json_tree); vat_json_init_object (node); - vat_json_object_add_uint (node, "vrf", clib_net_to_host_u32 (mp->vrf)); + vat_json_object_add_uint (node, "dp_table", + clib_net_to_host_u32 (mp->dp_table)); vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni)); } @@ -3343,6 +3356,7 @@ _(l2_interface_vlan_tag_rewrite_reply) \ _(modify_vhost_user_if_reply) \ _(delete_vhost_user_if_reply) \ _(want_ip4_arp_events_reply) \ +_(want_ip6_nd_events_reply) \ _(input_acl_set_interface_reply) \ _(ipsec_spd_add_del_reply) \ _(ipsec_interface_add_del_spd_reply) \ @@ -3387,7 +3401,8 @@ _(ipfix_enable_reply) \ _(pg_capture_reply) \ _(pg_enable_disable_reply) \ _(ip_source_and_port_range_check_add_del_reply) \ -_(ip_source_and_port_range_check_interface_add_del_reply) +_(ip_source_and_port_range_check_interface_add_del_reply)\ +_(delete_subif_reply) #define _(n) \ static void vl_api_##n##_t_handler \ @@ -3520,6 +3535,8 @@ _(VXLAN_GPE_TUNNEL_DETAILS, vxlan_gpe_tunnel_details) \ _(INTERFACE_NAME_RENUMBER_REPLY, interface_name_renumber_reply) \ _(WANT_IP4_ARP_EVENTS_REPLY, want_ip4_arp_events_reply) \ _(IP4_ARP_EVENT, ip4_arp_event) \ +_(WANT_IP6_ND_EVENTS_REPLY, want_ip6_nd_events_reply) \ +_(IP6_ND_EVENT, ip6_nd_event) \ _(INPUT_ACL_SET_INTERFACE_REPLY, input_acl_set_interface_reply) \ _(IP_ADDRESS_DETAILS, ip_address_details) \ _(IP_DETAILS, ip_details) \ @@ -3606,7 +3623,8 @@ _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY, \ _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY, \ ip_source_and_port_range_check_interface_add_del_reply) \ _(IPSEC_GRE_ADD_DEL_TUNNEL_REPLY, ipsec_gre_add_del_tunnel_reply) \ -_(IPSEC_GRE_TUNNEL_DETAILS, ipsec_gre_tunnel_details) +_(IPSEC_GRE_TUNNEL_DETAILS, ipsec_gre_tunnel_details) \ +_(DELETE_SUBIF_REPLY, delete_subif_reply) /* M: construct, but don't yet send a message */ @@ -10212,6 +10230,41 @@ api_want_ip4_arp_events (vat_main_t * vam) W; } +static int +api_want_ip6_nd_events (vat_main_t * vam) +{ + unformat_input_t *line_input = vam->input; + vl_api_want_ip6_nd_events_t *mp; + f64 timeout; + ip6_address_t address; + int address_set = 0; + u32 enable_disable = 1; + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "address %U", unformat_ip6_address, &address)) + address_set = 1; + else if (unformat (line_input, "del")) + enable_disable = 0; + else + break; + } + + if (address_set == 0) + { + errmsg ("missing addresses\n"); + return -99; + } + + M (WANT_IP6_ND_EVENTS, want_ip6_nd_events); + mp->enable_disable = enable_disable; + mp->pid = getpid (); + clib_memcpy (mp->address, &address, sizeof (ip6_address_t)); + + S; + W; +} + static int api_input_acl_set_interface (vat_main_t * vam) { @@ -11713,7 +11766,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam) vec_len (locator_set_name)); vec_free (locator_set_name); - mp->locator_num = vec_len (locators); + mp->locator_num = clib_host_to_net_u32 (vec_len (locators)); if (locators) clib_memcpy (mp->locators, locators, (sizeof (ls_locator_t) * vec_len (locators))); @@ -12333,11 +12386,17 @@ api_lisp_eid_table_add_del_map (vat_main_t * vam) return -99; } + if (vrf_set && bd_index_set) + { + errmsg ("error: both vrf and bd entered!"); + return -99; + } + M (LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map); mp->is_add = is_add; mp->vni = htonl (vni); - mp->dp_table = htonl (vrf); + mp->dp_table = vrf_set ? htonl (vrf) : htonl (bd_index); mp->is_l2 = bd_index_set; /* send */ @@ -12457,7 +12516,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam) mp->eid_type = eid->type; lisp_eid_put_vat (mp->eid, eid->addr, eid->type); - mp->rloc_num = vec_len (rlocs); + mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs)); clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs))); vec_free (rlocs); @@ -13117,15 +13176,45 @@ api_lisp_locator_set_dump (vat_main_t * vam) static int api_lisp_eid_table_map_dump (vat_main_t * vam) { + u8 is_l2 = 0; + u8 mode_set = 0; + unformat_input_t *input = vam->input; vl_api_lisp_eid_table_map_dump_t *mp; f64 timeout = ~0; + /* Parse args required to build the message */ + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (input, "l2")) + { + is_l2 = 1; + mode_set = 1; + } + else if (unformat (input, "l3")) + { + is_l2 = 0; + mode_set = 1; + } + else + { + errmsg ("parse error '%U'", format_unformat_error, input); + return -99; + } + } + + if (!mode_set) + { + errmsg ("expected one of 'l2' or 'l3' parameter!\n"); + return -99; + } + if (!vam->json_output) { - fformat (vam->ofp, "%=10s%=10s\n", "VNI", "VRF"); + fformat (vam->ofp, "%=10s%=10s\n", "VNI", is_l2 ? "BD" : "VRF"); } M (LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump); + mp->is_l2 = is_l2; /* send it... */ S; @@ -13216,13 +13305,11 @@ format_eid_for_eid_table (vat_main_t * vam, u8 * str, eid_table_t * eid_table, case 1: format_eid = (eid_table->eid_type ? format_ip6_address : format_ip4_address); - str = format (0, "[%d] %U/%d", - clib_net_to_host_u32 (eid_table->vni), + str = format (0, "[%d] %U/%d", eid_table->vni, format_eid, eid_table->eid, eid_table->eid_prefix_len); break; case 2: - str = format (0, "[%d] %U", - clib_net_to_host_u32 (eid_table->vni), + str = format (0, "[%d] %U", eid_table->vni, format_ethernet_address, eid_table->eid); break; default: @@ -13277,6 +13364,11 @@ format_locator_for_eid_table (vat_main_t * vam, u8 * str, ASSERT (vam != NULL); ASSERT (eid_table != NULL); + if (~0 == eid_table->locator_set_index) + { + return format (0, "action: %d\n", eid_table->action); + } + vec_foreach (loc, vam->locator_msg) { if (!first_line) @@ -13335,13 +13427,17 @@ print_lisp_eid_table_dump (vat_main_t * vam) vec_foreach (eid_table, vam->eid_tables) { - ret = lisp_locator_dump_send_msg (vam, eid_table->locator_set_index, 0); - if (ret) + if (~0 != eid_table->locator_set_index) { - vec_free (vam->locator_msg); - clean_locator_set_message (vam); - vec_free (vam->eid_tables); - return ret; + ret = lisp_locator_dump_send_msg (vam, eid_table->locator_set_index, + 0); + if (ret) + { + vec_free (vam->locator_msg); + clean_locator_set_message (vam); + vec_free (vam->eid_tables); + return ret; + } } tmp_str2 = format_eid_for_eid_table (vam, tmp_str2, eid_table, &ret); @@ -15168,6 +15264,36 @@ api_ipsec_gre_tunnel_dump (vat_main_t * vam) W; } +static int +api_delete_subif (vat_main_t * vam) +{ + unformat_input_t *i = vam->input; + vl_api_delete_subif_t *mp; + f64 timeout; + u32 sw_if_index = ~0; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "sw_if_index %d", &sw_if_index)) + ; + else + break; + } + + if (sw_if_index == ~0) + { + errmsg ("missing sw_if_index\n"); + return -99; + } + + /* Construct the API message */ + M (DELETE_SUBIF, delete_subif); + mp->sw_if_index = ntohl (sw_if_index); + + S; + W; +} + static int q_or_quit (vat_main_t * vam) { @@ -15631,6 +15757,7 @@ _(input_acl_set_interface, \ " | sw_if_index [ip4-table ] [ip6-table ]\n" \ " [l2-table ] [del]") \ _(want_ip4_arp_events, "address [del]") \ +_(want_ip6_nd_events, "address [del]") \ _(ip_address_dump, "(ipv4 | ipv6) ( | sw_if_index )") \ _(ip_dump, "ipv4 | ipv6") \ _(ipsec_spd_add_del, "spd_id [del]") \ @@ -15707,8 +15834,8 @@ _(lisp_locator_set_dump, "[locator-set-index | " \ "locator-set ] [local | remote]")\ _(lisp_eid_table_dump, "[eid / | ] [vni] " \ "[local] | [remote]") \ -_(lisp_eid_table_map_dump, "") \ _(lisp_eid_table_vni_dump, "") \ +_(lisp_eid_table_map_dump, "l2|l3") \ _(lisp_gpe_tunnel_dump, "") \ _(lisp_map_resolver_dump, "") \ _(show_lisp_status, "") \ @@ -15748,7 +15875,8 @@ _(ip_source_and_port_range_check_interface_add_del, \ "[udp-in-vrf ] [udp-out-vrf ]") \ _(ipsec_gre_add_del_tunnel, \ "src dst local_sa remote_sa [del]") \ -_(ipsec_gre_tunnel_dump, "[sw_if_index ]") +_(ipsec_gre_tunnel_dump, "[sw_if_index ]") \ +_(delete_subif,"sub_sw_if_index sub_if_id ") /* List of command functions, CLI names map directly to functions */ #define foreach_cli_function \