示例#1
0
    def SendCommandAndGetResponse(self, commandToRun, waitForIdle=True):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: SendCommandAndGetResponse
		# Input: Takes argument :
		# 	commandToRun: The UDAS API to be sent
		# Description: Wrapper Function that communicates with the UDAS s/w and then wait for UDAS to go IDLE
		# Return: StatusResult() object
		#-------------------------------------------------------------------------------------------------------------------
		"""
        result = self.SendApiAndGetResponse(commandToRun)
        if result.HasError():
            return result

        if waitForIdle:
            startTime = datetime.datetime.now()
            while ((datetime.datetime.now() - startTime).seconds < 60):
                result = self.SendApiAndGetResponse("GetHWState()", False)
                if result.HasError():
                    time.sleep(3)
                    continue

                isBusy = False if (self.LastKratosResponse
                                   == "READY") else True
                if not isBusy:
                    return StatusResult.Success()
                time.sleep(3)

            logger.error("KRATOS failed to return to IDLE state in 1 minute")

        return StatusResult.Success()
    def PIDControl(self, thermalZone, desiredTemperature, timeout, SVTemp=25):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: PIDControl
        # Input: Takes 4 arguments
        #       argument1: thermal Zone
        #       argument2: desiredTemperature in degree C
        #       argument3: timeout in seconds.
        #       argument4: SVTemp Temperature in degree C, default value is 25.0C
        # Description: Sets RV temperature, reports device temperature
        #-------------------------------------------------------------------------------------------------------------------
        """
        msTimeout = timeout * 1000
        logger.info("Inside PIDControl function")
        methodString = "-m PIDControl-" + str(thermalZone) + "," + str(
            desiredTemperature) + "," + str(msTimeout) + "," + str(SVTemp)
        logger.info(methodString)
        result = self.SendCommandAndGetResponse(methodString, timeout)
        logger.debug(result.CmdResult.Output)
        if result.Status.HasError():
            logger.error("Error in running PIDControl")
            return result.Status

        logger.debug("PIDControl function working fine")
        return StatusResult.Success()
    def ControlTemperature(self,
                           thermalZone,
                           desiredTemperature,
                           timeout,
                           SVTemp=25):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: ControlTemperature
        # Input: Takes 4 argument
        #       argument1: thermalZone
        #       argument2: desiredTemperature
        #       argument3: timeout in seconds
        #       argument4: SVTemp
        # Description: Controls temperature on device
        #---------------------------------------------------------------------------------------------------
        """
        logger.info("Calling ControlTemperature function")
        methodString = "-m ControlTemperature-" + str(thermalZone) + "," + str(
            desiredTemperature) + "," + str(timeout * 1000) + "," + str(SVTemp)
        #logger.debug(methodString)
        result = self.SendCommandAndGetResponse(methodString, timeout)
        logger.debug(result.CmdResult.Output)
        if result.Status.HasError():
            logger.error("Error in running ControlTemperature")
            return result.Status

        logger.debug("ControlTemperature function working fine")
        return StatusResult.Success()
示例#4
0
    def startsystem(self):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: startsystem
		# Description: Start the system with the previously deployed template
		# Input: Takes no argument
		# Examples:
		#   startsystem()
		#       It will start TBSLTE sytem with the previously deployed template
		#       and check if system is running at end
		# Return: StatusResult() object
		#-------------------------------------------------------------------------------------------------------------------
		"""
        if not self._get_tbslteutil_handle():
            return StatusResult.Error("TBSLTEUtil handle not initialized")

        try:
            output = self._tbslte_handle.start_system()
        except Exception as e:
            return StatusResult.Error(
                f"TBSLTEUtil threw an exception while starting the system: {e}"
            )

        if output == 0:
            return StatusResult.Error("Failed to start the TBS system")
        elif output == 2:
            logger.debug(
                "TBSLTE system was already running before calling the 'startsystem' function"
            )

        logger.info("TBSLTE system is up and running")
        return StatusResult.Success()
