|
|
|
@@ -171,7 +171,6 @@ class OaiCiTest():
|
|
|
|
|
self.UEDevicesOffCmd = []
|
|
|
|
|
self.UEDevicesOnCmd = []
|
|
|
|
|
self.UEDevicesRebootCmd = []
|
|
|
|
|
self.CatMDevices = []
|
|
|
|
|
self.UEIPAddresses = []
|
|
|
|
|
self.idle_sleep_time = 0
|
|
|
|
|
self.x2_ho_options = 'network'
|
|
|
|
@@ -647,249 +646,6 @@ class OaiCiTest():
|
|
|
|
|
logging.error('\033[91mInitialize OAI UE Failed! \033[0m')
|
|
|
|
|
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC,InfraUE,CONTAINERS)
|
|
|
|
|
|
|
|
|
|
def checkDevTTYisUnlocked(self):
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
|
SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
|
|
|
|
count = 0
|
|
|
|
|
while count < 5:
|
|
|
|
|
SSH.command('echo ' + self.ADBPassword + ' | sudo -S lsof | grep --colour=never ttyUSB0', '\$', 10)
|
|
|
|
|
result = re.search('picocom', SSH.getBefore())
|
|
|
|
|
if result is None:
|
|
|
|
|
count = 10
|
|
|
|
|
else:
|
|
|
|
|
time.sleep(5)
|
|
|
|
|
count = count + 1
|
|
|
|
|
SSH.close()
|
|
|
|
|
|
|
|
|
|
def InitializeCatM(self,HTML):
|
|
|
|
|
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
|
|
|
|
HELP.GenericHelp(CONST.Version)
|
|
|
|
|
sys.exit('Insufficient Parameter')
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
|
SSH.enablePicocomClosure()
|
|
|
|
|
SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
|
|
|
|
# dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S`
|
|
|
|
|
SSH.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10)
|
|
|
|
|
SSH.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10)
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
# Calling twice AT to clear all buffers
|
|
|
|
|
SSH.command('AT', 'OK|ERROR', 5)
|
|
|
|
|
SSH.command('AT', 'OK', 5)
|
|
|
|
|
# Doing a power cycle
|
|
|
|
|
SSH.command('AT^RESET', 'SIMSTORE,READY', 15)
|
|
|
|
|
SSH.command('AT', 'OK|ERROR', 5)
|
|
|
|
|
SSH.command('AT', 'OK', 5)
|
|
|
|
|
SSH.command('ATE1', 'OK', 5)
|
|
|
|
|
# Disabling the Radio
|
|
|
|
|
SSH.command('AT+CFUN=0', 'OK', 5)
|
|
|
|
|
logging.debug('\u001B[1m Cellular Functionality disabled\u001B[0m')
|
|
|
|
|
# Checking if auto-attach is enabled
|
|
|
|
|
SSH.command('AT^AUTOATT?', 'OK', 5)
|
|
|
|
|
result = re.search('AUTOATT: (?P<state>[0-9\-]+)', SSH.getBefore())
|
|
|
|
|
if result is not None:
|
|
|
|
|
if result.group('state') is not None:
|
|
|
|
|
autoAttachState = int(result.group('state'))
|
|
|
|
|
if autoAttachState is not None:
|
|
|
|
|
if autoAttachState == 0:
|
|
|
|
|
SSH.command('AT^AUTOATT=1', 'OK', 5)
|
|
|
|
|
logging.debug('\u001B[1m Auto-Attach enabled\u001B[0m')
|
|
|
|
|
else:
|
|
|
|
|
logging.debug('\u001B[1;37;41m Could not check Auto-Attach! \u001B[0m')
|
|
|
|
|
# Force closure of picocom but device might still be locked
|
|
|
|
|
SSH.close()
|
|
|
|
|
SSH.disablePicocomClosure()
|
|
|
|
|
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
|
|
|
|
self.checkDevTTYisUnlocked()
|
|
|
|
|
|
|
|
|
|
def TerminateCatM(self,HTML):
|
|
|
|
|
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
|
|
|
|
HELP.GenericHelp(CONST.Version)
|
|
|
|
|
sys.exit('Insufficient Parameter')
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
|
SSH.enablePicocomClosure()
|
|
|
|
|
SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
|
|
|
|
# dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S`
|
|
|
|
|
SSH.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10)
|
|
|
|
|
SSH.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10)
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
# Calling twice AT to clear all buffers
|
|
|
|
|
SSH.command('AT', 'OK|ERROR', 5)
|
|
|
|
|
SSH.command('AT', 'OK', 5)
|
|
|
|
|
# Disabling the Radio
|
|
|
|
|
SSH.command('AT+CFUN=0', 'OK', 5)
|
|
|
|
|
logging.debug('\u001B[1m Cellular Functionality disabled\u001B[0m')
|
|
|
|
|
SSH.close()
|
|
|
|
|
SSH.disablePicocomClosure()
|
|
|
|
|
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
|
|
|
|
self.checkDevTTYisUnlocked()
|
|
|
|
|
|
|
|
|
|
def AttachCatM(self,HTML,RAN,COTS_UE,EPC,InfraUE,CONTAINERS):
|
|
|
|
|
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
|
|
|
|
HELP.GenericHelp(CONST.Version)
|
|
|
|
|
sys.exit('Insufficient Parameter')
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
|
SSH.enablePicocomClosure()
|
|
|
|
|
SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
|
|
|
|
# dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S`
|
|
|
|
|
SSH.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10)
|
|
|
|
|
SSH.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10)
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
# Calling twice AT to clear all buffers
|
|
|
|
|
SSH.command('AT', 'OK|ERROR', 5)
|
|
|
|
|
SSH.command('AT', 'OK', 5)
|
|
|
|
|
# Enabling the Radio
|
|
|
|
|
SSH.command('AT+CFUN=1', 'SIMSTORE,READY', 5)
|
|
|
|
|
logging.debug('\u001B[1m Cellular Functionality enabled\u001B[0m')
|
|
|
|
|
time.sleep(4)
|
|
|
|
|
# We should check if we register
|
|
|
|
|
count = 0
|
|
|
|
|
attach_cnt = 0
|
|
|
|
|
attach_status = False
|
|
|
|
|
while count < 5:
|
|
|
|
|
SSH.command('AT+CEREG?', 'OK', 5)
|
|
|
|
|
result = re.search('CEREG: 2,(?P<state>[0-9\-]+),', SSH.getBefore())
|
|
|
|
|
if result is not None:
|
|
|
|
|
mDataConnectionState = int(result.group('state'))
|
|
|
|
|
if mDataConnectionState is not None:
|
|
|
|
|
if mDataConnectionState == 1:
|
|
|
|
|
count = 10
|
|
|
|
|
attach_status = True
|
|
|
|
|
result = re.search('CEREG: 2,1,"(?P<networky>[0-9A-Z]+)","(?P<networkz>[0-9A-Z]+)"', SSH.getBefore())
|
|
|
|
|
if result is not None:
|
|
|
|
|
networky = result.group('networky')
|
|
|
|
|
networkz = result.group('networkz')
|
|
|
|
|
logging.debug('\u001B[1m CAT-M module attached to eNB (' + str(networky) + '/' + str(networkz) + ')\u001B[0m')
|
|
|
|
|
else:
|
|
|
|
|
logging.debug('\u001B[1m CAT-M module attached to eNB\u001B[0m')
|
|
|
|
|
else:
|
|
|
|
|
logging.debug('+CEREG: 2,' + str(mDataConnectionState))
|
|
|
|
|
attach_cnt = attach_cnt + 1
|
|
|
|
|
else:
|
|
|
|
|
logging.debug(SSH.getBefore())
|
|
|
|
|
attach_cnt = attach_cnt + 1
|
|
|
|
|
count = count + 1
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
if attach_status:
|
|
|
|
|
SSH.command('AT+CESQ', 'OK', 5)
|
|
|
|
|
result = re.search('CESQ: 99,99,255,255,(?P<rsrq>[0-9]+),(?P<rsrp>[0-9]+)', SSH.getBefore())
|
|
|
|
|
if result is not None:
|
|
|
|
|
nRSRQ = int(result.group('rsrq'))
|
|
|
|
|
nRSRP = int(result.group('rsrp'))
|
|
|
|
|
if (nRSRQ is not None) and (nRSRP is not None):
|
|
|
|
|
logging.debug(' RSRQ = ' + str(-20+(nRSRQ/2)) + ' dB')
|
|
|
|
|
logging.debug(' RSRP = ' + str(-140+nRSRP) + ' dBm')
|
|
|
|
|
SSH.close()
|
|
|
|
|
SSH.disablePicocomClosure()
|
|
|
|
|
self.checkDevTTYisUnlocked()
|
|
|
|
|
if attach_status:
|
|
|
|
|
message = 'CAT-M module Attachment Completed in ' + str(attach_cnt+4) + ' seconds'
|
|
|
|
|
if (nRSRQ is not None) and (nRSRP is not None):
|
|
|
|
|
message += '\n RSRQ = ' + str(-20+(nRSRQ/2)) + ' dB'
|
|
|
|
|
message += '\n RSRP = ' + str(-140+nRSRP) + ' dBm'
|
|
|
|
|
HTML.CreateHtmlTestRowQueue('N/A', 'OK', [message])
|
|
|
|
|
else:
|
|
|
|
|
logging.error('\u001B[1m CAT-M module Attachment Failed\u001B[0m')
|
|
|
|
|
message = 'CAT-M module Attachment Failed'
|
|
|
|
|
HTML.CreateHtmlTestRowQueue('N/A', 'KO', [message])
|
|
|
|
|
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC,InfraUE,CONTAINERS)
|
|
|
|
|
|
|
|
|
|
def PingCatM(self,HTML,RAN,EPC,COTS_UE,InfraUE,CONTAINERS):
|
|
|
|
|
if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '':
|
|
|
|
|
HELP.GenericHelp(CONST.Version)
|
|
|
|
|
sys.exit('Insufficient Parameter')
|
|
|
|
|
check_eNB = True
|
|
|
|
|
check_OAI_UE = False
|
|
|
|
|
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
|
|
|
|
|
if (pStatus < 0):
|
|
|
|
|
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
|
|
|
|
|
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC,InfraUE,CONTAINERS)
|
|
|
|
|
return
|
|
|
|
|
try:
|
|
|
|
|
statusQueue = SimpleQueue()
|
|
|
|
|
lock = Lock()
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
|
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
|
|
|
|
|
SSH.command('cd ' + EPC.SourceCodePath, '\$', 5)
|
|
|
|
|
SSH.command('cd scripts', '\$', 5)
|
|
|
|
|
if re.match('OAI', EPC.Type, re.IGNORECASE):
|
|
|
|
|
logging.debug('Using the OAI EPC HSS: not implemented yet')
|
|
|
|
|
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
|
|
|
|
|
HTML.CreateHtmlTabFooter(False)
|
|
|
|
|
self.ConditionalExit()
|
|
|
|
|
else:
|
|
|
|
|
SSH.command('egrep --color=never "Allocated ipv4 addr" /opt/ltebox/var/log/xGwLog.0', '\$', 5)
|
|
|
|
|
result = re.search('Allocated ipv4 addr: (?P<ipaddr>[0-9\.]+) from Pool', SSH.getBefore())
|
|
|
|
|
if result is not None:
|
|
|
|
|
moduleIPAddr = result.group('ipaddr')
|
|
|
|
|
else:
|
|
|
|
|
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
|
|
|
|
|
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC,InfraUE,CONTAINERS)
|
|
|
|
|
return
|
|
|
|
|
ping_time = re.findall("-c (\d+)",str(self.ping_args))
|
|
|
|
|
device_id = 'catm'
|
|
|
|
|
ping_status = SSH.command('stdbuf -o0 ping ' + self.ping_args + ' ' + str(moduleIPAddr) + ' 2>&1 | stdbuf -o0 tee ping_' + self.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
|
|
|
|
|
# TIMEOUT CASE
|
|
|
|
|
if ping_status < 0:
|
|
|
|
|
message = 'Ping with UE (' + str(moduleIPAddr) + ') crashed due to TIMEOUT!'
|
|
|
|
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
|
|
|
|
SSH.close()
|
|
|
|
|
self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
|
|
|
|
|
return
|
|
|
|
|
result = re.search(', (?P<packetloss>[0-9\.]+)% packet loss, time [0-9\.]+ms', SSH.getBefore())
|
|
|
|
|
if result is None:
|
|
|
|
|
message = 'Packet Loss Not Found!'
|
|
|
|
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
|
|
|
|
SSH.close()
|
|
|
|
|
self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
|
|
|
|
|
return
|
|
|
|
|
packetloss = result.group('packetloss')
|
|
|
|
|
if float(packetloss) == 100:
|
|
|
|
|
message = 'Packet Loss is 100%'
|
|
|
|
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
|
|
|
|
SSH.close()
|
|
|
|
|
self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
|
|
|
|
|
return
|
|
|
|
|
result = re.search('rtt min\/avg\/max\/mdev = (?P<rtt_min>[0-9\.]+)\/(?P<rtt_avg>[0-9\.]+)\/(?P<rtt_max>[0-9\.]+)\/[0-9\.]+ ms', SSH.getBefore())
|
|
|
|
|
if result is None:
|
|
|
|
|
message = 'Ping RTT_Min RTT_Avg RTT_Max Not Found!'
|
|
|
|
|
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
|
|
|
|
|
SSH.close()
|
|
|
|
|
self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
|
|
|
|
|
return
|
|
|
|
|
rtt_min = result.group('rtt_min')
|
|
|
|
|
rtt_avg = result.group('rtt_avg')
|
|
|
|
|
rtt_max = result.group('rtt_max')
|
|
|
|
|
pal_msg = 'Packet Loss : ' + packetloss + '%'
|
|
|
|
|
min_msg = 'RTT(Min) : ' + rtt_min + ' ms'
|
|
|
|
|
avg_msg = 'RTT(Avg) : ' + rtt_avg + ' ms'
|
|
|
|
|
max_msg = 'RTT(Max) : ' + rtt_max + ' ms'
|
|
|
|
|
lock.acquire()
|
|
|
|
|
logging.debug('\u001B[1;37;44m ping result (' + moduleIPAddr + ') \u001B[0m')
|
|
|
|
|
logging.debug('\u001B[1;34m ' + pal_msg + '\u001B[0m')
|
|
|
|
|
logging.debug('\u001B[1;34m ' + min_msg + '\u001B[0m')
|
|
|
|
|
logging.debug('\u001B[1;34m ' + avg_msg + '\u001B[0m')
|
|
|
|
|
logging.debug('\u001B[1;34m ' + max_msg + '\u001B[0m')
|
|
|
|
|
qMsg = pal_msg + '\n' + min_msg + '\n' + avg_msg + '\n' + max_msg
|
|
|
|
|
packetLossOK = True
|
|
|
|
|
if packetloss is not None:
|
|
|
|
|
if float(packetloss) > float(self.ping_packetloss_threshold):
|
|
|
|
|
qMsg += '\nPacket Loss too high'
|
|
|
|
|
logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
|
|
|
|
|
packetLossOK = False
|
|
|
|
|
elif float(packetloss) > 0:
|
|
|
|
|
qMsg += '\nPacket Loss is not 0%'
|
|
|
|
|
logging.debug('\u001B[1;30;43m Packet Loss is not 0% \u001B[0m')
|
|
|
|
|
lock.release()
|
|
|
|
|
SSH.close()
|
|
|
|
|
message = 'CAT-M module\nIP Address : ' + moduleIPAddr + '\n' + qMsg
|
|
|
|
|
if (packetLossOK):
|
|
|
|
|
HTML.CreateHtmlTestRowQueue(self.ping_args, 'OK', [message])
|
|
|
|
|
else:
|
|
|
|
|
HTML.CreateHtmlTestRowQueue(self.ping_args, 'KO', [message])
|
|
|
|
|
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC,InfraUE,CONTAINERS)
|
|
|
|
|
except:
|
|
|
|
|
os.kill(os.getppid(),signal.SIGUSR1)
|
|
|
|
|
|
|
|
|
|
def AttachUE_common(self, device_id, statusQueue, lock, idx,COTS_UE):
|
|
|
|
|
try:
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
@@ -1306,29 +1062,6 @@ class OaiCiTest():
|
|
|
|
|
cnt += 1
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def GetAllCatMDevices(self, terminate_ue_flag):
|
|
|
|
|
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
|
|
|
|
HELP.GenericHelp(CONST.Version)
|
|
|
|
|
sys.exit('Insufficient Parameter')
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
|
SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
|
|
|
|
if self.ADBCentralized:
|
|
|
|
|
SSH.command('lsusb | egrep --colour=never "Future Technology Devices International, Ltd FT2232C" | sed -e "s#:.*##" -e "s# #_#g"', '\$', 15)
|
|
|
|
|
self.CatMDevices = re.findall('\r\n([A-Za-z0-9_]+)',SSH.getBefore())
|
|
|
|
|
else:
|
|
|
|
|
if (os.path.isfile('./modules_list.txt')):
|
|
|
|
|
os.remove('./modules_list.txt')
|
|
|
|
|
SSH.command('ls /etc/*/modules*.txt', '\$', 5)
|
|
|
|
|
result = re.search('/etc/ci/modules_list.txt', SSH.getBefore())
|
|
|
|
|
SSH.close()
|
|
|
|
|
if result is not None:
|
|
|
|
|
logging.debug('Found a module list file on ADB server')
|
|
|
|
|
if terminate_ue_flag == True:
|
|
|
|
|
if len(self.CatMDevices) == 0:
|
|
|
|
|
logging.debug('\u001B[1;37;41m CAT-M UE Not Found! \u001B[0m')
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
SSH.close()
|
|
|
|
|
|
|
|
|
|
def CheckUEStatus_common(self, lock, device_id, statusQueue, idx):
|
|
|
|
|
try:
|
|
|
|
|
SSH = sshconnection.SSHConnection()
|
|
|
|
|