def TFS_SoftwareUpgrade_001 ():
	try:
		t1 = time.localtime()
		testResult = ''
		result = ''
		TESTCASE = 'SoftwareUpgrade_001'
		glob.testDesc = """FTP the software image and activate it on the radio"""
		RemoteStationIP = glob.Configs['RemoteStation3RadioIP'].strip().split(',')
		serverIp = glob.Configs['FTPServerIP']
		userName = glob.Configs['FTPUserName']
		password = glob.Configs['FTPPassword']
		targetVersion = glob.Configs['TargetVersion']
		
		# Log Test Case Header
		print('TESTCASE #   %s\n' %TESTCASE)
		glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"
		
		logFile(glob.DlogName,"===============================================================\n")
		logFile(glob.DlogName,"TESTCASE %s\n\n"%TESTCASE)
		print ('#****************************************************************************')
		print ('#							START OF TEST CASE                                ')
		print ('#****************************************************************************')
		for i in range(0,len(RemoteStationIP)):
			STEP ('Step 1: FTP the software\n\n')
			result = soft.FTPTransfer (RemoteStationIP[i], serverIp, userName, password)
			validateStep('FTP the software', result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('Step 2: Activate the software on the radio\n\n')
			result = soft.SwActivation (RemoteStationIP[i], targetVersion)
			validateStep('Activate the software', result, TESTCASE)
			result = ''
		
	except TestException:
		testResult = 'FAIL'
		pass
	else:
		testResult = 'PASS'
			
	
	print ('#****************************************************************************')
	print ('#					END OF TEST CASE                                         ')
	print ('#****************************************************************************')
	finish (t1, TESTCASE, testResult)
def TFS_SoftwareUpgrade_004 ():
	try:
		t1 = time.localtime()
		testResult = ''
		result = ''
		TESTCASE = 'SoftwareUpgrade_004'
		glob.testDesc = """FTP the software to the base radio and then redistribute to all 
						the remote radios and then activate on the remote radios
						and then on the base radio."""
		TargetRadioIP = []	
		BaseStationIP = glob.Configs['BaseStationRadioIP'].strip().split(',')
		TargetBaseIP = glob.Configs['BaseStationVirtualIP'] 
		print('TESTCASE #   %s\n' %TESTCASE)
		glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"
		
		logFile(glob.DlogName,"===============================================================\n")
		logFile(glob.DlogName,"TESTCASE %s\n\n"%TESTCASE)
		
		# result = term.getProtectedActiveUnit(TargetBaseIP)
		# print (result)
		result = ip.getActivePartnerIpAddress(TargetBaseIP)
		print (result[2])
		validateStep('Configure DUT1: %s Radio as Base Station\n\n' %TargetBaseIP, result, TESTCASE)
		result = ''
		
	except TestException:
		testResult = 'FAIL'
		pass
	else:
		testResult = 'PASS'
			
	print ('#****************************************************************************')
	print ('#					END OF TEST CASE                                         ')
	print ('#****************************************************************************')
	finish (t1, TESTCASE, testResult)
	
def TFS_Radio_008 ():
	try:
		# log current time
		t1 = time.localtime()
		testResult = ''
		result = ''
		TESTCASE = 'Radio_008'
		glob.testDesc = """Verifies that radio communication in LBS mode without ACK with dual frequency"""
		# Define the variables to be used in the test case
		TargetRadioIP = []	
		BaseStationIP = glob.Configs['BaseStationRadioIP'].strip().split(',')
		TargetBaseIP = glob.Configs['BaseStationVirtualIP'] 
		RepeaterStationIP = glob.Configs['RepeaterStation2RadioIP'].strip().split(',')
		RemoteStationIP = glob.Configs['RemoteStation2RadioIP'].strip().split(',')
		TargetRemoteIP = glob.Configs['RemoteStation2VirtualIP']
		TargetRadioIP = TargetRadioIP + BaseStationIP
		TargetRadioIP = TargetRadioIP + RepeaterStationIP
		TargetRadioIP = TargetRadioIP + RemoteStationIP
		
		channelSizes = 2				# This defines channel sizes as 12.5
		channelAccMode = 2				# This set the channel access mode to be LBS
		channelAccAckEnabled = 2		# This enables the channel access mode without Acknowledgement
		baudRate = 115200
		srlPortIndx_base = glob.Configs['BaseSerialPortIndex']
		srlPortIndx_remote = glob.Configs['Remote2SerialPortIndex']
		
		srlPortNum_base = int (glob.Configs['BaseSerialPortNumber'])
		srlPortNum_remote = int(glob.Configs['Remote2SerialPortNumber'])
		
		txFrequency = 950056250
		rxFrequency = 950093750
		rptrTxFrequency = 950093750
		rptrRxFrequency = 950056250
		nwRadius = 2
		nwProximity = 2			# Overlapping Mode
		rptNwSeg = 12
		nwTrafficType = 0			# user defined mode
		defaultTtl = 0
		serialTtl = 0
		# srlPortNum = 1			# denotes the serial port number
		srlPrtCfgMode = 1
		flowCtrl = 1				# sets the flow control to CTS-RTS
		mtuSize = 512
		baseTermOpMode = 1			# sets operMOde as Base
		rptrTermOpMode = 2			# sets operMode as Repeater
		remoteOperMode = 3			# sets operMode as Remote
		etherMode = 1
		
		# Serial Tester Variables
		txAddress = rxAddress = 3	# sets the tx and rx address
		txPattern = rxPattern = 'prbs15'
		sender = 1
		receiver = 2
		stopBits = 1
		bSize = 8
		parity = 'None'
		rtscts = 'ON'
		port = glob.Configs['SerialTester1Port']
		ifg = 35
		numPkts = 100
		xonxoff = 'ON'
		srlTester = serialTester(port)

		base_Port1_InPkts_BT = 0
		base_Port1_OutPkts_BT = 0
		base_Port1_ErrPkts_BT = 0
		base_Port1_DropPkts_BT = 0
		base_Port1_DropFiltPkts_BT = 0
		base_Port1_RfInPktsErr_BT = 0
		base_Port1_RfOutDropPkts_BT = 0
		base_Port1_RfInDropFiltPkts_BT = 0

		base_Port1_InPkts_AT = 0
		base_Port1_OutPkts_AT = 0
		base_Port1_ErrPkts_AT = 0
		base_Port1_DropPkts_BT = 0
		base_Port1_DropFiltPkts_AT = 0
		base_Port1_RfInPktsErr_AT = 0
		base_Port1_RfOutDropPkts_AT = 0
		base_Port1_RfInDropFiltPkts_AT = 0
		

		remote_Port1_InPkts_BT = 0
		remote_Port1_OutPkts_BT = 0
		remote_Port1_ErrPkts_BT = 0
		remote_Port1_DropPkts_BT = 0
		remote_Port1_DropFiltPkts_BT = 0
		remote_Port1_RfInPktsErr_BT = 0
		remote_Port1_RfOutDropPkts_BT = 0
		remote_Port1_RfInDropFiltPkts_BT = 0

		remote_Port1_InPkts_AT = 0
		remote_Port1_OutPkts_AT = 0
		remote_Port1_ErrPkts_AT = 0
		remote_Port1_DropPkts_BT = 0
		remote_Port1_DropFiltPkts_AT = 0
		remote_Port1_RfInPktsErr_AT = 0
		remote_Port1_RfOutDropPkts_AT = 0
		remote_Port1_RfInDropFiltPkts_AT = 0
		
		base_TxPackets = 0
		base_RxPackets = 0
		base_ErrPackets = 0
		base_DropPkts = 0
		base_DropFiltPkts = 0
		base_RfInPktsErr = 0
		base_RfOutDropPkts = 0
		base_RfInDropFiltPkts = 0
		
		remote_TxPackets = 0
		remote_RxPackets = 0
		remote_ErrPackets = 0
		remote_DropPkts = 0
		remote_DropFiltPkts = 0
		remote_RfInPktsErr = 0
		remote_RfOutDropPkts = 0
		remote_RfInDropFiltPkts = 0


		# Log Test Case Header
		print('TESTCASE #   %s\n' %TESTCASE)
		glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"
		
		logFile(glob.DlogName,"===============================================================\n")
		logFile(glob.DlogName,"TESTCASE %s\n\n"%TESTCASE)

		print ('#****************************************************************************')
		print ('#							COMMON TEST SETUP                                ')
		print ('#****************************************************************************')
		print ('COMMON:	Configure DUT1  & DUT2 PIPS Radio as Base Station\n\n')
		
		
		for i in range(0,len(BaseStationIP)):
			STEP('COMMON:	Configure PIPS Radio as Base Station\n\n')
			result = term.setTerminalOperMode(BaseStationIP[i], baseTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Base Station\n\n' %BaseStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on Base radio\n\n')
			result = rad.setTxSettings (BaseStationIP[i], txFrequency)
			validateStep('Set the Tx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (BaseStationIP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(BaseStationIP[i], nwRadius, nwProximity)
			validateStep('Set Network Radius and Network Proximity on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(BaseStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %BaseStationIP[i] , result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		for i in range(0,len(RepeaterStationIP)):
			STEP('COMMON:	Configure PIPS Radio as Repeater Station\n\n')
			result = term.setTerminalOperMode(RepeaterStationIP[i], rptrTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Repeater Station\n\n' %RepeaterStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on Base radio\n\n')
			result = rad.setTxSettings (RepeaterStationIP[i], rptrTxFrequency)
			validateStep('Set the Tx Frequency on radio %s' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RepeaterStationIP[i], rptrRxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RepeaterStationIP[i], nwRadius, nwProximity, rptNwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RepeaterStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		for i in range(0,len(RemoteStationIP)):
			STEP('COMMON:	Configure Radio as Remote Station\n\n')
			result = term.setTerminalOperMode(RemoteStationIP[i], remoteOperMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Remote Station\n\n' %RemoteStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RemoteStationIP[i], nwRadius, nwProximity, rptNwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			result = rad.setTxSettings (RemoteStationIP[i], txFrequency)
			validateStep('Set the Tx Frequency on radio %s' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RemoteStationIP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RemoteStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		
		# The following configurations are done on the base, repeater and remote radios
		
		for i in range (0,len(TargetRadioIP)):
			#******************************************************************
			STEP ('COMMON: Configure the network traffic type as userdefined on all radios\n\n')
			result = rad.setRadioTrafficSettings(TargetRadioIP[i], nwTrafficType)
			validateStep('Set the Network Traffic Type on radio %s' %TargetRadioIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the Serial TTL to 0 on all radios\n\n')
			
			result = rad.setRadioAdvancedSettings (TargetRadioIP[i], defaultTtl, serialTtl)
			validateStep('Set the serial TTL to 0 on radio %s' %TargetRadioIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			
			
		print ('#****************************************************************************')
		print ('#							START OF TEST CASE                               ')
		print ('#****************************************************************************')

		# Set the channel Size
		for cnt in range(0,len(BaseStationIP)):
			STEP('COMMON:	Configure Channel Size on the Base Station\n\n')
			result = rad.setRadioChannelSize(BaseStationIP[cnt], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes,BaseStationIP[cnt]), result, TESTCASE)
			result = ''
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(BaseStationIP[cnt], 1)
			validateStep('Reboot the radio %s after 5 secs' %BaseStationIP[cnt] , result, TESTCASE)
			result = ''
	
		print ('#****************************************************************************')
		for cnt in range(0,len(RepeaterStationIP)):
			STEP('COMMON:	Configure Channel Size on the Repeater Station\n\n')
			result = rad.setRadioChannelSize(RepeaterStationIP[cnt], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes, RepeaterStationIP[cnt]), result, TESTCASE)
			result = ''
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RepeaterStationIP[cnt], 1)
			validateStep('Reboot the radio %s after 5 secs' %RepeaterStationIP[cnt] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		for cnt in range(0,len(RemoteStationIP)):
			STEP('COMMON:	Configure Channel Size on Remote Station\n\n')
			result = rad.setRadioChannelSize(RemoteStationIP[cnt], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes, RemoteStationIP[cnt]), result, TESTCASE)
			result = ''
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RemoteStationIP[cnt], 1)
			validateStep('Reboot the radio %s after 5 secs' %RemoteStationIP[cnt], result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		
		logFile(glob.DlogName,"****************************************************************************\n")
		logFile(glob.DlogName,"For Channel Size %s, and Channel Access Scheme  as %s \n" %(channelSizes, channelAccMode))
		logFile(glob.DlogName,"****************************************************************************\n")
		
		STEP ('Step 1:	Enable the Channel Access Mode on all radios\n\n')
		
		for i in range (0,len(TargetRadioIP)):
			result = rad.setRadioChannelAccessScheme (TargetRadioIP[i], channelAccMode, channelAccAckEnabled)
			validateStep('Configured the channel Access Scheme on %s\n\n' %TargetRadioIP[i], result, TESTCASE)
	
			result = ''	
		
		print ('#****************************************************************************')
		STEP ('Step 2:	Configure the serial ports on all radios\n\n')
		# configuring the serial ports on base radio
		for x in range(0,len(BaseStationIP)):			# for loop for base station radios
			result = srl.serialPortSetup (BaseStationIP[x],srlPortIndx_base, srlPrtCfgMode, mtuSize, baudRate, flowCtrl)
			validateStep('Configured the serial port on %s\n\n' %BaseStationIP[x], result, TESTCASE)
	
			result = ''
			
		# Configure the serial port on Remote
		for x in range(0,len(RemoteStationIP)):
			# Configure the serial port on Remote
			result = srl.serialPortSetup (RemoteStationIP[x],srlPortIndx_remote, srlPrtCfgMode, mtuSize, baudRate, flowCtrl)
			validateStep('Configured the serial port on %s\n\n' %RemoteStationIP[x], result, TESTCASE)
	
			result = ''
		
		print ('#****************************************************************************')
		STEP ('Step 3: Configure the Serial Tester to match the baud rates as the DUT\n\n')
		
		# Set the Tx and Rx Address
		srlTester.setTxRxAddress (txAddress, rxAddress)
		
		# Set the traffic port settings
		srlTester.trafficPortsSettings (baudRate, bSize, stopBits, parity, rtscts, mtuSize, ifg, numPkts, xonxoff)
		
		# Set the traffic direction
		srlTester.setTrafficDirection(sender, receiver)
		
		# Set the tx and rx traffic pattern
		srlTester.setTxRxTrafficPattern(txPattern, rxPattern)
		
		# Set SMR Test Options
		srlTester.setSMRTest('on', 'off')
		
		#Set the txDelay to 10
		srlTester.send_command('tx delay, 30\r\n')
		
		print ('#****************************************************************************')
		STEP ('Step 3a: Get the number Packets on the radio before sending traffic\n\n')
		
		# Get the number of packets on the remote radio before sending traffic
		result = mon.getSerialPortTxRxPkts (TargetRemoteIP, srlPortNum_remote)
		validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemoteIP, result, TESTCASE)
		if (result[0]):
			# Then collect all the values
			packetCounts = result[2]
			remote_Port1_InPkts_BT = packetCounts[0]
			remote_Port1_OutPkts_BT = packetCounts[1]
			remote_Port1_ErrPkts_BT = packetCounts[2]
			remote_Port1_DropPkts_BT = packetCounts[3]
			remote_Port1_DropFiltPkts_BT = packetCounts[4]
			remote_Port1_RfInPktsErr_BT = packetCounts[5]
			remote_Port1_RfOutDropPkts_BT = packetCounts[6]
			remote_Port1_RfInDropFiltPkts_BT = packetCounts[7]
			
			logFile(glob.DlogName, 'Remote In Pkts BT:	%s' %remote_Port1_InPkts_BT)
			logFile(glob.DlogName, 'Remote Out Pkts BT:	%s' %remote_Port1_OutPkts_BT)
			logFile(glob.DlogName, 'Remote Err Pkts BT:	%s' %remote_Port1_ErrPkts_BT)
			logFile(glob.DlogName, 'Remote Drop Pkts BT:	%s' %remote_Port1_DropPkts_BT)
			logFile(glob.DlogName, 'Remote Drop Filtered Pkts BT:	%s' %remote_Port1_DropFiltPkts_BT)
			logFile(glob.DlogName, 'Remote RF In Pkts Error BT:	%s' %remote_Port1_RfInPktsErr_BT)
			logFile(glob.DlogName, 'Remote RF Out Drop Pkts BT:	%s' %remote_Port1_RfOutDropPkts_BT)
			logFile(glob.DlogName, 'Remote In Drop Filtered Pkts BT:	%s\n\n' %remote_Port1_RfInDropFiltPkts_BT)
			
		
		result = ''	
		
		# Get the number of packets on the base radio before sending traffic
		result = mon.getSerialPortTxRxPkts (TargetBaseIP, srlPortNum_base)
		validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, result, TESTCASE)
		if (result[0]):
			# Then collect all the values
			packetCounts = result[2]
			base_Port1_InPkts_BT = packetCounts[0]
			base_Port1_OutPkts_BT = packetCounts[1]
			base_Port1_ErrPkts_BT = packetCounts[2]
			base_Port1_DropPkts_BT = packetCounts[3]
			base_Port1_DropFiltPkts_BT = packetCounts[4]
			base_Port1_RfInPktsErr_BT = packetCounts[5]
			base_Port1_RfOutDropPkts_BT = packetCounts[6]
			base_Port1_RfInDropFiltPkts_BT = packetCounts[7]
			
			logFile(glob.DlogName, 'Base In Pkts BT:	%s' %base_Port1_InPkts_BT)
			logFile(glob.DlogName, 'Base Out Pkts BT:	%s' %base_Port1_OutPkts_BT)
			logFile(glob.DlogName, 'Base Err Pkts BT:	%s' %base_Port1_ErrPkts_BT)
			logFile(glob.DlogName, 'Base Drop Pkts BT:	%s' %base_Port1_DropPkts_BT)
			logFile(glob.DlogName, 'Base Drop Filtered Pkts BT:	%s' %base_Port1_DropFiltPkts_BT)
			logFile(glob.DlogName, 'Base RF In Pkts Error BT:	%s' %base_Port1_RfInPktsErr_BT)
			logFile(glob.DlogName, 'Base RF Out Drop Pkts BT:	%s' %base_Port1_RfOutDropPkts_BT)
			logFile(glob.DlogName, 'Base In Drop Filtered Pkts BT:	%s\n\n' %base_Port1_RfInDropFiltPkts_BT)
			
		result = ''
		
		print ('#****************************************************************************')
		STEP ('Step 4 : Send and verify serial traffic')
		
		result = srlTester.sendAndVerifySerialTraffic ()
		# validateStep("Send and verify serial traffic\n", result, TESTCASE)
		# if (result[0]):
			# srlTesterPkts = result[2]
			# srlTesterPkts = tuple(srlTesterPkts)
			# txPackets = int(srlTesterPkts[0])
			# rxPackets = int(srlTesterPkts[1])
			# logFile(glob.DlogName, 'Serial Tx Packets : %s' %txPackets)
			# logFile(glob.DlogName, 'Serial Rx Packets : %s' %rxPackets)
			
		srlTesterPkts = result[2]
		srlTesterPkts = tuple(srlTesterPkts)
		txPackets = int(srlTesterPkts[0])
		rxPackets = int(srlTesterPkts[1])
		logFile(glob.DlogName, 'Serial Tx Packets : %s' %txPackets)
		logFile(glob.DlogName, 'Serial Rx Packets : %s' %rxPackets)
			
		result = ''
		
		print ('#****************************************************************************')
		STEP ('Step 5: Verify the traffic on the radios')
		
		# Get the number of packets on the remote radio after sending traffic
		result = mon.getSerialPortTxRxPkts (TargetRemoteIP, srlPortNum_remote)
		validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemoteIP, result, TESTCASE)
		if (result[0]):
			# Then collect all the values
			packetCounts = result[2]
			remote_Port1_InPkts_AT = packetCounts[0]
			remote_Port1_OutPkts_AT = packetCounts[1]
			remote_Port1_ErrPkts_AT = packetCounts[2]
			remote_Port1_DropPkts_AT = packetCounts[3]
			remote_Port1_DropFiltPkts_AT = packetCounts[4]
			remote_Port1_RfInPktsErr_AT = packetCounts[5]
			remote_Port1_RfOutDropPkts_AT = packetCounts[6]
			remote_Port1_RfInDropFiltPkts_AT = packetCounts[7]
			
			logFile(glob.DlogName, 'Remote In Pkts AT:	%s' %remote_Port1_InPkts_AT)
			logFile(glob.DlogName, 'Remote Out Pkts AT:	%s' %remote_Port1_OutPkts_AT)
			logFile(glob.DlogName, 'Remote Err Pkts AT:	%s' %remote_Port1_ErrPkts_AT)
			logFile(glob.DlogName, 'Remote Drop Pkts AT:	%s' %remote_Port1_DropPkts_AT)
			logFile(glob.DlogName, 'Remote Drop Filtered Pkts AT:	%s' %remote_Port1_DropFiltPkts_AT)
			logFile(glob.DlogName, 'Remote RF In Pkts Error AT:	%s' %remote_Port1_RfInPktsErr_AT)
			logFile(glob.DlogName, 'Remote RF Out Drop Pkts AT:	%s' %remote_Port1_RfOutDropPkts_AT)
			logFile(glob.DlogName, 'Remote In Drop Filtered Pkts AT:	%s\n\n' %remote_Port1_RfInDropFiltPkts_AT)
		
		result = ''				
		# Get the number of packets on the base radio before sending traffic
		result = mon.getSerialPortTxRxPkts (TargetBaseIP, srlPortNum_base)
		validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, result, TESTCASE)
		if (result[0]):
			# Then collect all the values
			packetCounts = result[2]
			base_Port1_InPkts_AT = packetCounts[0]
			base_Port1_OutPkts_AT = packetCounts[1]
			base_Port1_ErrPkts_AT = packetCounts[2]
			base_Port1_DropPkts_AT = packetCounts[3]
			base_Port1_DropFiltPkts_AT = packetCounts[4]
			base_Port1_RfInPktsErr_AT = packetCounts[5]
			base_Port1_RfOutDropPkts_AT = packetCounts[6]
			base_Port1_RfInDropFiltPkts_AT = packetCounts[7]
			
			logFile(glob.DlogName, 'Base In Pkts AT:	%s' %base_Port1_InPkts_AT)
			logFile(glob.DlogName, 'Base Out Pkts AT:	%s' %base_Port1_OutPkts_AT)
			logFile(glob.DlogName, 'Base Err Pkts AT:	%s' %base_Port1_ErrPkts_AT)
			logFile(glob.DlogName, 'Base Drop Pkts AT:	%s' %base_Port1_DropPkts_AT)
			logFile(glob.DlogName, 'Base Drop Filtered Pkts AT:	%s' %base_Port1_DropFiltPkts_AT)
			logFile(glob.DlogName, 'Base RF In Pkts Error AT:	%s' %base_Port1_RfInPktsErr_AT)
			logFile(glob.DlogName, 'Base RF Out Drop Pkts AT:	%s' %base_Port1_RfOutDropPkts_AT)
			logFile(glob.DlogName, 'Base In Drop Filtered Pkts AT:	%s\n\n' %base_Port1_RfInDropFiltPkts_AT)
			
		base_RxPackets = base_Port1_InPkts_AT - base_Port1_InPkts_BT
		base_DropPkts = base_Port1_DropPkts_AT - base_Port1_DropPkts_BT
		base_DropFiltPkts = base_Port1_DropFiltPkts_AT - base_Port1_DropFiltPkts_BT
		base_RfOutDropPkts = base_Port1_RfOutDropPkts_AT - base_Port1_RfOutDropPkts_BT
		remote_TxPackets = remote_Port1_OutPkts_AT - remote_Port1_OutPkts_BT
		remote_ErrPackets = remote_Port1_ErrPkts_AT - remote_Port1_ErrPkts_BT
		remote_RfInPktsErr = remote_Port1_RfInPktsErr_AT - remote_Port1_RfInPktsErr_BT
		remote_RfInDropFiltPkts = remote_Port1_RfInDropFiltPkts_AT - remote_Port1_RfInDropFiltPkts_BT
		
		logFile(glob.DlogName, 'Base RX Pkts AT:	%s' %base_RxPackets)
		logFile(glob.DlogName, 'Base Drop Pkts AT:	%s' %base_DropPkts)
		logFile(glob.DlogName, 'Base Drop Filtered Pkts AT:	%s' %base_DropFiltPkts)
		logFile(glob.DlogName, 'Base RF Out Drop Pkts AT:	%s' %base_RfOutDropPkts)
		
		logFile(glob.DlogName, 'Remote TX Pkts AT:	%s' %remote_TxPackets)
		logFile(glob.DlogName, 'Remote Err Pkts AT:	%s' %remote_ErrPackets)
		logFile(glob.DlogName, 'Remote RF In Pkts Err AT:	%s' %remote_RfInPktsErr)
		logFile(glob.DlogName, 'Remote RF In Drop Filtered Pkts AT:	%s\n\n' %remote_RfInDropFiltPkts)
		
		result = ''
		res = []
		# Verify the results
		# if ((base_RxPackets == remote_TxPackets) and (base_RxPackets == txPackets) and (remote_ErrPackets == 0)):
		if ((base_RxPackets == remote_TxPackets) and (remote_ErrPackets == 0)):
			res.append(True)
			res.append('Traffic Sent from Base is Received on Remote Station\n')
		else:
			print ('Failed')
			res.append(False)
			res.append('Traffic Sent from Base is not Received on Remote Station\n')
		
		validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, res, TESTCASE)
		
		print ('#****************************************************************************')
		
	except TestException:
		testResult = 'FAIL'
		pass
	else:
		testResult = 'PASS'
			
	finally:
		
		print ('\n#****************************************************************************')
		print ('#							CLEANUP SECTION		                             ')
		print ('#****************************************************************************')
		srlTester.close()
		for i in range (0,len(TargetRadioIP)):
			#******************************************************************
			STEP ('CLEANUP:	Restore the DUTs to User Defaults\n\n')
			
			result = maint.restoreUserDefaults (TargetRadioIP[i], 1)
			validateStep('Restoring User Defaults on %s\n\n' %TargetRadioIP[i], result, TESTCASE)
			
			result = ''
	print ('#****************************************************************************')
	print ('#					END OF TEST CASE                                         ')
	print ('#****************************************************************************')
	finish (t1, TESTCASE, testResult)
