Skip to content

Commit 00af023

Browse files
idoschkuba-moo
authored andcommitted
selftests: fib_nexthops: Add test cases for FDB status change
Add the following test cases for both IPv4 and IPv6: * Can change from FDB nexthop to non-FDB nexthop and vice versa. * Can change FDB nexthop address while in a group. * Cannot change from FDB nexthop to non-FDB nexthop and vice versa while in a group. Output without "nexthop: Forbid FDB status change while nexthop is in a group": # ./fib_nexthops.sh -t "ipv6_fdb_grp_fcnal ipv4_fdb_grp_fcnal" IPv6 fdb groups functional -------------------------- [...] TEST: Replace FDB nexthop to non-FDB nexthop [ OK ] TEST: Replace non-FDB nexthop to FDB nexthop [ OK ] TEST: Replace FDB nexthop address while in a group [ OK ] TEST: Replace FDB nexthop to non-FDB nexthop while in a group [FAIL] TEST: Replace non-FDB nexthop to FDB nexthop while in a group [FAIL] [...] IPv4 fdb groups functional -------------------------- [...] TEST: Replace FDB nexthop to non-FDB nexthop [ OK ] TEST: Replace non-FDB nexthop to FDB nexthop [ OK ] TEST: Replace FDB nexthop address while in a group [ OK ] TEST: Replace FDB nexthop to non-FDB nexthop while in a group [FAIL] TEST: Replace non-FDB nexthop to FDB nexthop while in a group [FAIL] [...] Tests passed: 36 Tests failed: 4 Tests skipped: 0 Output with "nexthop: Forbid FDB status change while nexthop is in a group": # ./fib_nexthops.sh -t "ipv6_fdb_grp_fcnal ipv4_fdb_grp_fcnal" IPv6 fdb groups functional -------------------------- [...] TEST: Replace FDB nexthop to non-FDB nexthop [ OK ] TEST: Replace non-FDB nexthop to FDB nexthop [ OK ] TEST: Replace FDB nexthop address while in a group [ OK ] TEST: Replace FDB nexthop to non-FDB nexthop while in a group [ OK ] TEST: Replace non-FDB nexthop to FDB nexthop while in a group [ OK ] [...] IPv4 fdb groups functional -------------------------- [...] TEST: Replace FDB nexthop to non-FDB nexthop [ OK ] TEST: Replace non-FDB nexthop to FDB nexthop [ OK ] TEST: Replace FDB nexthop address while in a group [ OK ] TEST: Replace FDB nexthop to non-FDB nexthop while in a group [ OK ] TEST: Replace non-FDB nexthop to FDB nexthop while in a group [ OK ] [...] Tests passed: 40 Tests failed: 0 Tests skipped: 0 Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c299131 commit 00af023

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tools/testing/selftests/net/fib_nexthops.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,26 @@ ipv6_fdb_grp_fcnal()
494494
run_cmd "$IP nexthop add id 69 encap mpls 101 via 2001:db8:91::8 dev veth1 fdb"
495495
log_test $? 2 "Fdb Nexthop with encap"
496496

497+
# Replace FDB nexthop to non-FDB and vice versa
498+
run_cmd "$IP nexthop add id 70 via 2001:db8:91::2 fdb"
499+
run_cmd "$IP nexthop replace id 70 via 2001:db8:91::2 dev veth1"
500+
log_test $? 0 "Replace FDB nexthop to non-FDB nexthop"
501+
run_cmd "$IP nexthop replace id 70 via 2001:db8:91::2 fdb"
502+
log_test $? 0 "Replace non-FDB nexthop to FDB nexthop"
503+
504+
# Replace FDB nexthop address while in a group
505+
run_cmd "$IP nexthop add id 71 group 70 fdb"
506+
run_cmd "$IP nexthop replace id 70 via 2001:db8:91::3 fdb"
507+
log_test $? 0 "Replace FDB nexthop address while in a group"
508+
509+
# Cannot replace FDB nexthop to non-FDB and vice versa while in a group
510+
run_cmd "$IP nexthop replace id 70 via 2001:db8:91::2 dev veth1"
511+
log_test $? 2 "Replace FDB nexthop to non-FDB nexthop while in a group"
512+
run_cmd "$IP nexthop add id 72 via 2001:db8:91::2 dev veth1"
513+
run_cmd "$IP nexthop add id 73 group 72"
514+
run_cmd "$IP nexthop replace id 72 via 2001:db8:91::2 fdb"
515+
log_test $? 2 "Replace non-FDB nexthop to FDB nexthop while in a group"
516+
497517
run_cmd "$IP link add name vx10 type vxlan id 1010 local 2001:db8:91::9 remote 2001:db8:91::10 dstport 4789 nolearning noudpcsum tos inherit ttl 100"
498518
run_cmd "$BRIDGE fdb add 02:02:00:00:00:13 dev vx10 nhid 102 self"
499519
log_test $? 0 "Fdb mac add with nexthop group"
@@ -574,6 +594,26 @@ ipv4_fdb_grp_fcnal()
574594
run_cmd "$IP nexthop add id 17 encap mpls 101 via 172.16.1.2 dev veth1 fdb"
575595
log_test $? 2 "Fdb Nexthop with encap"
576596

597+
# Replace FDB nexthop to non-FDB and vice versa
598+
run_cmd "$IP nexthop add id 18 via 172.16.1.2 fdb"
599+
run_cmd "$IP nexthop replace id 18 via 172.16.1.2 dev veth1"
600+
log_test $? 0 "Replace FDB nexthop to non-FDB nexthop"
601+
run_cmd "$IP nexthop replace id 18 via 172.16.1.2 fdb"
602+
log_test $? 0 "Replace non-FDB nexthop to FDB nexthop"
603+
604+
# Replace FDB nexthop address while in a group
605+
run_cmd "$IP nexthop add id 19 group 18 fdb"
606+
run_cmd "$IP nexthop replace id 18 via 172.16.1.3 fdb"
607+
log_test $? 0 "Replace FDB nexthop address while in a group"
608+
609+
# Cannot replace FDB nexthop to non-FDB and vice versa while in a group
610+
run_cmd "$IP nexthop replace id 18 via 172.16.1.2 dev veth1"
611+
log_test $? 2 "Replace FDB nexthop to non-FDB nexthop while in a group"
612+
run_cmd "$IP nexthop add id 20 via 172.16.1.2 dev veth1"
613+
run_cmd "$IP nexthop add id 21 group 20"
614+
run_cmd "$IP nexthop replace id 20 via 172.16.1.2 fdb"
615+
log_test $? 2 "Replace non-FDB nexthop to FDB nexthop while in a group"
616+
577617
run_cmd "$IP link add name vx10 type vxlan id 1010 local 10.0.0.1 remote 10.0.0.2 dstport 4789 nolearning noudpcsum tos inherit ttl 100"
578618
run_cmd "$BRIDGE fdb add 02:02:00:00:00:13 dev vx10 nhid 102 self"
579619
log_test $? 0 "Fdb mac add with nexthop group"

0 commit comments

Comments
 (0)