nornir (formerly brigade) - A new network automation framework
Before getting started, let me say that I'm big fan of Ansible. It is one of my go-to automation frameworks. Having said that, there have been use cases where I've run into some of the limitations of Ansible and to be fair some of those limitations may have been my own.
By limitations, I don't mean I could not do what I wanted but rather to do what I wanted got a bit more complex than perhaps it should have been. When I go back in 6 months, I'll have no idea how I got it to work. These use cases often involve more complex logic than what Ansible handles with its "simpler" constructs and Domain Specific Language (DSL) .
So I was very intrigued to hear that the following automation heavyweights had been working on a new automation framework, Nornir:
- David Barroso (think NAPALM - the Python library not the sticky flammable stuff)
- Kirk Byers (think Netmiko, Netmiko tools, and teacher extraordinaire - I can say that with full confidence as I'm pretty sure I've taken every one of his courses - some twice!)
- Patrick Ogenstad (think NetworkLore)
- and many others have since contributed!
As an engineer one of my favorite question is "What problem are we trying to solve?" and here is my answer to that question when applied to Nornir.
Simpler, more complex logic
An oxymoron? Certainly. Read on and I will try to explain.
By using pure Python, this framework solves the complex logic frustrations you may ultimately encounter with Ansible or any abstracted framework. If you can do it with Python or have done it with Python you are good to go. Thats not to say you can't take your Python script and turn it into an Ansible module but Nornir may save you that step.
Domain specific languages (DSLs) can be both a blessing and a curse.
They can allow you the illusion that you are not programing and so facilitate getting you started if "programming" is not your cup of tea.
They can help you get productive very quickly but eventually you may hit a tipping point where the cost of doing what you need to do with the tools and features in the DSL is too high in terms of complexity and supportability.
Nornir "simplifies" that complex logic by allowing you access to all the tools you have in native Python. As a side, and not insignificant, benefit you might actually remember what your code does when you get back to it in 6 months.
Native on all platforms
Many companies only provide Windows laptops and so I've always tried to be very mindful of that when developing solutions.
Scenario: I've got all of these Ansible play books that we can use to standardize network discovery, build configurations, apply configurations but most of my colleagues have Windows laptops and while I was able to develop and run these on my Mac where I can easily run an Ansible control server now we need to get an Ansible control server on a bunch of Windows laptops (this is not natively supported by Ansible).
There are certainly solutions for this (see Using Docker as an Ansible and Python platform for Network Engineers) but that's an extra step. There may be other reasons for taking that step but Nornir is a pip installable module and so you don't need to.
I spent a Sunday afternoon dabbling in Nornir and it was well worth the time. It took me about 45 minutes to get things set up on my Windows system and run the example Patrick Ogenstad included in his post. While Nornir is said to support Python 2.7 (but recommends Python 3.6) I did have installation issues even with the latest pip installed. That was a significant part of the 45 minutes. Once I set up a Python3 virtual environment it worked flawlessly. You can see my work in this GitHub repository.
This is an exciting new framework with a great deal of promise which we can add to our automation arsenal!
Over the next few weeks (or months ) I'll continue to familiarize myself with Nornir and report back.
This was originally published May 7, 2018 on Linkedin but has been updated to support the latest Nornir and scripts have been renamed so that there is no confusion between brigade and nornir. But let me say that this renaming is tied with the renaming of Cisco's Spark platform to Webex Teams as the worst ever, or at least worst in the last decade.
Original Brigade GitHub repository
Part 1 of this Series - Introduction to Nornir < You Are Here
Part 2 of this Series - Configuration Creation with Nornir