Esempio n. 1
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
Esempio n. 2
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
Esempio n. 3
0
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
Esempio n. 4
0
def show_container_info():
    container_name = aplib.get_container_name()
    aplib.get_container_status(container_name)
    container_key = aplib.get_my_container_key()
    station_key = '|'.join(container_key.split('|')[:-1])
    log.debug("Container = {0}".format(container_name))
    log.debug("Station   = {0}".format(station_key))
    log.debug("Cfg       = {0}".format(aplib.apdicts.configuration_data))
    return
Esempio n. 5
0
 def __init__(self, serial_number):
     self.container = str(lib.get_my_container_key().split("|")[-1])
     logger.info('The container number is {}'.format(self.container))
     self.serial = str(serial_number)
     logger.info('The serial number is {}'.format(self.serial))
     self.reset_time = config_fail_lock.reset_time
     self.count = config_fail_lock.max_fail_time
     self.timestampkey = self.container + 'tcount'
     self.keytotal = str(self.container) + 'total'
     self.all_total = self.get_data('total')
     self.passkey = self.container + 'P'
Esempio n. 6
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
Esempio n. 7
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
Esempio n. 8
0
def reset_globals():
    """ Reset Globals
    Used by Supercontainer in SC-PreSeq
    """
    log.debug("Chamber globals: reset...")
    container = aplib.get_my_container_key()
    S_KEY = '_'.join(container.split('|')[:-1])
    cp_key = 'chamber_profile_' + S_KEY
    cc_key = 'chamber_corners_' + S_KEY
    aplib.cache_data(cp_key, None)
    aplib.cache_data(cc_key, None)
    log.debug("Chamber globals reset done!")
    return
Esempio n. 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.')
Esempio n. 10
0
def monitor_slots(container=None, status=None):
    """Monitor slots
    record slots pass/fail status in local file '/tftpboot/cellctr', fail two times in same slot will disable it.
    Todo: get fail step name record in local file, two times fail in same steps(equipment issues) will disable slot
    :param container:
    :param status:
    :return:
    """
    record_dir = '/tftpboot/cellctr'
    if not container:
        try:
            container = lib.get_pre_sequence_info().containers[0]
        except Exception, e:
            log.info('This Main SEQ, {}'.format(e))
            container = lib.get_my_container_key().split('|')[-1]
Esempio n. 11
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
Esempio n. 12
0
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