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

Implement "optional_args" parameter for NAPALM integration #1374

Closed
bdlamprecht opened this issue Jul 25, 2017 · 3 comments
Closed

Implement "optional_args" parameter for NAPALM integration #1374

bdlamprecht opened this issue Jul 25, 2017 · 3 comments
Labels
type: feature Introduction of new functionality to the application

Comments

@bdlamprecht
Copy link
Contributor

Issue type:

Bug Report

Python version:
2.7.12
NetBox version:
2.1.0

First off, let me state that your work with integrating NAPALM into NetBox is outstanding. From what I've found so far, it works perfectly with Juniper devices. However, in my envrionment, when I try to use this new functionality with my IOS devices, I get the following error:

Error connecting to the device: Failed to enter enable mode

As mentioned in the NetworkToCode Slack channel, I encountered this problem previously and was able to solve it by supplying the optional_args dict which contained the parameter secret=[PASSWORD] to the NAPALM driver for the device (see http://napalm.readthedocs.io/en/latest/base.html for details).

I tried to test a solution myself in the /netbox/netbox/dcim/api/views.py file of v2.1.0, but was unsuccessful (most likely due to not understanding in depth how the integration took place).

My solution is something as simple as this in the views.py file mentioned above (in pseudo-code):

d = driver(
     hostname=ip_address,
     username=settings.NETBOX_USERNAME,
     password=settings.NETBOX_PASSWORD,
     optional_args.secret=settings.NETBOX_PASSWORD,

I'm assuming this is a simple fix due to the great work done by the team developing NAPALM, but if you need help testing a solution, I'd be happy to help.

@jeremystretch
Copy link
Member

NAPALM optional args for reference.

I think it makes sense to introduce a NAPALM_ARGS configuration parameter to hold a dictionary of these arguments, and pass it on every instantiation of a NetworkDriver. Seems that any args not recognized by a driver are ignored, so it should be safe to apply the same arguments to all drivers/platforms.

While we're at it, we should add a NAPALM_TIMEOUT setting (the default is 60 seconds).

@jeremystretch jeremystretch added the type: feature Introduction of new functionality to the application label Jul 26, 2017
@bdlamprecht
Copy link
Contributor Author

That works for me. Oddly enough, I don't see the secret argument in the link you referenced, perhaps the developers of NAPALM need to update their documentation.

@bdlamprecht
Copy link
Contributor Author

bdlamprecht commented Jul 26, 2017

Sorry, I pressed the wrong "comment" button. 😉

lampwins pushed a commit to lampwins/netbox that referenced this issue Oct 13, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

2 participants