예제 #1
0
def setRadioDataCompresssion(ipAddr, dataCompression):
	result = ''

	radio = handler (ipAddr, 161)

	# Setting the Antenna port configuration on the Radio
	sys.stdout.write("\rSetting the IP Data Compression on the Radio")
	sys.stdout.flush()

	_dataCompression = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathDataCompressionRatio', 1, dataCompression)
	if(_dataCompression[0]):
		result+=str(_dataCompression[1])
		
	else:
		result+=str(_dataCompression[1])
		sys.stdout.write("\rSetting IP Data Compression Ratio Parameter..Error\n")
		sys.stdout.flush()
		return (_dataCompression[0], result)
		
	# Validate the settings
	valid = True

	_dataCompression = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathDataCompressionRatio', 1)
	if (_dataCompression[3] == dataCompression): pass
	else:
		valid = False
		result+='Radio Data Compression Ratio configuration unsuccessful. '
		
	return (valid, result)
예제 #2
0
def enableDisableSerialPort (ipAddr, index, mode=1):
	result = ''

	radio = handler (ipAddr, 161)

	# Setting the Transmitter Settings on the Radio
	sys.stdout.write("\rSetting up the serial port on the Radio")
	sys.stdout.flush()

	# Set the mode
	_mode = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigCommissioned', index, mode)
	if(_mode[0]):
		pass
		
	else:
		result+=str(_mode[1])
		sys.stdout.write("\rSetting serial port mode Parameter..Error\n")
		sys.stdout.flush()
		return (_mode[0], result)
		
	# Validate the settings
	valid = True

	_mode = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigCommissioned', index)
	if (_mode[3] == mode): pass
	else:
		valid = False
		result+='Serial Port Mode configuration unsuccessful. '
		return (valid, result)
		
	return (valid, result)
def saveUserDefaults (ipAddr, value):
    result = ''
    
    radio = handler (ipAddr, 161)

    # Saving the user defaults
    sys.stdout.write("\rSaving the user defaults")
    sys.stdout.flush()
    
    saveUsrDflts = radio.setObject(community, 'APRISASR-4RF-MIB', 'mainSaveUserDefaults', 0, value)
    # saveUsrDflts = radio.setObjectOid(community, oids['SAVEUSRDFLT'], value)
    if(saveUsrDflts[0]):
        result+=str(saveUsrDflts[1])
        
    else:
        result+=str(saveUsrDflts[1])
        sys.stdout.write("\rCould not Save User Defaults on the DUT..Error\n")
        sys.stdout.flush()
        return (saveUsrDflts[0], result)
        
    # Wait for 10 secs for the radio to save the defaults
    time.sleep(40)
    
    # saveUsrDfltValue = radio.getObject(community, 'APRISASR-4RF-MIB', 'mainSaveUserDefaults', 0)
    saveUsrDfltValue = radio.getObjectOid(community, oids['SAVEUSRDFLT'])
    print ('SaveUserDefaultValue : %s\n' %saveUsrDfltValue)

    return (True, result)
예제 #4
0
def setRxSettings (ipAddr, rxFrequency=935125000):
    result = ''

    radio = handler (ipAddr, 161)

    # Setting the Receiver Settings on the Radio
    sys.stdout.write("\rSetting Receiver Settings on the Radio")
    sys.stdout.flush()

    # Set the Receiver Frequency
    rcvrFrequency = radio.setObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigFrequencyRx', 0, rxFrequency)
    # rcvrFrequency = radio.setObjectOid (community, oids['RXFREQUENCY'], rxFrequency)
    if(rcvrFrequency[0]):
        pass
        
    else:
        result+=str(rcvrFrequency[1])
        sys.stdout.write("\rSetting Receiver Frequency Parameters..Error\n")
        sys.stdout.flush()
        return (rcvrFrequency[0], result)
        
    # Validate the settings
    valid = True

    # rxFreqVal = radio.getObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigFrequencyRx', 0)
    rxFreqVal = radio.getObjectOid (community, oids['RXFREQUENCY'])
    if (rxFreqVal[3] == rxFrequency): pass
    else:
        valid = False
        result+='Rx Frequency configuration unsuccessful. '
        
    return (valid, result)
예제 #5
0
def setModemMode(ipAddr, modemMode=39):
	result = ''

	radio = handler (ipAddr, 161)

	# Setting the Modem Mode on the Radio
	sys.stdout.write("\rSetting Modem Mode on the Radio")
	sys.stdout.flush()

	modMode = radio.setObject (community, 'UNITCONFIG-4RF-MIB', 'unitConfigExtModemMode', 1, modemMode)
	if(modMode[0]):
		pass
		
	else:
		result+=str(modMode[1])
		sys.stdout.write("\rSetting Receiver Frequency Parameters..Error\n")
		sys.stdout.flush()
		return (modMode[0], result)
		
	# Validate the settings
	valid = True

	modMode = radio.getObject (community, 'UNITCONFIG-4RF-MIB', 'unitConfigExtModemMode', 1)
	if (modMode[3] == modemMode): pass
	else:
		valid = False
		result+='Modem Mode configuration unsuccessful. '
		
	return (valid, result)
예제 #6
0
def setRadioChannelSize(ipAddr, chanSize):
	result = ''

	radio = handler (ipAddr, 161)

	# Setting the Modem Mode on the Radio
	sys.stdout.write("\rSetting the Channel Size on the Radio")
	sys.stdout.flush()

	channelSize = radio.setObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigChannelSize', 0, chanSize)
	if(channelSize[0]):
		result+=str(channelSize[1])
		
	else:
		result+=str(channelSize[1])
		sys.stdout.write("\rSetting Channel Size Parameter..Error\n")
		sys.stdout.flush()
		return (channelSize[0], result)
		
	# Validate the settings
	valid = True

	channelSize = radio.getObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigChannelSize', 0)
	if (channelSize[3] == chanSize): pass
	else:
		valid = False
		result+='Radio channel size configuration unsuccessful. '
		
	return (valid, result)
예제 #7
0
def setRadioAnntenaPortConfig(ipAddr, antennaPortConfig):
	result = ''

	radio = handler (ipAddr, 161)

	# Setting the Antenna port configuration on the Radio
	sys.stdout.write("\rSetting the Antenna port configuration on the Radio")
	sys.stdout.flush()

	antennaConfig = radio.setObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigAntennaPort', 0, antennaPortConfig)
	if(antennaConfig[0]):
		result+=str(antennaConfig[1])
		
	else:
		result+=str(antennaConfig[1])
		sys.stdout.write("\rSetting Antenna port configuration Parameter..Error\n")
		sys.stdout.flush()
		return (antennaConfig[0], result)
		
	# Validate the settings
	valid = True

	antennaConfig = radio.getObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigAntennaPort', 0)
	if (antennaConfig[3] == antennaPortConfig): pass
	else:
		valid = False
		result+='Radio Antenna port configuration unsuccessful. '
		
	return (valid, result)
