In this lesson, we will cover:

  • What is Genie Learn?
  • How to run Genie learn the command line.
  • How to run Genie learn using Python.

The scripts and code for this lesson can be found within the pyATS repo under the directory: 003_genie/learn/.

What is Genie Learn?

Genie learn:

provides a representation of the current operational state of a device, per feature (protocol). It "learns" the operational state by executing a series of commands and parsing the output into a common data structure across different operating systems.

For example, let’s say we want to learn about OSPF on a Cisco IOS-based device. Genie would collect output from the device (for the following commands), parse the outputs, and aggregate them into a single data structure.

show ip protocols
show ip ospf
show ip ospf mpls ldp interface
show ip ospf mpls traffic­eng link
show ip ospf virtual­links
show ip ospf sham­links
show ip ospf interface
show ip ospf database topology
show ip ospf database router
show ip ospf database network
show ip ospf database summary
show ip ospf database external
show ip ospf database opaque­area
show ip ospf database opaque­as
show ip ospf database opaque­link
show ip ospf neighbor detail

How does Genie know what commands to use when we perform a learn for a given protocol/feature? Also, what defines how Genie constructs the single data structure from the output of all of the commands? This is achieved via the Genie Ops models. These models map which commands to run for a given protocol/feature and define the Ops structure.

Ready to Master Network Automation? Start Your Journey Today!
Our membership provides:
  • Full deep-dive course library (inc. Batfish, pyATS, Netmiko)
  • Code repositories inc. full course code, scripts and examples
  • 24x7 multi-vendor labs (Arista, Cisco, Juniper)
  • Private online community
  • Live monthly tech sessions
  • Access to tech session library

Join Now ➜
Close You've successfully subscribed to Packet Coders.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.