Tag: automation

Welcome to the second, and final, part of blog posts showing how to use Python to work with IP addresses. In part one we learned how ipaddress library can help us when working with IP addresses. We then learned about Address and Network objects and operations we can perform on them. Here I'll present Interface object, and its methods, before moving onto module level functions. After that I'll show how we can compare and sort ipaddress objects. We'll finish our journey with the module by talking about validation and exception handling. Working with IP addresses in Python series: Working with...

Continue reading »

If you work with computer networks sooner or later you will have to learn how to efficiently work with IP addresses and networks. As you probably guessed from the title of this post, we'll be learning how to create, modify and perform operations on IP objects using Python. Having to manipulate IP objects is common enough that Python ended up with a built in library dedicated to these tasks. It's name is... you probably guessed it, the name of the module is ipaddress. That's right, all you have to do to start working with IP goodness is one line,import...

Continue reading »

In this blog post I want to share, and talk about, Python program I wrote to solve problem of filtering out child prefixes. Contents Problem description Solution Naïve algorithm Patricia tree aka binary radix tree Python implementation Load testing Module and cli version Closing thoughts References Problem description So what exactly is the problem we're trying to solve? Imagine that you have a group of prefixes, assigned to servers, or clients, and you want to only keep prefixes that are not subnets of any other prefix. This could be because of your routing requirements or because you want to minimise...

Continue reading »

Time for another post in the series on Pynetbox, API client for NetBox. In the previous posts I showed how to retrieve, create and modify objects. Here we'll have a look at a few more interesting and useful examples of leveraging Pynetbox. I'm hoping to continue this series as NetBox is very feature rich and pretty much all of these features can be used programmatically with the help of Pynetbox. I hope this series will provide you with some inspiration as well as help in learning these great tools. Posts in the Pynetbox series: Pynetbox - NetBox Python API client...

Continue reading »