Genie Documentation¶
Genie
is the pyATS SDK which contains all the tools
needed for Network Test Automation. Genie bundled with the modular architecture
of the pyATS framework accelerates and simplifies development
of network test automation, while leveraging all the perks of the Python
programming language and promoting the development of agnostic libraries. Genie
is redefining how network test scripters interact with devices through
libraries and avoiding functional programming.
# Import Genie
from genie import testbed
# Look at the bottom for an example of a testbed file
testbed = testbed.load('testbed.yaml')
# Find the device I want to connect to
device = testbed.devices['nx-osv-1']
# Connect to it
device.connect()
# Parse device output
output = device.parse('show version')
# Print it nicely
import pprint
pprint.pprint(output)
{'platform': {'hardware': {'bootflash': '3184776 kB',
'chassis': 'NX-OSv Supervisor Module',
'device_name': 'nx-osv-1',
'model': 'NX-OSv',
'processor_board_id': 'TM00010000B',
'slots': 'None'},
...
Genie is used internally within Cisco for automating network testing and has also been released externally through Cisco DevNet. This means that the same tests which are used internally at Cisco during product development can also be executed externally on a customer setup. This is massive news for automation within and outside of Cisco!
Don’t even need to know python to re-use its functionalities; Can be used directly in bash
genie parse "show version" --testbed-file testbed.yaml --devices nx-osv-1 --output explore1
+==============================================================================+
| Genie Parse Summary for nx-osv-1 |
+==============================================================================+
| Connected to nx-osv-1 |
| - Log: explore-1/connection_nx-osv-1.txt |
|------------------------------------------------------------------------------|
| Parsed command 'show version' |
| - Parsed structure: explore-1/nx-osv-1_show-version_parsed.txt |
| - Device Console: explore-1/nx-osv-1_show-version_console.txt |
|------------------------------------------------------------------------------|
Genie at a glance
Provides structured data by parsing devices configuration and operation data which are fully OS Agnostic (One common structure for all OS/Interface management)
Apply configuration on all Cisco devices using a common structure for all OS/Platform/Cli/Yang
Test Harness to generate testscript and re-use existing testcases
Testbed Health Status Monitoring - Supports any pyATS script and can also be used as a standalone tool
Ansible and Robot libraries https://developer.cisco.com/docs/pyats/#!integration-to-other-frameworks