예제 #8
0
def setTerminalOperMode(ipAddr,termOperMode=3, etherOperMode=1):
    result = ''
    radio = handler (ipAddr, 161)

    # Setting the DUT1 Radio Operating Mode
    sys.stdout.write("\rSetting DUT1 Operating Mode")
    sys.stdout.flush()

    terminalOperMode = radio.setObject(community, 'UNITCONFIG-4RF-MIB', 'unitConfigOperatingMode', 1, termOperMode)
    # terminalOperMode = radio.setObjectOid(community, oids['TERMOPERMODE'], termOperMode)
    if(terminalOperMode[0]):
        # pass
        result+=str(terminalOperMode[1])
        result+='\n'
    else:
        result+=str(terminalOperMode[1])
        result+='\n'
        sys.stdout.write("\rSetting Operating Mode Parameters..Error\n")
        sys.stdout.flush() 
        return (terminalOperMode[0], result)
        
    # Set the ether operating mode
    ethernetOperMode = radio.setObject(community, 'UNITCONFIG-4RF-MIB', 'unitConfigEthernetMode', 1, etherOperMode)
    # ethernetOperMode = radio.setObjectOid(community, oids['ETHERMODE'], etherOperMode)
    if(ethernetOperMode[0]):
        # pass
        result+=str(ethernetOperMode[1])
        result+='\n'
    else:
        result+=str(ethernetOperMode[1])
        result+='\n'
        sys.stdout.write("\rSetting Ethernet Operating Mode Parameters..Error\n")
        sys.stdout.flush()
        return (ethernetOperMode[0], result)

    # Validate the settings
    valid = True
    terminalOperMode = radio.getObject(community, 'UNITCONFIG-4RF-MIB', 'unitConfigOperatingMode', 1)
    # terminalOperMode = radio.getObjectOid(community, oids['TERMOPERMODE'])
    print ('TERM OPER MODE: %s' %terminalOperMode[3])
    if (terminalOperMode[3] == termOperMode):
        pass
    else:
        valid = False
        result+='Terminal Operating Mode configuration unsuccessful. '
        return (valid, result)
        
    ethernetOperMode = radio.getObject(community, 'UNITCONFIG-4RF-MIB', 'unitConfigEthernetMode', 1)
    # ethernetOperMode = radio.getObjectOid(community, oids['ETHERMODE'])
    print ('ETHER OPER MODE: %s' %ethernetOperMode[3])
    if (ethernetOperMode[3] == etherOperMode):
        pass
    else:
        valid = False
        result+='Ethernet Mode configuration unsuccessful. '
        return (valid, result)
    
    return (valid, result)
예제 #9
0
def getActivePartnerIpAddress (ipAddr):
	result = ''
	radio = handler (ipAddr, 161)
	ipaddr = []
	radioIpAddr = []
	radiIp = []
	dot = '.'
	# Getting the active and partner IP Address
	sys.stdout.write("\rGetting the active and partner IP address")
	sys.stdout.flush()

	activeIpAddr = radio.getObject(community, 'IPCONFIG-4RF-MIB', 'ipConfigAddr', 1)
	if(activeIpAddr[0]):
		# pass
		result+=str(activeIpAddr[1])
		result+='\n'
		radIp = activeIpAddr[1]
		radiIp = radIp.strip().split(' ')
		radIp = radiIp[2]
		ipaddr.append(str (int ((radIp[2:4]), 16)))
		ipaddr.append(str (int ((radIp[4:6]), 16)))
		ipaddr.append(str (int ((radIp[6:8]), 16)))
		ipaddr.append(str (int ((radIp[8:10]), 16)))
		ip = tuple (ipaddr)
		rad = dot.join(ip)
		radioIpAddr.append(rad)
	else:
		result+=str(activeIpAddr[1])
		result+='\n'
		radioIpAddr = radioIpAddr + str(activeIpAddr[3])
		sys.stdout.write("\Getting the active radio IP Address..Error\n")
		sys.stdout.flush() 
		return (activeIpAddr[0], result, radioIpAddr)
		
	# Get the protection partner IP Address
	partnerIpAddr = radio.getObject(community, 'PROTCONFIG-4RF-MIB', 'protConfigProtectionPartner',1)
	# print ('PARTNER IP ADDR: %s' %partnerIpAddr)
	radIp = partnerIpAddr[1]
	radiIp = radIp.strip().split(' ')
	radIp = radiIp[2]
	print ('PARTNER IP ADDR:')
	print (radIp)
	if(partnerIpAddr[0]):
		# pass
		result+=str(partnerIpAddr[1])
		result+='\n'
		radioIpAddr.append(radIp)
	else:
		result+=str(partnerIpAddr[1])
		result+='\n'
		sys.stdout.write("\Getting the Partner radio IP Address..Error\n")
		sys.stdout.flush() 
		return (partnerIpAddr[0], result, radioIpAddr)
		
	return (True, result, radioIpAddr)
예제 #10
0
def setTxSettings (ipAddr, txFrequency=944125000, txPower=340):
    result = ''

    radio = handler (ipAddr, 161)

    # Setting the Transmitter Settings on the Radio
    sys.stdout.write("\rSetting Transmitter Settings on the Radio")
    sys.stdout.flush()

    # Set the transmitter Frequency
    transFrequency = radio.setObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigFrequencyTx', 0, txFrequency)
    # transFrequency = radio.setObjectOid (community, oids['TXFREQUENCY'], txFrequency)
    if(transFrequency[0]):
        pass
        
    else:
        result+=str(transFrequency[1])
        sys.stdout.write("\rSetting Transmitter Frequency Parameters..Error\n")
        sys.stdout.flush()
        return (transFrequency[0], result)

    # Set the Transmitter Power
	
    transPower = radio.setObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigPowerOutputSet', 0, txPower)
    # transPower = radio.setObjectOid (community, oids['POWEROUTPUT'], txPower)
    if(transPower[0]):
        pass
        
    else:
        result+=str(transPower[1])
        sys.stdout.write("\rSetting Transmitter Power Parameters..Error\n")
        sys.stdout.flush()
        return (transPower[0], result)
        
    # Validate the settings
    valid = True

    txFreqVal = radio.getObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigFrequencyTx', 0)
    # txFreqVal = radio.getObjectOid (community, oids['TXFREQUENCY'])
    if (txFreqVal[3] == txFrequency): pass
    else:
        valid = False
        result+='Tx Frequency configuration unsuccessful. '
        
    # txPwrVal = radio.getObject (community, 'RFCONFIG-4RF-MIB', 'rfConfigPowerOutputSet', 0)
    txPwrVal = radio.getObjectOid (community, oids['POWEROUTPUT'])
    if (txPwrVal[3] == txPower): pass
    else:
        valid = False
        result+='Tx Power configuration unsuccessful. '
        
    return (valid, result)
