def add_tst_data():
    """
    To provide the required serial number, container, pid, and test area for tst logging. <0_0>
    :return: lib.PASS or lib.FAIL
    """
    # Create a STATIONCAL SN
    lib.add_tst_data(serial_number='STATIONCAL{}'.format(mb_tst_info['slot']), test_area='PCBPM2',
                     product_id='STATIONCAL', test_container=lib.get_my_container_key().split('|')[-1])
    return lib.PASS
def add_tst_data():
    """
    To provide the required serial number, container, pid, and test area for tst logging.
    :return: lib.PASS or lib.FAIL
    """
    # Logging TST data for MB
    logger.info(
        'Sernum: {}, Uuttype: {}, Area: {}, container: {}, slot:{}'.format(
            mb_tst_info['serial_number'], mb_tst_info['uut_type'],
            mb_tst_info['test_area'], mb_tst_info['test_container'],
            mb_tst_info['slot']))
    lib.add_tst_data(**mb_tst_info)
    return lib.PASS
Exemple #3
0
def auto_record():
    """Auto Record
    record for monitor container, set dummy SN and uut type on here.
    :return:
    """
    area = lib.get_pre_sequence_info().areas[0]
    container = lib.get_pre_sequence_info().containers[0]
    system_tst_data = dict(
        serial_number='FOCAUTOMAIN',
        uut_type='73-AUTOM-AN',
    )

    lib.add_tst_data(test_area=area,
                     test_container=container,
                     **system_tst_data)

    return lib.PASS
Exemple #4
0
def run_single_pid():
    """ Run Single PID
    :return:
    """
    log.debug(
        "Run single PID in pre-sequence used to automatically start a single container."
    )
    info = lib.get_pre_sequence_info()
    areas = info.areas

    if len(areas) != 1:
        return lib.FAIL, "Only a single area can be handled by the pre-sequence 'run_single_pid'."

    containers = info.containers

    if len(containers) != 1:
        return lib.FAIL, "Only a single container can be handled by the pre-sequence 'run_single_pid'."

    area = areas[0]
    pids = info.pids_by_area(area)

    log.debug('areas: {}'.format(areas))
    log.debug('PIDS: {}'.format(pids))
    log.debug('containers: {}'.format(containers))

    if len(pids) == 0:
        return lib.FAIL, "There is no PID assigned to this container."

    if len(pids) != 1:
        return lib.FAIL, "Only a single PID can be handled by the pre-sequence 'run_single_pid'."

    # All is well let us kick this off
    container = containers[0]
    pid = pids[0]
    serial_number = str(uuid.uuid4().fields[-1])[:11]
    log.debug(
        "Pre-sequence single_pid: serial_number={0}, container={1}, uuttype={2}"
        .format(serial_number, container, pid))
    lib.add_tst_data(serial_number=serial_number,
                     test_container=container,
                     uut_type=pid,
                     test_area=area)
    return lib.PASS
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
Exemple #6
0
    def add_tst_data_for_children(self, **kwargs):
        """ Add TST Data for Children (step)

        This step generates tst record for components in system (children). It covers PSU and and device shows up in
        PCAMAPS, which includes Uplink module, Data Stack cable, etc.

        PSU data is from diags.get_psu, saved in uut_config['psu_info'] in previous step.
        PCAMAP data includes device instance defined in uut_config['pcamap_items_for_tst'].

        :param kwargs:
        :return:
        """
        def _map_to_tst(data, keymap):
            # Input check
            if not isinstance(data, dict) or not isinstance(keymap, dict):
                raise Exception('Input error, data and keymap must be dicts')

            ret = {}
            for key, value in data.iteritems():
                if keymap.get(key) and value != '0':
                    ret[keymap.get(key)] = value if keymap.get(
                        key) != 'eci' else int(value)

            return ret

        aplib.set_container_text('ADD TST DATA')
        log.info('STEP: Add TST Data For Children.')

        # Input processing
        major_line_id = self._ud.uut_config.get('major_line_id', 0)
        backflush_status = kwargs.get(
            'backflush_status',
            self._ud.uut_config.get('backflush_status', 'NO'))
        pcamap_to_tst_keymap = self._ud.uut_config.get('pcamap_to_tst_keymap',
                                                       {})
        psu_to_tst_keymap = self._ud.uut_config.get('psu_to_tst_keymap', {})
        pcamap_dev_list = self._ud.uut_config.get('pcamap_items_for_tst', [])
        pcamaps = self._ud.uut_config.get('pcamaps', {})
        if not pcamap_to_tst_keymap or not psu_to_tst_keymap or not pcamap_dev_list:
            log.error('Required Input missing')
            log.error(
                'Make sure pcamap_to_tst_keymap, psu_to_tst_keymap, pcamap_dev_list are '
                'all defined in product definition')
            return aplib.FAIL
        if not pcamaps:
            log.error('PCAMAPS is missing in uut_config')
            log.error('Make sure pcamaps is populated before this step')
            return aplib.FAIL

        # PSU data
        psu_data = self._ud.uut_config.get('psu_info', {}).values()

        # PCAMAP data
        pcamap_data = [
            value for key, value in pcamaps.iteritems()
            if key in pcamap_dev_list
        ]

        # Generate add_tst_data dict and add tst data
        for item in psu_data:
            tst_dict = _map_to_tst(data=item, keymap=psu_to_tst_keymap)
            if tst_dict:
                tst_dict['lineid'] = major_line_id
                tst_dict['backflush_status'] = backflush_status
                log.info('Add tst data for {0}'.format(tst_dict))
                aplib.add_tst_data(**tst_dict)
        for item in pcamap_data:
            tst_dict = _map_to_tst(data=item, keymap=pcamap_to_tst_keymap)
            if tst_dict:
                tst_dict['lineid'] = major_line_id
                tst_dict['backflush_status'] = backflush_status
                log.info('Add tst data for {0}'.format(tst_dict))
                aplib.add_tst_data(**tst_dict)

        return aplib.PASS