Gathering facts about your network device using NAPALM
When dealing with a device, we are usually doing two different types of operations. For example, we are either setting information or we are gathering information. NAPALM offers us two different types of functions to carry out these types of actions. To set information, we have configuration functions, and to retrieve information, we have getter functions. We will explore configuration functions in the Creating and applying a configuration template with jinja2 and NAPALM recipe. We have already seen a getter, the get_config()
function, in action in the Backing up your device configuration using NAPALM recipe. In this recipe, we will explore more of these functions so that we can retrieve more facts about the device we are connected to.
Getting ready
Open your code editor and create a file called gather_facts.py
. Next, in your Terminal, navigate to the same directory that you just created the gather_facts.py
file in.