Python Coding Flashcards
Which Python template can you use to retrieve IOS/Avaya/Arista etc files?
Use the ntc-template, which can be retrieved with GIT
Where is netmiko based on?
Netmiko is based on paramiko
What is netmiko using to connect to the device
SSH
Which function can you use to prompt the user a username/password string?
The getpass python library
How does a Python dictionary looks like for a device in a python script during netlike?
cisco_01 = {
“device_type”: “cisco_ios”,
“host”: “10.10.20.17”,
“username”: “cisco”,
“password”: “cisco123”
}
How do you unpack a dictionary?
With **kwargs
When do you use a dictionary to define nodes in your script?
You create more organised code
How do you access the EXEC privilege
connection.enable() # Enable method
Add: “secret”: “cisco123” # Enable password to node dictonary
How do you access config mode?
connection.config_mode()
What is a for loop?
For loop in Python is used to iterate over a sequence such as a Python list. Loop continues until it reaches the last item on the list.
Which library can be used to secure your login credentials?
getpass
Which Netmiko method can you use to send multiple commands to a network node?
send_config_set
Which features are included in the send_config_set method?
Automatically access global configuration mode. After running the script it automatically exit the global configuration mode
How can you create a list of nodes to connect automatically to all?
This is done with a list of dictionaries
In case of multiple nodes with a dictionary and a list, how does it look like?
The list had the dictionary inside. Like a bag with groceries.