コード例 #1
0
def cap_slot_status():
    """Capture slot status
    capture slot status from  cached data 'slot_status' and sync up to '/tftpboot/slot_status/slot_status'
    :return:
    """
    time.sleep(1)
    log.info('record Slot Status lock...')
    with locking.named_priority_lock(lockname='slot_status_lock',
                                     release_timeout=60,
                                     wait_timeout=30 * 60):
        slot_status = lib.get_cached_data('slot_status')
        log.debug('Current status ')
        log.debug('******************')
        for i in range(1, 9):
            log.info('{}'.format(slot_status[(i - 1) * 12:i * 12]))
        log.debug('******************')
        slot_status_file = r'/tftpboot/slot_status/slot_status'
        return_slot_status = ''
        with open(slot_status_file, 'w') as f:
            f.close()
        for ctr in slot_status:
            if ':8-12' in ctr:
                return_slot_status += ctr
            else:
                return_slot_status += ctr + ','
            os.system('echo {} >> {}'.format(ctr, slot_status_file))
    # log.info('return {}'.format(return_slot_status))
    return return_slot_status
コード例 #2
0
def auto_get_model():
    """Get Uut type model
    Get automation flag in pre-sequences.
    :return:
    """
    mm = lib.apdicts.userdict['mm']
    uuttype = mm.uut_config.get('MODEL_NUM', 'NA')
    # TODO: re-design for no hardcode
    uuttype_maps = {
        "WS-C3850-24T": "1",
        "WS-C3850-48T": "2",
        "WS-C3850-24P": "3",
        "WS-C3850-48P": "4",
        "WS-C3850-24U": "5",
        "WS-C3850-48U": "6",
        "WS-C3850-12S": "7",
        "WS-C3850-24S": "8",
        "WS-C3850-24XU": "9",
        "WS-C3850-12X48U": "A",
        "WS-C3850-12XS": "B",
        "WS-C3850-24XS": "C",
    }
    uut_type = uuttype_maps[uuttype]

    slot = "{}-{}".format(
        int(lib.get_my_container_key().split('|')[-1].split('_')[0][-2:]),
        int(lib.get_my_container_key().split('|')[-1].split('_')[1][:2]))
    status = "{}TEST{}".format(
        uut_type,
        lib.get_cached_data('slot_status')[slot_index[slot]].split(':')[0][-1])
    log.info('{}:{}'.format(status, slot))
    change_slot_status(slot, status)

    return
コード例 #3
0
ファイル: steps_ess_chamber.py プロジェクト: setlu/entsw_dev
def get_global_corners(container_key=None):
    """ Get Corners
    This is strictly a read of the global cache; therefore no locking required.
    IMPORTANT: This is done by sequence_definition() so MUST be compatible with Apollo main process.
               Global cache key is the station path (i.e. chamber).
    :return:
    """
    log.debug("Global Corners: get...")
    if not container_key:
        log.debug("Need to get container key...")
        container_key = aplib.get_my_container_key()
    S_KEY = '_'.join(container_key.split('|')[:-1])
    cc_key = 'chamber_corners_' + S_KEY
    try:
        log.debug("Chamber corner cache key (get) = {0}".format(cc_key))
        corners = aplib.get_cached_data(cc_key)
    except (KeyError, apexceptions.ApolloException) as e:
        log.exception("Problem with chamber corners in global cache.")
        log.exception(e.message)
        corners = None

    if not corners:
        log.error("Chamber corners: ABSENT!")
        log.error("Global cache key = {0}".format(cc_key))
        log.error(
            "Please correct the situation before running the chamber.  Inspect UUT product definitions."
        )
        raise apexceptions.AbortException("Chamber corners: ABSENT!")
    else:
        log.debug("Chamber corners: PRESENT.")
    return corners
コード例 #4
0
def automatic_clear_pre():
    """Automatic Clear Pre
    Clear slot status in pre-sequences
    pass pre-sequences uuts, clear auto_pass in userdict
    fail pre-sequences uuts, record status in local with SN, FAIL steps,
    :return:
    """
    mm = lib.apdicts.userdict['mm']
    current_sernum = mm.uut_config.get('SYSTEM_SERIAL_NUM', 'NOPOWERON')
    # Get Step dict
    current_status, steps_ret = auto_get_test_status()
    slot = "{}-{}".format(
        int(lib.get_my_container_key().split('|')[-1].split('_')[0][-2:]),
        int(lib.get_my_container_key().split('|')[-1].split('_')[1][:2]))
    slot_status = lib.get_cached_data('slot_status')
    slot_info = slot_status[slot_index[slot]]
    uut_type = slot_info[0]
    if current_status != 'PASS':
        status = '{}{}{}'.format(uut_type, current_status,
                                 slot_info.split(':')[0][-1])
        change_slot_status(slot, status)
        for k, v in steps_ret.items():
            if 'FAIL' in v:
                local_record(current_sernum, slot, status, k)

    return
コード例 #5
0
def standard_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        pass
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pl = udd.get('product_line').upper()
    seq_module = getattr(thismodule, pl + '_sysft')
    return seq_module.standard_switch_sequence_definition()
コード例 #6
0
def step__queue_children():
    ACTIVECS_KEY, MAXCS_KEY = steps_ess_chamber.get_chamber_slots_keys()
    uut_slots = aplib.get_cached_data(ACTIVECS_KEY)
    log.debug('Chamber slots staged: {0}'.format(uut_slots))
    supercontainer = aplib.get_container_name()
    for i, uut_slot in enumerate(uut_slots):
        container_name = '{0}:UUT{1:02}'.format(supercontainer, uut_slot)
        log.debug("Queued Conatiner = {0}".format(container_name))
        aplib.queue_child_container(container_name, test_area=__area__)
    return aplib.PASS
コード例 #7
0
def eng_utility_menu_sequence_definition():
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(aplib.get_my_container_key()))
    pf = udd.get('product_family').upper()
    seq = aplib.get_sequence_definition('{0} {1} SEQ ENG MENU DEBUG'.format(__product_line__, pf), jump_on_error='FINAL')
    if pf in SEQ_STEP_MAP:
        func = getattr(thismodule, SEQ_STEP_MAP[pf].seq_function_name)
        return func(seq, pf, udd)
    else:
        seq.add_step(err_product_family, kwargs={'pf': pf})
        seq.add_step(steps_catalyst.final, name='FINAL')
    return seq
コード例 #8
0
ファイル: sysft.py プロジェクト: setlu/entsw_dev
def standard_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, __area__),
                                        jump_on_error='FINAL')

    # ------------------------------------------------------------------------------------------------------------------
    # Init
    init_seq = seq.add_sequence('INITIALIZATION')
    init_seq.add_step(steps_quake.init, name='INIT', kwargs={})
    init_seq.add_step(steps_quake.ud_retrieve, name="RETRIEVE UUT DESCRIPTOR")
    init_seq.add_step(steps_quake.ud_print_uut_descriptor,
                      name='PRINT DESCRIPTOR')
    init_seq.add_step(steps_quake.ud_print_uut_config, name='PRINT UUT CONFIG')

    # Power ON & Boot
    # Unit should already be powered up from pre-sequence auto-discovery.
    seq.add_step(steps_quake.power_cycle_on,
                 name='POWER ON BOOT',
                 group_level=5,
                 enabled=False)

    # Basic Mode
    seq.add_step(steps_quake.goto_mode,
                 name='MODE IOS',
                 kwargs={'mode': 'IOS'})

    # PIDVID Verify
    seq.add_step(steps_quake.process_verify_pidvid,
                 name='PIDVID VERIFY',
                 jump_on_error='CLEAN UP')

    # ------------------------------------------------------------------------------------------------------------------
    #
    # PUT CODE HERE
    #

    # ------------------------------------------------------------------------------------------------------------------
    # Clean up
    final_seq = seq.add_sequence('FINAL', finalization=True)
    final_seq.add_step(steps_quake.power_off,
                       name='POWER OFF',
                       kwargs={},
                       group_level=1000)
    final_seq.add_step(steps_quake.clean_up, name='CLEAN UP')
    final_seq.add_step(steps_quake.final, name='END')

    return seq
コード例 #9
0
    def on(self, **kwargs):
        """ ON
        :param kwargs:
        :return:
        """
        channels = kwargs.get('channels', 'ALL')
        wait_for_boot = kwargs.get('wait_for_boot', True)

        bypass = False
        container_key = aplib.get_my_container_key()
        log.info('CONTAINER_KEY:')
        log.info('{0}'.format(container_key))
        container = container_key.split("|")[-1]
        pl, ar, ts, _ = container_key.split("|", 3)

        # 1. Check for power dependencies
        if self._ud.category == 'MODULAR':
            active_modular_name = '_'.join([pl, ar, ts, 'ActiveModular'])
            with locking.ContainerPriorityLock('__active_modular__'):
                active_modular = aplib.get_cached_data(active_modular_name)
                if not active_modular:
                    log.error("No active modular stations; please activate a UUT for allocation.")
                    return aplib.FAIL
                if container == active_modular[0] and self._uut_conn.status != aplib.STATUS_OPEN:
                    log.debug("Modular; primary connection for power on.")
                    bypass = False
                else:
                    log.debug("Modular; shared connection and/or connection already open.")
                    bypass = True

        # 2. Skip power if allowed
        if bypass:
            log.info("BYPASS: No power cycle.")
            return aplib.PASS

        # 3. Perform the power operation !!
        self.__power_operation(op='ON', channels=channels)

        # 4. UUT Boot process
        if not wait_for_boot:
            log.warning("Skip standard wait for boot after power on.")
            return aplib.PASS
        aplib.set_container_text('BOOT')
        log.info('Booting up unit')
        # Standard search for bootup after a power cycle.
        time.sleep(5.0)
        result, _ = self._mode_mgr.wait_for_boot()

        # NOTE: If the UUT is hardwired for "constant on" then this has no effect.
        return aplib.PASS if result else (aplib.FAIL, 'UUT wait for boot did not complete.')
