Parsing Both Tabular and Non-Tabular Output¶
For CLI command outputs that have both tabular and non-tabular components, it is possible to use both kinds of parsers. Please refer to the following example.
Putting It All Together¶
Please see the following downloadable file for instructions on how to run a sample pyATS job that does the following:
Connects to a router in your testbed
Runs a “show interface” command
Parses output using conventional cAAs/TCL parser
Runs the same “show interface” command again
Parses output using parsergen
Compares the results of each parser.
Runs a parse/compare operation against a small set of selected keys.
Runs a “show arp” command
Parses the output using parsergen
Standalone Parsing¶
It is also possible to run parsergen
in standalone mode.
In this model, all interactions with the device under test and the tcl
interpreter are “mocked”, meaning that while the parser thinks it is
talking to a real device and a real TCL interpreter, it is really talking
to mocks that are under the user’s complete control. The advantage is that a
parser can be tested with a variety of different kinds of inputs in an
incredibly swift manner because there is no requirement to have a real
device up and running.
Here’s an example of running the non-tabular parser in standalone mode:
nontabular_parser_xrvr.py
.
Here’s an example of running the tabular parser in standalone mode:
tabular_parser_subclass.py
.