示例#5
0
    def SetDataCollectionPath(self):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: SetDataCollectionPath
        # Input: Takes no argument
        # Description: Sets up path to save UDAS waveform on automation PC
        # Return: StatusResult() object
        #-------------------------------------------------------------------------------------------------------------------
        """
        logger.info("Setting Logs Location for saving UDAS")

        if self.boardHasEpm:
            if self.epm.getData:
                logger.warning('ALPACA : Measurement already running. Stopping previous measurement')

                result = self.StopMeasurement()
                if result.HasError():
                    logger.error('ALPACA : Error stopping previous measurement')
                    return result

        self.logsPath = "C:\\Automation\\Logs\\" + str(datetime.now().strftime('%Y-%m-%d_%H-%M-%S'))

        if self.boardHasEpm:
            try:
                logger.info('ALPACA : Log directory path : ' + self.logsPath)
                self.epm.SetLogDirectory(self.logsPath)
            except Exception as e:
                logger.error(str(e))
                return StatusResult.Error('ALPACA : ', str(e))

        return StatusResult.Success()
示例#6
0
    def HandleComPort(self):
        """
        -------------------------------------------------------------------------------------------------------------------
         Name: HandleComPort
         Input: Takes no argument
         Description: Handle the serial COM port connection to the Spiderboard
         Return: StatusResult() object
        -------------------------------------------------------------------------------------------------------------------
        """

        #Search for the Spiderboard COM port
        result = self.GetSpiderboardComPort()
        if result.HasError():
            logger.error(result.ErrorMessage())
            return result

        if self.portObj:
            #Open the port and create the COM port object
            result = self.OpenSpiderboardComPort()
            if result.HasError():
                logger.error('Failed to open Spiderboard COM port')
                logger.error(result.ErrorMessage())
                return result

        return StatusResult.Success()
示例#7
0
    def stopsystem(self):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: stopsystem
		# Description: Stop the TBSLTE system and check system is in stopped mode at end
		# Input: Takes no argument
		# Examples:
		#   stopsystem()
		#       It will stop TBSLTE sytem
		# Return: StatusResult() object
		#-------------------------------------------------------------------------------------------------------------------
		"""
        if not self._get_tbslteutil_handle():
            return StatusResult.Error("TBSLTEUtil handle not initialized")

        try:
            output = self._tbslte_handle.stop_system()
        except Exception as e:
            return StatusResult.Error(
                f"TBSLTEUtil threw an exception while stopping the system: {e}"
            )

        if output == 0:
            return StatusResult.Error("Failed to stop the TBS system")
        elif output == 2:
            logger.debug(
                "TBSLTE system was already stopped before calling the 'stopsystem' function"
            )

        logger.info("TBSLTE system is stopped successfully")
        return StatusResult.Success()
示例#8
0
    def GetSinglePlotStatistics(self, statisticList):
        logger.info("Getting Single Plot Statistics ")

        for channel in ['CURRENT', 'VOLTAGE']:
            commandToRun = f"GetSinglePlotStatistics(0,{channel})"
            result = self.SendCommandAndGetResponse(commandToRun)
            if result.HasError():
                logger.error(f"Error in reading battery {channel}")
                return result

            dataFields = None
            if self.LastApiResponse:
                dataFields = self.LastApiResponse.split(",")

            if (dataFields == None or len(dataFields) < 3):
                return StatusResult.Error(
                    f"Kratos: Failed to parse response while reading battery {channel} value. Response: {self.LastApiResponse}"
                )

            if channel == 'CURRENT':
                statisticList[0] = dataFields[2]
            else:
                statisticList[1] = dataFields[2]

        return StatusResult.Success()