コード例 #10
0
ファイル: pcbst.py プロジェクト: setlu/entsw_dev
def standard_switch_sequence_definition():
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(
        aplib.get_my_container_key()))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, __desc__),
                                        jump_on_error='FINAL')
    if pf in SEQ_STEP_MAP:
        func = getattr(thismodule, SEQ_STEP_MAP[pf].seq_function_name)
        return func(seq, pf, udd)
    else:
        seq.add_step(step__unknown, kwargs={'pf': pf})
        seq.add_step(steps_catalyst.final, name='FINAL')
    return seq
コード例 #11
0
ファイル: sysft.py プロジェクト: setlu/entsw_dev
def standard_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(__product_line__, pf, pc, __desc__), jump_on_error='FINAL')
    # -------
    subseq__init(seq)
    #
    # PUT DF SEQ HERE !
    #
    subseq__final(seq)
    return seq
コード例 #12
0
    def off(self, **kwargs):
        """ OFF
        :param kwargs:
        :return:
        """
        channels = kwargs.get('channels', 'ALL')

        container_key = aplib.get_my_container_key()
        log.info('CONTAINER_KEY:')
        log.info('{0}'.format(container_key))
        pl, ar, ts, _ = container_key.split("|", 3)

        # 1. Check for power dependencies
        if self._ud.category == 'MODULAR':
            active_modular_name = '_'.join([pl, ar, ts, 'ActiveModular'])
            with locking.ContainerPriorityLock('__active_modular__'):
                active_modular = aplib.get_cached_data(active_modular_name)
                if active_modular:
                    if len(active_modular) > 1:
                        log.debug("More than one modular UUT container is active; cannot power off.")
                        log.debug("Active: {0}".format(active_modular))
                        return aplib.SKIPPED
                    elif len(active_modular) == 1:
                        log.debug("One active modular container left; stay powered on.")
                        log.debug("Active: {0}".format(active_modular))
                        return aplib.SKIPPED
                    else:
                        log.debug("NO active modular containers!")
                        log.debug("Power OFF is allowed.")

        # 2. Determine OFF state
        if self._ud.keep_connected:  # or aplib.get_apollo_mode() == aplib.MODE_DEBUG:
            log.warning("*" * 50)
            log.warning("UUT CONNECTION IS STILL OPEN.\n"
                        " This can occur on an error, on abort, or intentionally by script.\n"
                        " If this connection is used by a different container, it will fail to start until"
                        " the connection is manually closed.\n"
                        " The connection is typically left in this state for production debug.\n"
                        " Close the connection when done OR restart this same container.")
            log.warning("*" * 50)
            return aplib.PASS

        # 3. Perform the power operation !!
        self.__power_operation(op='OFF', channels=channels)
        return aplib.PASS
コード例 #13
0
ファイル: sup_pcbp2.py プロジェクト: setlu/entsw_dev
def standard_modular_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, __desc__),
                                        jump_on_error='FINAL')
    if pf in SEQ_STEP_MAP:
        func = getattr(thismodule, SEQ_STEP_MAP[pf].seq_function_name)
        return func(seq, pf, udd, container)
    else:
        seq.add_step(err_product_family, kwargs={'pf': pf})
        seq.add_step(steps_catalyst.final, name='FINAL')
    return seq
コード例 #14
0
def step__clean_up():
    """ Main SEQ PASS update status
    :return (str): aplib.PASS/FAIL
    """
    if 'auto_pass' in lib.apdicts.userdict:
        slot = "{}-{}".format(
            int(lib.get_my_container_key().split('|')[-2][-2:]),
            int(lib.get_my_container_key().split('|')[-1][-2:]))
        slot_status = lib.get_cached_data('slot_status')
        slot_info = slot_status[slot_index[slot]]
        uut_type = slot_info[0]
        if lib.apdicts.userdict['auto_pass']:
            status = '{}PASS{}'.format(uut_type, slot_info.split(':')[0][-1])
        else:
            status = '{}FAIL{}'.format(uut_type, slot_info.split(':')[0][-1])

        change_slot_status(slot, status)
    return
コード例 #15
0
    def _linecard_sup_release(self, label=''):
        """ Linecard Supervisor Release (INTERNAL)

        Use this to release the lock on the SUP which is used for linecard testing.
        :return:
        """
        # Station path (MUST be associated to ONE CHASSIS!!)
        container_key = aplib.get_my_container_key()
        container = container_key.split("|")[-1]
        pl, ar, ts, _ = container_key.split("|", 3)
        sup_num = self.ud.uut_config.get('linecard', {}).get('sup_prime', 1)

        # Sup resource
        sup_resource_name = '_'.join(
            [pl, ar, ts, 'SupLinecardResource_supslot{0}'.format(sup_num)])
        active_name = '_'.join([pl, ar, ts, 'ActiveModular'])
        log.info("Linecard's Sup Lock Resource: {0} (for {1})".format(
            sup_resource_name, label))

        sup_lock = getattr(self.ud, 'sup_lock')
        if not sup_lock:
            log.info("The sup lock resource does not exist.")
            log.info("Nothing to release.")
            log.warning(
                "This could be an error in the sequence not first locking the sup for the container."
            )
            return False
        else:
            try:
                # Provide a status.
                active_linecards = aplib.get_cached_data(active_name)
                if active_linecards and container in active_linecards:
                    log.info("This container is active.")
            except Exception as e:
                log.warning(e)

            # Release it!
            self.ud.sup_lock.release()
            log.info("*** SUP LOCK RELEASED! ***")
        return True
コード例 #16
0
def auto_finish(serial=None, steps=''):
    """Automatic Finish
    record test status Pass/Fail in local file
    :return:
    """
    current_status, steps_ret = auto_get_test_status()
    slot = "{}-{}".format(
        int(lib.get_my_container_key().split('|')[-1].split('_')[0][-2:]),
        int(lib.get_my_container_key().split('|')[-1].split('_')[1][:2]))
    slot_status = lib.get_cached_data('slot_status')
    slot_info = slot_status[slot_index[slot]]
    uut_type = slot_info[0]
    status = "{}{}{}".format(uut_type, current_status,
                             slot_info.split(':')[0][-1])
    if current_status != 'PASS':
        for k, v in steps_ret.items():
            if 'FAIL' in v:
                steps = k
    local_record(serial, slot, status, steps)
    change_slot_status(slot, status)

    return
コード例 #17
0
def change_slot_status(slot, status, skip_error=True):
    """Change Slot Status
    Change slot status in local file
    :param slot:
    sample: Station_B_01 = 1-1: first 1 is Rack number , second 1 is Cell number
    :param status:
    sample: status: Pass, Fail1, Fail2, Idel.
    pass: product_name,1-1,Pass
    Fail1: product_name,1-1,Fail1,num-num.   #num-num:re-test cell
    Fail2: product_name,1-1,Fail2
    IDEL:
    :param skip_error:
    :return:
    """
    log.info('{} {} change lock...'.format(slot, status))
    with locking.named_priority_lock(lockname='slot_status_lock',
                                     release_timeout=60,
                                     wait_timeout=30 * 60):
        slot_status = lib.get_cached_data('slot_status')
        log.debug('>>>>> ')
        for i in range(1, 9):
            log.info('{}'.format(slot_status[(i - 1) * 12:i * 12]))
        log.debug('>>>>> '.format(slot_status))
        if 'ERRO' in slot_status[slot_index[slot]] and skip_error:
            log.debug('ERROR cannot change')
        else:
            if "ERRO" in status:
                status = "0ERRO1"
            slot_status[slot_index[slot]] = "{}:{}".format(status, slot)
            lib.cache_data('slot_status', slot_status)
        log.debug('<<<<< ')
        for i in range(1, 9):
            log.info('{}'.format(slot_status[(i - 1) * 12:i * 12]))
        log.debug('<<<<< ')
    cap_slot_status()
    log.info('Change local OK')
    return True
