Skip to content

Commit c42dc6b

Browse files
lolyunnelluri-cisco
authored andcommitted
[dualtor_io] Collect syslog to debug (sonic-net#17722)
* [test_link_failure] Collect syslog to debug Signed-off-by: Longxiang Lyu <[email protected]>
1 parent 8cdc80d commit c42dc6b

2 files changed

Lines changed: 64 additions & 72 deletions

File tree

tests/dualtor_io/test_link_failure.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,17 @@ def test_active_link_admin_down_config_reload_downstream(
422422
upper_tor_host.shell("config save -y")
423423

424424

425-
@pytest.mark.disable_loganalyzer
426425
@pytest.mark.enable_active_active
427426
@pytest.mark.skip_active_standby
428427
def test_active_link_admin_down_config_reload_link_up_upstream(
429428
upper_tor_host, lower_tor_host, send_server_to_t1_with_action, # noqa F811
430-
cable_type, active_active_ports # noqa F811
429+
cable_type, active_active_ports, setup_loganalyzer # noqa F811
431430
):
432431
"""
433432
Send traffic from server to T1 and unshut the active-active mux ports.
434433
Verify switchover and disruption.
435434
"""
435+
setup_loganalyzer(upper_tor_host, collect_only=True)
436436
if cable_type == CableType.active_active:
437437
try:
438438
config_interface_admin_status(upper_tor_host, active_active_ports, "down")
@@ -475,17 +475,17 @@ def test_active_link_admin_down_config_reload_link_up_upstream(
475475
upper_tor_host.shell("config save -y")
476476

477477

478-
@pytest.mark.disable_loganalyzer
479478
@pytest.mark.enable_active_active
480479
@pytest.mark.skip_active_standby
481480
def test_active_link_admin_down_config_reload_link_up_downstream_standby(
482481
upper_tor_host, lower_tor_host, send_t1_to_server_with_action, # noqa F811
483-
cable_type, active_active_ports # noqa F811
482+
cable_type, active_active_ports, setup_loganalyzer # noqa F811
484483
):
485484
"""
486485
Send traffic from T1 to standby ToR and unshut the active-active mux ports.
487486
Verify switchover and disruption.
488487
"""
488+
setup_loganalyzer(upper_tor_host, collect_only=True)
489489
if cable_type == CableType.active_active:
490490
try:
491491
config_interface_admin_status(upper_tor_host, active_active_ports, "down")

tests/dualtor_io/test_tor_failure.py

Lines changed: 60 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -56,117 +56,109 @@ def toggle_lower_tor_pdu(lower_tor_host, get_pdu_controller): # noqa F811
5656

5757

5858
@pytest.mark.enable_active_active
59-
@pytest.mark.disable_loganalyzer
6059
def test_active_tor_reboot_upstream(
6160
upper_tor_host, lower_tor_host, send_server_to_t1_with_action, # noqa F811
6261
toggle_all_simulator_ports_to_upper_tor, toggle_upper_tor_pdu, # noqa F811
6362
wait_for_device_reachable, wait_for_mux_container, cable_type, # noqa F811
64-
wait_for_pmon_container # noqa F811
63+
wait_for_pmon_container, setup_loganalyzer # noqa F811
6564
):
6665
"""
6766
Send upstream traffic and reboot the active ToR. Confirm switchover
6867
occurred and disruption lasts < 1 second
6968
"""
70-
with LogAnalyzer(ansible_host=lower_tor_host,
71-
marker_prefix="test_active_tor_reboot_upstream"):
72-
send_server_to_t1_with_action(
73-
upper_tor_host, verify=True, delay=MUX_SIM_ALLOWED_DISRUPTION_SEC,
74-
action=toggle_upper_tor_pdu, stop_after=60
75-
)
76-
wait_for_device_reachable(upper_tor_host)
77-
wait_for_mux_container(upper_tor_host)
78-
wait_for_pmon_container(upper_tor_host)
69+
setup_loganalyzer(upper_tor_host, collect_only=True)
70+
send_server_to_t1_with_action(
71+
upper_tor_host, verify=True, delay=MUX_SIM_ALLOWED_DISRUPTION_SEC,
72+
action=toggle_upper_tor_pdu, stop_after=60
73+
)
74+
wait_for_device_reachable(upper_tor_host)
75+
wait_for_mux_container(upper_tor_host)
76+
wait_for_pmon_container(upper_tor_host)
7977

80-
if cable_type == CableType.active_standby:
81-
verify_tor_states(
82-
expected_active_host=lower_tor_host,
83-
expected_standby_host=upper_tor_host
84-
)
85-
elif cable_type == CableType.active_active:
86-
verify_tor_states(
87-
expected_active_host=[upper_tor_host, lower_tor_host],
88-
expected_standby_host=None,
89-
cable_type=cable_type,
90-
verify_db_timeout=60
91-
)
78+
if cable_type == CableType.active_standby:
79+
verify_tor_states(
80+
expected_active_host=lower_tor_host,
81+
expected_standby_host=upper_tor_host
82+
)
83+
elif cable_type == CableType.active_active:
84+
verify_tor_states(
85+
expected_active_host=[upper_tor_host, lower_tor_host],
86+
expected_standby_host=None,
87+
cable_type=cable_type,
88+
verify_db_timeout=60
89+
)
9290

9391

94-
@pytest.mark.disable_loganalyzer
9592
def test_active_tor_reboot_downstream_standby(
9693
upper_tor_host, lower_tor_host, send_t1_to_server_with_action, # noqa F811
9794
toggle_all_simulator_ports_to_upper_tor, toggle_upper_tor_pdu, # noqa F811
9895
wait_for_device_reachable, wait_for_mux_container, # noqa F811
99-
wait_for_pmon_container # noqa F811
96+
wait_for_pmon_container, setup_loganalyzer # noqa F811
10097
):
10198
"""
10299
Send downstream traffic to the standby ToR and reboot the active ToR.
103100
Confirm switchover occurred and disruption lasts < 1 second
104101
"""
105-
with LogAnalyzer(ansible_host=lower_tor_host,
106-
marker_prefix="test_active_tor_reboot_downstream_standby"):
107-
send_t1_to_server_with_action(
108-
lower_tor_host, verify=True, delay=MUX_SIM_ALLOWED_DISRUPTION_SEC,
109-
action=toggle_upper_tor_pdu, stop_after=60
110-
)
111-
wait_for_device_reachable(upper_tor_host)
112-
wait_for_mux_container(upper_tor_host)
113-
wait_for_pmon_container(upper_tor_host)
114-
verify_tor_states(
115-
expected_active_host=lower_tor_host,
116-
expected_standby_host=upper_tor_host
117-
)
102+
setup_loganalyzer(upper_tor_host, collect_only=True)
103+
send_t1_to_server_with_action(
104+
lower_tor_host, verify=True, delay=MUX_SIM_ALLOWED_DISRUPTION_SEC,
105+
action=toggle_upper_tor_pdu, stop_after=60
106+
)
107+
wait_for_device_reachable(upper_tor_host)
108+
wait_for_mux_container(upper_tor_host)
109+
wait_for_pmon_container(upper_tor_host)
110+
verify_tor_states(
111+
expected_active_host=lower_tor_host,
112+
expected_standby_host=upper_tor_host
113+
)
118114

119115

120-
@pytest.mark.disable_loganalyzer
121116
def test_standby_tor_reboot_upstream(
122117
upper_tor_host, lower_tor_host, send_server_to_t1_with_action, # noqa F811
123118
toggle_all_simulator_ports_to_upper_tor, toggle_lower_tor_pdu, # noqa F811
124119
wait_for_device_reachable, wait_for_mux_container, # noqa F811
125-
wait_for_pmon_container # noqa F811
120+
wait_for_pmon_container, setup_loganalyzer # noqa F811
126121
):
127122
"""
128123
Send upstream traffic and reboot the standby ToR. Confirm no switchover
129124
occurred and no disruption
130125
"""
131-
with LogAnalyzer(ansible_host=upper_tor_host,
132-
marker_prefix="test_standby_tor_reboot_upstream"):
133-
send_server_to_t1_with_action(
134-
upper_tor_host, verify=True,
135-
action=toggle_lower_tor_pdu, stop_after=60
136-
)
137-
wait_for_device_reachable(lower_tor_host)
138-
wait_for_mux_container(lower_tor_host)
139-
wait_for_pmon_container(lower_tor_host)
140-
verify_tor_states(
141-
expected_active_host=upper_tor_host,
142-
expected_standby_host=lower_tor_host
143-
)
126+
setup_loganalyzer(lower_tor_host, collect_only=True)
127+
send_server_to_t1_with_action(
128+
upper_tor_host, verify=True,
129+
action=toggle_lower_tor_pdu, stop_after=60
130+
)
131+
wait_for_device_reachable(lower_tor_host)
132+
wait_for_mux_container(lower_tor_host)
133+
wait_for_pmon_container(lower_tor_host)
134+
verify_tor_states(
135+
expected_active_host=upper_tor_host,
136+
expected_standby_host=lower_tor_host
137+
)
144138

145139

146-
@pytest.mark.disable_loganalyzer
147140
def test_standby_tor_reboot_downstream_active(
148141
upper_tor_host, lower_tor_host, send_t1_to_server_with_action, # noqa F811
149142
toggle_all_simulator_ports_to_upper_tor, toggle_lower_tor_pdu, # noqa F811
150143
wait_for_device_reachable, wait_for_mux_container, # noqa F811
151-
wait_for_pmon_container # noqa F811
144+
wait_for_pmon_container, setup_loganalyzer # noqa F811
152145
):
153146
"""
154147
Send downstream traffic to the active ToR and reboot the standby ToR.
155148
Confirm no switchover occurred and no disruption
156149
"""
157-
with LogAnalyzer(ansible_host=upper_tor_host,
158-
marker_prefix="test_standby_tor_reboot_downstream_active"):
159-
send_t1_to_server_with_action(
160-
upper_tor_host, verify=True,
161-
action=toggle_lower_tor_pdu, stop_after=60
162-
)
163-
wait_for_device_reachable(lower_tor_host)
164-
wait_for_mux_container(lower_tor_host)
165-
wait_for_pmon_container(lower_tor_host)
166-
verify_tor_states(
167-
expected_active_host=upper_tor_host,
168-
expected_standby_host=lower_tor_host
169-
)
150+
setup_loganalyzer(lower_tor_host, collect_only=True)
151+
send_t1_to_server_with_action(
152+
upper_tor_host, verify=True,
153+
action=toggle_lower_tor_pdu, stop_after=60
154+
)
155+
wait_for_device_reachable(lower_tor_host)
156+
wait_for_mux_container(lower_tor_host)
157+
wait_for_pmon_container(lower_tor_host)
158+
verify_tor_states(
159+
expected_active_host=upper_tor_host,
160+
expected_standby_host=lower_tor_host
161+
)
170162

171163

172164
@pytest.mark.enable_active_active

0 commit comments

Comments
 (0)