示例#9
0
    def GetSinglePlotStatistics(self, statisticList):
        logger.info("Getting Single Plot Statistics ")
        methodString = "-m GetSinglePlotStatistics-1,1"
        result = self.SendCommandAndGetResponse(methodString)
        if result.Status.HasError():
            logger.error(
                "Error in Sending Command to get Single Point Statistics")
            return result

        current = "current : "
        voltage = "voltage : "
        match = re.findall(current + '(.*?);', result.CmdResult.Output,
                           re.DOTALL)
        if len(match) < 1:
            return StatusResult.Error("Could not read Current Value")

        # logger.info("Current : " + match[0])
        current = match[0]

        match = re.findall(voltage + '(.*?);', result.CmdResult.Output,
                           re.DOTALL)
        if len(match) < 1:
            return StatusResult.Error("Could not read Voltage Value")

        # logger.info("Voltage : " + match[0])
        voltage = match[0]

        statisticList[0] = current
        statisticList[1] = voltage

        return StatusResult.Success()
示例#10
0
    def StartAcquisition(self):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: StartAcquisition
		# Description: Starts Acquisition on Kratos
		#-------------------------------------------------------------------------------------------------------------------
		"""
        logger.info("Starting Acquisition")
        commandToRun = "StartAcquisition()"
        result = self.SendCommandAndGetResponse(commandToRun, False)
        if (result.HasError()):
            return result

        status = KratosConstants.ExtAcquisitionStatus.UNKNOWN
        logger.info("Kratos: Waiting For Acquisition To Be Ready")
        # Wait for up to 60seconds for the waiting for trigger screen
        startTime = datetime.datetime.now()
        while (status !=
               KratosConstants.ExtAcquisitionStatus.WAITING_FOR_TRIGGER
               and (datetime.datetime.now() - startTime).seconds < 60):
            time.sleep(2)
            status = self.GetExtAcquisitionStatus()

        if (status !=
                KratosConstants.ExtAcquisitionStatus.WAITING_FOR_TRIGGER):
            return StatusResult.Error(
                "Kratos: Acquisition Is Not Ready. Check That A Measurement Can Be Performed Manually"
            )

        return StatusResult.Success()
示例#11
0
    def PingStatus(self, IpAddress):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: PingStatus
        # Input: IpAddress
        # Description:Pings the machine (with IpAddress provided as an argument)
        # Return: StatusResult() object
        #-------------------------------------------------------------------------------------------------------------------
        """
        result = CommandLine.RunCommand('ping ' + IpAddress, 30)
        if result.Status.HasError():
            logger.error("Error in pinging host {0} . {1}".format(
                IpAddress, result.CmdResult.Output))
            return StatusResult.Error("Error in pinging host {0} . {1}".format(
                IpAddress, result.CmdResult.Output))

        logger.info(result.CmdResult.Output)

        if ('unreachable.' in result.CmdResult.Output):
            #No route from the local system. Packets sent were never put on the wire.
            return StatusResult.Error('IpAddress is unreacheable. ' +
                                      result.CmdResult.Output)

        elif ('Ping request could not find host' in result.CmdResult.Output):
            return StatusResult.Error('host_not_found. ' +
                                      result.CmdResult.Output)

        elif ('Request timed out.' in result.CmdResult.Output):
            return StatusResult.Error('Connection time out' +
                                      result.CmdResult.Output)

        return StatusResult.Success()
