Oct-17-2018, 01:08 PM
Got to know its getting failed here...
def macGrabber(child,switch,cat = False): try: if cat is False: child.expect('.#') child.sendline('sh mac address-table | no-more') else: child.sendline('sh mac address-table dynamic | i Gi') child.expect('.#', timeout=3000) except pexpect.TIMEOUT: print child.before,child.after child.close() raise macs = child.before child.close() macs = macs.splitlines() print('Connection to %s CLOSED' % switch) return macsCan we set a retry here ?