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

Add netmiko_ssh_autodetect task #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matman26
Copy link

Made this little task that uses SSHDetect to guess the network OS for a bunch of devices in my network. Task works on a regular nornir inventory, returning a Result with the guessed device_type for each host in the result field (there is also a flag that allows hosts to be updated at runtime). Since this uses netmiko directly I guess it makes sense to submit it as part of this plugin.

Thanks!

@ktbyers
Copy link
Owner

ktbyers commented Mar 2, 2022

@matman26 I will try to look at this in the next week to 10 days.

Thanks for the contribution.

@ktbyers
Copy link
Owner

ktbyers commented Apr 13, 2022

@matman26 I started reviewing this. I apologize for the delay.

I somewhat think we should not include this in the nornir_netmiko repository. I say this as Nornir has standard way for creating connections which for nornir_netmiko is here:

https://github.com/ktbyers/nornir_netmiko/blob/develop/nornir_netmiko/connections/netmiko.py

And this is technically creating a connection.

Also things like all of the additional Netmiko arguments are not supported. These are things that in Nornir are typical put into Connection Options > Netmiko > Extras.

I think that this might be a case where it is just better to have an example of doing it, instead of actually creating an ongoing nornir_netmiko task for it.

Let me know your thoughts on it.

@ncharaf
Copy link

ncharaf commented Oct 22, 2022

Hello,

@ktbyers @matman26 , i think we can add a new plateform autodetect or ssh_autodetect to the existing dict in order to be able to handle ssh autodetect.

We can handle it something like this example inside the open function

As you suggested @ktbyers if we change it in netmiko connection it would work but i think that @matman26 suggestion is also a good idea .If we want to add some logic ( for example send different command based on which vendor we are using , etc..) it won't work because you don't know which plateform you are really using.

Thanks !

@ktbyers
Copy link
Owner

ktbyers commented Oct 22, 2022

@ncharaf What problem are you trying to solve?

It is not clear to me what is the issue that we are trying to fix?

@ncharaf
Copy link

ncharaf commented Oct 22, 2022

Hello,

@ktbyers
The issue i that you need to specify a device plateform otherwise it won't work.

The idea is to implement a new plateform (ssh_autodetect or something else) on netmiko connecter in order to detect the device_type and set it dynamically so we will be able to execute the command on device.

We can also add a task that can detect the device_type and change it in the host platform in order to change the device plateform and have a faster execution because you don't need have to use the autodetect since we know already the plateform.

Is it clear ?

Thanks !

@ktbyers
Copy link
Owner

ktbyers commented Oct 25, 2022

@ncharaf Yeah, I guess we could (possibly) do something like platform="netmiko_auto" and cause that to execute the SSH autodetect mechanism.

@ncharaf
Copy link

ncharaf commented Oct 25, 2022

@ktbyers Yes sure but if we want to change the device plateform itself we should also implement what @matman26 suggest.

@ncharaf
Copy link

ncharaf commented Oct 25, 2022

@ktbyers I added a new PR #44

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.

3 participants