示例#12
0
    def GetAcquisitionError(self):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: GetAcquisitionError
		# Description: Get Acquisition Error if encountered
		#-------------------------------------------------------------------------------------------------------------------
		"""
        logger.info("Getting Acquisition Error")
        commandToRun = "GetAcquisitionError()"
        result = self.SendCommandAndGetResponse(commandToRun, False)
        if result.HasError():
            return result

        outputs = None
        if self.LastApiResponse:
            outputs = self.LastApiResponse.split(",")

        if (outputs == None or len(outputs) == 0):
            return StatusResult.Error(
                f"Incorrect response from Kratos while checking for Acquisition errors. Response: {self.LastApiResponse}"
            )

        if (outputs[0] != "NO ERROR"):
            return StatusResult.Error(
                f"Error response from Kratos while checking for Acquisition errors. Response: {self.LastApiResponse}"
            )

        return StatusResult.Success()
    def SetupServerIperf(port, throughput):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: SetupServerIperf
        # Input: Takes two arguments
        #       argument1: port
        #       argument2: throughput
        # Description: Function used start iPerf Server
        # Return: StatusResult result
        #-------------------------------------------------------------------------------------------------------------------
        """
        logger.info("Calling SetupServerIperf function")
        logger.info("TBS: Starting Iperf Server")
        command = TbsIPerfActions.plinkstr + "iperf -s -p " + str(
            port) + " -u -i2 -w " + str(throughput) + "M "
        logger.info("TBS: " + str(command))
        try:
            logger.info("Creating iPerfServer Thread")
            iPerfServerThread = Thread(target=CommandLine.RunCommand,
                                       args=[command, 15])
            logger.info("Staring iPerfServer Thread")
            iPerfServerThread.start()
        except Exception as e:
            logger.error("Exception raised from SetupServerIperf function: " +
                         str(e))
            return StatusResult.Error(
                "Exception raised from SetupServerIperf function: " + str(e))

        time.sleep(10)
        logger.info("SetupServerIperf function worked fine")
        return StatusResult.Success()
示例#14
0
    def CopyUdasLogs(self):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: CopyUdasLogs
        # Input: Takes no argument
        # Description: Copy UDAS waveform from Default location to Logs location
        # Return: StatusResult() object
        #-------------------------------------------------------------------------------------------------------------------
        """

        self.udasDir = TestCaseConfig.ReportsPath + '\\UDAS'
        logger.info("UDAS Directory : " + self.udasDir)

        logger.info("Copying UDAS waveform from Default location to Logs location")

        try :
            os.makedirs(self.udasDir)
        except OSError :
            if not os.path.exists(self.udasDir) :
                return StatusResult.Error("Error in creating UDAS Directory on Automation PC : " + self.udasDir)

        try:
            files = os.listdir(self.logsPath)
            for file in files:
                shutil.copy(os.path.join(self.logsPath, file), os.path.join(self.udasDir, file))
        except Exception as e:
            return StatusResult.Error('Failed to copy UDAS waveform : ', str(e))

        logger.info("Copying UDAS waveform Completed")

        return StatusResult.Success()
示例#15
0
    def StartMeasurement(self):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: StartMeasurement
        # Input: Takes no argument
        # Description: Starts power measurement on ALPACA
        # Return: StatusResult() object
        #-------------------------------------------------------------------------------------------------------------------
        """
        if self.boardHasEpm:
            if self.epm.getData:
                logger.warning('ALPACA : Measurement already running. Stopping previous measurement')

                result = self.StopMeasurement()
                if result.HasError():
                    logger.error('ALPACA : Error stopping previous measurement')
                    return result

            logger.info('ALPACA : Starting measurement')

            try:
                self.epm.StartMeasurement()
            except Exception as e:
                logger.error(str(e))
                return StatusResult.Error('ALPACA : ', str(e))

        return StatusResult.Success()
