X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vpp-api-test%2Fvat%2Fapi_format.c;h=c77571a7357f11cfcf9db17b034c298febad2e15;hb=7c8eda16d4bc10bf779200b23369e2ee12843dc1;hp=6f11083844bcbd487e4e718cf1b26e75eec9d325;hpb=948e00ff5eded0806fc7f54e8f3943aade2bd14a;p=vpp.git diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 6f11083844b..c77571a7357 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -3811,7 +3811,9 @@ _(IPSEC_GRE_ADD_DEL_TUNNEL_REPLY, ipsec_gre_add_del_tunnel_reply) \ _(IPSEC_GRE_TUNNEL_DETAILS, ipsec_gre_tunnel_details) \ _(DELETE_SUBIF_REPLY, delete_subif_reply) \ _(L2_INTERFACE_PBB_TAG_REWRITE_REPLY, l2_interface_pbb_tag_rewrite_reply) \ -_(PUNT_REPLY, punt_reply) +_(PUNT_REPLY, punt_reply) \ +_(IP_FIB_DETAILS, ip_fib_details) \ +_(IP6_FIB_DETAILS, ip6_fib_details) /* M: construct, but don't yet send a message */ @@ -6325,9 +6327,6 @@ api_mpls_ip_bind_unbind (vat_main_t * vam) /* Wait for a reply... */ W; - - /* Return the good/bad news */ - return (vam->retval); } static int @@ -7814,28 +7813,28 @@ api_ioam_enable (vat_main_t * vam) f64 timeout; u32 id = 0; int has_trace_option = 0; - int has_pow_option = 0; - int has_ppc_option = 0; + int has_pot_option = 0; + int has_seqno_option = 0; + int has_analyse_option = 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "trace")) has_trace_option = 1; - else if (unformat (input, "pow")) - has_pow_option = 1; - else if (unformat (input, "ppc encap")) - has_ppc_option = PPC_ENCAP; - else if (unformat (input, "ppc decap")) - has_ppc_option = PPC_DECAP; - else if (unformat (input, "ppc none")) - has_ppc_option = PPC_NONE; + else if (unformat (input, "pot")) + has_pot_option = 1; + else if (unformat (input, "seqno")) + has_seqno_option = 1; + else if (unformat (input, "analyse")) + has_analyse_option = 1; else break; } M (IOAM_ENABLE, ioam_enable); mp->id = htons (id); - mp->trace_ppc = has_ppc_option; - mp->pow_enable = has_pow_option; + mp->seqno = has_seqno_option; + mp->analyse = has_analyse_option; + mp->pot_enable = has_pot_option; mp->trace_enable = has_trace_option; S; @@ -10069,13 +10068,7 @@ static uword unformat_vxlan_decap_next u32 *result = va_arg (*args, u32 *); u32 tmp; - if (unformat (input, "drop")) - *result = VXLAN_INPUT_NEXT_DROP; - else if (unformat (input, "ip4")) - *result = VXLAN_INPUT_NEXT_IP4_INPUT; - else if (unformat (input, "ip6")) - *result = VXLAN_INPUT_NEXT_IP6_INPUT; - else if (unformat (input, "l2")) + if (unformat (input, "l2")) *result = VXLAN_INPUT_NEXT_L2_INPUT; else if (unformat (input, "%d", &tmp)) *result = tmp; @@ -14862,21 +14855,43 @@ api_mpls_fib_encap_dump (vat_main_t * vam) W; } +#define vl_api_mpls_fib_details_t_endian vl_noop_handler +#define vl_api_mpls_fib_details_t_print vl_noop_handler + static void vl_api_mpls_fib_details_t_handler (vl_api_mpls_fib_details_t * mp) { vat_main_t *vam = &vat_main; + int count = ntohl (mp->count); + vl_api_fib_path_t *fp; + int i; fformat (vam->ofp, "table-id %d, label %u, ess_bit %u\n", ntohl (mp->table_id), ntohl (mp->label), mp->eos_bit); + fp = mp->path; + for (i = 0; i < count; i++) + { + fformat (vam->ofp, + " weight %d, sw_if_index %d, is_local %d, is_drop %d, is_unreach %d, " + "is_prohitbit %d, afi %d, next_hop %U\n", ntohl (fp->weight), + ntohl (fp->sw_if_index), fp->is_local, fp->is_drop, + fp->is_unreach, fp->is_prohibit, fp->afi, format_ip46_address, + fp->next_hop, fp->afi); + fp++; + } } static void vl_api_mpls_fib_details_t_handler_json (vl_api_mpls_fib_details_t * mp) { vat_main_t *vam = &vat_main; + int count = ntohl (mp->count); vat_json_node_t *node = NULL; + struct in_addr ip4; + struct in6_addr ip6; + vl_api_fib_path_t *fp; + int i; if (VAT_JSON_ARRAY != vam->json_tree.type) { @@ -14889,6 +14904,28 @@ static void vl_api_mpls_fib_details_t_handler_json vat_json_object_add_uint (node, "table", ntohl (mp->table_id)); vat_json_object_add_uint (node, "s_bit", mp->eos_bit); vat_json_object_add_uint (node, "label", ntohl (mp->label)); + vat_json_object_add_uint (node, "path_count", count); + fp = mp->path; + for (i = 0; i < count; i++) + { + vat_json_object_add_uint (node, "weight", ntohl (fp->weight)); + vat_json_object_add_uint (node, "sw_if_index", ntohl (fp->sw_if_index)); + vat_json_object_add_uint (node, "is_local", fp->is_local); + vat_json_object_add_uint (node, "is_drop", fp->is_drop); + vat_json_object_add_uint (node, "is_unreach", fp->is_unreach); + vat_json_object_add_uint (node, "is_prohibit", fp->is_prohibit); + vat_json_object_add_uint (node, "next_hop_afi", fp->afi); + if (fp->afi == IP46_TYPE_IP4) + { + clib_memcpy (&ip4, &fp->next_hop, sizeof (ip4)); + vat_json_object_add_ip4 (node, "next_hop", ip4); + } + else if (fp->afi == IP46_TYPE_IP6) + { + clib_memcpy (&ip6, &fp->next_hop, sizeof (ip6)); + vat_json_object_add_ip6 (node, "next_hop", ip6); + } + } } static int @@ -14909,6 +14946,192 @@ api_mpls_fib_dump (vat_main_t * vam) W; } +#define vl_api_ip_fib_details_t_endian vl_noop_handler +#define vl_api_ip_fib_details_t_print vl_noop_handler + +static void +vl_api_ip_fib_details_t_handler (vl_api_ip_fib_details_t * mp) +{ + vat_main_t *vam = &vat_main; + int count = ntohl (mp->count); + vl_api_fib_path_t *fp; + int i; + + fformat (vam->ofp, + "table-id %d, prefix %U/%d\n", + ntohl (mp->table_id), format_ip4_address, mp->address, + mp->address_length); + fp = mp->path; + for (i = 0; i < count; i++) + { + fformat (vam->ofp, + " weight %d, sw_if_index %d, is_local %d, is_drop %d, is_unreach %d, " + "is_prohitbit %d, afi %d, next_hop %U\n", ntohl (fp->weight), + ntohl (fp->sw_if_index), fp->is_local, fp->is_drop, + fp->is_unreach, fp->is_prohibit, fp->afi, format_ip46_address, + fp->next_hop, fp->afi); + fp++; + } +} + +static void vl_api_ip_fib_details_t_handler_json + (vl_api_ip_fib_details_t * mp) +{ + vat_main_t *vam = &vat_main; + int count = ntohl (mp->count); + vat_json_node_t *node = NULL; + struct in_addr ip4; + struct in6_addr ip6; + vl_api_fib_path_t *fp; + int i; + + if (VAT_JSON_ARRAY != vam->json_tree.type) + { + ASSERT (VAT_JSON_NONE == vam->json_tree.type); + vat_json_init_array (&vam->json_tree); + } + node = vat_json_array_add (&vam->json_tree); + + vat_json_init_object (node); + vat_json_object_add_uint (node, "table", ntohl (mp->table_id)); + clib_memcpy (&ip4, &mp->address, sizeof (ip4)); + vat_json_object_add_ip4 (node, "prefix", ip4); + vat_json_object_add_uint (node, "mask_length", mp->address_length); + vat_json_object_add_uint (node, "path_count", count); + fp = mp->path; + for (i = 0; i < count; i++) + { + vat_json_object_add_uint (node, "weight", ntohl (fp->weight)); + vat_json_object_add_uint (node, "sw_if_index", ntohl (fp->sw_if_index)); + vat_json_object_add_uint (node, "is_local", fp->is_local); + vat_json_object_add_uint (node, "is_drop", fp->is_drop); + vat_json_object_add_uint (node, "is_unreach", fp->is_unreach); + vat_json_object_add_uint (node, "is_prohibit", fp->is_prohibit); + vat_json_object_add_uint (node, "next_hop_afi", fp->afi); + if (fp->afi == IP46_TYPE_IP4) + { + clib_memcpy (&ip4, &fp->next_hop, sizeof (ip4)); + vat_json_object_add_ip4 (node, "next_hop", ip4); + } + else if (fp->afi == IP46_TYPE_IP6) + { + clib_memcpy (&ip6, &fp->next_hop, sizeof (ip6)); + vat_json_object_add_ip6 (node, "next_hop", ip6); + } + } +} + +static int +api_ip_fib_dump (vat_main_t * vam) +{ + vl_api_ip_fib_dump_t *mp; + f64 timeout; + + M (IP_FIB_DUMP, ip_fib_dump); + S; + + /* Use a control ping for synchronization */ + { + vl_api_control_ping_t *mp; + M (CONTROL_PING, control_ping); + S; + } + W; +} + +#define vl_api_ip6_fib_details_t_endian vl_noop_handler +#define vl_api_ip6_fib_details_t_print vl_noop_handler + +static void +vl_api_ip6_fib_details_t_handler (vl_api_ip6_fib_details_t * mp) +{ + vat_main_t *vam = &vat_main; + int count = ntohl (mp->count); + vl_api_fib_path_t *fp; + int i; + + fformat (vam->ofp, + "table-id %d, prefix %U/%d\n", + ntohl (mp->table_id), format_ip6_address, mp->address, + mp->address_length); + fp = mp->path; + for (i = 0; i < count; i++) + { + fformat (vam->ofp, + " weight %d, sw_if_index %d, is_local %d, is_drop %d, is_unreach %d, " + "is_prohitbit %d, afi %d, next_hop %U\n", ntohl (fp->weight), + ntohl (fp->sw_if_index), fp->is_local, fp->is_drop, + fp->is_unreach, fp->is_prohibit, fp->afi, format_ip46_address, + fp->next_hop, fp->afi); + fp++; + } +} + +static void vl_api_ip6_fib_details_t_handler_json + (vl_api_ip6_fib_details_t * mp) +{ + vat_main_t *vam = &vat_main; + int count = ntohl (mp->count); + vat_json_node_t *node = NULL; + struct in_addr ip4; + struct in6_addr ip6; + vl_api_fib_path_t *fp; + int i; + + if (VAT_JSON_ARRAY != vam->json_tree.type) + { + ASSERT (VAT_JSON_NONE == vam->json_tree.type); + vat_json_init_array (&vam->json_tree); + } + node = vat_json_array_add (&vam->json_tree); + + vat_json_init_object (node); + vat_json_object_add_uint (node, "table", ntohl (mp->table_id)); + clib_memcpy (&ip6, &mp->address, sizeof (ip6)); + vat_json_object_add_ip6 (node, "prefix", ip6); + vat_json_object_add_uint (node, "mask_length", mp->address_length); + vat_json_object_add_uint (node, "path_count", count); + fp = mp->path; + for (i = 0; i < count; i++) + { + vat_json_object_add_uint (node, "weight", ntohl (fp->weight)); + vat_json_object_add_uint (node, "sw_if_index", ntohl (fp->sw_if_index)); + vat_json_object_add_uint (node, "is_local", fp->is_local); + vat_json_object_add_uint (node, "is_drop", fp->is_drop); + vat_json_object_add_uint (node, "is_unreach", fp->is_unreach); + vat_json_object_add_uint (node, "is_prohibit", fp->is_prohibit); + vat_json_object_add_uint (node, "next_hop_afi", fp->afi); + if (fp->afi == IP46_TYPE_IP4) + { + clib_memcpy (&ip4, &fp->next_hop, sizeof (ip4)); + vat_json_object_add_ip4 (node, "next_hop", ip4); + } + else if (fp->afi == IP46_TYPE_IP6) + { + clib_memcpy (&ip6, &fp->next_hop, sizeof (ip6)); + vat_json_object_add_ip6 (node, "next_hop", ip6); + } + } +} + +static int +api_ip6_fib_dump (vat_main_t * vam) +{ + vl_api_ip6_fib_dump_t *mp; + f64 timeout; + + M (IP6_FIB_DUMP, ip6_fib_dump); + S; + + /* Use a control ping for synchronization */ + { + vl_api_control_ping_t *mp; + M (CONTROL_PING, control_ping); + S; + } + W; +} + int api_classify_table_ids (vat_main_t * vam) { @@ -15712,6 +15935,8 @@ api_delete_subif (vat_main_t * vam) while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { + if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index)) + ; if (unformat (i, "sw_if_index %d", &sw_if_index)) ; else @@ -16504,7 +16729,7 @@ _(ip_source_and_port_range_check_interface_add_del, \ _(ipsec_gre_add_del_tunnel, \ "src dst local_sa remote_sa [del]") \ _(ipsec_gre_tunnel_dump, "[sw_if_index ]") \ -_(delete_subif,"sub_sw_if_index sub_if_id ") \ +_(delete_subif," | sw_if_index ") \ _(l2_interface_pbb_tag_rewrite, \ " | sw_if_index \n" \ "[disable | push | pop | translate_pbb_stag ] \n" \ @@ -16512,7 +16737,9 @@ _(l2_interface_pbb_tag_rewrite, \ _(punt, "protocol [ip ] [port ] [del]") \ _(flow_classify_set_interface, \ " | sw_if_index [ip4-table ] [ip6-table ] [del]") \ -_(flow_classify_dump, "type [ip4|ip6]") +_(flow_classify_dump, "type [ip4|ip6]") \ +_(ip_fib_dump, "") \ +_(ip6_fib_dump, "") /* List of command functions, CLI names map directly to functions */ #define foreach_cli_function \