aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/cli.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-05-08 19:18:18 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-05-09 20:08:58 +0000
commit7d31ab2a5cc2124ddd973ac5dfac2219619f345a (patch)
treec348cd84cf2c4edc0bb73890830ed2bc280117bf /src/vnet/pg/cli.c
parent016d4cc327f1980605db7a9e436597e8f36fe9ed (diff)
add mactime plugin unit / code coverage tests
The unit and code coverage tests are boring. The rest of the patch involves test and packet-generator infra cleanups. Teach the "make test-xxx" family of targets to set the api test plugin path correctly, to make "binary-api <api-message-name> <args>" debug CLI commands work correctly in the "make test" environment. Unfortunately involves both the top-level and test Makefiles. Add a minor pg cli feature, a CLI to manually set s->sw_if_index[VLIB_TX]. Consider the case where one configures an interface with both a device-input and an output feature. To test the output feature using the pg, it's necessary to inject packets into the interface output node with both b->sw_if_index[VLIB_TX] and b->sw_if_index[VLIB_RX] set correctly. For example: packet-generator new { name tx limit 15 size 128-128 interface local0 # rx: device input feature not configured on local0 tx-interface loop0 # tx: output node requires b->sw_if_index[VLIB_TX] node loop0-output data { hex 0x01005e7ffffa000dead0000008000102030405060708090a0b0c0d0e0f0102030405 } } Fix a longstanding bug in the packet generator stream setup. Remove kludges which set b->sw_if_index[VLIB_TX] to ~0 [in multiple places] instead of using the stream value s->sw_if_index[VLIB_TX], and setting THAT datum correctly. Change-Id: I1097a18e8db73661ded6b822c1d718f7e5cf36ed Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/pg/cli.c')
-rw-r--r--src/vnet/pg/cli.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index 4526986d1ff..9c42d70a383 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -109,19 +109,26 @@ static clib_error_t *
enable_disable_stream (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
+ unformat_input_t _line_input, *line_input = &_line_input;
pg_main_t *pg = &pg_main;
int is_enable = cmd->function_arg != 0;
u32 stream_index = ~0;
- if (unformat (input, "%U", unformat_eof))
- ;
- else if (unformat (input, "%U", unformat_hash_vec_string,
- pg->stream_index_by_name, &stream_index))
- ;
- else
- return clib_error_create ("unknown input `%U'",
- format_unformat_error, input);
+ if (!unformat_user (input, unformat_line_input, line_input))
+ goto doit;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "%U", unformat_hash_vec_string,
+ pg->stream_index_by_name, &stream_index))
+ ;
+ else
+ return clib_error_create ("unknown input `%U'",
+ format_unformat_error, line_input);
+ }
+ unformat_free (line_input);
+doit:
pg_enable_disable (stream_index, is_enable);
return 0;
@@ -374,6 +381,10 @@ new_stream (vlib_main_t * vm,
unformat_vnet_sw_interface, vnm,
&s.sw_if_index[VLIB_RX]))
;
+ else if (unformat (input, "tx-interface %U",
+ unformat_vnet_sw_interface, vnm,
+ &s.sw_if_index[VLIB_TX]))
+ ;
else if (unformat (input, "pcap %s", &pcap_file_name))
;