def setUp(self): #run before each test self.SMW = VSG().jav_OpenTest(host)
class TestGeneral(unittest.TestCase): def setUp(self): #run before each test self.SMW = VSG().jav_OpenTest(host) def tearDown(self): #Run after each test self.assertEqual(self.SMW.jav_Error()[0], '0') self.SMW.jav_Close() ############################################################################### ### <Test> ############################################################################### def test_SMW_WLAN_Get(self): nullVal = self.SMW.Get_WLAN_Standard() nullVal = self.SMW.Get_WLAN_ChBW() nullVal = self.SMW.Get_WLAN_PPDU() nullVal = self.SMW.Get_WLAN_MCS() nullVal = self.SMW.Get_WLAN_Modulation() self.assertEqual(self.SMW.jav_Error()[0], '0') def test_SMW_WLAN_Set(self): # self.SMW.Set_Freq(self.Freq) self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_ChBW(160) self.SMW.Set_WLAN_Standard('AC') self.SMW.Set_WLAN_MCS(1) self.SMW.Set_WLAN_Modulation('QPSK') # self.SMW.Set_WLAN_BBState('ON') # self.SMW.Set_RFState('ON') #Turn RF Output on self.assertEqual(self.SMW.jav_Error()[0], '0') def test_SMW_WLAN_Set_A(self): setVal = 'A' self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_Standard(setVal) getVal = self.SMW.Get_WLAN_Standard() if self.SMW.connected: self.assertEqual(setVal, getVal) def test_SMW_WLAN_Set_B(self): setVal = 'B' self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_Standard(setVal) getVal = self.SMW.Get_WLAN_Standard() if self.SMW.connected: self.assertEqual(setVal, getVal) # def test_SMW_WLAN_Set_G(self): # setVal = 'G' # self.SMW.Set_WLAN_BBState('OFF') # self.SMW.Set_WLAN_Standard(setVal) # getVal = self.SMW.Get_WLAN_Standard() # self.assertEqual(setVal,getVal) def test_SMW_WLAN_Set_N(self): setVal = 'N' self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_Standard(setVal) getVal = self.SMW.Get_WLAN_Standard() if self.SMW.connected: self.assertEqual(setVal, getVal) def test_SMW_WLAN_Set_AC(self): setVal = 'AC' self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_Standard(setVal) getVal = self.SMW.Get_WLAN_Standard() if self.SMW.connected: self.assertEqual(setVal, getVal) def test_SMW_WLAN_Set_AX(self): setVal = 'AX' self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_Standard(setVal) getVal = self.SMW.Get_WLAN_Standard() if self.SMW.connected: self.assertEqual(setVal, getVal) def test_SMW_WLAN_Set_Bad(self): #Test exception setVal = 'BAD' self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_Standard(setVal) def test_SMW_WLAN_Set_BBON(self): self.SMW.Set_WLAN_ChBW(20) if self.SMW.connected: self.SMW.Set_WLAN_BBState('ON')
### Loops Repeat = 1 PwrArry = range(-50,0,2) ############################################################################### ### Code Overhead ############################################################################### import timeit from rssd.VSA.WLAN_K91 import VSA #pylint: disable=E0611,E0401 from rssd.VSG.WLAN_K54 import VSG #pylint: disable=E0611,E0401 from rssd.FileIO import FileIO #pylint: disable=E0611,E0401 OFile = FileIO().makeFile(__file__) VSA = VSA().jav_Open(VSA_IP,OFile) #Create VSA Object VSG = VSG().jav_Open(VSG_IP,OFile) #Create VSG Object ############################################################################### ### Instrument Init ############################################################################### #VSA.Set_DisplayUpdate("OFF") VSA.Set_Param_Couple_All() VSA.Set_In_YIG('OFF') VSA.Set_Freq(Freq) VSA.Init_IQ() #FSW IQ Channel VSA.Set_IQ_Time(MeasTim) VSA.Init_WLAN() VSA.Set_WLAN_Standard('AC') VSA.Set_WLAN_ChBW(0)
def jav_OpenTest(self,SMW_IP,FSW_IP): self.SMW = VSG().jav_OpenTest(SMW_IP) #Create SMW Object self.FSW = VSA().jav_OpenTest(FSW_IP) #Create FSW Object return self
def jav_Open(self,SMW_IP,FSW_IP,OFile=''): self.SMW = VSG().jav_Open(SMW_IP,OFile,prnt=0) #Create SMW Object self.FSW = VSA().jav_Open(FSW_IP,OFile,prnt=0) #Create FSW Object return self
class VST(object): """ Rohde & Schwarz Vector Signal Transciever 802.11 Object """ def __init__(self): self.Freq = 2.5e9 self.SWM_Out = 0 self.WLAN_Std = 'N' self.WLAN_ChBW = 20 #MHz self.WLAN_MCS = 1 self.WLAN_Mod = 'QAM64' #QPSK; QAM16; QAM64; QAM256 def Get_WLAN_All(self): odata = [[] for i in range(3)] odata[0].append("[[Parameter]] ") odata[0].append("Standard ") odata[0].append("Ch BW ") odata[0].append("PPDU ") odata[0].append("MCS ") odata[0].append("Mod ") try: odata[1].append("[-SMW-]") odata[1].append(self.SMW.Get_WLAN_Standard()) odata[1].append(self.SMW.Get_WLAN_ChBW()) odata[1].append(self.SMW.Get_WLAN_PPDU()) odata[1].append(self.SMW.Get_WLAN_MCS()) odata[1].append(self.SMW.Get_WLAN_Modulation()) except: #pragma: no cover pass try: self.FSW.Init_WLAN() odata[2].append("[-FSW-]") odata[2].append(self.FSW.Get_WLAN_Standard()) odata[2].append(self.FSW.Get_WLAN_ChBW()) odata[2].append(self.FSW.Get_WLAN_PPDU()) odata[2].append(self.FSW.Get_WLAN_MCS()) odata[2].append(self.FSW.Get_WLAN_Modulation()) except: #pragma: no cover pass print('SMW/FSW Values: %d %d'%(len(odata[2]),len(odata[2]))) return odata def Get_WLAN_All_print(self): data = self.Get_WLAN_All() for i in range(len(data[0])): try: print("%s\t%s\t%s"%(data[0][i],data[1][i],data[2][i])) except: #pragma: no cover try: print("%s\t%s\t%s"%(data[0][i],data[1][i],'<notRead>')) except: print("%s\t%s\t%s"%(data[0][i],'<notRead>',data[2][i])) def jav_Open(self,SMW_IP,FSW_IP,OFile=''): self.SMW = VSG().jav_Open(SMW_IP,OFile,prnt=0) #Create SMW Object self.FSW = VSA().jav_Open(FSW_IP,OFile,prnt=0) #Create FSW Object return self def jav_OpenTest(self,SMW_IP,FSW_IP): self.SMW = VSG().jav_OpenTest(SMW_IP) #Create SMW Object self.FSW = VSA().jav_OpenTest(FSW_IP) #Create FSW Object return self def jav_Close(self): self.SMW.jav_Close() self.FSW.jav_Close() def jav_Clear(self): self.SMW.jav_Clear() self.FSW.jav_Clear() def Set_WLAN_All(self): try: ### SMW Settings self.SMW.Set_Freq(self.Freq) self.SMW.Set_WLAN_BBState('OFF') self.SMW.Set_WLAN_ChBW(self.WLAN_ChBW) self.SMW.Set_WLAN_Standard(self.WLAN_Std) self.SMW.Set_WLAN_MCS(self.WLAN_MCS) self.SMW.Set_WLAN_BBState('ON') self.SMW.Set_RFState('ON') #Turn RF Output on except: #pragma: no cover print("WLAN_SetSettings: SMW Error") try: ### FSW Setting self.FSW.Init_WLAN() self.FSW.Set_Freq(self.Freq) self.FSW.Set_WLAN_Standard(self.WLAN_Std) self.FSW.Set_WLAN_ChBW(self.WLAN_ChBW) self.FSW.Set_WLAN_MCS(self.WLAN_MCS) except: #pragma: no cover print("WLAN_SetSettings: FSW Error") return 0