HCIA-Datacom lab 19 of 22

Python automation with Paramiko and Netmiko

Automate a Huawei router and switch from Python. You write a Paramiko script that logs in over SSH, runs display commands and pushes a change, then use Netmiko to back up both devices in a loop and to push VLANs to the VRP8 switch with a proper commit.

Run this lab

It needs Lite: its 3 nodes are set to 4 vCPU and 5,120 MB in total. That fits the free demo too.

In your workspace: Shared, then HCIA-Datacom H12-811 guided labs, then 19 - Python automation with Paramiko and Netmiko

Try it free for 30 minutesRun it on Lite from £3 a day

The free demo needs no card and no email. Every lab plan includes every guided lab.

Level
Advanced
Time
About 60 minutes
Nodes need
4 vCPU, 5,120 MB
Smallest plan
Lite

The scenario

Northwind's network team is tired of logging in to devices one at a time. The management station (NMS, Ubuntu with Python 3, Paramiko and Netmiko already installed) can reach R1 and SW1 over SSH. You'll build the team's first tools: a script that runs display commands, one that makes a change, and a nightly backup of every device's configuration.

What you’ll practise

  • Explain why automation uses SSH and libraries such as Paramiko and Netmiko (and why telnetlib is gone)
  • Write a Paramiko script that opens an interactive shell, handles prompts and reads output
  • Push configuration with Paramiko and verify it
  • Use Netmiko device types for VRP5 (huawei) and VRP8 (huawei_vrpv8), including commit
  • Back up configurations from an inventory in a loop

The tasks

  1. Load the starting configuration
  2. Read a device with Paramiko
  3. Make a change with Paramiko
  4. Back up every device with Netmiko
  5. Push VLANs to the VRP8 switch, with a commit
  6. Think about safety

The Lab Tasks pane has the scenario, these tasks, the checks to run, hints and the full solution.

Topology and devices

The network as it opens in EVE-NG, drawn from the lab’s own canvas, and the image each node runs.

Topology of Python automation with Paramiko and Netmiko3 nodes, 2 links. Every link is listed as text below the diagram.R1SW1NMSeth0GE1/0/10GE1/0/1GE0/0/0
3 nodes, with the interface names each link uses. On a narrow screen, scroll the diagram sideways.
Nodes in Python automation with Paramiko and Netmiko, with the image each runs and the vCPU and RAM it’s set to
NodeDeviceImage in Add NodeSet to
R1Huawei AR1000V routerhuaweiar1k-5.170-V300R022C00SPC100-Auto-update-esn1 vCPU, 2,048 MB
SW1Huawei CloudEngine CE6800huaweice6800-bundled2 vCPU, 2,048 MB
NMSEVE-NG GUI server (Docker)eve-gui-server:latest1 vCPU, 1,024 MB

How to open this lab

  1. Sign in to your workspace at lab.cloudlabbox.com.

  2. In File Manager, open Shared, then the folder HCIA-Datacom H12-811 guided labs.

  3. Open 19 - Python automation with Paramiko and Netmiko and start its nodes, then open Lab Tasks for the scenario and the steps.

The lab is read-only. You can start the nodes and configure the devices, but changes to the topology can’t be saved. To change it, rebuild it in your own folder.

More HCIA-Datacom labs

All HCIA-Datacom labs

Related labs in other courses

CloudLabBox is independent of Huawei. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.