Introducing the Nautobot Data Validation Engine Plugin

Data, data, and more data, but is the data good data?

Coinciding with the coming release of Nautobot v1.1.0, the team is excited to announce the public release of the Data Validation Engine Plugin! This Nautobot plugin offers data validation and enforcement rule logic that utilizes the custom data validators functionality within the platform. Data validators allow for custom business logic to be enforced within Nautobot when changes to data occurs. This gives organizations the ability to better integrate Nautobot into their existing ecosystems and to put guardrails around its use to ensure that network data housed within Nautobot can be trusted. One of Nautobot’s core missions is to serve as a single Source of Truth (SoT) for network data, from which automation solutions can be engineered. For network automation to be successful, the data that drives that automation must be trusted, and for the data to be trusted, there must exist constraints within the data model to enforce its correctness.

The problem lies in the understanding that all organizations operate differently and each will have nuanced ways in which they manage and configure their networks that ultimately dictate constraints in their network SoT data. Something as simple as naming a device can quickly devolve into endless debate and 16 different organizational standards. As such, it is impossible for Nautobot to try to derive and implement any such direct data constraints that would apply to all users. Therefore, the custom data validators feature set exists, to empower end users to codify their business logic and be able to enforce it within Nautobot.

Data Validation Engine Plugin

So where, then, does the plugin fit? The custom data validators API is a raw Python interface that hooks into the data models’ clean() methods, allowing for ValidationErrors to be raised based on defined business logic when model instances are created or updated. If that doesn’t mean anything to you, the Data Validation Engine Plugin is for you!

The plugin offers a Web UI (and REST API) for creating and managing no-code business rules for validation. In this initial release, there are two types of supported rules, regular expressions, and min/max numeric based rules.

Regular Expression Rules

Regular expressions define search patterns for matching text and are quite pervasive in the industry for a variety of use cases. They are often used to validate that text conforms to a pattern. Here, we use them to define rules for constraining text based fields in Nautobot to user defined expressions.

regex-rules-list

Each rule defines the Nautobot model and the text based field on that model to which the validation should apply. A custom error message can be defined, else a default message will indicate validation against the regular expression has failed. The rule may also be toggled on and off in real time in the Web UI.

regex-rules-edit

When a rule has been create and enabled, it is enforced when an instance of the applicable model is either created or updated in the Web UI or REST API. Here we can see what happens when a user attempts to create a device that does no conform to the hostname standard that was defined above.

regex-rules-enforcement

Min/Max Numeric Rules

While regular expression rule work on text based fields, min/max rules work on numeric model fields.

min-max-rules-list

As the name implies, users have the ability to constrain the minimum and/or maximum values of a number-based field, and the rules are defined in the same way as regular expression rules.

min-max-rules-edit

As you might expect, the enforcement is also the same, and in this example, an organization wishes to enforce that no VLANs with ID greater than or equal to 4000 get deployed in their environment, so they create a min/max rule targeting the vid field on the VLAN model.

min-max-rules-enforcement

Install

The plugin is available as a Python package on PyPI and can be installed with pip, following the full instructions on GitHub.

Final Thoughts

Data is key to network automation and trusted, correct data is key to successful network automation. Enforcing your organization’s specific business logic constraints is an important step in building a network automation platform and Nautobot offers the feature set to enable you. The Data Validation Engine Plugin goes one step further in providing a user friendly, no-code solution to common data validation use cases. Give it a try and let us know what you think!



ntc img
ntc img

Contact Us to Learn More

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

Author