In this series of blog posts, I will walk through network automation with Nornir framework, but before we can dive into the good stuff, let’s build a lab that I can run automation on.
1 Why using 3 different platform for the lab?
It’s very common to use network equipment from more than one vendor (at least for ISPs). From my own limited experience, I’ve spent most time configuring and troubleshooting on Cisco IOS-XR and Huawei VRP routers for daily job. And invested quite a lot of time on Cisco IOS for my CCIE-RS exam. But didn’t have chance to work on Junos as much. Just like Chris mentioned in his blog post, I kind of hate to use Junos, guess it just didn’t click for me yet.
Automating network equipment of multiple vendors is a painful process, especially when it comes to the ones that doesn’t have too much global presence, or the ones that are banned (*cough* Huawei *cough*). Most of modern automation tools have limited support for Huawei. Let’s see if I can have Nornir to work with Huawei VRP routers and get some automation action going.
2 Lab details
I prefer EVE-NG over GNS3, since I used to lab a lot on it when I was preparing for CCIE exam, and I will be using community version (version v2.0.3-112) for this lab.
2.1 Import router images and get it running
First thing first, we need to import router images to EVE-NG. It’s a bit of a hassle to install these images, but definitely not rocket science.
For Junos: log in to VCP as root, type “cli” to enter Junos CLI
Off to a good start, all 3 images are running, let's see the version info for each router:
Juniper Junos: 20.4R3.8
root@vMX-R1> show version
Hostname: vMX-R1
Model: vmx
Junos: 20.4R3.8
JUNOS OS Kernel 64-bit [20210618.f43645e_builder_stable_11-204ab]
JUNOS OS libs [20210618.f43645e_builder_stable_11-204ab]
...
Huawei VRP: 8.180
<Huawei-R2>display ver
Huawei Versatile Routing Platform Software
VRP (R) software, Version 8.180 (NE40E V800R011C00SPC607B607)
Copyright (C) 2012-2018 Huawei Technologies Co., Ltd.
HUAWEI NE40E uptime is 0 day, 14 hours, 3 minutes
SVRP Platform Version 1.0
Cisco IOS-XR: 6.1.3
RP/0/0/CPU0:IOS-XR-R3#show version
Thu May 5 08:09:51.127 UTC
Cisco IOS XR Software, Version 6.1.3[Default]
Copyright (c) 2017 by Cisco Systems, Inc.
ROM: GRUB, Version 1.99(0), DEV RELEASE
...
2.2 Build a lab in EVE-NG
It’s time to build a simple lab around them to see if they work as intended.
Interface IP addresses between Router X,Y is set to 192.168.XY.X/24 format. For connection between R1 and R2, it will be 192.168.12.1/24 for R1 and 192.168.12.2/24 for R2. And all 3 routers have lo0 interface with X.X.X.X/32 address assigned.
Juniper vMX tip
You need to add both VCP and VFP, connect them together through em1 interface.
EVE-NG Topology
2.3 Change hostname & Configure interfaces
Let’s configure interface IP addresses and do bunch of pings to make sure they are connected.
set system root-authentication plain-text-password
set groups router system host-name vMX-R1
set apply-groups router
set interfaces ge-0/0/0 unit 0 family inet address 192.168.12.1/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.13.1/24
set interfaces lo0 unit 0 family inet address 1.1.1.1/32
commit
Setting up BGP for Cisco and Huawei was very straight-forward.
Junos is a little tricky, you have to add AS number under “routing-options” before you can configure iBGP commands.
Advertising lo0 address is very simple for both Cisco and Huawei, one network command will do the job. However, with Junos you have to configure a policy and apply it to the BGP config.
set policy-options policy-statement advertise.lo0 term 1 from route-filter 1.1.1.1/32 exact
set policy-options policy-statement advertise.lo0 term 1 then accept
set protocols bgp group ibgp-peers export advertise.lo0
I’ll add bits and pieces to make the lab suitable for automation, or completely overhaul the entire topology, just for the sake of messing around. 😂
4.2 TIL
TIL section is dedicated to the things that I’ve learned while writing blog posts, they can be either very trivial commands, or more complex concepts.
TIL : Today I Learned
To show / compare uncommitted changes, simply run these commands: show | compare (Junos) display configuration candidate changes (Huawei VRP) show commit changes diff (Cisco IOS-XR)