예제 #1
0
    def record_results(self, resid):

        import traceback
        import string
        import sys
        flag = False
        print "In record results"
        tb = self.config.testbedname
        tb_redstone = "TitanLBand_" + tb.split("_")[1] + "_" + tb.split("_")[2]
        self.info("Checking for the existence of testbed: %s" % (tb_redstone))
        res = database.check_testbed(tb_redstone)
        if(res):
            self.info("Testbed %s : Present" % (tb_redstone))
            flag = True
            self.info("Updating the same constants to testbed %s" % (tb_redstone))
        else:
            self.info("Testbed %s : NOT Present" % (tb_redstone))
            flag = False

        if(self.record):
            try:
                self.info("Storing testbed constants to the database")
                # First store the constants records to "ConstantsHistory" Table
                for key in CalConfig.tempSqlObject:
                     database.put_constant_value(CalConfig.tempSqlObject[key])
                # Update the Constants table with new values
                # The above sequence should not be changed.
                for key in self.dbRes:
                    database.update_constant_value(self.config.testbedname,key,self.dbRes[key])
                    if(flag):
                        database.update_constant_value(tb_redstone,key,self.dbRes[key])
            except:
                print "An error was thrown: %s" \
                      %string.join(traceback.format_exception(*sys.exc_info()), '')
                pass
예제 #2
0
    def getCalDataFromDB(self, testbed):
        
        CalConfig.tempSqlObject = {}
        res = database.check_testbed(testbed)
        if(not res):
            self.info("Testbed:%s does not exist in database" % (testbed))
            self.info("Creating testbed:%s and populating the testbed"
                      " constants in the database"% testbed)
            result = self.createTestbed(testbed)
            if(not result):
                self.failed("Not able to create the testbed in database")
                return False
        else:
            self.info("Testbed:%s already exists in database" % (testbed))

        #P1_1 Cal Constants EdfaOut Vs Tx
        CalConfig.outCal_switchModule = database.get_constant_value(testbed,"outCal_switchModule").ConstantValue
        CalConfig.outCal_switchSubMod = eval(database.get_constant_value(testbed,"outCal_switch_subModule").ConstantValue)
        CalConfig.outCal_switchPosition['edfaOut'] = eval(database.get_constant_value(testbed,"outCal_switchPos_edfaOut").ConstantValue)
        CalConfig.outCal_switchPosition['uutTx' ]  = eval(database.get_constant_value(testbed,"outCal_switchPos_uutTx").ConstantValue)        

        #P1_2 Cal Constants DemodOut1 Vs DemodOut2
        #CalConfig.pdPad_switchModule = database.get_constant_value(testbed,"pdPad_switchModule").ConstantValue
        #CalConfig.pdPad_switchSubMod = eval(database.get_constant_value(testbed,"pdPad_switch_subModule").ConstantValue)
        #CalConfig.pdPad_switchPosition['dmodOut1'] = eval(database.get_constant_value(testbed,"pdPad_switchPos_dmodOut1").ConstantValue)
        #CalConfig.pdPad_switchPosition['dmodOut2'] = eval(database.get_constant_value(testbed,"pdPad_switchPos_dmodOut2").ConstantValue)        
        
        for const in CalConfig.constLst:
            print "debug:", const
            CalConfig.tempSqlObject[const] = database.get_constant_value(testbed,const)
        
        CalConfig.voaAttn_zerodBm_for_pMeter_Prev = float(CalConfig.tempSqlObject['voaAttn_zerodBm_for_pMeter'].ConstantValue)
        CalConfig.dicon_sw1_pwrReading_Prev =  float(CalConfig.tempSqlObject['dicon_sw1_pwrReading'].ConstantValue)
        CalConfig.dicon_sw2_pwrReading_Prev =  float(CalConfig.tempSqlObject['dicon_sw2_pwrReading'].ConstantValue)
        CalConfig.dicon_sw3_pwrReading_Prev =  float(CalConfig.tempSqlObject['dicon_sw3_pwrReading'].ConstantValue)
        CalConfig.dicon_sw4_pwrReading_Prev =  float(CalConfig.tempSqlObject['dicon_sw4_pwrReading'].ConstantValue)

        CalConfig.outCal_inputPwr_forCalibration_Prev = float(CalConfig.tempSqlObject['outCal_inputPwr_forCalibration'].ConstantValue)     
        CalConfig.outCal_sw1_pwrReading_Prev = float(CalConfig.tempSqlObject['outCal_sw1_pwrReading'].ConstantValue)       
        CalConfig.outCal_sw2_pwrReading_Prev = float(CalConfig.tempSqlObject['outCal_sw2_pwrReading'].ConstantValue)

        #CalConfig.inputPwr_pdSwitchCal_Prev = float(CalConfig.tempSqlObject['inputPwr_pdSwitchCal'].ConstantValue)
        #CalConfig.pdCal_sw1_pwrReading_Prev = float(CalConfig.tempSqlObject['pdCal_sw1_pwrReading'].ConstantValue)
        #CalConfig.pdCal_sw2_pwrReading_Prev = float(CalConfig.tempSqlObject['pdCal_sw2_pwrReading'].ConstantValue)
        return True
예제 #3
0
    def record_results(self, resid):
        import traceback
        import string
        import sys

        flag = False
        print "In record results"
        tb = self.config.testbedname
        tb_redstone = "Redstone_" + tb.split("_")[1] + "_" + tb.split("_")[2]
        self.info("Checking for the existence of testbed: %s" % (tb_redstone))
        res = database.check_testbed(tb_redstone)
        if res:
            self.info("Testbed %s : Present" % (tb_redstone))
            flag = True
            self.info("Updating the same constants to testbed %s" % (tb_redstone))
        else:
            self.info("Testbed %s : NOT Present" % (tb_redstone))
            flag = False

        if self.record:
            try:
                self.info("Storing testbed constants to the database")
                # First store the constants records to "ConstantsHistory" Table
                # If its first cal run dont store default dummy values to
                # constants_history table
                if not self.newTB:
                    for key in CalConfig.tempSqlObject:
                        database.put_constant_value(CalConfig.tempSqlObject[key])
                # Update the Constants table with new values
                # The above sequence should not be changed.
                for key in self.dbRes:
                    database.update_constant_value(self.config.testbedname, key, self.dbRes[key])
                    if flag:
                        database.update_constant_value(tb_redstone, key, self.dbRes[key])
            except:
                print "An error was thrown: %s" % string.join(traceback.format_exception(*sys.exc_info()), "")
                pass
        else:
            self.info("Testbed Calibration constants NOT stored")
예제 #4
0
파일: __init__.py 프로젝트: pruan/TestDepot
#print sys.argv
num = len(sys.argv)
cl = sys.argv
#print "cl[4]:", cl[4]
#print "len of sys.argv:",num
for i in range(num):
    #print "i=",i
    str1 = str(cl[i])
    #print "str:", str1
    if (str1.find('testbedname') > 0):
        l1 = str1.split('=')
        testbed = l1[1]

#print "Testbed:", testbed

res = database.check_testbed(testbed)
if(not res):
    print ("\033[1;33m%s is not a valid testbed\033[m" % testbed)
    sys.exit(0)


#Check the lastupdate date in one of the calibration parameters
try:
    lc =  str (
        database.get_constant_value(testbed,"voaAttn_zerodBm_for_pMeter").LastUpdate
    )
except:
    print ("\033[1;33mUnable to retrieve testbed details from database\033[m")
    sys.exit(0)

#print lc