Exemplo n.º 1
0
    def lock_engage(self, reason):
        mode = lib.get_apollo_mode()
        if mode is 'DEBUG':
            logger.info('Debug mode, lock will be dismissed')
            self.reset_counts()
            return lib.PASS
        else:
            for i in range(3):
                questions = 'Too many FAILS because of {},Stop testing and contact TE now!'.format(
                    reason)
                check_answer = lib.ask_question(question=questions,
                                                picture_path='images/fail.jpg',
                                                picture_size='small',
                                                timeout=1000)

                if 'debug' in check_answer:
                    self.faillock_debug_menu()
                    return lib.PASS

                elif config_fail_lock.password in check_answer:
                    self.reset_counts()
                    return lib.PASS

                elif check_answer not in config_fail_lock.password:
                    text = 'Wrong answer!'
                    lib.ask_question(question=text)
            else:
                logger.info('Wrong answers, count reset fail!')
                raise Exception("Wrong password! Unable to proceed test!")
Exemplo n.º 2
0
def pre_finalize():
    """
    test finalize, power off uut, disconnect uut
    :return:
    """
    config_load(save_userdict=True)
    module_load()
    try:
        lock = fail_lock.Faillock(mb_tst_info['serial_number'])
        lock.fail_count_check(lib.get_apollo_mode())
    except KeyError:
        pass
    if fixture:
        fixture.close()
        time.sleep(1)
        fixture.test_result('run')
    try:
        switch1.login()
        switch2.login()
    except Exception:
        switch1.close()
        switch2.close()
        time.sleep(2)
        switch1.login()
        switch2.login()
    return lib.PASS
Exemplo n.º 3
0
def prestep__set_test_mode():
    """Set Test Mode
    set test mode for automation monitor container, Default: DEBUG
    :return:
    """
    lib.set_apollo_mode('DEBUG')
    log.info("get_apollo_mode is {}".format(lib.get_apollo_mode()))

    return lib.PASS
Exemplo n.º 4
0
def pre_initialize():
    """
    Initialize action: power off uut, open uut console
    And load the configure file by uut_type
    :return:
    """
    logger.info('This test is being run in {} mode'.format(
        lib.get_apollo_mode()))
    userdict_init()
    config_load()
    return lib.PASS
Exemplo n.º 5
0
 def increase_stepcount(self, errmsg):
     check = self.get_data(self.serial)
     mode = lib.get_apollo_mode()
     if check is 0 and mode is not 'DEBUG':
         count = self.get_data(self.container + errmsg)
         count += 1
         self.write_data(self.container + errmsg, count)
         logger.warning('Step {0} has {1} counts'.format(errmsg, count))
     else:
         logger.info('This is a retest board!')
         pass
Exemplo n.º 6
0
def version_control():
    """
    check the script verion
    :return:
    """
    if lib.get_apollo_mode() == lib.MODE_DEBUG:
        logger.info('Skip version check if run in DEBUG mode')
        return lib.SKIPPED
    server = Server(lib.conn.SERVER, 'server')
    server.source_code_diff_check('/opt/cisco/te/scripts/projects/wnbu/trunk/',
                                  ['utils', 'product_group_1', 'libs'])
    return lib.PASS
Exemplo n.º 7
0
def main_finalize():
    """
    test finalize, disconnect switch/thermal PC, power off uut, disconnect uut
    :return:
    """
    try:
        lock = fail_lock.Faillock(mb_tst_info['serial_number'])
        lock.fail_count_check(lib.apdicts.test_info.current_status,
                              lib.get_apollo_mode())

    finally:
        if lib.apdicts.test_info.current_status != 'PASS':
            # Change the failure log path
            utils.backup_fail_log(mb_tst_info['serial_number'])
            if fixture:
                fixture.test_result('fail')
        else:
            if lib.apdicts.userdict.get(
                    'fresh_unit',
                    False) and lib.get_apollo_mode() == lib.MODE_PROD:
                logger.debug('This is fresh unit, need to run log compare')
                utils.log_compare(
                    '/opt/cisco/te/scripts/projects/wnbu/trunk/product_group_1/barbados/foc/log_cmp/',
                    config.prod_type, mb_tst_info['test_area'],
                    mb_tst_info['uut_type'], mb_tst_info['serial_number'])
            if fixture:
                fixture.test_result('pass')

        if lib.get_apollo_mode() == lib.MODE_DEBUG:
            logger.info('Skip connection close if in DEBUG mode')
            # Only close the connection and power off if run in prod mode
        else:
            uut_power_off()
            if uut:
                uut.close()
            # if fixture:
            #     fixture.open()
        lib.apdicts.userdict.clear()
    return lib.PASS
Exemplo n.º 8
0
 def passing_count(self):
     number = self.get_data(self.passkey)
     mode = lib.get_apollo_mode()
     if number < 2 and mode is not 'DEBUG':
         number += 1
         self.write_data(self.passkey, number)
         logger.info('The pass count is {}'.format(number))
     elif number >= 2 and mode is not 'DEBUG':
         self.write_data(self.container, 0)
         self.write_data(self.passkey, 0)
         self.write_data(self.timestampkey, 0)
         logger.warning('Two consecutive Pass. Fail count has been reset!')
     elif mode is 'DEBUG':
         pass
