def test_method(self): errorCount = 0 sc = self.SC # bandwidth xunit = self.config.osaParams["scaleXunit"] # now begin the actual testing osnrList = self.config.osnrList cdTestList = self.config.cdTestList osnrTol = self.config.osnrParams["tol"] targetRefRxPwr = self.config.cardParams['rxpwr'][0] targetPwr = targetRefRxPwr uutRxTol = self.config.cardParams['tol'][0] refRxTol = self.config.cardParams["tol"][0] minosnr, maxosnr = self.config.osnrSpecRange INVALIDBER = self.config.INVALIDBER refsn = self.REFRX.SN vssd_offsets = self.config.vssd_offsets osnrBerLimits = self.config.osnrBerLimits bwlist = self.config.bwLimit bw = PQ("3.0 dB") bwLowerLimit,bwUpperLimit = bwlist[bw] print bwUpperLimit,bwLowerLimit self.dbRes = {} tb = self.config.testbed for cd in cdTestList: for targetOSNR in osnrList: for sn in self.uutSnList: #excluding refsn slot = self.uutDict[sn]["slot"] uut_slot = int(slot) ser_obj = self.uut_ser_dict[slot] obj = ser_obj UUT_ber = "UUT_slot%s" % slot ber_obj = self.uut_ser_dict[UUT_ber] uutid = self.uutDict[sn]["id"] self.dbRes[uutid] = {} g1a1_opt_pass = False ssd_opt_pass = False slot_num = (uut_slot-1) % 4 self.info("Disabling module prior to writing EEPROM") sc.module_control(slot, "Disable", self) self.info("Enabling module...") sc.module_control(slot, "Enable", self) download = True for sn in self.uutSnList: slot = self.uutDict[sn]["slot"] uutid = self.uutDict[sn]["id"] if self.errorCount[sn]: self.lf.write("\n\nERROR: slot%s(%s):\n VssdVg1a1Sweep test failed.\n" %(slot, sn)) self.failed("slot%s(%s): VssdVg1a1Sweep test failed." %(slot, sn), uutid) else: # clean up logs if the test passes by providing the diagnostic # dictionary to the clean-up function. Diag.clean_up_logs(sn, self.diag) self.passed ("%s(%s): VssdVg1a1Sweep test passed." % (slot, sn), uutid) if(download): self.info("Resetting line card so tag changes can take affects...") # DO THIS FROM CAROL ber_obj.reset_card() reset_dsp_sleep_time = 180 self.info("Wait %s seconds for DSP to come up..." % reset_dsp_sleep_time) time.sleep(reset_dsp_sleep_time) return self.completed("VssdVg1a1Sweep test completed.")
def test_method(self): errorCount = 0 MAXTAPS = self.config.MAXTAPS DELAY = self.config.DELAY INNER_LOOPS = self.config.INNER_LOOPS OUTER_LOOPS = self.config.OUTER_LOOPS DEBUG_LEVEL = self.config.DEBUG_LEVEL SKIP_G2M = self.config.SKIP_G2M SKIP_M2G = self.config.SKIP_M2G SKIP_J2G = self.config.SKIP_J2G LVDS_THRESHOLD = self.config.LVDS_THRESHOLD RESET_EN = self.config.RESET_EN DIE_ON_FAIL = self.config.DIE_ON_FAIL AIS_EN = self.config.AIS_EN PRBS_EN = self.config.PRBS_EN SET_SUMMIT_VOLTAGES = self.config.SET_SUMMIT_VOLTAGES expected_fpga_ver = self.config.EXPECTED_FPGA_VERSION UPPER_LIMIT = 10 # biggest window width that makes sense self.info("************ OPTIONS CONFIGURED ***************") if AIS_EN: self.info("AIS Enabled on Tx") if (DIE_ON_FAIL): self.info("STOP ON FAIL") if (PRBS_EN): self.info("PRBS Enabled on Tx") else: self.info("PRBS Disabled on Tx") self.uut_ser_dict = {} for sn, uut_dict in self.uutDict.items(): slot = uut_dict['slot'] UUT_mike_slot = "UUT_slot%s_mike" % slot UUT_carol_slot = "UUT_slot%s" % slot UUT_mike = self.uutDict[sn]['mike'] UUT_carol = self.uutDict[sn]['obj'] self.uut_ser_dict[sn] = uut_dict self.uut_ser_dict[UUT_carol_slot] = UUT_carol uutid = self.uutDict[sn]["id"] # just read out Marsha verison marsha_verison = UUT_carol.get_marsha_version() self.info("Marsha FPGA version: %s" % marsha_verison) # step1: make sure the FPGA is correctly loaded. raw_version = UUT_carol.show_fpga_version() #if raw_version.find('showVersion not found') >= 0: # self.error("FPGA not loaded correctly!") # raise TestSuiteAbort, "FPGA not loaded correctly!" #else: # #fpga_version = raw_version.split("\r\n")[0].strip() # #if fpga_version != expected_fpga_ver: # # raise TestSuiteAbort, "got FPGA version (%s), expected (%s)" % (fpga_version, expected_fpga_ver) try: IDELAY_IS_ZERO = self._config.IDELAY_IS_ZERO except: IDELAY_IS_ZERO = True if not IDELAY_IS_ZERO: fpga_version = raw_version.split("\r\n")[0].strip() if fpga_version != expected_fpga_ver: raise TestSuiteAbort, "got FPGA version (%s), expected (%s)" % (fpga_version, expected_fpga_ver) if 1: target_chan5_voltage = self.config.CHANNEL_5_VOLTAGE target_chan2_voltage = self.config.CHANNEL_2_VOLTAGE if SET_SUMMIT_VOLTAGES: target_chan5_voltage = self.config.CHANNEL_5_VOLTAGE target_chan2_voltage = self.config.CHANNEL_2_VOLTAGE # UUT_carol.change_summit_voltages(self, "setVoltageChange", long_method=False) else: UUT_carol.change_summit_voltages(self, "setVoltageDefault", long_method=False) time.sleep(10) (raw_voltages, volt_dict) = UUT_carol.get_summit_voltages() self.info("Summit Voltages: %s\n" % raw_voltages) try: read_chan5_voltage = volt_dict['5'][1] read_chan2_voltage = volt_dict['2'][1] except: self.error("Summit voltage parse error, trying again!") time.sleep(10) (raw_voltages, volt_dict) = UUT_carol.get_summit_voltages() self.info("Summit Voltages: %s\n" % raw_voltages) try: read_chan5_voltage = volt_dict['5'][1] read_chan2_voltage = volt_dict['2'][1] except: self.error("Error reading Summit voltage on 2nd try! Setting values to 0") read_chan5_voltage = 0 read_chan2_voltage = 0 if abs(float(read_chan5_voltage) - float(target_chan5_voltage)) > 0.01: self.error("Set voltage (%s) is greater than tolerance (0.01) from target (%s)" % (read_chan5_voltage, target_chan5_voltage)) raise TestSuiteAbort, "Set voltage (%s) is greater than tolerance (0.01) from target (%s)" % (read_chan5_voltage, target_chan5_voltage) if abs(float(read_chan2_voltage) - float(target_chan2_voltage)) > 0.01: self.error("Set voltage (%s) is greater than tolerance (0.01) from target (%s)" % (read_chan2_voltage, target_chan2_voltage)) raise TestSuiteAbort, "Set voltage (%s) is greater than tolerance (0.01) from target (%s)" % (read_chan2_voltage, target_chan2_voltage) comment = self.config.comment chan5_volt = "%s" % volt_dict['5'][1] chan2_volt = "%s" % volt_dict['2'][1] if not comment: comment = "" # there's a user comment if not IDELAY_IS_ZERO: comment += "VERSION=%s " % fpga_version comment += " Chan5Voltage=%s " % chan5_volt comment += " Chan2Voltage=%s " % chan2_volt comment += " Marsha=%s" % marsha_verison comment += " Resets=%s" % self.config.OUTER_LOOPS comment += " SCR_VER=%s" % self.SCREEN_VERSION self.config.comment = comment # set the channel. uut_tdc_type = UUT_mike.get_tdc_type() if uut_tdc_type == 0x1: chn = 51 else: chn = 50 self.info("Setting UUT to channel %s" % chn) UUT_mike.ModChan = chn # check Tx & Rx power, if they are greater than 1dbm difference, # then prompt user to check power cable and check again. self.info("Checking Tx & Rx power...") TxPwr = UUT_mike.show_line_tx_pwr() # check the power RxPwr = UUT_mike.RxPwr self.info("TxPwr: %s, RxPwr: %s" % (TxPwr, RxPwr)) if abs(TxPwr - RxPwr) > PQ("5.0 dBm"): self.error("TxPwr (%s) & RxPwr (%s) is greater than 1dBm" % (TxPwr, RxPwr)) self.user_input("Please make sure a loopback cable is connected between line Tx & line Rx port, press Enter to try again") TxPwr = UUT_mike.show_line_tx_pwr() RxPwr = UUT_mike.RxPwr if abs(TxPwr - RxPwr) > PQ("1.0 dBm"): raise TestSuiteAbort, "TxPwr (%s) & RxPwr (%s) is greater than 1dBm" % (TxPwr, RxPwr) self.info("TxPwr: %s, RxPwr: %s" % (TxPwr, RxPwr)) self.info("Ensure that OTU3 Framing and FEC are enabled") self.info("AIS_EN: %s" % AIS_EN) if (AIS_EN): UUT_mike._cmd("mw 0x5200 0xa5", DEBUG_LEVEL, self) else: UUT_mike._cmd("mw 0x5200 0xa0", DEBUG_LEVEL, self) UUT_mike._cmd("mw 0x5212 3", DEBUG_LEVEL, self) UUT_mike._cmd("startLoops") fixed_dispersion = 0.0 self.info("Set UUT TDC to dispersion of %s and fixed mode..." % fixed_dispersion) UUT_mike.set_tdc_fixed(fixed_dispersion) # if it's a 4400, then we need to do some setups if self.config.IS_4400: self.info("Setting for 4040...") # do set4400Check here... UUT_carol.set_4400_to_4040() UUT_carol.enable_line_prbs() sleep_time = 180 self.info("Sleeping for %s seconds" % sleep_time) time.sleep(sleep_time) # initialize array to have 134 elements to zero's j2gWindow = [] g2mWindow = [] m2gWindow = [] # alias GETVAL = UUT_mike.getVal thresh = LVDS_THRESHOLD max_retries = 80 exit_outer_loop = 0 for outerLoop in range(OUTER_LOOPS): j2gWin = [] m2gWin = [] g2mWin = [] if (self.config.RESET_EN): allAligned = 0 while (allAligned == 0): self.info("Realign interfaces...") UUT_mike._cmd("gw 5 2", DEBUG_LEVEL, self) time.sleep(1) tries = 0 tmp_aligned = False while (max_retries != tries): if (GETVAL("gr 0x800f", DEBUG_LEVEL, self)): time.sleep(1) tries += 1 else: tmp_aligned = True break if not tmp_aligned or tries == max_retries: # put inclomplete here... self.error("UUT failed to aligned after %s retries!" % max_retries) return self.incomplete("UUT failed to aligned after %s retries!" % max_retries) #while (GETVAL("gr 0x800f", DEBUG_LEVEL, self)) : # time.sleep(1) if (PRBS_EN): UUT_mike._cmd("mw 0x88 0x15", DEBUG_LEVEL, self) time.sleep(3) UUT_mike._cmd("kick", DEBUG_LEVEL, self) time.sleep(1) tmp_aligned = False while (max_retries != tries): if (GETVAL("gr 0x800f", DEBUG_LEVEL, self)): time.sleep(1) tries += 1 else: tmp_aligned = True break if not tmp_aligned or tries == max_retries: # put inclomplete here... self.error("UUT failed to aligned after %s retries!" % max_retries) return self.incomplete("UUT failed to aligned after %s retries!" % max_retries) time.sleep(5) #### new for verion 10 UUT_mike._cmd("bw 0x55 0x8", DEBUG_LEVEL, self) time.sleep(3) UUT_mike._cmd("bw 0x55 0xa", DEBUG_LEVEL, self) ######################### UUT_mike._cmd("gw 5 1", DEBUG_LEVEL, self) status = GETVAL("gr 5", DEBUG_LEVEL, self) while ((status & 2) == 0) : time.sleep(1) status = GETVAL("gr 5", DEBUG_LEVEL, self) status = GETVAL("gr 5", DEBUG_LEVEL, self) trys = 0 while (((status & 8) == 0) and (trys < 10)) : time.sleep(1) status= GETVAL("gr 5", DEBUG_LEVEL, self) trys = trys+1 time.sleep(1) self.info("Check for coarse alignment (< 2^16 errors are valid)") j2gHi = GETVAL("gr 0xbb", DEBUG_LEVEL, self) j2gLo = GETVAL("gr 0xba", DEBUG_LEVEL, self) g2mHi = GETVAL("mr 0xbb", DEBUG_LEVEL, self) g2mLo = GETVAL("mr 0xba", DEBUG_LEVEL, self) m2gHi = GETVAL("gr 0xbf", DEBUG_LEVEL, self) m2gLo = GETVAL("gr 0xbe", DEBUG_LEVEL, self) if (j2gHi==0) & (j2gLo==0) & (g2mHi==0) & (g2mLo==0) & (m2gHi==0) & (m2gLo==0) : allAligned = 1 else: self.info("\n!!! WARNING: COULD NOT ALIGN. TRYING AGAIN !!!\n") self.info("Stopping software loop..") time.sleep(3) UUT_mike._cmd("stopLoops", DEBUG_LEVEL, self) if exit_outer_loop & DIE_ON_FAIL: # exit_loop is set inside innerLoop break for innerLoop in range(INNER_LOOPS): loop = (outerLoop * INNER_LOOPS) + innerLoop if not SKIP_J2G: window_width = self.check_ldvs_between_fpgas(UUT_mike, 'Jan-to-Greg', outerLoop, innerLoop, loop) j2gWin.append(window_width) #j2gWindow[loop] = (window_width) if ((window_width < thresh) or (window_width > UPPER_LIMIT)): self.errorCount[sn] += 1 self.error("J->G window width %s not within (%s,%s)" % (window_width, thresh, UPPER_LIMIT)) exit_outer_loop = 1 self.info("j2g: %s" % j2gWindow) if not SKIP_G2M: window_width = self.check_ldvs_between_fpgas(UUT_mike, 'Greg-to-Marcia', outerLoop, innerLoop, loop) g2mWin.append(window_width) #g2mWindow[loop] = (window_width self.info("g2m: %s" % g2mWindow) if ((window_width < thresh) or (window_width > UPPER_LIMIT)): self.errorCount[sn] += 1 self.error("G->M window width %s not within (%s,%s)" % (window_width, thresh, UPPER_LIMIT)) exit_outer_loop = 1 if not SKIP_M2G: window_width = self.check_ldvs_between_fpgas(UUT_mike, 'Marcia-to-Greg', outerLoop, innerLoop, loop) #m2gWindow[loop] = (window_width) m2gWin.append(window_width) self.info("m2g: %s" % m2gWindow) if ((window_width < thresh) or (window_width > UPPER_LIMIT)): self.errorCount[sn] += 1 self.error("M->G window width %s not within (%s,%s)" % (window_width, thresh, UPPER_LIMIT)) exit_outer_loop = 1 if exit_outer_loop & DIE_ON_FAIL: break j2gWindow.append(j2gWin) m2gWindow.append(m2gWin) g2mWindow.append(g2mWin) UUT_mike._cmd("startLoops", DEBUG_LEVEL, self) self.widths_avg[uutid] = {} self.widths_min[uutid] = {} self.widths_dist[uutid] = {} # total widths distribution self.info("**********************************************************************") self.print_summary(uutid, j2gWindow, m2gWindow, g2mWindow) i = 0 j = 0 for j2g_outer, m2g_outer, g2m_outer in zip(j2gWindow, m2gWindow, g2mWindow): for j2g_inner, m2g_inner, g2m_inner in zip(j2g_outer, m2g_outer, g2m_outer): if (j2g_inner < thresh): self.error("Iteration(%s,%s) J->G window width %s less than %s" % (i, j, j2g_inner, thresh)) self.errorCount[sn] += 1 if (m2g_inner < thresh): self.error("Iteration(%s,%s) M->G window width %s less than %s" % (i, j, m2g_inner, thresh)) self.errorCount[sn] += 1 if (g2m_inner < thresh): self.error("Iteration(%s,%s) G->M window width %s less that %s" % (i, j, g2m_inner, thresh)) self.errorCount[sn] += 1 j += 1 i += 1 self.info("**********************************************************************\n\n") self.info("Resetting Line Card to purge special FPGA image...") for sn, uut_dict in self.uutDict.items(): if self.errorCount[sn]: UUT_carol._docmd("resetMe") self.failed("LVDS_Screen test failed.") else: if (self.config.flags.VERBOSE and self.config.flags.DEBUG): Diag.clean_up_logs(sn, self.diag) UUT_carol._docmd("resetMe") self.passed("LVDS_Screen test passed.") self.info("Wait for 60 seconds after UUT reset...") time.sleep(60) return self.completed("LVDS_Screen test completed.")
def test_method(self): errorCount = 0 # now begin the actual testing cdTestList = self.cdTestList osnrList = self.osnrList osnrTol = self.config.osnrParams["tol"] targetRefRxPwr = self.config.cardParams['rxpwr'][0] targetUutRxPwr = PQ('-18.0 dB') uutRxTol = self.config.cardParams['tol'][0] refRxTol = self.config.cardParams["tol"][0] temp = self.DAQ.temperature minosnr, maxosnr = self.config.osnrSpecRange INVALIDBER = self.config.INVALIDBER refsn = self.REFRX.SN wvlngth = self.tdc_channel_dict[self.tdc_type][1] self.info("Starts sweeping CD ...") self.lf.write("Starts sweeping CD ...") tb = self.config.testbed self.info("Enabling LINE PRBS on REF...") self.REFRX_ber.enable_line_prbs() self.REFRX_ber.set_for_tx_prbs() self.tamb = temp PWR_DELTA_MAX = PQ("2.0 dB") for sn in self.uutSnList: #excluding refsn obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] UUT_ber = "UUT_slot%s" % slot ber_obj = self.uut_ser_dict[UUT_ber] self.info("Enabling LINE PRBS...") ber_obj.enable_line_prbs() ber_obj.set_for_rx_prbs() for cd in cdTestList: self.diagnostic("##### Current CD: %s" % cd) # 1. disable CD EDFA output if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Disabling ProgCD output...") self.dBox.set_switch(6, 'cnt') # 2. set ProgCD to cd self.info("Setting dispersion to %s" % cd) self.dBox.dispersion = cd self.info("Dispersion is: %s" % self.dBox.dispersion) # 3. enable ProgCD if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Enabling ProgCD output...") self.dBox.set_switch(6, 'byp') # 4. enable and adjust Input VOAs to achieve targeted OSNR. self.info("Turning on Input VOAs and Stabilizing.....\n" ) for voa in self.config.voaInList: tb[voa].state = "ON" self.VOAOUT.state = "ON" time.sleep(10) # time to settle all instrument tdc_trained = 0 # set to initial osnr to a low value to obtain a small bitty eye self.info("Setting initial OSNR to %s" % self.init_osnr) osnr = set_OSNR(self.OSA, self.VOAASE, self.init_osnr, osnrTol, wvlngth) self.diagnostic("Initial OSNR %s" % osnr) pstatus, rxpwr = set_RxPwr(self.REFRX, self.VOAOUT, targetRefRxPwr, refRxTol) reacq_settle_time = 180 for sn in self.uutSnList: obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] ser_obj = self.uut_ser_dict[slot] self.info("Setting UUT (%s) in slot %s to initial dispersion to: %d" % (sn, slot,-cd)) ser_obj.set_tdc_startdisp(-cd) if 1: self.info("Dumping out UUT TDC setting...") raw_info = ser_obj.show_tdc_state() self.info("%s" % raw_info) self.info("Wait for TDC to heat up...") time.sleep(20) for sn in self.uutSnList: ser_obj = self.uut_ser_dict[slot] self.diagnostic("Forcing demod reacquistion on UUT %s..." % sn) ser_obj.force_demod_reacq() self.info("Sleeping for %s seconds after demod reacq..." % reacq_settle_time) time.sleep(reacq_settle_time) refsn_uut = "%s_%s" % (refsn, sn) for targetOSNR in osnrList: self.info("\n###### Verifying BER at CD: %s, OSNR: %s ######\n" %(cd, targetOSNR,)) self.lf.write("\n\nVerifying BER at CD: %s, OSNR: %s\n" % (cd, targetOSNR,)) # set the correct P3 osnr = set_OSNR(self.OSA, self.VOAASE, targetOSNR, osnrTol, wvlngth) # 5 & 6. enable and adjust output VOA's to achieve target power # reading self.info("Turning on Output VOAs and Stablizing...\n") self.VOAOUT.state = "ON" refindex = 0 #RefRx index in refSnList if (self.config.flags.DEBUG and self.config.flags.VERBOSE): self.info("Start logging diagnostics from UUT Mike Shell...") self.diag_logger[sn].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[sn].capture(None, ser_obj) self.info("Start logging diagnostics from REF Mike Shell...") self.diag_logger[refsn_uut].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[refsn_uut].capture(None, self.REFRX) hsynclosshist = {} hberr = {} cberr = {} lber = {} qval = {} rxpwr = {} qval = {} tdc_disp = {} current_disp = {} q_list = [] uutindex = 0 # UUT index in uutSnList berLimit = self.config.berLimit osnrBerLimits = self.config.osnrBerLimits uut_index = 0 for sn in self.uutSnList: #excluding refsn self.diagnostic("##### Running UUT (%s) " % sn) obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] ser_obj = self.uut_ser_dict[slot] #print self.uut_ser_dict obj = ser_obj UUT_ber = "UUT_slot%s" % slot ber_obj = self.uut_ser_dict[UUT_ber] self.info("Setting UUT Rx Power to %s." % (targetUutRxPwr,)) self.lf.write("\n\nSetting UUT RX Power to %s.\n" % (targetUutRxPwr,)) pstatus, rxpwr[sn] = set_RxPwr(ser_obj, self.VOAOUT, targetUutRxPwr, refRxTol) if not pstatus: self.diagnostic("UUT RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[sn], targetUutRxPwr)) self.lf.write("\n\nWARNING: UUT RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[sn], targetUutRxPwr)) self.info("### Running UUT (%s) on slot (%s)" % (sn, slot)) uut_slot = int(slot) uut_output_sw_name = self.UUT_LINE_OUTPUT_SW.name uut_output_sw_mod_name = self.UUT_LINE_OUTPUT_SW.sw_mod if int(uut_slot) < 6: uut_output_sw_pos = int(uut_slot) - 1 else: uut_output_sw_pos = int(uut_slot) - 5 self.info("### Setting %s to output on %d" % (uut_output_sw_name, uut_output_sw_pos)) self.DiCon.set_4x1_switch_output(uut_output_sw_mod_name, uut_output_sw_pos) # starts TDC trainning. self.info("Starting TDC training process...can take up to 10 minutes") self.tmp_uutDict = copy(self.config.uut_dict) self.tmp_uutSnList = self.tmp_uutDict.keys() tdc_lof_timeout = '120.0' self.info("Setting LOF timeout value %s for TDC..." % tdc_lof_timeout) ser_obj.set_tdc_lof_timeout(tdc_lof_timeout) for ser_no in self.tmp_uutSnList: #excluding refsn self.info("### ser_no: %s" % ser_no) obj = self.tmp_uutDict[ser_no]["obj"] slot = self.tmp_uutDict[ser_no]["slot"] tmp_uut_ser_dict = copy(self.uut_ser_dict) lc = tmp_uut_ser_dict[slot] self.diagnostic("Clearing slot %s(%s) TDC trainning bit..." % (slot, ser_no)) lc.clear_trainning_flag() self.info("Resetting LINE PRBS on REF & UUT...") self.REFRX_ber.reset_line_prbs() ber_obj.reset_line_prbs() hi = max(osnrBerLimits[targetOSNR]) low = min(osnrBerLimits[targetOSNR]) limit_check_timeout = 600 # 6 minutes time_check, lstatus, lber[sn] = self.check_limit(hi, low, ber_obj, ser_obj, self.REFRX_ber, sn, refsn_uut, self.tamb, targetOSNR, cd, limit_check_timeout) self.diagnostic("Check limit done within %s seconds" % time_check) self.diagnostic("SN: %s" % sn) self.diagnostic("Force enabling PRBS generator on REF...") self.REFRX_ber.set_for_tx_prbs() lber[refsn] = self.REFRX_ber.BER rxpwr[refsn] = self.REFRX.RxPwr rxpwr[sn] = obj.RxPwr self.diagnostic("UUT RxPwr: %s" % rxpwr[sn]) self.info("BER: %s" % lber[sn]) if not lstatus: #self.errorCount[sn] += 1 self.error("slot%s(%s):\n UUT current BER not stabilized.\n" %(slot, sn)) self.lf.write("\n\nERROR:slot%s(%s):\n UUT current BER not stabilized.\n" %(slot, sn)) self.info("slot%s(%s):\n TAmb: %s OSNR: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, osnr, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) self.lf.write("\n\nslot%s(%s):\n TAmb: %s OSNR: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, osnr, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) # compare the power delta, abort if the delta is > 2dB pwr_delta = abs(rxpwr[sn] - rxpwr[refsn]) if pwr_delta > PWR_DELTA_MAX: self.error("Power delta %s is greater than %s" % (pwr_delta, PWR_DELTA_MAX)) else: self.info("Power delta %s is within range %s" % (pwr_delta, PWR_DELTA_MAX)) uutindex += 1 qval[sn] = round(get_Q(lber[sn]), 2) tdc_disp[sn] = ser_obj.show_actual_dispersion() numIter = self.config.numIter if cd == 0: # xxx: the reference card has TDC disabled, so for qval[refsn] = round(get_Q(lber[refsn]), 2) else: qval[refsn] = INVALIDBER uutid = self.uutDict[sn]["id"] slot = self.uutDict[sn]["slot"] self.info("%s(%s):\n TAmb: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) self.lf.write("\n\n %s(%s):\n TAmb: %s UUTRxBER: %s RefRxBER: %s " "UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) #Comparing lber with the specified limits uutid = self.uutDict[sn]["id"] self.diagnostic("ID: %s" %uutid) if (self.config.flags.DEBUG and self.config.flags.VERBOSE): self.info("Start logging diagnostics from UUT Mike Shell...") self.diag_logger[sn].info("*** AFTER: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[sn].capture(None, ser_obj) self.info("Start logging diagnostics from REF Mike Shell...") self.diag_logger[refsn_uut].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[refsn_uut].capture(None, self.REFRX) if osnrBerLimits.has_key(targetOSNR): hi = max(osnrBerLimits[targetOSNR]) low = min(osnrBerLimits[targetOSNR]) self.diagnostic("HI: %s, LOW: %s" % (hi, low)) if qval[sn] < low or qval[sn] > hi: self.errorCount[sn] += 1 self.error("%s(%s):\nUUT actual Q %s (%s) not within BER limit (%s, %s)\n" %(slot, sn, qval[sn], lber[sn], low, hi)) self.lf.write("\n\nERROR: %s(%s):\n UUT actual Q %s (%s) not within BER limit (%s, %s)\n" %(slot, sn, qval[sn], lber[sn], low, hi)) else: pass self.lineRxBerArgs[uutid].append((temp, cd, osnr, lber[sn], lber[refsn], qval[sn], qval[refsn], rxpwr[sn], rxpwr[refsn], tdc_disp[sn])) edfa_info = ser_obj.get_edfa_loop_params() (pd1, pd2) = ser_obj.get_pd1_pd2() self.diagnostic("LaserCurr: %s, LaserAdc: %s, IpwrdBm: %s, Ipwr: %s, Pd1: %s, Pd2: %s, UutDispersion: %s" % \ (edfa_info['LaserCurr'], edfa_info['LaserAdc'], edfa_info['IpwrdBm'], edfa_info['Ipwr'], pd1, pd2, tdc_disp[sn])) #self.info(self.lineRxBerArgs) for sn in self.uutSnList: slot = self.uutDict[sn]["slot"] uutid = self.uutDict[sn]["id"] self.diagnostic(self.errorCount[sn]) if self.errorCount[sn]: self.lf.write("\n\nERROR: %s(%s):\n UUT LineRxBER test failed.\n" %(slot, sn)) self.failed("%s(%s):\n UUT LineRxBER test failed.\n" %(slot, sn), uutid) else: # clean up logs if the test passes by providing the diagnostic # dictionary to the clean-up function. Diag.clean_up_logs(sn, self.diag) self.passed("%s(%s):\n UUT LineRxBER test passed.\n" %(slot, sn), uutid) return self.completed("LineRxBER test completed.")
def test_method(self): errorCount = 0 sc = self.SC # now begin the actual testing osnrList = self.config.osnrList cdTestList = self.config.cdTestList #cdTestList = self.config.cdTestList osnrTol = self.config.osnrParams["tol"] targetRefRxPwr = self.config.cardParams['rxpwr'][0] targetPwr = targetRefRxPwr uutRxTol = self.config.cardParams['tol'][0] refRxTol = self.config.cardParams["tol"][0] temp = self.DAQ.temperature minosnr, maxosnr = self.config.osnrSpecRange INVALIDBER = self.config.INVALIDBER refsn = self.REFRX.SN wvlngth = self.tdc_channel_dict[self.tdc_type][1] self.info("Starts sweeping CD ...") self.lf.write("Starts sweeping CD ...") tb = self.config.testbed self.info("Enabling LINE PRBS on REF...") self.REFRX_ber.enable_line_prbs() self.REFRX_ber.set_for_tx_prbs() self.tamb = temp vadj_ber = {} vadj_dict = {} for sn in self.uutSnList: #excluding refsn obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] UUT_ber = "UUT_slot%s" % slot ber_obj = self.uut_ser_dict[UUT_ber] self.info("Enabling LINE PRBS...") ber_obj.enable_line_prbs() ber_obj.set_for_rx_prbs() for cd in cdTestList: self.diagnostic("##### Current CD: %s" % cd) # 1. disable CD EDFA output if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Disabling ProgCD output...") self.dBox.set_switch(6, 'cnt') # 2. set ProgCD to cd self.info("Setting dispersion to %s" % cd) self.dBox.dispersion = cd self.info("Dispersion is: %s" % self.dBox.dispersion) # 3. enable ProgCD if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Enabling ProgCD output...") self.dBox.set_switch(6, 'byp') # 4. enable and adjust Input VOAs to achieve targeted OSNR. self.info("Turning on Input VOAs and Stabilizing.....\n" ) for voa in self.config.voaInList: tb[voa].state = "ON" self.VOAOUT.state = "ON" time.sleep(10) # time to settle all instrument tdc_trained = 0 # set to initial osnr to a low value to obtain a small bitty eye self.info("Setting initial OSNR to %s" % self.init_osnr) osnr = set_OSNR(self.OSA, self.VOAASE, self.init_osnr, osnrTol, wvlngth) self.diagnostic("Initial OSNR %s" % osnr) pstatus, rxpwr = set_RxPwr(self.REFRX, self.VOAOUT, targetRefRxPwr, refRxTol) reacq_settle_time = 180 for sn in self.uutSnList: obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] ser_obj = self.uut_ser_dict[slot] self.info("Setting UUT (%s) in slot %s to initial dispersion to: %d" % (sn, slot,-cd)) ser_obj.set_tdc_startdisp(-cd) self.info("Wait for TDC to heat up...") time.sleep(20) for sn in self.uutSnList: ser_obj = self.uut_ser_dict[slot] self.diagnostic("Forcing demod reacquistion on UUT %s..." % sn) ser_obj.force_demod_reacq() self.info("Sleeping for %s seconds after demod reacq..." % reacq_settle_time) time.sleep(reacq_settle_time) refsn_uut = "%s_%s" % (refsn, sn) for targetOSNR in osnrList: self.info("\n###### Verifying BER at CD: %s, OSNR: %s ######\n" %(cd, targetOSNR,)) self.lf.write("\n\nVerifying BER at CD: %s, OSNR: %s\n" % (cd, targetOSNR,)) # set the correct P3 osnr = set_OSNR(self.OSA, self.VOAASE, targetOSNR, osnrTol, wvlngth) # 5 & 6. enable and adjust output VOA's to achieve target power # reading self.info("Turning on Output VOAs and Stablizing...\n") self.VOAOUT.state = "ON" rxpwr = {} lber = {} q_val = {} refindex = 0 #RefRx index in refSnList if (self.config.flags.DEBUG and self.config.flags.VERBOSE): self.info("Start logging diagnostics from UUT Mike Shell...") self.diag_logger[sn].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[sn].capture(None, ser_obj) self.info("Start logging diagnostics from REF Mike Shell...") self.diag_logger[refsn_uut].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[refsn_uut].capture(None, self.REFRX) hsynclosshist = {} hberr = {} cberr = {} lber = {} qval = {} rxpwr = {} qval = {} tdc_disp = {} current_disp = {} q_list = [] uutindex = 0 # UUT index in uutSnList berLimit = self.config.berLimit osnrBerLimits = self.config.osnrBerLimits uut_index = 0 download = False for sn in self.uutSnList: #excluding refsn self.diagnostic("##### Running UUT (%s) " % sn) obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] ser_obj = self.uut_ser_dict[slot] #print self.uut_ser_dict obj = ser_obj UUT_ber = "UUT_slot%s" % slot ber_obj = self.uut_ser_dict[UUT_ber] self.info("Setting UUT Rx Power to %s." % (targetRefRxPwr,)) self.lf.write("\n\nSetting UUT RX Power to %s.\n" % (targetRefRxPwr,)) pstatus, rxpwr[sn] = set_RxPwr(ser_obj, self.VOAOUT, targetRefRxPwr, refRxTol) if not pstatus: self.diagnostic("UUT RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[sn], targetRefRxPwr)) self.lf.write("\n\nWARNING: UUT RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[sn], targetRefRxPwr)) self.info("### Running UUT (%s) on slot (%s)" % (sn, slot)) uut_slot = int(slot) uut_output_sw_name = self.UUT_LINE_OUTPUT_SW.name uut_output_sw_mod_name = self.UUT_LINE_OUTPUT_SW.sw_mod if int(uut_slot) < 6: uut_output_sw_pos = int(uut_slot) - 1 else: uut_output_sw_pos = int(uut_slot) - 5 self.info("### Setting %s to output on %d" % (uut_output_sw_name, uut_output_sw_pos)) self.DiCon.set_4x1_switch_output(uut_output_sw_mod_name, uut_output_sw_pos) # starts TDC trainning. self.info("Starting TDC training process...can take up to 10 minutes") self.tmp_uutDict = copy(self.config.uut_dict) self.tmp_uutSnList = self.tmp_uutDict.keys() tdc_lof_timeout = '120.0' self.info("Setting LOF timeout value %s for TDC..." % tdc_lof_timeout) ser_obj.set_tdc_lof_timeout(tdc_lof_timeout) for ser_no in self.tmp_uutSnList: #excluding refsn self.info("### ser_no: %s" % ser_no) obj = self.tmp_uutDict[ser_no]["obj"] slot = self.tmp_uutDict[ser_no]["slot"] tmp_uut_ser_dict = copy(self.uut_ser_dict) lc = tmp_uut_ser_dict[slot] self.diagnostic("Clearing slot %s(%s) TDC trainning bit..." % (slot, ser_no)) lc.clear_trainning_flag() hi = max(osnrBerLimits[targetOSNR]) low = min(osnrBerLimits[targetOSNR]) limit_check_timeout = 600 # 6 minutes time_check, lstatus, lber[sn] = self.check_limit(hi, low, ber_obj, ser_obj, self.REFRX_ber, sn, refsn_uut, self.tamb, targetOSNR, cd, limit_check_timeout) self.diagnostic("Check limit done within %s seconds" % time_check) self.diagnostic("SN: %s" % sn) self.diagnostic("Force enabling PRBS generator on REF...") self.REFRX_ber.set_for_tx_prbs() lber[refsn] = self.REFRX_ber.BER rxpwr[refsn] = self.REFRX.RxPwr rxpwr[sn] = obj.RxPwr self.diagnostic("UUT RxPwr: %s" % rxpwr[sn]) self.info("BER: %s" % lber[sn]) if not lstatus: self.error("slot%s(%s):\n UUT current BER not stabilized.\n" %(slot, sn)) self.lf.write("\n\nERROR:slot%s(%s):\n UUT current BER not stabilized.\n" %(slot, sn)) self.info("slot%s(%s):\n TAmb: %s OSNR: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, osnr, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) self.lf.write("\n\nslot%s(%s):\n TAmb: %s OSNR: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, osnr, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) uutindex += 1 qval[sn] = round(get_Q(lber[sn]), 2) tdc_disp[sn] = ser_obj.show_actual_dispersion() numIter = self.config.numIter if cd == 0: # xxx: the reference card has TDC disabled, so for qval[refsn] = round(get_Q(lber[refsn]), 2) else: qval[refsn] = INVALIDBER uutid = self.uutDict[sn]["id"] slot = self.uutDict[sn]["slot"] self.info("%s(%s):\n TAmb: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) self.lf.write("\n\n %s(%s):\n TAmb: %s UUTRxBER: %s RefRxBER: %s " "UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) edfa_info = ser_obj.get_edfa_loop_params() (pd1, pd2) = ser_obj.get_pd1_pd2() self.diagnostic("LaserCurr: %s, LaserAdc: %s, IpwrdBm: %s, Ipwr: %s, Pd1: %s, Pd2: %s" % \ (edfa_info['LaserCurr'], edfa_info['LaserAdc'], edfa_info['IpwrdBm'], edfa_info['Ipwr'], pd1, pd2)) #### now step through the Vadj voltages cmd = "singleDac::getInstance" dac_inst = obj.getInstance(cmd) current_qval = 0 for val in range(0x0, 0x10f0, 0x100): current_vadj_val = val self.info("setting vadj to: %s" % (val)) obj.set_vadj_val(val, dac_inst) # wait for 10 seconds for value to settle down self.info("Wait for 10 secs for ber to become stable...") self.info("Resetting line ber and Wait 10 secs for ber to become stable...") ber_obj.reset_line_prbs() time.sleep(10) # now get the BER and store it prev_qval = copy(current_qval) print("Getting stable BER...") lstatus, lber[sn] = get_StabBER(ber_obj) q_val[sn] = round(get_Q(lber[sn]), 2) self.info("vadj: %s, BER: %s, Q: %s" % (current_vadj_val, lber[sn], q_val[sn])) vadj_dict[lber[sn]] = current_vadj_val current_qval = copy(q_val[sn]) if not lstatus: self.error("slot%s(%s):\n UUT current BER not stabilized.\n" %(slot, sn)) self.lf.write("\n\nERROR:slot%s(%s):\n UUT current BER not stabilized.\n" %(slot, sn)) self.info("CURR: %s, PREV: %s" % (current_qval, prev_qval)) #if (current_qval < prev_qval): # self.diagnostic("Current Q %s is < previous: %s!" % (current_qval, prev_qval)) # need to roll back to previous setting. # break #else: # prev_qval = current_qval vadj_ber[sn] = vadj_dict new_vadj_val = min(vadj_ber[sn].keys()) # if the new vadj_val is invalid, then just use the # original value. new_q_val = round(get_Q(new_vadj_val), 2) self.info("Opt QVal=%s" % (new_q_val)) #min_q_val = 12.8 min_q_val = 11.5 self.info("Disabling module prior to reading/writing EEPROM") sc.module_control(slot, "Disable", self) time.sleep(10) self.info("Setting module to flash mode...") obj = ser_obj ber_obj.prepFlash() phrx_cal_tag = ber_obj.upload_cust('PHRX_CAL') if ((PQ(0.9, 'BER') < new_vadj_val) or (new_q_val < min_q_val)): self.error("min BER %s (%s) is INVALID!" % (new_vadj_val, new_q_val)) self.errorCount[sn] += 1 self.info("Keeping original vadj value: %s" % phrx_cal_tag.Vadj) self.info("No update to tag is made...") else: download = True new_dac_vadj_val = vadj_dict[new_vadj_val] new_dac_val = round(new_dac_vadj_val * -5.5 / 0xFFF, 2) self.diagnostic("New VADJ value is: 0x%x (%s)" % (new_dac_vadj_val, new_dac_val)) phrx_cal_tag.Vadj = str(new_dac_val) self.info("Download tag PHRX_CAL back into EEPROM...") self.info(phrx_cal_tag.__str__()) res = ber_obj.download_cust(phrx_cal_tag) uutid = self.uutDict[sn]["id"] self.vadjArgs[uutid] = (vadj_dict) #save the tag as xml file... xml_file_name = "PHRX_CAL_%s.xml" % sn self.save_object(phrx_cal_tag, xml_file_name) self.info("Enabling module...") sc.module_control(slot, "Enable", self) for sn in self.uutSnList: slot = self.uutDict[sn]["slot"] uutid = self.uutDict[sn]["id"] self.diagnostic(self.errorCount[sn]) if self.errorCount[sn]: self.lf.write("\n\nERROR: %s(%s):\n UUT PhCalVadj test failed.\n" %(slot, sn)) self.failed("%s(%s):\n UUT PhCalVadj test failed.\n" %(slot, sn), uutid) else: # clean up logs if the test passes by providing the diagnostic # dictionary to the clean-up function. Diag.clean_up_logs(sn, self.diag) self.passed("%s(%s):\n UUT PhCalVadj test passed.\n" %(slot, sn), uutid) if(download): self.info("Resetting line card so tag changes can take affects...") # DO THIS FROM CAROL ber_obj.reset_card() reset_dsp_sleep_time = 180 self.info("Wait %s seconds for DSP to come up..." % reset_dsp_sleep_time) time.sleep(reset_dsp_sleep_time) return self.completed("PhCalVadj test completed.")
def test_method(self): errorCount = 0 # bandwidth cdTestList = self.config.cdTestList osnrTol = self.config.osnrParams["tol"] INVALIDBER = self.config.INVALIDBER refsn = self.REFRX.SN # a list of client protocol to check. #protocol_list = ['10gbelan',] protocol_list = ['sonetsdh', 'otu2_sonetsdh', '10gbelan',] osnrTol = self.config.osnrParams["tol"] targetRefRxPwr = self.config.cardParams['rxpwr'][0] targetPwr = targetRefRxPwr uutRxTol = self.config.cardParams['tol'][0] refRxTol = self.config.cardParams["tol"][0] protocol_status = {} # client port low power CLIENT_PORT_LOW_LIMIT = PQ('-14', 'dBm') REF_PORT_LOW_LIMIT = PQ('-21', 'dBm') sc_obj = self.SC # shelfcontroller object for XOOM interface shelf = 1 temp = self.DAQ.temperature self.diagnostic("Current temperature: %s" % temp) wvlngth = self.tdc_channel_dict[self.tdc_type][1] tb = self.config.testbed client_analyzer = self.config.testbed['Ref_InnoCor'] self.info("InnoCor RxPwr: %s" % client_analyzer.show_rx_power()) for cd in cdTestList: self.diagnostic("##### Current CD: %s" % cd) # 1. disable CD EDFA output self.info("Disabling ProgCD output...") if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Disabling ProgCD output...") self.dBox.set_switch(6, 'cnt') # 2. set ProgCD to cd self.info("Setting dispersion to %s" % cd) self.dBox.dispersion = cd self.info("Dispersion is: %s" % self.dBox.dispersion) # 3. enable ProgCD if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Enabling ProgCD output...") self.dBox.set_switch(6, 'byp') # 4. enable and adjust Input VOAs to achieve targeted OSNR. # 4. enable and adjust Input VOAs to achieve targeted OSNR. self.info("Turning on Input VOAs and Stabilizing.....\n" ) #for voa in self.config.voaInList: # tb[voa].state = "ON" self.diagnostic("Turning ON VOAs...") self.VOAASE.state = "ON" self.VOAREFTX.state = "ON" self.VOAOUT.state = "ON" time.sleep(10) # time to settle all instrument berrColInterval = 120 self.diagnostic("BER Collection interval is: %s" % berrColInterval) tdc_disp = {} uutindex = 0 # UUT index in uutSnList rxpwr = {} lber = {} refindex = 0 #RefRx index in refSnList port_inst_dict = {} # set the correct P3 for sn in self.uutSnList: #excluding refsn slot = self.uutDict[sn]["slot"] uut_slot = int(slot) ser_obj = self.uut_ser_dict[slot] obj = ser_obj UUT_ber = "UUT_slot%s" % slot ber_obj = self.uut_ser_dict[UUT_ber] self.info("Getting port instances...") port_inst_dict = ber_obj.get_port_instances() self.info("Port instances: %s" % port_inst_dict) is_2_1 = self.rel_dict[slot]['is_2_1'] release = self.rel_dict[slot]['release'] self.diagnostic("IS_2_1: %s, release: %s" % (is_2_1, release)) slot_num = (uut_slot-1) % 4 # XXX: disable module prior to messing with TDC control #setattr(obj, 'ModuleControl', 'Disabled') # set the DiCon switch to allow the UUT on slot X to # transmit self.info("### Running UUT (%s) on slot (%s)" % (sn, slot)) uut_output_sw_name = self.UUT_LINE_OUTPUT_SW.name if uut_slot > 5: uut_output_sw_pos = int(uut_slot) - 5 else: uut_output_sw_pos = int(uut_slot) - 1 uut_client_output_sw_name = self.UUT_CLIENT_OUTPUT_SW.name self.info("### Setting %s to output on %d" % (uut_output_sw_name, uut_output_sw_pos)) self.DiCon.set_4x1_switch_output(uut_output_sw_name, uut_output_sw_pos) self.info("### Setting %s to output on %d" % (uut_client_output_sw_name, uut_output_sw_pos)) self.DiCon.set_4x1_switch_output(uut_client_output_sw_name, uut_output_sw_pos) # 0. set dispersion self.diagnostic("Disabling UUT's PRBS generator and analyzer...") ser_obj.disable_prbs_gen() init_cd_dispersion = 0 self.info("Setting initial UUT (%s) TDC dispersion to: %d" % (sn, init_cd_dispersion)) ser_obj.set_tdc_startdisp(init_cd_dispersion) # 1. set LOF timeout self.info("Setting LOF timeout value for TDC...") ser_obj.set_tdc_lof_timeout() #setattr(obj, 'ModuleControl', 'Enabled') self.init_osnr = PQ("21.0 dB") self.info("### Setting initial OSNR to %s" % self.init_osnr) osnr = set_OSNR(self.OSA, self.VOAASE, self.init_osnr, osnrTol, wvlngth) self.diagnostic("Initial OSNR %s" % osnr) pstatus, rxpwr = set_RxPwr(self.REFRX, self.VOAOUT, targetRefRxPwr, refRxTol) reacq_settle_time = 180 for sn in self.uutSnList: obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] ser_obj = self.uut_ser_dict[slot] self.info("Setting UUT (%s) in slot %s to initial dispersion to: %d" % (sn, slot,-cd)) ser_obj.set_tdc_startdisp(-cd) for sn in self.uutSnList: ser_obj = self.uut_ser_dict[slot] self.diagnostic("Forcing demod reacquistion on UUT %s..." % sn) ser_obj.force_demod_reacq() self.info("Sleeping for %s seconds after demod reacq..." % reacq_settle_time) time.sleep(reacq_settle_time) self.line_check(self.rel_dict[slot], ber_obj, timeout=30) # We need to test multiple protocols on the client port (4) failed_params = {} for protocol in protocol_list: failed_params[protocol] = {} # step 1: configure the InnCor device to transmit with a # specific protocol. self.info("Configuring InnoCor to transmit %s..." % protocol) # first we have to stop the tx, configure the type, and # then restart it. if is_2_1: self.info("#### IS 2_1") client_analyzer.test_control('stop') client_analyzer.turn_off_laser() client_analyzer.set_protocol(protocol) self.info("Turning on Client TX laser...") client_analyzer.turn_on_laser() time.sleep(2) client_analyzer.test_control('start') # step 2: Now setup the client ports on the UUT for port_num in range(1, 5): self.info("Stopping client port #%s" % (port_num,)) ber_obj.stop_client(port_num) for port_num in range(1, 5): self.info("Setting up port %s to transmit %s" % (port_num,protocol)) ber_obj.setup_client_protocol_2_1(port_num, protocol) time.sleep(30) else: #2.3 self.info("#### IS 2_3") self.info("Stopping Ref Client test...") client_analyzer.test_control('stop') time.sleep(5) self.info("Turning off Ref Client TX laser...") client_analyzer.turn_off_laser() time.sleep(2) client_analyzer.set_protocol(protocol) # step 2: Now setup the client ports on the UUT self.info("Setting up Client Ports to transmit %s" % (protocol)) ber_obj.setup_clients_via_xoom(sc_obj, slot, protocol, self) if protocol == 'otu2_sonetsdh': self.info("### Do extra steps for OTU2...") for port_num in range(1, 5): inst = port_inst_dict[port_num] self.setup_tcm(ber_obj, inst) self.info("Starting Ref Client test...") self.info("Turning on Ref Client TX laser...") client_analyzer.turn_on_laser() time.sleep(2) client_analyzer.test_control('start') time.sleep(10) # display InnCor and UUT Client rx power status. ref_rx_pwr = client_analyzer.show_rx_power() self.info("Client analyzer RxPwr: %s" % ref_rx_pwr) try: if (float(ref_rx_pwr._value) < float(REF_PORT_LOW_LIMIT._value)): return self.incomplete("Reference Analyzer RxPwr (%s) < (%s)" % (ref_rx_pwr, REF_PORT_LOW_LIMIT)) except: self.error("Client analyzer RxPwr: %s" % ref_rx_pwr) #return self.incomplete("Reference Analyzer RxPwr (%s) is too low!" % ref_rx_pwr) for port_num in range(1, 5): port_rx_pwr = ber_obj.show_client_rx_pwr(port_num) port_tx_pwr = ber_obj.show_client_tx_pwr(port_num) self.info("UUT Client port #%s RxPwr: %s TxPwr: %s" % (port_num, port_rx_pwr, port_tx_pwr)) uut_client_checked = 0 if not uut_client_checked: berrColInterval = 120 self.diagnostic("### BER Collection interval is: %s" % berrColInterval) self.diagnostic("### Check for ClientBitErrors at CD=0") count = 0 if is_2_1: self.info("#### IS 2_1") # wait for a minute prior to ClientBERTReset sleep_time_plim_bert_reset = 10 self.info("Wait for %s seconds prior to ClientBERTReset..." % sleep_time_plim_bert_reset) time.sleep(sleep_time_plim_bert_reset) self.info("Resetting Client Traffic Generator counters...") client_analyzer.reset_counters() settle_time = 45 self.info("Sleeping for %s seconds..." % settle_time) time.sleep(settle_time) client_analyzer.test_control('stop') time.sleep(2) client_analyzer.test_control('start') time.sleep(2) self.info("Collecting BER info for: %s seconds iterations: %s..." % (berrColInterval, berrColInterval/10, )) out_of_sync = 0 if (berrColInterval > 100): # print out client prbs information for 2 minutes wait # case, display it every 10 seconds sample_interval = 10 iterations = berrColInterval/sample_interval - 1 current_time_sync = 0 if protocol == '10gbelan': self.info("Collecting %s information for %s seconds" % (protocol, berrColInterval)) time.sleep(20) # only sleep for 20 seconds for client_analyzer.test_control('stop') client_analyzer.test_control('start') time.sleep(berrColInterval) cberr, client_status = client_analyzer.get_ber_2_1(protocol) status_10gbelan = self.check_10gbelan_status(is_2_1, cberr, client_status) if not status_10gbelan: self.error("Client_Status: %s" % client_status) self.errorCount[sn] += 1 else: self.info("%s test passed. Client: %s" % (protocol, client_status)) else: for i in range(iterations): time.sleep(sample_interval) cberr, client_status = client_analyzer.get_ber_2_1(protocol) self.info("iter: %s ClientBitErrors: %s ClientStatus: %s" % (i, cberr, client_status)) if protocol == 'sonetsdh': sonetsdh_status = self.check_sonetsdh_status(is_2_1, cberr, client_status) if not sonetsdh_status: # error self.error("BER:%s, status: %s" % (cberr.value, client_status)) self.errorCount[sn] += 1 out_of_sync = 1 break else: # otu2 otu2_status = self.check_otu2_status(is_2_1, cberr, client_status) if not otu2_status: # error self.error("BER:%s, status: %s" % (cberr.value, client_status)) self.errorCount[sn] += 1 out_of_sync = 1 break else: time.sleep(berrColInterval) else: # 2.3 self.info("#### IS 2_3") self.info("Resetting Client Traffic Generator counters...") client_analyzer.reset_counters() if protocol == 'otu2_sonetsdh': settle_time = 45 # 120 else: settle_time = 30 self.info("Sleeping for %s seconds..." % settle_time) time.sleep(settle_time) self.info("Resetting Client Traffic Generator counters...") client_analyzer.reset_counters() start_time = time.time() out_of_sync = 0 sample_interval = 10 i = 0 self.info("Checking traffic ...") while 1: current_time = time.time() elasped = current_time - start_time if elasped < berrColInterval: time.sleep(sample_interval) # print out client prbs information for 2 minutes wait # case, display it every 10 seconds current_time_sync = 0 cberr, client_status = client_analyzer.get_ber(protocol) self.info("iter: %s ClientBitErrors: %s" % (i, cberr)) if protocol == '10gbelan': (status_10gbelan, failed_params[protocol]) = self.check_10gbelan_status(is_2_1, cberr, client_status) protocol_status[protocol] = ('F', 'P')[status_10gbelan == 1] if not status_10gbelan: self.error("Client_Status: %s" % failed_params[protocol]) self.errorCount[sn] += 1 out_of_sync = 1 break elif protocol == 'sonetsdh': (sonetsdh_status,failed_params[protocol]) = self.check_sonetsdh_status(is_2_1, cberr, client_status) protocol_status[protocol] = ('F', 'P')[sonetsdh_status == 1] if not sonetsdh_status: # error self.error("BER:%s, status: %s" % (cberr.value, failed_params[protocol])) self.errorCount[sn] += 1 out_of_sync = 1 break else: # otu2 (otu2_status, failed_params[protocol]) = self.check_otu2_status(is_2_1, cberr, client_status) protocol_status[protocol] = ('F', 'P')[otu2_status == 1] if not otu2_status: # error self.error("BER:%s, failed params: %s" % (cberr.value, failed_params[protocol])) self.errorCount[sn] += 1 out_of_sync = 1 break i += 1 else: self.info("Sampling interval expired!") break if protocol != '10gbelan': client_errors = cberr.value #cberr[sn] = int(client_errors) if (client_errors != 0): self.errorCount[sn] += 1 self.error("%s(%s):\n client Bit Errors %s != 0\n" %(slot, sn, client_errors)) self.lf.write("\n\nERROR: %s(%s):\n client BitErrors %s != 0" %(slot, sn, client_errors)) uut_client_checked = 1 uutid = self.uutDict[sn]["id"] self.clientChkArgs[uutid].append(temp) self.info("Rebooting InnoCor analyzer...takes two minutes to come up") client_analyzer.reboot() time.sleep(120) for sn in self.uutSnList: slot = self.uutDict[sn]["slot"] uutid = self.uutDict[sn]["id"] is_2_1 = self.rel_dict[slot]['is_2_1'] if not is_2_1: for protocol in protocol_list: self.info("%s test status is '%s'" % (protocol, protocol_status[protocol])) if self.errorCount[sn]: self.lf.write("\n\nERROR: slot%s(%s):\n ClientCheck test failed.\n" %(slot, sn)) self.failed("slot%s(%s):\n ClientCheck test failed.\n" %(slot, sn), uutid) else: # clean up logs if the test passes by providing the diagnostic # dictionary to the clean-up function. Diag.clean_up_logs(sn, self.diag) self.passed("%s(%s):\n ClientCheck test passed.\n" %(slot, sn), uutid) return self.completed("ClientCheck test completed.")
def test_method(self): #initial failure due to incorrect command or start up issues if (not self.passing): uutid = self.uutDict[self.uutSnList[0]]["id"] return self.failed("Burn In Test failed.", uutid) #log header setup startTime = time.time() self.df.write( "\nTime Stamp: %s" % (time.strftime( "%m-%d-%Y %H:%M:%S", time.localtime()))) self.df.write("\n\nBurn In Test Results:") #starting test status self.info("Starting burn in testing ...\n") self.lf.write("Starting burn in testing ...\n") # use to store temperature information. self.temp_readings = {} # each key is the module with self.temp_limits = self.config.temp_limits for k in self.temp_limits.keys(): self.temp_readings[k] = [] #initialize test parameters (min_chn, max_chn, odd_chn, even_chn, pwr, clpwr, cltxminpwr, cltxmaxpwr, losth, pminterval, rxpwr, rxmintol, rxmaxtol, clrxpwr, clrxmintol, clrxmaxtol, linetxmintol, linetxmaxtol) = self.config.uutParams uutid = self.uutDict[self.uutSnList[0]]["id"] totalHrs, interval = self.config.totalhrs numIter = self.config.numIter self.modTemps[uutid] = {} db_info = {} priorRun = self.db.currentRun i = 1 lineSecondsInSyncTotal = 0 clientSecondsInSyncTotal = 0 while i <= (self.numCheckIter - 6): #wait time before reading if self.debugMode == 1: time.sleep(5) #debug mode elif self.passing == False: time.sleep(5) #speed up test if failing else: while(1): time.sleep(60) #test mode if ((time.time() - startTime)/60) >= (interval.value * i): break #initial status tm = (time.time() - startTime)/60 #read uut state clientberr = 0 lineberr = 0 self.resetState = True while((self.resetState == True) and (self.resetCount <= self.maxResets)): try: uut_client_sync = self.uut860.get_client_sync() self.info("mr 0x3e802 = %s" % uut_client_sync) if uut_client_sync == '0': uut_client_state = [0, 1, 0, 1, 0.0, 0, 0] clientlostsync = 0 clientSecondsInSyncCurrent = int(time.time() - startTime) clientSecondsOutOfSyncCurrent = 0 clientSecondsSinceReset = int(time.time() - startTime) clientber = 0.0 clientPreFECBER = 0 clientberr = 0 else: uut_client_state = [1, 0, 0, 0, 0.0, 0, 0] clientlostsync = int(uut_client_state[0]) clientSecondsInSyncCurrent = uut_client_state[1] clientSecondsOutOfSyncCurrent = uut_client_state[2] clientSecondsSinceReset = uut_client_state[3] clientber = uut_client_state[4] clientPreFECBER = uut_client_state[5] clientberr = uut_client_state[6] except: self.info("Got exception #2...") uut_client_state = [1, 0, 0, 0, 0.0, 0, 0] clientlostsync = int(uut_client_state[0]) clientSecondsInSyncCurrent = uut_client_state[1] clientSecondsOutOfSyncCurrent = uut_client_state[2] clientSecondsSinceReset = uut_client_state[3] clientber = uut_client_state[4] clientPreFECBER = uut_client_state[5] clientberr = uut_client_state[6] #lost sync determination if (clientlostsync == 1): self.resetState = self.uut860.get_4011_soft_reset_status() if self.resetState == True: self.info("UUT was reset.\n") self.lf.write("\n\nUUT was reset.\n") self.df.write("\n\nUUT was reset.\n") self.db.msg += ("\n\nUUT was reset.\n") time.sleep(30) self.resetCount +=1 self.setup_uut() else: self.resetState = False # dump the power readings txPwrReading = self.uutdsp.show_line_tx_pwr() rxPwrReading = self.uutdsp.show_line_rx_pwr() clientOneTxPwrReading = self.uut860.show_client_tx_pwr(1) clientOneRxPwrReading = self.uut860.show_client_rx_pwr(1) clientTwoTxPwrReading = self.uut860.show_client_tx_pwr(2) clientTwoRxPwrReading = self.uut860.show_client_rx_pwr(2) clientThreeTxPwrReading = self.uut860.show_client_tx_pwr(3) clientThreeRxPwrReading = self.uut860.show_client_rx_pwr(3) clientFourTxPwrReading = self.uut860.show_client_tx_pwr(4) clientFourRxPwrReading = self.uut860.show_client_rx_pwr(4) # dump the temperature readings #self.info("Dumping temperature sensor information.....") tempReadings = self.uut860.get_raw_temps() if not self.uut860.check_temp_limits(tempReadings, self.temp_limits, self): self.passing = False self.error("Module Temperature check failed!") tempSummary = "" while (tempReadings != {}): sensorName, sensorReading = tempReadings.popitem() tempSummary = "%s %s: %s degC" % (tempSummary, sensorName, sensorReading) if sensorName in self.temp_limits.keys(): self.temp_readings[sensorName].append(float(sensorReading)) #self.info(self.temp_readings) self.modTemps[uutid] = self.temp_readings # dump the alarms information #self.info("Dumping alarms information.....") #line_alarms = self.uut860.dump_line_alarms('Titan') #client_alarms = self.uut860.dump_client_alarms() # display tdc dispersion information tdc_disp = self.uutdsp.show_actual_dispersion() self.info("#### UUT TDC Dispersion: %s" % tdc_disp) self.lf.write("#### UUT TDC Dispersion: %s" % tdc_disp) #Status Information self.info("Iter: %d Time: %u min LostSync: %s SecondsInSync: %s ResetCount: %s" % (i, tm, clientlostsync, clientSecondsInSyncCurrent, self.resetCount)) self.info("Iter: %d LineTxPwr: %.2f dBm LineRxPwr %.2f dBm" % (i, txPwrReading, rxPwrReading)) self.info("Iter: %d Port1TxPwr: %.2f dBm Port1RxPwr: %.2f dBm Port2TxPwr: %.2f dBm Port2RxPwr: %.2f dBm" % (i, clientOneTxPwrReading, clientOneRxPwrReading, clientTwoTxPwrReading, clientTwoRxPwrReading)) self.info("Iter: %d Port3TxPwr: %.2f dBm Port3RxPwr: %.2f dBm Port4TxPwr: %.2f dBm Port4RxPwr: %.2f dBm" % (i, clientThreeTxPwrReading, clientThreeRxPwrReading, clientFourTxPwrReading, clientFourRxPwrReading)) self.lf.write("\n\nIter: %d Time: %u min LostSync: %s SecondsInSync: %s ResetCount: %s\n" % (i, tm, clientlostsync, clientSecondsInSyncCurrent, self.resetCount)) self.lf.write("\n\nIter: %d LineTxPwr: %.2f dBm LineRxPwr %.2f dBm\n" % (i, txPwrReading, rxPwrReading)) self.lf.write("\n\nIter: %d Port1TxPwr: %.2f dBm Port1RxPwr: %.2f dBm Port2TxPwr: %.2f dBm Port2RxPwr: %.2f dBm\n" % (i, clientOneTxPwrReading, clientOneRxPwrReading, clientTwoTxPwrReading, clientTwoRxPwrReading)) self.lf.write("\n\nIter: %d Port3TxPwr: %.2f dBm Port3RxPwr: %.2f dBm Port4TxPwr: %.2f dBm Port4RxPwr: %.2f dBm\n" % (i, clientThreeTxPwrReading, clientThreeRxPwrReading, clientFourTxPwrReading, clientFourRxPwrReading)) #self.info("Iter: %d Client Alarms: %s" % (i, client_alarms)) #self.lf.write("\n\nIter: %d Client Alarms: %s\n" % (i, client_alarms)) #self.info("Iter: %d Line Alarms: %s" % (i, line_alarms)) #self.lf.write("\n\nIter: %d Line Alarms: %s\n" % (i, line_alarms)) self.info("Iter: %d Temperature Sensor Readings: %s" % (i, tempSummary)) self.lf.write("\n\nIter: %d Temperature Sensor Readings: %s\n" % (i, tempSummary)) #Database Information self.db.msg += ("Iter: %d Time: %u min LostSync: %s SecondsInSync: %s ResetCount: %s\n" % (i, tm, clientlostsync, clientSecondsInSyncCurrent, self.resetCount)) db_info['lastUpdate'] = datetime.datetime.fromtimestamp(timelib.now()) db_info['status'] = 2 db_info['endTime'] = None db_info['currentRun'] = int(priorRun + (i/4)) self._update_uut_db(db_info) #failure determination if (self.resetCount > self.maxResets): self.passing = False #uut was reset self.failed("UUT was reset more than %s times." % self.maxResets) if (clientlostsync == 1) and (self.resetState == False): self.passing = False #uut is out of sync self.failed("UUT was out of sync.") #check all powers if ((rxPwrReading < (txPwrReading + rxmintol)) or (rxPwrReading > (txPwrReading + rxmaxtol)) or (txPwrReading < (pwr + linetxmintol)) or (txPwrReading > (pwr + linetxmaxtol))): self.passing = False self.failed("Line side power is not within range.\n") #check all powers if ((clientOneRxPwrReading < (clientTwoTxPwrReading + clrxmintol)) or (clientOneRxPwrReading > (clientTwoTxPwrReading + clrxmaxtol)) or (clientTwoTxPwrReading < cltxminpwr) or (clientTwoTxPwrReading > cltxmaxpwr)): self.passing = False self.failed("Client side power is not within range.\n") #check all powers if ((clientTwoRxPwrReading < (clientThreeTxPwrReading + clrxmintol)) or (clientTwoRxPwrReading > (clientThreeTxPwrReading + clrxmaxtol))or (clientThreeTxPwrReading < cltxminpwr) or (clientThreeTxPwrReading > cltxmaxpwr)): self.passing = False self.failed("Client side power is not within range.\n") #check all powers if ((clientThreeRxPwrReading < (clientFourTxPwrReading + clrxmintol)) or (clientThreeRxPwrReading > (clientFourTxPwrReading + clrxmaxtol))or (clientFourTxPwrReading < cltxminpwr) or (clientFourTxPwrReading > cltxmaxpwr)): self.passing = False self.failed("Client side power is not within range.\n") #check all powers if ((clientFourRxPwrReading < (clientOneTxPwrReading + clrxmintol)) or (clientFourRxPwrReading > (clientOneTxPwrReading + clrxmaxtol))or (clientOneTxPwrReading < cltxminpwr) or (clientOneTxPwrReading > cltxmaxpwr)): self.passing = False self.failed("Client side power is not within range.\n") try: uut_line_state = self.uut860.show_line_prbs() except: self.diagnostic("Problem retrieving LINE PRBS...trying again in 30 seconds") time.sleep(30) try: uut_line_state = self.uut860.show_line_prbs() except: self.diagnostic("2nd try failed...using default...") uut_line_state = [1, 0, 0, 0, 0.0, 0, 0] linelostsync = int(uut_line_state[0]) lineSecondsInSyncCurrent = uut_line_state[1] lineSecondsOutOfSyncCurrent = uut_line_state[2] lineSecondsSinceReset = uut_line_state[3] lineber = uut_line_state[4] linePreFECBER = uut_line_state[5] lineberr = uut_line_state[6] self.check_line_ber_limits(uut_line_state) if self.passing == False: break # line side status check self.info("Resetting line prbs after 15 minutes...") self.uut860.reset_line_prbs() #interval increment i += 1 #check itla self.check_itla() i += 6 db_info['lastUpdate'] = datetime.datetime.fromtimestamp(timelib.now()) db_info['status'] = 2 db_info['endTime'] = None db_info['currentRun'] = int(priorRun + (i/4)) self._update_uut_db(db_info) #record errors accumulated during the test self.burnInTestArgs[uutid].append((lineberr, clientberr)) #pass/fail determination self.df.write( "\nTime Stamp: %s" % (time.strftime( "%m-%d-%Y %H:%M:%S", time.localtime()))) self.df.flush if not self.passing: self.db.msg += "\n\nBurn In Test failed." db_info['status'] = -1 db_info['endTime'] = datetime.datetime.fromtimestamp(timelib.now()) self._update_uut_db(db_info) return self.failed("Burn In Test failed.", uutid) else: self.db.msg += "\n\nBurn In Test passed." db_info['status'] = 1 db_info['endTime'] = datetime.datetime.fromtimestamp(timelib.now()) self._update_uut_db(db_info) Diag.clean_up_logs(self.serialno, self.diag) return self.passed("Burn In Test passed.", uutid)
def test_method(self): errorCount = 0 lber = {} tdc_type = self.tdc_type tb = self.config.testbed iterations = self.config.iterations for i in range(1, iterations): self.diagnostic("##### Current iteration: %s" % i) for sn in self.uutSnList: #excluding refsn obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] uut_slot = int(slot) ser_obj = self.uut_ser_dict[slot] UUT_ber = "UUT_slot%s" % slot #UUT_ber = "UUT_slot%s_ber" % slot ber_obj = self.uut_ser_dict[UUT_ber] #ber_obj = self.config.testbed[UUT_ber] obj = ser_obj # this applies to 4400 only if self.config.is_4400: ber_obj.set_4400_to_4040() time.sleep(5) self.info("### Running UUT (%s) on slot (%s)" % (sn, slot)) self.info("Enabling LINE PRBS...") ber_obj.enable_line_prbs() self.info("### Resetting prbs stats...") ber_obj.reset_line_prbs() time.sleep(5) line_ber = ber_obj.BER secs_out_of_sync, post_fec_ber = ber_obj.get_post_fec_ber() self.info("Line BER: %s, Secs in Sync: %s, postFEC BER: %s" % (line_ber, secs_out_of_sync, post_fec_ber)) if post_fec_ber != ERROR_FREE: self.error("Line PostFEC errors detected, %s seconds out of sync!: %s" % (post_fec_ber, secs_out_of_sync)) self.errorCount[sn] += 1 break # step 3: issue hammer command self.info("### Resetting all FPGAs...") ber_obj._docmd('gw 5 1') sleep_time = 60 self.info("Allowing for %s seconds for UUT to sync up..." % sleep_time) time.sleep(sleep_time) self.info("### Resetting prbs stats...") ber_obj.reset_line_prbs() ber_mon_time = 120 self.info("Collecting postFEC information for %s seconds" % ber_mon_time) time.sleep(ber_mon_time) secs_out_of_sync, post_fec_ber = ber_obj.get_post_fec_ber() if post_fec_ber != ERROR_FREE: self.error("Line PostFEC errors detected, %s seconds out of sync!: %s" % (post_fec_ber, secs_out_of_sync)) self.errorCount[sn] += 1 break self.lf.write( "\nTime Stamp: %s" % (time.strftime( "%m-%d-%Y %H:%M:%S", time.localtime()))) self.lf.flush() for sn in self.uutSnList: slot = self.uutDict[sn]["slot"] uutid = self.uutDict[sn]["id"] self.diagnostic(self.errorCount[sn]) if (self.errorCount[sn]): self.lf.write("\n\nERROR: slot%s(%s):\n UUT ParityCheck test failed.\n" %(slot, sn)) self.failed("slot%s(%s):\n UUT ParityCheck test failed.\n" %(slot, sn), uutid) else: # clean up logs if the test passes by providing the diagnostic # dictionary to the clean-up function. Diag.clean_up_logs(sn, self.diag) self.passed("slot%s(%s):\n UUT ParityCheck test passed.\n" %(slot, sn), uutid) return self.completed("ParityCheck test completed.")
def test_method(self): errorCount = 0 sc = self.SC shelf = 1 # bandwidth xunit = self.config.osaParams["scaleXunit"] # now begin the actual testing osnrList = self.config.osnrList cdTestList = self.config.cdTestList osnrTol = self.config.osnrParams["tol"] targetRefRxPwr = self.config.cardParams['rxpwr'][0] targetPwr = targetRefRxPwr uutRxTol = self.config.cardParams['tol'][0] refRxTol = self.config.cardParams["tol"][0] minosnr, maxosnr = self.config.osnrSpecRange INVALIDBER = self.config.INVALIDBER refsn = self.REFRX.SN vssd_offsets = self.config.vssd_offsets osnrBerLimits = self.config.osnrBerLimits bwlist = self.config.bwLimit bw = PQ("3.0 dB") bwLowerLimit,bwUpperLimit = bwlist[bw] print bwUpperLimit,bwLowerLimit self.dbRes = {} wvlngth = self.tdc_channel_dict[self.tdc_type][1] self.info("Starts sweeping CD ...") self.lf.write("Starts sweeping CD ...") tb = self.config.testbed for cd in cdTestList: self.diagnostic("##### Current CD: %s" % cd) # 1. disable CD EDFA output #self.info("Disabling ProgCD output...") #self.dBox.set_switch(6, 'cnt') # 2. set ProgCD to cd self.info("Setting dispersion to %s" % cd) self.dBox.dispersion = cd self.info("Dispersion is: %s" % self.dBox.dispersion) # 3. enable ProgCD #self.info("Enabling ProgCD output...") #self.dBox.set_switch(6, 'byp') # 4. enable and adjust Input VOAs to achieve targeted OSNR. self.info("Turning on Input VOAs and Stabilizing.....\n" ) for voa in self.config.voaInList: tb[voa].state = "ON" time.sleep(10) # time to settle all instrument for targetOSNR in osnrList: self.info("\n###### Verifying BER at CD: %s, OSNR: %s ######\n" %(cd, targetOSNR,)) self.lf.write("\n\nVerifying BER at CD: %s, OSNR: %s\n" % (cd, targetOSNR,)) qval = {} tdc_disp = {} q_list = [] uutindex = 0 # UUT index in uutSnList rxpwr = {} lber = {} q_val = {} refindex = 0 #RefRx index in refSnList # set the correct P3 download = False for sn in self.uutSnList: #excluding refsn slot = self.uutDict[sn]["slot"] uut_slot = int(slot) ser_obj = self.uut_ser_dict[slot] obj = ser_obj UUT_ber = "UUT_slot%s" % slot ber_obj = self.uut_ser_dict[UUT_ber] uutid = self.uutDict[sn]["id"] self.dbRes[uutid] = {} g1a1_opt_pass = False ssd_opt_pass = False slot_num = (uut_slot-1) % 4 card_type = sc.get_attribute("CardTypePresent", shelf, slot) card = card_type[:-3] self.info("Card in slot #%s is '%s'" % (slot, card)) if(card.find('4400') >= 0): self.info("Setting UUT(4400) to 4040 Mode..") ber_obj.set_4400_to_4040() time.sleep(10) self.info("Enabling loops to make sure prev test did not turn it on...") obj.enable_drv_bal_loops() time.sleep(10) init_cd_dispersion = 0 self.info("Setting initial dispersion to: %d" % init_cd_dispersion) ser_obj.set_tdc_startdisp(init_cd_dispersion) # 1. set LOF timeout self.info("Setting LOF timeout value for TDC...") ser_obj.set_tdc_lof_timeout() # set the DiCon switch to allow the UUT on slot X to # transmit self.info("### Running UUT (%s) on slot (%s)" % (sn, slot)) uut_output_sw_name = self.UUT_LINE_OUTPUT_SW.name uut_output_sw_pos = int(uut_slot) - 5 self.info("Setting %s to output on %d" % (uut_output_sw_name, uut_output_sw_pos)) self.DiCon.set_4x1_switch_output(uut_output_sw_name, uut_output_sw_pos) self.info("Setting target OSNR to %s" % targetOSNR) osnr = set_OSNR(self.OSA, self.VOAASE, targetOSNR, osnrTol, wvlngth) self.diagnostic("Target OSNR %s" % osnr) # 5 & 6. enable and adjust output VOA's to achieve target power # reading self.info("Turning on Output VOAs and Stablizing...\n") for voa in self.config.voaOutList: tb[voa].state = "ON" self.info("Setting Ref Rx Power to %s." % (targetRefRxPwr,)) self.lf.write("\n\nSetting Ref RX Power to %s.\n" % (targetRefRxPwr,)) pstatus, rxpwr[refsn] = set_RxPwr(self.REFRX, self.VOAOUT, targetRefRxPwr, refRxTol) if not pstatus: stat = self.REFRX._docmd('stat') self.diagnostic("STAT: %s" % stat) self.error("REF RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[refsn], targetRefRxPwr)) self.lf.write("\n\nERROR: REF RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[refsn], targetRefRxPwr)) self.diagnostic("Forcing demod reacquistion on REF %s..." % refsn) reacq_settle_time = 180 self.REFRX.force_demod_reacq() self.info("Sleeping for %s seconds after demod reacq..." % reacq_settle_time) time.sleep(reacq_settle_time) #self.info("Sleeping 60sec..") #time.sleep(60) # XXX restart the Tx MUX after every LOS # ser_obj.restart_tx_mux() self.info("Enabling LINE PRBS on UUT...") ber_obj.enable_line_prbs() self.info("Enabling LINE PRBS on REF...") self.REFRX_ber.enable_line_prbs() self.info("Setting module to flash mode...") ber_obj.prepFlash() self.info("Disabling Driver and Balance Loops...") obj.disable_drv_bal_loops() time.sleep(10) adj_cal_tag = ber_obj.upload_cust('DRIVER_AMP_ADJ_CAL') drv_mfg_tag = ber_obj.upload_cust('DRIVER_AMP_ADJ_MFG') org_xml_file_name = "DRIVER_AMP_ADJ_CAL_ORG_%s.xml" % sn self.save_object(adj_cal_tag, org_xml_file_name) self.save_object(drv_mfg_tag,('DRIVER_AMP_ADJ_MFG_%s.xml' % (sn))) temp = float(self.temperature.value) self.info("TAmb: %s" % (temp)) self.dbRes[uutid]['t_amb'] = temp self.dbRes[uutid]['drv_mfg'] = drv_mfg_tag.sn updateLst = [] tempFlag = "ROOM" if( temp > 20 and temp < 30): updateLst.append(1.0) updateLst.append(30.0) updateLst.append(60.0) BW_tol = PQ("0.6 GHz") elif(temp > 40 and temp < 60): updateLst.append(60.0) tempFlag = "HIGH" BW_tol = PQ("3.0 GHz") elif(temp < 0): updateLst.append(1.0) tempFlag = "LOW" BW_tol = PQ("3.0 GHz") else: self.info("_debug temp:%s" % (temp)) pass # =============== get INIT values for SSD and G1A1 ============ # If Tamb is at Room use values from main tag # else use values from temperature tag init_g1a1_val = 0.0 init_ssd_val = 0.0 g1a1_step = 0.024 ssd_step = 0.1 g1a1_dir = 1 ssd_dir = -1 #if(tempFlag == "ROOM"): # init_ssd_val = float(adj_cal_tag.Ssd) # init_g1a1_val = float(adj_cal_tag.G1a1) #else: ssd_temp_list = list(adj_cal_tag.get_element('SSD_TEMP_CAL')) g1a1_temp_list = list(adj_cal_tag.get_element('G1A1_TEMP_CAL')) for ssd in ssd_temp_list: if(tempFlag == "LOW"): if(eval(ssd.Temp) == 1.00 or eval(ssd.Temp) == 5.00): init_ssd_val = float(ssd.Voltage) break elif(tempFlag == "HIGH"): if(eval(ssd.Temp) == 60.0): init_ssd_val = float(ssd.Voltage) ssd_step = 0.15 break elif(tempFlag == "ROOM"): if(eval(ssd.Temp) == 30.0): init_ssd_val = float(ssd.Voltage) break else: pass for g1a1 in g1a1_temp_list: if(tempFlag == "LOW"): if(eval(g1a1.Temp) == 1.00 or eval(g1a1.Temp) == 5.00): init_g1a1_val = float(g1a1.Voltage) break elif(tempFlag == "HIGH"): if(eval(g1a1.Temp) == 60.0): init_g1a1_val = float(g1a1.Voltage) break elif(tempFlag == "ROOM"): if(eval(g1a1.Temp) == 30.0): init_g1a1_val = float(g1a1.Voltage) break else: pass self.info("Init SSD: %.3f, Init G1A1: %.3f" % (init_ssd_val, init_g1a1_val)) #self.info("using init_g1a1_val as -0.64") #init_g1a1_val = -0.640 loopCnt = 6 qval_limit = 13.5 #minimum Q val safe_g1a1 = 1.0 safe_ssd = -2.45 coarsePass = False rxpwr[sn] = obj.RxPwr settle_time = 600 #self.info("sleeping for 120 seconds to settle things down...") #time.sleep(120) ber_obj.set_for_tx_prbs() self.REFRX_ber.set_for_rx_prbs() self.REFRX_ber.reset_line_prbs() lstatus, ber_start = get_LineBER(self.REFRX_ber) if not lstatus: self.info("REFRX not in sync...") if ( ber_start.value >= 0.999): self.info("REFRX not in sync...need to do coarse G1a1 sweep") self.info("G1A1 COARSE STEP SWEEP...") g1a1_val = init_g1a1_val coarse_step = 0.1 for i in range(10): self.info("setting g1a1 to %s" % (g1a1_val)) ser_obj.cust_set_driver_amp('G1a1', g1a1_val) time.sleep(2) self.REFRX_ber.reset_line_prbs() time.sleep(1) lstatus, ber_start = get_LineBER(self.REFRX_ber) q_start = round(get_Q(ber_start),2) self.info("ber:%s qval:%s" % (ber_start,q_start)) if(q_start > qval_limit): init_g1a1_val = g1a1_val coarsePass = True self.info("Breaking out of COARSE sweep..") break g1a1_val += coarse_step if(g1a1_val > safe_g1a1): self.error("G1a1 sweep exceeds safety val of %s" % (safe_g1a1)) break if(not coarsePass): return self.incomplete("Vssd Vg1a1 Optimization-- REF Out of Sync..") hi = max(osnrBerLimits[targetOSNR]) low = min(osnrBerLimits[targetOSNR]) g1a1_qval_lst = [] tmpg1a1Lst = [init_g1a1_val - 0.048, init_g1a1_val, init_g1a1_val + 0.048] prevq = 0 prevg1a1 = tmpg1a1Lst[0] self.info("") self.info("Checking for the Parabolic envelope...") for i in range(3): g1a1_val = tmpg1a1Lst[i] self.info("Setting G1a1 to (%s)" % (g1a1_val)) ser_obj.cust_set_driver_amp('G1a1', g1a1_val) time.sleep(2) self.REFRX_ber.reset_line_prbs() time.sleep(10) lstatus, lber_init = get_StabBER(self.REFRX_ber) q = round(get_Q(lber_init),2) self.info("StabBER:%s Q:%s" % (lber_init,q)) if(i > 0): deltaq = prevq - q deltag1a1 = g1a1_val - prevg1a1 self.info("deltaQ:%s deltaG1a1:%s" % (deltaq,deltag1a1)) if(abs(deltaq) < 0.1): g1a1_val = prevg1a1 + 1.5*deltag1a1 self.info("Setting G1a1 to (%s)" % (g1a1_val)) ser_obj.cust_set_driver_amp('G1a1', g1a1_val) time.sleep(2) self.REFRX_ber.reset_line_prbs() time.sleep(10) lstatus, lber_init = get_StabBER(self.REFRX_ber) q = round(get_Q(lber_init),2) self.info("StabBER:%s Q:%s" % (lber_init,q)) prevq = q prevg1a1 = g1a1_val g1a1_qval_lst.append((g1a1_val,q,)) tmpQ = list(zip(*g1a1_qval_lst)[1]) if(tmpQ[0] > tmpQ[1]): g1a1_dir = -1 #g1a1_qval_lst = [] #re initialize this list #g1a1_qval_lst.pop(0) elif(tmpQ[2] > tmpQ[1]): g1a1_dir = 1 #g1a1_qval_lst = [] #re initialize this list #g1a1_qval_lst.pop(1) elif(tmpQ[1] > tmpQ[0] and tmpQ[1] > tmpQ[2]): g1a1_dir = -1 loopCnt = 3 self.info("Already at peak..") else: g1a1_dir = 1 self.info("G1A1 Sweep Direction: %s" % (g1a1_dir)) current_g1a1_val = init_g1a1_val + g1a1_dir*g1a1_step prev_qval = tmpQ[1] #qval for the init_g1a1_val titleLst = ['G1a1','Qval'] self.info("") self.info("Starting G1a1 Fine Sweep...") while(loopCnt > 0): loopCnt -= 1 self.info("setting g1a1 to: %s" % (current_g1a1_val)) ser_obj.cust_set_driver_amp('G1a1', current_g1a1_val) time.sleep(1) self.REFRX_ber.reset_line_prbs() self.info("Wait for 10 secs for ber to become stable...") time.sleep(10) #lstatus, lber[sn] = get_LineBER(self.REFRX_ber) #if not lstatus: # self.info("WARNING: slot%s(%s):\n UUT current BER not valid at OSNR: %s\n" %(slot, sn, osnr)) # self.lf.write("\n\nWARNING: slot%s(%s):\n UUT current BER not valid at OSNR: %s\n" %(slot, sn, osnr)) #else: print("Getting stable BER...") lstatus, lber[sn] = get_StabBER(self.REFRX_ber) #obj) # get stabilized BER if not lstatus: self.error("slot%s(%s):UUT current BER not stabilized." %(slot, sn)) self.info("reading line BER...") #self.lf.write("\n\nERROR:slot%s(%s):\n UUT current BER not stabilized.\n" %(slot, sn)) lstatus, lber[sn] = get_LineBER(self.REFRX_ber) q_val[sn] = round(get_Q(lber[sn]), 2) self.info("g1a1: %s, BER: %s, Curr_Q: %s Prev_Q:%s" % (current_g1a1_val, lber[sn], q_val[sn],prev_qval)) #vg1a1_dict[qval[sn]] = current_g1a1_val g1a1_qval_lst.append((current_g1a1_val,q_val[sn],)) #resTable.append([current_g1a1_val,q_val[sn]]) current_qval = copy(q_val[sn]) current_g1a1_val += g1a1_dir*g1a1_step prev_qval = current_qval g1a1_qval_lst.sort() g1a1Table = copy(g1a1_qval_lst) g1a1Table.insert(0,titleLst) finalTable = toRSTtable(g1a1Table,vdelim='|') print "\n\n" print finalTable print "\n\n" self._report.add_summary('G1a1 Sweep Results') self._report.add_summary(finalTable) self.info("%s" % (g1a1_qval_lst)) xdata = list(zip(*g1a1_qval_lst)[0]) ydata = list(zip(*g1a1_qval_lst)[1]) if(len(xdata)) < 3: return self.incomplete("very few sweep points...") self.info("Performing a quadratic fit for G1a1 vs Qval") a,b,c,rsquare = leastSquareParabolicFit(xdata,ydata) self.info("G1A1 Quad Fit: a:%s b:%s c:%s rsquare:%s" % (a,b,c,rsquare)) if(rsquare < 0.8): self.error("rsquare_quad:%s is below 0.8" % (rsquare)) else: #Peak of a parabola is y = -b/2a #x at peak y is (4ac - b^2)/(4a) opt_g1a1 = round((-b/(2*a)),3) exp_qval = round(((4*a*c) - (b*b))/(4*a),2) if(opt_g1a1 > safe_g1a1): self.error("Optimized g1a1:%s exceeds safe G1a1(%s)" % (opt_g1a1,safe_g1a1)) else: self.info("Setting G1a1 to %s as per the sweep results.." % (opt_g1a1)) ser_obj.cust_set_driver_amp('G1a1', opt_g1a1) time.sleep(2) self.REFRX_ber.reset_line_prbs() self.info("Wait for 10 secs for ber to become stable...") time.sleep(10) print("Getting stable BER...") lstatus, lber_opt = get_StabBER(self.REFRX_ber) #obj) # get stabilized BER if not lstatus: self.error("slot%s(%s):UUT current BER not stabilized." %(slot, sn)) self.info("reading line BER...") lstatus, lber_opt = get_LineBER(self.REFRX_ber) q_val_opt = round(get_Q(lber_opt), 2) self.info("Qval corresponding to Opt_G1a1(%s):%s" % (opt_g1a1,q_val_opt)) if(q_val_opt < qval_limit): self.errorCount[sn] += 1 self.error("G1a1 Optimum Qval(%s) is less than %s" % (q_val_opt,qval_limit)) else: g1a1_opt_pass = True self.info("PASS: G1A1 Optimization passed") self.info("") self.dbRes[uutid]['vg1a1'] = opt_g1a1 self.dbRes[uutid]['q_val'] = q_val_opt if(not g1a1_opt_pass): self.failed("G1A1 Optimization failed") self.info("Starting Ssd Optimization...") self.info("Turning VOA_ASE Off...") self.VOAASE.state = "OFF" targetBW = PQ("33.0 GHz") current_ssd_val = init_ssd_val self.info("setting Initial ssd to: %s," % (current_ssd_val)) ser_obj.cust_set_driver_amp('Vssd', current_ssd_val) time.sleep(10) wl, sw = self.OSA.get_spectralwidth(xunit, bw, wvlngth) bwGHz = PQ(float(sw) * 1000.0, "GHz") # convert THz to GHz self.info("Initial BW:%s" % (bwGHz)) bwDiff = (bwGHz - targetBW) if(abs(bwDiff) > BW_tol): self.info("initial BW:%s is not with in %s +/- %s" % (bwGHz,targetBW,BW_tol)) sweep = True else: self.info("Initial BW:%s is with in %s +/- %s" % (bwGHz,targetBW,BW_tol)) self.info("Skipping Ssd Optimization...") sweep = False ssd_target = init_ssd_val self.dbRes[uutid]['bw'] = bwGHz.value self.dbRes[uutid]['vssd'] = ssd_target if(sweep): # determine which direction to step if bwDiff.value < 0: ssd_dir = 1 else: ssd_dir = -1 self.info("Ssd Sweep direction:%s" % (ssd_dir)) current_ssd_val = init_ssd_val + ssd_dir*ssd_step ssd_bw_lst = [] ssd_qval_lst = [] numIter = 5 vssd_final = -100 bw_final = PQ("999 GHz") i = 0 print bwUpperLimit,bwLowerLimit ssd_bw_lst.append((init_ssd_val,bwGHz.value,)) titleLst = ['Ssd','BW','Qval'] ssdTable = [] ssdTable.append(titleLst) while (sweep): self.info("setting ssd to: %s," % (current_ssd_val)) ser_obj.cust_set_driver_amp('Vssd', current_ssd_val) self.info("Wait for 10 secs...") time.sleep(10) self.info("Getting BW data...") # we have to get the OptBandwidth information as well. wl, sw = self.OSA.get_spectralwidth(xunit, bw, wvlngth) bwGHz = PQ(float(sw) * 1000.0, "GHz") # convert THz to GHz lstatus, lber[sn] = get_LineBER(self.REFRX_ber) qval = round(get_Q(lber[sn]),2) self.info("i: %d, SSD: %s, BW: %s, BER: %s Q:%s" % (i, current_ssd_val, bwGHz, lber[sn],qval)) if bwGHz < bwUpperLimit and bwGHz > bwLowerLimit: ssd_bw_lst.append((current_ssd_val,bwGHz.value,)) ssd_qval_lst.append((current_ssd_val,qval,)) ssdTable.append([current_ssd_val,bwGHz.value,qval]) if i > numIter: break else: current_ssd_val += (ssd_dir*ssd_step) if(current_ssd_val < safe_ssd): self.error("Ssd: %s exceeds safe Ssd(%s)" % (current_ssd_val,safe_ssd)) break i += 1 if(sweep): finalSsdTable = toRSTtable(ssdTable,vdelim='|') print "\n\n" print finalSsdTable print "\n\n" self._report.add_summary('Ssd Sweep Results') self._report.add_summary(finalSsdTable) #if(vssd_final == -100): # self.error("Not able to achieve targetBW:%s" % # (targetBW)) #else: self.info("Performing a quadratic fit between BW vs Ssd") xdata = list(zip(*ssd_bw_lst)[1]) ydata = list(zip(*ssd_bw_lst)[0]) a,b,c,rsquare = leastSquareParabolicFit(xdata,ydata) if(rsquare < 0.88): self.error("rsqaure_quad:%s is below 0.88" % (rsquare)) self.info("Ssd Quad Fit: a:%s b:%s c:%s rsquare:%s" % (a,b,c,rsquare)) #y = ax^2 + bx + c ssd_target = (a*targetBW.value*targetBW.value + b*targetBW.value + c) self.info("Opt Ssd to achieve 33GHz:%s" % (ssd_target)) if(ssd_target < safe_ssd): self.error("Optimized Ssd: %s exceeds safe Ssd(%s)" % (ssd_target,safe_ssd)) else: self.info("setting ssd to: %s" % (ssd_target)) ser_obj.cust_set_driver_amp('Vssd', ssd_target) self.info("Wait for 10 secs...") time.sleep(10) self.info("Getting BW data...") # we have to get the OptBandwidth information as well. wl, sw = self.OSA.get_spectralwidth(xunit, bw, wvlngth) bwGHz = PQ(float(sw) * 1000.0, "GHz") # convert THz to GHz if(abs(bwGHz - targetBW) > BW_tol): self.error("Optimized BW:%s is not with in %s +/- %s" % (bwGHz,targetBW,BW_tol)) self.errorCount[sn] += 1 lstatus, lber[sn] = get_LineBER(self.REFRX_ber) qval = round(get_Q(lber[sn]),2) self.info("Ssd:%s BW:%s Qval:%s" % (ssd_target,sw,qval)) self.info("Turning VOA_ASE On.. to measure finalQ") self.VOAASE.state = "ON" self.info("Wait for 10 secs...") time.sleep(10) self.info("Getting finalBER data...") lstatus, lber_final = get_StabBER(self.REFRX_ber) qval_fin = round(get_Q(lber_final),2) self.info("Ssd:%s Final Qval:%s" % (ssd_target,qval_fin)) self.dbRes[uutid]['bw'] = bwGHz.value self.dbRes[uutid]['vssd'] = ssd_target if(qval_fin < qval_limit): self.errorCount[sn] += 1 self.error("Ssd Optimum Qval(%s) is less than %s" % (qval_fin,qval_limit)) else: ssd_opt_pass = True #print only an error message if((qval_fin - q_val_opt) < -0.3): self.error("qval_g1a1(%s) and qval_ssd(%s) differ by" " more than 0.3dBq" % (q_val_opt,qval_fin)) for tag in adj_cal_tag.get_children(): if(not g1a1_opt_pass and tag._name == 'G1A1_TEMP_CAL'): continue if(not ssd_opt_pass and tag._name == 'SSD_TEMP_CAL'): continue cal_tags = tag.get_children() for cal_tag in cal_tags: if(cal_tag.Temp == "5.00"): cal_tag.Temp = "1.00" if(updateLst.__contains__(eval(cal_tag.Temp))): if(tag._name == 'G1A1_TEMP_CAL'): cal_tag.Voltage = str(round(opt_g1a1,3)) if(tag._name == 'SSD_TEMP_CAL'): cal_tag.Voltage = str(round(ssd_target, 3)) if(g1a1_opt_pass or ssd_opt_pass): self.info("Disabling module prior to writing EEPROM") sc.module_control(slot, "Disable", self) # key of the dictionary index into the vadj value self.info("Download tag DRIVER_AMP_ADJ_CAL back into EEPROM...") self.info(adj_cal_tag.__str__()) #self.user_input("") res = ber_obj.download_cust(adj_cal_tag) self.info("Saving new tag...") xml_file_name = "DRIVER_AMP_ADJ_CAL_%s.xml" % sn self.save_object(adj_cal_tag, xml_file_name) self.info("Enabling module...") sc.module_control(slot, "Enable", self) download = True else: self.info("G1A1/SSD Optimization has failures..") self.info("Enabling driver loops..") obj.enable_drv_bal_loops() for sn in self.uutSnList: slot = self.uutDict[sn]["slot"] uutid = self.uutDict[sn]["id"] if self.errorCount[sn]: self.lf.write("\n\nERROR: slot%s(%s):\n VssdVg1a1Sweep test failed.\n" %(slot, sn)) self.failed("slot%s(%s): VssdVg1a1Sweep test failed." %(slot, sn), uutid) else: # clean up logs if the test passes by providing the diagnostic # dictionary to the clean-up function. Diag.clean_up_logs(sn, self.diag) self.passed ("%s(%s): VssdVg1a1Sweep test passed." % (slot, sn), uutid) if(download): self.info("Resetting line card so tag changes can take affects...") # DO THIS FROM CAROL ber_obj.reset_card() reset_dsp_sleep_time = 180 self.info("Wait %s seconds for DSP to come up..." % reset_dsp_sleep_time) time.sleep(reset_dsp_sleep_time) return self.completed("VssdVg1a1Sweep test completed.")
def test_method(self): errorCount = 0 sc = self.SC # now begin the actual testing # loop through OSNRs for each do 700, 0 and +700 dispersion. cdTestList = self.cdTestList osnrList = self.osnrList shelf = 1 osnrTol = self.config.osnrParams["tol"] wvlngth = self.tdc_channel_dict[self.tdc_type][1] targetRefRxPwr = self.config.cardParams['rxpwr'][0] targetUutPwr = PQ('-18.0 dB') refRxTol = self.config.cardParams["tol"][0] uutRxTol = self.config.cardParams['tol'][0] temp = self.DAQ.temperature minosnr, maxosnr = self.config.osnrSpecRange numIter = self.config.numIter INVALIDBER = self.config.INVALIDBER berLimit = self.config.berLimit osnrBerLimits = self.config.osnrBerLimits self.RxLOSThr = -24.0 temp = self.DAQ.temperature self.tamb = temp PWR_DELTA_MAX = PQ("2.0 dB") self.tdc_type = self.config.default_tdc_type tdc_type = self.tdc_type refsn = self.refsn self.info("Starts sweeping CD ...") self.lf.write("Starts sweeping CD ...") tb = self.config.testbed hsynclosshist = {} hberr = {} lber = {} qval = {} rxpwr = {} qval = {} current_disp = {} index = 0 for cd in cdTestList: self.diagnostic("##### Current CD: %s" % cd) # 1. disable CD EDFA output if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Disabling ProgCD output...") self.dBox.set_switch(6, 'cnt') # 2. set ProgCD to cd self.info("Setting dispersion to %s" % cd) self.dBox.dispersion = cd self.info("Dispersion is: %s" % self.dBox.dispersion) # 3. enable ProgCD if self.PROGCD.__class__ == instruments.GP700: pass else: self.info("Enabling ProgCD output...") self.dBox.set_switch(6, 'byp') # 4. enable and adjust Input VOAs to achieve targeted OSNR. q_list = [] uutindex = 0 # UUT index in uutSnList for sn in self.uutSnList: #excluding refsn obj = self.uutDict[sn]["obj"] slot = self.uutDict[sn]["slot"] uut_slot = int(slot) ser_obj = self.uut_ser_dict[slot] UUT_ber = "UUT_slot%s" % slot #UUT_ber = "UUT_slot%s_ber" % slot ber_obj = self.uut_ser_dict[UUT_ber] #ber_obj = self.config.testbed[UUT_ber] obj = ser_obj card_type = sc.get_attribute("CardTypePresent", shelf, slot) card = card_type[:-3] self.info("Card in slot #%s is '%s'" % (slot, card)) if(card.find('4400') >= 0): self.info("Setting UUT(4400) to 4040 Mode..") ber_obj.set_4400_to_4040() time.sleep(10) if index == 0: # test the reference # 1. reference in loop back # 2. set OSNR = 18.0, cd = 0 # 3. enable REF line PRBS # 4. demod (wati for 3 minutes) # 5. check BER against spec. self.info("### Testing Reference....") ref_cd = 0 self.info("Setting dispersion to %s" % ref_cd) self.dBox.dispersion = ref_cd self.info("Dispersion is: %s" % self.dBox.dispersion) time.sleep(10) # # time to settle all instrument self.info("Enabling LINE PRBS on REF...") self.REFRX_ber.enable_line_prbs() # SW3-SW5 = ITU Channel H. Assume H is connected to port 0, 1 pdir_mod_name = "%s" % (self.PDIR.sw_mod) pdir_name = self.PDIR.name pdir_3_index = "%s:3" % pdir_name pdir_3_pos = self.dicon_sw_dict_rx[tdc_type][pdir_3_index] self.info("Setting %s to position %d" % (pdir_3_index, pdir_3_pos)) self.DiCon.set_switch(pdir_mod_name, pdir_3_pos, 3) pwav_name = self.PWAV.name pwav_mod_name = "%s" % (self.PWAV.sw_mod) pwav_pos = self.dicon_sw_dict_rx[tdc_type][pwav_name]#self.config.pwav_pos self.info("Setting %s:1, %s:2, %s:3 to position %d" % \ (pwav_name, pwav_name, pwav_name, pwav_pos)) self.DiCon.set_switch(pwav_mod_name, pwav_pos, 1) self.DiCon.set_switch(pwav_mod_name, pwav_pos, 2) self.DiCon.set_switch(pwav_mod_name, pwav_pos, 3) pdir_1_index = "%s:1" % pdir_name pdir_2_index = "%s:2" % pdir_name pdir_1_pos = self.dicon_sw_dict_rx[tdc_type][pdir_1_index] pdir_2_pos = self.dicon_sw_dict_rx[tdc_type][pdir_2_index] #self.config.pdir_2_pos self.info("Setting %s to %d and %s to %d" % (pdir_1_index, pdir_1_pos, pdir_2_index, pdir_2_pos)) self.DiCon.set_switch(pdir_mod_name, pdir_1_pos, 1) self.DiCon.set_switch(pdir_mod_name, pdir_2_pos, 2) uut_output_sw_name = self.UUT_LINE_OUTPUT_SW.name uut_output_sw_mod_name = self.UUT_LINE_OUTPUT_SW.sw_mod if int(uut_slot) < 6: uut_output_sw_pos = int(uut_slot) - 1 else: uut_output_sw_pos = int(uut_slot) - 5 ref_osnr = PQ("18.1 dB") self.info("Setting initial OSNR to %s" % ref_osnr) osnr = set_OSNR(self.OSA, self.VOAASE, ref_osnr, osnrTol, wvlngth) self.diagnostic("Initial OSNR %s" % osnr) pstatus, rxpwr = set_RxPwr(self.REFRX, self.VOAOUT, targetRefRxPwr, refRxTol) self.diagnostic("Forcing demod reacquistion on REF %s..." % refsn) reacq_settle_time = 180 self.REFRX.force_demod_reacq() self.info("Sleeping for %s seconds after demod reacq..." % reacq_settle_time) time.sleep(reacq_settle_time) refsn_uut = "%s_%s" % (refsn, sn) # reset line prbs self.info("Resetting LINE PRBS on REF & UUT...") self.REFRX_ber.reset_line_prbs() ber_obj.reset_line_prbs() # now check PRBS on reference hi = max(osnrBerLimits[ref_osnr]) low = min(osnrBerLimits[ref_osnr]) limit_check_timeout = 600 time_check, lstatus, lber[refsn] = self.check_limit(hi, low, ber_obj, ser_obj, self.REFRX_ber, sn, refsn_uut, self.tamb, ref_osnr, ref_cd, limit_check_timeout) try: qval[refsn] = round(get_Q(lber[refsn]), 2) except: invalid_q_val = 99 self.diagnostic("Got invliad BER...set Q_val as %d" % invalid_q_val) qval[refsn] = invalid_q_val # invalid BER if osnrBerLimits.has_key(ref_osnr): if qval[refsn] < low or qval[refsn] > hi: self.errorCount[sn] += 1 self.error("Q %s (%s), NOT within BER limit (%s, %s)" % (qval[refsn], lber[refsn], low, hi)) return self.incomplete("REFERENCE is not within specs!") else: self.info("Q %s (%s), within BER limit (%s, %s)" % (qval[refsn], lber[refsn], low, hi)) index += 1 # set the REF & UUT to transmit on the correct channel #ser_obj.ModChan = self.chn #self.REFRX.ModChan = self.chn #self.diagnostic("UUT Tx set to channel %s" % ser_obj.ModChan) #self.diagnostic("REF Tx set to channel %s" % self.REFRX.ModChan) self.info("Setting UUT (%s) in slot %s to initial dispersion to: %d" % (sn, slot,-cd)) ser_obj.set_tdc_startdisp(-cd) # XXX: must do this to enable periodic check to make sure the # 4400 is functioning as a 4040 # self.diagnostic("Setting 4400 as a 4040...") #obj.set_4400_to_4040() self.info("### Running UUT (%s) on slot (%s)" % (sn, slot)) pdir_mod_name = "%s" % (self.PDIR.sw_mod) pdir_name = self.PDIR.name pdir_3_index = "%s:3" % pdir_name pdir_3_pos = self.dicon_sw_dict[tdc_type][pdir_3_index] self.info("Setting %s to position %d" % (pdir_3_index, pdir_3_pos)) self.DiCon.set_switch(pdir_mod_name, pdir_3_pos, 3) pwav_name = self.PWAV.name pwav_mod_name = "%s" % (self.PWAV.sw_mod) pwav_pos = self.dicon_sw_dict[tdc_type][pwav_name]#self.config.pwav_pos self.info("Setting %s:1, %s:2, %s:3 to position %d" % \ (pwav_name, pwav_name, pwav_name, pwav_pos)) self.DiCon.set_switch(pwav_mod_name, pwav_pos, 1) self.DiCon.set_switch(pwav_mod_name, pwav_pos, 2) self.DiCon.set_switch(pwav_mod_name, pwav_pos, 3) pdir_1_index = "%s:1" % pdir_name pdir_2_index = "%s:2" % pdir_name pdir_1_pos = self.dicon_sw_dict[tdc_type][pdir_1_index] pdir_2_pos = self.dicon_sw_dict[tdc_type][pdir_2_index] #self.config.pdir_2_pos self.info("Setting %s to %d and %s to %d" % (pdir_1_index, pdir_1_pos, pdir_2_index, pdir_2_pos)) self.DiCon.set_switch(pdir_mod_name, pdir_1_pos, 1) self.DiCon.set_switch(pdir_mod_name, pdir_2_pos, 2) uut_output_sw_name = self.UUT_LINE_OUTPUT_SW.name uut_output_sw_mod_name = self.UUT_LINE_OUTPUT_SW.sw_mod if int(uut_slot) < 6: uut_output_sw_pos = int(uut_slot) - 1 else: uut_output_sw_pos = int(uut_slot) - 5 uut_client_output_sw_name = self.UUT_CLIENT_OUTPUT_SW.name uut_client_output_sw_mod_name = self.UUT_CLIENT_OUTPUT_SW.sw_mod self.info("### Setting %s to output on %d" % (uut_output_sw_mod_name, uut_output_sw_pos)) self.DiCon.set_4x1_switch_output(uut_output_sw_name, uut_output_sw_pos) self.info("### Setting %s to output on %d" % (uut_client_output_sw_name, uut_output_sw_pos)) self.DiCon.set_4x1_switch_output(uut_client_output_sw_mod_name, uut_output_sw_pos) # set to initial osnr to a low value to obtain a small bitty eye self.info("Setting initial OSNR to %s" % self.init_osnr) osnr = set_OSNR(self.OSA, self.VOAASE, self.init_osnr, osnrTol, wvlngth) self.diagnostic("Initial OSNR %s" % osnr) pstatus, rxpwr = set_RxPwr(self.REFRX, self.VOAOUT, targetRefRxPwr, refRxTol) self.diagnostic("Forcing demod reacquistion on REF %s..." % refsn) reacq_settle_time = 180 self.REFRX.force_demod_reacq() self.info("Sleeping for %s seconds after demod reacq..." % reacq_settle_time) time.sleep(reacq_settle_time) refsn_uut = "%s_%s" % (refsn, sn) for targetOSNR in osnrList: if targetOSNR == PQ(13.4, 'dB'): # was 12.5, but there's a +1 factor berrColInterval = 120 else: berrColInterval = 2 self.diagnostic("BER Collection interval is: %s" % berrColInterval) if cd != 0: adjtargetOSNR = targetOSNR + PQ(1, 'dB') else: adjtargetOSNR = targetOSNR self.info("\n###### Verifying BER at CD :%s at OSNR: %s ######\n" %(cd, adjtargetOSNR,)) self.lf.write("\n\nVerifying BER at CD: %s OSNR: %s\n" % (cd, adjtargetOSNR,)) osnr = set_OSNR(self.OSA, self.VOAASE, adjtargetOSNR, osnrTol, wvlngth) # 5 & 6. enable and adjust output VOA's to achieve target power # reading #self.info("Turning on Output VOAs and Stablizing...\n") rxpwr = {} lber = {} refindex = 0 #RefRx index in refSnList self.info("Setting Ref Rx Power to %s." % (targetRefRxPwr,)) self.lf.write("\n\nSetting Ref RX Power to %s.\n" % (targetRefRxPwr,)) pstatus, rxpwr[refsn] = set_RxPwr(self.REFRX, self.VOAOUT, targetRefRxPwr, refRxTol) if not pstatus: self.error("REF RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[refsn], targetRefRxPwr)) self.lf.write("\n\nERROR: REF RxPwr %s not equivalent to " "ExpRxPwr %s" %(rxpwr[refsn], targetRefRxPwr)) self.diagnostic("TARGET_OSNR: %s, osnrList[0]: %s" % (targetOSNR, osnrList[0])) if (self.config.flags.VERBOSE and self.config.flags.DEBUG): self.info("Start logging diagnostics from UUT Mike Shell...") self.diag_logger[sn].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[sn].capture(None, ser_obj) self.info("Start logging diagnostics from REF Mike Shell...") self.diag_logger[refsn_uut].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[refsn_uut].capture(None, self.REFRX) #if targetOSNR == osnrList[0]: # # wait longer for the fir osnr setting. # settle_time = 120 #else: # settle_time = 20 settle_time = 20 self.info("Enabling LINE PRBS...") ber_obj.enable_line_prbs() self.info("Checking for lock...") self.diagnostic("Setting for REF RX PRBS...") self.REFRX_ber.set_for_rx_prbs() hi = max(osnrBerLimits[adjtargetOSNR]) low = min(osnrBerLimits[adjtargetOSNR]) limit_check_timeout = 600 # 5 minutes time_check, lstatus, lber[refsn] = self.check_limit(hi, low, ber_obj, ser_obj, self.REFRX_ber, sn, refsn_uut, self.tamb, targetOSNR, cd, limit_check_timeout) self.diagnostic("Check limit done within %s seconds" % time_check) if not lstatus: self.diagnostic("TDC unable to get a lock within %s seconds" % time_check) else: self.diagnostic("TDC got a lock within %s seconds" % (time_check)) #self.info("Settle Time: %s" % settle_time) #self.info("Sleeping for %s seconds..." % settle_time) #time.sleep(settle_time) lber[sn] = ber_obj.BER rxpwr[sn] = obj.RxPwr #lstatus, lber[refsn] = get_LineBER(self.REFRX_ber) if not lstatus: if targetOSNR >= minosnr: #minosnr = 19.5dB self.info("WARNING: slot%s(%s):\n REF current BER not valid at OSNR: %s\n" % (slot, sn, osnr)) self.lf.write("\n\nWARNING: slot%s(%s):\n REF current BER not valid at OSNR: %s\n" %(slot, sn, osnr)) self.info("slot%s(%s):\n TAmb: %s OSNR: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, osnr, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) self.lf.write("\n\nslot%s(%s):\n TAmb: %s OSNR: %s UUTRxBER: %s RefRxBER: %s UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, osnr, lber[sn], lber[refsn], rxpwr[sn], rxpwr[refsn])) uutindex += 1 try: qval[sn] = round(get_Q(lber[sn]), 2) except: self.diagnostic("Got invliad UUT BER...") qval[sn] = 0 self.info("Getting TDC dispersion...") current_disp[sn] = ser_obj.show_actual_dispersion() self.info("TDC disperison: %s" % current_disp[sn]) q_list.append((qval[sn], current_disp[sn])) numIter = self.config.numIter try: qval[refsn] = round(get_Q(lber[refsn]), 2) except: invalid_q_val = 99 self.diagnostic("Got invliad BER...set Q_val as %d" % invalid_q_val) qval[refsn] = invalid_q_val # invalid BER #Comparing lber with the specified limits uutid = self.uutDict[sn]["id"] slot = self.uutDict[sn]["slot"] self.info("slot%s(%s):\n TAmb: %s UUTRxBER: %s(%s) RefRxBER: %s(%s) UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, lber[sn], qval[sn], lber[refsn], qval[refsn], rxpwr[sn], rxpwr[refsn])) self.lf.write("slot%s(%s):\n TAmb: %s UUTRxBER: %s(%s) RefRxBER: %s(%s) UUTRxPwr: %s RefRxPower: %s\n" % (slot, sn, temp, lber[sn], qval[sn], lber[refsn], qval[refsn], rxpwr[sn], rxpwr[refsn])) high = max(osnrBerLimits[adjtargetOSNR]) low = min(osnrBerLimits[adjtargetOSNR]) self.diagnostic("REF_Q: %s, LOW: %s, HIGH: %s" % ( qval[refsn], low, high)) if (self.config.flags.VERBOSE and self.config.flags.DEBUG): self.info("Start logging diagnostics from UUT Mike Shell...") self.diag_logger[sn].info("*** AFTER: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[sn].capture(None, ser_obj) self.info("Start logging diagnostics from REF Mike Shell...") self.diag_logger[refsn_uut].info("*** BEFORE: PV OSNR: %s, CD: %s" % (targetOSNR, cd)) self.diag[refsn_uut].capture(None, self.REFRX) if osnrBerLimits.has_key(targetOSNR): if qval[refsn] < low or qval[refsn] > high: self.errorCount[sn] += 1 self.error("%s(%s):\nREF actual Q %s (%s) not within BER limit (%s, %s)\n" %(slot, sn, qval[refsn], lber[refsn], low, high)) self.lf.write("\n\nERROR: %s(%s):\n UUT actual Q %s (%s) not within BER limit (%s, %s)\n" %(slot, sn, qval[refsn], lber[refsn], low, high)) self.lineTxBerArgs[uutid].append((temp, cd, osnr, lber[sn], lber[refsn], qval[sn], qval[refsn], rxpwr[sn], rxpwr[refsn])) edfa_info = ser_obj.get_edfa_loop_params() (pd1, pd2) = ser_obj.get_pd1_pd2() self.diagnostic("LaserCurr: %s, LaserAdc: %s, IpwrdBm: %s, Ipwr: %s, Pd1: %s, Pd2: %s" % \ (edfa_info['LaserCurr'], edfa_info['LaserAdc'], edfa_info['IpwrdBm'], edfa_info['Ipwr'], pd1, pd2)) self.lf.write( "\nTime Stamp: %s" % (time.strftime( "%m-%d-%Y %H:%M:%S", time.localtime()))) self.lf.flush() for sn in self.uutSnList: slot = self.uutDict[sn]["slot"] uutid = self.uutDict[sn]["id"] self.diagnostic(self.errorCount[sn]) if (self.errorCount[sn]): self.lf.write("\n\nERROR: slot%s(%s):\n UUT LineTxBER test failed.\n" %(slot, sn)) self.failed("slot%s(%s):\n UUT LineTxBER test failed.\n" %(slot, sn), uutid) else: # clean up logs if the test passes by providing the diagnostic # dictionary to the clean-up function. Diag.clean_up_logs(sn, self.diag) self.passed("slot%s(%s):\n UUT LineTxBER test passed.\n" %(slot, sn), uutid) return self.completed("LineTxBER test completed.")