Skip to content

KDUMP_REMOTE_BUG_FIX #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/hostcfgd
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]", # New feature: SSH key, default value
"ssh_path": "/home/admin/.ssh" # New feature: SSH path, default value
}

def load(self, kdump_table):
Expand Down
11 changes: 6 additions & 5 deletions tests/hostcfgd/hostcfgd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '[email protected]']), # 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)

Expand All @@ -225,6 +225,7 @@ def test_kdump_load(self):
MockConfigDb.CONFIG_DB['KDUMP'] = {
'config': {
"enabled": "true",
"remote" : "true"
}
}
daemon = hostcfgd.HostConfigDaemon()
Expand All @@ -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', '[email protected]']), # 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)
Expand Down
9 changes: 6 additions & 3 deletions tests/hostcfgd/test_ldap_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"AAA": {
Expand All @@ -39,7 +42,7 @@
"fail-delay": 0,
"lockout-reattempt": 15,
"lockout-attempts": 5
},
},
"failthrough": "True",
"debug": "True",
}
Expand Down Expand Up @@ -94,7 +97,7 @@
"fail-delay": 0,
"lockout-reattempt": 15,
"lockout-attempts": 5
},
},
"debug": "True",
}
},
Expand Down
30 changes: 24 additions & 6 deletions tests/hostcfgd/test_passwh_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
}
},
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
}
},
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
}
},
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
},
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
}
},
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions tests/hostcfgd/test_radius_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"AAA": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"AAA": {
Expand Down
25 changes: 20 additions & 5 deletions tests/hostcfgd/test_ssh_server_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"SERIAL_CONSOLE": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"SERIAL_CONSOLE": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"SERIAL_CONSOLE": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"SERIAL_CONSOLE": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"SERIAL_CONSOLE": {
Expand Down
44 changes: 28 additions & 16 deletions tests/hostcfgd/test_tacacs_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"AAA": {
"authentication": {
"login": "local"
},
"authorization": {
"login": "local"
"login": "local"
},
"accounting": {
"login": "local"
"login": "local"
}
},
"TACPLUS": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"AAA": {
"authentication": {
"login": "local"
},
"authorization": {
"login": "tacacs+"
"login": "tacacs+"
},
"accounting": {
"login": "tacacs+"
"login": "tacacs+"
}
},
"TACPLUS": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"AAA": {
"authentication": {
"login": "local"
},
"authorization": {
"login": "tacacs+ local"
"login": "tacacs+ local"
},
"accounting": {
"login": "tacacs+ local"
"login": "tacacs+ local"
}
},
"TACPLUS": {
Expand Down Expand Up @@ -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": "[email protected]",
"ssh_path": "/home/admin/.ssh"
}
},
"AAA": {
"authentication": {
"login": "local"
},
"authorization": {
"login": "local"
"login": "local"
},
"accounting": {
"login": "disable"
"login": "disable"
}
},
"TACPLUS": {
Expand Down
Loading