Customizing Nautobot with Applications

Nautobot’s plugin system is designed to allow app developers to deliver efficient, highly integrated, highly customized applications to their users.

NOTE: Nautobot is gradually moving away from the term plugin toward the terms app or application. In this blog post, those terms may be used interchangeably.

This article will discuss Nautobot as a platform, and some capabilities that Nautobot app developers can leverage.

Nautobot Is the Platform

One of the main reasons that Network to Code (NTC) forked NetBox was to develop a robust application (plugin) platform (you can read more about that here). This capability allows NTC, and the larger Nautobot community, to extend and build upon Nautobot’s Core features and leverage Nautobot’s Source of Truth (SoT) data to deliver high-value automation applications.

Nautobot Applications Are First Class Citizens

The Nautobot Core team has been working hard to give Nautobot application developers the ability to heavily customize the Nautobot environment for their users. The intent is to give any application the same look, feel, and functionality as that of Nautobot Core. This empowers developers to customize Nautobot to meet their business and operational needs and give their users a seamless experience between Nautobot Core and application-defined functions.

To enable this type of customization, applications need to have many of the same capabilities as those in Nautobot Core code. Below are a few recent or upcoming features that developers can use in their applications to customize Nautobot.

Applications Can Customize Navigation

Starting in Nautobot 1.1, Nautobot app developers can add tabs, groups, items, and buttons in the top-level navigation menu. (Prior to Nautobot 1.1, apps could only add items and buttons to the dedicated Plugins menu.)

This allows the app developer to customize the top-level navigation for the organization’s users.

The example below shows the Nautobot ChatOps app’s NavMenuGroup being promoted to a (top-level) NavMenuTab named ChatOps:

1-custom-navigation

Applications Can Customize Page Content

To customize Nautobot’s appearance and usability, app developers have to be able to customize what content is displayed and where it is displayed. It is also very important that developers be able to display important info from the app in different ways and in various places. These next two features describe that capability.

Plugins Can Inject Banners (Coming in 1.2!)

Coming in Nautobot 1.2, apps can add banners to display specific and/or important information to the user.

Examples include:

  • Reminders
  • Change window information
  • Maintenance notifications
  • Last known network automation task or execution
plugin-banner

Plugins Can Add Content to Existing Pages

Nautobot apps can add content to existing Nautobot DetailView pages. The example below shows the Device Onboarding panel added to the Device’s DetailView by the Device Onboarding app:

2.5-detail-view-content

And, coming in Nautobot 1.2, apps will be able to add custom content to Nautobot’s home page. This example shows the ChatOps application adding a ChatOps panel to Nautobot’s home page:

2-homepage-content

Users Are Encouraged to Use Nautobot Core Models

A Nautobot application will often introduce a new type of object. Typically, that object should have a corresponding model. Nautobot’s documentation explicitly encourages and recommends that Nautobot applications use models subclassed from Nautobot Core Models.

Leveraging the Nautobot Core Models in apps has three key benefits:

  • It provides a more consistent experience for the user because the app uses objects that are already part of Nautobot
  • It is efficient, allowing the developer to reuse code that is already part of Nautobot Core
  • It gives the developers access to the existing features for the Core models they use

Apps Can Leverage Nautobot Features

The last bullet point in the list above talks about leveraging features associated with Nautobot’s Core Models. This section will discuss a few of the features available using the @extras_features decorator on app-defined models.

This example shows the decorator applied to the ComplianceFeature model in the Circuit Maintenance app code. Each parameter in the decorator adds a specific Nautobot feature to the model.

4-plugin-extras-features

Relationships

Sometimes it is desirable to create a new kind of relationship between objects in your Source of Truth to reflect business logic and/or operational realities that may be useful but have not yet been defined. This is where the Relationships feature adds value.

When the relationships parameter is added to the @extras_features decorator, the application-defined model can use the Relationships feature. This feature enables app developers to create custom relationships to and from their app-defined models that fit their business and/or operational needs.

This example is from the Circuit Maintenance application. It shows a custom relationship between instances of the (Core) Interface model and instances of the CircuitMaintenance model. The examples show the Interface instance sin01-edge-02 / Ethernet 16/1 has a relationship to a single CircuitMaintenance instance:

5-relationships

Webhooks

Models created by apps can leverage Nautobot’s webhook feature to alert external systems when create/update/delete changes occur in app-defined Model instances.

The example here shows webhook creation for the ParsedNotification model, defined in the Circuit Maintenance application:

6-webhook-1

Webhooks allow developers to extend their app’s automation capabilities and/or to tie the app into a CI/CD pipeline. For example, it’s easy to imagine a process that notifies the ticketing system to create a ticket for the maintenance when a ParsedNotification model instance is created.

7-webhook-2v2

Custom Fields

App-defined models can use Nautobot’s custom fields feature. Custom fields allow users to store custom data, specific to their operational or business needs, within objects. Custom fields also allow users to further customize the app-defined models.

This example shows an Approval status custom field on the ComplianceRule model in the Golden Config application:

8-custom-fieldv2

The examples above are just a few of Nautobot’s features that application-defined models can leverage to increase efficiency and meet business and operational requirements.

And That’s Not All!

This article has just touched on the full depth of Nautobot integration for app-defined models.

Here is a list of additional @extras_features parameters that Nautobot app developers can use:

  • custom_links – users can display arbitrary hyperlinks to external content within Nautobot object views
  • custom_validators – users can add custom validation logic for model attributes
  • export_templates – users can define custom templates to control how an object’s data can be displayed
  • statuses – users can define custom statuses for model instances
  • graphql – apps can expose their models via the GraphQL interface to allow the models to be queried easily

There are also additional Core integrations that app-defined models can leverage. Those will be the topics of upcoming content, including blogs, videos on the NTC YouTube Channel, and slide decks.


Conclusion

In addition to being a Source of Truth, Nautobot is an application platform with an extensible architecture that offers multiple ways to leverage Nautobot features.

This post discussed a few of the ways that the Nautobot platform allows developers to

  • customize navigation
  • customize where and how to display content
  • leverage Nautobot Core features
  • reuse Nautobot Core code

These features allow developers to customize their apps to their organization’s workflows and business needs.

Thank you, and have a great day!

-Tim



ntc img
ntc img

Contact Us to Learn More

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

Author