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

Integrate NAPALM to support pulling live data from devices #1348

Closed
jeremystretch opened this issue Jul 14, 2017 · 8 comments
Closed

Integrate NAPALM to support pulling live data from devices #1348

jeremystretch opened this issue Jul 14, 2017 · 8 comments
Milestone

Comments

@jeremystretch
Copy link
Member

jeremystretch commented Jul 14, 2017

Issue type: Feature request

Python version: 2.7.6
NetBox version: 2.0.10

Today, NetBox has very limited support for interacting with network devices. It has some custom RPC code for connecting to some Juniper, Cisco, and Opengear devices to pull inventory and LLDP information, but this functionality is very limited and error-prone. We can integrate the NAPALM automation project to abstract the RPC logic and support much more functionality with a wide array of devices.

At a high level, here are some changes that will be needed:

  • Add a napalm_driver field to dcim.Platform (new database migration)
  • Create a custom form widget for the napalm_driver field to list all built-in drivers but also allow free text to specify a custom driver
    • The field's help_text should indicate that NAPALM must be installed
  • Add a custom permission napalm_read to dcim.Device
  • Add a napalm detail route to dcim.api.DeviceViewSet. This will accept the NAPALM operation as part of the URL
    • E.g. GET /api/dcim/devices/<pk>/napalm/get_facts/
    • Unsupported operations will return an error indicating such
  • Create a "NAPALM" tab on the device view (this replaces the LLDP tab)
    • This view will include a list of all available NAPALM operations. Selecting an operation will populate the page with data from the API
@bdlamprecht
Copy link
Contributor

bdlamprecht commented Jul 14, 2017

Just to comment on this, I agree that this integration would be nice, however it appears to contradict with what NetBox was originally intended to be. To quote from the documentation, "As such, automated import of live network state is strongly discouraged." Perhaps that goal has changed as NetBox has matured.

While I would be interested in the functionality, great care would be needed to ensure that the information gathered from NAPALM is "vetted by a human to ensure its integrity" with a few validation steps that the user would need to walk through.

This is just me thinking out loud, not necessarily "gospel".

@jeremystretch
Copy link
Member Author

@bdlamprecht The intent here is provide a convenient way of retrieving data from live devices for display and (to some extent) validation. For example, NetBox currently supports pulling live LLDP neighbors from a device to compare with what's defined in its database and highlight any discrepancies (this functionality will be replaced by NAPALM). The key is that none of this data is being written to NetBox's database: it is only being retrieved and inspected.

The one exception to this will be inventory data, which makes sense to import directly from devices. Unfortunately, NAPALM doesn't currently support collecting inventory data so this functionality may still be a ways off.

@jeremystretch
Copy link
Member Author

I have this working in the develop-2.1 branch. It will be included in the v2.1 release.

@jeremystretch jeremystretch added this to the v2.1 milestone Jul 17, 2017
@rkutsel
Copy link

rkutsel commented Jul 17, 2017 via email

@alesz
Copy link

alesz commented Jul 20, 2017

Great feature, will definitely come handy. Would it be possible to run queries via dedicated bastion CM host at some point?

@MrQuiX
Copy link

MrQuiX commented Feb 9, 2018

It would be great to use NAPALM to compare the output of get_interfaces_ip against the existing table, just like LLDP. Even better would be an option to import interfaces without any data, or manually affirm an overwrite.

@mk311d
Copy link

mk311d commented Feb 12, 2018

+1 for a bit of automation
Could imagine to import the interfaces after the device has been added to the inventory or during the process of adding it.
An additional thing I can imagine but maybe it's not aligned with the concept of netbox, to automatically monitor the assigned IP's to hosts. To make it easier, let's say for only those IP's where the device has an interface in the subnet (physical interface or SVI). Monitoring ARP or pinging the device.

Automatically populating the interfaces would be a big big help anyway.

@davelaramee-ssense
Copy link

davelaramee-ssense commented May 2, 2018

Hello,

First awesome tool, I love netbox!

! EDIT
! My issue is the name of the interfaces does not match in netbox vs lldp response
! I need to rename my interfaces in netbox
!

I have just integrated napalm (running locally on ubuntu 16.04, version 2.3.3, via: pip3 install napalm)

But,
Running Cisco ios-xe
System image file is "bootflash:isr4400-universalk9.03.16.04b.S.155-3.S4b-ext.SPA.bin"

With lldp running, I am not able to get neighbor information under the neighbors tab.
Although the other tabs do show proper information (status and config)

The router does display lldp information as following;
S418-RTR-BS01#show lldp neighbors
Capability codes:
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other

Device ID Local Intf Hold-time Capability Port ID
S418-DSW-BS01.corp.sGi0/0/0 120 B Gi1/0/23
S418-DSW-BS01.corp.sGi0/0/1 120 B Gi1/0/22

Total entries displayed: 2

I guess I am missing something, Not too sure where to check for any troubleshooting.

Thank you for you help

@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants