def DoWork(self):
        try:
            #jsonpath = os.path.realpath(r'../CrAutoFarm/Json/PerfTuning1.json')
            #settingcomb = BiosSettingsComb(jsonpath)
            settingcomb = BiosSettingsComb(self._config)
            q = queue.Queue()
            combs = settingcomb.__dict__.items()
            #for idx in range(0, len(combs)):  # python 2.7 not support this
                #comb = combs[idx]  # this is not supported in python 3
            idx = 0
            for comb in combs:
                q.put(ChangeBiosKnobSettingsState(BiosSettingsComb(self._config), comb[1]))

                '''
                    Switch AD mode
                '''
                q.put(InitialParamicoClientState())
                q.put(aepCommand_DeleteNameSpace_State())
                q.put(aepCommand_CreateADGoal_State())

                '''
                OS reboot
                '''
                q.put(PowerCycleState())
                self._parentWorkThread._powerCycleRequestCount += 1

                q.put(InitialParamicoClientState())
                latencyTestState = crHealth_PERF_001_State()
                latencyTestState.TestCaption = settingcomb.Caption(idx)
                latencyTestState.SetParentWorkThread(self._parentWorkThread)
                q.put(latencyTestState)

                idx += 1

            currentQueue = self._parentWorkThread._queue
            while(True):
                if currentQueue.qsize() == 0:
                    break
                q.put(currentQueue.get_nowait())

            self._parentWorkThread._queue = queue.Queue()
            while(True):
                if q.qsize() == 0:
                    break
                self._parentWorkThread._queue.put(q.get_nowait())
            pass
        except Exception as e:
            self._logger.error(str(e))
            self._success = False
Exemple #2
0
    def IntialWork(self):
        self._powerCycleRequestCount = 0
        self._queue = queue.Queue()
        # self._queue.put(InitialITPState())
        if self.IsDefaultTestType:
            self._queue.put(InitialParamicoClientState())

        return self._initialWork('crHealth')
Exemple #3
0
 def IntialWork(self):
     q = queue.Queue()
     queueRef = weakref.ref(q)
     self._queue = queueRef()  # queue.Queue()
     if not self._config['simulation']:
         self._queue.put(InitialParamicoClientState())
         self._queue.put(SftpState())
     return self._initialWork('crPerf')
    def IntialWork(self):
        state = None
        self._powerCycleRequestCount = 0
        q = queue.Queue()
        queueRef = weakref.ref(q)
        self._queue = queueRef()
        if os.path.isdir(Consts.COMB_OUTPUT_FOLDER):
            combinfos = os.listdir(Consts.COMB_OUTPUT_FOLDER)
            if len(combinfos) > 0:
                jsonfileCombInfo = os.path.realpath(r'{}/{}'.format(
                    Consts.COMB_OUTPUT_FOLDER, combinfos[0]))
                combInfo = CombInfoDictionary(
                    open(jsonfileCombInfo, 'r').read())
                comb = combInfo[Consts.COMB_DATA_KEY]

                # The system should be starting with the OS mode
                self._queue.put(InitialParamicoClientState())
                self._queue.put(
                    ChangeBiosKnobSettingsState(BiosSettingsComb(self._config),
                                                comb[1]))

                self._queue.put(WaitForOSBootState())
                self._queue.put(InitialParamicoClientState())

                latencyTestState = crPerf_LatencyTest_State()
                latencyTestState._configTest = self._config['PerfTuning'][
                    'tests'][0]
                latencyTestState.TestCaption = combInfo.__dict__[
                    Consts.COMB_CAPTION_KEY]
                latencyTestState.SetParentWorkThread(self)
                self._queue.put(latencyTestState)

                if os.path.isfile(jsonfileCombInfo):
                    os.remove(jsonfileCombInfo)

        if self._queue.qsize() > 0:
            state = self._queue.get_nowait()
        return state
Exemple #5
0
    def IntialWork(self):
        self._powerCycleRequestCount = 0
        self._queue = queue.Queue()
        if not self._config['skipAcCycle']:
            self._queue.put(SwitchOffState())
            self._queue.put(SwitchOnState())
        '''
            Switch AD mode
        '''
        self._queue.put(InitialParamicoClientState())
        self._queue.put(aepCommand_DeleteNameSpace_State())
        self._queue.put(aepCommand_CreateADGoal_State())
        '''
        OS reboot
        '''

        self._queue.put(PowerCycleState())
        self._powerCycleRequestCount += 1

        self._queue.put(InitialParamicoClientState())

        self._queue.put(SftpState())

        return self._initialWork()
Exemple #6
0
    def DoWork(self):
        if self._abort or (self._configTest is not None and self._configTest['skip']):
            return
        self._shellCommand = self._configTest['shellCommand']
        self.InsertReportHeader(self._configTest['testid'])
        self.ReportHealthStatus()
        self.CloseReportRow()
        result = RESULTS.FAILED
        if self._success:
            result = RESULTS.PASSED

        self._parentWorkThread.UpdateResults(self._configTest['testid'], result)
        self._logger.info('Execute {0} result = {1}'.format(self._configTest['testid'], result.value))

        if self._configTest['powercycle']:
            from workstates.systemControlState.initialParamicoClientState import InitialParamicoClientState
            from workstates.systemControlState.powerCycleState import PowerCycleState
            self._insertStatesToWorkflow([PowerCycleState(),InitialParamicoClientState()])