コード例 #18
0
def standard_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, __desc__),
                                        jump_on_error='FINAL')
    # -------
    subseq__init(seq)

    # Area Check
    seq.add_step(steps_edison.process_area_check,
                 name='AREACHECK',
                 kwargs={'previous_area': 'SYSASSY'},
                 enabled=True,
                 jump_on_error='FINAL')

    seq.add_step(steps_edison.goto_mode,
                 name='MODE BTLDR INIT',
                 kwargs={'mode': 'BTLDR'})
    seq.add_step(steps_edison.pcamap_read_uut, name='READ UUT INFO')
    seq.add_step(steps_edison.process_verify_cmpd,
                 name='VERIFY CMPD',
                 kwargs={'eco_type': 'VERIFICATION'})
    seq.add_step(steps_edison.process_get_swpid_from_lineid,
                 name='GET IOS PID')
    seq.add_step(steps_edison.ios_get_software_licenses,
                 name='GET SW LICENSES')
    # seq.add_step(steps_edison.process_assign_verify_mac, name='VERIFY MAC')
    seq.add_step(steps_edison.process_populate_dsc_pcamap,
                 name='LOAD DSC PCAMAP',
                 kwargs={'source_testarea': ['SYSINT', 'SYSASSY']})
    seq.add_step(steps_edison.process_verify_clei_eci_label,
                 name='VERIFY CLEI LABEL',
                 kwargs={'source_testarea': ['SYSINT', 'SYSASSY']})
    seq.add_step(steps_edison.ios_download_images, name='PREPARE IOS IMAGES')

    # Bootloader mode
    seq.add_step(steps_edison.goto_mode,
                 name='MODE BTLDR',
                 kwargs={'mode': 'BTLDR'})
    seq.add_step(steps_edison.upgrade_btldr, name='UPGRADE BTLDR')
    # Program Top Level PID
    seq.add_step(steps_edison.pcamap_program_toplevel_pid,
                 name='PROGRAM TOP LEVEL PID')

    # Linux Mode
    seq.add_step(steps_edison.goto_mode,
                 name='MODE LINUX',
                 kwargs={
                     'mode': 'LINUX',
                     'do_primary_mount': True
                 })
    seq.add_step(steps_edison.linux_set_terminal_width,
                 name='SET TERMINAL WIDTH')
    seq.add_step(steps_edison.ios_remove_default_licenses,
                 name='DELETE DEFAULT LICENSES')
    seq.add_step(steps_edison.ios_install_supplemental_images,
                 name='INSTALL SUPP IMAGES')
    seq.add_step(steps_edison.load_hw_images,
                 name='DOWNLOAD DIAG IMAGE',
                 kwargs={'master_list': ['diag']})

    # Verify MCU -----------------
    mcu_vrfy_subseq = seq.add_sequence('VERIFY MCU')
    mcu_vrfy_subseq.add_step(steps_edison.goto_mode,
                             name='MODE STARDUST - VERIFY MCU',
                             kwargs={'mode': 'STARDUST'})
    mcu_vrfy_subseq.add_step(steps_edison.upgrade_mcu,
                             name='VERIFY MCU',
                             kwargs={'verify_only': True})

    # Get PSU data----------------
    seq.add_step(steps_edison.diags_psu_check, name='GET PSU INFO')
    # ----------------------------

    # Quack DSC ------------------
    quack_dsc_subseq = seq.add_sequence(
        'QUACK DATA STACK CABLE', precondition='userdict.get("dsc_installed")')
    quack_dsc_subseq.add_step(steps_edison.goto_mode,
                              name='MODE STARDUST - QUACK DSC',
                              kwargs={'mode': 'STARDUST'})
    quack_dsc_subseq.add_step(steps_edison.pcamap_write_uut_peripheral,
                              name='WRITE DSC PCAMAP DEV 2',
                              kwargs={'device_instance': '2'})
    quack_dsc_subseq.add_step(steps_edison.pcamap_write_uut_peripheral,
                              name='WRITE DSC PCAMAP DEV 3',
                              kwargs={'device_instance': '3'})
    quack_dsc_subseq.add_step(steps_edison.quack2_sign_chip,
                              name='QUACK DSC 2',
                              kwargs={'device_instance': '2'})
    quack_dsc_subseq.add_step(steps_edison.quack2_sign_chip,
                              name='QUACK DSC 3',
                              kwargs={'device_instance': '3'})
    quack_dsc_subseq.add_step(steps_edison.diags_stackrac_test,
                              name='STACK RAC TEST')
    # ----------------------------

    # Config check ---------------
    cnf_chk_subseq = seq.add_sequence('CONFIG CHECK')
    cnf_chk_subseq.add_step(steps_edison.pcamap_read_uut,
                            name='READ DEV 1',
                            kwargs={'device_instance': 1})
    cnf_chk_subseq.add_step(steps_edison.pcamap_read_uut,
                            name='READ DEV 2',
                            kwargs={'device_instance': 2})
    cnf_chk_subseq.add_step(steps_edison.pcamap_read_uut,
                            name='READ DEV 3',
                            kwargs={'device_instance': 3})
    cnf_chk_subseq.add_step(steps_edison.process_configuration_check,
                            name='CNF CHECK')
    # ----------------------------

    # Add tst data ---------------
    seq.add_step(steps_edison.process_add_tst_data_for_children,
                 name='ADD TST DATA FOR COMPONENTS')
    # ----------------------------

    # Stardust Diag Testing ------
    diag_subseq = seq.add_sequence('DIAGNOSTIC TESTS')
    diag_subseq.add_step(steps_edison.goto_mode,
                         name='MODE STARDUST - DIAGNOSTIC',
                         kwargs={'mode': 'STARDUST'})
    diag_subseq.add_step(steps_edison.diags_sysinit, name='SYSINIT')
    diag_subseq.add_step(steps_edison.diags_rtc_chkset_test,
                         name='RTC CHK SET',
                         kwargs=dict(severity_allowed=400))
    diag_subseq.add_step(steps_edison.diags_serdeseye_sif_test,
                         name='SERDES EYE SIF TEST',
                         precondition='userdict.get("dsc_installed")')
    diag_subseq.add_step(steps_edison.diags_serdeseye_nif_test,
                         name='SERDES EYE NIF TEST')
    diag_subseq.add_step(steps_edison.diags_vmargin_test,
                         name='VOLTAGE TEST',
                         kwargs={
                             'check_only': True,
                             'margin_level': 'NOMINAL',
                             'device_instance': 0
                         })
    diag_subseq.add_step(steps_edison.upgrade_fpga, name='UPGRADE FPGA')
    # ----------------------------

    # IOS install ----------------
    ios_install_subseq = seq.add_sequence('IOS INSTALLATION')
    ios_install_subseq.add_step(steps_edison.goto_mode,
                                name='MODE BTLDR - IOS INSTALL',
                                kwargs={'mode': 'BTLDR'})
    ios_install_subseq.add_step(steps_edison.ios_install_main_image,
                                name='INSTALL MAIN IOS IMAGE')
    # ----------------------------

    # License Install/Verify -----
    lic_subseq = seq.add_sequence('LIC INSTALL AND VERIFY')
    lic_subseq.add_step(steps_edison.goto_mode,
                        name='MODE IOSE - LIC',
                        kwargs={'mode': 'IOSE'})
    lic_subseq.add_step(steps_edison.ios_install_licenses, name='INSTALL LIC')
    lic_subseq.add_step(steps_edison.ios_verify_default_licenses,
                        name='VERIFY LIC')
    lic_subseq.add_step(steps_edison.ios_verify_apcount_license,
                        name='VERIFY APCOUNT LIC')
    # ----------------------------

    # Verify IOS status ----------
    ios_verify_subseq = seq.add_sequence('VERIFY IOS STATUS')
    ios_verify_subseq.add_step(steps_edison.goto_mode,
                               name='MODE IOSE - IOS VERIFY STATUS',
                               kwargs={'mode': 'IOSE'})
    ios_verify_subseq.add_step(steps_edison.process_get_hw_modules_from_lineid,
                               name='GET HW MODULES')
    ios_verify_subseq.add_step(steps_edison.ios_verify_idpro,
                               name='ID PRO VERIFY')
    ios_verify_subseq.add_step(steps_edison.ios_verify_log_for_empty_poe_ports,
                               name='VERIFY POE LOGS')
    ios_verify_subseq.add_step(steps_edison.ios_verify_customer_version,
                               name='VERIFY IOS VER')
    ios_verify_subseq.add_step(steps_edison.ios_check_environments,
                               name='IOS ENV')
    # ----------------------------

    # IOS clean up
    seq.add_step(steps_edison.ios_clean_up, name='IOS CLEAN UP')
    # ------------------------------------------------------------------------------------------------------------------

    # Power Cycle and wait for UUT to boot up IOS
    seq.add_step(steps_edison.goto_mode,
                 name='MODE BTLDR - FINAL',
                 kwargs={'mode': 'BTLDR'})
    seq.add_step(
        steps_edison.pcamap_cleanup_rommon_params,
        name='UNSET PARAMS',
    )
    seq.add_step(steps_edison.pcamap_set_manual_boot,
                 name='MANUAL BOOT NO',
                 kwargs={'manual_boot': False})
    seq.add_step(steps_edison.power_cycle_on,
                 name='POWER CYCLE',
                 kwargs={'wait_for_boot': False})
    seq.add_step(steps_edison.ios_waitfor_cfg_dialog_boot,
                 name='WAIT FOR IOS BOOT UP')
    seq.add_step(steps_edison.power_off, name='POWER OFF')

    subseq__final(seq)
    return seq
