[python]First use of Napalm

I have a few Cisco routers which are on IOS, I have never used NAPALM before, I use netmiko most often for cisco devices, Napalm itself is based on netmiko, I napalm has a get_facts method that gather the information of cisco ios router, this is very convenient as compared with netmiko, netmiko is more … Continue reading [python]First use of Napalm

[python]Cisco FMC REST API example – GET Server version and add device to Cisco FMC

Introduction The version used for this lab is Cisco FMC 6.4.0, and Cisco FTD used is 6.3.0. To access the Cisco FMC REST API, you need to ensure it is enabled. You can test it by going to https:///api/api-explorer if you can see the swagger like documentation then the REST API is enabled, you can … Continue reading [python]Cisco FMC REST API example – GET Server version and add device to Cisco FMC

[python]Download videos from youtube with pytube

Introduction I am finding a windows application which can use to download youtube videos like downie, I found out a python module known as pytube3 that can be used for this purpose. Basic usage So for my own purpose I download some videos which I need to listen while exercising, below is the code to … Continue reading [python]Download videos from youtube with pytube

[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

[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]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]Capture return values after threads are finished.

Return value lost after threads finished I have made two functions: The jinja template for preparing the object network {name} command: Then I create a test code to push multiple object network {name} commands to a single cisco asa - fw02. To achieve concurrency I use the threading.Thread module, however my return value of send_net_objs_to_asa_host … Continue reading [python]Capture return values after threads are finished.