aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nsim/nsim_test.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-12-06 10:20:14 -0500
committerFlorin Coras <florin.coras@gmail.com>2018-12-06 18:28:47 +0000
commit10c5ff143a86d15e78cb1f8625eb0ab8bf72b6ce (patch)
tree00afabf7ca2ccd4042b2315b38fa6fb1bf5902c2 /src/plugins/nsim/nsim_test.c
parent995ff06fb73a2d1ac8472977cf3089d763f17d33 (diff)
nsim: add packet loss simulation, docs
Change-Id: Ic9747541aad8148ebf7d520b525b99c4cc3961f3 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/nsim/nsim_test.c')
-rw-r--r--src/plugins/nsim/nsim_test.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/nsim/nsim_test.c b/src/plugins/nsim/nsim_test.c
index 0e2a26af55b..7123703fd42 100644
--- a/src/plugins/nsim/nsim_test.c
+++ b/src/plugins/nsim/nsim_test.c
@@ -182,6 +182,7 @@ api_nsim_configure (vat_main_t * vam)
f64 delay = 0.0, bandwidth = 0.0;
f64 packet_size = 1500.0;
u32 num_workers = vlib_num_workers ();
+ u32 packets_per_drop = 0;
int ret;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -192,6 +193,8 @@ api_nsim_configure (vat_main_t * vam)
;
else if (unformat (i, "packet-size %f", &packet_size))
;
+ else if (unformat (i, "packets-per-drop %u", &packets_per_drop))
+ ;
else
break;
}
@@ -211,6 +214,7 @@ api_nsim_configure (vat_main_t * vam)
mp->bandwidth_in_bits_per_second = (u64) (bandwidth);
mp->bandwidth_in_bits_per_second =
clib_host_to_net_u64 (mp->bandwidth_in_bits_per_second);
+ mp->packets_per_drop = ntohl (packets_per_drop);
/* send it... */
S (mp);
@@ -227,7 +231,8 @@ api_nsim_configure (vat_main_t * vam)
#define foreach_vpe_api_msg \
_(nsim_enable_disable, \
"[<intfc0> | sw_if_index <swif0>] [<intfc1> | sw_if_index <swif1>] [disable]") \
-_(nsim_configure, "delay <time> bandwidth <bw> [packet-size <nn>]")
+_(nsim_configure, "delay <time> bandwidth <bw> [packet-size <nn>]" \
+"[packets-per-drop <nnnn>]")
static void
nsim_api_hookup (vat_main_t * vam)