diff options
author | Florin Coras <fcoras@cisco.com> | 2017-11-22 19:22:48 -0800 |
---|---|---|
committer | Chris Luke <chris_luke@comcast.com> | 2017-12-06 19:28:04 +0000 |
commit | 73e4f7965b7f6c0ff3c1217962f76ad586af6332 (patch) | |
tree | dc7a9f5da0ca30ec69448549cc965e1200477fcc /src/vnet/session/session_test.c | |
parent | 3288ed7234ad9b6d59d249f48dd1a2d06168bfd5 (diff) |
session: support for rule tags overwriting
Change-Id: I0cf48b69042996afcb8b192f5fd98165058d9e1d
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_test.c')
-rw-r--r-- | src/vnet/session/session_test.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/vnet/session/session_test.c b/src/vnet/session/session_test.c index bf3cea2a97c..1303e8b9fdf 100644 --- a/src/vnet/session/session_test.c +++ b/src/vnet/session/session_test.c @@ -1136,7 +1136,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) " not work (no-rule)"); /* - * Test tags. Add/del rule with tag + * Test tags. Add/overwrite/del rule with tag */ args.table_args.is_add = 1; args.table_args.lcl_port = 1234; @@ -1164,9 +1164,28 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) SESSION_TEST ((tc->c_index == listener->connection_index), "lookup 1.2.3.4/32 1234 5.6.7.8/16 4321 should work"); + vec_free (args.table_args.tag); + args.table_args.lcl_port = 1234; + args.table_args.lcl.fp_addr.ip4 = lcl_ip; + args.table_args.lcl.fp_len = 16; + args.table_args.tag = format (0, "test_rule_overwrite"); + error = vnet_session_rule_add_del (&args); + SESSION_TEST ((error == 0), + "Overwrite 1.2.3.4/16 1234 5.6.7.8/16 4321 deny tag test_rule" + " should work"); + if (verbose) + { + session_lookup_dump_rules_table (0, FIB_PROTOCOL_IP4, + TRANSPORT_PROTO_TCP); + session_lookup_dump_local_rules_table (local_ns_index, FIB_PROTOCOL_IP4, + TRANSPORT_PROTO_TCP); + } + args.table_args.is_add = 0; args.table_args.lcl_port += 1; error = vnet_session_rule_add_del (&args); + SESSION_TEST ((error == 0), "Del 1.2.3.4/32 1234 5.6.7.8/32 4321 deny " + "tag %v", args.table_args.tag); if (verbose) { session_lookup_dump_rules_table (0, FIB_PROTOCOL_IP4, @@ -1174,8 +1193,6 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) session_lookup_dump_local_rules_table (local_ns_index, FIB_PROTOCOL_IP4, TRANSPORT_PROTO_TCP); } - SESSION_TEST ((error == 0), "Del 1.2.3.4/32 1234 5.6.7.8/32 4321 deny " - "tag test_rule"); tc = session_lookup_connection_wt4 (0, &lcl_pref.fp_addr.ip4, &rmt_pref.fp_addr.ip4, lcl_port, rmt_port, TRANSPORT_PROTO_TCP, 0, |