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 »

I'm sure many of you had to compute summary network given a number of subnets. It's one of those rare occasions when you have to dust off binary maths skills that you had to pick up while learning ip address subnetting. In this blog post I want to discuss related problem, namely working out the largest prefix length needed to encompass provided prefix lengths. I realise it's a mouthful so I'll show some examples before moving onto solution and corresponding Python code. Contents Problem description Examples Solution and algorithm Python implementation Example usage GitHub repository with the source code Problem...

Continue reading »

Time for another post in the series on Pynetbox, awesome PythonAPI client for NetBox. In part 1 we learned how to retrieve information from NetBox, and how to work with objects returned by Pynetbox. In part 2 we've gone through object creation, where we learned how to check what fields are required and how to fill them to make NetBox happy. In this post we will talk about updating existing objects and deleting objects we no longer need. Unlike first two posts this one will be much shorter but should be no less exciting! Posts in the Pynetbox series: Pynetbox...

Continue reading »

Welcome to the second post in the series dedicated to Pynetbox, Python API client for NetBox. In this episode I'll be talking about object creation and we'll go through a few code examples showing how can we add stuff to NetBox. Expect some cool Python code and unexpected plot twists! Posts in the Pynetbox series: Pynetbox - NetBox Python API client part 1 - getting info Pynetbox - NetBox Python API client part 2 - creating objects Pynetbox - NetBox Python API client part 3 - updates and deletions Pynetbox - NetBox Python API client part 4 - tags and...

Continue reading »