netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Public demo: https://demo.netbox.dev
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.44k stars 2.52k forks source link

Integrate NAPALM to support pulling live data from devices #1348

Closed jeremystretch closed 7 years ago

jeremystretch commented 7 years ago

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:

bdlamprecht commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

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

rkutsel commented 7 years ago

I agree this is a huge deal. I've been waiting for this announcement for a while and can't wait to test it once the stable is out.

On Mon, Jul 17, 2017 at 10:35 bdlamprecht notifications@github.com wrote:

Wow, very cool that you got this working already! Nice work.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/digitalocean/netbox/issues/1348#issuecomment-315825246, or mute the thread https://github.com/notifications/unsubscribe-auth/ARj55TReWAg72RQn_ntm-4biOMQWt2iSks5sO5tGgaJpZM4OYaD6 .

-- Roman N. Kutsel

alesz commented 7 years ago

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

MrQuiX commented 6 years ago

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 commented 6 years ago

+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 commented 6 years ago

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