If you follow me on Twitter or LinkedIn, you’ve probably seen me talking about a project I’ve been working on called net-textorial. You may be wondering why the funny name? What does it do? In this post, I’m going to go over net-textorial, the tech it’s built on, and why you should use it. Let’s jump in!
What is net-textorial?
Net-textorial is a text-based user interface (TUI) application built on the Python library Textual, and uses Netmiko under-the-hood for handling all the device connections and data parsing. Specifically, the ntc-templates library is used to handle the data parsing with Netmiko.
As a bonus nugget, the project name derived from a combination of network, textual, and tutorial (network + textual + tutorial = net-textorial).
In the following sections, we will dive into each library that make up net-textorial, starting with Textual!
Before I go any further, I’d like to give a massive shoutout to the Textualize team that developed the Textual library. It’s a phenomenal library and I’ve enjoyed building TUI apps with it. Now you may be asking yourself, “WTF is a TUI? I’ve heard of a GUI, but never a TUI?”. Well, you’re in the right place. A TUI is an app built completely in the terminal with interactive widgets (buttons, input fields, checkbox, etc.). You may think it sounds a lot like web development with the different widgets I listed, and if you enjoy web development, you’re in for a treat. Textual uses CSS for styling a TUI app! Granted, it uses it’s own flavor of CSS, but nevertheless, it still uses CSS concepts (ID selector, class selector, etc.) to style the app. There is a whole section in the Textual docs that go over how CSS is implemented.
I could go on and on about the Textual library, but here are some key takeaways for network engineers: It allows network engineers to stay in their favorite place (the terminal!), TUI apps can run over SSH (very convenient), and it is cross-platform (TUI apps only need a terminal to run, which is present across all platforms).
Many network engineers are familiar with this library. Netmiko is one of the go-to libraries when beginning your network automation journey. It’s not to say it’s only for beginners (I still use it!), but many engineers start with this library due to its ease of use and low barrier to entry. For those unfamiliar, Netmiko handles device connections and data parsing. For data parsing, Netmiko relies on two libraries: ntc-templates and Genie. Currently, net-textorial only supports parsing with the ntc-templates library. There are plans to add support for Genie parsers in the future.
Now that we know what makes up net-textorial, let’s look at why someone may be interested in using it.
Why use net-textorial?
I built net-textorial to help introduce network engineers to a key foundation of network automation (or really any automation), structured data. It allows engineers to become more familiar with parsed (structured) data, and to begin exploring the data using Python or other tooling. The best part is that the structured data is coming right from your network devices! As a bonus, I’ve built integrations with different source of truths, including Netbox, Nautobot, and Cisco DNA Center. This integration allows net-textorial to sync with the device inventory from a supported source of truth, which will provide autocomplete suggestions when typing in the device name into net-textorial.
I hope you now have a general overview of net-textorial and are interested in trying it for yourself. I truly think TUI apps are a game changer in the network automation space. TUIs present network engineers with a clean UI within the terminal (where many network engineers want to be!) and have minimal requirements, which allow apps to run in almost any network environment. If you’d like to get started, check out the Getting Started section in the net-textorial code repository on GitHub.
I also recently recorded a video on my Youtube channel (@devnetdan), where I go over the functionality and some of the codebase. Here’s the video link if you’re interested in checking out the YouTube video: Net-textorial: A TUI app for network engineers
If you have questions or feedback, feel free to leave a comment or hit me up on Twitter (@devnetdan). Thanks for reading!
Net-textorial project: https://github.com/dannywade/net-textorial
Textual docs: https://textual.textualize.io/