コード例 #19
0
def standard_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    psd = udd.get('uut_config', {}).get('prod_seq_def', {})
    area = __area__  # udd.get(test_area, None)
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, area),
                                        jump_on_error='FINAL')

    # Enable CATS
    # seq.adt_enabled = ['cats']
    # ------------------------------------------------------------------------------------------------------------------
    # Init
    init_seq = seq.add_sequence('INITIALIZATION')
    init_seq.add_step(steps_franklin.init, name='INIT', kwargs={})
    init_seq.add_step(steps_franklin.ud_retrieve,
                      name="RETRIEVE UUT DESCRIPTOR")
    init_seq.add_step(steps_franklin.ud_print_uut_descriptor,
                      name='PRINT DESCRIPTOR')
    init_seq.add_step(steps_franklin.ud_print_uut_config,
                      name='PRINT UUT CONFIG')

    # Area Check
    seq.add_step(steps_franklin.process_area_check,
                 name='AREACHECK',
                 kwargs={},
                 enabled=True)

    # Power ON & Boot
    # Unit should already be powered up from pre-sequence auto-discovery.
    # seq.add_step(steps_franklin.power_cycle_on, name='POWER ON BOOT', group_level=5, enabled=False)

    # Basic Mode
    seq.add_step(steps_franklin.goto_mode,
                 name='MODE BTLDR',
                 kwargs={'mode': 'BTLDR'})

    # MAC Verify Only
    seq.add_step(steps_franklin.process_assign_verify_mac,
                 name='VERIFY MAC',
                 kwargs={'assign': False})

    # Get RFID Data
    seq.add_step(steps_franklin.process_get_rfid_db,
                 name='GET RFID TID',
                 enabled=True,
                 kwargs={})

    # ------------------------------------------------------------------------------------------------------------------
    # PCAMAP
    pcamap_seq = seq.add_sequence('PCAMAP PROGRAMMING', enabled=True)
    # Verify CMPD
    # TODO: waiting Trac #5852
    pcamap_seq.add_step(steps_franklin.process_verify_cmpd,
                        name='VERIFY CMPD SPROM',
                        enabled=False,
                        kwargs={
                            'force': False,
                            'cmpd_description': 'SPROM',
                            'uut_type_key': 'MODEL_NUM',
                            'part_number_key': 'TAN_NUM',
                            'part_revision_key': 'TAN_REVISION_NUMBER',
                            'eco_type': 'VERIFICATION'
                        })

    # PCAMAP Program
    pcamap_seq.add_step(steps_franklin.pcamap_write_uut,
                        name='PCAMAP PROGRAM',
                        kwargs={
                            'device_instance': 0,
                            'memory_type': 'vb'
                        })

    # PIDVID Verify
    seq.add_step(steps_franklin.process_verify_pidvid,
                 name='PIDVID VERIFY',
                 jump_on_error='CLEAN UP')

    # ------------------------------------------------------------------------------------------------------------------
    # Load Images
    image_load_seq = seq.add_sequence('IMAGE LOADING', enabled=True)
    image_load_seq.add_step(steps_franklin.goto_mode,
                            name='MODE LINUX',
                            kwargs={'mode': 'LINUX'})
    image_load_seq.add_step(steps_franklin.linux_set_network_interface,
                            name='SET LINUX NET INTF')
    image_load_seq.add_step(
        steps_franklin.load_hw_images,
        name='LOAD HW IMAGES',
        kwargs={
            'master_list':
            ['btldr', 'linux', 'diag', 'fpga', 'mcu', 'nic', 'SBC_CFG'],
            'force':
            False
        },
        enabled=False)
    image_load_seq.add_step(steps_franklin.ios_install_supplemental_images,
                            name='LOAD IOS SUPPLEMENTAL IMAGES',
                            enabled=True)

    # ------------------------------------------------------------------------------------------------------------------
    # Update any Images via stardust
    # SBC update will ALWAYS program; turn off for FST.
    image_seq = seq.add_sequence('DEVICE IMAGE PROGRAMMING', enabled=True)
    image_secboot_seq = image_seq.add_sequence(
        'DEVICE IMAGE PROGRAMMING SECBOOT')
    image_secboot_seq.add_step(steps_franklin.goto_mode,
                               name='MODE BTLDR',
                               kwargs={'mode': 'BTLDR'})
    image_secboot_seq.add_step(steps_franklin.upgrade_btldr, name='PROG BTLDR')
    image_secboot_seq.add_step(steps_franklin.goto_mode,
                               name='MODE STARDUST',
                               kwargs={'mode': 'STARDUST'})
    image_secboot_seq.add_step(steps_franklin.upgrade_fpga, name='PROG FPGA')
    image_secboot_seq.add_step(steps_franklin.power_cycle_on,
                               name='POWER ON REBOOT',
                               kwargs={'contingent': True},
                               group_level=5)
    image_mcu_seq = image_seq.add_sequence('DEVICE IMAGE PROGRAMMING MCU')
    image_mcu_seq.add_step(steps_franklin.goto_mode,
                           name='MODE STARDUST',
                           kwargs={'mode': 'STARDUST'})
    image_mcu_seq.add_step(steps_franklin.diags_switch_mcu_mode,
                           name='MCU MODE IOS',
                           kwargs={'kkmode': 'IOS'})
    image_mcu_seq.add_step(steps_franklin.upgrade_mcu,
                           name='PROG MCU',
                           enabled=False)
    image_nic_seq = image_seq.add_sequence('DEVICE IMAGE PROGRAMMING NIC')
    image_nic_seq.add_step(steps_franklin.goto_mode,
                           name='MODE LINUX',
                           kwargs={'mode': 'LINUX'})
    image_nic_seq.add_step(steps_franklin.upgrade_nic,
                           name='PROG NIC',
                           enabled=True)
    image_sbc_seq = image_seq.add_sequence('DEVICE IMAGE PROGRAMMING SBC')
    image_sbc_seq.add_step(steps_franklin.goto_mode,
                           name='MODE STARDUST',
                           kwargs={'mode': 'STARDUST'})
    image_sbc_seq.add_step(steps_franklin.update_sbc,
                           name='PROG SBC',
                           enabled=False)

    # ------------------------------------------------------------------------------------------------------------------
    # Identity Protection Programming
    idpro_seq = seq.add_sequence('IDENTITY PROTECTION')
    idpro_main_subseq = idpro_seq.add_sequence('IDENTITY PROTECTION MAINBOARD',
                                               enabled=True)
    idpro_main_subseq.add_step(steps_franklin.power_cycle_on,
                               name='POWER ON REBOOT',
                               group_level=5)
    idpro_main_subseq.add_step(steps_franklin.goto_mode,
                               name='MODE STARDUST',
                               kwargs={'mode': 'STARDUST'})
    idpro_main_subseq.add_step(steps_franklin.diags_sysinit,
                               name='DIAG SYSINIT')
    idpro_main_subseq.add_step(steps_franklin.x509sudi_sign_certificate,
                               name='X509 SHA1',
                               kwargs={'x509_sudi_hash': 'SHA1'},
                               enabled=True)
    idpro_main_subseq.add_step(steps_franklin.act2_sign_chip,
                               name='ACT2',
                               kwargs={
                                   'device_instance': 0,
                                   'keytype': 'ACT2-RSA'
                               },
                               enabled=True)
    idpro_main_subseq.add_step(steps_franklin.act2_sign_chip,
                               name='ACT2 2099',
                               kwargs={
                                   'device_instance': 0,
                                   'keytype': 'ACT2-HARSA'
                               },
                               enabled=True)
    idpro_main_subseq.add_step(steps_franklin.x509sudi_sign_certificate,
                               name='X509 SHA256',
                               kwargs={
                                   'x509_sudi_hash': 'SHA256',
                                   'keytype': 'ACT2-RSA'
                               },
                               enabled=True)
    idpro_main_subseq.add_step(steps_franklin.x509sudi_sign_certificate,
                               name='X509 SHA256 2099',
                               kwargs={
                                   'x509_sudi_hash': 'CMCA3',
                                   'keytype': 'ACT2-HARSA'
                               },
                               enabled=False)

    # Peripherals for special builds only (i.e. proto, etc.).
    if psd.get(area, {}).get('idpro_periphs', False):
        idpro_peripheral_subseq = idpro_seq.add_sequence(
            'IDENTITY PROTECTION PERIPHERALS', enabled=True)
        idpro_peripheral_subseq.add_step(steps_franklin.goto_mode,
                                         name='MODE STARDUST',
                                         kwargs={'mode': 'STARDUST'})
        idpro_peripheral_subseq.add_step(steps_franklin.diags_sysinit,
                                         name='DIAG SYSINIT')
        idpro_peripheral_subseq.add_step(steps_franklin.act2_sign_chip,
                                         name='ACT2 1',
                                         kwargs={
                                             'device_instance': 1,
                                             'keytype': 'ACT2-RSA'
                                         },
                                         enabled=True)
        idpro_peripheral_subseq.add_step(steps_franklin.act2_sign_chip,
                                         name='ACT2 2',
                                         kwargs={
                                             'device_instance': 2,
                                             'keytype': 'ACT2-RSA'
                                         },
                                         enabled=True)
        idpro_peripheral_subseq.add_step(steps_franklin.act2_sign_chip,
                                         name='ACT2 3',
                                         kwargs={
                                             'device_instance': 3,
                                             'keytype': 'ACT2-RSA'
                                         },
                                         enabled=True)
        idpro_peripheral_subseq.add_step(steps_franklin.act2_sign_chip,
                                         name='ACT2 4',
                                         kwargs={
                                             'device_instance': 4,
                                             'keytype': 'ACT2-RSA'
                                         },
                                         enabled=True)

    # IOS Boot Test and IdPro Check
    idpro_seq.add_step(steps_franklin.goto_mode,
                       name='MODE IOSE',
                       kwargs={'mode': 'IOSE'})
    idpro_seq.add_step(steps_franklin.ios_verify_idpro,
                       name='ID PRO VERIFICATION',
                       kwargs={})
    idpro_seq.add_step(steps_franklin.goto_mode,
                       name='MODE BTLDR',
                       kwargs={'mode': 'BTLDR'})
    idpro_seq.add_step(steps_franklin.process_assign_verify_mac,
                       name='VERIFY MAC',
                       kwargs={'assign': False})

    # ------------------------------------------------------------------------------------------------------------------
    # Power Cycle Testing
    seq.add_step(steps_franklin.power_power_cycle_testing,
                 name='POWER CYCLE TEST')

    # ==================================================================================================================
    # Main Loop Tests
    # ------------------------------------------------------------------------------------------------------------------
    fst_loop_seq = seq.add_sequence('SYSTEM LOOP TESTS',
                                    iterations=(aplib.ITERATION_TIME, 30))
    fst_loop_seq.iterations.type = aplib.ITERATION_TIME
    fst_loop_seq.iterations.value = psd.get(area, {}).get(
        'total_loop_time_secs', 1) if psd else 1
    fst_loop_seq.add_step(steps_franklin.loop_marker,
                          name='FST LOOP',
                          kwargs={'title': 'FST'})

    # ------------------------------------------------------------------------------------------------------------------
    # Diag Testing
    diag_seq = fst_loop_seq.add_sequence('DIAGNOSTIC TESTS', enabled=True)
    diag_seq.add_step(steps_franklin.goto_mode,
                      name='MODE STARDUST',
                      kwargs={'mode': 'STARDUST'})
    diag_seq.add_step(steps_franklin.diags_sysinit, name='SYSINIT')
    diag_seq.add_step(steps_franklin.diags_rtc_chkset_test,
                      name='RTC CHK SET TEST',
                      kwargs={})
    diag_seq.add_step(steps_franklin.diags_psu_check,
                      name='PSU CHECK',
                      kwargs={})
    diag_seq.add_step(steps_franklin.diags_update_mcu_settings,
                      name='MCU SETTINGS',
                      kwargs={})
    diag_seq.add_step(steps_franklin.diags_temperature_test,
                      name='TEMPERATURE TEST',
                      kwargs={'operational_state': 'diag'},
                      enabled=True)
    diag_seq.add_step(steps_franklin.diags_vmargin_test,
                      name='VMARGIN TEST',
                      kwargs={
                          'device_instance': 0,
                          'margin_level': 'NOMINAL'
                      },
                      enabled=True)
    diag_seq.add_step(steps_franklin.diags_fan_test,
                      name='FAN TEST',
                      kwargs={},
                      enabled=True)
    diag_seq.add_step(steps_franklin.diags_stackrac_test,
                      name='STACKRAC TEST',
                      kwargs={},
                      enabled=True)
    diag_seq.add_step(steps_franklin.diags_serdeseye_sif_test,
                      name='SERDES EYE SIF TEST',
                      kwargs={},
                      enabled=True)
    diag_seq.add_step(steps_franklin.diags_serdeseye_nif_test,
                      name='SERDES EYE NIF TEST',
                      kwargs={},
                      enabled=True)
    # Diag Testlist build-out
    dynamic_sequence_builder.build_diag_testlist_subseq(
        diag_seq=diag_seq,
        container=container,
        udd=udd,
        step_module=steps_franklin,
        category=None,
        enabled=True)

    # ------------------------------------------------------------------------------------------------------------------
    # Traffic Testing
    traf_seq = fst_loop_seq.add_sequence('TRAFFIC TESTS', enabled=True)
    traf_seq.add_step(steps_franklin.goto_mode,
                      name='MODE STARDUST PRETRAF',
                      kwargs={'mode': 'STARDUST'})
    traf_seq.add_step(steps_franklin.diags_sysinit,
                      name='DIAG SYSINIT PRETRAF')
    dynamic_sequence_builder.build_traffic_cases_subseq(
        traffic_seq=traf_seq,
        container=container,
        udd=udd,
        step_module=steps_franklin,
        category=None,
        enabled=True)

    seq.add_step(steps_franklin.loop_marker,
                 name='FST LOOPS DONE',
                 kwargs={
                     'title': 'FST (Loops completed)',
                     'close_loop': True
                 })
    # ==================================================================================================================

    # ------------------------------------------------------------------------------------------------------------------
    # Power OFF
    seq.add_step(steps_franklin.power_off, name='POWER OFF', group_level=1000)

    # Clean up
    final_seq = seq.add_sequence('FINAL', finalization=True)
    final_seq.add_step(steps_franklin.power_off,
                       name='POWER OFF',
                       kwargs={},
                       group_level=1000)
    final_seq.add_step(steps_franklin.clean_up, name='CLEAN UP')
    final_seq.add_step(steps_franklin.final, name='END')

    return seq