示例#16
0
    def sendtbsltecomponentrawcommand(self, **kwargs):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: sendtbsltecomponentrawcommand
		# Description: This function allow user access any tbslte component module raw function directly
		# Input: Takes argument :
		#   component_name (:class:`str`): : Required: Component name
		#       tbslte.BMSC, tbslte.GW, tbslte.MME, tbslte.ENB, tbslte.CELL
		#   componet_index (:class:`str`): : Required: Value can be 'all'
		#       component or component index
		#   method (:class:`str`): None: Required:TBS raw API, please use
		#       go/tbsltedoc https://qct-artifactory.qualcomm.com/artifactory
		#       /tbs-content-browsing-local/sphinx_docs.zip!/sphinx_docs/index.html for API detail
		#   inputs (:class:`list`): : Required: TBS component raw API input
		#       parameters.  It supports multiple parameters
		# Example:
		#   sendtbsltecomponentrawcommand({component_name='CELL', componet_index='all', method='set_mimo_ior',inputs=-50 })
		#       Send set_mimo_ior input -50 in all Panda Cell
		#   sendtbsltecomponentrawcommand({component_name='CELL',componet_index= 'all', method= 'get_mimo_ior'})
		#       Send get_mimo_ior input None in all Panda Cell
		#   sendtbsltecomponentrawcommand({component_name='CELL',componet_index= '1',method= 'get_mimo_ior'})
		#       Send get_mimo_ior input None in all Panda Cell index 1
		# Return: StatusResult() object
		#-------------------------------------------------------------------------------------------------------------------
		"""
        if not self._get_tbslteutil_handle():
            return StatusResult.Error("TBSLTEUtil handle not initialized")

        try:
            component_name = kwargs.get('component_name')
            componet_index = kwargs.get('componet_index')
            method = kwargs.get('method')
            inputs = kwargs.get('inputs')
            output = self._tbslte_handle.tbslte_component_dispatcher(
                component_name, component_index, method, inputs)
        except Exception as e:
            return StatusResult.Error(
                f"TBSLTEUtil threw an exception during tbslte_component_dispatcher: {e}"
            )

        if not output:
            return StatusResult.Error(
                f"Failed to run sendtbsltecomponentrawcommand for the input: {json.dumps(kwargs)}"
            )

        logger.info(
            f"Successful in running sendtbsltecomponentrawcommand for the input: {json.dumps(kwargs)}"
        )
        return StatusResult.Success()
示例#17
0
    def StopMeasurement(self):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: StopMeasurement
        # Input: Takes no argument
        # Description: Stops power measurement on ALPACA if power measurement in progress
        # Return: StatusResult() object
        #-------------------------------------------------------------------------------------------------------------------
        """
        #pdb.set_trace()
        logger.info('ALPACA : Stopping measurement')

        if self.boardHasEpm:
            if not self.epm.getData:
                logger.warning('ALPACA : Measurement not running')
                return StatusResult.Success()

            try:
                self.epm.StopMeasurement()
            except Exception as e:
                logger.error(str(e))
                return StatusResult.Error('ALPACA : ', str(e))

        return StatusResult.Success()
    def GetTECComPort():
        """
        -------------------------------------------------------------------------------------------------------------------
         Name: GetTECComPort
         Input: Takes no argument
         Description: Get the COM port number for TEC
         Return: StatusResult() object
        -------------------------------------------------------------------------------------------------------------------
        """
        port = WindowsComPort.GetComPort('prolific usb-to-serial comm port')
        if not port:
            return StatusResult.Error('TEC not detected!')

        logger.info("The COM port of the TEC is " + port.device)
        return StatusResult.Success()
示例#19
0
    def initialize_handler(self):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: initialize_handler
		# Description: Create TBSLTEUtility handle and connect to Qualcomm LTE(4G) Test Base Station based on key tbslte_host_id
		# Input: Takes no argument
		# Return: StatusResult() object
		#-------------------------------------------------------------------------------------------------------------------
		"""
        self._host_id = TestSuiteConfig.TbsLteHostId
        if self._host_id is None:
            return StatusResult.Error("TbsLteHostId is not provisioned")

        logger.debug(
            f"TBSLTE Host ID {self._host_id} obtained from input XML key TbsLteHostId"
        )
        return StatusResult.Success()
示例#20
0
    def GetAcquisitionStatus(self):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: GetAcquisitionStatus
		# Description: This methods checks if Acquisition is in progress
		#-------------------------------------------------------------------------------------------------------------------
		"""
        # logger.info("Getting Acquisition Status")
        commandToRun = "GetAcquisitionStatus()"
        result = self.SendCommandAndGetResponse(commandToRun, False)
        if (result.HasError()):
            return (result, False)

        isAcquiring = True if (self.LastApiResponse
                               == "ACQUISITION IN PROGRESS") else False

        return (StatusResult.Success(), isAcquiring)