예제 #11
0
def setModemConfig (ipAddr, enrMode=0, modType=14):
	result = ''

	radio = handler (ipAddr, 161)

	# Setting the Receiver Settings on the Radio
	sys.stdout.write("\rSetting Modem COnfiguration on the Radio")
	sys.stdout.flush()

	# Set the Enhanced Noise Rejection Mode
	enhNoiseRejMode = radio.setObject (community, 'RFCONFIG-4RF-MIB', 'rfCfgRfMode', 1, enrMode)
	if(enhNoiseRejMode[0]):
		result+=str(enhNoiseRejMode[1])
		
	else:
		result+=str(enhNoiseRejMode[1])
		sys.stdout.write("\rSetting Enhanced Noise Rejection Mode..Error\n")
		sys.stdout.flush()
		return (enhNoiseRejMode[0], result)

	# Set the Modulation Type
	modulationType = radio.setObject (community, 'MODEMCONFIG-4RF-MIB', 'modemConfigModulationType', 1, modType)
	# modulationType = radio.setObjectOid (community, oids['MODTYPE'], modType)
	if(modulationType[0]):
		pass
		
	else:
		result+=str(modulationType[1])
		sys.stdout.write("\rSetting Receiver Frequency Parameters..Error\n")
		sys.stdout.flush()
		return (modulationType[0], result)
		
	# Validate the settings
	valid = True

	enhNoiseRejMode = radio.getObject (community, 'RFCONFIG-4RF-MIB', 'rfCfgRfMode', 1)
	if (enhNoiseRejMode[3] == enrMode): pass
	else:
		valid = False
		result+='Enhanced Noise Rejection Mode configuration unsuccessful. '

	modTypeVal = radio.getObject (community, 'MODEMCONFIG-4RF-MIB', 'modemConfigModulationType', 1)
	# modTypeVal = radio.getObjectOid (community, oids['MODTYPE'])
	if (modTypeVal[3] == modType): pass
	else:
		valid = False
		result+='Modulation Type configuration unsuccessful. '
		
	return (valid, result)
예제 #12
0
def setRadioTrafficSettings (ipAddr, nwTrafficType=3, bulkDataTrnsfrRate=1):
	result = ''

	radio = handler (ipAddr, 161)

	# Setting the Channel Traffic settings on the Radio
	sys.stdout.write("\rSetting the Channel Traffic Settings on the Radio")
	sys.stdout.flush()

	bulkDataTransferRate = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathFileTransferRate', 1, bulkDataTrnsfrRate)
	if(bulkDataTransferRate[0]):
		result+=str(bulkDataTransferRate[1])
		
	else:
		result+=str(bulkDataTransferRate[1])
		sys.stdout.write("\rChannel Traffic Settings..Error\n")
		sys.stdout.flush()
		return (bulkDataTransferRate[0], result)
		
	# Set the network Traffic Settings
	networkTraffType = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathExtTrafficType', 1, nwTrafficType)
	if(networkTraffType[0]):
		result+=str(networkTraffType[1])
		
	else:
		result+=str(networkTraffType[1])
		sys.stdout.write("\rChannel Traffic Settings..Error\n")
		sys.stdout.flush()
		return (networkTraffType[0], result)
		
	# Validate the settings
	valid = True

	bulkDataTransferRate = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathFileTransferRate', 1)
	if (bulkDataTransferRate[3] == bulkDataTrnsfrRate): pass
	else:
		valid = False
		result+='Radio channel size configuration unsuccessful. '
		return (valid, result)
		
	networkTraffType = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathExtTrafficType', 1)
	if (networkTraffType[3] == nwTrafficType): pass
	else:
		valid = False
		result+='Radio channel size configuration unsuccessful. '
		return (valid, result)

	return (valid, result)
예제 #13
0
def setSerialDataStream (ipAddr, streamMode, packetFiltering=1):
	result = ''
	radio = handler (ipAddr, 161)

	# Setting the Channel Traffic settings on the Radio
	sys.stdout.write("\rSetting the Access Scheme on the Radio")
	sys.stdout.flush()
	
	strMode = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathSerialDataStreamMode', 1, streamMode)
	if(strMode[0]):
		result+=str(strMode[1])
		
	else:
		result+=str(strMode[1])
		sys.stdout.write("\rSerial Data Stream Mode Setting..Error\n")
		sys.stdout.flush()
		return (strMode[0], result)
		
	
	pktFiltering = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathPacketFiltering', 1, packetFiltering)
	if(pktFiltering[0]):
		result+=str(pktFiltering[1])
		
	else:
		result+=str(pktFiltering[1])
		sys.stdout.write("\rPacket Filtering setting..Error\n")
		sys.stdout.flush()
		return (pktFiltering[0], result)
		
	# Validate the settings
	valid = True
	
	strMode = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathSerialDataStreamMode', 1)
	if (strMode[3] == streamMode): pass
	else:
		valid = False
		result+='Serial data stream mode configuration unsuccessful. '
		return (valid, result)
		
	pktFiltering = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathPacketFiltering', 1)	
	if (pktFiltering[3] == packetFiltering): pass
	else:
		valid = False
		result+='Packet Filtering configuration unsuccessful. '
		return (valid, result)
		
	return (valid, result)
예제 #14
0
def setRadioChannelAccessScheme (ipAddr, accessScheme, ackEnabled=2):
	result = ''
	radio = handler (ipAddr, 161)

	# Setting the Channel Traffic settings on the Radio
	sys.stdout.write("\rSetting the Access Scheme on the Radio")
	sys.stdout.flush()
	
	accScheme = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathAccessScheme', 1, accessScheme)
	if(accScheme[0]):
		result+=str(accScheme[1])
		
	else:
		result+=str(accScheme[1])
		sys.stdout.write("\rAccess Scheme setting..Error\n")
		sys.stdout.flush()
		return (accScheme[0], result)
		
	ackEnable = radio.setObject (community, 'APRISASR-4RF-MIB', 'chAccAckEnabled', 0, ackEnabled)
	if(ackEnable[0]):
		result+=str(ackEnable[1])
		
	else:
		result+=str(ackEnable[1])
		sys.stdout.write("\rAccess Scheme setting..Error\n")
		sys.stdout.flush()
		return (ackEnable[0], result)
		
	# Validate the settings
	valid = True
	
	accScheme = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathAccessScheme', 1)
	if (accScheme[3] == accessScheme): pass
	else:
		valid = False
		result+='Channel Access Scheme configuration unsuccessful. '
		return (valid, result)
		
	ackEnable = radio.getObject (community, 'APRISASR-4RF-MIB', 'chAccAckEnabled', 0)	
	if (ackEnable[3] == ackEnabled): pass
	else:
		valid = False
		result+='Channel Access Ack configuration unsuccessful. '
		return (valid, result)
		
	return (valid, result)