コード例 #20
0
    def _allocate_card(self,
                       action,
                       priority=100,
                       card_name='card',
                       keep_last=False):
        """ Allocate Card (INTERNAL)

        Activating a linecard or Supervisor = start using it.
        Deactivating a linecard or Supervisor = done using it and no longer need to talk to the card.

        This routine uses an "active card" list maintained in global cache to keep track of all linecards/Supervisors in use.
        Also a 'remove from list' is performed on all non-running containers still in the 'active card list'
        (could happen with abort or exception w/ no cleanup).

        :param (str) action: 'deactivate', 'activate', 'show'
        :param (int) priority: lower number is higher priority
        :param (bool) keep_last: Future feature (NOT USED); use to keep last container when deactivating to stay
                          powered on for something else prior to cleanup.
        :return: True|False
        """
        log.debug("Configuration Data")
        self.ud.derive_device_info()
        card_config = self.ud.uut_config.get(card_name.lower(), None)
        if not card_config:
            log.warning("No configuration data for the UUT card: {0}".format(
                card_name))
            log.warning(
                "Please check the card name and the Apollo x_config.py.")
            return False
        log.debug("Card config = {0}".format(card_config))

        container_key = aplib.get_my_container_key()
        container = container_key.split("|")[-1]
        pl, ar, ts, _ = container_key.split("|", 3)
        active_name = '_'.join([pl, ar, ts, 'ActiveModular'])
        with locking.ContainerPriorityLock('__active_modular__',
                                           priority=priority):
            log.debug("Lock    : {0}".format(active_name))
            log.debug("Priority: {0}".format(priority))

            active_cards = aplib.get_cached_data(active_name)
            if active_cards:
                idx = active_cards.index(
                    container) if container in active_cards else -1
            else:
                active_cards = []

            if action == 'activate':
                log.debug("Active {0}.".format(card_name))
                if not active_cards:
                    log.debug("First {0} container to use: '{1}'".format(
                        card_name.lower(), container))
                    active_cards = [container]
                    aplib.cache_data(active_name, active_cards)
                else:
                    if container not in active_cards:
                        log.debug(
                            "Adding {0} container to the active list: {1}".
                            format(card_name.lower(), container))
                        active_cards.append(container)
                        aplib.cache_data(active_name, active_cards)
                    else:
                        log.debug("{0} container already active: {1}".format(
                            card_name, container))

            elif action == 'deactivate':
                log.debug("Deactive {0}.".format(card_name))
                for c in active_cards:
                    # Check & remove orphaned containers (not running but still in the active list due to no cleanup).
                    status = aplib.get_container_status(c)
                    log.debug("{0:<10} = {1}{2}".format(
                        c, status, '*' if status != 'RUNNING' else ''))
                    if status != 'RUNNING':
                        idx = active_cards.index(c)
                        active_cards.pop(idx)
                if len(active_cards) > 1:
                    if idx >= 0:
                        log.info("Deactivating {0} container: '{1}'...".format(
                            card_name.lower(), container))
                        active_cards.pop(idx)
                        aplib.cache_data(active_name, active_cards)
                        log.info(
                            "{0} container deactivated.".format(card_name))
                    else:
                        log.info("{0} container already deactivated.".format(
                            card_name))
                elif len(active_cards) == 1:
                    if not keep_last:
                        log.info(
                            "Only one {0} container remains active and it will be deactivated."
                            .format(card_name.lower()))
                        aplib.cache_data(active_name, [])
                    else:
                        log.warning(
                            "Only one {0} container remains active; deactivate is bypassed."
                            .format(card_name.lower()))
                        log.warning(
                            "This should only be done when the chassis needs to stay powered on."
                        )
                else:
                    log.info(
                        "No {0} containers were activated; nothing to deactivate."
                        .format(card_name.lower()))

            elif action == 'show':
                log.debug("Show {0}.".format(card_name))

            else:
                log.error("Unknown action for {0} allocation.".format(
                    card_name.lower()))
                return False

            msg = "Active {0}s".format(card_name)
            log.info(msg)
            log.info("-" * len(msg))
            for lc in active_cards:
                log.info("{0} {1}".format(lc, '*' if lc == container else ''))

        return True
