Copyright (C) 2020 Tomas Hlavacek ([email protected])
This is an tttempt to modernize network administration with Python and Ansible.
Currently NAK supports parsing VLANs, interface configuration, Port-channel confguration, vPC, VLT and BGP and users from IOS, NX-OS, Dell OS10, HP ProCurve and Brocade Ironware.
Moreover, NAK can write configuration to the same extent to IOS, NX-OS and OS10 boxes.
Compatibility matrix
VLANs | L2 interface | Port-channel | vPC/VLT | BGP | |
---|---|---|---|---|---|
IOS | RW | RW | RW | N/A | N |
NX-OS | RW | RW | RW | RW | N |
OS10 | RW | RW | RW | RW | N |
ProCurve | RO | RO | RO | N/A | N/A |
Ironware | RO | RO | RO | N/A | N |
Prerequisities:
- Python 3
- Ansible
- Napalm
pip3 install ansible
pip3 install napalm-dellos10
python3 setup.py install
The conversion of switch/router config file to YAML representation of VLANs and ports can be tested with example config file dumps.
box2yaml -t ios examples/cisco-ios-confg
box2yaml -t nxos examples/cisco-nexus-confg
box2yaml -t dellos10 examples/os10-confg
box2yaml -t procurve examples/hp-procurve-confg
box2yaml -t ironware examples/brocade-simple-confg
For configuring devices an Ansible inventory is needed - use examples/hosts
as a starting point.
Please note extra variables in the inventory:
all:
vars:
nak_commonconf: /var/lib/nak/vlans.yml
nak_confdir: /var/lib/nak/yconfig
NAK assumes that nak_confdir
contains a YAML config file for each switch in the inventory
that could be cofigured/managed by NAK. Therefore for monster.taaa.eu
NAK expects to find
a file in /var/lib/nak/yconfig/monster.taaa.eu.yml
.
To simulate configuration write and then to really write & commit the supported parts of the configuration you can run:
nak -s -l monter
which means "simulate" (-s
) configuration and limit (-l
) for host monster
. NAK connects
to the box, sends the candidate configuration, generates diff and prints the generated batch and
the diff generated by the box (if supported by Napalm) and then the candidate configuration
is discarded, so no changes are committed to the box.
When you are satisfied, you can run NAK for real - without -s
parameter. NAK supports multiple
-l <hostname>
parameters or you can ommit limitations altogether and then all boxes in the
entire inventory will be updated.
Last part of NAK is simple inv2csv
that prints inventory in form of CSV. It is useful for
generating Oxidized inventory and connecting any other tools that need access to the
network boxes.
Any contributions are welcome. Please fork & request merge. Issue requests are also welcome.
Plans:
- support BGP
- support VXLAN EVPN on NX-OS and OS10
- support IOS-XR
- support Junos
- ... ?