Files
awesome-python/website/data/category_intros/network-virtualization.md
T
Vinta ChenandClaude 6bccb357f6 docs: rewrite Network Virtualization category intro
The intro predated the 2026-10-02 audit and did not mention the newly added netmiko.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02 16:17:17 +08:00

2.2 KiB

Netmiko is where to start with Python network automation libraries; when many vendors need one API, move to NAPALM. Scapy works a layer down, on raw packets.

How to choose:

  • Running show and config commands on devices over SSH: Netmiko
  • Config changes across vendors, with a diff before commit: NAPALM
  • Forging, sending, sniffing, or dissecting packets: Scapy

Netmiko gathers show-command output and makes config changes across a very broad set of platforms, and spares you most of the low-level regex matching on device prompts. Describe the device in a dict with its device_type, host, and credentials, and pass it to ConnectHandler, which picks the right class and opens the SSH connection. Run show commands with send_command(), and config commands with send_config_set(), which enters config mode for you.

NAPALM puts a unified API over different network operating systems. Get a driver with get_network_driver() and open the device in a with block, which the docs say to stick with for most situations, since it opens and closes the session for you. To change config, load a candidate that replaces or merges into the running one, check it with compare_config(), then commit or discard it. The docs also say to test your workflow and try to break things on a lab first.

Scapy sends, sniffs, dissects, and forges network packets, as an interactive shell or as a library you import. Build a packet by stacking layers with the / operator, like IP()/TCP(), and override only the fields whose defaults you don't want. Sending packets needs root privileges, so start the shell with sudo scapy.