0001
0002
0003 source "$relative_path/mirror_lib.sh"
0004
0005 quick_test_span_gre_dir_ips()
0006 {
0007 local tundev=$1; shift
0008
0009 do_test_span_dir_ips 10 h3-$tundev "$@"
0010 }
0011
0012 fail_test_span_gre_dir_ips()
0013 {
0014 local tundev=$1; shift
0015
0016 do_test_span_dir_ips 0 h3-$tundev "$@"
0017 }
0018
0019 test_span_gre_dir_ips()
0020 {
0021 local tundev=$1; shift
0022
0023 test_span_dir_ips h3-$tundev "$@"
0024 }
0025
0026 full_test_span_gre_dir_ips()
0027 {
0028 local tundev=$1; shift
0029 local direction=$1; shift
0030 local forward_type=$1; shift
0031 local backward_type=$1; shift
0032 local what=$1; shift
0033 local ip1=$1; shift
0034 local ip2=$1; shift
0035
0036 RET=0
0037
0038 mirror_install $swp1 $direction $tundev "matchall $tcflags"
0039 test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \
0040 "$backward_type" "$ip1" "$ip2"
0041 mirror_uninstall $swp1 $direction
0042
0043 log_test "$direction $what ($tcflags)"
0044 }
0045
0046 full_test_span_gre_dir_vlan_ips()
0047 {
0048 local tundev=$1; shift
0049 local direction=$1; shift
0050 local vlan_match=$1; shift
0051 local forward_type=$1; shift
0052 local backward_type=$1; shift
0053 local what=$1; shift
0054 local ip1=$1; shift
0055 local ip2=$1; shift
0056
0057 RET=0
0058
0059 mirror_install $swp1 $direction $tundev "matchall $tcflags"
0060
0061 test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \
0062 "$backward_type" "$ip1" "$ip2"
0063
0064 tc filter add dev $h3 ingress pref 77 prot 802.1q \
0065 flower $vlan_match \
0066 action pass
0067 mirror_test v$h1 $ip1 $ip2 $h3 77 10
0068 tc filter del dev $h3 ingress pref 77
0069
0070 mirror_uninstall $swp1 $direction
0071
0072 log_test "$direction $what ($tcflags)"
0073 }
0074
0075 quick_test_span_gre_dir()
0076 {
0077 quick_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
0078 }
0079
0080 fail_test_span_gre_dir()
0081 {
0082 fail_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
0083 }
0084
0085 test_span_gre_dir()
0086 {
0087 test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
0088 }
0089
0090 full_test_span_gre_dir()
0091 {
0092 full_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
0093 }
0094
0095 full_test_span_gre_dir_vlan()
0096 {
0097 full_test_span_gre_dir_vlan_ips "$@" 192.0.2.1 192.0.2.2
0098 }
0099
0100 full_test_span_gre_stp_ips()
0101 {
0102 local tundev=$1; shift
0103 local nbpdev=$1; shift
0104 local what=$1; shift
0105 local ip1=$1; shift
0106 local ip2=$1; shift
0107 local h3mac=$(mac_get $h3)
0108
0109 RET=0
0110
0111 mirror_install $swp1 ingress $tundev "matchall $tcflags"
0112 quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
0113
0114 bridge link set dev $nbpdev state disabled
0115 sleep 1
0116 fail_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
0117
0118 bridge link set dev $nbpdev state forwarding
0119 sleep 1
0120 quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
0121
0122 mirror_uninstall $swp1 ingress
0123
0124 log_test "$what: STP state ($tcflags)"
0125 }
0126
0127 full_test_span_gre_stp()
0128 {
0129 full_test_span_gre_stp_ips "$@" 192.0.2.1 192.0.2.2
0130 }