[python]Checking whether the hosts in inventory are alive with Nornir

Nornir has a tcp_ping function that can be used to test connections within the inventory file. You can check one or multiple ports, you can also specify the hosts of your choice So let's see how can this be used. Check if a port is live for hosts in inventory This is my yaml inventory … Continue reading [python]Checking whether the hosts in inventory are alive with Nornir

[python]Understanding how to capture the result you need with Nornir

Introduction The documentation has illustrated how to display the output to the console screen, however it did not explicitly show how to capture the data you need. It does document about what is AggregatedResult object and Result object, but still using examples will be easier to understand and also to encourage more people to use … Continue reading [python]Understanding how to capture the result you need with Nornir

[python]Nornir framework usage example 1 – show ip int brief

Introduction Before using Nornir, I was using netmiko, netmiko is a steady module which makes configuring, getting information from cisco based devices easily. Of course netmiko is not limited to just Cisco, it is a multi-vendor module. Napalm is another network module which does the same thing as netmiko, however when dealing with Cisco ios … Continue reading [python]Nornir framework usage example 1 – show ip int brief

[python]TextFSM to match show interface summary

The Cisco ASAv has a command show interface summary, this command output has a lot of information, these are the interesting information I need from this command: Interface id including the sub interface if available nameif, which is the name interface which must be configured administrative status protocol status vlan id if available ip address … Continue reading [python]TextFSM to match show interface summary

Do not update netmiko to version 5 if you are using it with nornir

I have been using nornir to call netmiko, the netmiko version used by nornir is version 2.4.2, netmiko has just updated to version 3.0, before I upgraded the netmiko, I could push config set. After I upgraded netmiko to 3.0, my script started raised netmiko timeout, but the commands were sent to the firewall. From … Continue reading Do not update netmiko to version 5 if you are using it with nornir

[python]Comparing execution time without threading, with threadpoolexecutor and threading subclass

3 round results to print out the execution time of calling the functions This is a comparison in execution time by sending show version to three Cisco ASA - fw01, fw02 and fw03. All connections with netmiko.ConnectHandler has a global_delay_factor of 0.5s. I have made three functions: connect_device_type_1: This function does not use threading but … Continue reading [python]Comparing execution time without threading, with threadpoolexecutor and threading subclass

[python]Matching sh run object service with textfsm

I have been experimenting a few combination with textfsm, the problematic one is show run object service may show description and some may not show description this is because description is an optional configuration item in Cisco ASA. This makes matching description kind of hard. The current working textfsm only matches compulsory items such as … Continue reading [python]Matching sh run object service with textfsm