예제 #15
0
def setSoftwareManualLock (ipAddr, manualLock, activeUnit=1):
	result = ''

	radio = handler (ipAddr, 161)

	# Restoring the user defaults
	sys.stdout.write("\rSetting the Software Manual Lock")
	sys.stdout.flush()
	
	_manualLock = radio.setObject(community, 'PROTFAULT-4RF-MIB', 'protFaultManualLock', 0, manualLock)
	if(_manualLock[0]):
		result+=str(_manualLock[1])
        
	else:
		result+=str(_manualLock[1])
		sys.stdout.write("\rCould not set the Software ManualLock on the DUT..Error\n")
		sys.stdout.flush()
		return (_manualLock[0], result)
		
	_activeUnit = radio.setObject(community, 'PROTFAULT-4RF-MIB', 'protFaultManualActiveUnit', 0, activeUnit)
	if(_activeUnit[0]):
		result+=str(_activeUnit[1])
		
	else:
		result+=str(_activeUnit[1])
		sys.stdout.write("\rCould not set the Active Unit on the DUT..Error\n")
		sys.stdout.flush()
		return (_activeUnit[0], result)
		
	# get the Values and verify if the parameters were set correctly.
	valid = True

	_manualLock = radio.getObject(community, 'PROTFAULT-4RF-MIB', 'protFaultManualLock', 0)
	if (_manualLock[3] == manualLock): pass
	else:
		valid = False
		result+='Setting Software Manual Lock unsuccessful. '
		
	_activeUnit = radio.getObject(community, 'PROTFAULT-4RF-MIB', 'protFaultManualActiveUnit', 0)
	if (_activeUnit[3] == activeUnit): pass
	else:
		valid = False
		result+='Setting the active unit unsuccessful. '
		
	return (valid, result)
예제 #16
0
def getProtectedActiveUnit (ipAddr):
	result = ''
	radio = handler (ipAddr, 161)
	activeUnit = 0
	# Checking the active unit of a protected radio
	sys.stdout.write("\rChecking the active unit of a protected radio")
	sys.stdout.flush()
	
	valid = True
	actUnit = radio.getObject(community, 'APRISASR-VIEW-4RF-MIB', 'termSumProtectionCurrentActiveUnit', 0)
	print ('Active Unit: %s' %actUnit[3])
	if (actUnit[0]):
		activeUnit = int(actUnit[3])
	else:
		valid = False
		result+='Radio is a Protected Unit. '
		return (valid, result, activeUnit)
		
	return (valid, result, activeUnit)
예제 #17
0
def checkIfProtectedUnit (ipAddr):
	result = ''
	radio = handler (ipAddr, 161)

	# Checking if the radio is a protected Unit
	sys.stdout.write("\rChecking if the radio is a protected Unit")
	sys.stdout.flush()
	
	valid = False

	protected = radio.getObject(community, 'APRISASR-VIEW-4RF-MIB', 'termSumProtectionType', 0)
	print ('Protection Type: %s' %protected[3])
	if (protected[3] == 0):
		valid = False
		result+='Radio is not a Protected Unit. '
	else:
		valid = True
		result+='Radio is a Protected Unit. '
		
	return (valid, result)
예제 #18
0
def rebootRadio (ipAddr, value):
    result = ''
    radio = handler (ipAddr, 161)

    # Setting the DUT1 Radio Operating Mode
    sys.stdout.write("\rRebooting the radio")
    sys.stdout.flush()

    reboot = radio.setObject(community, 'APRISASR-4RF-MIB', 'mainReboot', 0, value)
    # reboot = radio.setObjectOid(community, oids['REBOOT'], value)
    if(reboot[0]):
        pass
        
    else:
        result+=str(reboot[1])
        sys.stdout.write("\rCould not reboot the DUT..Error\n")
        sys.stdout.flush()
        return (reboot[0], result)
        
    # Wait for 40 secs for the radio to come up
    time.sleep(40)

    return (True, result)
