From: John Lo Date: Thu, 20 Sep 2018 20:07:00 +0000 (-0400) Subject: Add more CLI options to vpp_api_test for calling ip_add_del_route X-Git-Tag: v18.10-rc1~146 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=22030434ac9a3a7296617b996268e79dbf8bbffa Add more CLI options to vpp_api_test for calling ip_add_del_route Change-Id: I114e93b6bc71cfcdcfe6d3ddde26f77118e36ab8 Signed-off-by: John Lo --- diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 61b34973d6f..0a0198940cf 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -8486,6 +8486,8 @@ api_ip_add_del_route (vat_main_t * vam) mpls_label_t next_hop_out_label = MPLS_LABEL_INVALID; mpls_label_t next_hop_via_label = MPLS_LABEL_INVALID; + memset (&v4_next_hop_address, 0, sizeof (ip4_address_t)); + memset (&v6_next_hop_address, 0, sizeof (ip6_address_t)); /* Parse args required to build the message */ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { @@ -8518,6 +8520,16 @@ api_ip_add_del_route (vat_main_t * vam) { next_hop_set = 1; } + else + if (unformat + (i, "via %U", api_unformat_sw_if_index, vam, &sw_if_index)) + { + next_hop_set = 1; + } + else if (unformat (i, "via sw_if_index %d", &sw_if_index)) + { + next_hop_set = 1; + } else if (unformat (i, "resolve-attempts %d", &resolve_attempts)) ; else if (unformat (i, "weight %d", &next_hop_weight)) @@ -23509,8 +23521,8 @@ _(sw_interface_slave_dump, \ _(ip_table_add_del, \ "table [ipv6] [add | del]\n") \ _(ip_add_del_route, \ - "/ via > [table-id ]\n" \ - "[ | sw_if_index ] [resolve-attempts ]\n" \ + "/ via <||sw_if_index |via-label >\n" \ + "[table-id ] [ | sw_if_index ] [resolve-attempts ]\n"\ "[weight ] [drop] [local] [classify ] [del]\n" \ "[multipath] [count ]") \ _(ip_mroute_add_del, \ diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index 44aaf82a73c..e40a7dca938 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -726,9 +726,6 @@ static void *vl_api_ip_add_del_route_t_print if (mp->is_add == 0) s = format (s, "del "); - if (mp->next_hop_sw_if_index != ~0) - s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index)); - if (mp->is_ipv6) s = format (s, "%U/%d ", format_ip6_address, mp->dst_address, mp->dst_address_length); @@ -753,6 +750,9 @@ static void *vl_api_ip_add_del_route_t_print s = format (s, "via %U ", format_ip6_address, mp->next_hop_address); else s = format (s, "via %U ", format_ip4_address, mp->next_hop_address); + if (mp->next_hop_sw_if_index != ~0) + s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index)); + } if (mp->next_hop_weight != 1)