forked from mlichvar/linuxptp-testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
20-pmc
executable file
·500 lines (449 loc) · 16.4 KB
/
20-pmc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
#!/bin/bash
. test.common
test_start "pmc"
limit=51
jitter=0.0
subnets="1 2 | 2 3"
pmc_node=3
requests_replies=(
"GET USER_DESCRIPTION"
"sending: GET USER_DESCRIPTION
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT USER_DESCRIPTION
userDescription "
"GET DEFAULT_DATA_SET"
"sending: GET DEFAULT_DATA_SET
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT DEFAULT_DATA_SET
twoStepFlag 1
slaveOnly 0
numberPorts 2
priority1 128
clockClass 248
clockAccuracy 0xfe
offsetScaledLogVariance 0xffff
priority2 128
clockIdentity 123456\.fffe\.780102
domainNumber 0"
"GET CURRENT_DATA_SET"
"sending: GET CURRENT_DATA_SET
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT CURRENT_DATA_SET
stepsRemoved 1
offsetFromMaster -?[0-9]+\.[0-9]+
meanPathDelay [0-9]+\.[0-9]+"
"GET PARENT_DATA_SET"
"sending: GET PARENT_DATA_SET
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT PARENT_DATA_SET
parentPortIdentity 123456\.fffe\.780101-1
parentStats 0
observedParentOffsetScaledLogVariance 0xffff
observedParentClockPhaseChangeRate 0x7fffffff
grandmasterPriority1 128
gm\.ClockClass 248
gm\.ClockAccuracy 0xfe
gm\.OffsetScaledLogVariance 0xffff
grandmasterPriority2 128
grandmasterIdentity 123456\.fffe\.780101"
"GET TIME_PROPERTIES_DATA_SET"
"sending: GET TIME_PROPERTIES_DATA_SET
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT TIME_PROPERTIES_DATA_SET
currentUtcOffset 3[567]
leap61 0
leap59 0
currentUtcOffsetValid 0
ptpTimescale 1
timeTraceable 0
frequencyTraceable 0
timeSource 0xa0"
"GET PRIORITY1"
"sending: GET PRIORITY1
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT PRIORITY1
priority1 128"
"GET PRIORITY2"
"sending: GET PRIORITY2
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT PRIORITY2
priority2 128"
"GET DOMAIN"
"sending: GET DOMAIN
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT DOMAIN
domainNumber 0"
"GET SLAVE_ONLY"
"sending: GET SLAVE_ONLY
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT SLAVE_ONLY
slaveOnly 0"
"GET CLOCK_ACCURACY"
"sending: GET CLOCK_ACCURACY
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT CLOCK_ACCURACY
clockAccuracy 0xfe"
"GET TRACEABILITY_PROPERTIES"
"sending: GET TRACEABILITY_PROPERTIES
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT TRACEABILITY_PROPERTIES
timeTraceable 0
frequencyTraceable 0"
"GET TIMESCALE_PROPERTIES"
"sending: GET TIMESCALE_PROPERTIES
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT TIMESCALE_PROPERTIES
ptpTimescale 1"
"GET TIME_STATUS_NP"
"sending: GET TIME_STATUS_NP
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT TIME_STATUS_NP
master_offset -?[0-9]+
ingress_time 1262304[0-9]+
cumulativeScaledRateOffset \+0\.000000000
scaledLastGmPhaseChange 0
gmTimeBaseIndicator 0
lastGmPhaseChange 0x0000'0000000000000000\.0000
gmPresent true
gmIdentity 123456\.fffe\.780101"
"GET GRANDMASTER_SETTINGS_NP"
"sending: GET GRANDMASTER_SETTINGS_NP
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT GRANDMASTER_SETTINGS_NP
clockClass 248
clockAccuracy 0xfe
offsetScaledLogVariance 0xffff
currentUtcOffset 3[567]
leap61 0
leap59 0
currentUtcOffsetValid 0
ptpTimescale 1
timeTraceable 0
frequencyTraceable 0
timeSource 0xa0"
"GET NULL_MANAGEMENT"
"sending: GET NULL_MANAGEMENT
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT "
"GET CLOCK_DESCRIPTION"
"sending: GET CLOCK_DESCRIPTION
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT CLOCK_DESCRIPTION
clockType 0x4000
physicalLayerProtocol IEEE 802\.3
physicalAddress 12:34:56:78:01:02
protocolAddress 1 192\.168\.123\.2
manufacturerId 00:00:00
productDescription ;;
revisionData ;;
userDescription
profileId 00:1b:19:00:01:00
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT CLOCK_DESCRIPTION
clockType 0x4000
physicalLayerProtocol IEEE 802\.3
physicalAddress 12:34:56:78:02:02
protocolAddress 1 192\.168\.124\.2
manufacturerId 00:00:00
productDescription ;;
revisionData ;;
userDescription
profileId 00:1b:19:00:01:00"
"GET PORT_DATA_SET"
"sending: GET PORT_DATA_SET
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT PORT_DATA_SET
portIdentity 123456\.fffe\.780102-1
portState SLAVE
logMinDelayReqInterval 0
peerMeanPathDelay 0
logAnnounceInterval 1
announceReceiptTimeout 3
logSyncInterval 0
delayMechanism 1
logMinPdelayReqInterval 0
versionNumber 2
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT PORT_DATA_SET
portIdentity 123456\.fffe\.780102-2
portState MASTER
logMinDelayReqInterval 0
peerMeanPathDelay 0
logAnnounceInterval 1
announceReceiptTimeout 3
logSyncInterval 0
delayMechanism 1
logMinPdelayReqInterval 0
versionNumber 2"
"GET LOG_ANNOUNCE_INTERVAL"
"sending: GET LOG_ANNOUNCE_INTERVAL
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT LOG_ANNOUNCE_INTERVAL
logAnnounceInterval 1
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT LOG_ANNOUNCE_INTERVAL
logAnnounceInterval 1"
"GET ANNOUNCE_RECEIPT_TIMEOUT"
"sending: GET ANNOUNCE_RECEIPT_TIMEOUT
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT ANNOUNCE_RECEIPT_TIMEOUT
announceReceiptTimeout 3
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT ANNOUNCE_RECEIPT_TIMEOUT
announceReceiptTimeout 3"
"GET LOG_SYNC_INTERVAL"
"sending: GET LOG_SYNC_INTERVAL
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT LOG_SYNC_INTERVAL
logSyncInterval 0
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT LOG_SYNC_INTERVAL
logSyncInterval 0"
"GET VERSION_NUMBER"
"sending: GET VERSION_NUMBER
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT VERSION_NUMBER
versionNumber 2
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT VERSION_NUMBER
versionNumber 2"
"GET DELAY_MECHANISM"
"sending: GET DELAY_MECHANISM
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT DELAY_MECHANISM
delayMechanism 1
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT DELAY_MECHANISM
delayMechanism 1"
"GET LOG_MIN_PDELAY_REQ_INTERVAL"
"sending: GET LOG_MIN_PDELAY_REQ_INTERVAL
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGE?MENT LOG_MIN_PDELAY_REQ_INTERVAL
logMinPdelayReqInterval 0
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGE?MENT LOG_MIN_PDELAY_REQ_INTERVAL
logMinPdelayReqInterval 0"
"GET PORT_DATA_SET_NP"
"sending: GET PORT_DATA_SET_NP
123456.fffe.780102-1 seq 0 RESPONSE MANAGE?MENT PORT_DATA_SET_NP
neighborPropDelayThresh 20000000
asCapable 1
123456.fffe.780102-2 seq 0 RESPONSE MANAGE?MENT PORT_DATA_SET_NP
neighborPropDelayThresh 20000000
asCapable 1"
"GET PORT_STATS_NP"
"sending: GET PORT_STATS_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT PORT_STATS_NP
portIdentity 123456\.fffe\.780102-1
rx_Sync [1234][0-9]
rx_Delay_Req 0
rx_Pdelay_Req 0
rx_Pdelay_Resp 0
rx_Follow_Up [1234][0-9]
rx_Delay_Resp [1234][0-9]
rx_Pdelay_Resp_Follow_Up 0
rx_Announce [1234][0-9]
rx_Signaling 0
rx_Management 0
tx_Sync 0
tx_Delay_Req [1234][0-9]
tx_Pdelay_Req 0
tx_Pdelay_Resp 0
tx_Follow_Up 0
tx_Delay_Resp 0
tx_Pdelay_Resp_Follow_Up 0
tx_Announce 0
tx_Signaling 0
tx_Management 0
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT PORT_STATS_NP
portIdentity 123456\.fffe\.780102-2
rx_Sync 0
rx_Delay_Req 0
rx_Pdelay_Req 0
rx_Pdelay_Resp 0
rx_Follow_Up 0
rx_Delay_Resp 0
rx_Pdelay_Resp_Follow_Up 0
rx_Announce 0
rx_Signaling 0
rx_Management 1
tx_Sync [1234][0-9]
tx_Delay_Req 0
tx_Pdelay_Req 0
tx_Pdelay_Resp 0
tx_Follow_Up [1234][0-9]
tx_Delay_Resp 0
tx_Pdelay_Resp_Follow_Up 0
tx_Announce [1234][0-9]
tx_Signaling 0
tx_Management 1"
"GET PORT_SERVICE_STATS_NP"
"sending: GET PORT_SERVICE_STATS_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT PORT_SERVICE_STATS_NP
portIdentity 123456\.fffe\.780102-1
announce_timeout 0
sync_timeout 0
delay_timeout [1234][0-9]
unicast_service_timeout 0
unicast_request_timeout 0
master_announce_timeout 0
master_sync_timeout 0
qualification_timeout 0
sync_mismatch 0
followup_mismatch 0
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT PORT_SERVICE_STATS_NP
portIdentity 123456\.fffe\.780102-2
announce_timeout 1
sync_timeout 0
delay_timeout 0
unicast_service_timeout 0
unicast_request_timeout 0
master_announce_timeout [1234][0-9]
master_sync_timeout [1234][0-9]
qualification_timeout 0
sync_mismatch 0
followup_mismatch 0"
"GET UNICAST_MASTER_TABLE_NP"
"sending: GET UNICAST_MASTER_TABLE_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT UNICAST_MASTER_TABLE_NP
actual_table_size 0
BM identity address state clockClass clockQuality offsetScaledLogVariance p1 p2
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT UNICAST_MASTER_TABLE_NP
actual_table_size 0
BM identity address state clockClass clockQuality offsetScaledLogVariance p1 p2"
"GET ALTERNATE_TIME_OFFSET_ENABLE"
"sending: GET ALTERNATE_TIME_OFFSET_ENABLE
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT ALTERNATE_TIME_OFFSET_ENABLE
keyField 0
enable 0"
"GET ALTERNATE_TIME_OFFSET_NAME"
"sending: GET ALTERNATE_TIME_OFFSET_NAME
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT ALTERNATE_TIME_OFFSET_NAME
keyField 0
displayName "
"GET ALTERNATE_TIME_OFFSET_PROPERTIES"
"sending: GET ALTERNATE_TIME_OFFSET_PROPERTIES
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT ALTERNATE_TIME_OFFSET_PROPERTIES
keyField 0
currentOffset 0
jumpSeconds 0
timeOfNextJump 0"
"GET POWER_PROFILE_SETTINGS_NP"
"sending: GET POWER_PROFILE_SETTINGS_NP
123456.fffe.780102-1 seq 0 RESPONSE MANAGEMENT POWER_PROFILE_SETTINGS_NP
version 0
grandmasterID 0x0000
grandmasterTimeInaccuracy 4294967295
networkTimeInaccuracy 4294967295
totalTimeInaccuracy 4294967295
123456.fffe.780102-2 seq 0 RESPONSE MANAGEMENT POWER_PROFILE_SETTINGS_NP
version 0
grandmasterID 0x0000
grandmasterTimeInaccuracy 4294967295
networkTimeInaccuracy 4294967295
totalTimeInaccuracy 4294967295"
"GET CMLDS_INFO_NP"
"sending: GET CMLDS_INFO_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT CMLDS_INFO_NP
meanLinkDelay 0
scaledNeighborRateRatio 0
as_capable 1
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT CMLDS_INFO_NP
meanLinkDelay 0
scaledNeighborRateRatio 0
as_capable 1"
)
for i in $(seq 0 $[${#requests_replies[*]} / 2 - 1]); do
pmc_conf=${requests_replies[$[i * 2]]}
run_ptp4l || test_fail
if ! check_pmc_output "^${requests_replies[$[i * 2 + 1]]}$"; then
cat tmp/log.$pmc_node
test_fail
fi
done
requests_replies=(
"SET PRIORITY1 130"
"sending: SET PRIORITY1
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT PRIORITY1
priority1 130"
"SET PRIORITY2 130"
"sending: SET PRIORITY2
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT PRIORITY2
priority2 130"
"SET GRANDMASTER_SETTINGS_NP clockClass 6 clockAccuracy 0xfd offsetScaledLogVariance 0xfffe currentUtcOffset 50 leap61 1 leap59 0 currentUtcOffsetValid 1 ptpTimescale 0 timeTraceable 1 frequencyTraceable 1 timeSource 0xa1"
"sending: SET GRANDMASTER_SETTINGS_NP
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT GRANDMASTER_SETTINGS_NP
clockClass 6
clockAccuracy 0xfd
offsetScaledLogVariance 0xfffe
currentUtcOffset 50
leap61 1
leap59 0
currentUtcOffsetValid 1
ptpTimescale 0
timeTraceable 1
frequencyTraceable 1
timeSource 0xa1"
"SET SUBSCRIBE_EVENTS_NP duration 1 NOTIFY_PORT_STATE on NOTIFY_TIME_SYNC on NOTIFY_PARENT_DATA_SET on NOTIFY_CMLDS on"
"sending: SET SUBSCRIBE_EVENTS_NP
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT SUBSCRIBE_EVENTS_NP
duration 1
NOTIFY_PORT_STATE on
NOTIFY_TIME_SYNC on
NOTIFY_PARENT_DATA_SET on
NOTIFY_CMLDS on.*"
"SET SYNCHRONIZATION_UNCERTAIN_NP 1"
"sending: SET SYNCHRONIZATION_UNCERTAIN_NP
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT SYNCHRONIZATION_UNCERTAIN_NP
uncertain 1"
# asCapable is ignored
"SET PORT_DATA_SET_NP neighborPropDelayThresh 1000 asCapable 0"
"sending: SET PORT_DATA_SET_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT PORT_DATA_SET_NP
neighborPropDelayThresh 1000
asCapable 1
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT PORT_DATA_SET_NP
neighborPropDelayThresh 1000
asCapable 1"
"SET ALTERNATE_TIME_OFFSET_ENABLE keyField 3 enable 1"
"sending: SET ALTERNATE_TIME_OFFSET_ENABLE
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT ALTERNATE_TIME_OFFSET_ENABLE
keyField 3
enable 1"
"SET ALTERNATE_TIME_OFFSET_NAME keyField 3 displayName CET"
"sending: SET ALTERNATE_TIME_OFFSET_NAME
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT ALTERNATE_TIME_OFFSET_NAME
keyField 3
displayName CET"
"SET ALTERNATE_TIME_OFFSET_PROPERTIES keyField 3 currentOffset 36000 jumpSeconds -3600 timeOfNextJump 6000000000"
"sending: SET ALTERNATE_TIME_OFFSET_PROPERTIES
123456\.fffe\.780102-0 seq 0 RESPONSE MANAGEMENT ALTERNATE_TIME_OFFSET_PROPERTIES
keyField 3
currentOffset 36000
jumpSeconds -3600
timeOfNextJump 6000000000"
"SET POWER_PROFILE_SETTINGS_NP version 2 grandmasterID 1 grandmasterTimeInaccuracy 100 networkTimeInaccuracy 100 totalTimeInaccuracy 200"
"sending: SET POWER_PROFILE_SETTINGS_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT POWER_PROFILE_SETTINGS_NP
version 2
grandmasterID 0x0001
grandmasterTimeInaccuracy 100
networkTimeInaccuracy 100
totalTimeInaccuracy 200
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT POWER_PROFILE_SETTINGS_NP
version 2
grandmasterID 0x0001
grandmasterTimeInaccuracy 100
networkTimeInaccuracy 100
totalTimeInaccuracy 200"
"GET PORT_PROPERTIES_NP"
"sending: GET PORT_PROPERTIES_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT PORT_PROPERTIES_NP
portIdentity 123456\.fffe\.780102-1
portState SLAVE
timestamping HARDWARE
interface eth0
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT PORT_PROPERTIES_NP
portIdentity 123456\.fffe\.780102-2
portState MASTER
timestamping HARDWARE
interface eth1"
"GET PORT_HWCLOCK_NP"
"sending: GET PORT_HWCLOCK_NP
123456\.fffe\.780102-1 seq 0 RESPONSE MANAGEMENT PORT_HWCLOCK_NP
portIdentity 123456\.fffe\.780102-1
phcIndex 1
flags 0
123456\.fffe\.780102-2 seq 0 RESPONSE MANAGEMENT PORT_HWCLOCK_NP
portIdentity 123456\.fffe\.780102-2
phcIndex 1
flags 0"
)
for i in $(seq 0 $[${#requests_replies[*]} / 2 - 1]); do
pmc_conf=${requests_replies[$[i * 2]]}
# UDS-RO
pmc_uds="2:2"
run_ptp4l || test_fail
if ! check_pmc_output "RESPONSE MANAGEMENT_ERROR_STATUS"; then
cat tmp/log.$pmc_node
test_fail
fi
# UDS-RW
pmc_uds="2:1"
run_ptp4l || test_fail
if ! check_pmc_output "^${requests_replies[$[i * 2 + 1]]}$"; then
cat tmp/log.$pmc_node
test_fail
fi
done
test_pass