コード例 #21
0
def step__auto_monitor():
    """Auto Monitor
    monitor and communicate with Robot
    :return:
    """
    container = lib.get_pre_sequence_info().containers[0]
    log.info('This is Auto[{}]'.format(container[0]))
    area = 'SYSBI'

    pc = lib.conn.PC
    pc.power_on()
    log.info('waiting command....')
    time.sleep(0.5)
    pc.clear_recbuf()
    time.sleep(0.5)
    out_type = 'X'
    while True:
        null_seq = []
        pc.send('')
        if '#' in pc.recbuf:
            slot_status = lib.get_cached_data('slot_status')
            comm = pc.recbuf.upper()
            log.info('received command [{}]'.format(comm))

            if comm[-1] != '#':
                log.debug('invalid command, skip')
                pc.clear_recbuf()
                continue

            if comm.count('#') > 1:
                comm = comm.split('#')[-2] + '#'
                log.info('fix command ->{}'.format(comm))

            if 'ASK' in comm:
                if "ALL#" in comm:
                    pc.send('{}#'.format(cap_slot_status()))
                else:
                    r = int(comm.split(':')[1].split('_')[0]) - 1
                    r = 0 if r < 1 else r
                    action_seq = []
                    if '_I#' in comm or '_C#' in comm:
                        in_slot_status = slot_status
                        action_seq = [
                            slot for slot in in_slot_status if 'NULL' in slot
                        ]
                        # log.debug('I output seq is {}, len is {}'.format(action_seq, len(action_seq)))
                        if len(action_seq) < 2:
                            action_seq = ['0NI']
                    elif '_O#' in comm:
                        out_slot_status = slot_status[
                            (r + 1) * 12 - 1::-1] + slot_status[(r + 1) * 12:]
                        if out_type == 'E':
                            action_seq = [
                                slot for slot in out_slot_status
                                if any(ctr in slot for ctr in ['PASS', 'FAIL'])
                            ]
                        else:
                            action_seq = [
                                slot for slot in out_slot_status
                                if slot[0] in ["0", out_type] and any(
                                    ctr in slot for ctr in ['PASS', 'FAIL'])
                            ]
                        while action_seq:
                            if "FAIL1" not in action_seq[0]:
                                break
                            else:
                                null_seq = [
                                    slot for slot in out_slot_status
                                    if 'NULL' in slot
                                ]
                                if null_seq:
                                    break
                                else:
                                    action_seq.remove(action_seq[0])
                                    continue
                    elif '_X#' in comm:
                        out_slot_status = slot_status[(r + 1) * 12 - 1::-1]
                        if out_type == 'E':
                            out_seq = [
                                slot for slot in out_slot_status if any(
                                    ctr in slot for ctr in ['PASS', 'FAIL2'])
                            ]
                        else:
                            out_seq = [
                                slot for slot in out_slot_status
                                if slot[0] == out_type and any(
                                    ctr in slot for ctr in ['PASS', 'FAIL2'])
                            ]
                        idle_seq = [
                            slot for slot in out_slot_status if 'IDLE' in slot
                        ]
                        in_seq = [
                            slot for slot in slot_status if 'NULL' in slot
                        ]
                        if len(in_seq) < 2:
                            in_seq = []
                        action_seq = out_seq + idle_seq + in_seq
                        if not action_seq:
                            out_slot_status = slot_status[(r + 1) * 12:]
                            if out_type == 'E':
                                out_seq = [
                                    slot for slot in out_slot_status
                                    if any(ctr in slot
                                           for ctr in ['PASS', 'FAIL2'])
                                ]
                            else:
                                out_seq = [
                                    slot for slot in out_slot_status
                                    if slot[0] == out_type and any(
                                        ctr in slot
                                        for ctr in ['PASS', 'FAIL2'])
                                ]
                            idle_seq = [
                                slot for slot in out_slot_status
                                if 'IDLE' in slot
                            ]
                            action_seq = out_seq + idle_seq
                    elif '_N#' in comm:
                        out_slot_status = slot_status[
                            (r + 1) * 12 - 1::-1] + slot_status[(r + 1) * 12:]
                        null_seq = [
                            slot for slot in out_slot_status if 'NULL' in slot
                        ]
                        if null_seq:
                            action_seq = [
                                slot for slot in out_slot_status
                                if 'FAIL1' in slot
                            ]
                    elif '_R#' in comm:
                        out_slot_status = slot_status[
                            (r + 1) * 12 - 1::-1] + slot_status[(r + 1) * 12:]
                        action_seq = [
                            slot for slot in out_slot_status if 'IDLE' in slot
                        ]
                    else:
                        log.error('Comm format wrong [{}]'.format(comm))
                    log.info('Action SEQ -> [{}]'.format(action_seq))
                    action = "0NA"
                    if action_seq:
                        for slot in action_seq:
                            action = slot
                            if "FAIL1" in action:
                                null_slot = null_seq[0]
                                action = action + ',' + null_slot.split(':')[1]
                            break
                    if any(ctr in action for ctr in ["IDLE", "PASS", "NULL"]):
                        action = action.split(':')[0][:5] + ':' + action.split(
                            ':')[1]
                    log.info('Next action [{}]'.format(action))
                    pc.send('{}#'.format(action[1:]))

            elif '-' in comm and ':' in comm:
                slot = comm.split(':')[1].split('#')[0]
                status = comm.split(':')[0]
                if 'TEST' in status:
                    station = 'Station'
                    cell = 'AUTO:UUT{:02}_{:02}'.format(
                        int(slot.split('-')[0]), int(slot.split('-')[1]))
                    status = '0TEST{}'.format(2 if 'RE' in status else 1)
                    pc.send('OK#')
                    while True:
                        run_apollo_container(prod_line='UAG_C3K',
                                             area=area,
                                             test_station=station,
                                             container=cell,
                                             mode='PROD')
                        if lib.get_container_status(cell) == 'RUNNING':
                            log.info('{} running ok'.format(cell))
                            break
                        log.info(
                            '{} running meet issue, re-start'.format(cell))
                        continue
                    change_slot_status(slot, status, False)
                    continue
                elif 'FIN' in status:
                    slot = comm.split(':')[1].split('#')[0]
                    log.debug('Remove {} UUT'.format(slot))
                    status = '0NULL1'
                elif 'IDLE' in status:
                    slot = comm.split(':')[1].split('#')[0]
                    log.debug('Input IDLE {} UUT'.format(slot))
                    status = '0IDLE1'
                elif 'ERRO' in status:
                    status = '0ERRO1'
                elif 'FAIL' in status:
                    status = '0FAIL2'
                elif 'OPEN0' in status:
                    status = '0NULL1'
                elif 'OPEN1' in status:
                    status = '0IDLE1'
                elif 'OPEN2' in status:
                    status = '0FAIL2'
                else:
                    log.info('received command [{}]issue'.format(comm))
                pc.send('OK#')
                change_slot_status(slot, status, False)

            elif 'OUTPUT' in comm:
                out_type = comm.split(':')[1].split('#')[0]
                log.info('Output {} Product'.format(uuttype[out_type]))
                pc.send('OK#')
            else:
                log.info('received invalid command {}'.format(comm))

        else:
            continue

    return lib.PASS
コード例 #22
0
ファイル: steps_ess_chamber.py プロジェクト: setlu/entsw_dev
def set_global_profile(forced_profile=None):
    """ Set Global Chamber Profile
    Used by the UUT Container PRE-SEQ.
    This sets the profile to be used by ALL UUTs in the chamber via a global data cache.
    IMPORTANT: Global cache key is the station path (i.e. chamber).
    Differing product families are allowed to run but their profile selections MUST match; if not then it will abort.
    :param (list) forced_profile:
    :return:
    """

    log.debug("Global Profile: set...")
    container = aplib.get_my_container_key()
    # Source the profile.
    try:
        udd = aplib.apdicts.userdict.get('udd')
        if not udd:
            log.error("The UutDescriptor Dict was not available.")
            log.error(
                "Please confirm proper application of the application software!"
            )
            raise Exception("The UutDescriptor Dict was not available.")

        chamber_profile = udd.get('chamber_profile')

        if forced_profile:
            profile = collections.OrderedDict(forced_profile)
            log.debug("Chamber Profile Source: FORCED.")
        elif chamber_profile:
            profile = collections.OrderedDict(chamber_profile)
            log.debug("Chamber Profile Source: UUT DESCRIPTOR.")
        else:
            log.warning(
                "No UutDescriptor chamber_profile, or forced_profile available."
            )
            log.warning(
                "Check the product definitions and common definition for 'chamber_profile'."
            )
            log.warning("The default commercial profile will be used.")
            profile = collections.OrderedDict(DEFAULT_PROFILES['commercial'])
    except (KeyError, AttributeError):
        log.error(
            "Chamber profile data is not available or not in correct form.")
        return False

    log.debug('-' * 50)
    log.debug("{0} : Chamber Profile = {1}".format(container, profile))

    # Get the current profile definition (possibly set by another container in the same chamber)
    # Global cache key is the station path (i.e. chamber)
    S_KEY = '_'.join(container.split('|')[:-1])
    cp_key = 'chamber_profile_' + S_KEY
    with locking.named_priority_lock('__profile__' + S_KEY):
        try:
            log.debug("Chamber profile cache key (set) = {0}".format(cp_key))
            established_profile = aplib.get_cached_data(cp_key)
        except (KeyError, apexceptions.ApolloException):
            established_profile = None

        if not forced_profile:
            # Save the product-specific profile selections for use by SEQ.
            if not established_profile:
                established_profile = profile
                aplib.cache_data(cp_key, established_profile)
                log.debug(
                    "*** A new chamber profile set has been established. ***")

            # All UUT profile definitions must match.  This allows different PIDs in the same chamber BUT requires
            # them to all have the same profile definition.
            if profile != established_profile:
                log.error("Chamber profile: REJECTED!")
                log.error(
                    "There is a mismatch of chamber_profiles in {0}.  This is NOT allowed."
                    .format(container))
                log.error(
                    "Please correct the situation before running the chamber.  Inspect UUT product definitions."
                )
                raise apexceptions.AbortException(
                    "MISMATCH of chamber profiles in {0}.".format(container))
            else:
                log.debug("Chamber profile: ACCEPTED.  {0}".format(
                    established_profile))
        else:
            aplib.cache_data(cp_key, profile)
            log.debug("Chamber profile: FORCED.  {0}".format(profile))

    return True
コード例 #23
0
ファイル: pcbp2.py プロジェクト: setlu/entsw_dev
def standard_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, __area__),
                                        jump_on_error='FINAL')

    # Enable CATS
    # seq.adt_enabled = ['cats']
    # ------------------------------------------------------------------------------------------------------------------
    # Init
    init_seq = seq.add_sequence('INITIALIZATION')
    init_seq.add_step(steps_quake.init, name='INIT', kwargs={})
    init_seq.add_step(steps_quake.ud_retrieve, name="RETRIEVE UUT DESCRIPTOR")
    init_seq.add_step(steps_quake.ud_print_uut_descriptor,
                      name='PRINT DESCRIPTOR')
    init_seq.add_step(steps_quake.ud_print_uut_config, name='PRINT UUT CONFIG')

    # Area Check
    seq.add_step(steps_quake.process_area_check,
                 name='AREACHECK',
                 kwargs={},
                 enabled=True)

    # Power ON & Boot
    # Unit should already be powered up from pre-sequence auto-discovery.
    seq.add_step(steps_quake.power_cycle_on,
                 name='POWER ON BOOT',
                 group_level=5,
                 enabled=False)

    # Basic Mode
    seq.add_step(steps_quake.goto_mode,
                 name='MODE BTLDR',
                 kwargs={'mode': 'BTLDR'})

    # MAC Verify Only
    seq.add_step(steps_quake.process_assign_verify_mac,
                 name='VERIFY MAC',
                 kwargs={'assign': False})

    # Get RFID Data
    seq.add_step(steps_quake.process_get_rfid_db,
                 name='GET RFID TID',
                 enabled=True,
                 kwargs={})

    # ------------------------------------------------------------------------------------------------------------------
    # PCAMAP
    pcamap_seq = seq.add_sequence('PCAMAP PROGRAMMING', enabled=True)
    # Verify CMPD
    # TODO: waiting Trac #5852
    pcamap_seq.add_step(steps_quake.process_verify_cmpd,
                        name='VERIFY CMPD SPROM',
                        enabled=False,
                        kwargs={
                            'force': False,
                            'cmpd_description': 'SPROM',
                            'uut_type_key': 'MODEL_NUM',
                            'part_number_key': 'TAN_NUM',
                            'part_revision_key': 'TAN_REVISION_NUMBER',
                            'eco_type': 'VERIFICATION'
                        })

    # PCAMAP Program
    pcamap_seq.add_step(steps_quake.pcamap_write_uut,
                        name='PCAMAP PROGRAM',
                        kwargs={
                            'device_instance': 0,
                            'memory_type': 'vb'
                        })

    # PIDVID Verify
    seq.add_step(steps_quake.process_verify_pidvid,
                 name='PIDVID VERIFY',
                 jump_on_error='CLEAN UP')

    # ------------------------------------------------------------------------------------------------------------------
    # PCBP2

    # PUT PCBP2 CODE HERE

    # ------------------------------------------------------------------------------------------------------------------
    # Clean up
    final_seq = seq.add_sequence('FINAL', finalization=True)
    final_seq.add_step(steps_quake.power_off,
                       name='POWER OFF',
                       kwargs={},
                       group_level=1000)
    final_seq.add_step(steps_quake.clean_up, name='CLEAN UP')
    final_seq.add_step(steps_quake.final, name='END')

    return seq
