Skip to content

Commit dbc8f50

Browse files
sdszhangmssonicbld
authored andcommitted
[TACACS] Improve robustness for IPv6 TACACS cases to workaround tacacs_plus server crash issue (sonic-net#13026)
Description of PR Summary: Fixes TACACS failures in test_mgmt_ipv6_only module. Approach What is the motivation for this PR? It's observed that tacacs_plus process may crash when receiving ipv6 tacacs requests. Need a way to workaround it. How did you do it? Similar issue in tacacs/test_ro_user has been fixed in sonic-net#12819 Using the similar method to restart tacacs_plus process if it fails. How did you verify/test it? Verified in both virtual testbed and physical testbed. Not seeing tacacs failures anymore. co-authorized by: [email protected]
1 parent a49e178 commit dbc8f50

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/ip/test_mgmt_ipv6_only.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from tests.tacacs.utils import check_output
99
from tests.bgp.test_bgp_fact import run_bgp_facts
1010
from tests.test_features import run_show_features
11-
from tests.tacacs.test_ro_user import ssh_remote_run
11+
from tests.tacacs.test_ro_user import ssh_remote_run_retry
1212
from tests.ntp.test_ntp import run_ntp, setup_ntp_func # noqa F401
1313
from tests.common.helpers.assertions import pytest_require
1414
from tests.tacacs.conftest import tacacs_creds, check_tacacs_v6_func # noqa F401
@@ -128,29 +128,29 @@ def test_snmp_ipv6_only(duthosts, enum_rand_one_per_hwsku_hostname, localhost, c
128128

129129
# use function scope fixture so that convert_and_restore_config_db_to_ipv6_only will setup before check_tacacs_v6_func.
130130
# Otherwise, tacacs_v6 config may be lost after config reload in ipv6_only fixture.
131-
def test_ro_user_ipv6_only(localhost, duthosts, enum_rand_one_per_hwsku_hostname,
131+
def test_ro_user_ipv6_only(localhost, ptfhost, duthosts, enum_rand_one_per_hwsku_hostname,
132132
tacacs_creds, convert_and_restore_config_db_to_ipv6_only, check_tacacs_v6_func): # noqa F811
133133
# Add a temporary debug log to see if DUTs are reachable via IPv6 mgmt-ip. Will remove later
134134
log_eth0_interface_info(duthosts)
135135
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
136136
dutipv6 = get_mgmt_ipv6(duthost)
137137

138-
res = ssh_remote_run(localhost, dutipv6, tacacs_creds['tacacs_ro_user'],
139-
tacacs_creds['tacacs_ro_user_passwd'], 'cat /etc/passwd')
138+
res = ssh_remote_run_retry(localhost, dutipv6, ptfhost, tacacs_creds['tacacs_ro_user'],
139+
tacacs_creds['tacacs_ro_user_passwd'], 'cat /etc/passwd')
140140
check_output(res, 'test', 'remote_user')
141141

142142

143143
# use function scope fixture so that convert_and_restore_config_db_to_ipv6_only will setup before check_tacacs_v6_func.
144144
# Otherwise, tacacs_v6 config may be lost after config reload in ipv6_only fixture.
145-
def test_rw_user_ipv6_only(localhost, duthosts, enum_rand_one_per_hwsku_hostname,
145+
def test_rw_user_ipv6_only(localhost, ptfhost, duthosts, enum_rand_one_per_hwsku_hostname,
146146
tacacs_creds, convert_and_restore_config_db_to_ipv6_only, check_tacacs_v6_func): # noqa F811
147147
# Add a temporary debug log to see if DUTs are reachable via IPv6 mgmt-ip. Will remove later
148148
log_eth0_interface_info(duthosts)
149149
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
150150
dutipv6 = get_mgmt_ipv6(duthost)
151151

152-
res = ssh_remote_run(localhost, dutipv6, tacacs_creds['tacacs_rw_user'],
153-
tacacs_creds['tacacs_rw_user_passwd'], "cat /etc/passwd")
152+
res = ssh_remote_run_retry(localhost, dutipv6, ptfhost, tacacs_creds['tacacs_rw_user'],
153+
tacacs_creds['tacacs_rw_user_passwd'], "cat /etc/passwd")
154154
check_output(res, 'testadmin', 'remote_user_su')
155155

156156

0 commit comments

Comments
 (0)