configuration

Replace Words in Files or Strings using Python

Preface

I’m a Network Engineer learning Python, and these are purely my notes. I’m not an expert by any means. Feel free to use any of these examples and improve upon them. Feel free to call me out where things can be done better.

Onward

A common task I need to do is replace words in a file with something else. For example:

hostname $hostname
interface Gig0/1
 ip address $ip 255.255.255.252

Where $hostname and $ip should be variables that needs replacing. This post looks at how to accomplish this on the Python interpretor, and via a script file using a Python function.

To keep things relatively simple, I’m only going to perform the replacement on a single file, using a single set of attributes. (more…)

Search a List of Dictionaries in Python

Preface

I’m a Network Engineer learning Python, and these are purely my notes. I’m not an expert by any means. Feel free to use any of these examples and improve upon them. Feel free to call me out where things can be done better.

Onward

This post is sort of a follow-up to my last one regarding CSVs converted to dictionaries. So, I have this big list of dictionaries, these key/value pairs, and I want to do things with them. In this case, I’d like to be able to search this list and return just the key/values for a specific device.  This will later be used when building network device configuration files. (more…)

Convert a CSV to a Dictionary in Python

Preface

I’m a Network Engineer learning Python, and these are purely my notes. I’m not an expert by any means. Feel free to use any of these examples and improve upon them. Feel free to call me out where things can be done better.

Onward

I have a CSV full of device-specific variables that I need to use in a script built for generating network device configurations. For example:

devicess (more…)

Fibre Channel over IP (FCIP) for CCIE DC

Fibre Channel over IP (FCIP) is a tunneling protocol used to connect FC networks across IP networks, such as a WAN. It uses TCP with the DF bit set. Being that this is IP storage, it is only supported on the MDS platform. The basic configuration is straight forward, but be aware that there are lots of configurable tweaks.  In this blog post I’ll be going through the configuration of several FCIP topologies, feel free to follow along.  At the end I’ll post a quick template. (more…)

FC Security for CCIE DC – FC-SP / DHCHAP

Fibre Channel Security Protocol (FC-SP) provides the capabilities for Diffie-Hellman Challenge Handshake Authentication Protocol (DHCHAP) to authenticate switches and/or hosts attempting to enter the fabric. The terms FC-SP and DHCHAP are used interchangeably. Unlike most FC feature, DHCHAP is not configured on a per-VSAN basis. (more…)