.. | .. |
---|
31 | 31 | ping_ipv4 |
---|
32 | 32 | test_update |
---|
33 | 33 | test_no_update |
---|
| 34 | + test_pedit_norewrite |
---|
| 35 | + test_dscp_leftover |
---|
34 | 36 | " |
---|
35 | 37 | |
---|
36 | 38 | lib_dir=$(dirname $0)/../../../net/forwarding |
---|
.. | .. |
---|
50 | 52 | echo ${reprio[$in]} |
---|
51 | 53 | } |
---|
52 | 54 | |
---|
| 55 | +zero() |
---|
| 56 | +{ |
---|
| 57 | + echo 0 |
---|
| 58 | +} |
---|
| 59 | + |
---|
| 60 | +three() |
---|
| 61 | +{ |
---|
| 62 | + echo 3 |
---|
| 63 | +} |
---|
| 64 | + |
---|
53 | 65 | h1_create() |
---|
54 | 66 | { |
---|
55 | | - local dscp; |
---|
56 | | - |
---|
57 | 67 | simple_if_init $h1 192.0.2.1/28 |
---|
58 | 68 | tc qdisc add dev $h1 clsact |
---|
59 | 69 | dscp_capture_install $h1 0 |
---|
.. | .. |
---|
87 | 97 | dscp_map() |
---|
88 | 98 | { |
---|
89 | 99 | local base=$1; shift |
---|
| 100 | + local prio |
---|
90 | 101 | |
---|
91 | 102 | for prio in {0..7}; do |
---|
92 | 103 | echo app=$prio,5,$((base + prio)) |
---|
.. | .. |
---|
97 | 108 | { |
---|
98 | 109 | simple_if_init $swp1 192.0.2.2/28 |
---|
99 | 110 | __simple_if_init $swp2 v$swp1 192.0.2.17/28 |
---|
| 111 | + |
---|
| 112 | + tc qdisc add dev $swp1 clsact |
---|
| 113 | + tc qdisc add dev $swp2 clsact |
---|
100 | 114 | |
---|
101 | 115 | lldptool -T -i $swp1 -V APP $(dscp_map 0) >/dev/null |
---|
102 | 116 | lldptool -T -i $swp2 -V APP $(dscp_map 0) >/dev/null |
---|
.. | .. |
---|
109 | 123 | lldptool -T -i $swp2 -V APP -d $(dscp_map 0) >/dev/null |
---|
110 | 124 | lldptool -T -i $swp1 -V APP -d $(dscp_map 0) >/dev/null |
---|
111 | 125 | lldpad_app_wait_del |
---|
| 126 | + |
---|
| 127 | + tc qdisc del dev $swp2 clsact |
---|
| 128 | + tc qdisc del dev $swp1 clsact |
---|
112 | 129 | |
---|
113 | 130 | __simple_if_fini $swp2 192.0.2.17/28 |
---|
114 | 131 | simple_if_fini $swp1 192.0.2.2/28 |
---|
.. | .. |
---|
156 | 173 | local reprio=$1; shift |
---|
157 | 174 | local dev1=$1; shift |
---|
158 | 175 | local dev2=$1; shift |
---|
| 176 | + local i |
---|
159 | 177 | |
---|
160 | 178 | local prio2=$($reprio $prio) # ICMP Request egress prio |
---|
161 | 179 | local prio3=$($reprio $prio2) # ICMP Response egress prio |
---|
.. | .. |
---|
169 | 187 | eval "local -A dev1_t0s=($(dscp_fetch_stats $dev1 0))" |
---|
170 | 188 | eval "local -A dev2_t0s=($(dscp_fetch_stats $dev2 0))" |
---|
171 | 189 | |
---|
| 190 | + local ping_timeout=$((PING_TIMEOUT * 5)) |
---|
172 | 191 | ip vrf exec $vrf_name \ |
---|
173 | 192 | ${PING} -Q $dscp ${sip:+-I $sip} $dip \ |
---|
174 | | - -c 10 -i 0.1 -w 2 &> /dev/null |
---|
| 193 | + -c 10 -i 0.5 -w $ping_timeout &> /dev/null |
---|
175 | 194 | |
---|
176 | 195 | eval "local -A dev1_t1s=($(dscp_fetch_stats $dev1 0))" |
---|
177 | 196 | eval "local -A dev2_t1s=($(dscp_fetch_stats $dev2 0))" |
---|
.. | .. |
---|
204 | 223 | { |
---|
205 | 224 | local update=$1; shift |
---|
206 | 225 | local reprio=$1; shift |
---|
| 226 | + local prio |
---|
207 | 227 | |
---|
208 | 228 | sysctl_restore net.ipv4.ip_forward_update_priority |
---|
209 | 229 | sysctl_set net.ipv4.ip_forward_update_priority $update |
---|
.. | .. |
---|
215 | 235 | |
---|
216 | 236 | test_update() |
---|
217 | 237 | { |
---|
| 238 | + echo "Test net.ipv4.ip_forward_update_priority=1" |
---|
218 | 239 | __test_update 1 reprioritize |
---|
219 | 240 | } |
---|
220 | 241 | |
---|
221 | 242 | test_no_update() |
---|
222 | 243 | { |
---|
| 244 | + echo "Test net.ipv4.ip_forward_update_priority=0" |
---|
223 | 245 | __test_update 0 echo |
---|
224 | 246 | } |
---|
225 | 247 | |
---|
| 248 | +# Test that when DSCP is updated in pedit, the DSCP rewrite is turned off. |
---|
| 249 | +test_pedit_norewrite() |
---|
| 250 | +{ |
---|
| 251 | + echo "Test no DSCP rewrite after DSCP is updated by pedit" |
---|
| 252 | + |
---|
| 253 | + tc filter add dev $swp1 ingress handle 101 pref 1 prot ip flower \ |
---|
| 254 | + action pedit ex munge ip dsfield set $((3 << 2)) retain 0xfc \ |
---|
| 255 | + action skbedit priority 3 |
---|
| 256 | + |
---|
| 257 | + __test_update 0 three |
---|
| 258 | + |
---|
| 259 | + tc filter del dev $swp1 ingress pref 1 |
---|
| 260 | +} |
---|
| 261 | + |
---|
| 262 | +# Test that when the last APP rule is removed, the prio->DSCP map is properly |
---|
| 263 | +# set to zeroes, and that the last APP rule does not stay active in the ASIC. |
---|
| 264 | +test_dscp_leftover() |
---|
| 265 | +{ |
---|
| 266 | + echo "Test that last removed DSCP rule is deconfigured correctly" |
---|
| 267 | + |
---|
| 268 | + lldptool -T -i $swp2 -V APP -d $(dscp_map 0) >/dev/null |
---|
| 269 | + lldpad_app_wait_del |
---|
| 270 | + |
---|
| 271 | + __test_update 0 zero |
---|
| 272 | + |
---|
| 273 | + lldptool -T -i $swp2 -V APP $(dscp_map 0) >/dev/null |
---|
| 274 | + lldpad_app_wait_set $swp2 |
---|
| 275 | +} |
---|
| 276 | + |
---|
226 | 277 | trap cleanup EXIT |
---|
227 | 278 | |
---|
228 | 279 | setup_prepare |
---|