ciscoconfparse.IOSConfigList Object

class ciscoconfparse.IOSConfigList(data=None, comment_delimiter='!', debug=False, factory=False, ignore_blank_lines=True, syntax='ios', CiscoConfParse=None)

A custom list to hold IOSCfgLine objects. Most people will never need to use this class directly.

Initialize the class.

Kwargs:
  • data (list): A list of parsed IOSCfgLine objects
  • comment (str): A comment delimiter. This should only be changed when parsing non-Cisco IOS configurations, which do not use a ! as the comment delimiter. comment defaults to ‘!’
  • debug (bool): debug defaults to False, and should be kept that way unless you’re working on a very tricky config parsing problem. Debug output is not particularly friendly
  • ignore_blank_lines (bool): ignore_blank_lines defaults to True; when this is set True, ciscoconfparse ignores blank configuration lines. You might want to set ignore_blank_lines to False if you intentionally use blank lines in your configuration (ref: Github Issue #2).
Returns:
append(val)

S.append(object) – append object to the end of the sequence

config_heirarchy()

Walk this configuration and return the following tuple at each parent ‘level’:

(list_of_parent_sibling_objs, list_of_nonparent_sibling_objs)
count(value) → integer -- return number of occurrences of value
extend(values)

S.extend(iterable) – extend sequence by appending elements from the iterable

index(value) → integer -- return first index of value.

Raises ValueError if the value is not present.

insert(ii, val)

S.insert(index, object) – insert object before index

pop([index]) → item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(value)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE