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

Request tiny clarification in pydoc on BaseConnection#special_login_handler #3511

Open
chrisinmtown opened this issue Oct 17, 2024 · 2 comments

Comments

@chrisinmtown
Copy link

Description of Issue/Question

I am writing to request clarification of the stub special_login_handler function, which currently has just this:

    def special_login_handler(self, delay_factor: float = 1.0) -> None:
        """Handler for devices like WLC, Extreme ERS that throw up characters prior to login."""
        pass

Netmiko version

Latest - tip of branch develop

Request

As far as I can understand, SSH authentication has already happened before the special_login_handler function defined in https://github.com/ktbyers/netmiko/blob/develop/netmiko/base_connection.py is called. I speculate that the function's purpose is to consume extra text after authentication is complete and before the first prompt is shown, to help Netmiko to discover the command-line prompt reliably. If that's correct, then I think the pydoc maybe should be something like this:

    """
    Handler for devices like WLC, Extreme ERS that throw up characters
    after authentication is complete and before displaying a prompt.
    """

With all that said, I see in https://github.com/ktbyers/netmiko/blob/develop/netmiko/dell/dell_powerconnect.py#L87 that a SSHClient_noauth client is installed, and the special_login_handler function seems to be responsible for authentication. If that's right, I'll propose a much better Pydoc.

Please comment, thanks for your time.

p.s. this is my way of asking, do I really need a custom SSHClient for Paramiko to cope with an unusual SSH authentication procedure.

@ktbyers
Copy link
Owner

ktbyers commented Oct 17, 2024

A common case where special_login_handler is needed is when a device uses a non-standard SSH login (i.e. where you need to bypass normal SSH authentication mechanisms and have Netmiko handle it directly). Examples of this being the cisco_s200, and calix_b6 drivers.

Consequently, I think this description would be misleading/confusing:

    Handler for devices like WLC, Extreme ERS that throw up characters
    after authentication is complete and before displaying a prompt.

As authentication might not have taken place (i.e. netmiko is handling the authentication process). Note, there is ambiguity in the meaning of authentication as you have Paramiko "authentication" and you have the actual "authentication" (i.e. logging into the device with username and password). I think the latter of these two is the more common-sense meaning.

I open to other naming/docstrings, but we shouldn't refer to authentication is complete (as it very likely won't be).

@chrisinmtown
Copy link
Author

Thank you for the quick reply and explanation! I think you have reinforced my opinion that the pydoc on that function needs a few more words :) I'm not sure I got the sense of "authentication" quite right, but how about possibly:

Handler for devices like WLC, Extreme ERS that require Netmiko to handle the authentication process
because the normal Paramiko secure shell authentication process does not work.

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

No branches or pull requests

2 participants