interface: add api test file
Type: improvement
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Ib07029204ecf12bf2adb5a39afa54bc98fb81f34
diff --git a/src/vnet/ip/ip_test.c b/src/vnet/ip/ip_test.c
index 3ba38d3..c47cd3d 100644
--- a/src/vnet/ip/ip_test.c
+++ b/src/vnet/ip/ip_test.c
@@ -40,7 +40,6 @@
{
/* API message ID base */
u16 msg_id_base;
- u32 ping_id;
vat_main_t *vat_main;
} ip_test_main_t;
@@ -100,7 +99,7 @@
static uword
unformat_fib_path (unformat_input_t *input, va_list *args)
{
- vnet_main_t *vnm = va_arg (*args, vnet_main_t *);
+ vat_main_t *vam = va_arg (*args, vat_main_t *);
vl_api_fib_path_t *path = va_arg (*args, vl_api_fib_path_t *);
u32 weight, preference;
mpls_label_t out_label;
@@ -114,14 +113,14 @@
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "%U %U", unformat_vl_api_ip4_address,
- &path->nh.address.ip4, unformat_vnet_sw_interface, vnm,
+ &path->nh.address.ip4, api_unformat_sw_if_index, vam,
&path->sw_if_index))
{
path->proto = FIB_API_PATH_NH_PROTO_IP4;
}
else if (unformat (input, "%U %U", unformat_vl_api_ip6_address,
- &path->nh.address.ip6, unformat_vnet_sw_interface,
- vnm, &path->sw_if_index))
+ &path->nh.address.ip6, api_unformat_sw_if_index, vam,
+ &path->sw_if_index))
{
path->proto = FIB_API_PATH_NH_PROTO_IP6;
}
@@ -238,7 +237,6 @@
static int
api_ip_route_add_del (vat_main_t *vam)
{
- vnet_main_t *vnm = vnet_get_main ();
unformat_input_t *i = vam->input;
vl_api_ip_route_add_del_t *mp;
u32 vrf_id = 0;
@@ -274,7 +272,7 @@
is_multipath = 1;
else if (unformat (i, "seed %d", &random_seed))
;
- else if (unformat (i, "via %U", unformat_fib_path, vnm,
+ else if (unformat (i, "via %U", unformat_fib_path, vam,
&paths[path_count]))
{
path_count++;
@@ -704,7 +702,6 @@
static int
api_ip_address_dump (vat_main_t *vam)
{
- vnet_main_t *vnm = vnet_get_main ();
unformat_input_t *i = vam->input;
vl_api_ip_address_dump_t *mp;
vl_api_control_ping_t *mp_ping;
@@ -718,8 +715,7 @@
{
if (unformat (i, "sw_if_index %d", &sw_if_index))
sw_if_index_set = 1;
- else if (unformat (i, "%U", unformat_vnet_sw_interface, vnm,
- &sw_if_index))
+ else if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
sw_if_index_set = 1;
else if (unformat (i, "ipv4"))
ipv4_set = 1;
@@ -1022,7 +1018,6 @@
int
api_ip_source_and_port_range_check_interface_add_del (vat_main_t *vam)
{
- vnet_main_t *vnm = vnet_get_main ();
unformat_input_t *input = vam->input;
vl_api_ip_source_and_port_range_check_interface_add_del_t *mp;
u32 sw_if_index = ~0;
@@ -1034,8 +1029,7 @@
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (input, "%U", unformat_vnet_sw_interface, vnm,
- &sw_if_index))
+ if (unformat (input, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
;
else if (unformat (input, "sw_if_index %d", &sw_if_index))
;
@@ -1214,7 +1208,6 @@
static int
api_sw_interface_ip6_enable_disable (vat_main_t *vam)
{
- vnet_main_t *vnm = vnet_get_main ();
unformat_input_t *i = vam->input;
vl_api_sw_interface_ip6_enable_disable_t *mp;
u32 sw_if_index;
@@ -1224,7 +1217,7 @@
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (i, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
+ if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
sw_if_index_set = 1;
else if (unformat (i, "sw_if_index %d", &sw_if_index))
sw_if_index_set = 1;