示例#21
0
    def UsbOn(self):
        """
        -------------------------------------------------------------------------------------------------------------------
         Name: UsbOn
         Input: Takes no argument
         Description: Enables USB
         Return: StatusResult() object
        -------------------------------------------------------------------------------------------------------------------
        """
        logger.info("Spiderboard: USB On")
        result = self.ExecuteCommand(SpiderBoard.usbOn)
        if result.HasError():
            logger.error(result.ErrorMessage())
            return StatusResult.Error("USB on with the Spiderboard failed!  " +
                                      result.ErrorMessage())

        return StatusResult.Success()
示例#22
0
    def sendtestabilitycommandonltetbs(self, **kwargs):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: sendtestabilitycommandonltetbs
		# Description: Sends testability command to tbslte station
		# Input: Takes argument :
		#   command (:class:`str`): : Required: The testability command to execute
		# Example:
		#   sendtestabilitycommandonltetbs({command="MME COMMAND GET MME_QUERY_STATE"})
		#       Send testability command MME COMMAND GET MME_QUERY_STATE to
		#       the TBSLTE station
		# Return: StatusResult() object
		#-------------------------------------------------------------------------------------------------------------------
		"""
        if not self._get_tbslteutil_handle():
            return StatusResult.Error("TBSLTEUtil handle not initialized")

        try:
            command = kwargs.get('command')
            output = self._tbslte_handle.send_testability_command(command)
        except Exception as e:
            return StatusResult.Error(
                f"TBSLTEUtil threw an exception while sending testability command to tbslte station: {e}"
            )

        if output is None:
            return StatusResult.Error(
                'Sending testability command failed, returned None')

        else:
            # TBSLTE returns dict include request_status.
            result_hash = str(command).split(' ')[0] + '_STATUS'
            if (result_hash in output.keys()
                    and 'REQUEST_STATUS' in output[result_hash].keys()
                    and output[result_hash]['REQUEST_STATUS']['ERROR'] == 0
                    and output[result_hash]['REQUEST_STATUS']['CAUSE']
                    == 'SUCCESS'):
                logger.info(
                    "Successful in sending testability command to TBSLTE system"
                )
            else:
                return StatusResult.Error(
                    f'Sending testability command failed, returned output: {json.dumps(output)}'
                )

        return StatusResult.Success()
示例#23
0
    def ActivateBSECell(self):
        try:
            logger.info("Activating BSE Cell")
            result = self.SendCommandAndGetResponse(
                "-m ActivateBSECell-" + self.address + "," +
                UxmCallBoxHandler.protocolType)
            if result.Status.HasError():
                return result
            '''
							Logic to check if the operation performed is successfull
							It could be parsing the obtained console log
					'''
        except Exception as ex:
            return StatusResult.Error("Failed To De Register UE From IMS : " +
                                      str(ex))

        return StatusResult.Success()
示例#24
0
    def RestartKratos(self, IpAddress):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: RestartKratos
        # Input: Takes Argument: IpAddress of the KratosMachine
        # Description: Terminates the Kratos application on the kratosmachine. Batch file running on the machine will restart the kratos app.
        # Return: StatusResult() object
        #-------------------------------------------------------------------------------------------------------------------
        """

        logger.info("Restarting Kratos Application")
        methodString = " -m RestartKratos2-" + str(IpAddress)
        result = self.SendCommandAndGetResponse(methodString)
        if result.Status.HasError():
            logger.error("Error in Sending Command to RestartKratos")
            return result.Status
        time.sleep(300)
        return StatusResult.Success()