예제 #19
0
def BaseDistribute(ipAddr):
    # Parameters
    radio = handler(ipAddr, 161)
    basestationIP = ipAddr
    basestationIPList = basestationIP.strip().split('.')

    result = ''

    sys.stdout.write("\rSetting File Distribution Parameters..")
    sys.stdout.flush()
 
    # Set File Transfer Parameters
    # From Source
    direction = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferDirection', 1, 1)
    if(direction[0]):
        result+=str(direction[1])
        result+='\n'
    else:
        result+=str(direction[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (direction[0], result)
    
    # Software Pack
    filename = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferFileName', 1, 'Software Pack')
    if(filename[0]):
        result+=str(filename[1])
        result+='\n'
    else:    
        result+=str(filename[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (filename[0], result)
    
    
    # Protocol: OTA
    protocol = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferProtocol', 1, 3)
    if(protocol[0]):
        result+=str(protocol[1])
        result+='\n'
    else:    
        result+=str(protocol[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (protocol[0], result)
    
    
    # Base Station IP 
    srcaddr = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferSourceAddress', 1, univ.OctetString((int(basestationIPList[0]),int(basestationIPList[1]),int(basestationIPList[2]),int(basestationIPList[3]))))
    if(srcaddr[0]):
        result+=str(srcaddr[1])
        result+='\n'
    else:    
        result+=str(srcaddr[1])
        sys.stdout.write("\rSetting File Distribution Parameters..Error\n")
        sys.stdout.flush()
        return (srcaddr[0], result)

    # finished parameter setting
    sys.stdout.write("\rSetting File Distribution Parameters..Done\n")
    sys.stdout.flush()
    

    # Send start command and polling progress

    # fileTransferControl:              start	
    start = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferControl', 1, 1)
    if(start[0]):
        result+=str(start[1])
        result+='\n'
    else:    
        result+=start[1]
        sys.stdout.write("\rStarting Distribution..Error\n")
        sys.stdout.flush()
        return (start[0], result)


    # Show Progress
    while(True):
        progress = radio.getObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferProgress', 1)
        status = radio.getObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferControl', 1)
        sys.stdout.write("\rPushing File..%s%%"%(str(progress[3])))
        sys.stdout.flush()
        if((int(status[3]) is 13)):
            if(int(progress[3]) is 0):
                result+="\nSoftware version already exist in receiver radio\n"
                sys.stdout.write("\rSoftware version already exist in receiver radio\n")
                sys.stdout.flush()
            break
        elif((int(status[3]) is 14) or (int(status[3]) is 15) or (int(status[3]) is 16) or (int(status[3]) is 17) or (int(status[3]) is 19)):
            break
        else:
            pass
        time.sleep(1)

    sys.stdout.write("\n\n\rTransfer Control: %s\n"%ctrlStatus[int(status[3])])
    sys.stdout.flush()
    result+="Transfer Control: "+ctrlStatus[int(status[3])]+"\n"
	
    # return: (parameter setting result, final control status(for diagnosis, success/fail)
    return ((int(status[3])==13), result)
예제 #20
0
def InterUnitTransfer(ipAddr):
	radio = handler (ipAddr, 161)

	# Parameters
	
	result = ''

	sys.stdout.write("\rSetting File Transfer Parameters..")
	sys.stdout.flush()

	# Software Pack
	filename = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferFileName', 1, 'Software Pack')
	if(filename[0]):
		result+=str(filename[1])
		result+='\n'
	else:    
		result+=str(filename[1])
		sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
		sys.stdout.flush()
		return (filename[0], result)

	protocol = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferProtocol', 1, 5)
	if(protocol[0]):
		result+=str(protocol[1])
		result+='\n'
	else:    
		result+=str(protocol[1])
		sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
		sys.stdout.flush()
		return (protocol[0], result)
		
		
	# finished parameter setting
	sys.stdout.write("\rSetting File Transfer Parameters..Done\n")
	sys.stdout.flush()


	# Send start command and poll progress

	# fileTransferControl:              start	
	start = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferControl', 1, 1)
	if(start[0]):
		result+=str(start[1])
		result+='\n'
	else:    
		result+=start[1]
		sys.stdout.write("\rStarting Transfer..Error\n")
		sys.stdout.flush()
		return (start[0], result)


	# Show Progress
	while(True):
		progress = radio.getObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferProgress', 1)
		status = radio.getObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferControl', 1)
		sys.stdout.write("\rTransfering File..%s%%"%(str(progress[3])))
		sys.stdout.flush()
		if(int(status[3]) is 13):
			break
		elif((int(status[3]) is 10) or (int(status[3]) is 14) or (int(status[3]) is 15) or (int(status[3]) is 16) or (int(status[3]) is 17) or (int(status[3]) is 19)):
			break
		else:
			pass
		time.sleep(1)

	sys.stdout.write("\n\n\rTransfer Control: %s\n"%ctrlStatus[int(status[3])])
	sys.stdout.flush()
	result+="\nTransfer Control: "+ctrlStatus[int(status[3])]+"\n"
	# return: (parameter setting result, final control status(for diagnosis, success/fail)
	return ((int(status[3])==13), result)
예제 #21
0
def setRadioAdvancedSettings (ipAddr, dfltPktTtl=0, serialPktTtl=0,enetPktTtl=0):
	result = ''
	radio = handler (ipAddr, 161)

	# Setting the Channel Traffic settings on the Radio
	sys.stdout.write("\rSetting the Advanced Settings on the Radio")
	sys.stdout.flush()

	defaultPktTtl = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathPacketTtl', 1, dfltPktTtl)
	print ('\n******DEFLT TTL**************\n')
	print (defaultPktTtl)
	if(defaultPktTtl[0]):
		result+=str(defaultPktTtl[1])
		
	else:
		result+=str(defaultPktTtl[1])
		sys.stdout.write("\rDefault Packet time-to-live setting..Error\n")
		sys.stdout.flush()
		return (defaultPktTtl[0], result)

	# Set the serial packet TTL value
	serialPacketTtl = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathExtSerialPacketTtl', 1, serialPktTtl)
	print ('\n******SERIAL TTL**************\n')
	print (serialPacketTtl)
	if(serialPacketTtl[0]):
		result+=str(serialPacketTtl[1])
		
	else:
		result+=str(serialPacketTtl[1])
		sys.stdout.write("\rSerial Packet time-to-live setting..Error\n")
		sys.stdout.flush()
		return (serialPacketTtl[0], result)
		
	# Set the Ethernet packet TTL value
	enetPacketTtl = radio.setObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathExtEthernetPacketTtl', 1, enetPktTtl)
	print ('\n******ENET TTL**************\n')
	print (enetPacketTtl)
	if(enetPacketTtl[0]):
		result+=str(enetPacketTtl[1])
		
	else:
		result+=str(enetPacketTtl[1])
		sys.stdout.write("\Ethernet Packet time-to-live setting..Error\n")
		sys.stdout.flush()
		return (enetPacketTtl[0], result)
		
	# Validate the settings
	valid = True

	defaultPktTtl = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathPacketTtl', 1)
	if (defaultPktTtl[3] == dfltPktTtl): pass
	else:
		valid = False
		result+='Default Packet time-to-live configuration unsuccessful. '
		return (valid, result)
		
	serialPacketTtl = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathExtSerialPacketTtl', 1)
	if (serialPacketTtl[3] == serialPktTtl): pass
	else:
		valid = False
		result+='Serial Packet time-to-live configuration unsuccessful. '
		return (valid, result)
		
	enetPacketTtl = radio.getObject (community, 'TRAFFCONFIG-4RF-MIB', 'traffConfigPathExtEthernetPacketTtl', 1)
	if (enetPacketTtl[3] == enetPktTtl): pass
	else:
		valid = False
		result+='Ethernet Packet time-to-live configuration unsuccessful. '
		return (valid, result)

	return (valid, result)
예제 #22
0
def SwActivation(ipAddr, targetVersion):

	#parameters
	radio = handler(ipAddr, 161)

	# detailed result
	result = ''
	availablePack = 0

	# 0. Before activating any software, check current software on the radio to see if an activation is necessary
	CurrVer = radio.getObject(community, 'APRISASR-4RF-MIB', 'upgradeActiveSoftwareBuildNumber', 0)
	if(CurrVer[0]):
		if (str(CurrVer[3])==targetVersion):
			# result+='Currently Running Software Version: '+CurrVer[3]+"\n"
			result = 'Currently Running Software Version: %s\n' %CurrVer[3]
			return (True, result)
		else:    
			# 1. chech sw pack availability
			# take note of version, if not available, exit here with error msg

			# Check software pack version
			PrevVer = radio.getObject(community, 'APRISASR-4RF-MIB', 'upgradeStandbySoftwareBuildNumber', 0)
			if(PrevVer[0]):
				if (str(PrevVer[3])==targetVersion):
					# result+='Previous Software Pack Version: '+PrevVer[3]+"\n"
					result = 'Previous Software Pack Version: %s\n' %PrevVer[3]
					print('Previous Software Pack Version: '+PrevVer[3]+"\n")
					availablePack = 2
				else:
					swPackVer = radio.getObject(community, 'SWMANAGER-4RF-MIB', 'swManagerVersion', 3)
					if (targetVersion.startswith(str(swPackVer[3]))):
						# result+='Available Software Pack Version: '+swPackVer[3]+"\n"
						result = 'Available Software Pack Version: %s\n' %swPackVer[3]
						print('Available Software Pack Version: '+swPackVer[3]+"\n")
						availablePack = 3
					else:
						result = "Existing Software Packs on Radio does not match target software version of %s\n"%targetVersion
						print("Existing Software Packs on Radio does not match target software version of %s\n"%targetVersion)
						return (False, result)       
			else:
				# result+="\rError Could not Check Existing Software\n"
				result = '\rError Could not Check Existing Software\n'
				print("\rError Could not Check Existing Software \n")
				return (False, result)

			# 2. start activision, snmpSet available to active, log object setting result,
			# shouldnt be any error here but log just in case

			if (availablePack==3):
				swPackAct = radio.setObject(community, 'SWMANAGER-4RF-MIB', 'swManagerControl', 3, 1)
				if(swPackAct[0]):
					#result+=rvoids[swPackAct[2]]+': '+swManagerControl[int(swPackAct[3])]+'\n'+swPackAct[1]+"\n\n"
					print('Activation Initiated\n')
					# return (True, result)
				else:
					# result+='\rError Could not initiate activation\n'+str(swPackAct[1])
					result = '\rError Could not initiate activation  %s \n' %str(swPackAct[1])
					print("\rError Could not initiate activation\n")
					return (swPackAct[0], result)
			elif (availablePack==2):
				prevPackAct = radio.setObject(community, 'SWMANAGER-4RF-MIB', 'swManagerControl', 2, 1)
				if(prevPackAct[0]):
					#result+=rvoids[prevPackAct[2]]+': '+swManagerControl[int(prevPackAct[3])]+'\n'+prevPackAct[1]+"\n\n"
					print('Activation Initiated\n')
					# return (True, result)
				else:
					# result+='\rError Could not initiate activation\n'+str(prevPackAct[1])
					result = '\rError Could not initiate activation  %s\n' %str(prevPackAct[1])
					print("\rError Could not initiate activation\n")
					return (prevPackAct[0], result)
			else:
				result = '\rFatal Error \n'
				print('Fatal error\n')
				return (False, result)
	else:
		result = '\rError Could not Check Current Running Software\n'
		print("\rError Could not Check Current Running Software\n")
		return (False, result)

	# wait for radio to respond after activation, keep polling on currswversion and status? verify version and status.
	# if no respond after timeout, return error, if version and status verification failes return error
	# otherwise its a success and return current version and status

	for i in range(0,90):
		currSwVer = radio.getObject(community, 'APRISASR-4RF-MIB', 'upgradeActiveSoftwareBuildNumber', 0)
		print ('Current SW Version: %s' %currSwVer[3])
		if(currSwVer[0]):
			if (str(currSwVer[3]) == targetVersion):
				break
			else:
				pass
		else:
			pass
		time.sleep(10)

	# Timeout, check current sw version again, if we can't get respond of if it still does not match, declare fail
	currSwVer = radio.getObject(community, 'APRISASR-4RF-MIB', 'upgradeActiveSoftwareBuildNumber', 0)
	if(currSwVer[0]):
		if (str(currSwVer[3])==targetVersion):
			# result+='Activition Successful, Current Software Version: '+currSwVer[3]+"\n\n"
			result = 'Activition Successful, Current Software Version:  %s\n' %currSwVer[3]
		else:
			result = '\rActivation Failed.\n'
			return (False, result) 
	else:
		# result = str(currSwVer[1])+"\rCould not retrieve current software version\n"
		result = '\r%s Could not retrieve current software version\n' %str(currSwVer[1])
		print("\rCould not retrieve current software version\n")
		return (currSwVer[0], result)
		

	return(currSwVer[0], result)
예제 #23
0
def serialPortSetup (ipAddr, index, mode=1, mtu=512, baudRate=115200, flowCtrl=0, charLen=8,parity=0, stopBits=1, ifg=35):
    result = ''

    radio = handler (ipAddr, 161)

    # Setting the Transmitter Settings on the Radio
    sys.stdout.write("\rSetting up the serial port on the Radio")
    sys.stdout.flush()

    # Set the mode
    _mode = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigMode', index, mode)
    # _mode = radio.setObjectOid (community, oids['SRLPRTMODE'], mode)
    if(_mode[0]):
        pass
        
    else:
        result+=str(_mode[1])
        sys.stdout.write("\rSetting serial port mode Parameter..Error\n")
        sys.stdout.flush()
        return (_mode[0], result)

    # Set the MTU Size for the serial port
    mtuSize = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigExt1Mtu', index, mtu)
    # mtuSize = radio.setObjectOid (community, oids['MTU'], mtu)
    if(mtuSize[0]):
        pass
        
    else:
        result+=str(mtuSize[1])
        sys.stdout.write("\rSetting serial port MTU size Parameter..Error\n")
        sys.stdout.flush()
        return (mtuSize[0], result)
        
    # Set the baud rate
    _baudRate = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigRate', index, baudRate)
    # _baudRate = radio.setObjectOid (community, oids['BAUDRATE'], baudRate)
    if(_baudRate[0]):
        pass
        
    else:
        result+=str(_baudRate[1])
        sys.stdout.write("\rSetting serial port Baud Rate Parameter..Error\n")
        sys.stdout.flush()
        return (_baudRate[0], result)
        
    # Setting the character length parameter
    characterLen = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigDataBits', index, charLen)
    # characterLen = radio.setObjectOid (community, oids['CHARLEN'], charLen)
    if(characterLen[0]):
        pass
        
    else:
        result+=str(characterLen[1])
        sys.stdout.write("\rSetting serial port Character Length Parameter..Error\n")
        sys.stdout.flush()
        return (characterLen[0], result)
        
    # Setting the Parity
    _parity = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigParity', index, parity)
    # _parity = radio.setObjectOid (community, oids['PARITY'], parity)
    if(_parity[0]):
        pass
        
    else:
        result+=str(_parity[1])
        sys.stdout.write("\rSetting serial port Parity Parameter..Error\n")
        sys.stdout.flush()
        return (_parity[0], result)
        
    #Setting the stop bits
    _stopBits = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigStopBits', index, stopBits)
    # _stopBits = radio.setObjectOid (community, oids['STOPBITS'], stopBits)
    if(_stopBits[0]):
        pass
        
    else:
        result+=str(_stopBits[1])
        sys.stdout.write("\rSetting serial port Stop BIts Parameter..Error\n")
        sys.stdout.flush()
        return (_stopBits[0], result)
        
    # Setting the flow Control
    flowControl = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigFlowControl', index, flowCtrl)
    # flowControl = radio.setObjectOid (community, oids['FLOWCTRL'], flowCtrl)
    if(flowControl[0]):
        pass
        
    else:
        result+=str(flowControl[1])
        sys.stdout.write("\rSetting serial port Flow Control Parameter..Error\n")
        sys.stdout.flush()
        return (flowControl[0], result)
        
    # Setting the inter frame gap parameter
    interFrameGap = radio.setObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigInterframeGap', index, ifg)
    # interFrameGap = radio.setObjectOid (community, oids['IFG'], ifg)
    if(interFrameGap[0]):
        pass
        
    else:
        result+=str(interFrameGap[1])
        sys.stdout.write("\rSetting serial port Inter Frame Gap Parameter..Error\n")
        sys.stdout.flush()
        return (interFrameGap[0], result)

    # Validate the settings
    valid = True

    _mode = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigMode', index)
    # _mode = radio.getObjectOid (community, oids['SRLPRTMODE'])
    if (_mode[3] == mode): pass
    else:
        valid = False
        result+='Serial Port Mode configuration unsuccessful. '
        return (valid, result)
        
    mtuSize = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigExt1Mtu', index)
    # mtuSize = radio.getObjectOid (community, oids['MTU'])
    if (mtuSize[3] == mtu): pass
    else:
        valid = False
        result+='Serial Port MTU Size configuration unsuccessful. '
        return (valid, result)
        
    _baudRate = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigRate', index)
    # _baudRate = radio.getObjectOid (community, oids['BAUDRATE'])
    if (_baudRate[3] == baudRate): pass
    else:
        valid = False
        result+='Serial Port Baud Rate configuration unsuccessful. '
        return (valid, result)
        
    characterLen = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigDataBits', index)
    # characterLen = radio.getObjectOid (community, oids['CHARLEN'])
    if (characterLen[3] == charLen): pass
    else:
        valid = False
        result+='Serial Port Character Length configuration unsuccessful. '
        return (valid, result)
        
    _parity = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigParity', index)
    # _parity = radio.getObjectOid (community, oids['PARITY'])
    if (_parity[3] == parity): pass
    else:
        valid = False
        result+='Serial Port Parity configuration unsuccessful. '
        return (valid, result)
        
    _stopBits = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialAsyncConfigStopBits', index)
    # _stopBits = radio.getObjectOid (community, oids['STOPBITS'])
    if (_stopBits[3] == stopBits): pass
    else:
        valid = False
        result+='Serial Port Stop Bits configuration unsuccessful. '
        return (valid, result)
        
    flowControl = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigFlowControl', index)
    # flowControl = radio.getObjectOid (community, oids['FLOWCTRL'])
    if (flowControl[3] == flowCtrl): pass
    else:
        valid = False
        result+='Serial Port Flow Control configuration unsuccessful. '
        return (valid, result)
        
    interFrameGap = radio.getObject (community, 'SERIALCONFIG-4RF-MIB', 'serialPortConfigInterframeGap', index)
    # interFrameGap = radio.getObjectOid (community, oids['IFG'])
    if (interFrameGap[3] == ifg): pass
    else:
        valid = False
        result+='Serial Port Inter Frame Gap configuration unsuccessful. '
        return (valid, result)
        
    return (valid, result)
예제 #24
0
def getSerialPortTxRxPkts (ipAddr, portNum):
	result = ''
	pktCounts = []
	rfInPktsErrIndex = 40
	rfOutDropPktsIndex = 42
	rfInDropFiltPktsIndex = 44
	
	radio = handler (ipAddr, 161)

	# Get the In packets, Out Packets and Errored Packet Counters
	sys.stdout.write("\rGet the In packets, Out Packets and Errored Packet Counters\n")
	sys.stdout.flush()

	if (portNum == 1):
		inPktsIndex = 155
		outPktsIndex = 157
		errPktsIndex = 159
		dropPktsIndex = 161
		dropFiltPktsIndex = 163
	elif (portNum == 2):
		inPktsIndex = 166
		outPktsIndex = 168
		errPktsIndex = 170
		dropPktsIndex = 172
		dropFiltPktsIndex = 174
	else:			# if its a USB Serial port
		inPktsIndex = 177
		outPktsIndex = 179
		errPktsIndex = 181
		dropPktsIndex = 183
		dropFiltPktsIndex = 185
		
	# Now get the packet counts
	valid = True
	inPkts = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', inPktsIndex)
	if (inPkts[0]):
		pktCounts.append(inPkts[3])
	else:
		valid = False
		result+='Serial Port InPkts Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	outPkts = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', outPktsIndex)
	if (outPkts[0]):
		pktCounts.append(outPkts[3])
	else:
		valid = False
		result+='Serial Port OutPkts Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	errPkts = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', errPktsIndex)
	if (errPkts[0]):
		pktCounts.append(errPkts[3])
	else:
		valid = False
		result+='Serial Port ErrPkts Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	dropPkts = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', dropPktsIndex)
	if (dropPkts[0]):
		pktCounts.append(dropPkts[3])
	else:
		valid = False
		result+='Serial Port DropPkts Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	dropFiltPkts = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', dropFiltPktsIndex)
	if (dropFiltPkts[0]):
		pktCounts.append(dropFiltPkts[3])
	else:
		valid = False
		result+='Serial Port Drop Filtered Pkts Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	# get the RF In Drop Errors and Out Drop Congestion Packets and Out Drop Filtered Packet counts
	rfInPktsErr = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', rfInPktsErrIndex)
	if (rfInPktsErr[0]):
		pktCounts.append(rfInPktsErr[3])
	else:
		valid = False
		result+='RF Port In Packets Error Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	rfOutDropPkts = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', rfOutDropPktsIndex)
	if (rfOutDropPkts[0]):
		pktCounts.append(rfOutDropPkts[3])
	else:
		valid = False
		result+='RF Port Out Drop Packets Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	rfInDropFiltPkts = radio.getObject (community, 'MONPARAM-4RF-MIB', 'monParamReading', rfInDropFiltPktsIndex)
	if (rfInDropFiltPkts[0]):
		pktCounts.append(rfInDropFiltPkts[3])
	else:
		valid = False
		result+='RF Port In Drop Filtered Packets Retrieval unsuccessful. '
		return (valid, result, pktCounts)
		
	return (valid, result, pktCounts)
예제 #25
0
def FTPTransfer(ipAddr, serverIP, user, passwd):
    radio = handler (ipAddr, 161)

    # Parameters
    serverIPList = serverIP.strip().split('.')
   
    result = ''

    sys.stdout.write("\rSetting File Transfer Parameters..")
    sys.stdout.flush()

    # Set File Transfer Parameters
    # From Source
    direction = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferDirection', 1, 1)
    if(direction[0]):
        result+=str(direction[1])
        result+='\n'
    else:
        result+=str(direction[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (direction[0], result)
    
    # Software Pack
    filename = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferFileName', 1, 'Software Pack')
    if(filename[0]):
        result+=str(filename[1])
        result+='\n'
    else:    
        result+=str(filename[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (filename[0], result)
    
    
    # FTP
    protocol = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferProtocol', 1, 1)
    if(protocol[0]):
        result+=str(protocol[1])
        result+='\n'
    else:    
        result+=str(protocol[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (protocol[0], result)
    
    
    # Server IP 
    srcaddr = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferSourceAddress', 1, univ.OctetString((int(serverIPList[0]),int(serverIPList[1]),int(serverIPList[2]),int(serverIPList[3]))))
    if(srcaddr[0]):
        result+=str(srcaddr[1])
        result+='\n'
    else:    
        result+=str(srcaddr[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (srcaddr[0], result)
    
    
    # Source Address Type
    srcaddrtype = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferSourceAddressType', 1, 1)
    if(srcaddrtype[0]):
        result+=str(srcaddrtype[1])
        result+='\n'
    else:    
        result+=str(srcaddrtype[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (srcaddrtype[0], result)
    
    
    # Username
    name = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferUserName', 1, user)
    if(name[0]):
        result+=str(name[1])
        result+='\n'
    else:    
        result+=str(name[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (name[0], result)
    
    
    # Password
    password = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferUserPassword', 1, passwd)
    if(password[0]):
        result+=str(password[1])
        result+='\n'
    else:
        result+=str(password[1])
        sys.stdout.write("\rSetting File Transfer Parameters..Error\n")
        sys.stdout.flush()
        return (password[0], result)

    # finished parameter setting
    sys.stdout.write("\rSetting File Transfer Parameters..Done\n")
    sys.stdout.flush()
    

    # Send start command and poll progress

    # fileTransferControl:              start	
    start = radio.setObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferControl', 1, 1)
    if(start[0]):
        result+=str(start[1])
        result+='\n'
    else:    
        result+=start[1]
        sys.stdout.write("\rStarting Transfer..Error\n")
        sys.stdout.flush()
        return (start[0], result)


    # Show Progress
    while(True):
        progress = radio.getObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferProgress', 1)
        status = radio.getObject(community, 'FILETRANSFER-4RF-MIB', 'fileTransferControl', 1)
        sys.stdout.write("\rTransfering File..%s%%"%(str(progress[3])))
        sys.stdout.flush()
        if(int(status[3]) is 13):
            break
        elif((int(status[3]) is 10) or (int(status[3]) is 14) or (int(status[3]) is 15) or (int(status[3]) is 16) or (int(status[3]) is 17) or (int(status[3]) is 19)):
            break
        else:
            pass
        time.sleep(1)

    sys.stdout.write("\n\n\rTransfer Control: %s\n"%ctrlStatus[int(status[3])])
    sys.stdout.flush()
    result+="\nTransfer Control: "+ctrlStatus[int(status[3])]+"\n"
    # return: (parameter setting result, final control status(for diagnosis, success/fail)
    return ((int(status[3])==13), result)
예제 #26
0
def setRFNetworkDetails (ipAddr, nwRadius=1, nwRptrPrxmty=0, rptNwSeg=0):
	result = ''
	radio = handler (ipAddr, 161)

	# Setting the DUT RF Network Details
	sys.stdout.write("\rSetting DUT RF Network Details")
	sys.stdout.flush()

	# Set the network Radius
	ntwkRadius = radio.setObject(community, 'APRISASR-4RF-MIB', 'termRfNwkRadius', 0, nwRadius)
	if(ntwkRadius[0]):
		# pass
		result+=str(ntwkRadius[1])
		result+='\n'
	else:
		result+=str(ntwkRadius[1])
		result+='\n'
		sys.stdout.write("\rSetting Network Radius Parameter..Error\n")
		sys.stdout.flush() 
		return (ntwkRadius[0], result)
		
	# Set the Network proximity parameter
	ntwkRptrProximity = radio.setObject(community, 'APRISASR-4RF-MIB', 'termRfNwkRepeaterProximity', 0, nwRptrPrxmty)
	if(ntwkRptrProximity[0]):
		# pass
		result+=str(ntwkRptrProximity[1])
		result+='\n'
	else:
		result+=str(ntwkRptrProximity[1])
		result+='\n'
		sys.stdout.write("\rSetting Network Repeater Proximity..Error\n")
		sys.stdout.flush() 
		return (ntwkRptrProximity[0], result)
		
	ntwkRptrSegment = radio.setObject(community, 'UNITCONFIG-4RF-MIB', 'unitConfigGroupIdentityRepeater', 1, rptNwSeg)
	if(ntwkRptrSegment[0]):
		# pass
		result+=str(ntwkRptrSegment[1])
		result+='\n'
	else:
		result+=str(ntwkRptrSegment[1])
		result+='\n'
		sys.stdout.write("\rSetting Network Repeater Proximity..Error\n")
		sys.stdout.flush() 
		return (ntwkRptrSegment[0], result)
	
	# Validate the settings
	valid = True

	ntwkRadius = radio.getObject(community, 'APRISASR-4RF-MIB', 'termRfNwkRadius', 0)
	print ('Network Radius: %s' %ntwkRadius[3])
	if (ntwkRadius[3] == nwRadius):
		pass
	else:
		valid = False
		result+='RF Network Radius configuration unsuccessful. '
		return (valid, result)
		
	ntwkRptrProximity = radio.getObject(community, 'APRISASR-4RF-MIB', 'termRfNwkRepeaterProximity', 0)
	print ('Network Proximity: %s' %ntwkRptrProximity[3])
	if (ntwkRptrProximity[3] == nwRptrPrxmty):
		pass
	else:
		valid = False
		result+='RF Network Radius configuration unsuccessful. '
		return (valid, result)
		
	ntwkRptrSegment = radio.getObject(community, 'UNITCONFIG-4RF-MIB', 'unitConfigGroupIdentityRepeater', 1)
	if (ntwkRptrSegment[3] == rptNwSeg):
		pass
	else:
		valid = False
		result+='RF Network Radius configuration unsuccessful. '
		return (valid, result)

	return (valid, result)