This day is inspired by the article “Визуализация сетевых топологий, или зачем еще сетевому инженеру Python #2”. I wrote Golang program that analyzes the output of the cisco sh int, sh mac-address-table (for switches) or sh ip arp (for routers) commands and vizualizes network topology from mac address tables. I only used mac address information, not LLDP (CDP).
NeXt Ui (Github) is used for visualization.
For example, I received an output with self-made telnet client on Golang from a network of this topology:
As result, you can see a clickable diagram in the browser with devices and links between them:
Previously, I made topology a network of switches, for which is quite enough data about the neighbor’s mac-addresses. If routers appear in the network, then you can’t do without LLDP(CDP). I wrote a program that visualizes the network topology based on CDP. The code is still raw, and it took a little more than two hours to write it. The main goal is to practice in Golang.
The source code, sample CDP data, and the result of computing on this data is available on GitHub. I built the topology of this network: