Generate network topology graph from LLDP neighbors
The LLDP-to-Graph Ansible playbook uses LLDP neighbor data collected with napalm_get_facts Ansible module to generate network diagram in Graphviz .dot file format.
The playbooks were tested with these versions of Ansible and NAPALM:
- Ansible 2.4
- napalm 1.2.0 (or greater)
- napalm-ansible 0.7.0 (or greater)
- The playbooks have been updated to work with Ansible 2.4 and will not work with previous versions of Ansible
napalm-ansibleto find path to your distribution of NAPALM and update ansible.cfg accordingly
- The playbooks and Jinja2 templates have been updated to support platforms (like Cisco IOS) that send shortened interface names in LLDP updates
- The playbooks work with a mix of hostnames and FQDNs (for example, E1 versus E1.virl.info)
-e no_domain=1option on
ansible-playbookcommand line to use short hostnames in printouts and graphs
git checkout LLDP-to-Graph-v1.0 to get the source files matching the original case study.
- Create your inventory file. The current hosts file uses vEOS leaf-and-spine topology. Set IP addresses, usernames, passwords and ports in the inventory file.
- Install NAPALM Ansible modules with
git clone https://github.com/napalm-automation/napalm-ansible/(assuming you already installed NAPALM)
- Install graphviz
- Generate the network topology file with
- Generate the network diagram (in PNG format) with
dot -Tpng network.dot >network.png
- Enjoy, modify and submit a pull request when you add something awesome