diff --git a/scripts/hostcfgd b/scripts/hostcfgd index 70ffc07c..36f09640 100644 --- a/scripts/hostcfgd +++ b/scripts/hostcfgd @@ -1141,8 +1141,8 @@ class KdumpCfg(object): "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", "num_dumps": "3", "remote": "false", # New feature: remote, default is "false" - "ssh_string": "user@localhost", # New feature: SSH key, default value - "ssh_path": "/a/b/c" # New feature: SSH path, default value + "ssh_string": "admin@127.0.0.1", # New feature: SSH key, default value + "ssh_path": "/home/admin/.ssh" # New feature: SSH path, default value } def load(self, kdump_table): diff --git a/tests/hostcfgd/hostcfgd_test.py b/tests/hostcfgd/hostcfgd_test.py index 880aee22..07756c76 100644 --- a/tests/hostcfgd/hostcfgd_test.py +++ b/tests/hostcfgd/hostcfgd_test.py @@ -215,8 +215,8 @@ def test_kdump_event(self): call(['sonic-kdump-config', '--num_dumps', '3']), call(['sonic-kdump-config', '--memory', '0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M']), call(['sonic-kdump-config', '--remote', 'false']), # Covering remote - call(['sonic-kdump-config', '--ssh_string', 'user@localhost']), # Covering ssh_string - call(['sonic-kdump-config', '--ssh_path', '/a/b/c']) # Covering ssh_path + call(['sonic-kdump-config', '--ssh_string', 'admin@127.0.0.1']), # Covering ssh_string + call(['sonic-kdump-config', '--ssh_path', '/home/admin/.ssh']) # Covering ssh_path ] mocked_subprocess.check_call.assert_has_calls(expected, any_order=True) @@ -225,6 +225,7 @@ def test_kdump_load(self): MockConfigDb.CONFIG_DB['KDUMP'] = { 'config': { "enabled": "true", + "remote" : "true" } } daemon = hostcfgd.HostConfigDaemon() @@ -235,9 +236,9 @@ def test_kdump_load(self): call(['sonic-kdump-config', '--enable']), call(['sonic-kdump-config', '--num_dumps', '3']), call(['sonic-kdump-config', '--memory', '0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M']), - call(['sonic-kdump-config', '--remote', 'false']), # Covering remote - call(['sonic-kdump-config', '--ssh_string', 'user@localhost']), # Covering ssh_string - call(['sonic-kdump-config', '--ssh_path', '/a/b/c']) # Covering ssh_path + call(['sonic-kdump-config', '--remote', 'true']), # Covering remote + call(['sonic-kdump-config', '--ssh_string', 'admin@127.0.0.1']), # Covering ssh_string + call(['sonic-kdump-config', '--ssh_path', '/home/admin/.ssh']) # Covering ssh_path ] mocked_subprocess.check_call.assert_has_calls(expected, any_order=True) diff --git a/tests/hostcfgd/test_ldap_vectors.py b/tests/hostcfgd/test_ldap_vectors.py index 1026dcbb..187e4a07 100644 --- a/tests/hostcfgd/test_ldap_vectors.py +++ b/tests/hostcfgd/test_ldap_vectors.py @@ -28,7 +28,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "AAA": { @@ -39,7 +42,7 @@ "fail-delay": 0, "lockout-reattempt": 15, "lockout-attempts": 5 - }, + }, "failthrough": "True", "debug": "True", } @@ -94,7 +97,7 @@ "fail-delay": 0, "lockout-reattempt": 15, "lockout-attempts": 5 - }, + }, "debug": "True", } }, diff --git a/tests/hostcfgd/test_passwh_vectors.py b/tests/hostcfgd/test_passwh_vectors.py index 5f26ee3a..d6df354a 100644 --- a/tests/hostcfgd/test_passwh_vectors.py +++ b/tests/hostcfgd/test_passwh_vectors.py @@ -40,7 +40,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } } }, @@ -79,7 +82,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } } }, @@ -118,7 +124,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } } }, @@ -157,7 +166,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, }, @@ -196,7 +208,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } } }, @@ -235,7 +250,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } } } diff --git a/tests/hostcfgd/test_radius_vectors.py b/tests/hostcfgd/test_radius_vectors.py index a1311a10..6d6eefce 100644 --- a/tests/hostcfgd/test_radius_vectors.py +++ b/tests/hostcfgd/test_radius_vectors.py @@ -39,7 +39,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "AAA": { @@ -178,7 +181,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "AAA": { diff --git a/tests/hostcfgd/test_ssh_server_vectors.py b/tests/hostcfgd/test_ssh_server_vectors.py index 8a14d1fd..2f791f02 100644 --- a/tests/hostcfgd/test_ssh_server_vectors.py +++ b/tests/hostcfgd/test_ssh_server_vectors.py @@ -35,7 +35,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "SERIAL_CONSOLE": { @@ -75,7 +78,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "SERIAL_CONSOLE": { @@ -115,7 +121,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "SERIAL_CONSOLE": { @@ -155,7 +164,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "SERIAL_CONSOLE": { @@ -195,7 +207,10 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" } }, "SERIAL_CONSOLE": { diff --git a/tests/hostcfgd/test_tacacs_vectors.py b/tests/hostcfgd/test_tacacs_vectors.py index b77fdeed..56e2d3aa 100644 --- a/tests/hostcfgd/test_tacacs_vectors.py +++ b/tests/hostcfgd/test_tacacs_vectors.py @@ -28,18 +28,21 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" + } }, "AAA": { "authentication": { "login": "local" }, "authorization": { - "login": "local" + "login": "local" }, "accounting": { - "login": "local" + "login": "local" } }, "TACPLUS": { @@ -90,18 +93,21 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" + } }, "AAA": { "authentication": { "login": "local" }, "authorization": { - "login": "tacacs+" + "login": "tacacs+" }, "accounting": { - "login": "tacacs+" + "login": "tacacs+" } }, "TACPLUS": { @@ -152,18 +158,21 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" + } }, "AAA": { "authentication": { "login": "local" }, "authorization": { - "login": "tacacs+ local" + "login": "tacacs+ local" }, "accounting": { - "login": "tacacs+ local" + "login": "tacacs+ local" } }, "TACPLUS": { @@ -214,18 +223,21 @@ "config": { "enabled": "false", "num_dumps": "3", - "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" - } + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M", + "remote": "disabled", + "ssh_string": "admin@127.0.0.1", + "ssh_path": "/home/admin/.ssh" + } }, "AAA": { "authentication": { "login": "local" }, "authorization": { - "login": "local" + "login": "local" }, "accounting": { - "login": "disable" + "login": "disable" } }, "TACPLUS": {