Skip to content
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

kdump-Remote-SSH-Configurations #3400

Open
wants to merge 210 commits into
base: master
Choose a base branch
from

Conversation

Ghulam-Bahoo
Copy link

What I did
Added remote kdump functionality using SSH in SONiC.

How I did it
I added two new commands and two options to configure the kdump remote ssh feature.

How to verify it
Upon kernel crash, kdump will transfer the crash report files to the ssh server.

@muhammadalihussnain muhammadalihussnain force-pushed the kdump_ssh_Enhancement branch 2 times, most recently from 4597f36 to bc212a5 Compare October 1, 2024 07:11
@muhammadalihussnain
Copy link

@venkatmahalingam Hi! we have updated the code. Please Help us review the Code PRs. Thanks

@ridahanif96
Copy link
Contributor

@venkatmahalingam Hi! we have updated the code. Please Help us review the Code PRs. Thanks in advance, target is 202411

if current_status == 'false':
click.echo("Remote feature is not enabled. Please enable the remote feature first.")
return

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No validation for SSH path?

if current_status == 'false':
click.echo("Remote feature is not enabled. Please enable the remote feature first.")
return

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No validation for SSH key?

ssh_prv_key = get_kdump_config("ssh_path")
click.echo("Kdump private key path: {}".format(ssh_prv_key))

if get_kdump_config("remote") == "false":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'else' condition is enough here.

@@ -1,10 +1,9 @@
import importlib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the reason for this removal.

result = runner.invoke(config.config.commands["kdump"].commands["enable"], obj=db)
print(result.exit_code)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the reason for this removal.

with self.assertRaises(SystemExit) as sys_exit:
sonic_kdump_config.read_ssh_string()
self.assertEqual(sys_exit.exception.code, 1)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No test cases no negative scenarios i.e invalid ssh_key/ssh_path?

mock_read_ssh_string.return_value = 'user@ip_address' # Simulate reading existing SSH string

# Call the function to test
sonic_kdump_config.write_ssh_string('user@ip_address')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user@ip_address ? can we test with actual valid values?

"""Tests the function `read_ssh_path(...)` in script `sonic-kdump-config`."""

# Test successful case with valid SSH path
mock_run_cmd.return_value = (0, ['/path/to/keys'], None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/path/to/keys ? can we test with actual valid values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants