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>
This commit is contained in:
Vinta Chen
2026-10-02 16:17:17 +08:00
co-authored by Claude
parent 31f629b1ea
commit 6bccb357f6
@@ -1,10 +1,13 @@
Configure network devices from several vendors through one API with the Python network automation library NAPALM. Scapy forges, sends, and sniffs packets.
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:
- Configuring network devices from several vendors, or reading their state: NAPALM
- Forging, sending, sniffing, and dissecting network packets: Scapy
- 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
NAPALM [talks to network devices of different operating systems through a unified API](https://napalm.readthedocs.io/en/latest/), to change their configuration or retrieve data from them. `pip install napalm` [installs all the core drivers](https://napalm.readthedocs.io/en/latest/installation/index.html). Pick the driver for your device's OS with [`get_network_driver()`](https://napalm.readthedocs.io/en/latest/#selecting-the-right-driver), like `get_network_driver('eos')`. Then [connect in a `with` block](https://napalm.readthedocs.io/en/latest/tutorials/context_manager.html), which opens and closes the session for you. To change the configuration, [load a candidate that replaces the device's config or merges into it](https://napalm.readthedocs.io/en/latest/tutorials/changing_the_config.html#replacing-the-configuration), and check the diff with `compare_config()`. Then apply it with `commit_config()`, or throw it away with `discard_config()`. What each driver supports differs, so [test your workflow in a lab first](https://napalm.readthedocs.io/en/latest/support/index.html#configuration-support-matrix).
Netmiko gathers show-command output and makes config changes [across a very broad set of platforms](https://github.com/ktbyers/netmiko#why-netmiko), 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](https://pynet.twb-tech.com/blog/netmiko-python-library.html). Run show commands with `send_command()`, and config commands with `send_config_set()`, which [enters config mode for you](https://github.com/ktbyers/netmiko#getting-started-1).
Scapy [sends, sniffs, dissects, and forges network packets](https://scapy.readthedocs.io/en/latest/introduction.html#about-scapy), and you can use it [as a shell or as a library](https://github.com/secdev/scapy). Instead of telling you a port is open or closed, it [gives you the full decoded packets](https://scapy.readthedocs.io/en/latest/introduction.html#what-makes-scapy-so-special), so you probe once and interpret many times. Install it with `pip install scapy`, and on Windows, [install Npcap first](https://scapy.readthedocs.io/en/latest/installation.html#windows). [Sending packets needs root privileges](https://scapy.readthedocs.io/en/latest/usage.html#starting-scapy), so start the shell with `sudo scapy`, or on Windows from a command prompt with administrator privileges. Build a packet by [stacking layers with `/`](https://scapy.readthedocs.io/en/latest/usage.html#stacking-layers), like `IP()/TCP()`, and fields you don't set get sensible defaults. In your own scripts, [import what you need from `scapy.all`](https://scapy.readthedocs.io/en/latest/extending.html#using-scapy-in-your-tools).
NAPALM puts [a unified API over different network operating systems](https://napalm.readthedocs.io/en/latest/). 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](https://napalm.readthedocs.io/en/latest/tutorials/context_manager.html), 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](https://napalm.readthedocs.io/en/latest/tutorials/changing_the_config.html). The docs also say to [test your workflow and try to break things on a lab first](https://napalm.readthedocs.io/en/latest/support/index.html#configuration-support-matrix).
Scapy [sends, sniffs, dissects, and forges network packets](https://scapy.readthedocs.io/en/latest/introduction.html#about-scapy), as an interactive shell or as a library you import. Build a packet by [stacking layers with the `/` operator](https://scapy.readthedocs.io/en/latest/usage.html#stacking-layers), like `IP()/TCP()`, and override only the fields whose defaults you don't want. [Sending packets needs root privileges](https://scapy.readthedocs.io/en/latest/usage.html#starting-scapy), so start the shell with `sudo scapy`.