def TFS_Radio_017 ():
	try:
		# log current time
		t1 = time.localtime()
		testResult = ''
		result = ''
		TESTCASE = 'Radio_017'
		glob.testDesc = """ Verify serial traffic between two remote radios and 
						base configured as Base Repeater and packet filtering set 
						to Disabled and Automatic"""
		# Define the variables to be used in the test case
		TargetRadioIP = []	
		BaseStationIP = glob.Configs['BaseStationRadioIP'].strip().split(',')
		TargetBaseIP = glob.Configs['BaseStationVirtualIP'] 
		
		# Here we are configuring Repeater1 as one of the Remote Radio and Remote3 as Remote2
		RemoteStation1IP = glob.Configs['RepeaterStation1RadioIP'].strip().split(',')
		RemoteStation2IP = glob.Configs['RemoteStation3RadioIP'].strip().split(',')
		TargetRemote1IP = glob.Configs['RepeaterStationVirtualIP']
		TargetRemote2IP = glob.Configs['RemoteStation3VirtualIP']
		TargetRadioIP = TargetRadioIP + BaseStationIP
		TargetRadioIP = TargetRadioIP + RemoteStation1IP
		TargetRadioIP = TargetRadioIP + RemoteStation2IP
		
		TargetRemoteRadioIP = []
		TargetRemoteRadioIP = TargetRemoteRadioIP + RemoteStation1IP
		TargetRemoteRadioIP = TargetRemoteRadioIP + RemoteStation2IP
		
		channelSizes = [3]	# This defines channel sizes as 12.5, 25 and 50 respectively
		baudRate = 115200
		srlPort1Indx_base = glob.Configs['BaseSerialPortIndex']
		srlPort2Indx_base = glob.Configs['BaseSerialPort2Index']
		
		srlPortIndx_remote1 = glob.Configs['Repeater1SerialPortIndex']
		srlPortIndx_remote2 = glob.Configs['Remote3SerialPort2Index']
		
		srlPort1Num_base = int(glob.Configs['BaseSerialPortNumber'])
		srlPort2Num_base = int(glob.Configs['BaseSerialPort2Number'])
		srlPortNum_remote1 = int(glob.Configs['Repeater1SerialPortNumber'])
		srlPortNum_remote2 = int(glob.Configs['Remote3SerialPort2Number'])
		
		txFrequency = 950056250
		rxFrequency = 950093750
		remTxFrequency = 950093750
		remRxFrequency = 950056250
		txPower = 340				# This denotes txPower as 15dB
		txPower_rem = 100				# This denotes txPower as 20dB
		nwRadius = 2
		nwProximity = 2 			# Overlapping Mode
		rptNwSeg = 12
		nwTrafficType = 0			# user defined mode
		streamMode = 1
		packetFiltering = 0			# Set the packet filtering to disabled
		packetFiltering_base = 1
		dataCompression = 0
		defaultTtl = 0
		serialTtl = 0
		# srlPortNum = 1			# denotes the serial port number
		srlPrtCfgMode = 1
		flowCtrl = 1				# sets the flow control to CTS-RTS
		mtuSize = 512
		baseTermOpMode = 5			# sets operMOde as Base Repeater
		remoteOperMode = 3			# sets operMode as Remote
		etherMode = 1
		
		# Serial Tester Variables
		txAddress = rxAddress = 3	# sets the tx and rx address
		txPattern = rxPattern = 'prbs15'
		sender = 1
		receiver = 2
		stopBits = 1
		bSize = 8
		parity = 'None'
		rtscts = 'ON'
		port = glob.Configs['SerialTester3Port']
		ifg = 35
		numPkts = 100
		xonxoff = 'ON'
		
		srlTester = serialTester(port)
		
		remote1_Port_InPkts_BT = 0
		remote1_Port_OutPkts_BT = 0
		remote1_Port_ErrPkts_BT = 0
		remote1_Port_DropPkts_BT = 0
		remote1_Port_DropFiltPkts_BT = 0
		remote1_Port_RfInPktsErr_BT = 0
		remote1_Port_RfOutDropPkts_BT = 0
		remote1_Port_RfInDropFiltPkts_BT = 0
		
		remote2_Port_InPkts_BT = 0
		remote2_Port_OutPkts_BT = 0
		remote2_Port_ErrPkts_BT = 0
		remote2_Port_DropPkts_BT = 0
		remote2_Port_DropFiltPkts_BT = 0
		remote2_Port_RfInPktsErr_BT = 0
		remote2_Port_RfOutDropPkts_BT = 0
		remote2_Port_RfInDropFiltPkts_BT = 0 
		
		remote1_Port_InPkts_AT = 0
		remote1_Port_OutPkts_AT = 0
		remote1_Port_ErrPkts_AT = 0
		remote1_Port_DropPkts_AT = 0
		remote1_Port_DropFiltPkts_AT = 0
		remote1_Port_RfInPktsErr_AT = 0
		remote1_Port_RfOutDropPkts_AT = 0
		remote1_Port_RfInDropFiltPkts_AT = 0
		
		remote2_Port_InPkts_AT = 0
		remote2_Port_OutPkts_AT = 0
		remote2_Port_ErrPkts_AT = 0
		remote2_Port_DropPkts_AT = 0
		remote2_Port_DropFiltPkts_AT = 0
		remote2_Port_RfInPktsErr_AT = 0
		remote2_Port_RfOutDropPkts_AT = 0
		remote2_Port_RfInDropFiltPkts_AT = 0
		
		remote1_TxPackets = 0
		remote1_RxPackets = 0
		remote1_ErrPackets = 0
		remote1_DropPkts = 0
		remote1_DropFiltPkts = 0
		remote1_RfInPktsErr = 0
		remote1_RfOutDropPkts = 0
		remote1_RfInDropFiltPkts = 0
		
		remote2_TxPackets = 0
		remote2_RxPackets = 0
		remote2_ErrPackets = 0
		remote2_DropPkts = 0
		remote2_DropFiltPkts = 0
		remote2_RfInPktsErr = 0
		remote2_RfOutDropPkts = 0
		remote2_RfInDropFiltPkts = 0
		
		# Log Test Case Header
		print('TESTCASE #   %s\n' %TESTCASE)
		glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"
		
		logFile(glob.DlogName,"===============================================================\n")
		logFile(glob.DlogName,"TESTCASE %s\n\n"%TESTCASE)

		print ('#****************************************************************************')
		print ('#							COMMON TEST SETUP                                ')
		print ('#****************************************************************************')
		print ('COMMON:	Configure DUT1  & DUT2 PIPS Radio as Base Station\n\n')
		
		
		for i in range(0,len(BaseStationIP)):
			STEP('COMMON:	Configure PIPS Radio as Base Station\n\n')
			result = term.setTerminalOperMode(BaseStationIP[i], baseTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Base Station\n\n' %BaseStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %BaseStationIP[i])
			result = rad.setTxSettings (BaseStationIP[i], txFrequency,txPower)
			validateStep('Set the Tx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (BaseStationIP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(BaseStationIP[i], nwRadius, nwProximity)
			validateStep('Set Network Radius and Network Proximity on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the Data Stream Mode and Packet Filtering on all radios\n\n')
			result = rad.setSerialDataStream (BaseStationIP[i], streamMode, packetFiltering_base)
			validateStep('Configured the Data Stream Mode and Packet Filtering on %s\n\n' %BaseStationIP[i], result, TESTCASE)

			result = ''
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(BaseStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %BaseStationIP[i] , result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		for i in range(0,len(TargetRemoteRadioIP)):
			STEP('COMMON:	Configure Radio as Remote Station\n\n')
			result = term.setTerminalOperMode(TargetRemoteRadioIP[i], remoteOperMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Remote Station\n\n' %TargetRemoteRadioIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(TargetRemoteRadioIP[i], nwRadius, nwProximity)
			validateStep('Set Network Radius and Network Proximity on radio %s' %TargetRemoteRadioIP[i] , result, TESTCASE)
			result = ''
			
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %TargetRemoteRadioIP[i])
			result = rad.setTxSettings (TargetRemoteRadioIP[i], remTxFrequency, txPower)
			validateStep('Set the Tx Frequency on radio %s' %TargetRemoteRadioIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (TargetRemoteRadioIP[i], remRxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %TargetRemoteRadioIP[i] , result, TESTCASE)
			result = ''
			
			STEP ('COMMON: Configure the Data Stream Mode and Packet Filtering on all radios\n\n')
			result = rad.setSerialDataStream (TargetRemoteRadioIP[i], streamMode, packetFiltering)
			validateStep('Configured the Data Stream Mode and Packet Filtering on %s\n\n' %TargetRemoteRadioIP[i], result, TESTCASE)

			result = ''
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(TargetRemoteRadioIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %TargetRemoteRadioIP[i] , result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		for i in range (0,len(TargetRadioIP)):
			#******************************************************************
			
			STEP ('COMMON: Configure the network traffic type as userdefined on all radios\n\n')
			result = rad.setRadioTrafficSettings(TargetRadioIP[i], nwTrafficType)
			validateStep('Set the Network Traffic Type on radio %s' %TargetRadioIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the Serial TTL to 0 on all radios\n\n')
			
			result = rad.setRadioAdvancedSettings (TargetRadioIP[i], defaultTtl, serialTtl)
			validateStep('Set the serial TTL to 0 on radio %s' %TargetRadioIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
		
		print ('#****************************************************************************')
		print ('#							START OF TEST CASE                               ')
		print ('#****************************************************************************')
		
		for i in range (0,len(channelSizes)):					# for loop for channel sizes
			# Set the channel Size
			for cnt in range(0,len(TargetRadioIP)):
				STEP('COMMON:	Configure Channel Size on the Base Station\n\n')
				result = rad.setRadioChannelSize(TargetRadioIP[cnt], channelSizes[i])
				validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes[i],TargetRadioIP[cnt]), result, TESTCASE)
				result = ''
	
				print ('#****************************************************************************')
				STEP('COMMON:	Configure IP Data Compression Ratio on the radios\n\n')
				result = rad.setRadioDataCompresssion(TargetRadioIP[cnt], dataCompression)
				validateStep('Configure Data Compression on the Radio %s\n\n' %(TargetRadioIP[cnt]), result, TESTCASE)
				result = ''
	
				print ('#****************************************************************************')
				
				# Reboot the radio for the configuration to take effect
				STEP ("COMMON:	Reboot the DUT\n\n")
				result = maint.rebootRadio(TargetRadioIP[cnt], 1)
				validateStep('Reboot the radio %s after 5 secs' %TargetRadioIP[cnt] , result, TESTCASE)
				result = ''
		
			print ('#****************************************************************************')
			STEP ('Step 2:	Configure the serial ports on all radios\n\n')
			# Configure the serial port on Remote1
			for x in range(0,len(RemoteStation1IP)):
				# Configure the serial port on Remote
				result = srl.serialPortSetup (RemoteStation1IP[x],srlPortIndx_remote1, srlPrtCfgMode, mtuSize, baudRate, flowCtrl)
				validateStep('Configured the serial port on %s\n\n' %RemoteStation1IP[x], result, TESTCASE)
		
				result = ''
			
			print ('#****************************************************************************')
			for x in range(0,len(RemoteStation2IP)):
				# Configure the serial port on Remote2
				result = srl.serialPortSetup (RemoteStation2IP[x],srlPortIndx_remote2, srlPrtCfgMode, mtuSize, baudRate, flowCtrl)
				validateStep('Configured the serial port on %s\n\n' %RemoteStation2IP[x], result, TESTCASE)
		
				result = ''
			
			print ('#****************************************************************************')
			STEP ('Step 3: Configure the Serial Tester to match the baud rates as the DUT\n\n')
					
			# Set the Tx and Rx Address
			srlTester.setTxRxAddress (txAddress, rxAddress)
			
			# Set the traffic port settings
			srlTester.trafficPortsSettings (baudRate, bSize, stopBits, parity, rtscts, mtuSize, ifg, numPkts, xonxoff)
			
			# Set the traffic direction
			srlTester.setTrafficDirection(sender, receiver)
			
			# Set the tx and rx traffic pattern
			srlTester.setTxRxTrafficPattern(txPattern, rxPattern)
			
			# Set SMR Test Options
			srlTester.setSMRTest('on', 'off')
			
			#Set the txDelay to 10
			srlTester.send_command('tx delay, 100\r\n')
			
			print ('#****************************************************************************')
			STEP ('Step 4: Get the number Packets on the radio before sending traffic\n\n')
					
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_BT = packetCounts[0]
				remote1_Port_OutPkts_BT = packetCounts[1]
				remote1_Port_ErrPkts_BT = packetCounts[2]
				remote1_Port_DropPkts_BT = packetCounts[3]
				remote1_Port_DropFiltPkts_BT = packetCounts[4]
				remote1_Port_RfInPktsErr_BT = packetCounts[5]
				remote1_Port_RfOutDropPkts_BT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts BT:	%s' %remote1_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote1 Out Pkts BT:	%s' %remote1_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote1 Err Pkts BT:	%s' %remote1_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts BT:	%s' %remote1_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts BT:	%s' %remote1_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error BT:	%s' %remote1_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts BT:	%s' %remote1_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts BT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_BT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_BT = packetCounts[0]
				remote2_Port_OutPkts_BT = packetCounts[1]
				remote2_Port_ErrPkts_BT = packetCounts[2]
				remote2_Port_DropPkts_BT = packetCounts[3]
				remote2_Port_DropFiltPkts_BT = packetCounts[4]
				remote2_Port_RfInPktsErr_BT = packetCounts[5]
				remote2_Port_RfOutDropPkts_BT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts BT:	%s' %remote2_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote2 Out Pkts BT:	%s' %remote2_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote2 Err Pkts BT:	%s' %remote2_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts BT:	%s' %remote2_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts BT:	%s' %remote2_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error BT:	%s' %remote2_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts BT:	%s' %remote2_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts BT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_BT)
			
			result = ''
			print ('#****************************************************************************')
			STEP ('Step 5 : Send and verify serial traffic')
			
			result = srlTester.sendAndVerifySerialTraffic ()
			
			# Here Rx packets will be zero as there will not be a physical connection from Radio serial
			# port to the serial tester
			srlTesterPkts = result[2]
			srlTesterPkts = tuple(srlTesterPkts)
			txPackets = int(srlTesterPkts[0])
			rxPackets = int(srlTesterPkts[1])
			logFile(glob.DlogName, 'Serial Tx Packets : %s' %txPackets)
			logFile(glob.DlogName, 'Serial Rx Packets : %s' %rxPackets)
				
			result = ''
			
			print ('#****************************************************************************')
			STEP ('Step 6: Get the number Packets on the radio after sending traffic\n\n')
					
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_AT = packetCounts[0]
				remote1_Port_OutPkts_AT = packetCounts[1]
				remote1_Port_ErrPkts_AT = packetCounts[2]
				remote1_Port_DropPkts_AT = packetCounts[3]
				remote1_Port_DropFiltPkts_AT = packetCounts[4]
				remote1_Port_RfInPktsErr_AT = packetCounts[5]
				remote1_Port_RfOutDropPkts_AT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts AT:	%s' %remote1_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote1 Out Pkts AT:	%s' %remote1_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote1 Err Pkts AT:	%s' %remote1_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts AT:	%s' %remote1_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts AT:	%s' %remote1_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error AT:	%s' %remote1_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts AT:	%s' %remote1_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts AT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_AT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_AT = packetCounts[0]
				remote2_Port_OutPkts_AT = packetCounts[1]
				remote2_Port_ErrPkts_AT = packetCounts[2]
				remote2_Port_DropPkts_AT = packetCounts[3]
				remote2_Port_DropFiltPkts_AT = packetCounts[4]
				remote2_Port_RfInPktsErr_AT = packetCounts[5]
				remote2_Port_RfOutDropPkts_AT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts AT:	%s' %remote2_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote2 Out Pkts AT:	%s' %remote2_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote2 Err Pkts AT:	%s' %remote2_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts AT:	%s' %remote2_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts AT:	%s' %remote2_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error AT:	%s' %remote2_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts AT:	%s' %remote2_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts AT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_AT)
				
				
			remote1_RxPackets = remote1_Port_InPkts_AT - remote1_Port_InPkts_BT
			remote1_DropPkts = remote1_Port_DropPkts_AT - remote1_Port_DropPkts_BT
			remote1_DropFiltPkts = remote1_Port_DropFiltPkts_AT - remote1_Port_DropFiltPkts_BT
			remote1_RfOutDropPkts = remote1_Port_RfOutDropPkts_AT - remote1_Port_RfOutDropPkts_BT
			
			remote2_TxPackets = remote2_Port_OutPkts_AT - remote2_Port_OutPkts_BT
			remote2_ErrPackets = remote2_Port_ErrPkts_AT - remote2_Port_ErrPkts_BT
			remote2_RfInPktsErr = remote2_Port_RfInPktsErr_AT - remote2_Port_RfInPktsErr_BT
			remote2_RfInDropFiltPkts = remote2_Port_RfInDropFiltPkts_AT - remote2_Port_RfInDropFiltPkts_BT
			
			result = ''
			res = []
			# Verify the results
			if ((remote1_RxPackets == remote2_TxPackets) and (remote1_RxPackets == txPackets) and (remote2_ErrPackets == 0)):
				res.append(True)
				res.append('Traffic Sent from Remote1 is Received on Remote2 Station\n')
			else:
				print ('Failed')
				res.append(False)
				res.append('Traffic Sent from Remote1 is not Received on Remote2 Station\n')
			
			validateStep('Verified Traffic on the radios\n\n', res, TESTCASE)
			
			print ('#****************************************************************************')
			STEP ('Step 7: Change the traffic direction and collect stats on the radios before sending traffic')
			
			srlTester.setTrafficDirection(receiver, sender)
			
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_BT = packetCounts[0]
				remote1_Port_OutPkts_BT = packetCounts[1]
				remote1_Port_ErrPkts_BT = packetCounts[2]
				remote1_Port_DropPkts_BT = packetCounts[3]
				remote1_Port_DropFiltPkts_BT = packetCounts[4]
				remote1_Port_RfInPktsErr_BT = packetCounts[5]
				remote1_Port_RfOutDropPkts_BT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts BT:	%s' %remote1_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote1 Out Pkts BT:	%s' %remote1_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote1 Err Pkts BT:	%s' %remote1_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts BT:	%s' %remote1_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts BT:	%s' %remote1_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error BT:	%s' %remote1_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts BT:	%s' %remote1_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts BT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_BT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_BT = packetCounts[0]
				remote2_Port_OutPkts_BT = packetCounts[1]
				remote2_Port_ErrPkts_BT = packetCounts[2]
				remote2_Port_DropPkts_BT = packetCounts[3]
				remote2_Port_DropFiltPkts_BT = packetCounts[4]
				remote2_Port_RfInPktsErr_BT = packetCounts[5]
				remote2_Port_RfOutDropPkts_BT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts BT:	%s' %remote2_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote2 Out Pkts BT:	%s' %remote2_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote2 Err Pkts BT:	%s' %remote2_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts BT:	%s' %remote2_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts BT:	%s' %remote2_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error BT:	%s' %remote2_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts BT:	%s' %remote2_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts BT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_BT)
			
			result = ''
			print ('#****************************************************************************')
			STEP ('Step 8 : Send and verify serial traffic')
			
			result = srlTester.sendAndVerifySerialTraffic ()
			
			# Here Rx packets will be zero as there will not be a physical connection from Radio serial
			# port to the serial tester
			srlTesterPkts = result[2]
			srlTesterPkts = tuple(srlTesterPkts)
			txPackets = int(srlTesterPkts[0])
			rxPackets = int(srlTesterPkts[1])
			logFile(glob.DlogName, 'Serial Tx Packets : %s' %txPackets)
			logFile(glob.DlogName, 'Serial Rx Packets : %s' %rxPackets)
				
			result = ''
			
			print ('#****************************************************************************')
			STEP ('Step 9: Get the number Packets on the radio before sending traffic\n\n')
					
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_AT = packetCounts[0]
				remote1_Port_OutPkts_AT = packetCounts[1]
				remote1_Port_ErrPkts_AT = packetCounts[2]
				remote1_Port_DropPkts_AT = packetCounts[3]
				remote1_Port_DropFiltPkts_AT = packetCounts[4]
				remote1_Port_RfInPktsErr_AT = packetCounts[5]
				remote1_Port_RfOutDropPkts_AT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts AT:	%s' %remote1_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote1 Out Pkts AT:	%s' %remote1_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote1 Err Pkts AT:	%s' %remote1_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts AT:	%s' %remote1_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts AT:	%s' %remote1_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error AT:	%s' %remote1_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts AT:	%s' %remote1_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts AT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_AT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_AT = packetCounts[0]
				remote2_Port_OutPkts_AT = packetCounts[1]
				remote2_Port_ErrPkts_AT = packetCounts[2]
				remote2_Port_DropPkts_AT = packetCounts[3]
				remote2_Port_DropFiltPkts_AT = packetCounts[4]
				remote2_Port_RfInPktsErr_AT = packetCounts[5]
				remote2_Port_RfOutDropPkts_AT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts AT:	%s' %remote2_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote2 Out Pkts AT:	%s' %remote2_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote2 Err Pkts AT:	%s' %remote2_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts AT:	%s' %remote2_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts AT:	%s' %remote2_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error AT:	%s' %remote2_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts AT:	%s' %remote2_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts AT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_AT)
				
				
			remote2_RxPackets = remote2_Port_InPkts_AT - remote2_Port_InPkts_BT
			remote2_DropPkts = remote2_Port_DropPkts_AT - remote2_Port_DropPkts_BT
			remote2_DropFiltPkts = remote2_Port_DropFiltPkts_AT - remote2_Port_DropFiltPkts_BT
			remote2_RfOutDropPkts = remote2_Port_RfOutDropPkts_AT - remote2_Port_RfOutDropPkts_BT
			
			remote1_TxPackets = remote1_Port_OutPkts_AT - remote1_Port_OutPkts_BT
			remote1_ErrPackets = remote1_Port_ErrPkts_AT - remote1_Port_ErrPkts_BT
			remote1_RfInPktsErr = remote1_Port_RfInPktsErr_AT - remote1_Port_RfInPktsErr_BT
			remote1_RfInDropFiltPkts = remote1_Port_RfInDropFiltPkts_AT - remote1_Port_RfInDropFiltPkts_BT
			
			result = ''
			res = []
			# Verify the results
			if ((remote2_RxPackets == remote1_TxPackets) and (remote2_RxPackets == txPackets) and (remote1_ErrPackets == 0)):
				res.append(True)
				res.append('Traffic Sent from Remote2 is Received on Remote1 Station\n')
			else:
				print ('Failed')
				res.append(False)
				res.append('Traffic Sent from Remote2 is not Received on Remote1 Station\n')
			
			validateStep('Verified Traffic on the radios\n\n', res, TESTCASE)
			
			result = ''
			
			print ('#****************************************************************************')
			STEP ('Step 10:	Configure the Packet Filtering as Automatic')
			
			packetFiltering = 1
			for cnt in range(0,len(TargetRadioIP)):
				
				STEP ('COMMON: Configure the Data Stream Mode and Packet Filtering on all radios\n\n')
				result = rad.setSerialDataStream (TargetRadioIP[i], streamMode, packetFiltering)
				validateStep('Configured the Data Stream Mode and Packet Filtering on %s\n\n' %TargetRadioIP[i], result, TESTCASE)
	
				result = ''
				
			print ('#****************************************************************************')
			STEP ('Step 11: Get the number Packets on the radio before sending traffic\n\n')
					
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_BT = packetCounts[0]
				remote1_Port_OutPkts_BT = packetCounts[1]
				remote1_Port_ErrPkts_BT = packetCounts[2]
				remote1_Port_DropPkts_BT = packetCounts[3]
				remote1_Port_DropFiltPkts_BT = packetCounts[4]
				remote1_Port_RfInPktsErr_BT = packetCounts[5]
				remote1_Port_RfOutDropPkts_BT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts BT:	%s' %remote1_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote1 Out Pkts BT:	%s' %remote1_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote1 Err Pkts BT:	%s' %remote1_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts BT:	%s' %remote1_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts BT:	%s' %remote1_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error BT:	%s' %remote1_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts BT:	%s' %remote1_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts BT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_BT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_BT = packetCounts[0]
				remote2_Port_OutPkts_BT = packetCounts[1]
				remote2_Port_ErrPkts_BT = packetCounts[2]
				remote2_Port_DropPkts_BT = packetCounts[3]
				remote2_Port_DropFiltPkts_BT = packetCounts[4]
				remote2_Port_RfInPktsErr_BT = packetCounts[5]
				remote2_Port_RfOutDropPkts_BT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts BT:	%s' %remote2_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote2 Out Pkts BT:	%s' %remote2_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote2 Err Pkts BT:	%s' %remote2_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts BT:	%s' %remote2_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts BT:	%s' %remote2_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error BT:	%s' %remote2_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts BT:	%s' %remote2_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts BT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_BT)
			
			result = ''
			print ('#****************************************************************************')
			STEP ('Step 12 : Send and verify serial traffic')
			
			srlTester.setTrafficDirection(sender, receiver)
			
			result = srlTester.sendAndVerifySerialTraffic ()
			
			# Here Rx packets will be zero as there will not be a physical connection from Radio serial
			# port to the serial tester
			srlTesterPkts = result[2]
			srlTesterPkts = tuple(srlTesterPkts)
			txPackets = int(srlTesterPkts[0])
			rxPackets = int(srlTesterPkts[1])
			logFile(glob.DlogName, 'Serial Tx Packets : %s' %txPackets)
			logFile(glob.DlogName, 'Serial Rx Packets : %s' %rxPackets)
				
			result = ''
			
			print ('#****************************************************************************')
			STEP ('Step 13: Get the number Packets on the radio after sending traffic\n\n')
					
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_AT = packetCounts[0]
				remote1_Port_OutPkts_AT = packetCounts[1]
				remote1_Port_ErrPkts_AT = packetCounts[2]
				remote1_Port_DropPkts_AT = packetCounts[3]
				remote1_Port_DropFiltPkts_AT = packetCounts[4]
				remote1_Port_RfInPktsErr_AT = packetCounts[5]
				remote1_Port_RfOutDropPkts_AT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts AT:	%s' %remote1_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote1 Out Pkts AT:	%s' %remote1_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote1 Err Pkts AT:	%s' %remote1_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts AT:	%s' %remote1_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts AT:	%s' %remote1_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error AT:	%s' %remote1_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts AT:	%s' %remote1_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts AT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_AT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_AT = packetCounts[0]
				remote2_Port_OutPkts_AT = packetCounts[1]
				remote2_Port_ErrPkts_AT = packetCounts[2]
				remote2_Port_DropPkts_AT = packetCounts[3]
				remote2_Port_DropFiltPkts_AT = packetCounts[4]
				remote2_Port_RfInPktsErr_AT = packetCounts[5]
				remote2_Port_RfOutDropPkts_AT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts AT:	%s' %remote2_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote2 Out Pkts AT:	%s' %remote2_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote2 Err Pkts AT:	%s' %remote2_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts AT:	%s' %remote2_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts AT:	%s' %remote2_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error AT:	%s' %remote2_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts AT:	%s' %remote2_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts AT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_AT)
				
				
			remote1_RxPackets = remote1_Port_InPkts_AT - remote1_Port_InPkts_BT
			remote1_DropPkts = remote1_Port_DropPkts_AT - remote1_Port_DropPkts_BT
			remote1_DropFiltPkts = remote1_Port_DropFiltPkts_AT - remote1_Port_DropFiltPkts_BT
			remote1_RfOutDropPkts = remote1_Port_RfOutDropPkts_AT - remote1_Port_RfOutDropPkts_BT
			
			remote2_TxPackets = remote2_Port_OutPkts_AT - remote2_Port_OutPkts_BT
			remote2_ErrPackets = remote2_Port_ErrPkts_AT - remote2_Port_ErrPkts_BT
			remote2_RfInPktsErr = remote2_Port_RfInPktsErr_AT - remote2_Port_RfInPktsErr_BT
			remote2_RfInDropFiltPkts = remote2_Port_RfInDropFiltPkts_AT - remote2_Port_RfInDropFiltPkts_BT
			
			result = ''
			res = []
			# Verify the results
			if ((remote2_TxPackets == 0) and (remote1_RxPackets == txPackets)):
				res.append(True)
				res.append('Traffic Sent from Remote1 is not Received on Remote2 Station - Expected\n')
			else:
				print ('Failed')
				res.append(False)
				res.append('Traffic Sent from Remote1 is Received on Remote2 Station - Not Expected\n')
			
			validateStep('Verified Traffic on the radios\n\n', res, TESTCASE)
			
			print ('#****************************************************************************')
			STEP ('Step 14: Change the traffic direction and collect stats on the radios before sending traffic')
			
			srlTester.setTrafficDirection(receiver, sender)
			
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_BT = packetCounts[0]
				remote1_Port_OutPkts_BT = packetCounts[1]
				remote1_Port_ErrPkts_BT = packetCounts[2]
				remote1_Port_DropPkts_BT = packetCounts[3]
				remote1_Port_DropFiltPkts_BT = packetCounts[4]
				remote1_Port_RfInPktsErr_BT = packetCounts[5]
				remote1_Port_RfOutDropPkts_BT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts BT:	%s' %remote1_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote1 Out Pkts BT:	%s' %remote1_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote1 Err Pkts BT:	%s' %remote1_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts BT:	%s' %remote1_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts BT:	%s' %remote1_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error BT:	%s' %remote1_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts BT:	%s' %remote1_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts BT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_BT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_BT = packetCounts[0]
				remote2_Port_OutPkts_BT = packetCounts[1]
				remote2_Port_ErrPkts_BT = packetCounts[2]
				remote2_Port_DropPkts_BT = packetCounts[3]
				remote2_Port_DropFiltPkts_BT = packetCounts[4]
				remote2_Port_RfInPktsErr_BT = packetCounts[5]
				remote2_Port_RfOutDropPkts_BT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_BT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts BT:	%s' %remote2_Port_InPkts_BT)
				logFile(glob.DlogName, 'Remote2 Out Pkts BT:	%s' %remote2_Port_OutPkts_BT)
				logFile(glob.DlogName, 'Remote2 Err Pkts BT:	%s' %remote2_Port_ErrPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts BT:	%s' %remote2_Port_DropPkts_BT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts BT:	%s' %remote2_Port_DropFiltPkts_BT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error BT:	%s' %remote2_Port_RfInPktsErr_BT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts BT:	%s' %remote2_Port_RfOutDropPkts_BT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts BT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_BT)
			
			result = ''
			print ('#****************************************************************************')
			STEP ('Step 15 : Send and verify serial traffic')
			
			result = srlTester.sendAndVerifySerialTraffic ()
			
			# Here Rx packets will be zero as there will not be a physical connection from Radio serial
			# port to the serial tester
			srlTesterPkts = result[2]
			srlTesterPkts = tuple(srlTesterPkts)
			txPackets = int(srlTesterPkts[0])
			rxPackets = int(srlTesterPkts[1])
			logFile(glob.DlogName, 'Serial Tx Packets : %s' %txPackets)
			logFile(glob.DlogName, 'Serial Rx Packets : %s' %rxPackets)
				
			result = ''
			
			print ('#****************************************************************************')
			STEP ('Step 16: Get the number Packets on the radio before sending traffic\n\n')
					
			# Get the number of packets on the remote1 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote1IP, srlPortNum_remote1)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote1IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote1_Port_InPkts_AT = packetCounts[0]
				remote1_Port_OutPkts_AT = packetCounts[1]
				remote1_Port_ErrPkts_AT = packetCounts[2]
				remote1_Port_DropPkts_AT = packetCounts[3]
				remote1_Port_DropFiltPkts_AT = packetCounts[4]
				remote1_Port_RfInPktsErr_AT = packetCounts[5]
				remote1_Port_RfOutDropPkts_AT = packetCounts[6]
				remote1_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote1 In Pkts AT:	%s' %remote1_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote1 Out Pkts AT:	%s' %remote1_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote1 Err Pkts AT:	%s' %remote1_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Pkts AT:	%s' %remote1_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote1 Drop Filtered Pkts AT:	%s' %remote1_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote1 RF In Pkts Error AT:	%s' %remote1_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote1 RF Out Drop Pkts AT:	%s' %remote1_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote1 In Drop Filtered Pkts AT:	%s\n\n' %remote1_Port_RfInDropFiltPkts_AT)
			
			result = ''
			
			# Get the number of packets on the remote2 radio before sending traffic
			result = mon.getSerialPortTxRxPkts (TargetRemote2IP, srlPortNum_remote2)
			validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemote2IP, result, TESTCASE)
			if (result[0]):
				# Then collect all the values
				packetCounts = result[2]
				remote2_Port_InPkts_AT = packetCounts[0]
				remote2_Port_OutPkts_AT = packetCounts[1]
				remote2_Port_ErrPkts_AT = packetCounts[2]
				remote2_Port_DropPkts_AT = packetCounts[3]
				remote2_Port_DropFiltPkts_AT = packetCounts[4]
				remote2_Port_RfInPktsErr_AT = packetCounts[5]
				remote2_Port_RfOutDropPkts_AT = packetCounts[6]
				remote2_Port_RfInDropFiltPkts_AT = packetCounts[7]
				
				logFile(glob.DlogName, 'Remote2 In Pkts AT:	%s' %remote2_Port_InPkts_AT)
				logFile(glob.DlogName, 'Remote2 Out Pkts AT:	%s' %remote2_Port_OutPkts_AT)
				logFile(glob.DlogName, 'Remote2 Err Pkts AT:	%s' %remote2_Port_ErrPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Pkts AT:	%s' %remote2_Port_DropPkts_AT)
				logFile(glob.DlogName, 'Remote2 Drop Filtered Pkts AT:	%s' %remote2_Port_DropFiltPkts_AT)
				logFile(glob.DlogName, 'Remote2 RF In Pkts Error AT:	%s' %remote2_Port_RfInPktsErr_AT)
				logFile(glob.DlogName, 'Remote2 RF Out Drop Pkts AT:	%s' %remote2_Port_RfOutDropPkts_AT)
				logFile(glob.DlogName, 'Remote2 In Drop Filtered Pkts AT:	%s\n\n' %remote2_Port_RfInDropFiltPkts_AT)
				
				
			remote2_RxPackets = remote2_Port_InPkts_AT - remote2_Port_InPkts_BT
			remote2_DropPkts = remote2_Port_DropPkts_AT - remote2_Port_DropPkts_BT
			remote2_DropFiltPkts = remote2_Port_DropFiltPkts_AT - remote2_Port_DropFiltPkts_BT
			remote2_RfOutDropPkts = remote2_Port_RfOutDropPkts_AT - remote2_Port_RfOutDropPkts_BT
			
			remote1_TxPackets = remote1_Port_OutPkts_AT - remote1_Port_OutPkts_BT
			remote1_ErrPackets = remote1_Port_ErrPkts_AT - remote1_Port_ErrPkts_BT
			remote1_RfInPktsErr = remote1_Port_RfInPktsErr_AT - remote1_Port_RfInPktsErr_BT
			remote1_RfInDropFiltPkts = remote1_Port_RfInDropFiltPkts_AT - remote1_Port_RfInDropFiltPkts_BT
			
			result = ''
			res = []
			# Verify the results
			if ((remote1_TxPackets == 0) and (remote2_RxPackets == txPackets)):
				res.append(True)
				res.append('Traffic Sent from Remote2 is not Received on Remote1 Station - Expected\n')
			else:
				print ('Failed')
				res.append(False)
				res.append('Traffic Sent from Remote2 is Received on Remote1 Station - Not Expected\n')
			
			validateStep('Verified Traffic on the radios\n\n', res, TESTCASE)
			
			result = ''
			
			print ('#****************************************************************************')
			
	except TestException:
		testResult = 'FAIL'
		pass
	else:
		testResult = 'PASS'
			
	finally:
		
		print ('\n#****************************************************************************')
		print ('#							CLEANUP SECTION		                             ')
		print ('#****************************************************************************')
		srlTester.close()
		# for i in range (0,len(TargetRadioIP)):
			# # ******************************************************************
			# STEP ('CLEANUP:	Restore the DUTs to User Defaults\n\n')
			
			# result = maint.restoreUserDefaults (TargetRadioIP[i], 1)
			# validateStep('Restoring User Defaults on %s\n\n' %TargetRadioIP[i], result, TESTCASE)
			
			# result = ''
	print ('#****************************************************************************')
	print ('#					END OF TEST CASE                                         ')
	print ('#****************************************************************************')
	finish (t1, TESTCASE, testResult)
def TFS_Serial_004 ():
	try:
		#**********************************************************************
		#		VARIABLE DECLARATION AND DEFINITIONS
		#**********************************************************************
		
		# log current time
		t1 = time.localtime()
		testResult = ''
		result = ''
		TESTCASE = 'Serial_004'
		glob.testDesc = 'Verify the parity none, odd and even on the serial ports'
		# Define the variables to be used in the test case
		TargetRadioIP = []	
		BaseStationIP = glob.Configs['BaseStationRadioIP'].strip().split(',')
		TargetBaseIP = glob.Configs['BaseStationVirtualIP'] 
		RepeaterStationIP = glob.Configs['RepeaterStationRadioIP'].strip().split(',')
		RemoteStationIP = glob.Configs['RemoteStationRadioIP'].strip().split(',')
		TargetRemoteIP = glob.Configs['RemoteStationVirtualIP']
		# TargetRadioIP = BaseStationIP + RepeaterStationIP + RemoteStationIP		# list of all radio to be configured
		TargetRadioIP = TargetRadioIP + BaseStationIP
		TargetRadioIP = TargetRadioIP + RepeaterStationIP
		TargetRadioIP = TargetRadioIP + RemoteStationIP
		
		srlPortIndx_base = glob.Configs['BaseSerialPortIndex']
		srlPortIndx_remote = glob.Configs['RemoteSerialPortIndex']
		
		srlPortNum_base = int (glob.Configs['BaseSerialPortNumber'])
		srlPortNum_remote = int(glob.Configs['RemoteSerialPortNumber'])
		
		channelSizes = [4]	# This defines channel sizes as 12.5, 25 and 50 respectively
		parityList = [0, 1, 2]
		
		# channelSizes = [2]	# This defines channel sizes as 12.5, 25 and 50 respectively
		# parityList = [0]
		
		
		baudRate = 115200
		
		# srlPortIndx = 1
		txFrequency = 950056250
		rxFrequency = 950093750
		txFrequency_rptr = 950093750
		rxFrequency_rptr = 950056250
		nwRadius = 2
		nwProximity = 2 			# Overlapping Mode
		rptNwSeg = 12
		nwTrafficType = 0			# user defined mode
		defaultTtl = 0
		serialTtl = 0
		# srlPortNum = 1			# denotes the serial port number
		srlPrtCfgMode = 1
		flowCtrl = 1				# sets the flow control to CTS-RTS
		mtuSize = 512
		baseTermOpMode = 1			# sets operMOde as Base
		rptrTermOpMode = 2			# sets operMode as Repeater
		remoteOperMode = 3			# sets operMode as Remote
		etherMode = 1
		
		# Serial Tester Variables
		txAddress = rxAddress = 3	# sets the tx and rx address
		txPattern = rxPattern = 'prbs15'
		sender = 1
		receiver = 2
		stopBits = 1
		bSize = 8
		parity = 'None'
		rtscts = 'ON'
		port = glob.Configs['SerialTesterPort']
		ifg = 35
		numPkts = 50
		xonxoff = 'ON'
		srlTester = serialTester(port)

		base_Port1_InPkts_BT = 0
		base_Port1_OutPkts_BT = 0
		base_Port1_ErrPkts_BT = 0
		base_Port1_DropPkts_BT = 0
		base_Port1_DropFiltPkts_BT = 0
		base_Port1_RfInPktsErr_BT = 0
		base_Port1_RfOutDropPkts_BT = 0
		base_Port1_RfInDropFiltPkts_BT = 0

		base_Port1_InPkts_AT = 0
		base_Port1_OutPkts_AT = 0
		base_Port1_ErrPkts_AT = 0
		base_Port1_DropPkts_BT = 0
		base_Port1_DropFiltPkts_AT = 0
		base_Port1_RfInPktsErr_AT = 0
		base_Port1_RfOutDropPkts_AT = 0
		base_Port1_RfInDropFiltPkts_AT = 0
		

		remote_Port1_InPkts_BT = 0
		remote_Port1_OutPkts_BT = 0
		remote_Port1_ErrPkts_BT = 0
		remote_Port1_DropPkts_BT = 0
		remote_Port1_DropFiltPkts_BT = 0
		remote_Port1_RfInPktsErr_BT = 0
		remote_Port1_RfOutDropPkts_BT = 0
		remote_Port1_RfInDropFiltPkts_BT = 0

		remote_Port1_InPkts_AT = 0
		remote_Port1_OutPkts_AT = 0
		remote_Port1_ErrPkts_AT = 0
		remote_Port1_DropPkts_BT = 0
		remote_Port1_DropFiltPkts_AT = 0
		remote_Port1_RfInPktsErr_AT = 0
		remote_Port1_RfOutDropPkts_AT = 0
		remote_Port1_RfInDropFiltPkts_AT = 0
		
		base_TxPackets = 0
		base_RxPackets = 0
		base_ErrPackets = 0
		base_DropPkts = 0
		base_DropFiltPkts = 0
		base_RfInPktsErr = 0
		base_RfOutDropPkts = 0
		base_RfInDropFiltPkts = 0
		
		remote_TxPackets = 0
		remote_RxPackets = 0
		remote_ErrPackets = 0
		remote_DropPkts = 0
		remote_DropFiltPkts = 0
		remote_RfInPktsErr = 0
		remote_RfOutDropPkts = 0
		remote_RfInDropFiltPkts = 0

		#**********************************************************************
		#		END OF VARIABLE DECLARATION AND DEFINITIONS
		#**********************************************************************
		
		# Log Test Case Header
		print('TESTCASE #   %s\n' %TESTCASE)
		glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"
		
		logFile(glob.DlogName,"===============================================================\n")
		logFile(glob.DlogName,"TESTCASE %s\n\n"%TESTCASE)

		print ('#****************************************************************************')
		print ('#							COMMON TEST SETUP                                ')
		print ('#****************************************************************************')
		print ('COMMON:	Configure DUT1  & DUT2 PIPS Radio as Base Station\n\n')
		
		
		for i in range(0,len(BaseStationIP)):
			STEP('COMMON:	Configure PIPS Radio as Base Station\n\n')
			result = term.setTerminalOperMode(BaseStationIP[i], baseTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Base Station\n\n' %BaseStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(BaseStationIP[i], nwRadius, nwProximity)
			validateStep('Set Network Radius and Network Proximity on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			result = rad.setTxSettings (BaseStationIP[i], txFrequency)
			validateStep('Set the Tx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (BaseStationIP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(BaseStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %BaseStationIP[i] , result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		for i in range(0,len(RepeaterStationIP)):
			STEP('COMMON:	Configure PIPS Radio as Repeater Station\n\n')
			result = term.setTerminalOperMode(RepeaterStationIP[i], rptrTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Repeater Station\n\n' %RepeaterStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RepeaterStationIP[i], nwRadius, nwProximity, rptNwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			result = rad.setTxSettings (RepeaterStationIP[i], txFrequency_rptr)
			validateStep('Set the Tx Frequency on radio %s' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RepeaterStationIP[i], rxFrequency_rptr)
			validateStep('Set the Rx Frequency on radio %s' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RepeaterStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RepeaterStationIP[i] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		for i in range(0,len(RemoteStationIP)):
			STEP('COMMON:	Configure Radio as Remote Station\n\n')
			result = term.setTerminalOperMode(RemoteStationIP[i], remoteOperMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Remote Station\n\n' %RemoteStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RemoteStationIP[i], nwRadius, nwProximity, rptNwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			result = rad.setTxSettings (RemoteStationIP[i], txFrequency)
			validateStep('Set the Tx Frequency on radio %s' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RemoteStationIP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RemoteStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RemoteStationIP[i] , result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		
		# The following configurations are done on the base, repeater and remote radios
		
		for i in range (0,len(TargetRadioIP)):
						
			STEP ('COMMON: Configure the network traffic type as userdefined on all radios\n\n')
			result = rad.setRadioTrafficSettings(TargetRadioIP[i], nwTrafficType)
			validateStep('Set the Network Traffic Type on radio %s' %TargetRadioIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the Serial TTL to 0 on all radios\n\n')
			
			result = rad.setRadioAdvancedSettings (TargetRadioIP[i], defaultTtl, serialTtl)
			validateStep('Set the serial TTL to 0 on radio %s' %TargetRadioIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			
			
		print ('#****************************************************************************')
		print ('#							START OF TEST CASE                               ')
		print ('#****************************************************************************')

		# The following steps should be repeated for different channel sizes and different baud rates

		for i in range (0,len(channelSizes)):					# for loop for channel sizes
			# Set the channel Size
			for cnt in range(0,len(BaseStationIP)):
				STEP('COMMON:	Configure Channel Size on the Base Station\n\n')
				result = rad.setRadioChannelSize(BaseStationIP[cnt], channelSizes[i])
				validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes[i],BaseStationIP[cnt]), result, TESTCASE)
				result = ''
				
				# Reboot the radio for the configuration to take effect
				STEP ("COMMON:	Reboot the DUT\n\n")
				result = maint.rebootRadio(BaseStationIP[cnt], 1)
				validateStep('Reboot the radio %s after 5 secs' %BaseStationIP[cnt] , result, TESTCASE)
				result = ''
		
			print ('#****************************************************************************')
			for cnt in range(0,len(RepeaterStationIP)):
				STEP('COMMON:	Configure Channel Size on the Repeater Station\n\n')
				result = rad.setRadioChannelSize(RepeaterStationIP[cnt], channelSizes[i])
				validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes[i], RepeaterStationIP[cnt]), result, TESTCASE)
				result = ''
				
				# Reboot the radio for the configuration to take effect
				STEP ("COMMON:	Reboot the DUT\n\n")
				result = maint.rebootRadio(RepeaterStationIP[cnt], 1)
				validateStep('Reboot the radio %s after 5 secs' %RepeaterStationIP[cnt] , result, TESTCASE)
				result = ''
				
			print ('#****************************************************************************')
			for cnt in range(0,len(RemoteStationIP)):
				STEP('COMMON:	Configure Channel Size on Remote Station\n\n')
				result = rad.setRadioChannelSize(RemoteStationIP[cnt], channelSizes[i])
				validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes[i], RemoteStationIP[cnt]), result, TESTCASE)
				result = ''
				
				# Reboot the radio for the configuration to take effect
				STEP ("COMMON:	Reboot the DUT\n\n")
				result = maint.rebootRadio(RemoteStationIP[cnt], 1)
				validateStep('Reboot the radio %s after 5 secs' %RemoteStationIP[cnt], result, TESTCASE)
				result = ''
			
			print ('#****************************************************************************')
			
			for j in range (0,len(parityList)):					# for loop for baud rates
				logFile(glob.DlogName,"****************************************************************************\n")
				logFile(glob.DlogName,"For Channel Size %s, and Baud Rate set to %s\n" %(channelSizes[i], parityList[j]))
				logFile(glob.DlogName,"****************************************************************************\n")
				
				STEP ('Step 2:	Configure the serial ports on all radios\n\n')
				# configuring the serial ports on base radio
				for x in range(0,len(BaseStationIP)):			# for loop for base station radios
					result = srl.serialPortSetup (BaseStationIP[x],srlPortIndx_base, srlPrtCfgMode, mtuSize, baudRate, flowCtrl, bSize, parityList[j])
					validateStep('Configured the serial port on %s\n\n' %BaseStationIP[x], result, TESTCASE)
            
					result = ''
					
				for x in range(0,len(RemoteStationIP)):
					# Configure the serial port on Remote
					result = srl.serialPortSetup (RemoteStationIP[x],srlPortIndx_remote, srlPrtCfgMode, mtuSize, baudRate, flowCtrl, bSize, parityList[j])
					validateStep('Configured the serial port on %s\n\n' %RemoteStationIP[x], result, TESTCASE)
		
					result = ''
				
				print ('#****************************************************************************')
				STEP ('Step 3: Configure the Serial Tester to match the baud rates as the DUT\n\n')
				
				# Set the Tx and Rx Address
				srlTester.setTxRxAddress (txAddress, rxAddress)
				
				if (parityList[j] == 0):
					parity = 'none'
				elif (parityList[j] == 1):
					parity = 'even'
				else:
					parity = 'odd'
				# Set the traffic port settings
				srlTester.trafficPortsSettings (baudRate, bSize, stopBits, parity, rtscts, mtuSize, ifg, numPkts, xonxoff)
				
				# Set the traffic direction
				srlTester.setTrafficDirection(sender, receiver)
				
				# Set the tx and rx traffic pattern
				srlTester.setTxRxTrafficPattern(txPattern, rxPattern)
				
				# Set SMR Test Options
				srlTester.setSMRTest('on', 'off')
				
				#Set the txDelay to 10
				srlTester.send_command('tx delay, 30\r\n')
				
				print ('#****************************************************************************')
				STEP ('Step 3a: Get the number Packets on the radio before sending traffic\n\n')
				
				# Get the number of packets on the remote radio before sending traffic
				result = mon.getSerialPortTxRxPkts (TargetRemoteIP, srlPortNum_remote)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemoteIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					remote_Port1_InPkts_BT = packetCounts[0]
					remote_Port1_OutPkts_BT = packetCounts[1]
					remote_Port1_ErrPkts_BT = packetCounts[2]
					remote_Port1_DropPkts_BT = packetCounts[3]
					remote_Port1_DropFiltPkts_BT = packetCounts[4]
					remote_Port1_RfInPktsErr_BT = packetCounts[5]
					remote_Port1_RfOutDropPkts_BT = packetCounts[6]
					remote_Port1_RfInDropFiltPkts_BT = packetCounts[7]
					
					logFile(glob.DlogName, 'Remote In Pkts BT:	%s' %remote_Port1_InPkts_BT)
					logFile(glob.DlogName, 'Remote Out Pkts BT:	%s' %remote_Port1_OutPkts_BT)
					logFile(glob.DlogName, 'Remote Err Pkts BT:	%s' %remote_Port1_ErrPkts_BT)
					logFile(glob.DlogName, 'Remote Drop Pkts BT:	%s' %remote_Port1_DropPkts_BT)
					logFile(glob.DlogName, 'Remote Drop Filtered Pkts BT:	%s' %remote_Port1_DropFiltPkts_BT)
					logFile(glob.DlogName, 'Remote RF In Pkts Error BT:	%s' %remote_Port1_RfInPktsErr_BT)
					logFile(glob.DlogName, 'Remote RF Out Drop Pkts BT:	%s' %remote_Port1_RfOutDropPkts_BT)
					logFile(glob.DlogName, 'Remote In Drop Filtered Pkts BT:	%s\n\n' %remote_Port1_RfInDropFiltPkts_BT)
					
				
				result = ''	
				
				# Get the number of packets on the base radio before sending traffic
				result = mon.getSerialPortTxRxPkts (TargetBaseIP, srlPortNum_base)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					base_Port1_InPkts_BT = packetCounts[0]
					base_Port1_OutPkts_BT = packetCounts[1]
					base_Port1_ErrPkts_BT = packetCounts[2]
					base_Port1_DropPkts_BT = packetCounts[3]
					base_Port1_DropFiltPkts_BT = packetCounts[4]
					base_Port1_RfInPktsErr_BT = packetCounts[5]
					base_Port1_RfOutDropPkts_BT = packetCounts[6]
					base_Port1_RfInDropFiltPkts_BT = packetCounts[7]
					
					logFile(glob.DlogName, 'Base In Pkts BT:	%s' %base_Port1_InPkts_BT)
					logFile(glob.DlogName, 'Base Out Pkts BT:	%s' %base_Port1_OutPkts_BT)
					logFile(glob.DlogName, 'Base Err Pkts BT:	%s' %base_Port1_ErrPkts_BT)
					logFile(glob.DlogName, 'Base Drop Pkts BT:	%s' %base_Port1_DropPkts_BT)
					logFile(glob.DlogName, 'Base Drop Filtered Pkts BT:	%s' %base_Port1_DropFiltPkts_BT)
					logFile(glob.DlogName, 'Base RF In Pkts Error BT:	%s' %base_Port1_RfInPktsErr_BT)
					logFile(glob.DlogName, 'Base RF Out Drop Pkts BT:	%s' %base_Port1_RfOutDropPkts_BT)
					logFile(glob.DlogName, 'Base In Drop Filtered Pkts BT:	%s\n\n' %base_Port1_RfInDropFiltPkts_BT)
				
				result = ''
				
				print ('#****************************************************************************')
				STEP ('Step 4 : Send and verify serial traffic')
				result = srlTester.sendAndVerifySerialTraffic ()
				
				# Cheriyan - Uncomment the following lines later
				# validateStep("Send and verify serial traffic\n", result, TESTCASE)
				# if (result[0]):
					# srlTesterPkts = result[2]
					# txPackets = int(srlTesterPkts[0])
					# rxPackets = int(srlTesterPkts[1])
					
				srlTesterPkts = result[2]
				txPackets = int(srlTesterPkts[0])
				rxPackets = int(srlTesterPkts[1])
				
				result = ''
				
				print ('#****************************************************************************')
				STEP ('Step 5: Verify the traffic on the radios')
				
				# Get the number of packets on the remote radio after sending traffic
				result = mon.getSerialPortTxRxPkts (TargetRemoteIP, srlPortNum_remote)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemoteIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					remote_Port1_InPkts_AT = packetCounts[0]
					remote_Port1_OutPkts_AT = packetCounts[1]
					remote_Port1_ErrPkts_AT = packetCounts[2]
					remote_Port1_DropPkts_AT = packetCounts[3]
					remote_Port1_DropFiltPkts_AT = packetCounts[4]
					remote_Port1_RfInPktsErr_AT = packetCounts[5]
					remote_Port1_RfOutDropPkts_AT = packetCounts[6]
					remote_Port1_RfInDropFiltPkts_AT = packetCounts[7]
					
					logFile(glob.DlogName, 'Remote In Pkts AT:	%s' %remote_Port1_InPkts_AT)
					logFile(glob.DlogName, 'Remote Out Pkts AT:	%s' %remote_Port1_OutPkts_AT)
					logFile(glob.DlogName, 'Remote Err Pkts AT:	%s' %remote_Port1_ErrPkts_AT)
					logFile(glob.DlogName, 'Remote Drop Pkts AT:	%s' %remote_Port1_DropPkts_AT)
					logFile(glob.DlogName, 'Remote Drop Filtered Pkts AT:	%s' %remote_Port1_DropFiltPkts_AT)
					logFile(glob.DlogName, 'Remote RF In Pkts Error AT:	%s' %remote_Port1_RfInPktsErr_AT)
					logFile(glob.DlogName, 'Remote RF Out Drop Pkts AT:	%s' %remote_Port1_RfOutDropPkts_AT)
					logFile(glob.DlogName, 'Remote In Drop Filtered Pkts AT:	%s\n\n' %remote_Port1_RfInDropFiltPkts_AT)
				
				result = ''				
				# Get the number of packets on the base radio before sending traffic
				result = mon.getSerialPortTxRxPkts (TargetBaseIP, srlPortNum_base)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					base_Port1_InPkts_AT = packetCounts[0]
					base_Port1_OutPkts_AT = packetCounts[1]
					base_Port1_ErrPkts_AT = packetCounts[2]
					base_Port1_DropPkts_AT = packetCounts[3]
					base_Port1_DropFiltPkts_AT = packetCounts[4]
					base_Port1_RfInPktsErr_AT = packetCounts[5]
					base_Port1_RfOutDropPkts_AT = packetCounts[6]
					base_Port1_RfInDropFiltPkts_AT = packetCounts[7]
					
					logFile(glob.DlogName, 'Base In Pkts AT:	%s' %base_Port1_InPkts_AT)
					logFile(glob.DlogName, 'Base Out Pkts AT:	%s' %base_Port1_OutPkts_AT)
					logFile(glob.DlogName, 'Base Err Pkts AT:	%s' %base_Port1_ErrPkts_AT)
					logFile(glob.DlogName, 'Base Drop Pkts AT:	%s' %base_Port1_DropPkts_AT)
					logFile(glob.DlogName, 'Base Drop Filtered Pkts AT:	%s' %base_Port1_DropFiltPkts_AT)
					logFile(glob.DlogName, 'Base RF In Pkts Error AT:	%s' %base_Port1_RfInPktsErr_AT)
					logFile(glob.DlogName, 'Base RF Out Drop Pkts AT:	%s' %base_Port1_RfOutDropPkts_AT)
					logFile(glob.DlogName, 'Base In Drop Filtered Pkts AT:	%s\n\n' %base_Port1_RfInDropFiltPkts_AT)
					
				base_RxPackets = base_Port1_InPkts_AT - base_Port1_InPkts_BT
				base_DropPkts = base_Port1_DropPkts_AT - base_Port1_DropPkts_BT
				base_DropFiltPkts = base_Port1_DropFiltPkts_AT - base_Port1_DropFiltPkts_BT
				base_RfOutDropPkts = base_Port1_RfOutDropPkts_AT - base_Port1_RfOutDropPkts_BT
				remote_TxPackets = remote_Port1_OutPkts_AT - remote_Port1_OutPkts_BT
				remote_ErrPackets = remote_Port1_ErrPkts_AT - remote_Port1_ErrPkts_BT
				remote_RfInPktsErr = remote_Port1_RfInPktsErr_AT - remote_Port1_RfInPktsErr_BT
				remote_RfInDropFiltPkts = remote_Port1_RfInDropFiltPkts_AT - remote_Port1_RfInDropFiltPkts_BT
				
				logFile(glob.DlogName, 'Base RX Pkts AT:	%s' %base_RxPackets)
				logFile(glob.DlogName, 'Base Drop Pkts AT:	%s' %base_DropPkts)
				logFile(glob.DlogName, 'Base Drop Filtered Pkts AT:	%s' %base_DropFiltPkts)
				logFile(glob.DlogName, 'Base RF Out Drop Pkts AT:	%s' %base_RfOutDropPkts)
				
				logFile(glob.DlogName, 'Remote TX Pkts AT:	%s' %remote_TxPackets)
				logFile(glob.DlogName, 'Remote Err Pkts AT:	%s' %remote_ErrPackets)
				logFile(glob.DlogName, 'Remote RF In Pkts Err AT:	%s' %remote_RfInPktsErr)
				logFile(glob.DlogName, 'Remote RF In Drop Filtered Pkts AT:	%s\n\n' %remote_RfInDropFiltPkts)
				
				result = ''
				res = []
				# Verify the results
				if ((base_RxPackets == remote_TxPackets) and (base_RxPackets == txPackets) and (remote_ErrPackets == 0)):
					res.append(True)
					res.append('Traffic Sent from Base is Received on Remote Station\n')
				else:
					print ('Failed')
					res.append(False)
					res.append('Traffic Sent from Base is not Received on Remote Station\n')
				
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, res, TESTCASE)
				
				print ('#****************************************************************************')
				STEP ('Step 6: Change the traffic direction and collect stats on the radios before sending traffic')
				
				srlTester.setTrafficDirection(receiver, sender)
				
				# Get the number of packets on the remote radio before sending traffic
				result = mon.getSerialPortTxRxPkts (TargetRemoteIP, srlPortNum_remote)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemoteIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					remote_Port1_InPkts_BT = packetCounts[0]
					remote_Port1_OutPkts_BT = packetCounts[1]
					remote_Port1_ErrPkts_BT = packetCounts[2]
					remote_Port1_DropPkts_BT = packetCounts[3]
					remote_Port1_DropFiltPkts_BT = packetCounts[4]
					remote_Port1_RfInPktsErr_BT = packetCounts[5]
					remote_Port1_RfOutDropPkts_BT = packetCounts[6]
					remote_Port1_RfInDropFiltPkts_BT = packetCounts[7]
					
					logFile(glob.DlogName, 'Remote In Pkts BT:	%s' %remote_Port1_InPkts_BT)
					logFile(glob.DlogName, 'Remote Out Pkts BT:	%s' %remote_Port1_OutPkts_BT)
					logFile(glob.DlogName, 'Remote Err Pkts BT:	%s' %remote_Port1_ErrPkts_BT)
					logFile(glob.DlogName, 'Remote Drop Pkts BT: %s' %remote_Port1_DropPkts_BT)
					logFile(glob.DlogName, 'Remote Drop Filtered Pkts BT: %s' %remote_Port1_DropFiltPkts_BT)
					logFile(glob.DlogName, 'Remote RF In Pkts Error BT:	%s' %remote_Port1_RfInPktsErr_BT)
					logFile(glob.DlogName, 'Remote RF Out Drop Pkts BT:	%s' %remote_Port1_RfOutDropPkts_BT)
					logFile(glob.DlogName, 'Remote In Drop Filtered Pkts BT: %s\n\n' %remote_Port1_RfInDropFiltPkts_BT)
					
				
				result = ''	
				
				# Get the number of packets on the base radio before sending traffic
				result = mon.getSerialPortTxRxPkts (TargetBaseIP, srlPortNum_base)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					base_Port1_InPkts_BT = packetCounts[0]
					base_Port1_OutPkts_BT = packetCounts[1]
					base_Port1_ErrPkts_BT = packetCounts[2]
					base_Port1_DropPkts_BT = packetCounts[3]
					base_Port1_DropFiltPkts_BT = packetCounts[4]
					base_Port1_RfInPktsErr_BT = packetCounts[5]
					base_Port1_RfOutDropPkts_BT = packetCounts[6]
					base_Port1_RfInDropFiltPkts_BT = packetCounts[7]
					
					logFile(glob.DlogName, 'Base In Pkts BT:	%s' %base_Port1_InPkts_BT)
					logFile(glob.DlogName, 'Base Out Pkts BT:	%s' %base_Port1_OutPkts_BT)
					logFile(glob.DlogName, 'Base Err Pkts BT:	%s' %base_Port1_ErrPkts_BT)
					logFile(glob.DlogName, 'Base Drop Pkts BT:	%s' %base_Port1_DropPkts_BT)
					logFile(glob.DlogName, 'Base Drop Filtered Pkts BT:	%s' %base_Port1_DropFiltPkts_BT)
					logFile(glob.DlogName, 'Base RF In Pkts Error BT:	%s' %base_Port1_RfInPktsErr_BT)
					logFile(glob.DlogName, 'Base RF Out Drop Pkts BT:	%s' %base_Port1_RfOutDropPkts_BT)
					logFile(glob.DlogName, 'Base In Drop Filtered Pkts BT:	%s\n\n' %base_Port1_RfInDropFiltPkts_BT)
					
				result = ''
				
				print ('#****************************************************************************')
				STEP ('Step 7: Send the traffic and verify the results on the serial tester')
				
				result = srlTester.sendAndVerifySerialTraffic ()
				# Cheriyan - Uncomment the following lines later
				# validateStep("Send and verify serial traffic\n", result, TESTCASE)
				# if (result[0]):
					# srlTesterPkts = result[2]
					# txPackets = int(srlTesterPkts[0])
					# rxPackets = int(srlTesterPkts[1])
				
				srlTesterPkts = result[2]
				txPackets = int(srlTesterPkts[0])
				rxPackets = int(srlTesterPkts[1])
				result = ''
				
				print ('#****************************************************************************')
				STEP ('Step 8: Verify the traffic results on the radios')
				
				# Get the number of packets on the remote radio after sending traffic
				result = mon.getSerialPortTxRxPkts (TargetRemoteIP, srlPortNum_remote)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetRemoteIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					remote_Port1_InPkts_AT = packetCounts[0]
					remote_Port1_OutPkts_AT = packetCounts[1]
					remote_Port1_ErrPkts_AT = packetCounts[2]
					remote_Port1_DropPkts_AT = packetCounts[3]
					remote_Port1_DropFiltPkts_AT = packetCounts[4]
					remote_Port1_RfInPktsErr_AT = packetCounts[5]
					remote_Port1_RfOutDropPkts_AT = packetCounts[6]
					remote_Port1_RfInDropFiltPkts_AT = packetCounts[7]
					
					logFile(glob.DlogName, 'Remote In Pkts AT:	%s' %remote_Port1_InPkts_AT)
					logFile(glob.DlogName, 'Remote Out Pkts AT:	%s' %remote_Port1_OutPkts_AT)
					logFile(glob.DlogName, 'Remote Err Pkts AT:	%s' %remote_Port1_ErrPkts_AT)
					logFile(glob.DlogName, 'Remote Drop Pkts AT:	%s' %remote_Port1_DropPkts_AT)
					logFile(glob.DlogName, 'Remote Drop Filtered Pkts AT:	%s' %remote_Port1_DropFiltPkts_AT)
					logFile(glob.DlogName, 'Remote RF In Pkts Error AT:	%s' %remote_Port1_RfInPktsErr_AT)
					logFile(glob.DlogName, 'Remote RF Out Drop Pkts AT:	%s' %remote_Port1_RfOutDropPkts_AT)
					logFile(glob.DlogName, 'Remote In Drop Filtered Pkts AT:	%s\n\n' %remote_Port1_RfInDropFiltPkts_AT)
				
				result = ''				
				# Get the number of packets on the base radio before sending traffic
				result = mon.getSerialPortTxRxPkts (TargetBaseIP, srlPortNum_base)
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, result, TESTCASE)
				if (result[0]):
					# Then collect all the values
					packetCounts = result[2]
					base_Port1_InPkts_AT = packetCounts[0]
					base_Port1_OutPkts_AT = packetCounts[1]
					base_Port1_ErrPkts_AT = packetCounts[2]
					base_Port1_DropPkts_AT = packetCounts[3]
					base_Port1_DropFiltPkts_AT = packetCounts[4]
					base_Port1_RfInPktsErr_AT = packetCounts[5]
					base_Port1_RfOutDropPkts_AT = packetCounts[6]
					base_Port1_RfInDropFiltPkts_AT = packetCounts[7]
					
					logFile(glob.DlogName, 'Base In Pkts AT:	%s' %base_Port1_InPkts_AT)
					logFile(glob.DlogName, 'Base Out Pkts AT:	%s' %base_Port1_OutPkts_AT)
					logFile(glob.DlogName, 'Base Err Pkts AT:	%s' %base_Port1_ErrPkts_AT)
					logFile(glob.DlogName, 'Base Drop Pkts AT:	%s' %base_Port1_DropPkts_AT)
					logFile(glob.DlogName, 'Base Drop Filtered Pkts AT:	%s' %base_Port1_DropFiltPkts_AT)
					logFile(glob.DlogName, 'Base RF In Pkts Error AT:	%s' %base_Port1_RfInPktsErr_AT)
					logFile(glob.DlogName, 'Base RF Out Drop Pkts AT:	%s' %base_Port1_RfOutDropPkts_AT)
					logFile(glob.DlogName, 'Base In Drop Filtered Pkts AT:	%s\n\n' %base_Port1_RfInDropFiltPkts_AT)
					
				remote_RxPackets = remote_Port1_InPkts_AT - remote_Port1_InPkts_BT
				remote_DropPkts = remote_Port1_DropPkts_AT - remote_Port1_DropPkts_BT
				remote_DropFiltPkts = remote_Port1_DropFiltPkts_AT - remote_Port1_DropFiltPkts_BT
				remote_RfOutDropPkts = remote_Port1_RfOutDropPkts_AT - remote_Port1_RfOutDropPkts_BT
				
				base_TxPackets = base_Port1_OutPkts_AT - base_Port1_OutPkts_BT
				base_ErrPackets = base_Port1_ErrPkts_AT - base_Port1_ErrPkts_BT
				base_RfInPktsErr = base_Port1_RfInPktsErr_AT - base_Port1_RfInPktsErr_BT
				base_RfInDropFiltPkts = base_Port1_RfInDropFiltPkts_AT - base_Port1_RfInDropFiltPkts_BT
				
				
				logFile(glob.DlogName, 'Remote RX Pkts AT:	%s' %remote_RxPackets)
				logFile(glob.DlogName, 'Remote Drop Pkts AT:	%s' %remote_DropPkts)
				logFile(glob.DlogName, 'Remote Drop Filtered Pkts AT:	%s' %remote_DropFiltPkts)
				logFile(glob.DlogName, 'Remote RF Out Drop Pkts AT:	%s\n\n' %remote_RfOutDropPkts)
				
				logFile(glob.DlogName, 'Base TX Pkts AT:	%s' %base_TxPackets)
				logFile(glob.DlogName, 'Base Err Pkts AT:	%s' %base_ErrPackets)
				logFile(glob.DlogName, 'Base RF In Pkts Err AT:	%s' %base_RfInPktsErr)
				logFile(glob.DlogName, 'Base RF In Drop Filtered Pkts AT:	%s' %base_RfInDropFiltPkts)
				
				result = ''
				res = []
				# Verify the results
				if ((remote_RxPackets == base_TxPackets) and (remote_RxPackets == txPackets) and (base_ErrPackets == 0)):
					res.append(True)
					res.append('Traffic Sent from Base is Received on Remote Station\n')
				else:
					res.append(False)
					res.append('Traffic Sent from Remote is not Received on Base Station\n')
				
				validateStep('Retrieved Packet Counts on %s\n\n' %TargetBaseIP, res, TESTCASE)
				
	except TestException:
		testResult = 'FAIL'
	
	else:
		testResult = 'PASS'
			
	finally:
		srlTester.close()
		print ('\n#****************************************************************************')
		print ('#							CLEANUP SECTION		                             ')
		print ('#****************************************************************************')
		for i in range (0,len(TargetRadioIP)):
			#******************************************************************
			STEP ('CLEANUP:	Restore the DUTs to User Defaults\n\n')
			
			result = maint.restoreUserDefaults (TargetRadioIP[i], 1)
			validateStep('Restoring User Defaults on %s\n\n' %TargetRadioIP[i], result, TESTCASE)
			
			result = ''
	print ('#****************************************************************************')
	print ('#					END OF TEST CASE                                         ')
	print ('#****************************************************************************')
	finish (t1, TESTCASE, testResult)
def TFS_SoftwareUpgrade_002():
    try:
        t1 = time.localtime()
        testResult = ""
        result = ""
        TESTCASE = "SoftwareUpgrade_002"
        glob.testDesc = """FTP the software image to the primary and then do a inter-unit transfer
							to the secondary radio and activate the software"""
        PIPSStationIP = glob.Configs["PIPSRadioIP"].strip().split(",")
        # serverIPList = PIPSStationIP[0].strip().split('.')
        # serverIp = serverIPList[0]+'.'+serverIPList[1]+'.'+serverIPList[2]+'.'+'6'
        serverIp = glob.Configs["FTPServerIP"]
        userName = glob.Configs["FTPUserName"]
        password = glob.Configs["FTPPassword"]
        targetVersion = glob.Configs["TargetVersion"]
        manualLock = -1
        activeUnit = 1

        # Log Test Case Header
        print("TESTCASE #   %s\n" % TESTCASE)
        glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"

        logFile(glob.DlogName, "===============================================================\n")
        logFile(glob.DlogName, "TESTCASE %s\n\n" % TESTCASE)
        print("#****************************************************************************")
        print("#							START OF TEST CASE                                ")
        print("#****************************************************************************")
        STEP("COMMON:	Set the Software manual Lock\n\n")
        result = maint.setSoftwareManualLock(PIPSStationIP[0], manualLock, activeUnit)
        validateStep("Set Software Manual on radio %s" % PIPSStationIP[0], result, TESTCASE)
        manualLockSet = True
        result = ""

        print("#****************************************************************************")
        STEP("Step 1: FTP the software\n\n")
        result = soft.FTPTransfer(PIPSStationIP[0], serverIp, userName, password)
        validateStep("FTP the software", result, TESTCASE)
        result = ""

        print("#****************************************************************************")
        STEP("Step 2: Do a Inter Unit transfer of the software to secondary\n")
        result = soft.InterUnitTransfer(PIPSStationIP[1])
        validateStep("Inter Unit Transfer the software", result, TESTCASE)
        result = ""

        print("#****************************************************************************")
        STEP("COMMON:	Disable the Software manual Lock\n\n")
        manualLock = 0
        result = maint.setSoftwareManualLock(PIPSStationIP[0], manualLock, activeUnit)
        validateStep("Set Software Manual on radio %s" % PIPSStationIP[0], result, TESTCASE)
        manualLockSet = True
        result = ""

        print("#****************************************************************************")
        for i in range(0, len(PIPSStationIP)):
            STEP("Step 3: Activate the software on the radio\n\n")
            result = soft.SwActivation(PIPSStationIP[i], targetVersion)
            validateStep("Activate the software", result, TESTCASE)
            result = ""

    except TestException:
        testResult = "FAIL"
        pass
    else:
        testResult = "PASS"

    print("#****************************************************************************")
    print("#					END OF TEST CASE                                         ")
    print("#****************************************************************************")
    finish(t1, TESTCASE, testResult)
def TFS_SoftwareUpgrade_001 ():
	try:
		t1 = time.localtime()
		testResult = ''
		result = ''
		TESTCASE = 'SoftwareUpgrade_001'
		glob.testDesc = """FTP the software image and activate it on the radio"""
		RemoteStationIP = glob.Configs['RadioIP'].strip().split(',')
		TargetRadioIP = glob.Configs['RadioVirtualIP']
		serverIp = glob.Configs['RadioFTPServer']
		userName = glob.Configs['FTPUserName']
		password = glob.Configs['FTPPassword']
		targetVersion = glob.Configs['TargetVersion']
		manualLock = -1
		activeUnit = 2
		
		# Log Test Case Header
		print('TESTCASE #   %s\n' %TESTCASE)
		glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"
		
		logFile(glob.DlogName,"===============================================================\n")
		logFile(glob.DlogName,"TESTCASE %s\n\n"%TESTCASE)
		print ('#****************************************************************************')
		print ('#							START OF TEST CASE                                ')
		print ('#****************************************************************************')
		result = term.checkIfProtectedUnit (TargetRadioIP)
		if (result[0]):
			STEP ('Step 1:	Set the Software manual Lock\n\n')
			result = maint.setSoftwareManualLock(RemoteStationIP[1], manualLock, activeUnit)
			validateStep('Set Software Manual on radio %s' %RemoteStationIP[1] , result, TESTCASE)
			time.sleep(5)
			result = ''
		
			print ('#****************************************************************************')
			STEP ('Step 2: FTP the software\n\n')
			result = soft.FTPTransfer (RemoteStationIP[1], serverIp, userName, password)
			validateStep('FTP the software', result, TESTCASE)
			result = ''
		
			print ('#****************************************************************************')
			STEP ('Step 3:	Set the Software manual Lock\n\n')
			activeUnit = 1
			result = maint.setSoftwareManualLock(RemoteStationIP[0], manualLock, activeUnit)
			validateStep('Set Software Manual on radio %s' %RemoteStationIP[0] , result, TESTCASE)
			time.sleep(5)
			result = ''
		
			print ('#****************************************************************************')
			STEP ('Step 4: FTP the software\n\n')
			result = soft.FTPTransfer (RemoteStationIP[0], serverIp, userName, password)
			validateStep('FTP the software', result, TESTCASE)
			result = ''
		
			print ('#****************************************************************************')
			STEP ('Step 5:	Disable the Software manual Lock\n\n')
			manualLock = 0
			result = maint.setSoftwareManualLock(RemoteStationIP[0], manualLock, activeUnit)
			validateStep('Set Software Manual on radio %s' %RemoteStationIP[0] , result, TESTCASE)
			time.sleep(5)
			result = ''
		
			print ('#****************************************************************************')
				
		else:
			STEP ('Step 1: FTP the software\n\n')
			result = soft.FTPTransfer (TargetRadioIP, serverIp, userName, password)
			validateStep('FTP the software', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 6:	Activate the software on each of the remote3 radios\n\n')
		
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRadioIP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetRadioIP)
			if (res[2] == 1):
				# If primary is active unit, then activate the secondary radio
				result = soft.SwActivation (RemoteStationIP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the primary unit
				result = soft.SwActivation (RemoteStationIP[0], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
			else:
				# If secondary is active unit, then activate the primary radio
				result = soft.SwActivation (RemoteStationIP[0], targetVersion)
				validateStep('Activate the software on the primary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the secondary unit
				result = soft.SwActivation (RemoteStationIP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
		
		else:
			STEP ('Step 2:	Activate the software on each of the remote3 radios\n\n')
			result = soft.SwActivation (TargetRadioIP, targetVersion)
			validateStep('Activate the software on the Remote3 radio', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		
	except TestException:
		testResult = 'FAIL'
		pass
	else:
		testResult = 'PASS'
			
	
	print ('#****************************************************************************')
	print ('#					END OF TEST CASE                                         ')
	print ('#****************************************************************************')
	finish (t1, TESTCASE, testResult)
def TFS_SoftwareUpgrade_003 ():
	try:
		t1 = time.localtime()
		testResult = ''
		result = ''
		TESTCASE = 'SoftwareUpgrade_003'
		glob.testDesc = """FTP the software to the base radio and then redistribute to all 
						the remote radios and then activate on the remote radios
						and then on the base radio."""
		TargetRadioIP = []	
		BaseStationIP = glob.Configs['BaseStationRadioIP'].strip().split(',')
		TargetBaseIP = glob.Configs['BaseStationVirtualIP'] 
		RepeaterStation1IP = glob.Configs['RepeaterStation1RadioIP'].strip().split(',')
		RepeaterStation2IP = glob.Configs['RepeaterStation2RadioIP'].strip().split(',')
		TargetRepeater1IP = glob.Configs['RepeaterStation1VirtualIP'] 
		TargetRepeater2IP = glob.Configs['RepeaterStation2VirtualIP'] 
		RemoteStation1IP = glob.Configs['RemoteStation1RadioIP'].strip().split(',')
		RemoteStation2IP = glob.Configs['RemoteStation2RadioIP'].strip().split(',')
		RemoteStation3IP = glob.Configs['RemoteStation3RadioIP'].strip().split(',')
		TargetRemote1IP = glob.Configs['RemoteStation1VirtualIP']
		TargetRemote2IP = glob.Configs['RemoteStation2VirtualIP']
		TargetRemote3IP = glob.Configs['RemoteStation3VirtualIP']
		TargetRadioIP = TargetRadioIP + BaseStationIP
		TargetRadioIP = TargetRadioIP + RepeaterStation1IP
		TargetRadioIP = TargetRadioIP + RepeaterStation2IP
		TargetRadioIP = TargetRadioIP + RemoteStation1IP
		TargetRadioIP = TargetRadioIP + RemoteStation2IP
		TargetRadioIP = TargetRadioIP + RemoteStation3IP
		
		
		serverIp = glob.Configs['FTPServerIP']
		userName = glob.Configs['FTPUserName']
		password = glob.Configs['FTPPassword']
		targetVersion = glob.Configs['TargetVersion']
		manualLock = -1
		activeUnit = 2
		
		channelSizes = 4
		txFrequency = 950056250
		rxFrequency = 950093750
		rptrTxFrequency = 950093750
		rptrRxFrequency = 950056250
		rem3TxFrequency = 950093750
		rem3RxFrequency = 950056250
		txPower = 340				# This denotes txPower as 15dB
		txPower_rptr = 340				# This denotes txPower as 20dB
		nwRadius = 2
		nwProximity = 2 			# overlapping Coverage Mode
		rpt1NwSeg = 10
		rpt2NwSeg = 12
		nwTrafficType = 0			# user defined mode
		defaultTtl = 0
		serialTtl = 0
		srlPrtCfgMode = 1
		flowCtrl = 1				# sets the flow control to CTS-RTS
		mtuSize = 512
		baseTermOpMode = 1			# sets operMOde as Base
		rptrTermOpMode = 2			# sets operMode as Repeater
		remoteOperMode = 3			# sets operMode as Remote
		etherMode = 1
		
		# Log Test Case Header
		print('TESTCASE #   %s\n' %TESTCASE)
		glob.DlogName = glob.resultsDir + "\\" + TESTCASE + ".log"
		
		logFile(glob.DlogName,"===============================================================\n")
		logFile(glob.DlogName,"TESTCASE %s\n\n"%TESTCASE)
		print ('#****************************************************************************')
		print ('#							COMMON TEST SETUP                                ')
		print ('#****************************************************************************')
		for i in range(0,len(BaseStationIP)):
			STEP('COMMON:	Configure PIPS Radio as Base Station\n\n')
			result = term.setTerminalOperMode(BaseStationIP[i], baseTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Base Station\n\n' %BaseStationIP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %BaseStationIP[i])
			result = rad.setTxSettings (BaseStationIP[i], txFrequency,txPower)
			validateStep('Set the Tx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (BaseStationIP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(BaseStationIP[i], nwRadius, nwProximity)
			validateStep('Set Network Radius and Network Proximity on radio %s' %BaseStationIP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP('COMMON:	Configure Channel Size on the All the Radios\n\n')
			result = rad.setRadioChannelSize(BaseStationIP[i], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes,BaseStationIP[i]), result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(BaseStationIP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %BaseStationIP[i] , result, TESTCASE)
			result = ''
		
		print ('#****************************************************************************')
		for i in range(0,len(RepeaterStation1IP)):
			STEP('COMMON:	Configure PIPS Radio as Repeater Station 1\n\n')
			result = term.setTerminalOperMode(RepeaterStation1IP[i], rptrTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Repeater Station 1\n\n' %RepeaterStation1IP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %RepeaterStation1IP[i])
			result = rad.setTxSettings (RepeaterStation1IP[i], rptrTxFrequency, txPower_rptr)
			validateStep('Set the Tx Frequency on radio %s' %RepeaterStation1IP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RepeaterStation1IP[i], rptrRxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RepeaterStation1IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RepeaterStation1IP[i], nwRadius, nwProximity, rpt1NwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RepeaterStation1IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP('COMMON:	Configure Channel Size on the All the Radios\n\n')
			result = rad.setRadioChannelSize(RepeaterStation1IP[i], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes,RepeaterStation1IP[i]), result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RepeaterStation1IP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RepeaterStation1IP[i] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		for i in range(0,len(RepeaterStation2IP)):
			STEP('COMMON:	Configure PIPS Radio as Repeater Station 1\n\n')
			result = term.setTerminalOperMode(RepeaterStation2IP[i], rptrTermOpMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Repeater Station 1\n\n' %RepeaterStation2IP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %RepeaterStation2IP[i])
			result = rad.setTxSettings (RepeaterStation2IP[i], rptrTxFrequency, txPower)
			validateStep('Set the Tx Frequency on radio %s' %RepeaterStation2IP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RepeaterStation2IP[i], rptrRxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RepeaterStation2IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RepeaterStation2IP[i], nwRadius, nwProximity, rpt2NwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RepeaterStation2IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP('COMMON:	Configure Channel Size on the All the Radios\n\n')
			result = rad.setRadioChannelSize(RepeaterStation2IP[i], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes,RepeaterStation2IP[i]), result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RepeaterStation2IP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RepeaterStation2IP[i] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		for i in range(0,len(RemoteStation1IP)):
			STEP('COMMON:	Configure Radio as Remote Station\n\n')
			result = term.setTerminalOperMode(RemoteStation1IP[i], remoteOperMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Remote Station\n\n' %RemoteStation1IP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RemoteStation1IP[i], nwRadius, nwProximity, rpt1NwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RemoteStation1IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %RemoteStation1IP[i])
			result = rad.setTxSettings (RemoteStation1IP[i], txFrequency, txPower)
			validateStep('Set the Tx Frequency on radio %s' %RemoteStation1IP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RemoteStation1IP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RemoteStation1IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP('COMMON:	Configure Channel Size on the All the Radios\n\n')
			result = rad.setRadioChannelSize(RemoteStation1IP[i], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes,RemoteStation1IP[i]), result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RemoteStation1IP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RemoteStation1IP[i] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		for i in range(0,len(RemoteStation2IP)):
			STEP('COMMON:	Configure Radio as Remote Station\n\n')
			result = term.setTerminalOperMode(RemoteStation2IP[i], remoteOperMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Remote Station\n\n' %RemoteStation2IP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RemoteStation2IP[i], nwRadius, nwProximity, rpt2NwSeg)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RemoteStation2IP[i] , result, TESTCASE)
			result = ''
			
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %RemoteStation2IP[i])
			result = rad.setTxSettings (RemoteStation2IP[i], txFrequency, txPower)
			validateStep('Set the Tx Frequency on radio %s' %RemoteStation2IP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RemoteStation2IP[i], rxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RemoteStation2IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP('COMMON:	Configure Channel Size on the All the Radios\n\n')
			result = rad.setRadioChannelSize(RemoteStation2IP[i], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes,RemoteStation2IP[i]), result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RemoteStation2IP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RemoteStation2IP[i] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		for i in range(0,len(RemoteStation3IP)):
			STEP('COMMON:	Configure Radio as Remote Station\n\n')
			result = term.setTerminalOperMode(RemoteStation3IP[i], remoteOperMode, etherMode)
			validateStep('Configure DUT1: %s Radio as Remote Station\n\n' %RemoteStation3IP[i], result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP ('COMMON:	Set the network Radius and Network Proximity\n\n')
			result = term.setRFNetworkDetails(RemoteStation3IP[i], nwRadius, nwProximity)
			validateStep('Set Network Radius and Network Proximity on radio %s' %RemoteStation3IP[i] , result, TESTCASE)
			result = ''
			
			STEP ('COMMON: Configure the single Tx and Rx Frequency on all radios\n\n')
			print ('TargetRadio: %s' %RemoteStation3IP[i])
			result = rad.setTxSettings (RemoteStation3IP[i], rem3TxFrequency, txPower)
			validateStep('Set the Tx Frequency on radio %s' %RemoteStation3IP[i] , result, TESTCASE)
			result = ''
			
			# Set the Rx Frequency on the radios
			result = rad.setRxSettings (RemoteStation3IP[i], rem3RxFrequency)
			validateStep('Set the Rx Frequency on radio %s' %RemoteStation3IP[i] , result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			STEP('COMMON:	Configure Channel Size on the All the Radios\n\n')
			result = rad.setRadioChannelSize(RemoteStation3IP[i], channelSizes)
			validateStep('Configure Channel Size as %s on  %s Radio \n\n' %(channelSizes,RemoteStation3IP[i]), result, TESTCASE)
			result = ''
			
			print ('#****************************************************************************')
			# Reboot the radio for the configuration to take effect
			STEP ("COMMON:	Reboot the DUT\n\n")
			result = maint.rebootRadio(RemoteStation3IP[i], 1)
			validateStep('Reboot the radio %s after 5 secs' %RemoteStation3IP[i] , result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		
		print ('#****************************************************************************')
		print ('#							START OF TEST CASE                                ')
		print ('#****************************************************************************')
		# Find if Base is a protected Unit
		result = term.checkIfProtectedUnit (TargetBaseIP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			STEP ('Step 1: Perform a software manual lock to seconndary unit on Base Radio')
			result = maint.setSoftwareManualLock(BaseStationIP[1], manualLock, activeUnit)
			validateStep('Set Software Manual on radio %s' %BaseStationIP[1] , result, TESTCASE)
			
			result = ''
		    
			time.sleep(5)
			print ('#****************************************************************************')
			STEP ('Step 2: FTP the software to secondary radio\n\n')
			result = soft.FTPTransfer (BaseStationIP[1], serverIp, userName, password)
			validateStep('FTP the software', result, TESTCASE)
			result = ''	
			
			print ('#****************************************************************************')
			STEP ('Step 3: Perform a software manual lock to primary unit on Base Radio')
			
			activeUnit = 1
			
			result = maint.setSoftwareManualLock(BaseStationIP[0], manualLock, activeUnit)
			validateStep('Set Software Manual on radio %s' %BaseStationIP[0] , result, TESTCASE)
			
			time.sleep(5)
			result = ''
				
			print ('#****************************************************************************')
			STEP ('Step 4: FTP the software to primary radio\n\n')
			result = soft.FTPTransfer (BaseStationIP[0], serverIp, userName, password)
			validateStep('FTP the software', result, TESTCASE)
			result = ''	
			
			print ('#****************************************************************************')
			STEP ('Step 5:	Disable the Software manual Lock\n\n')
			manualLock = 0
			result = maint.setSoftwareManualLock(BaseStationIP[0], manualLock, activeUnit)
			validateStep('Set Software Manual on radio %s' %BaseStationIP[0] , result, TESTCASE)
			
			result = ''
			
			print ('#****************************************************************************')
		else:
			STEP ('Step 2: FTP the software to Base radio\n\n')
			result = soft.FTPTransfer (TargetBaseIP, serverIp, userName, password)
			validateStep('FTP the software', result, TESTCASE)
			result = ''	
			
			print ('#****************************************************************************')
			
		STEP ('Step 6:	Do a Remote Distribute to all the radios\n\n')
		result = soft.BaseDistribute (BaseStationIP[0])
		validateStep('Remote Distribute the software the software', result, TESTCASE)
		result = ''	
		
		print ('#****************************************************************************')
		STEP ('Step 6a: Do a InterUnit Transfer to the standby radios for PIPS Remote1')
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRemote1IP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetRemote1IP)
			if (res[2] == 1):
				# Set the software manual lock to the active unit and then do the
				# Inter Unit Transfer
				
				manualLock = -1
				activeUnit = 1
				
				result = maint.setSoftwareManualLock(RemoteStation1IP[0], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RemoteStation1IP[0] , result, TESTCASE)
				result = ''
				
				# Do a Inter Unit Transfer
				result = soft.InterUnitTransfer (RemoteStation1IP[1])
				validateStep('Inter Unit Transfer the software', result, TESTCASE)
				result = ''
				
				# Disable the software manual lock
				manualLock = 0
				result = maint.setSoftwareManualLock(RemoteStation1IP[0], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RemoteStation1IP[0] , result, TESTCASE)
				result = ''
			else:
				# Set the software manual lock to the active unit and then do the
				# Inter Unit Transfer
				
				manualLock = -1
				activeUnit = 2
				
				result = maint.setSoftwareManualLock(RemoteStation1IP[1], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RemoteStation1IP[1] , result, TESTCASE)
				result = ''
				
				# Do a Inter Unit Transfer
				result = soft.InterUnitTransfer (RemoteStation1IP[0])
				validateStep('Inter Unit Transfer the software', result, TESTCASE)
				result = ''
				
				# Disable the software manual lock
				manualLock = 0
				result = maint.setSoftwareManualLock(RemoteStation1IP[1], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RemoteStation1IP[1] , result, TESTCASE)
				result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 6b: Do a InterUnit Transfer to the standby radios for PIPS Repeater1')
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRepeater1IP)
		if (result[0]):
			# Find the active Unit in this Repeater Radio
			res = term.getProtectedActiveUnit(TargetRepeater1IP)
			if (res[2] == 1):
				# Set the software manual lock to the active unit and then do the
				# Inter Unit Transfer
				
				manualLock = -1
				activeUnit = 1
				
				result = maint.setSoftwareManualLock(RepeaterStation1IP[0], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RepeaterStation1IP[0] , result, TESTCASE)
				result = ''
				
				# Do a Inter Unit Transfer
				result = soft.InterUnitTransfer (RepeaterStation1IP[1])
				validateStep('Inter Unit Transfer the software', result, TESTCASE)
				result = ''
				
				# Disable the software manual lock
				manualLock = 0
				result = maint.setSoftwareManualLock(RepeaterStation1IP[0], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RepeaterStation1IP[0] , result, TESTCASE)
				result = ''
			else:
				# Set the software manual lock to the active unit and then do the
				# Inter Unit Transfer
				
				manualLock = -1
				activeUnit = 2
				
				result = maint.setSoftwareManualLock(RepeaterStation1IP[1], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RepeaterStation1IP[1] , result, TESTCASE)
				result = ''
				
				# Do a Inter Unit Transfer
				result = soft.InterUnitTransfer (RepeaterStation1IP[0])
				validateStep('Inter Unit Transfer the software', result, TESTCASE)
				result = ''
				
				# Disable the software manual lock
				manualLock = 0
				result = maint.setSoftwareManualLock(RepeaterStation1IP[1], manualLock, activeUnit)
				validateStep('Set Software Manual on radio %s' %RepeaterStation1IP[1] , result, TESTCASE)
				result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 7:	Activate the software on each of the remote radios\n\n')
		
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRemote1IP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetRemote1IP)
			if (res[2] == 1):
				# If primary is active unit, then activate the secondary radio
				result = soft.SwActivation (RemoteStation1IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the primary unit
				result = soft.SwActivation (RemoteStation1IP[0], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
			else:
				# If secondary is active unit, then activate the primary radio
				result = soft.SwActivation (RemoteStation1IP[0], targetVersion)
				validateStep('Activate the software on the primary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the secondary unit
				result = soft.SwActivation (RemoteStation1IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
		
		else:
			result = soft.SwActivation (TargetRemote1IP, targetVersion)
			validateStep('Activate the software on the Remote1 radio', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 8:	Activate the software on each of the remote2 radios\n\n')
		
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRemote2IP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetRemote2IP)
			if (res[2] == 1):
				# If primary is active unit, then activate the secondary radio
				result = soft.SwActivation (RemoteStation2IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the primary unit
				result = soft.SwActivation (RemoteStation2IP[0], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
			else:
				# If secondary is active unit, then activate the primary radio
				result = soft.SwActivation (RemoteStation2IP[0], targetVersion)
				validateStep('Activate the software on the primary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the secondary unit
				result = soft.SwActivation (RemoteStation2IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
		
		else:
			result = soft.SwActivation (TargetRemote2IP, targetVersion)
			validateStep('Activate the software on the Remote2 radio', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 9:	Activate the software on each of the remote3 radios\n\n')
		
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRemote3IP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetRemote3IP)
			if (res[2] == 1):
				# If primary is active unit, then activate the secondary radio
				result = soft.SwActivation (RemoteStation3IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the primary unit
				result = soft.SwActivation (RemoteStation3IP[0], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
			else:
				# If secondary is active unit, then activate the primary radio
				result = soft.SwActivation (RemoteStation3IP[0], targetVersion)
				validateStep('Activate the software on the primary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the secondary unit
				result = soft.SwActivation (RemoteStation3IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
		
		else:
			result = soft.SwActivation (TargetRemote3IP, targetVersion)
			validateStep('Activate the software on the Remote3 radio', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 10:	Activate the software on each of the Repeater1 radios\n\n')
		
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRepeater1IP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetRepeater1IP)
			if (res[2] == 1):
				# If primary is active unit, then activate the secondary radio
				result = soft.SwActivation (RepeaterStation1IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the primary unit
				result = soft.SwActivation (RepeaterStation1IP[0], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
			else:
				# If secondary is active unit, then activate the primary radio
				result = soft.SwActivation (RepeaterStation1IP[0], targetVersion)
				validateStep('Activate the software on the primary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the secondary unit
				result = soft.SwActivation (RepeaterStation1IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
		
		else:
			result = soft.SwActivation (TargetRepeater1IP, targetVersion)
			validateStep('Activate the software on the Repeater1 radio', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 11:	Activate the software on each of the Repeater2 radios\n\n')
		
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetRepeater2IP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetRepeater2IP)
			if (res[2] == 1):
				# If primary is active unit, then activate the secondary radio
				result = soft.SwActivation (RepeaterStation2IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the primary unit
				result = soft.SwActivation (RepeaterStation2IP[0], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
			else:
				# If secondary is active unit, then activate the primary radio
				result = soft.SwActivation (RepeaterStation2IP[0], targetVersion)
				validateStep('Activate the software on the primary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the secondary unit
				result = soft.SwActivation (RepeaterStation2IP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
		
		else:
			result = soft.SwActivation (TargetRepeater2IP, targetVersion)
			validateStep('Activate the software on the Repeater2 radio', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		STEP ('Step 11:	Activate the software on each of the Base radios\n\n')
		
		# Find if this is a PIPS radio
		result = term.checkIfProtectedUnit (TargetBaseIP)
		if (result[0]):
			# Find the active Unit in this Remote Radio
			res = term.getProtectedActiveUnit(TargetBaseIP)
			if (res[2] == 1):
				# If primary is active unit, then activate the secondary radio
				result = soft.SwActivation (BaseStationIP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the primary unit
				result = soft.SwActivation (BaseStationIP[0], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
			else:
				# If secondary is active unit, then activate the primary radio
				result = soft.SwActivation (BaseStationIP[0], targetVersion)
				validateStep('Activate the software on the primary unit', result, TESTCASE)
				result = ''
				
				# Now activate the software on the secondary unit
				result = soft.SwActivation (BaseStationIP[1], targetVersion)
				validateStep('Activate the software on the secondary unit', result, TESTCASE)
				result = ''
		
		else:
			result = soft.SwActivation (TargetBaseIP, targetVersion)
			validateStep('Activate the software on the Base radio', result, TESTCASE)
			result = ''
			
		print ('#****************************************************************************')
		
	except TestException:
		testResult = 'FAIL'
		pass
	else:
		testResult = 'PASS'
			
	finally:
		
		print ('\n#****************************************************************************')
		print ('#							CLEANUP SECTION		                             ')
		print ('#****************************************************************************')
		
		for i in range (0,len(TargetRadioIP)):
			# ******************************************************************
			STEP ('CLEANUP:	Restore the DUTs to User Defaults\n\n')
			
			result = maint.restoreUserDefaults (TargetRadioIP[i], 1)
			validateStep('Restoring User Defaults on %s\n\n' %TargetRadioIP[i], result, TESTCASE)
			
			result = ''
	print ('#****************************************************************************')
	print ('#					END OF TEST CASE                                         ')
	print ('#****************************************************************************')
	finish (t1, TESTCASE, testResult)
def SimpleTest_001():
    try:
        # log current time
        t1 = time.localtime()
            
        # oids = {
        # 'REBOOT' : '1.3.6.1.4.1.14817.7.4.1.1.8.1.1.0'
        # }

        TESTCASE = 'T10001'
        DSlogName = str(TESTCASE+'stepLvSmryLog.log')
        DSlog = open(DSlogName, 'a')
        # Define the variables to be used in the test case
        RadioIP = glob.Configs['TargetRadioIP']
        BaseStationIP = glob.Configs['BaseStationRadioIP']
        RemoteStationIP = glob.Configs['RemoteIPList']
        baseTermOpMode = 1
        remoteOperMode = 3
        etherMode = 2
        dut1_TxFreq = dut2_RxFreq = 444125000
        dut1_RxFreq = dut2_TxFreq = 450125000
        modulationType = 25
        mtuSize = 1500
        baudRate = 38400
        flowCtrl = 1
        sender = 1
        receiver = 2
        rtscts = 1
        port = 'COM1'
        srlTester = serialTester(port)
        
        # Log Test Case Header
        print('TESTCASE #T10001\n')
        DtilLog = open(glob.DlogName, 'a')
        DtilLog.write("<p>\n")
        log(DtilLog,"===============================================================\n", False, 'RED', 5)
        log(DtilLog,"TESTCASE %s\n\n"%TESTCASE, False, 'RED', 5)
        # DtilLog.close()

        print ('#****************************************************************************')
        print ('#							START OF TEST CASE                               ')
        print ('#****************************************************************************')
        print ('Step 1:	Configure DUT1 Radio as Base Station')

        STEP ("Step 1:	Configure DUT1 Radio as Base Station\n\n1")
        result = term.setTerminalOperMode(BaseStationIP, baseTermOpMode, etherMode)
        validateStep('Configure DUT1 Radio as Base Station\n\n', result, DSlog, TESTCASE)
        
        result = ''
            
    finally:
        # print ('#****************************************************************************')
        # print ('#					CLEANUP OF TEST CASE                                         ')
        # print ('#****************************************************************************')
        print ('cleanup')
        # result = maint.restoreUserDefaults (RemoteStationIP, 1)
        # validateStep('Restoring User Defaults on DUT2\n\n', result, DSlog, TESTCASE)
        
        # result = ''
        
        # result = maint.restoreUserDefaults (BaseStationIP, 1)
        # validateStep('Restoring User Defaults on DUT1\n\n', result, DSlog, TESTCASE)
        
        # result = ''
    print ('#****************************************************************************')
    print ('#					END OF TEST CASE                                         ')
    print ('#****************************************************************************')
    finish (t1, TESTCASE, DSlogName)
    # finish(t1)