示例#25
0
    def CloseSpiderboardComPort(self):
        """
        -------------------------------------------------------------------------------------------------------------------
         Name: CloseSpiderboardComPort
         Input: Takes no argument
         Description: Close the COM port connection to the Spiderboard.
         Return: StatusResult() object
        -------------------------------------------------------------------------------------------------------------------
        """

        if self.serObj:
            result = WindowsComPort.CloseComPort(self.serObj)
            if result.HasError():
                logger.error('Failed to close Spiderboard COM port:')
                logger.error(result.ErrorMessage())
                return result

        return StatusResult.Success()
示例#26
0
    def Relay2Off(self):
        """
        -------------------------------------------------------------------------------------------------------------------
         Name: Relay2Off
         Input: Takes no argument
         Description: Disables Relay2
         Return: StatusResult() object
        -------------------------------------------------------------------------------------------------------------------
        """
        logger.info("Spiderboard: Relay2 Off")
        result = self.ExecuteCommand(SpiderBoard.relay2Off)
        if result.HasError():
            logger.error(result.ErrorMessage())
            return StatusResult.Error(
                "Relay2 off with the Spiderboard failed!  " +
                result.ErrorMessage())

        return StatusResult.Success()
示例#27
0
    def RecallAgilentUXMRegister(self, register):
        try:
            logger.info("Recalling Agilent UXM Register  : " + register)
            print("Recalling Agilent UXM Register  : " + register)
            result = self.SendCommandAndGetResponse(
                "-m RecallAgilentUXMRegister-" + self.address + "," +
                register + "," + UxmCallBoxHandler.protocolType)
            if result.Status.HasError():
                return result
            '''
							Logic to check if the operation performed is successfull
							It could be parsing the obtained console log
					'''
        except Exception as ex:
            return StatusResult.Error("Failed To De Register UE From IMS : " +
                                      str(ex))

        return StatusResult.Success()
示例#28
0
    def initialize_scenario(self):
        """
		#-------------------------------------------------------------------------------------------------------------------
		# Name: initialize_scenario
		# Description: Initialize instance variables for a single scenario
		# Input: Takes no argument
		# Return: StatusResult() object
		#-------------------------------------------------------------------------------------------------------------------
		"""
        if self._tbslte_handle is None:
            try:
                self._tbslte_handle = TBSLTEUtil(self._host_id)
            except Exception as e:
                logger.error(
                    'Failed to initialize TBS module. Please make sure your TBS is running on Octopus 96 or above'
                )
                return StatusResult.Error(
                    f'Failed to create TBSLTEUtil object. Error: {e}')
        return StatusResult.Success()
示例#29
0
    def ReleaseTacPort(self):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: ReleaseTacPort
        # Input: Takes no argument
        # Description: close TAC port
        # Return: StatusResult() object
        #-------------------------------------------------------------------------------------------------------------------
        """
        if self.boardHasTac and hasattr(self.tac, 'ser'):
            try:
                logger.debug('Releasing TAC port')
                self.tac.ser.close()
            except Exception as e:
                logger.error('Failed to close TAC port')
                logger.error(str(e))
                return StatusResult.Error('Failed to close TAC port : ', str(e))

        return StatusResult.Success()
    def SetTemperature(self, temperature):
        """
        #-------------------------------------------------------------------------------------------------------------------
        # Name: SetTemperature
        # Input: Takes one argument
        #       argument1: Temperature in degree C
        # Description: Sets temperature on Thermal Controller
        #-------------------------------------------------------------------------------------------------------------------
        """
        logger.info("Setting temperature to " + str(temperature))
        methodString = "-m SetTemperature-" + str(temperature)
        result = self.SendCommandAndGetResponse(methodString)
        if result.Status.HasError():
            logger.error("Error in setting Temperature" +
                         result.CmdResult.Output)
            return result.Status

        logger.debug("SetTemperatue function working fine")
        return StatusResult.Success()