One of my favorite libraries in Python in Pydantic. I love it and use it all over the place.
[Read More]
My first time at AWS re:invent
From November 24th till December 1st, I was in Las Vegas to attend AWS re:invent for the first time.
[Read More]
Testing network configurations using Batfish, Pandas and pytest
Recently, I started looking into testing and validating network configurations leveraging Batfish, Pandas and pytest. Doing something with Batfish has been on my to-do list for quite a while. After playing with it, I can say it is a real pity I did not start using this tool earlier.
[Read More]
Extending Python with C
speed up your Python using C
A good deal of Python, or at least CPython, is written in C. The language and the interpreter are implemented in C and in addition to this, you can also find a lot of modules in the Python standard library powered by C.
[Read More]
Building a network configuration
Even though there are a lot of resources on rendering and building network configurations, I was missing content that describes the pattern that I have been using for some time now. This post outlines the pattern I have been using and provides a toy example where that pattern is implemented....
[Read More]
Calling Rust from Python using PyO3
speed up your Python using Rust
Calling Rust code from Python is made easy by PyO3. You can write a Rust library and rely on the combination of PyO3 and maturin, a supporting tool from the PyO3 ecosystem, to compile the Rust library and have it installed directly as a Python module. Among others, PyO3 can...
[Read More]
Calling Rust from Python
speed up your Python using Rust
Python is a fantastic language! At least, in my opinion it is. There is a great ecosystem of libraries that you can use and I find it a very satisfying language to work with. But being the interpreted language that it is, Python is not the fastest. To speed things...
[Read More]
Rust Option and Result
dealing with the Option and Result enum
A thorough understanding of the Option enum and the Result enum are essential to understanding optional values and error handling in Rust. In this ariticle, I will work my way through both of them.
[Read More]
Rust vectors
data types
What is a vector:
[Read More]
Rust slice
data types
In Rust, the slice is a primitive type as well as a sequence type. I found slices very confusing at first. In the Rust book, slices are defined as ‘a dynamically-sized view into a contiguous sequence’.
[Read More]
Rust tuple
data types
The Rust tuple is placed in several categories of types. For starters, the tuple is a primitive type. Among others, this means tuples have the Copy trait implemented, making them pass by value.
[Read More]
Rust SSH
Learning Rust by building a CLI tool
Creating small CLI tools is a fun way to get more familiar with a programming language. If you are coming from an infrastructure background, a CLI tool that you can use to send commands to devices/servers might be considered a neat starting point getting into Rust. This is how I...
[Read More]
Rust arrays
data types
In Rust, the array is the simplest of the sequence types (the others being slices and tuples). The array lives on the stack and has a fixed length. The length you declare an array with is part of it’s type and it is going to remain the same throughout the...
[Read More]
Rust scalar types
data types
Scalar types
[Read More]
GoSNMP
GoSNMP is a very fun package to play with and learn about Go. It is easy to use and it can be made into doing something usefull quickly. The examples in the repo are clear and SNMP offers a fun way to play with channels and retrieving information from devices....
[Read More]
Working with JSON in Go
A little while ago, I decided to start learning Go. One of the things that I wanted to start out with was learning how to work with JSON. Coming from Python, the first thing I noticed was that working with JSON in Go is a bit more involved.
[Read More]
Schedule the boring stuff with Python
The schedule module describes itself as ‘Python job scheduling for humans’. It is a nice package that I use for infrastructure related tasks and activities. The package (currently) prides itself for the following: A simple to use API for scheduling jobs. Very lightweight and no external dependencies. Excellent test coverage....
[Read More]
Navigating Juniper RPC returns using XPATH
Many people dread XML and would rather work with JSON. However, XPATH can be extremely powerful when dealing with the Juniper XML API output.
[Read More]
Using Python functions in Jinja templates
In some cases, Jinja templates become too complicated. Lots of deeply nested if statements, clunky ways of working with variables, macros and many other things that hurt the eyes.
[Read More]
Nornir
In the search for a framework that would allow me to plug my automations without too much fuss, I came across Nornir. I have been enjoying it so much that I decided to do write down an introduction for others. My hope is that this post will allow others to...
[Read More]
Getting started with JSNAPy
JSNAPy allows you to create snapshots that capture the state of devices running Junos. After capturing the device state, you can run tests against these snapshots. These tests can tell you if there is something to worry about or not.
[Read More]
TextFSM
Google TextFSM is a Python module that is written to make parsing text easier. It is a convenient way to turn CLI output into structured data. This blog covers a TextFSM example and shares the way in which I have been using TextFSM lately.
[Read More]
Executing shell commands using Junos PyEZ
When you log in to a Juniper device, you normally land on the Juniper CLI. This is the command shell that most engineers are familiar with. But not all commands are available on the Juniper CLI. Sometimes you will need to interact with the shell of the underlying OS, which...
[Read More]
Scrapli in SaltStack
Recently, I have been looking into a Python library called scrapli. You can use it for screen scraping and what led me to checking out this package is the fact that it is easy to tap into ssh2-python. This can offer quite some benefits in terms of speed and CPU...
[Read More]
Working with YAML in Python
Some examples on working with YAML (‘YAML Ain’t Markup Language’) in Python3. In the examples, I am using PyYAML version 5.2 which can be installed using pip3 install pyyaml.
[Read More]
BFD protected LAG
A LAG combines multiple physical links between two adjacent nodes together to establish a single (virtual) link. This offers increased bandwidth, link efficiency and physical redundancy.
[Read More]
SaltStack overview
Diving into SaltStack for the first time can be difficult and confusing. There is a lot of terminology involved that is going to be new. This makes it difficult to get a clear overview of how everything is working together and how the different parts might be useful to you....
[Read More]
Using the Cisco IOS XR API for information gathering
Cisco IOS XR has an XML API you can use to retrieve structured data from the device. In this article, I will run through several examples on how you can do this with Python. I will use the backend NAPALM library called pyIOSXR to issue RPCs. I’ll also show some...
[Read More]
NAPALM and NX-OS
Recently, I have been exploring NAPALM in relation to NX-OS. To connect to the device, I used the nxos driver which uses the NXAPI. This write-up contains some of the basic operations. I am using NAPALM version 2.5.0 and the NX-OS device is a Nexus7700 running 8.0(1).
[Read More]
Screen scraping basics for network engineers
This article contains several examples I could have used after reading up on the basics in Python. After I read the first chapters of Automate the Boring Stuff with Python and Learning Python, 5th Edition, I struggled to put the concepts I read about into practice. I understood the basic...
[Read More]