Wednesday, May 19, 2021

CiscoConfParse delete child lines

I'm trying to use CiscoConfParse to modify a config. If I delete an object with child objects it leaves all the child objects in place. E.g. if I delete ip sla, it leaves all the child elements in place.

Or if I delete an interface, it leaves all the child elements e.g. (speed,duplex,description) Any idea how to fix this?

Thanks

from ciscoconfparse import CiscoConfParse
parse = CiscoConfParse('config.temp.conf', syntax='ios')
parse.delete_lines('^ip sla 100')
parse.save_as('new_config.txt')



No comments:

Post a Comment