コード例 #24
0
def standard_switch_common(profile_type):
    """ 2C/4C Run Sequence that includes:
        1) setup
        2) area check
        3) chamber startup
        4) corner buildup
        5) chamber wrapup
        5) power off
        6) cleanup

    :return: seq
    """
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, __area__),
                                        jump_on_error='FINAL')

    # Enable CATS
    # seq.adt_enabled = ['cats']
    # ------------------------------------------------------------------------------------------------------------------
    # Init
    init_seq = seq.add_sequence('INITIALIZATION')
    init_seq.add_step(steps_nyquist.init, name='INIT', kwargs={})
    init_seq.add_step(steps_nyquist.ud_retrieve,
                      name="RETRIEVE UUT DESCRIPTOR")
    init_seq.add_step(steps_nyquist.ud_print_uut_descriptor,
                      name='PRINT DESCRIPTOR')
    init_seq.add_step(steps_nyquist.ud_print_uut_config,
                      name='PRINT UUT CONFIG')

    # Chamber Init
    # TODO: Trac#6087
    seq.add_step(steps_ess_chamber.step__chamber_init,
                 name='CHAMBER INIT',
                 kwargs={
                     'profile_type': profile_type,
                     'fi_action': 'nopause',
                     'first_init': False
                 })
    # Area Check
    seq.add_step(steps_nyquist.process_area_check,
                 name='AREACHECK',
                 kwargs={'previous_area': 'ICT'},
                 enabled=True)

    # MAC Verify Only
    seq.add_step(steps_nyquist.process_assign_verify_mac,
                 name='VERIFY MAC',
                 kwargs={'assign': False})

    # ------------------------------------------------------------------------------------------------------------------
    # PCAMAP
    pcamap_seq = seq.add_sequence('PCAMAP PROGRAMMING', enabled=True)
    # Verify CMPD
    # TODO: waiting Trac #5852
    pcamap_seq.add_step(steps_nyquist.process_verify_cmpd,
                        name='VERIFY CMPD SPROM',
                        kwargs={
                            'force': False,
                            'cmpd_description': 'SPROM',
                            'uut_type_key': 'MODEL_NUM',
                            'part_number_key': 'MOTHERBOARD_ASSEMBLY_NUM',
                            'part_revision_key': 'MOTHERBOARD_REVISION_NUM',
                            'previous_area': 'PCBST',
                            'eco_type': 'VERIFICATION'
                        },
                        enabled=False)

    # Chamber Start
    seq.add_step(steps_ess_chamber.step__chamber_start,
                 name='CHAMBER START',
                 kwargs={})

    # --------------------------------------------------------------------------------------------------------------
    # Build All Corners
    # Example corners = OrderedDict([('NTNV', ('AMBIENT', 'NOMINAL', False)),
    #                                ('HTLV', ('HOT', 'LOW', True)),
    #                                ('LTLV', ('COLD', 'LOW', True))])
    if True:  # Logic branch for chamber debug (if needed)
        corners = steps_ess_chamber.get_global_corners()
        for i, corner in enumerate(corners):
            temperature = corners[corner][0]
            voltage = corners[corner][1]
            adt_flag = corners[corner][2]
            corner_seq = seq.add_sequence('{0} CORNER'.format(corner),
                                          adt_enabled=adt_flag)
            corner_seq.add_step(steps_ess_chamber.step__chamber_ramp,
                                name='CHAMBER RAMP {0}'.format(temperature),
                                kwargs={'action': temperature})
            corner_seq_sublevel1 = corner_seq.add_sequence('UUT-MONITOR GROUP',
                                                           parallel_steps=True)
            corner_seq_sublevel1.add_step(
                steps_ess_chamber.step__chamber_start_monitor,
                name="CHAMBER MONITOR START {0}".format(i))
            corner_seq_sublevel2 = corner_seq_sublevel1.add_sequence(
                'UUT AT {0} VOLT'.format(voltage))
            corner_seq_sublevel3 = corner_seq_sublevel2.add_sequence(
                'UUT TESTS',
                adt_enabled=adt_flag,
                jump_on_error="CHAMBER MONITOR STOP {0}".format(i))
            corner_seq_sublevel3.add_step(steps_nyquist.power_cycle_on,
                                          name='POWER ON BOOT',
                                          group_level=5)
            if True:  # Logic branch for chamber debug (if needed)
                corner_seq_sublevel3.add_step(steps_nyquist.goto_mode,
                                              name='MODE STARDUST',
                                              kwargs={'mode': 'STARDUST'})
                corner_seq_sublevel3.add_step(
                    steps_nyquist.diags_switch_mcu_mode,
                    name='MCU MODE IOS',
                    kwargs={'kkmode': 'IOS'})
                corner_seq_sublevel3.add_step(steps_nyquist.diags_sysinit,
                                              name='DIAG SYSINIT')
                corner_seq_sublevel3.add_step(steps_nyquist.diags_vmargin_test,
                                              name='VOLTAGE MARGIN',
                                              kwargs={
                                                  'device_instance': 0,
                                                  'margin_level': voltage
                                              })
                corner_seq_sublevel3.add_step(
                    steps_nyquist.diags_temperature_test,
                    name='UUT TEMPERATURES',
                    kwargs={
                        'temperature_corner': temperature,
                        'operational_state': 'idle'
                    })
                corner_seq_sublevel3.add_step(steps_nyquist.diags_psu_check,
                                              name='PSU CHECK',
                                              kwargs={})
                corner_seq_sublevel3.add_step(
                    steps_nyquist.diags_stackrac_test,
                    name='STACKRAC TEST',
                    kwargs={})
                corner_seq_sublevel3.add_step(
                    steps_nyquist.diags_serdeseye_sif_test,
                    name='SERDES EYE SIF TEST',
                    kwargs={})
                corner_seq_sublevel3.add_step(
                    steps_nyquist.diags_serdeseye_nif_test,
                    name='SERDES EYE NIF TEST',
                    kwargs={})
                # Diag Testlist build-out
                corner_seq_sublevel3_diag = corner_seq_sublevel3.add_sequence(
                    'DIAG TESTS')
                corner_seq_sublevel3_diag.add_step(steps_nyquist.goto_mode,
                                                   name='MODE DIAG',
                                                   kwargs={'mode': 'DIAG'})
                dynamic_sequence_builder.build_diag_testlist_subseq(
                    diag_seq=corner_seq_sublevel3_diag,
                    container=container,
                    udd=udd,
                    step_module=steps_nyquist,
                    category=None,
                    enabled=True)
                # Traffic Testlist build-out
                corner_seq_sublevel3_traf = corner_seq_sublevel3.add_sequence(
                    'TRAF TESTS')
                corner_seq_sublevel3_traf.add_step(steps_nyquist.goto_mode,
                                                   name='MODE STARDUST',
                                                   kwargs={'mode': 'STARDUST'})
                dynamic_sequence_builder.build_traffic_cases_subseq(
                    traffic_seq=corner_seq_sublevel3_traf,
                    container=container,
                    udd=udd,
                    step_module=steps_nyquist,
                    category=None,
                    enabled=True)
            # Corner wrap-up
            corner_seq_sublevel2.add_step(
                steps_ess_chamber.step__chamber_stop_monitor,
                name="CHAMBER MONITOR STOP {0}".format(i),
                kwargs={},
                group_level=aplib.FINALIZATION - 2)
            corner_seq.add_step(steps_nyquist.power_off,
                                name='POWER OFF',
                                group_level=aplib.FINALIZATION - 1)

    # ------------------------------------------------------------------------------------------------------------------
    # Chamber Wrap-Up
    #   1. Chamber Stop will sync all containers AND return chamber to ambient.
    #   2. Power off each UUT.
    #   3. Clean Up (remove classes and clean userdict)
    final_seq = seq.add_sequence('FINAL', finalization=True)
    final_seq.add_step(steps_ess_chamber.step__chamber_final,
                       name="CHAMBER STOP",
                       kwargs={},
                       group_level=aplib.FINALIZATION - 3)
    final_seq.add_step(steps_nyquist.power_off,
                       name='POWER OFF',
                       group_level=aplib.FINALIZATION - 2)
    final_seq.add_step(steps_nyquist.clean_up,
                       name='CLEAN UP',
                       group_level=aplib.FINALIZATION - 1)

    return seq
コード例 #25
0
ファイル: steps_ess_chamber.py プロジェクト: setlu/entsw_dev
def prestep__chamber_post_staging():
    ACTIVECS_KEY, _ = get_chamber_slots_keys()
    active_chamber_slots = aplib.get_cached_data(ACTIVECS_KEY)
    log.debug("Active chamber slots: {0}".format(active_chamber_slots))
    return aplib.PASS
