0001
0002
0003
0004 ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding"
0005 NUM_NETIFS=4
0006 source lib.sh
0007
0008 h1_create()
0009 {
0010 simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64
0011 }
0012
0013 h1_destroy()
0014 {
0015 simple_if_fini $h1 192.0.2.1/24 2001:db8:1::1/64
0016 }
0017
0018 h2_create()
0019 {
0020 simple_if_init $h2 192.0.2.2/24 2001:db8:1::2/64
0021 }
0022
0023 h2_destroy()
0024 {
0025 simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64
0026 }
0027
0028 switch_create()
0029 {
0030 ip link add dev br0 type bridge \
0031 ageing_time $LOW_AGEING_TIME \
0032 mcast_snooping 0
0033
0034 ip link set dev $swp1 master br0
0035 ip link set dev $swp2 master br0
0036
0037 ip link set dev br0 up
0038 ip link set dev $swp1 up
0039 ip link set dev $swp2 up
0040 }
0041
0042 switch_destroy()
0043 {
0044 ip link set dev $swp2 down
0045 ip link set dev $swp1 down
0046
0047 ip link del dev br0
0048 }
0049
0050 setup_prepare()
0051 {
0052 h1=${NETIFS[p1]}
0053 swp1=${NETIFS[p2]}
0054
0055 swp2=${NETIFS[p3]}
0056 h2=${NETIFS[p4]}
0057
0058 vrf_prepare
0059
0060 h1_create
0061 h2_create
0062
0063 switch_create
0064 }
0065
0066 cleanup()
0067 {
0068 pre_cleanup
0069
0070 switch_destroy
0071
0072 h2_destroy
0073 h1_destroy
0074
0075 vrf_cleanup
0076 }
0077
0078 ping_ipv4()
0079 {
0080 ping_test $h1 192.0.2.2
0081 }
0082
0083 ping_ipv6()
0084 {
0085 ping6_test $h1 2001:db8:1::2
0086 }
0087
0088 learning()
0089 {
0090 learning_test "br0" $swp1 $h1 $h2
0091 }
0092
0093 flooding()
0094 {
0095 flood_test $swp2 $h1 $h2
0096 }
0097
0098 trap cleanup EXIT
0099
0100 setup_prepare
0101 setup_wait
0102
0103 tests_run
0104
0105 exit $EXIT_STATUS