def main(): logging.log(25, '=' * 80) logging.log(25, 'Starting new testing cycle!') logging.log(25, '-' * 80) dev_list = [HL3_11, HL3_12] fault = False iteration = 1 while fault is not True: print ' ' logging.log(25, '-' * 80) logging.log(25, 'Test Iteration [{}].'.format(iteration)) logging.log(25, '-' * 80) for router in dev_list: print ' ' dev = JU.connect(router['mgmt'], user='******', password='******', facts=False) logging.log(25, 'Connected to [{}]. Checking for trouble.'.format(dev.facts['hostname'])) logging.log(25, '-' * 80) broken_instances = get_vpls_broken(dev) if len(broken_instances) > 0: # If we are broken at the first iteration, let's clean up. if iteration == 1: print ' ' logging.error('Found broken instances in first iteration. Setup is not clean!') logging.error('Procceding to clear mac table for broken instances.') clear_vpls_mac_table(dev, broken_instances) continue fpc_list = get_fpc_list(dev) get_bd_index(dev, broken_instances) get_re_mac_list(dev, broken_instances) get_hw_mac_list(dev, fpc_list, broken_instances) fault = True else: logging.log(25, 'Found no MAC stuck events on [{}]. Happy days!'.format(dev.facts['hostname'])) print '\n' if fault is True: logging.log(25, 'Replication complete. Happy troubleshooting!') logging.log(25, 'Use <vmc_clean.py> to clean up.') break elif iteration == 200: logging.log(25, "Could not replicate in 200 Iterations. Something is not working") logging.log(25, 'Simulating node down for [{}].'.format(dev.facts['hostname'])) JU.Configure(dev, "set interfaces lo0 disable \n") time.sleep(30) logging.log(25, 'Simulating node up for [{}].'.format(dev.facts['hostname'])) JU.Configure(dev, "delete interfaces lo0 disable \n") wait_time = 120 logging.log(25, 'Will wait [{}] seconds for things to reconverge.'.format(wait_time)) time.sleep(wait_time) iteration += 1
def main(): logging.log(25, 'Running <clean> mode. Will clean any stale MACs in the setup.') dev_list = [HL3_11, HL3_12] for router in dev_list: print ' ' dev = JU.connect(router['mgmt'], user='******', password='******', facts=False) logging.log(25, 'Connected to [{}]. Checking for trouble.'.format(dev.facts['hostname'])) logging.log(25, '-' * 80) broken_instances = get_vpls_broken(dev) if len(broken_instances) > 0: # If we are broken, let's clean up. logging.error('Found broken instances!') logging.error('Procceding to clear mac table for broken instances.') clear_vpls_mac_table(dev, broken_instances) else: logging.log(25, 'Found no MAC stuck events on [{}]. Happy days!'.format(dev.facts['hostname']))