Using IP Fabric with Nornir
Today we have some great news for Nornir users – a plugin for IP Fabric has just been released, allowing use of IP Fabric network inventory for Nornir automation! And as we understand that seeing is believing, we have prepared a free 1 month trial for up to 20 devices. Test it directly in your network! All you need it to click the button below.
As any networking engineer who has started his/her automation journey will have realised, one of the first elements required for a successful automation project is a complete and updated inventory. It is necessary to ensure that network changes are applied to the correct network devices, and to do the checks to ensure that those changes have had the desired effect.
Other more advanced automation concepts are irrelevant without being certain that the information they operate on is complete. These ideas, such as idempotency and “network as code”, will make good topics for posts in the future!
Thanks to its full REST API, IP Fabric can supply deep, rich data to other software tools in your network management ecosystem. In particular, customers and partners are using the platform to provide inventory data for their automation tooling.
Nornir is a well known, high-performance network automation framework written for the Python programming language. As with any other automation tool, one of the key components of Nornir is inventory: indeed, according to the documentation it is “the most important piece of Nornir”.
How can we leverage our favourite network discovery and assurance tool (IP Fabric of course!) to improve an automation project in Nornir?
The obvious answer is to use IP Fabric as its inventory: it has the discovered list of network devices and a great deal of information about every device in the network, that can be used to filter the inventory and thus apply configuration changes only where necessary.
Today, we are happy to announce the launch of the IP Fabric inventory plugin for Nornir. Developed by a member of the partner community, the plugin reads the IP Fabric inventory and exposes the device information to Nornir, to be consumed in the automation workflow created by the customer.
How it works
Nornir is currently due a major code release, so as yet the IP Fabric plugin is not yet published in pip. Once the new version of Nornir is available and steady, the intention is to build a more integrated install process.
In the meantime, assuming you have Python and Nornir installed on your workstation, to install the plugin:
- clone the IP Fabric Github repo https://github.com/routetonull/ipfabric_nornir_demo and
- copy the ipfabric.py file into the plugins/inventory directory in your Nornir installation.
Then simply launch Python and import the information from IP Fabric! You’ll find some demo scripts in the repo with the plugin itself – check the readme for more information.
from nornir import InitNornir
nr = InitNornir(
To verify that all devices are imported:
That’s it! We can now use all the familiar Nornir functions for inventory filtering and to launch the automation tasks.
In the next post, we’ll work on some examples of using the IP Fabric Nornir plugin to verify device configurations and fix any drift from the desired values, getting all the necessary information from IP Fabric via API. And stay tuned for some video walkthroughs.
We’re excited about introducing this new capability as an example of how the partner and customer community can extend the capability of our product. There are other integrations and developments in the pipeline – if you are registered with the networktocode Slack, join the #ipfabric channel to join in the discussion, or subscribe to our subreddit r/ipfabric to ask more detailed questions.
Try it yourself
Feeling inspired? Test IP Fabric in your lab environment today with our trial lab license. All you need to click the button below and fill in the form.
If you’re interested in a full PoC of the platform, get in touch!