From cd3be2975054dc0b8d6af38c8bb786c49cc039f6 Mon Sep 17 00:00:00 2001 From: Noa Or Date: Sun, 26 Jul 2020 17:17:20 +0300 Subject: [PATCH 1/2] [Mellanox] Add Mellanox support in configure_tacacs Signed-off-by: Noa Or --- tests/common/plugins/tacacs.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/common/plugins/tacacs.py b/tests/common/plugins/tacacs.py index 6f86912ec6b..24ce962144e 100644 --- a/tests/common/plugins/tacacs.py +++ b/tests/common/plugins/tacacs.py @@ -17,6 +17,11 @@ def configure_tacacs(ptfhost, duthost, creds, tacacs_server_ip): duthost.shell("sudo config tacacs add %s" % tacacs_server_ip) duthost.shell("sudo config tacacs authtype login") + if duthost.facts['asic_type'] == 'mellanox': + duthost.shell("sudo config tacacs add %s" % creds['tacacs_servers'][0]) + duthost.shell("sudo config tacacs authtype pap") + duthost.shell("sudo useradd %s --password 123456" % creds['tacacs_ro_user'], module_ignore_errors=True) + # enable tacacs+ duthost.shell("sudo config aaa authentication login tacacs+") @@ -40,10 +45,13 @@ def cleanup_tacacs(ptfhost, duthost, tacacs_server_ip): # reset tacacs client configuration duthost.shell("sudo config tacacs delete %s" % tacacs_server_ip) + if duthost.facts['asic_type'] == 'mellanox': + duthost.shell("sudo config tacacs delete %s" % creds['tacacs_ro_user']) duthost.shell("sudo config tacacs default passkey") duthost.shell("sudo config aaa authentication login default") duthost.shell("sudo config aaa authentication failthrough default") + @pytest.fixture(scope="module") def test_tacacs(ptfhost, duthost, creds): tacacs_server_ip = ptfhost.host.options['inventory_manager'].get_host(ptfhost.hostname).vars['ansible_host'] From d47d6a73c522f531c023e4fb09162f31610f3352 Mon Sep 17 00:00:00 2001 From: Noa Or Date: Sun, 26 Jul 2020 17:40:50 +0300 Subject: [PATCH 2/2] Change tacacs server in cleanup_tacacs --- tests/common/plugins/tacacs.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/common/plugins/tacacs.py b/tests/common/plugins/tacacs.py index 24ce962144e..4ccc5336b4d 100644 --- a/tests/common/plugins/tacacs.py +++ b/tests/common/plugins/tacacs.py @@ -46,12 +46,11 @@ def cleanup_tacacs(ptfhost, duthost, tacacs_server_ip): # reset tacacs client configuration duthost.shell("sudo config tacacs delete %s" % tacacs_server_ip) if duthost.facts['asic_type'] == 'mellanox': - duthost.shell("sudo config tacacs delete %s" % creds['tacacs_ro_user']) + duthost.shell("sudo config tacacs delete %s" % creds['tacacs_servers'][0]) duthost.shell("sudo config tacacs default passkey") duthost.shell("sudo config aaa authentication login default") duthost.shell("sudo config aaa authentication failthrough default") - @pytest.fixture(scope="module") def test_tacacs(ptfhost, duthost, creds): tacacs_server_ip = ptfhost.host.options['inventory_manager'].get_host(ptfhost.hostname).vars['ansible_host']