NFD21 – NetBox Automation Integrations

Blog Detail

Wrapping up our presentations at Networking Field Day 21 last week, I was fortunate to spend some time discussing NetBox and its role as a robust source of truth within a network automation framework. Most people who use NetBox are familiar with its web interface and to some extent its REST API, but there are a variety of ways NetBox enables the import and export of data to support highly automated workflows. If you haven’t had a chance to check out NetBox yet, you can find the project on GitHub and the documentation here.

CSV Import/Export

NetBox supports CSV-formatted data import for most objects. This is very convenient for migrating data from spreadsheets to NetBox. All that’s needed is to ensure the required columns are present and named appropriately, and that the data is in a valid format. NetBox also provides a means to export data in CSV format for use by other applications.

Export CSV form

Export Templates

While the built-in CSV export function is handy, there is often a need to provide more control over the format of exported data. This can be done using export templates, which leverage the Jinja2 templating language to render arbitrary output. For instance, you might write an export template to generate a Nagios configuration file from a set of NetBox devices. Within the NetBox UI, you can then navigate to the devices list and select your custom template under the “export” button. The generated document will be provided for direct download.

Export template form

Webhooks

Sometimes it’s necessary to automatically update related systems whenever data in NetBox changes. For example, maybe you need to update a network monitoring system every time a new device is added in NetBox. This can be accomplished by creating a webhook under NetBox’s admin UI. Simply select the type(s) of object that you’re interested in, the actions on which to trigger (creation, modification, and/or deletion), and the attributes of the remote system to be notified. When the relevant changes occur, NetBox will automatically generate an HTTP POST request to the remote system with all the details of the change and the object’s new state.

Webhooks form

To see a demonstration of webhooks in action, check out Jason Edelman’s presentation.

REST API

The most robust mechanism for exchanging data with NetBox is its REST API. The API allows for nearly the same degree of functionality as the web UI (with a few caveats) and supports the creation, retrieval, modification, and deletion of objects. All objects are represented in the API using JSON serialization. NetBox provides a human-friendly browsable version of the API locally, as well as live documentation using OpenAPI (Swagger). Client libraries such as pynetbox are available to simplify the consumption of NetBox’s API by external systems.

Browsable REST API

Custom Scripts

Custom script are a new feature in NetBox, introduced in v2.6.3, which allows an administrator to extend NetBox with arbitrary Python code. These scripts are rendered as forms in the web UI, prompting the user for data which the script processes to perform some action. Scripts can create new objects in NetBox, manipulate existing objects, import data from or send data to remote systems – anything, really. This feature is especially powerful as it allows for the extension of NetBox’s core functionality without introducing the need to maintain a custom fork of the project.

Custom script form

NetBox and Network to Code

While NetBox offers plenty of avenues for integration with other systems, we understand that actually writing the code to engage these features is often easier said than done. Fortunately, Network to Code is proud to offer commercial support for NetBox as well as assistance with custom development. Leveraging our expertise with NetBox and related network automation tools, we are uniquely positioned to deliver extremely high value solutions with quick turnaround. Let us know what we can do for you!

The full series of videos from our NFD21 presentation is posted on Tech Field Day.



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!

Joining the Team

Blog Detail

Two weeks after starting with Network to Code, I thought now might be a good time to share some thoughts on the transition, my motivations for joining, and where I see us going.

I made the jump to Network to Code after five years working for a popular cloud hosting provider. My role there was managing a team of what we called network developers: folks with one foot in traditional network engineering and the other in software development. My team was tasked with developing and maintaining the various tools and integrations crucial for automation of our network infrastructure. This was a natural fit for me, having led the development of NetBox for several years in conjunction with our automation initiatives, and I very much enjoyed my work.

Over the past year or so, it’s been hard to ignore Network to Code’s mounting successes. While I had been in sporadic contact with various folks on the team, I first took serious notice of their growth when John Anderson, a fellow NetBox maintainer, came onboard last year. But what really attracted me to the team was the scope and depth of presentations NTC had put together for Interop 19. I was honored to present alongside John a talk showcasing NetBox as a source of truth for network automation, and I was thoroughly impressed by the caliber of others on the team.

Speaking of NetBox, it’s exciting to see the project moved into its own GitHub organization, completely detached from any commercial entity. NetBox has grown far bigger than I ever expected. Despite it being open source software (or perhaps because of it), I hear people ask again and again if there are any commercial support options for NetBox. It is often deployed as a central component in network automation solutions, and many organizations prefer the backing of guaranteed support. With John and I now both at Network to Code, there’s good potential to simultaneously address this need and secure long-term sponsored development.

It’s an exciting time to be working in network automation. After decades of tolerating legacy network management solutions, organizations all over the world are quickly recognizing the benefits to be gained from standardizing and automating their infrastructure operations. It’s encouraging to see so many teams at various stages of the same journey, ultimately in pursuit of next-generation network deployment and maintenance.

Network to Code is uniquely positioned to help set the course of the industry over the coming years, and I’m thrilled to be part of the team. We’re in for some fun!



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!