Commit 888c4ead authored by Raphael Defosseux's avatar Raphael Defosseux

fix(ci): Fixes for the legacy LTE bench

 - Problem with escaping chars
 - Killing properly tshark process on EPC
 - standalone Terminate eNB was failing
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 7f910a2e
...@@ -1329,7 +1329,7 @@ class OaiCiTest(): ...@@ -1329,7 +1329,7 @@ class OaiCiTest():
SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
if self.ADBCentralized: if self.ADBCentralized:
SSH.command('adb devices', '\$', 15) SSH.command('adb devices', '\$', 15)
self.UEDevices = re.findall("\\\\r\\\\n([A-Za-z0-9]+)\\\\tdevice",SSH.getBefore()) self.UEDevices = re.findall('\r\n([A-Za-z0-9]+)\tdevice',SSH.getBefore())
#report number and id of devices found #report number and id of devices found
msg = "UEDevices found by GetAllUEDevices : " + " ".join(self.UEDevices) msg = "UEDevices found by GetAllUEDevices : " + " ".join(self.UEDevices)
logging.debug(msg) logging.debug(msg)
...@@ -1379,8 +1379,7 @@ class OaiCiTest(): ...@@ -1379,8 +1379,7 @@ class OaiCiTest():
SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
if self.ADBCentralized: if self.ADBCentralized:
SSH.command('lsusb | egrep --colour=never "Future Technology Devices International, Ltd FT2232C" | sed -e "s#:.*##" -e "s# #_#g"', '\$', 15) 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()) self.CatMDevices = re.findall('\r\n([A-Za-z0-9_]+)',SSH.getBefore())
self.CatMDevices = re.findall("\\\\r\\\\n([A-Za-z0-9_]+)",SSH.getBefore())
else: else:
if (os.path.isfile('./modules_list.txt')): if (os.path.isfile('./modules_list.txt')):
os.remove('./modules_list.txt') os.remove('./modules_list.txt')
...@@ -2046,7 +2045,7 @@ class OaiCiTest(): ...@@ -2046,7 +2045,7 @@ class OaiCiTest():
req_bandwidth = '%.1f Gbits/sec' % req_bw req_bandwidth = '%.1f Gbits/sec' % req_bw
req_bw = req_bw * 1000000000 req_bw = req_bw * 1000000000
result = re.search('Server Report:\\\\r\\\\n(?:|\[ *\d+\].*) (?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(\d+\/..\d+) +(\((?P<packetloss>[0-9\.]+)%\))', SSH.getBefore()) result = re.search('Server Report:\r\n(?:|\[ *\d+\].*) (?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(\d+\/..\d+) +(\((?P<packetloss>[0-9\.]+)%\))', SSH.getBefore())
if result is not None: if result is not None:
bitrate = result.group('bitrate') bitrate = result.group('bitrate')
packetloss = result.group('packetloss') packetloss = result.group('packetloss')
...@@ -2262,7 +2261,7 @@ class OaiCiTest(): ...@@ -2262,7 +2261,7 @@ class OaiCiTest():
def Iperf_analyzeV3Output(self, lock, UE_IPAddress, device_id, statusQueue,SSH): def Iperf_analyzeV3Output(self, lock, UE_IPAddress, device_id, statusQueue,SSH):
result = re.search('(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?:|[0-9\.]+ ms +\d+\/\d+ \((?P<packetloss>[0-9\.]+)%\)) +(?:|receiver)\\\\r\\\\n(?:|\[ *\d+\] Sent \d+ datagrams)\\\\r\\\\niperf Done\.', SSH.getBefore()) result = re.search('(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?:|[0-9\.]+ ms +\d+\/\d+ \((?P<packetloss>[0-9\.]+)%\)) +(?:|receiver)\r\n(?:|\[ *\d+\] Sent \d+ datagrams)\r\niperf Done\.', SSH.getBefore())
if result is None: if result is None:
result = re.search('(?P<error>iperf: error - [a-zA-Z0-9 :]+)', SSH.getBefore()) result = re.search('(?P<error>iperf: error - [a-zA-Z0-9 :]+)', SSH.getBefore())
lock.acquire() lock.acquire()
...@@ -3865,7 +3864,7 @@ class OaiCiTest(): ...@@ -3865,7 +3864,7 @@ class OaiCiTest():
SSH = sshconnection.SSHConnection() SSH = sshconnection.SSHConnection()
SSH.open(IPAddress, UserName, Password) SSH.open(IPAddress, UserName, Password)
SSH.command('lsb_release -a', '\$', 5) SSH.command('lsb_release -a', '\$', 5)
result = re.search('Description:\\\\t(?P<os_type>[a-zA-Z0-9\-\_\.\ ]+)', SSH.getBefore()) result = re.search('Description:\t(?P<os_type>[a-zA-Z0-9\-\_\.\ ]+)', SSH.getBefore())
if result is not None: if result is not None:
OsVersion = result.group('os_type') OsVersion = result.group('os_type')
logging.debug('OS is: ' + OsVersion) logging.debug('OS is: ' + OsVersion)
...@@ -3883,13 +3882,13 @@ class OaiCiTest(): ...@@ -3883,13 +3882,13 @@ class OaiCiTest():
logging.debug('OS is: ' + OsVersion) logging.debug('OS is: ' + OsVersion)
HTML.OsVersion[idx]=OsVersion HTML.OsVersion[idx]=OsVersion
SSH.command('uname -r', '\$', 5) SSH.command('uname -r', '\$', 5)
result = re.search('uname -r\\\\r\\\\n(?P<kernel_version>[a-zA-Z0-9\-\_\.]+)', SSH.getBefore()) result = re.search('uname -r\r\n(?P<kernel_version>[a-zA-Z0-9\-\_\.]+)', SSH.getBefore())
if result is not None: if result is not None:
KernelVersion = result.group('kernel_version') KernelVersion = result.group('kernel_version')
logging.debug('Kernel Version is: ' + KernelVersion) logging.debug('Kernel Version is: ' + KernelVersion)
HTML.KernelVersion[idx]=KernelVersion HTML.KernelVersion[idx]=KernelVersion
SSH.command('dpkg --list | egrep --color=never libuhd003', '\$', 5) SSH.command('dpkg --list | egrep --color=never libuhd', '\$', 5)
result = re.search('libuhd003:amd64 *(?P<uhd_version>[0-9\.]+)', SSH.getBefore()) result = re.search('libuhd.*:amd64 *(?P<uhd_version>[0-9\.]+)', SSH.getBefore())
if result is not None: if result is not None:
UhdVersion = result.group('uhd_version') UhdVersion = result.group('uhd_version')
logging.debug('UHD Version is: ' + UhdVersion) logging.debug('UHD Version is: ' + UhdVersion)
...@@ -3902,7 +3901,7 @@ class OaiCiTest(): ...@@ -3902,7 +3901,7 @@ class OaiCiTest():
logging.debug('UHD Version is: ' + UhdVersion) logging.debug('UHD Version is: ' + UhdVersion)
HTML.UhdVersion[idx]=UhdVersion HTML.UhdVersion[idx]=UhdVersion
SSH.command('echo ' + Password + ' | sudo -S uhd_find_devices', '\$', 180) SSH.command('echo ' + Password + ' | sudo -S uhd_find_devices', '\$', 180)
usrp_boards = re.findall('product: ([0-9A-Za-z]+)\\\\r\\\\n', SSH.getBefore()) usrp_boards = re.findall('product: ([0-9A-Za-z]+)', SSH.getBefore())
count = 0 count = 0
for board in usrp_boards: for board in usrp_boards:
if count == 0: if count == 0:
...@@ -3914,14 +3913,18 @@ class OaiCiTest(): ...@@ -3914,14 +3913,18 @@ class OaiCiTest():
logging.debug('USRP Board(s) : ' + UsrpBoard) logging.debug('USRP Board(s) : ' + UsrpBoard)
HTML.UsrpBoard[idx]=UsrpBoard HTML.UsrpBoard[idx]=UsrpBoard
SSH.command('lscpu', '\$', 5) SSH.command('lscpu', '\$', 5)
result = re.search('CPU\(s\): *(?P<nb_cpus>[0-9]+).*Model name: *(?P<model>[a-zA-Z0-9\-\_\.\ \(\)]+).*CPU MHz: *(?P<cpu_mhz>[0-9\.]+)', SSH.getBefore()) result = re.search('CPU\(s\): *(?P<nb_cpus>[0-9]+)', SSH.getBefore())
if result is not None: if result is not None:
CpuNb = result.group('nb_cpus') CpuNb = result.group('nb_cpus')
logging.debug('nb_cpus: ' + CpuNb) logging.debug('nb_cpus: ' + CpuNb)
HTML.CpuNb[idx]=CpuNb HTML.CpuNb[idx]=CpuNb
result = re.search('Model name: *(?P<model>[a-zA-Z0-9\-\_\.\ \(\)]+)', SSH.getBefore())
if result is not None:
CpuModel = result.group('model') CpuModel = result.group('model')
logging.debug('model: ' + CpuModel) logging.debug('model: ' + CpuModel)
HTML.CpuModel[idx]=CpuModel HTML.CpuModel[idx]=CpuModel
result = re.search('CPU MHz: *(?P<cpu_mhz>[0-9\.]+)', SSH.getBefore())
if result is not None:
CpuMHz = result.group('cpu_mhz') + ' MHz' CpuMHz = result.group('cpu_mhz') + ' MHz'
logging.debug('cpu_mhz: ' + CpuMHz) logging.debug('cpu_mhz: ' + CpuMHz)
HTML.CpuMHz[idx]=CpuMHz HTML.CpuMHz[idx]=CpuMHz
......
...@@ -374,7 +374,7 @@ class RANManagement(): ...@@ -374,7 +374,7 @@ class RANManagement():
mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.open(lIpAddr, lUserName, lPassWord)
eth_interface = 'any' eth_interface = 'any'
fltr = 'sctp' fltr = 'sctp'
logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m') logging.debug('\u001B[1m Launching tshark on xNB on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m')
pcapfile = pcapfile_prefix + self.testCase_id + '_log.pcap' pcapfile = pcapfile_prefix + self.testCase_id + '_log.pcap'
mySSH.command('echo ' + lPassWord + ' | sudo -S rm -f /tmp/' + pcapfile , '\$', 5) mySSH.command('echo ' + lPassWord + ' | sudo -S rm -f /tmp/' + pcapfile , '\$', 5)
mySSH.command('echo $USER; nohup sudo -E tshark -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + pcapfile + ' > /dev/null 2>&1 &','\$', 5) mySSH.command('echo $USER; nohup sudo -E tshark -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + pcapfile + ' > /dev/null 2>&1 &','\$', 5)
...@@ -390,7 +390,7 @@ class RANManagement(): ...@@ -390,7 +390,7 @@ class RANManagement():
mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
eth_interface = 'any' eth_interface = 'any'
fltr = 'sctp' fltr = 'sctp'
logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m') logging.debug('\u001B[1m Launching tshark on EPC on interface ' + eth_interface + ' with filter "' + fltr + '"\u001B[0m')
self.epcPcapFile = 'enb_' + self.testCase_id + '_s1log.pcap' self.epcPcapFile = 'enb_' + self.testCase_id + '_s1log.pcap'
mySSH.command('echo ' + localEpcPassword + ' | sudo -S rm -f /tmp/' + self.epcPcapFile , '\$', 5) mySSH.command('echo ' + localEpcPassword + ' | sudo -S rm -f /tmp/' + self.epcPcapFile , '\$', 5)
mySSH.command('echo $USER; nohup sudo tshark -f "host ' + lIpAddr +'" -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + self.epcPcapFile + ' > /tmp/tshark.log 2>&1 &', localEpcUserName, 5) mySSH.command('echo $USER; nohup sudo tshark -f "host ' + lIpAddr +'" -i ' + eth_interface + ' -f "' + fltr + '" -w /tmp/' + self.epcPcapFile + ' > /tmp/tshark.log 2>&1 &', localEpcUserName, 5)
...@@ -517,7 +517,7 @@ class RANManagement(): ...@@ -517,7 +517,7 @@ class RANManagement():
localEpcUserName = EPC.UserName localEpcUserName = EPC.UserName
localEpcPassword = EPC.Password localEpcPassword = EPC.Password
mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
logging.debug('\u001B[1m Stopping tshark \u001B[0m') logging.debug('\u001B[1m Stopping tshark on EPC \u001B[0m')
mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
if self.epcPcapFile != '': if self.epcPcapFile != '':
mySSH.command('echo ' + localEpcPassword + ' | sudo -S chmod 666 /tmp/' + self.epcPcapFile, '\$', 5) mySSH.command('echo ' + localEpcPassword + ' | sudo -S chmod 666 /tmp/' + self.epcPcapFile, '\$', 5)
...@@ -644,18 +644,16 @@ class RANManagement(): ...@@ -644,18 +644,16 @@ class RANManagement():
time.sleep(5) time.sleep(5)
mySSH.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) mySSH.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
#stopping tshark (valid if eNB and enabled in xml, will not harm otherwise) #stopping tshark (valid if eNB and enabled in xml, will not harm otherwise)
logging.debug('\u001B[1m Stopping tshark \u001B[0m') logging.debug('\u001B[1m Stopping tshark on xNB \u001B[0m')
mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
time.sleep(1) time.sleep(1)
mySSH.close() mySSH.close()
# If tracer options is on, stopping tshark on EPC side if EPC.IPAddress != "none" and EPC.IPAddress != '':
result = re.search('T_stdout', str(self.Initialize_eNB_args))
if (result is not None):
localEpcIpAddr = EPC.IPAddress localEpcIpAddr = EPC.IPAddress
localEpcUserName = EPC.UserName localEpcUserName = EPC.UserName
localEpcPassword = EPC.Password localEpcPassword = EPC.Password
logging.debug('\u001B[1m Stopping tshark on EPC (' + localEpcIpAddr + ') \u001B[0m')
mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
logging.debug('\u001B[1m Stopping tshark \u001B[0m')
mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
time.sleep(1) time.sleep(1)
if self.epcPcapFile != '': if self.epcPcapFile != '':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment