Introduction Netmiko has support of textfsm, however it does not have every template to help the matching, to learn how to use textfsm is useful in this situation which you can create your own template without overly rely on module's limited template. TextFSM is created by google, it provides easier and more structured way of … Continue reading [python]Use TextFSM to easily get objects you need from unstructured data.
Tag: cisco
[python]How to capture results with nornir
Introduction Nornir is a framework for network automation, it gels popular automation tools such as napalm, netmiko, paramiko and Ansible. However I could not find good examples on how to parse the result if I use show access-list with netmiko_send_command during task.run. There is a built in print_result() function which shows the status and output … Continue reading [python]How to capture results with nornir
[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]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]Configuring cisco asa
Introduction I am testing some functions for sending configuration over to cisco asa with netmiko. Netmiko support sending commands and sending commands as a set. In order to deliver the command as a set Jinja2 template engine is used to fill up the variables of the template. The purpose of this post is to record … Continue reading [python]Configuring cisco asa
[cisco]Public key authentication on Cisco ASA
I am using Cisco ASAv asa992-smp-k8.bin Generate RSA from Centos ssh-keygen -t rsa -b 2048 I rename this asymmetric keys as cisco_id_rsa. Then I get the contents of cisco_id_rsa.pub. Exclude the ssh-rsa and the username@hostname, only get the key and copy and paste to the cisco asa. See the screenshot on the highlighted portion. On … Continue reading [cisco]Public key authentication on Cisco ASA
[python]Detect changes in configuration of ASA
Three python scripts were written for doing specific tasks. conn_asa.py - this script is responsible for generating two outputs hostname and md_now (md is short for message digest) statechange.py - this script writes the hash generated from conn_asa.py into database. compare_change.py - this script compares the hash stored in db with the current hash generated … Continue reading [python]Detect changes in configuration of ASA
[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
[python]Convert show ip int brief into structured json data
Cisco IOS commands output is unstructured in the perception of scripting, the output format made sense only to engineers, however if you need to program such output is difficult if the output is not processed. One of the better way to structure the unstructured cisco output is to check each row of the output, then … Continue reading [python]Convert show ip int brief into structured json data