Merge ~liaou3/checkbox-iiotg/+git/checkbox-provider-intliotg:refactor_tsn_test_plan into ~checkbox-dev/checkbox-iiotg/+git/checkbox-provider-intliotg:master
- Git
- lp:~liaou3/checkbox-iiotg/+git/checkbox-provider-intliotg
- refactor_tsn_test_plan
- Merge into master
Status: | Merged |
---|---|
Approved by: | Vincent Liao |
Approved revision: | 2d5a8b8f81966184db4897833c31dc91b3bf4ca0 |
Merged at revision: | 7c101e0b251d3cf509ce9aa715bbc8a04722f041 |
Proposed branch: | ~liaou3/checkbox-iiotg/+git/checkbox-provider-intliotg:refactor_tsn_test_plan |
Merge into: | ~checkbox-dev/checkbox-iiotg/+git/checkbox-provider-intliotg:master |
Diff against target: |
575 lines (+373/-101) 5 files modified
bin/tsn_test_env_setup.sh (+36/-0) bin/tsn_time_sync.sh (+27/-0) bin/udp_traffic_test.sh (+58/-0) units/tsn/jobs.pxu (+196/-89) units/tsn/test-plan.pxu (+56/-12) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PeiYao Chang | Approve | ||
Rick Wu | Approve | ||
StanleyHuang | Pending | ||
Patrick Liu | Pending | ||
Vic Liu | Pending | ||
Review via email: mp+451778@code.launchpad.net |
Commit message
Refactor TSN testplan from manual to semi-automated
Description of the change
# Description
All of these test cases is based on the TSN testing document[1] provided by Intel, and was simplified into the testing document[2], then I created those test jobs based on that. You could read those document if you have time (I know the document is too long to read). To put it simply, I created jobs based on each protocal in TSN.
# Difference
In the past we ran tsn tests as manual jobs
- May be human error exist -> Hard to unified the test method
- No log left -> Hard to track the error
Now we run tsn as semi-automated jobs
- Every tester run the same commands -> Unify the test method
- There's log left -> Make review easier
- Test cases categorized into each protocal -> Make tester easy to test each protocal
# TODO
I know that we could run these tsn tests fully automated. However I would like to make this MR go into the main branch first. After that I will slowly improve the test cases from semi-automated to fully-automated.
# Submissions:
https:/
# References
[1] https:/
[2] https:/
Vincent Liao (liaou3) wrote : | # |
> @Vincent,
> I have one minor suggestion. Otherwise LGTM.
@Rick
Fixed!
PeiYao Chang (baconyao) wrote : | # |
There are four duplicated paths of "/usr/share/
Vincent Liao (liaou3) wrote : | # |
@Patrick
Fixed.
Vincent Liao (liaou3) wrote : | # |
@Patrick
Thanks for your review, please see my latest commit.
I will raise another MR for checkbox-
Preview Diff
1 | diff --git a/bin/tsn_test_env_setup.sh b/bin/tsn_test_env_setup.sh |
2 | new file mode 100755 |
3 | index 0000000..4eaefbe |
4 | --- /dev/null |
5 | +++ b/bin/tsn_test_env_setup.sh |
6 | @@ -0,0 +1,36 @@ |
7 | +#!/bin/bash |
8 | + |
9 | +set -e |
10 | + |
11 | +interface=$1 |
12 | +gptp_config_path=$2 |
13 | + |
14 | +echo "## Creating gPTP.cfg to $gptp_config_path..." |
15 | +echo "[global] |
16 | +gmCapable 1 |
17 | +priority1 248 |
18 | +priority2 248 |
19 | +logAnnounceInterval 0 |
20 | +logSyncInterval -3 |
21 | +syncReceiptTimeout 3 |
22 | +neighborPropDelayThresh 800 |
23 | +min_neighbor_prop_delay -20000000 |
24 | +assume_two_step 1 |
25 | +path_trace_enabled 1 |
26 | +follow_up_info 1 |
27 | +transportSpecific 0x1 |
28 | +ptp_dst_mac 01:80:C2:00:00:0E |
29 | +network_transport L2 |
30 | +delay_mechanism P2P |
31 | +tx_timestamp_timeout 100" > "$gptp_config_path" |
32 | + |
33 | +echo "## Disabling EEE status to prevent the network adapter from entering EEE mode..." |
34 | +ethtool --set-eee "$interface" eee off |
35 | +echo "## Displaying EEE status..." |
36 | +ethtool --show-eee "$interface" |
37 | + |
38 | +echo "## Disabling pause options to prevent from traffic interruption..." |
39 | +ethtool -A "$interface" autoneg off rx off tx off |
40 | + |
41 | +echo "## Disabling NTP clock sync to prevent interrupt with clock sync between boards..." |
42 | +timedatectl set-ntp 0 |
43 | diff --git a/bin/tsn_time_sync.sh b/bin/tsn_time_sync.sh |
44 | new file mode 100755 |
45 | index 0000000..c8e3ce9 |
46 | --- /dev/null |
47 | +++ b/bin/tsn_time_sync.sh |
48 | @@ -0,0 +1,27 @@ |
49 | +#!/bin/bash |
50 | + |
51 | +set -e |
52 | + |
53 | +timeout=$1 |
54 | +mode=$2 |
55 | +config_path=$3 |
56 | +eth_interface=$4 |
57 | +server_user=$5 |
58 | +server_ip=$6 |
59 | +server_pwd=$7 |
60 | +server_eth_interface=$8 |
61 | + |
62 | +# This will clear any queue discipline configuration on the devices. If there was no configuration, you will get an error, but you can ignore it. |
63 | +sshpass -p "$server_pwd" ssh -o StrictHostKeyChecking=no "$server_user"@"$server_ip" "echo ${server_pwd} | sudo -S tc qdisc del dev $server_eth_interface root" || true |
64 | +tc qdisc del dev "$eth_interface" root || true |
65 | + |
66 | +if [ "$mode" == "client" ]; then |
67 | + sshpass -p "$server_pwd" ssh -o StrictHostKeyChecking=no "$server_user"@"$server_ip" "echo ${server_pwd} | sudo -S timeout $timeout ptp4l -P2Hi $server_eth_interface -f $config_path --step_threshold=1 --first_step_threshold=0.0" & |
68 | + timeout "$timeout" ptp4l -P2Hi "$eth_interface" -f "$config_path" --step_threshold=1 -m -s --first_step_threshold=0.0 |
69 | +elif [ "$mode" == "master" ]; then |
70 | + timeout "$timeout" ptp4l -P2Hi "$eth_interface" -f "$config_path" --step_threshold=1 --first_step_threshold=0.0 & |
71 | + sshpass -p "$server_pwd" ssh -o StrictHostKeyChecking=no "$server_user"@"$server_ip" "echo ${server_pwd} | sudo -S timeout $timeout ptp4l -m -s -P2Hi $server_eth_interface -f $config_path --step_threshold=1 --first_step_threshold=0.0" |
72 | +else |
73 | + echo "Wrong argument for $mode. It should be either client or master" |
74 | + exit 1 |
75 | +fi |
76 | diff --git a/bin/udp_traffic_test.sh b/bin/udp_traffic_test.sh |
77 | new file mode 100755 |
78 | index 0000000..c0ac460 |
79 | --- /dev/null |
80 | +++ b/bin/udp_traffic_test.sh |
81 | @@ -0,0 +1,58 @@ |
82 | +#!/bin/bash |
83 | + |
84 | +eth_interface=$1 |
85 | +testing_time=$2 |
86 | +gptp_config_path=$3 |
87 | +server_user=$4 |
88 | +server_ip=$5 |
89 | +server_pwd=$6 |
90 | +server_eth_interface=$7 |
91 | + |
92 | +echo "## Starting time synchronization..." |
93 | +tsn_time_sync.sh "$testing_time" master "${gptp_config_path}" "${eth_interface}" "${server_user}" "${server_ip}" "${server_pwd}" "${server_eth_interface}" > /dev/null & |
94 | +sleep 10 |
95 | + |
96 | +echo "## Setting TAPRIO qdisc..." |
97 | +BASE=$(date +%s%N) |
98 | +tc qdisc add dev "${eth_interface}" parent root handle 100 taprio num_tc 4 map 0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 queues 1@0 1@1 1@2 1@3 base-time "${BASE}" sched-entry S 01 5000000 sched-entry S 02 5000000 sched-entry S 04 5000000 sched-entry S 08 5000000 flags 0x2 txtime-delay 0 |
99 | +sleep 10 |
100 | + |
101 | +echo "## Starting iperf3 server..." |
102 | +sshpass -p "${server_user}" ssh -o StrictHostKeyChecking=no "${server_user}@${server_ip}" "echo ${server_pwd} | sudo -S iperf3 -s -p 5100 -D" & |
103 | +sshpass -p "${server_user}" ssh -o StrictHostKeyChecking=no "${server_user}@${server_ip}" "echo ${server_pwd} | sudo -S iperf3 -s -p 5101 -D" & |
104 | +sshpass -p "${server_user}" ssh -o StrictHostKeyChecking=no "${server_user}@${server_ip}" "echo ${server_pwd} | sudo -S iperf3 -s -p 5102 -D" & |
105 | + |
106 | +echo "## Setting which hardware transmit queue each iperf3 instance using via net_prio cgroups..." |
107 | +mkdir -p /sys/fs/cgroup/net_prio |
108 | +mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio |
109 | +mkdir -p /sys/fs/cgroup/net_prio/grp1 |
110 | +echo "${eth_interface} 1" > /sys/fs/cgroup/net_prio/grp1/net_prio.ifpriomap |
111 | +mkdir -p /sys/fs/cgroup/net_prio/grp2 |
112 | +echo "${eth_interface} 2" > /sys/fs/cgroup/net_prio/grp2/net_prio.ifpriomap |
113 | +mkdir -p /sys/fs/cgroup/net_prio/grp3 |
114 | +echo "${eth_interface} 3" > /sys/fs/cgroup/net_prio/grp3/net_prio.ifpriomap |
115 | + |
116 | +echo "## Setting IP address..." |
117 | +TARGET_IP=192.168.1.22 |
118 | +sshpass -p "${server_user}" ssh -o StrictHostKeyChecking=no "${server_user}@${server_ip}" "echo ${server_pwd} | sudo -S ip addr add ${TARGET_IP}/24 dev ${server_eth_interface}" |
119 | +ip addr add 192.168.1.11/24 dev "${eth_interface}" |
120 | + |
121 | +echo "## Running iperf3 client and add each instance to its owncgroup directory..." |
122 | +iperf3 -u -l 1000 -b0 -p 5100 -c ${TARGET_IP} -t $((testing_time-10)) >> /dev/null & |
123 | +echo $! > /sys/fs/cgroup/net_prio/grp1/cgroup.procs |
124 | +iperf3 -u -l 1000 -b0 -p 5101 -c ${TARGET_IP} -t $((testing_time-10)) >> /dev/null & |
125 | +echo $! > /sys/fs/cgroup/net_prio/grp2/cgroup.procs |
126 | +iperf3 -u -l 1000 -b0 -p 5102 -c ${TARGET_IP} -t $((testing_time-10)) >> /dev/null & |
127 | +echo $! > /sys/fs/cgroup/net_prio/grp3/cgroup.procs |
128 | + |
129 | +echo "## Checking results..." |
130 | +tc -s qdisc show dev "${eth_interface}" |
131 | +sleep 10 |
132 | +echo "" |
133 | +echo "# 10 seconds after..." |
134 | +tc -s qdisc show dev "${eth_interface}" |
135 | +sleep 10 |
136 | +echo "" |
137 | +echo "# 10 seconds after..." |
138 | +tc -s qdisc show dev "${eth_interface}" |
139 | +sshpass -p "${server_user}" ssh -o StrictHostKeyChecking=no "${server_user}@${server_ip}" "echo ${server_pwd} | sudo -S killall iperf3" |
140 | diff --git a/units/tsn/jobs.pxu b/units/tsn/jobs.pxu |
141 | index 701398b..96b1a4f 100644 |
142 | --- a/units/tsn/jobs.pxu |
143 | +++ b/units/tsn/jobs.pxu |
144 | @@ -1,11 +1,30 @@ |
145 | unit: job |
146 | category_id: tsn |
147 | -id: tsn/enabled |
148 | -_summary: Check if TSN is supported |
149 | +id: tsn/tsn-detected |
150 | +plugin: shell |
151 | +_summary: Check if there is at least one ethernet interface support TSN |
152 | imports: from com.canonical.plainbox import manifest |
153 | requires: manifest.has_tsn == 'True' |
154 | -flags: simple |
155 | -command: echo "TSN is supported." |
156 | +user: root |
157 | +command: |
158 | + DEVLIST=$(lspci |grep -i "ethernet controller" |cut -d' ' -f1) |
159 | + exit_code=1 |
160 | + for DEVICE in $DEVLIST; do |
161 | + mystr="" |
162 | + mystr=$(lspci -nnvv -s "$DEVICE" |grep -i 'precision time measurement') |
163 | + if [ -n "$mystr" ]; then |
164 | + INTERFACE=$(ls -l /sys/class/net |grep "$DEVICE" |cut -d'/' -f8) |
165 | + echo "$INTERFACE : TSN supported!" |
166 | + exit_code=0 |
167 | + fi |
168 | + done |
169 | + echo "" |
170 | + if [ "$exit_code" -eq 0 ]; then |
171 | + echo "PASS: Found at least one ethernet interface supporting TSN!" |
172 | + else |
173 | + echo "FAIL: There's no ethernet interface supporting TSN!" |
174 | + fi |
175 | + exit "$exit_code" |
176 | |
177 | unit: job |
178 | category_id: tsn |
179 | @@ -47,7 +66,7 @@ _description: |
180 | If it does, it will have a number identifying which clock ID it is using,\ |
181 | and a corresponding entry in /dev/ptp#.\ |
182 | If it does not support PTP, it will list "none", and the test will fail. |
183 | -depends: tsn/enabled |
184 | +depends: tsn/tsn-detected |
185 | plugin: shell |
186 | user: root |
187 | command: |
188 | @@ -68,132 +87,220 @@ command: |
189 | unit: template |
190 | template-resource: tsn/tsn-devices |
191 | template-unit: job |
192 | -id: tsn/verify-SUT-{eth-interface}-as-client-time-sync |
193 | +id: tsn/test-env-setup-for-{eth-interface} |
194 | category_id: tsn |
195 | -_summary: Verify SUT can use {eth-interface} to establish foreign clock sync |
196 | -_purpose: |
197 | - Use {eth-interface} on the SUT to synchronize its clock with the clock\ |
198 | - of the Grand Master of the Secondary System. |
199 | -depends: tsn/enabled |
200 | -plugin: manual |
201 | -_steps: |
202 | - Follow the instructions as described here: |
203 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.pzr6mq4dyb0u |
204 | +_summary: Setup TSN testing environment for Ethernet interface {eth-interface} |
205 | +_description: |
206 | + Setup Testing environment for TSN |
207 | +depends: tsn/tsn-detected |
208 | +plugin: shell |
209 | +user: root |
210 | +environ: |
211 | + GPTP_CONFIG_PATH |
212 | +command: |
213 | + tsn_test_env_setup.sh {eth-interface} "${{GPTP_CONFIG_PATH:-/usr/share/gPTP.cfg}}" |
214 | |
215 | -unit: template |
216 | -template-resource: tsn/tsn-devices |
217 | -template-unit: job |
218 | -id: tsn/verify-SUT-{eth-interface}-as-client-sync-to-ptp-hw-clock |
219 | +unit: job |
220 | category_id: tsn |
221 | -_summary: Verify SUT {eth-interface} can sync its hardware clock to Master |
222 | -_purpose: |
223 | - Use {eth-interface} on the SUT to synchronize its clock with the clock\ |
224 | - of the Grand Master of the Secondary System. |
225 | -depends: tsn/enabled |
226 | -plugin: manual |
227 | -_steps: |
228 | - Follow the instructions as described here: |
229 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.dxubm4m7zzag |
230 | +id: tsn/test-server-env-setup |
231 | +_summary: Setup the TSN server environment |
232 | +plugin: user-interact |
233 | +user: root |
234 | +_description: |
235 | + Setup Testing server environment for TSN |
236 | +environ: |
237 | + GPTP_CONFIG_PATH |
238 | +command: |
239 | + echo "Please enter the ethernet interface (like enp1s0, eno1 etc.) you would like to enable." |
240 | + echo "Please make sure that ethernet interface support TSN." |
241 | + read -p "Ethernet interface: " eth_interface |
242 | + tsn_test_env_setup.sh "$eth_interface" "${{GPTP_CONFIG_PATH:-/usr/share/gPTP.cfg}}" |
243 | |
244 | unit: template |
245 | template-resource: tsn/tsn-devices |
246 | template-unit: job |
247 | -id: tsn/verify-SUT-{eth-interface}-as-talker-using-time-aware-shaper |
248 | +id: tsn/ieee802.1as-2011/time-sync-between-two-system-as-client-{eth-interface} |
249 | category_id: tsn |
250 | -_summary: Verify SUT {eth-interface} can transmit using Time Aware Shaper |
251 | +_summary: Verify SUT can use {eth-interface} to establish time-sync with another machine as client (IEEE 802.1AS-2011) |
252 | _purpose: |
253 | - Configure Time Aware Shaper on SUT and Secondary, and verify SUT transmits\ |
254 | - packets in accordance to this configuration |
255 | -depends: tsn/enabled |
256 | -plugin: manual |
257 | -_steps: |
258 | - Follow the instructions as described here: |
259 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.2mpce0amhrf9 |
260 | + Use {eth-interface} on the SUT to achieve time sync with the second machine as client |
261 | +depends: |
262 | + tsn/tsn-detected |
263 | +plugin: user-interact-verify |
264 | +user: root |
265 | +environ: |
266 | + TSN_SERVER_IP |
267 | + TSN_SERVER_USER |
268 | + TSN_SERVER_PWD |
269 | + TSN_SERVER_INTERFACE |
270 | + GPTP_CONFIG_PATH |
271 | +command: |
272 | + tsn_time_sync.sh 60 client "${{GPTP_CONFIG_PATH:-/usr/share/gPTP.cfg}}" {eth-interface} "$TSN_SERVER_USER" "$TSN_SERVER_IP" "$TSN_SERVER_PWD" "$TSN_SERVER_INTERFACE" |
273 | +_verification: |
274 | + Is the `rms` value within 100ns? |
275 | |
276 | unit: template |
277 | template-resource: tsn/tsn-devices |
278 | template-unit: job |
279 | -id: tsn/verify-SUT-{eth-interface}-as-talker-using-time-based-shaper |
280 | +id: tsn/ieee802.1as-2011/time-sync-between-two-system-as-master-{eth-interface} |
281 | category_id: tsn |
282 | -_summary: Verify SUT {eth-interface} can transmit at precise 1ms intervals |
283 | +_summary: Verify SUT can use {eth-interface} to establish time-sync with another machine as master (IEEE 802.1AS-2011) |
284 | _purpose: |
285 | - Configure Time Based Shaper on SUT and Secondary, and verify SUT transmits\ |
286 | - packets in accordance to this configuration |
287 | -depends: tsn/enabled |
288 | -plugin: manual |
289 | -_steps: |
290 | - Follow the instructions as described here: |
291 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.2m1zswmirdvb |
292 | + Use {eth-interface} on the SUT to achieve time sync with the second machine as master |
293 | +depends: |
294 | + tsn/tsn-detected |
295 | +plugin: user-interact-verify |
296 | +user: root |
297 | +environ: |
298 | + TSN_SERVER_IP |
299 | + TSN_SERVER_USER |
300 | + TSN_SERVER_PWD |
301 | + TSN_SERVER_INTERFACE |
302 | + GPTP_CONFIG_PATH |
303 | +command: |
304 | + tsn_time_sync.sh 60 master "${{GPTP_CONFIG_PATH:-/usr/share/gPTP.cfg}}" {eth-interface} "$TSN_SERVER_USER" "$TSN_SERVER_IP" "$TSN_SERVER_PWD" "$TSN_SERVER_INTERFACE" |
305 | +_verification: |
306 | + Is the `rms` value within 100ns? |
307 | |
308 | unit: template |
309 | template-resource: tsn/tsn-devices |
310 | template-unit: job |
311 | -id: tsn/verify-SUT-{eth-interface}-configured-with-frame-preemption |
312 | +id: tsn/ieee802.1as-2011/time-sync-system-clock-with-PHC-as-client-{eth-interface} |
313 | category_id: tsn |
314 | -_summary: Verify that Frame-Preemption can be configured on the {eth-interface} of the SUT |
315 | +_summary: Verify if the system can sync time between system clock and PTP hardware clock as client(IEEE 802.1AS-2011) |
316 | +depends: |
317 | + tsn/tsn-detected |
318 | + tsn/ieee802.1as-2011/time-sync-between-two-system-as-client-{eth-interface} |
319 | +plugin: user-interact-verify |
320 | +user: root |
321 | _purpose: |
322 | - Configure Frame-Preemption on the SUT |
323 | -depends: tsn/enabled |
324 | -plugin: manual |
325 | -_steps: |
326 | - Follow the instructions as described here: |
327 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.ge4dauxlinm3 |
328 | + To check if the system can sync time between system clock and PTP hardware clock as client |
329 | +environ: |
330 | + TSN_SERVER_IP |
331 | + TSN_SERVER_USER |
332 | + TSN_SERVER_PWD |
333 | + TSN_SERVER_INTERFACE |
334 | + GPTP_CONFIG_PATH |
335 | +command: |
336 | + tsn_time_sync.sh 60 client "${{GPTP_CONFIG_PATH:-/usr/share/gPTP.cfg}}" {eth-interface} "$TSN_SERVER_USER" "$TSN_SERVER_IP" "$TSN_SERVER_PWD" "$TSN_SERVER_INTERFACE" > /dev/null & |
337 | + pmc -u -b 0 -t 1 "SET GRANDMASTER_SETTINGS_NP clockClass 248\ |
338 | + clockAccuracy 0xfe offsetScaledLogVariance 0xffff currentUtcOffset 37\ |
339 | + leap61 0 leap59 0 currentUtcOffsetValid 1 ptpTimescale 1 timeTraceable 1\ |
340 | + frequencyTraceable 0 timeSource 0xa0" |
341 | + timeout 60 phc2sys -s {eth-interface} -O 0 -c CLOCK_REALTIME --step_threshold=1 \ |
342 | + --transportSpecific=1 -w -m --first_step_threshold=0.0 |
343 | +_verification: |
344 | + Is the `phc offset` value within `100ns`? |
345 | + Is the `State` value equal to `S2`? |
346 | + Is the `Path Delay` equal to `0` |
347 | |
348 | unit: template |
349 | template-resource: tsn/tsn-devices |
350 | template-unit: job |
351 | -id: tsn/verify-SUT-{eth-interface}-as-master-time-sync |
352 | +id: tsn/ieee802.1as-2011/time-sync-system-clock-with-PHC-as-master-{eth-interface} |
353 | category_id: tsn |
354 | -_summary: Verify SUT can use {eth-interface} to establish itself as the Clock Master |
355 | +_summary: Verify if the system can sync time between system clock and PTP hardware clock as master(IEEE 802.1AS-2011) |
356 | +depends: |
357 | + tsn/tsn-detected |
358 | + tsn/ieee802.1as-2011/time-sync-between-two-system-as-master-{eth-interface} |
359 | +plugin: user-interact-verify |
360 | +user: root |
361 | _purpose: |
362 | - Use {eth-interface} on the SUT to become the Grand Clock Master and have the Secondary\ |
363 | - System synchronize with it. |
364 | -depends: tsn/enabled |
365 | -plugin: manual |
366 | -_steps: |
367 | - Follow the instructions as described here: |
368 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.15f1v79u3km0 |
369 | + To check if the system can sync time between system clock and PTP hardware clock as master |
370 | +environ: |
371 | + TSN_SERVER_IP |
372 | + TSN_SERVER_USER |
373 | + TSN_SERVER_PWD |
374 | + TSN_SERVER_INTERFACE |
375 | + GPTP_CONFIG_PATH |
376 | +command: |
377 | + tsn_time_sync.sh 60 master "${{GPTP_CONFIG_PATH:-/usr/share/gPTP.cfg}}" {eth-interface} "$TSN_SERVER_USER" "$TSN_SERVER_IP" "$TSN_SERVER_PWD" "$TSN_SERVER_INTERFACE" > /dev/null & |
378 | + pmc -u -b 0 -t 1 "SET GRANDMASTER_SETTINGS_NP clockClass 248\ |
379 | + clockAccuracy 0xfe offsetScaledLogVariance 0xffff currentUtcOffset 37\ |
380 | + leap61 0 leap59 0 currentUtcOffsetValid 1 ptpTimescale 1 timeTraceable 1\ |
381 | + frequencyTraceable 0 timeSource 0xa0" |
382 | + timeout 60 phc2sys -s {eth-interface} -O 0 -c CLOCK_REALTIME --step_threshold=1 \ |
383 | + --transportSpecific=1 -w -m --first_step_threshold=0.0 |
384 | +_verification: |
385 | + Is the `phc offset` value within `100ns`? |
386 | + Is the `State` value equal to `S2`? |
387 | + Is the `Path Delay` equal to `0` |
388 | |
389 | unit: template |
390 | template-resource: tsn/tsn-devices |
391 | template-unit: job |
392 | -id: tsn/verify-SUT-{eth-interface}-as-master-sync-to-ptp-hw-clock |
393 | +id: tsn/time-based-shaping/udp-packet-time-check-{eth-interface} |
394 | category_id: tsn |
395 | -_summary: Verify Secondary can sync hardware clock of the SUT {eth-interface} |
396 | +_summary: Check the packet time intervals |
397 | +depends: |
398 | + tsn/tsn-detected |
399 | +plugin: user-interact-verify |
400 | +user: root |
401 | _purpose: |
402 | - Have the Secondary system to synchronize its HW clock with the HW clock on the {eth-interface} of the SUT |
403 | -depends: tsn/enabled |
404 | -plugin: manual |
405 | -_steps: |
406 | - Follow the instructions as described here: |
407 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.rb5hx7uq4hcr |
408 | + To check if the system can transmit udp packet precisely at 1 ms intervals |
409 | +environ: |
410 | + TSN_SERVER_IP |
411 | + TSN_SERVER_USER |
412 | + TSN_SERVER_PWD |
413 | + TSN_SERVER_INTERFACE |
414 | +command: |
415 | + tc qdisc del dev {eth-interface} root |
416 | + tc qdisc add dev {eth-interface} handle 8001: parent root mqprio num_tc 4 map 0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 queues 1@0 1@1 1@2 1@3 hw 0 |
417 | + tc qdisc replace dev {eth-interface} parent 8001:4 etf offload clockid CLOCK_TAI delta 500000 |
418 | + tc qdisc show dev {eth-interface} |
419 | + timeout 30 udp_tai -c 3 -i {eth-interface} -P 1000000 -p 90 -d 600000 > /dev/null & |
420 | + timeout 30 sshpass -p "u" ssh -o StrictHostKeyChecking=no "$TSN_SERVER_USER"@"$TSN_SERVER_IP" "echo "$TSN_SERVER_PWD" | sudo -S tcpdump -Q in -ttt -ni "$TSN_SERVER_INTERFACE" --time-stamp-precision=nano -j adapter_unsynced port 7788 -c 20000" |
421 | +_verification: |
422 | + Is the packets are being transmitted every 1000000ns (+/-500ns)? |
423 | + If > 95% of packets match this criteria the test is successful. |
424 | |
425 | unit: template |
426 | template-resource: tsn/tsn-devices |
427 | template-unit: job |
428 | -id: tsn/verify-SUT-{eth-interface}-as-listener-using-time-aware-shaper |
429 | +id: tsn/ieee802.1qbv/udp-traffic-check-{eth-interface} |
430 | category_id: tsn |
431 | -_summary: Verify SUT {eth-interface} can receive using Time Aware Shaper |
432 | +_summary: Check if the streams packet are handled properly |
433 | +depends: |
434 | + tsn/tsn-detected |
435 | +plugin: user-interact-verify |
436 | +user: root |
437 | _purpose: |
438 | - Configure Time Aware Shaper on SUT and Secondary, and verify SUT receives\ |
439 | - packets in accordance to this configuration |
440 | -depends: tsn/enabled |
441 | -plugin: manual |
442 | -_steps: |
443 | - Follow the instructions as described here: |
444 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.9x7mdm368f70 |
445 | + To check if the system can transmit 4 streams of iperf udp traffic |
446 | + using TAPRIO qdisc to limit the bandwidth of each stream. |
447 | +environ: |
448 | + TSN_SERVER_IP |
449 | + TSN_SERVER_USER |
450 | + TSN_SERVER_PWD |
451 | + TSN_SERVER_INTERFACE |
452 | + GPTP_CONFIG_PATH |
453 | +command: |
454 | + udp_traffic_test.sh {eth-interface} 30 "${{GPTP_CONFIG_PATH:-/usr/share/gPTP.cfg}}" "$TSN_SERVER_USER" "$TSN_SERVER_IP" "$TSN_SERVER_PWD" "$TSN_SERVER_INTERFACE" |
455 | +_verification: |
456 | + Is the send bytes and pkt are increasing for 100:1 - 100:4? |
457 | + |
458 | |
459 | unit: template |
460 | template-resource: tsn/tsn-devices |
461 | template-unit: job |
462 | -id: tsn/verify-SUT-{eth-interface}-as-listener-using-time-based-shaper |
463 | +id: tsn/ieee802.1qbu/check-frame-preemption-{eth-interface} |
464 | category_id: tsn |
465 | -_summary: Verify SUT {eth-interface} can receive at precise 1ms intervals |
466 | +_summary: Check if could set frame preemption |
467 | +depends: |
468 | + tsn/tsn-detected |
469 | +plugin: user-interact-verify |
470 | +user: root |
471 | _purpose: |
472 | - Configure Time Based Shaper on SUT and Secondary, and verify the Secondary transmits\ |
473 | - packets in accordance to this configuration |
474 | -depends: tsn/enabled |
475 | -plugin: manual |
476 | -_steps: |
477 | - Follow the instructions as described here: |
478 | - https://docs.google.com/document/d/14fNcjUzxh6H-mWK8tXV8HoUxrgFirOhDksUZfd44OTY/edit#heading=h.ozz3peqlqp6g |
479 | + To check if the system can setup frame preemption |
480 | +command: |
481 | + if ! command -v ethtool-rt.ethtool > /dev/null; then |
482 | + echo "ERROR: snap ethtool-rt si required for this test and it's probably not installed." |
483 | + echo "Please install it with the following command." |
484 | + echo "$ sudo snap install ethtool-rt --edge --devmode" |
485 | + exit 1 |
486 | + fi |
487 | + echo "## Setting frame preemption on..." |
488 | + ethtool-rt.ethtool --set-frame-preemption {eth-interface} fp on |
489 | + echo "## Showing frame preemption settings..." |
490 | + ethtool-rt.ethtool --show-frame-preemption {eth-interface} |
491 | +_verification: |
492 | + Is the frame preemption enabled for {eth-interface}? |
493 | diff --git a/units/tsn/test-plan.pxu b/units/tsn/test-plan.pxu |
494 | index f5d27de..1b6d405 100644 |
495 | --- a/units/tsn/test-plan.pxu |
496 | +++ b/units/tsn/test-plan.pxu |
497 | @@ -13,16 +13,14 @@ _name: Time Sensitive Networking (TSN) test (manual) |
498 | unit: test plan |
499 | bootstrap_include: |
500 | tsn/tsn-devices |
501 | -include: |
502 | - tsn/verify-SUT-.*-as-client-time-sync |
503 | - tsn/verify-SUT-.*-as-client-sync-to-ptp-hw-clock |
504 | - tsn/verify-SUT-.*-as-talker-using-time-aware-shaper |
505 | - tsn/verify-SUT-.*-as-talker-using-time-based-shaper |
506 | - tsn/verify-SUT-.*-configured-with-frame-preemption |
507 | - tsn/verify-SUT-.*-as-master-time-sync |
508 | - tsn/verify-SUT-.*-as-master-sync-to-ptp-hw-clock |
509 | - tsn/verify-SUT-.*-as-listener-using-time-aware-shaper |
510 | - tsn/verify-SUT-.*-as-listener-using-time-based-shaper |
511 | +include: |
512 | + tsn/tsn-detected |
513 | + tsn/test-env-setup-for-.* |
514 | +nested_part: |
515 | + tsn-ieee802.1as-2011 |
516 | + tsn-time-based-shaping |
517 | + tsn-ieee802.1qbv |
518 | + tsn-ieee802.1qbu |
519 | |
520 | id: tsn-automated |
521 | _name: Time Sensitive Networking (TSN) test (automated) |
522 | @@ -31,5 +29,51 @@ bootstrap_include: |
523 | tsn/tsn-devices |
524 | include: |
525 | tsn/verify-PTP-for-.* |
526 | - |
527 | - |
528 | + |
529 | +id: tsn-ieee802.1as-2011 |
530 | +_name: Time Sensitive Networking Test Plan for IEEE 802.1AS-2011 |
531 | +_description: |
532 | + This testplan is to check if it could follow IEEE 802.1AS-2011. |
533 | + - To achieve time synchronization between two platforms. |
534 | + - To synchronize each platforms's system clock with PHC (Physical hardware clock) |
535 | + using hardware cross-timestamping (which is selected by phc2sys automatically). |
536 | +unit: test plan |
537 | +bootstrap_include: |
538 | + tsn/tsn-devices |
539 | +include: |
540 | + tsn/ieee802.1as-2011/time-sync-between-two-system-as-client-.* |
541 | + tsn/ieee802.1as-2011/time-sync-between-two-system-as-master-.* |
542 | + tsn/ieee802.1as-2011/time-sync-system-clock-with-PHC-as-client-.* |
543 | + tsn/ieee802.1as-2011/time-sync-system-clock-with-PHC-as-master-.* |
544 | + |
545 | +id: tsn-time-based-shaping |
546 | +_name: Time Sensitive Networking Test Plan for Time-Based Shaping |
547 | +_description: |
548 | + This testplan is to check if it could do time-based Shaping. |
549 | + - Transmit a UDP packet precisely at 1 ms intervals. The listner board |
550 | + shows the time between packets. |
551 | +unit: test plan |
552 | +bootstrap_include: |
553 | + tsn/tsn-devices |
554 | +include: |
555 | + tsn/time-based-shaping/udp-packet-time-check-.* |
556 | + |
557 | +id: tsn-ieee802.1qbv |
558 | +_name: Time Sensitive Networking Test Plan for IEEE 802.1Qbv |
559 | +_description: |
560 | + This testplan is to check if it could follow IEEE 802.1Qbv Time Aware Shaper (TAS). |
561 | +unit: test plan |
562 | +bootstrap_include: |
563 | + tsn/tsn-devices |
564 | +include: |
565 | + tsn/ieee802.1qbv/udp-traffic-check-.* |
566 | + |
567 | +id: tsn-ieee802.1qbu |
568 | +_name: Time Sensitive Networking Test Plan for IEEE 802.1Qbu |
569 | +_description: |
570 | + This testplan is to check if it could follow IEEE 802.1Qbu Frame Preemption. |
571 | +unit: test plan |
572 | +bootstrap_include: |
573 | + tsn/tsn-devices |
574 | +include: |
575 | + tsn/ieee802.1qbu/check-frame-preemption-.* |
@Vincent,
I have one minor suggestion. Otherwise LGTM.