summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/snat_test.c
diff options
context:
space:
mode:
authorMartin <magalik@cisco.com>2017-03-08 03:31:02 -0800
committerMartin <magalik@cisco.com>2017-03-08 04:38:37 -0800
commit6b7fcda46689bf540538f839c870a9981752fc2c (patch)
tree64bc0f5c009c5aea52ce2e3e0eab69cc0a0aa683 /src/plugins/snat/snat_test.c
parent3f844d0bc900e5db40ba74724e2b61e7943682d3 (diff)
SNAT: user_session_dump is_ip4 and vat unformating added
Change-Id: I0ffab147c3218a75b7c3bb829983f538c7b637ee Signed-off-by: Martin <magalik@cisco.com>
Diffstat (limited to 'src/plugins/snat/snat_test.c')
-rw-r--r--src/plugins/snat/snat_test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/snat/snat_test.c b/src/plugins/snat/snat_test.c
index c60554b21d5..39db45cd8be 100644
--- a/src/plugins/snat/snat_test.c
+++ b/src/plugins/snat/snat_test.c
@@ -667,8 +667,11 @@ static void vl_api_snat_user_session_details_t_handler
static int api_snat_user_session_dump(vat_main_t * vam)
{
+ unformat_input_t* i = vam->input;
vl_api_snat_user_session_dump_t * mp;
vl_api_snat_control_ping_t *mp_ping;
+ ip4_address_t addr;
+ u32 vrf_id = ~0;
int ret;
if (vam->json_output)
@@ -677,11 +680,24 @@ static int api_snat_user_session_dump(vat_main_t * vam)
return -99;
}
+ if (unformat (i, "ip_address %U vrf_id %d",
+ unformat_ip4_address, &addr, &vrf_id))
+ ;
+ else
+ {
+ clib_warning("unknown input '%U'", format_unformat_error, i);
+ return -99;
+ }
+
M(SNAT_USER_SESSION_DUMP, mp);
S(mp);
/* Use a control ping for synchronization */
M(SNAT_CONTROL_PING, mp_ping);
+ memset(mp->ip_address, 0, 16);
+ clib_memcpy(mp->ip_address, &addr, 4);
+ mp->vrf_id = htonl(vrf_id);
+ mp->is_ip4 = 1;
S(mp_ping);
W (ret);