pyats_genie_command_parse package

Submodules

pyats_genie_command_parse.pyats_genie_command_parse module

This is meant to separate out the genie parsers from Cisco pyats

It allows you to skip the testbed.yml or anything else before parsing the output data.

All that is needed to parse the data, is telling the class what NOS, what the full command is, and the output string data from the command.

class pyats_genie_command_parse.pyats_genie_command_parse.GenieCommandParse(nos)[source]

Bases: object

Class to parse string output with Genie without requiring a testbed, just parse the string data

Parameters:

nos (String) – One of the following {‘nxos’, ‘ios’, ‘iosxe’, ‘iosxr’}

Raises:

LookupError – If a supported nos is not found

class MockDevice(show_output_data: str)[source]

Bases: object

Class that is a mock device to parse

Parameters:

show_output_data (String) – The output data from the show command

execute(*args, **kwargs) str[source]

Method to execute the MockDevice

Parameters:
  • args (Arguments) – Unknown

  • kwargs (Keyword Arguments) – Unknown

Return type:

String

Returns:

The output data from the show command

parse_file(show_command: str, file_name_and_path: str) dict[source]

Method to parse a show command using a text file

Parameters:
  • show_command (String) – The show command to parse for, use full command!!

  • file_name_and_path (String) – The full path and name of the file

Return type:

Dict

Returns:

Dictionary of parsed data

Raises:
  • TypeError – if the show_command is not a string

  • FileNotFoundError – if the file you are trying to parse can’t be found

parse_string(show_command: str, show_output_data: str) dict[source]

Method to parse a show command using string data

Parameters:
  • show_command (String) – The show command to parse for, use full command!!

  • show_output_data (String) – The output data from the show command

Return type:

Dict

Returns:

Dictionary of parsed data

Raises:
  • TypeError – if the show_command is not a string

  • TypeError – if the show_output_data is not a string

supported_nos = {'aireos', 'apic', 'asa', 'bigip', 'cheetah', 'comware', 'dnac', 'gaia', 'ios', 'iosxe', 'iosxr', 'ironware', 'junos', 'linux', 'nxos', 'sros', 'viptela'}

Module contents

init for pyats_genie_command_parse