Example #1
0
def clear_vpls_mac_table(dev, broken_instances):
    cmd_list = []
    for instance in broken_instances:
        cmd = 'clear vpls mac-table instance {}'.format(instance.name)
        cmd_list.append(cmd)
    logging.error('Clearing mac table for broken instances.')
    JU.run_cli(dev, cmd_list)
Example #2
0
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, 'Restarting FPCs on [{}].'.format(dev.facts['hostname']))
        fpc_list = get_fpc_list(dev)
        for fpc in fpc_list:
            JU.run_cli(dev, 'request chassis fpc slot {} restart'.format(fpc.slot))
        wait_time = 240
        logging.log(25, 'Will wait [{}] seconds for things to reconverge.'.format(wait_time))
        time.sleep(wait_time)
        iteration += 1
Example #3
0
def clear_all_vpls_macs(dev):
    logging.log(25, 'Clearing mac table for ALL instances.')
    JU.run_cli(dev, 'clear vpls mac-table')