Introduction The entire script demo can be found here. The script reads from an excel sheet named as "vlans.xlsx" and extracts the information, the information is then converted into vlan commands with a jinja2 template, the script is able to send to multiple switches by using threading, on each thread a new Switch instance is … Continue reading [python]Creating vlans on multiple switches
[python]Grow commands from a template with jinja2
Problem I made a template to push object network configuration to Cisco ASA, this is how the template looks like: conf_attr is the keyword to store the payload I sent to Cisco ASA via Nornir/netmiko, the problem with this template is only one command is sent per session. In order to commands to be sent … Continue reading [python]Grow commands from a template with jinja2
[python]Improve on ACL template.
Introduction On previous few posts, the ACL was push to the cisco asa with Nornir, but there was limitation that is only one source ip, one destination ip and one service are allowed, if there is more than one in any of these then only one rule is pushed. But there will be a number … Continue reading [python]Improve on ACL template.
[python]Filter inventory – Nornir
Introduction Nornir is a framework for network automation, it gels netmiko, paramiko, ansible, yaml, ansible, napalm, netconf together, this is a must have package for doing network automation and it is not too difficult to learn. There will be time when specific configuration is for specific device in the inventory, in order to push to … Continue reading [python]Filter inventory – Nornir
[python]Push ACL to Cisco ASA with Nornir. Passing in dictionary.
Introduction On previous post testing was done to push ACL to Cisco ASA with static information, however in production preparing static information directly to the run method of Nornir is not practical, if the information is passed as a dictionary through API gateway the payload will have to be passed to the add_acl function. So … Continue reading [python]Push ACL to Cisco ASA with Nornir. Passing in dictionary.
[python]Using Nornir framework to push ACL to Cisco ASA
Introduction Nornir is a framework for network automation, the framework is written in Python and gels Paramiko, Netmiko, Napalm, Jinja2 and Ansible. The use of framework makes the code more consistent and easier to adapt. Secret management Hashicorp vault is required for storing the secret in the code. The extraction of secrets from the vault … Continue reading [python]Using Nornir framework to push ACL to Cisco ASA
[python]Syntax error on Jinja2 – end of statement block – got %
The bug in the script is kind of difficult to hunt, however a hint whenever you see exception like this: Always check if there is a space between the % and the } The exception was raised due to this:
[python]Automating OSPF configuration of two routers
Network diagram There are two vIOS which are R1 and R2, they have their gi0/2 and gi0/3 connected to the R5 switch, the configuration is pushed from the cloud through their gi0/2 and gi0/3 to configure their gi0/0 to become OSPF neighbours. Objective To configure the two routers to become ospf neighbors, the OSPF configuration … Continue reading [python]Automating OSPF configuration of two routers