コード例 #26
0
ファイル: assy.py プロジェクト: setlu/entsw_dev
def standard_switch_sequence_definition():
    try:
        container = aplib.get_my_container_key()
    except Exception:
        raise Exception("Cannot use this Apollo version!")
    udd = aplib.get_cached_data('{0}_uut_descriptor'.format(container))
    pf = udd.get('product_family').upper()
    pc = udd.get('product_codename').upper()
    psd = udd.get('uut_config', {}).get('prod_seq_def', {})
    area = __area__  # udd.get('test_area', None)
    seq = aplib.get_sequence_definition('{0} {1} {2} {3} SEQ'.format(
        __product_line__, pf, pc, area),
                                        jump_on_error='FINAL')

    # ------------------------------------------------------------------------------------------------------------------
    # Init
    init_seq = seq.add_sequence('INITIALIZATION')
    init_seq.add_step(steps_nyquist.init, name='INIT', kwargs={})
    init_seq.add_step(steps_nyquist.ud_retrieve,
                      name="RETRIEVE UUT DESCRIPTOR")
    init_seq.add_step(steps_nyquist.ud_print_uut_descriptor,
                      name='PRINT DESCRIPTOR')
    init_seq.add_step(steps_nyquist.ud_print_uut_config,
                      name='PRINT UUT CONFIG')

    # Area Check
    seq.add_step(steps_nyquist.process_area_check,
                 name='AREACHECK',
                 kwargs={},
                 enabled=True)

    # Power ON & Boot
    # Unit should already be powered up from pre-sequence auto-discovery.
    # seq.add_step(steps_nyquist.power_cycle_on, name='POWER ON BOOT', group_level=5, enabled=False)

    # Basic Mode
    seq.add_step(steps_nyquist.goto_mode,
                 name='MODE BTLDR',
                 kwargs={'mode': 'BTLDR'})

    # ------------------------------------------------------------------------------------------------------------------
    # PCAMAP
    pcamap_seq = seq.add_sequence('PCAMAP PROGRAMMING', enabled=True)
    # Verify CMPD
    # TODO: waiting Trac #5852
    pcamap_seq.add_step(steps_nyquist.process_verify_cmpd,
                        name='VERIFY CMPD SPROM',
                        enabled=False,
                        kwargs={
                            'force': False,
                            'cmpd_description': 'SPROM',
                            'uut_type_key': 'MODEL_NUM',
                            'part_number_key': 'TAN_NUM',
                            'part_revision_key': 'TAN_REVISION_NUMBER',
                            'eco_type': 'VERIFICATION'
                        })

    # PCAMAP Program
    pcamap_seq.add_step(steps_nyquist.pcamap_write_uut,
                        name='PCAMAP PROGRAM',
                        kwargs={
                            'device_instance': 0,
                            'memory_type': 'vb'
                        })

    # PIDVID Verify
    seq.add_step(steps_nyquist.process_verify_pidvid,
                 name='PIDVID VERIFY',
                 jump_on_error='CLEAN UP')

    # ------------------------------------------------------------------------------------------------------------------
    # Diag Testing
    diag_seq = seq.add_sequence('DIAGNOSTIC TESTS', enabled=True)
    diag_seq.add_step(steps_nyquist.goto_mode,
                      name='MODE STARDUST',
                      kwargs={'mode': 'STARDUST'})
    diag_seq.add_step(steps_nyquist.diags_sysinit, name='SYSINIT')
    diag_seq.add_step(steps_nyquist.diags_psu_check,
                      name='PSU CHECK',
                      kwargs={})

    # Diag Testlist build-out
    dynamic_sequence_builder.build_diag_testlist_subseq(
        diag_seq=diag_seq,
        container=container,
        udd=udd,
        step_module=steps_nyquist,
        category=None,
        enabled=True)

    # ------------------------------------------------------------------------------------------------------------------
    # Traffic Testing
    traf_seq = seq.add_sequence('TRAFFIC TESTS', enabled=True)
    traf_seq.add_step(steps_nyquist.goto_mode,
                      name='MODE STARDUST PRETRAF',
                      kwargs={'mode': 'STARDUST'})
    traf_seq.add_step(steps_nyquist.diags_sysinit, name='DIAG SYSINIT PRETRAF')
    dynamic_sequence_builder.build_traffic_cases_subseq(
        traffic_seq=traf_seq,
        container=container,
        udd=udd,
        step_module=steps_nyquist,
        category=None,
        enabled=True)

    # ------------------------------------------------------------------------------------------------------------------
    # Power OFF
    seq.add_step(steps_nyquist.power_off, name='POWER OFF', group_level=1000)

    # Clean up
    final_seq = seq.add_sequence('FINAL', finalization=True)
    final_seq.add_step(steps_nyquist.power_off,
                       name='POWER OFF',
                       kwargs={},
                       group_level=1000)
    final_seq.add_step(steps_nyquist.clean_up, name='CLEAN UP')
    final_seq.add_step(steps_nyquist.final, name='END')

    return seq
コード例 #27
0
ファイル: steps_ess_chamber.py プロジェクト: setlu/entsw_dev
def set_global_corners(forced_corners=None):
    """ Set Global ChamberCorners
    Used by the UUT Container PRE-SEQ.
    This sets the corners to be used by ALL UUTs in the chamber via a global data cache.
    IMPORTANT: Global cache key is the station path (i.e. chamber).
    Differing product families are allowed to run but their corner selections MUST match; if not then it will abort.

    Example set in product_definition:
    'chamber_corners': [('NTNV', False), ('HTLV', True), ('HTHV', True), ('LTLV', True)]

    Example of globally saved after processing:
    OrderedDict([('NTNV', ('AMBIENT', 'NOMINAL', False)),
             ('HTLV', ('HOT', 'LOW', True)),
             ('HTHV', ('HOT', 'HIGH', True)),
             ('LTLV', ('COLD', 'LOW', True))])

    :param (list) forced_corners:
    :return:
    """
    log.debug("Global Corners: set...")
    # Check for a product-specific corner definition.
    _lookup = {
        'HT': HOT,
        'LT': COLD,
        'NT': AMBIENT,
        'HV': 'HIGH',
        'LV': 'LOW',
        'NV': 'NOMINAL'
    }
    container = aplib.get_my_container_key()

    try:
        udd = aplib.apdicts.userdict.get('udd')
        if not udd:
            log.error("The UutDescriptor Dict was not available.")
            log.error(
                "Please confirm proper application of the application software!"
            )
            raise Exception("The UutDescriptor Dict was not available.")

        chamber_corners = udd.get('chamber_corners')

        if forced_corners:
            listed_corners = collections.OrderedDict(forced_corners)
            log.debug("Chamber Corners Source: FORCED.")
        elif chamber_corners:
            listed_corners = collections.OrderedDict(chamber_corners)
            log.debug("Chamber Corners Source: UUT DESCRIPTOR.")
        else:
            log.warning(
                "No UutDescriptor chamber_corners, or forced_corners available."
            )
            log.warning(
                "Check the product definitions and common definition for 'chamber_corners'."
            )
            log.warning(
                "The default '2-Corner' sequence (HTLV, LTHV) will be used.")
            listed_corners = [('LTHV', True), ('HTLV', True)]

        processed_corners = []
        if listed_corners:
            for lc in listed_corners:
                name = lc[0] if isinstance(lc, tuple) else lc
                adt = lc[1] if isinstance(lc, tuple) and len(lc) > 1 else False
                if len(name) == 4:
                    temp = _lookup.get(name[:2], AMBIENT)
                    volt = _lookup.get(name[2:4], 'NOMINAL')
                elif len(name) == 2:
                    temp = _lookup.get(name, AMBIENT)
                    volt = 'NOMINAL'
                else:
                    temp = AMBIENT
                    volt = 'NOMINAL'
                processed_corners.append((name, (temp, volt, adt)))
        corners = collections.OrderedDict(
            processed_corners) if processed_corners else None
    except (KeyError, AttributeError):
        log.warning(
            "Chamber corner data is not available or not in correct form.")
        return False

    log.debug('-' * 20)
    log.debug("{0} : Chamber Corners = {1}".format(container, listed_corners))

    # Now check for proper form of corners dict.
    for corner in corners:
        if not isinstance(corners[corner], tuple):
            log.error("Product specific corners are not in the proper form.")
            raise apexceptions.AbortException

    # Get the current corner definition (possibly set by another container in the same chamber)
    S_KEY = '_'.join(container.split('|')[:-1])
    cc_key = 'chamber_corners_' + S_KEY
    with locking.named_priority_lock('__corners__' + S_KEY):
        try:
            log.debug("Chamber corner cache key (set) = {0}".format(cc_key))
            established_corners = aplib.get_cached_data(cc_key)
        except (KeyError, apexceptions.ApolloException):
            established_corners = None

        if not forced_corners:
            # Save the product-specific corner selections for use by SEQ.
            if not established_corners:
                established_corners = corners
                aplib.cache_data(cc_key, established_corners)
                log.debug(
                    "*** A new chamber corner set has been established. ***")

            # All UUT corner definitions must match.  This allows different PIDs in the same chamber BUT requires them
            # to all have the same corner definition.
            if corners != established_corners:
                log.error("Chamber corners: REJECTED!")
                log.error(
                    "There is a mismatch of chamber_corners in {0}.  This is NOT allowed."
                    .format(container))
                log.error(
                    "Please correct the situation before running the chamber.  Inspect UUT product definitions."
                )
                raise apexceptions.AbortException(
                    "MISMATCH of chamber corners in {0}.".format(container))
            else:
                log.debug("Chamber corners: ACCEPTED.  {0}".format(
                    established_corners))
        else:
            aplib.cache_data(cc_key, corners)
            log.debug("Chamber corners: FORCED.  {0}".format(corners))

    return True