The networking_cisco.plugins.cisco.common.htparser Module

class networking_cisco.plugins.cisco.common.htparser.HTParser(cfg)

Bases: object

A simple hierarchical text parser.

Indents in the text are used to derive parent child hierarchy.

find_children(linespec)

Find lines and immediate children that match the linespec regex.

Parameters:linespec – regular expression of line to match
Returns:list of lines. These correspond to the lines that were matched and their immediate children
find_lines(linespec)

Find lines that match the linespec regex.

find_objects(linespec)

Find lines that match the linespec regex.

Parameters:linespec – regular expression of line to match
Returns:list of LineItem objects
class networking_cisco.plugins.cisco.common.htparser.LineItem(line)

Bases: object

add_children(child)
re_match(regex, group=1, default=”)
re_search_children(linespec)
str_list()