Monthly Archive: July 2020
Jinja2 and CSV
CVS can be use as a Dictionary : 1 Line = Keys 2 Line = Values etc…. Each Keys/Values ( Columns ) are separated by a ‘ , ‘ If more then one value is added for one key then…
Read more
Jinja2 Basics
The Basic : Example of a configuration in one script : import jinja2 dict_variables = {‘key’: ‘value’, etc…} template_cfg = ”’ config…{{ .key }} config…{{ .key }} config….{{ .key }} “”” template = jinja2.Template(template_cfg) print(template.render(dict_variables) To access : a key…
Read more
Date Time
Devices Type as 2020 07 30
Simple references to all device type available : a10 accedian alcatel_aos alcatel_sros apresia_aeos arista_eos aruba_os avaya_ers avaya_vsp brocade_fastiron brocade_netiron brocade_nos brocade_vdx brocade_vyos calix_b6 checkpoint_gaia ciena_saos cisco_asa cisco_ios cisco_nxos cisco_s300 cisco_tp cisco_wlc cisco_xe cisco_xr cloudgenix_ion coriant dell_dnos9 dell_force10 dell_isilon dell_os10 dell_os6…
Read more
Fast CLI
Files Transfer
from netmiko import ConnectHandler, file_transfer source_file = “file.ext” dest_file = “file.ext” direction = “put” / “get” file_system = “bootflash:” # Create the Netmiko SSH connection ssh_conn = ConnectHandler(**devices) transfer_dict = file_transfer( ssh_conn, source_file=source_file, dest_file=dest_file, file_system=file_system, direction=direction, overwrite_file=True, ) print(transfer_dict) …
Read more
Netmiko Delay Factor
Global delay factor Delay factor #ConnectHandler from pprint import pprint from netmiko import Netmiko from getpass import getpass password = getpass() devices = {‘host’: ‘100.96.0.18’, ‘username’: ‘ntc’, ‘password’: ‘ntc123’, ‘device_type’: ‘cisco_xe’, ‘secret’: password, ‘session_log’: ‘my_output.txt’, ‘global_delay_factor’:10} 2 would multiple by .1,…
Read more
Handling Prompts from sent commands
Some commands towards different devices requirement prompt inputs. This is how you manage this situation : Example of multiple prompt for a single command. ping = net_connect.send_command(“ping”) #by trying this script it is going to endup in a timeout error…
Read more