Everything is Python
Although you don’t need to know Python to use the pyATS ecosystem, it might help you to understand the structure of the Python-based commands described in this guide.
Tip
Remember, you can use the Library command line for network automation and never have to enter a Python command!
The following example explains the statements used to connect to a device and parse output from the show inventory command.
Number |
Statement |
Description |
|---|---|---|
1 |
|
Get the``genie.testbed``library and its``load`` function. |
2 |
|
Load the``tb.yaml``testbed and store it in the``tb`` variable. |
3 |
|
Find the``nx-osv-1``device and store it in the variable``dev``. |
4 |
|
Connect to the device you defined as``dev``. |
5 |
|
Parse the``show inventory``output for``dev``, and store the output in the variable``p1``. |
6 |
|
Print a meaningful message and the serial number for Slot 1. |
Tip
If you want to know more about how to use Python, you can find many good online tutorials.