Exemplo n.º 9
0
 def increase_count(self):
     mode = lib.get_apollo_mode()
     serial = self.serial
     check = self.get_data(serial)
     logger.info('The serial check is {}'.format(check))
     if check is 0 and mode is not 'DEBUG':
         count = self.get_data(self.container)
         count += 1
         logger.warning('The count is {}'.format(count))
         self.write_data(self.container, count)
         self.write_data(self.serial, 'PASS')
     elif mode is 'DEBUG' or check is 'PASS':
         logger.warning('This is a retest board in {} mode!'.format(mode))
         pass
def version_control():
    """
    check the script verion
    :return:
    """
    step_dict, step_name = load_step_parameter(ctrl_handle=windows)
    logger.warning('Windows code check PASS!')
    if lib.get_apollo_mode() == lib.MODE_DEBUG:
        logger.info('Skip version check if run in DEBUG mode')
        return lib.SKIPPED
    windows.check_win_dll(step_dict['dll_dict'])
    windows.windows_version_ctrl(step_dict['exec_md5'])
    server = Server(lib.conn.SERVER, 'server')
    server.source_code_diff_check('/opt/cisco/te/scripts/projects/wnbu/trunk/',
                                  ['utils', 'product_group_1', 'libs'])
    return lib.PASS
Exemplo n.º 11
0
def mb_mac_program():
    """
    step1: request MAC
    step2: program MAC to uut
    step3: record MAC
    :return:
    """
    mac1, mac2, _ = request_mac(
        mb_tst_info['serial_number'], mb_tst_info['uut_type'],
        config.mac_block_size.value,
        't' if lib.get_apollo_mode() == lib.MODE_DEBUG else 'm')

    logger.info('mac1 --- [{}], mac2 --- [{}]'.format(mac1, mac2))
    config.mac_address.value = mac2.upper()
    uut.write_mb_mac()
    """
Exemplo n.º 12
0
def tst_area_check():
    """
    Areacheck test for scanned serial number; Also determine if the unit is a fresh unit or not
    :return: lib.PASS once the function passes
    """

    # if we are in debug mode, it is always seen as fresh unit
    lib.apdicts.userdict['fresh_unit'] = False
    if lib.get_apollo_mode() == lib.MODE_DEBUG:
        logger.info('Skip area check if run in DEBUG mode')
        return lib.PASS

    sn, uuttype, area = mb_tst_info['serial_number'], mb_tst_info[
        'uut_type'], mb_tst_info['test_area']
    for test_area in config.mb_test_areas:
        try:
            logger.info(
                "[{}] areacheck on serial number [{}], uut type [{}]".format(
                    test_area, sn, uuttype))
            cesiumlib.verify_area(serial_number=sn,
                                  uut_type=uuttype,
                                  area=test_area,
                                  timeframe='2y')
        except apexceptions.ServiceFailure as ex:
            if test_area == area:
                if '12101' in ex.message:  # Data not found
                    logger.info('This is a fresh unit, no record at {}'.format(
                        test_area))
                    lib.apdicts.userdict['fresh_unit'] = True
                    break
                elif '11129' in ex.message:  # Num. passes or last record check failed
                    logger.info(
                        'This is not a fresh unit, has failed record at {}'.
                        format(test_area))
                    break
            raise
        # only verify test area ahead of this current area (including this area)
        if test_area == area:
            logger.info(
                'This is not a fresh unit, has passed record at {}'.format(
                    test_area))
            break
    return lib.PASS
Exemplo n.º 13
0
def radio_mac_program():
    """
    Request mac for daughter board
    :return:
    """
    mac1, mac2, _ = request_mac(
        config.radio_sn_virtual[BAND_2G], config.radio_uuttype,
        config.r0_mac_block_size.value + config.r1_mac_block_size.value,
        't' if lib.get_apollo_mode() == lib.MODE_DEBUG else 'm')

    config.r0_mac_address.value = mac2.upper()
    # config.r1_mac_address.value = ':'.join(lib.chunk(hex(int(mac1, 16) + 16)[2:].upper(), 2))
    config.r1_mac_address.value = ':'.join(
        lib.chunk('{:012x}'.format(int(mac1, 16) + 16).upper(), 2))

    uut.write_r0_mac()
    uut.write_r1_mac()

    logger.info('MAC verification with MAC:{}, SN:{}'.format(
        mac1, config.radio_sn_virtual[BAND_2G]))
    """
Exemplo n.º 14
0
def main_initialize():
    """
    Initialize action: load module instances saved in cache
    Also load the configure file by uut_type
    :return:
    """
    logger.info('This test is being run in {} mode'.format(
        lib.get_apollo_mode()))
    userdict_init()
    config_load(save_userdict=True)
    module_load()
    userdict = lib.apdicts.userdict
    userdict['mgig_fw_need'] = config.mgig_fw_need
    userdict['led_test_need'] = config.led_test_need

    mb_tst_info['testr1name'] = 'Barbados Uboot Name'
    mb_tst_info['testr1'] = config.u_boot_image.name
    mb_tst_info['testr2name'] = 'barbados_Part1_Linux'
    mb_tst_info['testr2'] = config.mfg_image.name
    lib.add_tst_data(**mb_tst_info)

    return lib.PASS