aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-09-20 16:07:00 -0400
committerNeale Ranns <nranns@cisco.com>2018-09-21 08:18:34 +0000
commit22030434ac9a3a7296617b996268e79dbf8bbffa (patch)
tree131292c34035b8508003773b3111eb0a002005aa /src
parentc01c4451c5c6285fbfb086fb46557234804f86ee (diff)
Add more CLI options to vpp_api_test for calling ip_add_del_route
Change-Id: I114e93b6bc71cfcdcfe6d3ddde26f77118e36ab8 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vat/api_format.c16
-rw-r--r--src/vpp/api/custom_dump.c6
2 files changed, 17 insertions, 5 deletions
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 <n> [ipv6] [add | del]\n") \
_(ip_add_del_route, \
- "<addr>/<mask> via <addr | via-label <n>> [table-id <n>]\n" \
- "[<intfc> | sw_if_index <id>] [resolve-attempts <n>]\n" \
+ "<addr>/<mask> via <<addr>|<intfc>|sw_if_index <id>|via-label <n>>\n" \
+ "[table-id <n>] [<intfc> | sw_if_index <id>] [resolve-attempts <n>]\n"\
"[weight <n>] [drop] [local] [classify <n>] [del]\n" \
"[multipath] [count <n>]") \
_(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)