Cisco ASA's show run object network will show the subnet, host and range objects, netmiko has a textfsm template to match the result in dictionary, however there is no template to match show run object service hence for the service part you will need to write your own textfsm template. On this example I will … Continue reading [python]show run object network
Security configurations such as from ASA, IPS, NACS, ISR zone base firewall, VPN etc will be posted here.
[python]Convert TextFSM nested list data into dictionary
Introduction Reference: http://gratuitousarp.info/a-quick-example-of-using-textfsm-to-parse-data-from-cisco-show-commands/ The reference article alluded a method known as value_map, I immediately knew it is possible to change to dictionary easily when I saw the output of value_map. This is how the output of value_map looks like, and this explains how the variable maps to the regex, if you are using re module … Continue reading [python]Convert TextFSM nested list data into dictionary
[python]TextFSM and TTP
I was testing on another command show run object network, and ttp did not match the word "description" and hence the part about "description" was omitted. This is not a problem as netmiko already has a ready made textFSM template that matches show run object network. Example of ttp with show run object network This … Continue reading [python]TextFSM and TTP
[python]Usage example of ttp
Introduction Thank you Kirill Pletnev for letting me know about ttp module. ttp - Template Text Parser - is an easier to use parser than TextFSM, user does not need to know regex, the regex has already been defined, but how comprehensive is the regex is yet for me to discover. You can refer to … Continue reading [python]Usage example of ttp
[python]Use TextFSM to easily get objects you need from unstructured data.
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.
[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] asa library
I created an asa library which contains functions require to perform some asa operations, this is not a complete set, there are some sets which I have not tested yet, the below functions are all tested and working.
[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