]> git.proxmox.com Git - mirror_ovs.git/blame - tests/reconnect.at
dpif_packet: Rename to dp_packet
[mirror_ovs.git] / tests / reconnect.at
CommitLineData
3ed497fc
BP
1AT_BANNER([reconnect library])
2
d1b680c6
BP
3m4_define([__RECONNECT_CHECK],
4 [AT_SETUP([$1])
99155935 5 $2
d1b680c6 6 AT_KEYWORDS([reconnect])
99155935
BP
7 AT_DATA([input], [$3])
8 AT_CHECK([$4], [0], [$5])
d1b680c6
BP
9 AT_CLEANUP])
10
11m4_define([RECONNECT_CHECK],
99155935
BP
12 [__RECONNECT_CHECK(
13 [$1 - C],
14 [],
15 [$2],
eadd1644 16 [ovstest test-reconnect < input],
99155935
BP
17 [$3])
18 __RECONNECT_CHECK(
19 [$1 - Python],
20 [AT_SKIP_IF([test $HAVE_PYTHON = no])],
21 [$2],
22 [$PYTHON $srcdir/test-reconnect.py < input],
23 [$3])])
d1b680c6 24
3ed497fc 25######################################################################
d1b680c6
BP
26RECONNECT_CHECK([nothing happens if not enabled],
27 [run
3ed497fc 28timeout
d1b680c6 29],
3ed497fc
BP
30 [### t=1000 ###
31run
32timeout
33 no timeout
34])
3ed497fc
BP
35
36######################################################################
d1b680c6
BP
37RECONNECT_CHECK([quick connect, idle disconnect],
38 [enable
3ed497fc
BP
39
40# Connection succeeds.
41run
42connected
43
44# Send inactivity probe.
45timeout
46run
47
48# Idle timeout kills connection.
49timeout
50run
51disconnected
d1b680c6 52],
3ed497fc
BP
53 [### t=1000 ###
54enable
55 in BACKOFF for 0 ms (0 ms backoff)
56
57# Connection succeeds.
58run
59 should connect
60connected
61 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 62 created 1000, last activity 1000, last connected 1000
3ed497fc 63 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
64 connected
65 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
66
67# Send inactivity probe.
68timeout
69 advance 5000 ms
70
71### t=6000 ###
72 in ACTIVE for 5000 ms (0 ms backoff)
3ed497fc
BP
73run
74 should send probe
75 in IDLE for 0 ms (0 ms backoff)
76
77# Idle timeout kills connection.
78timeout
79 advance 5000 ms
80
81### t=11000 ###
82 in IDLE for 5000 ms (0 ms backoff)
3ed497fc
BP
83run
84 should disconnect
85disconnected
86 in BACKOFF for 0 ms (1000 ms backoff)
87 1 successful connections out of 1 attempts, seqno 2
5eda645e 88 disconnected
eba18f00 89 disconnected at 11000 ms (0 ms ago)
3ed497fc 90])
3ed497fc
BP
91
92######################################################################
d1b680c6
BP
93RECONNECT_CHECK([slow connect, idle disconnect],
94 [enable
3ed497fc
BP
95
96# Start connecting.
97run
98connecting
99
100# Connect after 500 ms.
101advance 500
102run
103connected
104
105# Send inactivity probe.
106timeout
107run
108
109# Idle timeout kills connection.
110timeout
111run
112disconnected
d1b680c6 113],
3ed497fc
BP
114 [### t=1000 ###
115enable
116 in BACKOFF for 0 ms (0 ms backoff)
117
118# Start connecting.
119run
120 should connect
121connecting
c36cf65e 122 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc
BP
123
124# Connect after 500 ms.
125advance 500
126
127### t=1500 ###
c36cf65e 128 in CONNECTING for 500 ms (0 ms backoff)
3ed497fc 129run
3ed497fc
BP
130connected
131 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 132 created 1000, last activity 1000, last connected 1500
3ed497fc 133 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
134 connected
135 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
136
137# Send inactivity probe.
138timeout
139 advance 5000 ms
140
141### t=6500 ###
142 in ACTIVE for 5000 ms (0 ms backoff)
3ed497fc
BP
143run
144 should send probe
145 in IDLE for 0 ms (0 ms backoff)
146
147# Idle timeout kills connection.
148timeout
149 advance 5000 ms
150
151### t=11500 ###
152 in IDLE for 5000 ms (0 ms backoff)
3ed497fc
BP
153run
154 should disconnect
155disconnected
156 in BACKOFF for 0 ms (1000 ms backoff)
157 1 successful connections out of 1 attempts, seqno 2
5eda645e 158 disconnected
eba18f00 159 disconnected at 11500 ms (0 ms ago)
3ed497fc 160])
3ed497fc
BP
161
162######################################################################
d1b680c6
BP
163RECONNECT_CHECK([connect backs off],
164 [enable
3ed497fc
BP
165
166# First connection attempt fails after 1000 ms.
167run
168connecting
169run
170timeout
171run
172connect-failed
173
174# Back off for 1000 ms.
175timeout
176run
177
178# Second connection attempt fails after 1000 ms.
179connecting
180timeout
181run
182connect-failed
183
184# Back off for 2000 ms.
185timeout
186run
187
188# Third connection attempt fails after 2000 ms.
189connecting
190timeout
191run
192connect-failed
193
194# Back off for 4000 ms.
195timeout
196run
197
198# Third connection attempt fails after 4000 ms.
199connecting
200timeout
201run
202connect-failed
203
204# Back off for 8000 ms.
205timeout
206run
207
208# Third connection attempt fails after 8000 ms.
209connecting
210timeout
211run
212connect-failed
213
214# Back off for 8000 ms.
215timeout
216run
217
218# Fourth connection attempt fails after 8000 ms.
219connecting
220timeout
221run
222connect-failed
d1b680c6 223],
3ed497fc
BP
224 [### t=1000 ###
225enable
226 in BACKOFF for 0 ms (0 ms backoff)
227
228# First connection attempt fails after 1000 ms.
229run
230 should connect
231connecting
c36cf65e 232 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 233run
3ed497fc
BP
234timeout
235 advance 1000 ms
236
237### t=2000 ###
c36cf65e 238 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
239run
240 should disconnect
241connect-failed
242 in BACKOFF for 0 ms (1000 ms backoff)
243 0 successful connections out of 1 attempts, seqno 0
244
245# Back off for 1000 ms.
246timeout
247 advance 1000 ms
248
249### t=3000 ###
250 in BACKOFF for 1000 ms (1000 ms backoff)
251run
252 should connect
253
254# Second connection attempt fails after 1000 ms.
255connecting
c36cf65e 256 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
257timeout
258 advance 1000 ms
259
260### t=4000 ###
c36cf65e 261 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
262run
263 should disconnect
264connect-failed
265 in BACKOFF for 0 ms (2000 ms backoff)
266 0 successful connections out of 2 attempts, seqno 0
267
268# Back off for 2000 ms.
269timeout
270 advance 2000 ms
271
272### t=6000 ###
273 in BACKOFF for 2000 ms (2000 ms backoff)
274run
275 should connect
276
277# Third connection attempt fails after 2000 ms.
278connecting
c36cf65e 279 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
280timeout
281 advance 2000 ms
282
283### t=8000 ###
c36cf65e 284 in CONNECTING for 2000 ms (2000 ms backoff)
3ed497fc
BP
285run
286 should disconnect
287connect-failed
288 in BACKOFF for 0 ms (4000 ms backoff)
289 0 successful connections out of 3 attempts, seqno 0
290
291# Back off for 4000 ms.
292timeout
293 advance 4000 ms
294
295### t=12000 ###
296 in BACKOFF for 4000 ms (4000 ms backoff)
297run
298 should connect
299
300# Third connection attempt fails after 4000 ms.
301connecting
c36cf65e 302 in CONNECTING for 0 ms (4000 ms backoff)
3ed497fc
BP
303timeout
304 advance 4000 ms
305
306### t=16000 ###
c36cf65e 307 in CONNECTING for 4000 ms (4000 ms backoff)
3ed497fc
BP
308run
309 should disconnect
310connect-failed
311 in BACKOFF for 0 ms (8000 ms backoff)
312 0 successful connections out of 4 attempts, seqno 0
313
314# Back off for 8000 ms.
315timeout
316 advance 8000 ms
317
318### t=24000 ###
319 in BACKOFF for 8000 ms (8000 ms backoff)
320run
321 should connect
322
323# Third connection attempt fails after 8000 ms.
324connecting
c36cf65e 325 in CONNECTING for 0 ms (8000 ms backoff)
3ed497fc
BP
326timeout
327 advance 8000 ms
328
329### t=32000 ###
c36cf65e 330 in CONNECTING for 8000 ms (8000 ms backoff)
3ed497fc
BP
331run
332 should disconnect
333connect-failed
334 in BACKOFF for 0 ms (8000 ms backoff)
335 0 successful connections out of 5 attempts, seqno 0
336
337# Back off for 8000 ms.
338timeout
339 advance 8000 ms
340
341### t=40000 ###
342 in BACKOFF for 8000 ms (8000 ms backoff)
343run
344 should connect
345
346# Fourth connection attempt fails after 8000 ms.
347connecting
c36cf65e 348 in CONNECTING for 0 ms (8000 ms backoff)
3ed497fc
BP
349timeout
350 advance 8000 ms
351
352### t=48000 ###
c36cf65e 353 in CONNECTING for 8000 ms (8000 ms backoff)
3ed497fc
BP
354run
355 should disconnect
356connect-failed
357 in BACKOFF for 0 ms (8000 ms backoff)
358 0 successful connections out of 6 attempts, seqno 0
359])
3ed497fc
BP
360
361######################################################################
d1b680c6
BP
362RECONNECT_CHECK([connections with no data preserve backoff],
363 [enable
3ed497fc
BP
364
365# First connect, then idle timeout kills connection.
366run
367connected
368timeout
369run
370timeout
371run
372disconnected
373
374# Back off for 1000 ms.
375timeout
376run
377
378# Second connect, then idle timeout kills connection.
379run
380connected
381timeout
382run
383timeout
384run
385disconnected
386
387# Back off for 2000 ms.
388timeout
389run
390
391# Third connect, then idle timeout kills connection.
392run
393connected
394timeout
395run
396timeout
397run
398disconnected
399
400# Back off for 4000 ms.
401timeout
402], [### t=1000 ###
403enable
404 in BACKOFF for 0 ms (0 ms backoff)
405
406# First connect, then idle timeout kills connection.
407run
408 should connect
409connected
410 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 411 created 1000, last activity 1000, last connected 1000
3ed497fc 412 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
413 connected
414 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
415timeout
416 advance 5000 ms
417
418### t=6000 ###
419 in ACTIVE for 5000 ms (0 ms backoff)
3ed497fc
BP
420run
421 should send probe
422 in IDLE for 0 ms (0 ms backoff)
423timeout
424 advance 5000 ms
425
426### t=11000 ###
427 in IDLE for 5000 ms (0 ms backoff)
3ed497fc
BP
428run
429 should disconnect
430disconnected
431 in BACKOFF for 0 ms (1000 ms backoff)
432 1 successful connections out of 1 attempts, seqno 2
5eda645e 433 disconnected
eba18f00 434 disconnected at 11000 ms (0 ms ago)
3ed497fc
BP
435
436# Back off for 1000 ms.
437timeout
438 advance 1000 ms
439
440### t=12000 ###
441 in BACKOFF for 1000 ms (1000 ms backoff)
5eda645e 442 last connected 11000 ms ago, connected 10000 ms total
3ed497fc
BP
443run
444 should connect
445
446# Second connect, then idle timeout kills connection.
447run
448 should connect
449connected
450 in ACTIVE for 0 ms (1000 ms backoff)
a6f639f8 451 created 1000, last activity 1000, last connected 12000
3ed497fc 452 2 successful connections out of 2 attempts, seqno 3
5eda645e
AE
453 connected
454 last connected 0 ms ago, connected 10000 ms total
3ed497fc
BP
455timeout
456 advance 5000 ms
457
458### t=17000 ###
459 in ACTIVE for 5000 ms (1000 ms backoff)
3ed497fc
BP
460run
461 should send probe
462 in IDLE for 0 ms (1000 ms backoff)
463timeout
464 advance 5000 ms
465
466### t=22000 ###
467 in IDLE for 5000 ms (1000 ms backoff)
3ed497fc
BP
468run
469 should disconnect
470disconnected
471 in BACKOFF for 0 ms (2000 ms backoff)
472 2 successful connections out of 2 attempts, seqno 4
5eda645e 473 disconnected
eba18f00 474 disconnected at 22000 ms (0 ms ago)
3ed497fc
BP
475
476# Back off for 2000 ms.
477timeout
478 advance 2000 ms
479
480### t=24000 ###
481 in BACKOFF for 2000 ms (2000 ms backoff)
5eda645e 482 last connected 12000 ms ago, connected 20000 ms total
3ed497fc
BP
483run
484 should connect
485
486# Third connect, then idle timeout kills connection.
487run
488 should connect
489connected
490 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 491 created 1000, last activity 1000, last connected 24000
3ed497fc 492 3 successful connections out of 3 attempts, seqno 5
5eda645e
AE
493 connected
494 last connected 0 ms ago, connected 20000 ms total
3ed497fc
BP
495timeout
496 advance 5000 ms
497
498### t=29000 ###
499 in ACTIVE for 5000 ms (2000 ms backoff)
3ed497fc
BP
500run
501 should send probe
502 in IDLE for 0 ms (2000 ms backoff)
503timeout
504 advance 5000 ms
505
506### t=34000 ###
507 in IDLE for 5000 ms (2000 ms backoff)
3ed497fc
BP
508run
509 should disconnect
510disconnected
511 in BACKOFF for 0 ms (4000 ms backoff)
512 3 successful connections out of 3 attempts, seqno 6
5eda645e 513 disconnected
eba18f00 514 disconnected at 34000 ms (0 ms ago)
3ed497fc
BP
515
516# Back off for 4000 ms.
517timeout
518 advance 4000 ms
519
520### t=38000 ###
521 in BACKOFF for 4000 ms (4000 ms backoff)
5eda645e 522 last connected 14000 ms ago, connected 30000 ms total
3ed497fc 523])
3ed497fc
BP
524
525######################################################################
d1b680c6
BP
526RECONNECT_CHECK([brief connection preserves backoff],
527 [enable
3ed497fc
BP
528
529# First connection attempt fails after 1000 ms.
530run
531connecting
532run
533timeout
534run
535connect-failed
536
537# Back off for 1000 ms.
538timeout
539run
540
541# Second connection attempt fails after 1000 ms.
542connecting
543timeout
544run
545connect-failed
546
547# Back off for 2000 ms.
548timeout
549run
550
551# Third connection attempt succeeds after 500 ms.
552connecting
553advance 500
554run
555connected
556
557# Connection drops after another 250 ms.
558advance 250
559disconnected
560run
561
562# Back off for 4000 ms.
563timeout
564run
d1b680c6 565], [### t=1000 ###
3ed497fc
BP
566enable
567 in BACKOFF for 0 ms (0 ms backoff)
568
569# First connection attempt fails after 1000 ms.
570run
571 should connect
572connecting
c36cf65e 573 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 574run
3ed497fc
BP
575timeout
576 advance 1000 ms
577
578### t=2000 ###
c36cf65e 579 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
580run
581 should disconnect
582connect-failed
583 in BACKOFF for 0 ms (1000 ms backoff)
584 0 successful connections out of 1 attempts, seqno 0
585
586# Back off for 1000 ms.
587timeout
588 advance 1000 ms
589
590### t=3000 ###
591 in BACKOFF for 1000 ms (1000 ms backoff)
592run
593 should connect
594
595# Second connection attempt fails after 1000 ms.
596connecting
c36cf65e 597 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
598timeout
599 advance 1000 ms
600
601### t=4000 ###
c36cf65e 602 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
603run
604 should disconnect
605connect-failed
606 in BACKOFF for 0 ms (2000 ms backoff)
607 0 successful connections out of 2 attempts, seqno 0
608
609# Back off for 2000 ms.
610timeout
611 advance 2000 ms
612
613### t=6000 ###
614 in BACKOFF for 2000 ms (2000 ms backoff)
615run
616 should connect
617
618# Third connection attempt succeeds after 500 ms.
619connecting
c36cf65e 620 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
621advance 500
622
623### t=6500 ###
c36cf65e 624 in CONNECTING for 500 ms (2000 ms backoff)
3ed497fc 625run
3ed497fc
BP
626connected
627 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 628 created 1000, last activity 1000, last connected 6500
3ed497fc 629 1 successful connections out of 3 attempts, seqno 1
5eda645e
AE
630 connected
631 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
632
633# Connection drops after another 250 ms.
634advance 250
635
636### t=6750 ###
637 in ACTIVE for 250 ms (2000 ms backoff)
3ed497fc
BP
638disconnected
639 in BACKOFF for 0 ms (4000 ms backoff)
640 1 successful connections out of 3 attempts, seqno 2
5eda645e 641 disconnected
eba18f00 642 disconnected at 6750 ms (0 ms ago)
3ed497fc
BP
643run
644
645# Back off for 4000 ms.
646timeout
647 advance 4000 ms
648
649### t=10750 ###
650 in BACKOFF for 4000 ms (4000 ms backoff)
5eda645e 651 last connected 4250 ms ago, connected 250 ms total
3ed497fc
BP
652run
653 should connect
654])
3ed497fc
BP
655
656######################################################################
d1b680c6
BP
657RECONNECT_CHECK([brief connection with data preserves backoff],
658 [enable
3ed497fc
BP
659
660# First connection attempt fails after 1000 ms.
661run
662connecting
663run
664timeout
665run
666connect-failed
667
668# Back off for 1000 ms.
669timeout
670run
671
672# Second connection attempt fails after 1000 ms.
673connecting
674timeout
675run
676connect-failed
677
678# Back off for 2000 ms.
679timeout
680run
681
682# Third connection attempt succeeds after 500 ms.
683connecting
684advance 500
685run
686connected
687
688# Connection receives 3 chunks of data spaced 250 ms apart.
689advance 250
690run
a6f639f8 691activity
3ed497fc
BP
692advance 250
693run
a6f639f8 694activity
3ed497fc
BP
695advance 250
696run
a6f639f8 697activity
3ed497fc
BP
698
699# Connection drops.
700disconnected
701run
702
703# Back off for 4000 ms.
704timeout
705run
d1b680c6 706],
3ed497fc
BP
707 [### t=1000 ###
708enable
709 in BACKOFF for 0 ms (0 ms backoff)
710
711# First connection attempt fails after 1000 ms.
712run
713 should connect
714connecting
c36cf65e 715 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 716run
3ed497fc
BP
717timeout
718 advance 1000 ms
719
720### t=2000 ###
c36cf65e 721 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
722run
723 should disconnect
724connect-failed
725 in BACKOFF for 0 ms (1000 ms backoff)
726 0 successful connections out of 1 attempts, seqno 0
727
728# Back off for 1000 ms.
729timeout
730 advance 1000 ms
731
732### t=3000 ###
733 in BACKOFF for 1000 ms (1000 ms backoff)
734run
735 should connect
736
737# Second connection attempt fails after 1000 ms.
738connecting
c36cf65e 739 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
740timeout
741 advance 1000 ms
742
743### t=4000 ###
c36cf65e 744 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
745run
746 should disconnect
747connect-failed
748 in BACKOFF for 0 ms (2000 ms backoff)
749 0 successful connections out of 2 attempts, seqno 0
750
751# Back off for 2000 ms.
752timeout
753 advance 2000 ms
754
755### t=6000 ###
756 in BACKOFF for 2000 ms (2000 ms backoff)
757run
758 should connect
759
760# Third connection attempt succeeds after 500 ms.
761connecting
c36cf65e 762 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
763advance 500
764
765### t=6500 ###
c36cf65e 766 in CONNECTING for 500 ms (2000 ms backoff)
3ed497fc 767run
3ed497fc
BP
768connected
769 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 770 created 1000, last activity 1000, last connected 6500
3ed497fc 771 1 successful connections out of 3 attempts, seqno 1
5eda645e
AE
772 connected
773 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
774
775# Connection receives 3 chunks of data spaced 250 ms apart.
776advance 250
777
778### t=6750 ###
779 in ACTIVE for 250 ms (2000 ms backoff)
3ed497fc 780run
a6f639f8
BP
781activity
782 created 1000, last activity 6750, last connected 6500
3ed497fc
BP
783advance 250
784
785### t=7000 ###
786 in ACTIVE for 500 ms (2000 ms backoff)
3ed497fc 787run
a6f639f8
BP
788activity
789 created 1000, last activity 7000, last connected 6500
3ed497fc
BP
790advance 250
791
792### t=7250 ###
793 in ACTIVE for 750 ms (2000 ms backoff)
3ed497fc 794run
a6f639f8
BP
795activity
796 created 1000, last activity 7250, last connected 6500
3ed497fc
BP
797
798# Connection drops.
799disconnected
800 in BACKOFF for 0 ms (4000 ms backoff)
801 1 successful connections out of 3 attempts, seqno 2
5eda645e 802 disconnected
eba18f00 803 disconnected at 7250 ms (0 ms ago)
3ed497fc
BP
804run
805
806# Back off for 4000 ms.
807timeout
808 advance 4000 ms
809
810### t=11250 ###
811 in BACKOFF for 4000 ms (4000 ms backoff)
5eda645e 812 last connected 4750 ms ago, connected 750 ms total
3ed497fc
BP
813run
814 should connect
815])
3ed497fc
BP
816
817######################################################################
d1b680c6
BP
818RECONNECT_CHECK([long connection resets backoff],
819 [enable
3ed497fc
BP
820
821# First connection attempt fails after 1000 ms.
822run
823connecting
824run
825timeout
826run
827connect-failed
828
829# Back off for 1000 ms.
830timeout
831run
832
833# Second connection attempt fails after 1000 ms.
834connecting
835timeout
836run
837connect-failed
838
839# Back off for 2000 ms.
840timeout
841run
842
843# Third connection attempt succeeds after 500 ms.
844connecting
845advance 500
846run
847connected
848
849# Connection receives 3 chunks of data spaced 2000 ms apart.
850advance 2000
851run
a6f639f8 852activity
3ed497fc
BP
853advance 2000
854run
a6f639f8 855activity
3ed497fc
BP
856advance 2000
857run
a6f639f8 858activity
3ed497fc
BP
859
860# Connection drops.
861disconnected
862run
863
864# Back off for 1000 ms.
865timeout
866run
d1b680c6 867],
3ed497fc
BP
868 [### t=1000 ###
869enable
870 in BACKOFF for 0 ms (0 ms backoff)
871
872# First connection attempt fails after 1000 ms.
873run
874 should connect
875connecting
c36cf65e 876 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 877run
3ed497fc
BP
878timeout
879 advance 1000 ms
880
881### t=2000 ###
c36cf65e 882 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
883run
884 should disconnect
885connect-failed
886 in BACKOFF for 0 ms (1000 ms backoff)
887 0 successful connections out of 1 attempts, seqno 0
888
889# Back off for 1000 ms.
890timeout
891 advance 1000 ms
892
893### t=3000 ###
894 in BACKOFF for 1000 ms (1000 ms backoff)
895run
896 should connect
897
898# Second connection attempt fails after 1000 ms.
899connecting
c36cf65e 900 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
901timeout
902 advance 1000 ms
903
904### t=4000 ###
c36cf65e 905 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
906run
907 should disconnect
908connect-failed
909 in BACKOFF for 0 ms (2000 ms backoff)
910 0 successful connections out of 2 attempts, seqno 0
911
912# Back off for 2000 ms.
913timeout
914 advance 2000 ms
915
916### t=6000 ###
917 in BACKOFF for 2000 ms (2000 ms backoff)
918run
919 should connect
920
921# Third connection attempt succeeds after 500 ms.
922connecting
c36cf65e 923 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
924advance 500
925
926### t=6500 ###
c36cf65e 927 in CONNECTING for 500 ms (2000 ms backoff)
3ed497fc 928run
3ed497fc
BP
929connected
930 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 931 created 1000, last activity 1000, last connected 6500
3ed497fc 932 1 successful connections out of 3 attempts, seqno 1
5eda645e
AE
933 connected
934 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
935
936# Connection receives 3 chunks of data spaced 2000 ms apart.
937advance 2000
938
939### t=8500 ###
940 in ACTIVE for 2000 ms (2000 ms backoff)
3ed497fc 941run
a6f639f8
BP
942activity
943 created 1000, last activity 8500, last connected 6500
3ed497fc
BP
944advance 2000
945
946### t=10500 ###
947 in ACTIVE for 4000 ms (2000 ms backoff)
3ed497fc 948run
a6f639f8
BP
949activity
950 created 1000, last activity 10500, last connected 6500
3ed497fc
BP
951advance 2000
952
953### t=12500 ###
954 in ACTIVE for 6000 ms (2000 ms backoff)
3ed497fc 955run
a6f639f8
BP
956activity
957 created 1000, last activity 12500, last connected 6500
3ed497fc
BP
958
959# Connection drops.
960disconnected
961 in BACKOFF for 0 ms (1000 ms backoff)
962 1 successful connections out of 3 attempts, seqno 2
5eda645e 963 disconnected
eba18f00 964 disconnected at 12500 ms (0 ms ago)
3ed497fc
BP
965run
966
967# Back off for 1000 ms.
968timeout
969 advance 1000 ms
970
971### t=13500 ###
972 in BACKOFF for 1000 ms (1000 ms backoff)
5eda645e 973 last connected 7000 ms ago, connected 6000 ms total
3ed497fc
BP
974run
975 should connect
976])
3ed497fc
BP
977
978######################################################################
d1b680c6
BP
979RECONNECT_CHECK([connection attempt fails quickly],
980 [enable
3ed497fc
BP
981
982# Connection fails quickly.
983run
984connect-failed ECONNREFUSED
985
986# Back off for 1000 ms.
987run
988timeout
989
990# Connection fails quickly again.
991run
992connect-failed ECONNREFUSED
993
994# Back off for 2000 ms.
995run
996timeout
d1b680c6
BP
997],
998 [### t=1000 ###
3ed497fc
BP
999enable
1000 in BACKOFF for 0 ms (0 ms backoff)
1001
1002# Connection fails quickly.
1003run
1004 should connect
1005connect-failed ECONNREFUSED
1006 in BACKOFF for 0 ms (1000 ms backoff)
1007 0 successful connections out of 1 attempts, seqno 0
1008
1009# Back off for 1000 ms.
1010run
1011timeout
1012 advance 1000 ms
1013
1014### t=2000 ###
1015 in BACKOFF for 1000 ms (1000 ms backoff)
1016
1017# Connection fails quickly again.
1018run
1019 should connect
1020connect-failed ECONNREFUSED
1021 in BACKOFF for 0 ms (2000 ms backoff)
1022 0 successful connections out of 2 attempts, seqno 0
1023
1024# Back off for 2000 ms.
1025run
1026timeout
1027 advance 2000 ms
1028
1029### t=4000 ###
1030 in BACKOFF for 2000 ms (2000 ms backoff)
1031])
3ed497fc 1032
a85c0bbc 1033######################################################################
d1b680c6
BP
1034RECONNECT_CHECK([max-tries of 1 honored],
1035 [set-max-tries 1
a85c0bbc
BP
1036enable
1037
1038# Connection succeeds.
1039run
1040connected
1041
1042# Send inactivity probe.
1043timeout
1044run
1045
1046# Idle timeout kills connection.
1047timeout
1048run
1049disconnected
d1b680c6 1050],
a85c0bbc
BP
1051 [### t=1000 ###
1052set-max-tries 1
1053 1 tries left
1054enable
1055 in BACKOFF for 0 ms (0 ms backoff)
1056 0 tries left
1057
1058# Connection succeeds.
1059run
1060 should connect
1061connected
1062 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 1063 created 1000, last activity 1000, last connected 1000
a85c0bbc 1064 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
1065 connected
1066 last connected 0 ms ago, connected 0 ms total
a85c0bbc
BP
1067
1068# Send inactivity probe.
1069timeout
1070 advance 5000 ms
1071
1072### t=6000 ###
1073 in ACTIVE for 5000 ms (0 ms backoff)
a85c0bbc
BP
1074run
1075 should send probe
1076 in IDLE for 0 ms (0 ms backoff)
1077
1078# Idle timeout kills connection.
1079timeout
1080 advance 5000 ms
1081
1082### t=11000 ###
1083 in IDLE for 5000 ms (0 ms backoff)
a85c0bbc
BP
1084run
1085 should disconnect
1086disconnected
1087 in VOID for 0 ms (1000 ms backoff)
1088 1 successful connections out of 1 attempts, seqno 2
5eda645e 1089 disconnected
eba18f00 1090 disconnected at 11000 ms (0 ms ago)
a85c0bbc 1091])
a85c0bbc
BP
1092
1093######################################################################
d1b680c6
BP
1094RECONNECT_CHECK([max-tries of 0 honored],
1095 [set-max-tries 0
a85c0bbc
BP
1096enable
1097run
1098timeout
d1b680c6 1099],
a85c0bbc
BP
1100 [### t=1000 ###
1101set-max-tries 0
1102 0 tries left
1103enable
1104run
1105timeout
1106 no timeout
1107])
19df7f51
BP
1108
1109######################################################################
d1b680c6
BP
1110RECONNECT_CHECK([passive mode],
1111 [passive
19df7f51
BP
1112enable
1113
1114# Start listening.
1115timeout
1116run
1117listening
1118
1119# Listening never times out.
1120timeout
1121run
1122
1123# Listening failed (accept() returned funny error?). Back off and try again.
1124listen-error 0
1125timeout
1126run
1127listening
1128
1129# Connection accepted.
1130connected
a6f639f8 1131activity
19df7f51 1132advance 1000
a6f639f8 1133activity
19df7f51
BP
1134
1135# Connection times out.
1136timeout
1137run
1138timeout
1139run
1140disconnected
1141
1142# Start listening again.
1143timeout
1144run
1145listening
d1b680c6 1146],
19df7f51
BP
1147 [### t=1000 ###
1148passive
1149enable
1150 in BACKOFF for 0 ms (0 ms backoff)
1151
1152# Start listening.
1153timeout
1154 advance 0 ms
1155run
1156 should connect
1157listening
1158 in LISTENING for 0 ms (0 ms backoff)
1159
1160# Listening never times out.
1161timeout
1162 no timeout
1163run
1164
1165# Listening failed (accept() returned funny error?). Back off and try again.
1166listen-error 0
1167 in BACKOFF for 0 ms (1000 ms backoff)
1168timeout
1169 advance 1000 ms
1170
1171### t=2000 ###
1172 in BACKOFF for 1000 ms (1000 ms backoff)
1173run
1174 should connect
1175listening
1176 in LISTENING for 0 ms (1000 ms backoff)
1177
1178# Connection accepted.
1179connected
1180 in ACTIVE for 0 ms (1000 ms backoff)
a6f639f8 1181 created 1000, last activity 1000, last connected 2000
19df7f51 1182 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
1183 connected
1184 last connected 0 ms ago, connected 0 ms total
a6f639f8
BP
1185activity
1186 created 1000, last activity 2000, last connected 2000
19df7f51
BP
1187advance 1000
1188
1189### t=3000 ###
1190 in ACTIVE for 1000 ms (1000 ms backoff)
a6f639f8
BP
1191activity
1192 created 1000, last activity 3000, last connected 2000
19df7f51
BP
1193
1194# Connection times out.
1195timeout
1196 advance 5000 ms
1197
1198### t=8000 ###
1199 in ACTIVE for 6000 ms (1000 ms backoff)
19df7f51
BP
1200run
1201 should send probe
1202 in IDLE for 0 ms (1000 ms backoff)
1203timeout
1204 advance 5000 ms
1205
1206### t=13000 ###
1207 in IDLE for 5000 ms (1000 ms backoff)
19df7f51
BP
1208run
1209 should disconnect
1210disconnected
1211 in BACKOFF for 0 ms (0 ms backoff)
1212 1 successful connections out of 1 attempts, seqno 2
5eda645e 1213 disconnected
eba18f00 1214 disconnected at 13000 ms (0 ms ago)
19df7f51
BP
1215
1216# Start listening again.
1217timeout
1218 advance 0 ms
1219run
1220 should connect
1221listening
1222 in LISTENING for 0 ms (0 ms backoff)
1223])