CI: adding support for multiple XML scenario files
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
+197
-109
@@ -91,7 +91,8 @@ class SSHConnection():
|
||||
self.ADBUserName = ''
|
||||
self.ADBPassword = ''
|
||||
self.testCase_id = ''
|
||||
self.testXMLfile = ''
|
||||
self.testXMLfiles = []
|
||||
self.nbTestXMLfiles = 0
|
||||
self.desc = ''
|
||||
self.Build_eNB_args = ''
|
||||
self.Initialize_eNB_args = ''
|
||||
@@ -112,6 +113,11 @@ class SSHConnection():
|
||||
self.htmlUEConnected = 0
|
||||
self.htmleNBFailureMsg = ''
|
||||
self.picocom_closure = False
|
||||
self.idle_sleep_time = 0
|
||||
self.htmlTabRefs = []
|
||||
self.htmlTabNames = []
|
||||
self.htmlTabIcons = []
|
||||
self.finalStatus = False
|
||||
|
||||
def open(self, ipaddress, username, password):
|
||||
count = 0
|
||||
@@ -282,9 +288,9 @@ class SSHConnection():
|
||||
self.command('chmod 777 log', '\$', 5)
|
||||
# no need to remove in log (git clean did the trick)
|
||||
self.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee -a compile_oai_enb.log', 'Bypassing the Tests', 600)
|
||||
self.command('mkdir -p build_log_' + SSH.testCase_id, '\$', 5)
|
||||
self.command('mv log/* ' + 'build_log_' + SSH.testCase_id, '\$', 5)
|
||||
self.command('mv compile_oai_enb.log ' + 'build_log_' + SSH.testCase_id, '\$', 5)
|
||||
self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5)
|
||||
self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5)
|
||||
self.command('mv compile_oai_enb.log ' + 'build_log_' + self.testCase_id, '\$', 5)
|
||||
# Workaround to run with develop-nr
|
||||
self.command('if [ -e ran_build ]; then cp -rf ran_build lte_build_oai; fi', '\$', 30)
|
||||
self.close()
|
||||
@@ -300,7 +306,7 @@ class SSHConnection():
|
||||
self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
|
||||
self.command('source oaienv', '\$', 5)
|
||||
self.command('cd scripts', '\$', 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_hss 2>&1 | stdbuf -o0 awk \'{ print strftime("[%Y/%m/%d %H:%M:%S] ",systime()) $0 }\' | stdbuf -o0 tee -a hss_' + SSH.testCase_id + '.log &', 'Core state: 2 -> 3', 35)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_hss 2>&1 | stdbuf -o0 awk \'{ print strftime("[%Y/%m/%d %H:%M:%S] ",systime()) $0 }\' | stdbuf -o0 tee -a hss_' + self.testCase_id + '.log &', 'Core state: 2 -> 3', 35)
|
||||
else:
|
||||
logging.debug('Using the ltebox simulated HSS')
|
||||
self.command('if [ -d ' + self.EPCSourceCodePath + '/scripts ]; then echo ' + self.eNBPassword + ' | sudo -S rm -Rf ' + self.EPCSourceCodePath + '/scripts ; fi', '\$', 5)
|
||||
@@ -326,7 +332,7 @@ class SSHConnection():
|
||||
logging.debug('\u001B[1;37;41m Hostname Not Found! \u001B[0m')
|
||||
sys.exit(1)
|
||||
host_name = result.group('host_name')
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_mme 2>&1 | stdbuf -o0 tee -a mme_' + SSH.testCase_id + '.log &', 'MME app initialization complete', 100)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_mme 2>&1 | stdbuf -o0 tee -a mme_' + self.testCase_id + '.log &', 'MME app initialization complete', 100)
|
||||
else:
|
||||
self.command('cd /opt/ltebox/tools', '\$', 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_mme', '\$', 5)
|
||||
@@ -342,7 +348,7 @@ class SSHConnection():
|
||||
self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
|
||||
self.command('source oaienv', '\$', 5)
|
||||
self.command('cd scripts', '\$', 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_spgw 2>&1 | stdbuf -o0 tee -a spgw_' + SSH.testCase_id + '.log &', 'Initializing SPGW-APP task interface: DONE', 30)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_spgw 2>&1 | stdbuf -o0 tee -a spgw_' + self.testCase_id + '.log &', 'Initializing SPGW-APP task interface: DONE', 30)
|
||||
else:
|
||||
self.command('cd /opt/ltebox/tools', '\$', 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_xGw', '\$', 5)
|
||||
@@ -357,7 +363,7 @@ class SSHConnection():
|
||||
pStatus = self.CheckProcessExist(initialize_eNB_flag)
|
||||
if (pStatus < 0):
|
||||
self.CreateHtmlTestRow(self.Initialize_eNB_args, 'KO', pStatus)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
# If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
@@ -368,8 +374,8 @@ class SSHConnection():
|
||||
if result is not None:
|
||||
eth_interface = result.group('eth_interface')
|
||||
logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m')
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f /tmp/enb_' + SSH.testCase_id + '_s1log.pcap', '\$', 5)
|
||||
self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/enb_' + SSH.testCase_id + '_s1log.pcap > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f /tmp/enb_' + self.testCase_id + '_s1log.pcap', '\$', 5)
|
||||
self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/enb_' + self.testCase_id + '_s1log.pcap > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5)
|
||||
self.close()
|
||||
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
|
||||
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
|
||||
@@ -384,7 +390,7 @@ class SSHConnection():
|
||||
logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m')
|
||||
self.command('cd common/utils/T/tracer', '\$', 5)
|
||||
self.command('make', '\$', 10)
|
||||
self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '_record.log 2>&1 &', self.eNBUserName, 5)
|
||||
self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '_record.log 2>&1 &', self.eNBUserName, 5)
|
||||
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
|
||||
full_config_file = full_config_file[:extIdx + 5]
|
||||
config_path, config_file = os.path.split(full_config_file)
|
||||
@@ -402,12 +408,12 @@ class SSHConnection():
|
||||
# Launch eNB with the modified config file
|
||||
self.command('source oaienv', '\$', 5)
|
||||
self.command('cd cmake_targets', '\$', 5)
|
||||
self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh ', '\$', 5)
|
||||
self.command('chmod 775 ./my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh ', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + SSH.testCase_id + '.log', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(SSH.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '.log ./my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh', '\$', 5)
|
||||
self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5)
|
||||
self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
|
||||
if not rruCheck:
|
||||
self.eNBLogFile = 'enb_' + SSH.testCase_id + '.log'
|
||||
self.eNBLogFile = 'enb_' + self.testCase_id + '.log'
|
||||
time.sleep(6)
|
||||
doLoop = True
|
||||
loopCounter = 10
|
||||
@@ -422,7 +428,7 @@ class SSHConnection():
|
||||
doLoop = False
|
||||
logging.error('\u001B[1;37;41m eNB logging system did not show got sync! \u001B[0m')
|
||||
self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', ALL_PROCESSES_OK)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
# In case of T tracer recording, we need to kill tshark on EPC side
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
if result is not None:
|
||||
@@ -431,12 +437,12 @@ class SSHConnection():
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
|
||||
self.close()
|
||||
time.sleep(1)
|
||||
pcap_log_file = 'enb_' + SSH.testCase_id + '_s1log.pcap'
|
||||
pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap'
|
||||
self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.')
|
||||
self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
|
||||
self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
|
||||
if rruCheck:
|
||||
result = re.search('wait RUs', str(self.ssh.before))
|
||||
else:
|
||||
@@ -472,7 +478,7 @@ class SSHConnection():
|
||||
sys.exit('Insufficient Parameter')
|
||||
multi_jobs = []
|
||||
for device_id in self.UEDevices:
|
||||
p = Process(target = SSH.InitializeUE_common, args = (device_id,))
|
||||
p = Process(target = self.InitializeUE_common, args = (device_id,))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
multi_jobs.append(p)
|
||||
@@ -639,7 +645,7 @@ class SSHConnection():
|
||||
if (pStatus < 0):
|
||||
self.CreateHtmlTestRow('N/A', 'KO', pStatus)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
multi_jobs = []
|
||||
status_queue = SimpleQueue()
|
||||
@@ -647,7 +653,7 @@ class SSHConnection():
|
||||
nb_ue_to_connect = 0
|
||||
for device_id in self.UEDevices:
|
||||
if (self.nbMaxUEtoAttach == -1) or (nb_ue_to_connect < self.nbMaxUEtoAttach):
|
||||
p = Process(target = SSH.AttachUE_common, args = (device_id, status_queue, lock,))
|
||||
p = Process(target = self.AttachUE_common, args = (device_id, status_queue, lock,))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
multi_jobs.append(p)
|
||||
@@ -657,7 +663,7 @@ class SSHConnection():
|
||||
|
||||
if (status_queue.empty()):
|
||||
self.CreateHtmlTestRow('N/A', 'KO', ALL_PROCESSES_OK)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
self.AutoTerminateUEandeNB()
|
||||
sys.exit(1)
|
||||
else:
|
||||
@@ -683,7 +689,7 @@ class SSHConnection():
|
||||
else:
|
||||
self.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
|
||||
def DetachUE_common(self, device_id):
|
||||
@@ -704,11 +710,11 @@ class SSHConnection():
|
||||
if (pStatus < 0):
|
||||
self.CreateHtmlTestRow('N/A', 'KO', pStatus)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
multi_jobs = []
|
||||
for device_id in self.UEDevices:
|
||||
p = Process(target = SSH.DetachUE_common, args = (device_id,))
|
||||
p = Process(target = self.DetachUE_common, args = (device_id,))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
multi_jobs.append(p)
|
||||
@@ -767,11 +773,11 @@ class SSHConnection():
|
||||
pStatus = self.CheckProcessExist(initialize_eNB_flag)
|
||||
if (pStatus < 0):
|
||||
self.CreateHtmlTestRow('N/A', 'KO', pStatus)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
multi_jobs = []
|
||||
for device_id in self.UEDevices:
|
||||
p = Process(target = SSH.RebootUE_common, args = (device_id,))
|
||||
p = Process(target = self.RebootUE_common, args = (device_id,))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
multi_jobs.append(p)
|
||||
@@ -851,7 +857,7 @@ class SSHConnection():
|
||||
self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
|
||||
self.command('cd scripts', '\$', 5)
|
||||
ping_time = re.findall("-c (\d+)",str(self.ping_args))
|
||||
ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee -a ping_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
|
||||
ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee -a ping_' + self.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
|
||||
# TIMEOUT CASE
|
||||
if ping_status < 0:
|
||||
message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!'
|
||||
@@ -919,12 +925,12 @@ class SSHConnection():
|
||||
pStatus = self.CheckProcessExist(initialize_eNB_flag)
|
||||
if (pStatus < 0):
|
||||
self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
ueIpStatus = self.GetAllUEIPAddresses()
|
||||
if (ueIpStatus < 0):
|
||||
self.CreateHtmlTestRow(self.ping_args, 'KO', UE_IP_ADDRESS_ISSUE)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
multi_jobs = []
|
||||
i = 0
|
||||
@@ -932,7 +938,7 @@ class SSHConnection():
|
||||
status_queue = SimpleQueue()
|
||||
for UE_IPAddress in self.UEIPAddresses:
|
||||
device_id = self.UEDevices[i]
|
||||
p = Process(target = SSH.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,))
|
||||
p = Process(target = self.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
multi_jobs.append(p)
|
||||
@@ -943,7 +949,7 @@ class SSHConnection():
|
||||
if (status_queue.empty()):
|
||||
self.CreateHtmlTestRow(self.ping_args, 'KO', ALL_PROCESSES_OK)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
else:
|
||||
ping_status = True
|
||||
@@ -962,7 +968,7 @@ class SSHConnection():
|
||||
else:
|
||||
self.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
|
||||
def Iperf_ComputeTime(self):
|
||||
@@ -978,11 +984,11 @@ class SSHConnection():
|
||||
logging.debug('\u001B[1;37;41m Iperf bandwidth Not Found! \u001B[0m')
|
||||
sys.exit(1)
|
||||
iperf_bandwidth = result.group('iperf_bandwidth')
|
||||
if SSH.iperf_profile == 'balanced':
|
||||
if self.iperf_profile == 'balanced':
|
||||
iperf_bandwidth_new = float(iperf_bandwidth)/ue_num
|
||||
if SSH.iperf_profile == 'single-ue':
|
||||
if self.iperf_profile == 'single-ue':
|
||||
iperf_bandwidth_new = float(iperf_bandwidth)
|
||||
if SSH.iperf_profile == 'unbalanced':
|
||||
if self.iperf_profile == 'unbalanced':
|
||||
# residual is 2% of max bw
|
||||
residualBW = float(iperf_bandwidth) / 50
|
||||
if idx == 0:
|
||||
@@ -998,7 +1004,7 @@ class SSHConnection():
|
||||
return result
|
||||
|
||||
def Iperf_analyzeV2TCPOutput(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options):
|
||||
self.command('awk -f /tmp/tcp_iperf_stats.awk /tmp/CI-eNB/scripts/iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
self.command('awk -f /tmp/tcp_iperf_stats.awk /tmp/CI-eNB/scripts/iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
result = re.search('Avg Bitrate : (?P<average>[0-9\.]+ Mbits\/sec) Max Bitrate : (?P<maximum>[0-9\.]+ Mbits\/sec) Min Bitrate : (?P<minimum>[0-9\.]+ Mbits\/sec)', str(self.ssh.before))
|
||||
if result is not None:
|
||||
avgbitrate = result.group('average')
|
||||
@@ -1104,7 +1110,7 @@ class SSHConnection():
|
||||
return 0
|
||||
|
||||
def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options):
|
||||
if (not os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')):
|
||||
if (not os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
|
||||
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log')
|
||||
return
|
||||
# Computing the requested bandwidth in float
|
||||
@@ -1129,7 +1135,7 @@ class SSHConnection():
|
||||
req_bandwidth = '%.1f Gbits/sec' % req_bw
|
||||
req_bw = req_bw * 1000000000
|
||||
|
||||
server_file = open('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', 'r')
|
||||
server_file = open('iperf_server_' + self.testCase_id + '_' + device_id + '.log', 'r')
|
||||
br_sum = 0.0
|
||||
ji_sum = 0.0
|
||||
pl_sum = 0
|
||||
@@ -1254,12 +1260,12 @@ class SSHConnection():
|
||||
# Launch iperf server on EPC side
|
||||
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
||||
self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
|
||||
self.command('rm -f iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
port = 5001 + idx
|
||||
if udpIperf:
|
||||
self.command('echo $USER; nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + SSH.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5)
|
||||
self.command('echo $USER; nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5)
|
||||
else:
|
||||
self.command('echo $USER; nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + SSH.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5)
|
||||
self.command('echo $USER; nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5)
|
||||
time.sleep(0.5)
|
||||
self.close()
|
||||
|
||||
@@ -1276,8 +1282,8 @@ class SSHConnection():
|
||||
modified_options = modified_options.replace('-R','')
|
||||
time.sleep(0.5)
|
||||
|
||||
self.command('rm -f iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
iperf_status = self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||
self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
iperf_status = self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||
# TIMEOUT Case
|
||||
if iperf_status < 0:
|
||||
self.close()
|
||||
@@ -1295,15 +1301,15 @@ class SSHConnection():
|
||||
# in case of failure, retrieve server log
|
||||
if (clientStatus == -1):
|
||||
time.sleep(1)
|
||||
if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')):
|
||||
os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')
|
||||
self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.')
|
||||
if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
|
||||
os.remove('iperf_server_' + self.testCase_id + '_' + device_id + '.log')
|
||||
self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
|
||||
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
|
||||
|
||||
def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue):
|
||||
try:
|
||||
# Single-UE profile -- iperf only on one UE
|
||||
if SSH.iperf_profile == 'single-ue' and idx != 0:
|
||||
if self.iperf_profile == 'single-ue' and idx != 0:
|
||||
return
|
||||
useIperf3 = False
|
||||
udpIperf = True
|
||||
@@ -1334,13 +1340,13 @@ class SSHConnection():
|
||||
if (useIperf3):
|
||||
self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5)
|
||||
else:
|
||||
self.command('rm -f iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
result = re.search('-u', str(self.iperf_args))
|
||||
if result is None:
|
||||
self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -s -i 1" > iperf_server_' + SSH.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
|
||||
self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
|
||||
udpIperf = False
|
||||
else:
|
||||
self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -u -s -i 1" > iperf_server_' + SSH.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
|
||||
self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -u -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
|
||||
time.sleep(0.5)
|
||||
self.close()
|
||||
|
||||
@@ -1355,14 +1361,14 @@ class SSHConnection():
|
||||
modified_options = str(self.iperf_args)
|
||||
time.sleep(0.5)
|
||||
|
||||
self.command('rm -f iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
|
||||
if (useIperf3):
|
||||
self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||
self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||
|
||||
clientStatus = 0
|
||||
self.Iperf_analyzeV3Output(lock, UE_IPAddress, device_id, statusQueue)
|
||||
else:
|
||||
iperf_status = self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + SSH.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||
iperf_status = self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
|
||||
if iperf_status < 0:
|
||||
self.close()
|
||||
message = 'iperf on UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT !'
|
||||
@@ -1381,9 +1387,9 @@ class SSHConnection():
|
||||
self.close()
|
||||
if (clientStatus == -1):
|
||||
time.sleep(1)
|
||||
if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')):
|
||||
os.remove('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')
|
||||
self.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + SSH.testCase_id + '_' + device_id + '.log', '.')
|
||||
if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
|
||||
os.remove('iperf_server_' + self.testCase_id + '_' + device_id + '.log')
|
||||
self.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
|
||||
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
|
||||
except:
|
||||
os.kill(os.getppid(),signal.SIGUSR1)
|
||||
@@ -1397,13 +1403,13 @@ class SSHConnection():
|
||||
if (pStatus < 0):
|
||||
self.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
ueIpStatus = self.GetAllUEIPAddresses()
|
||||
if (ueIpStatus < 0):
|
||||
self.CreateHtmlTestRow(self.iperf_args, 'KO', UE_IP_ADDRESS_ISSUE)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
multi_jobs = []
|
||||
i = 0
|
||||
@@ -1423,7 +1429,7 @@ class SSHConnection():
|
||||
if (status_queue.empty()):
|
||||
self.CreateHtmlTestRow(self.iperf_args, 'KO', ALL_PROCESSES_OK)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
else:
|
||||
iperf_status = True
|
||||
@@ -1447,7 +1453,7 @@ class SSHConnection():
|
||||
else:
|
||||
self.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue)
|
||||
self.AutoTerminateUEandeNB()
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
|
||||
def CheckProcessExist(self, initialize_eNB_flag):
|
||||
@@ -1699,8 +1705,8 @@ class SSHConnection():
|
||||
def TerminateeNB(self):
|
||||
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
|
||||
self.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S daemon --name=enb' + str(SSH.eNB_instance) + '_daemon --stop', '\$', 5)
|
||||
self.command('rm -f my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S daemon --name=enb' + str(self.eNB_instance) + '_daemon --stop', '\$', 5)
|
||||
self.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGINT lte-softmodem || true', '\$', 5)
|
||||
time.sleep(5)
|
||||
self.command('stdbuf -o0 ps -aux | grep -v grep | grep lte-softmodem', '\$', 5)
|
||||
@@ -1744,7 +1750,7 @@ class SSHConnection():
|
||||
logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile)
|
||||
if (logStatus < 0):
|
||||
self.CreateHtmlTestRow('N/A', 'KO', logStatus)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.CreateHtmlTabFooter(False)
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
@@ -1818,7 +1824,7 @@ class SSHConnection():
|
||||
|
||||
def TerminateUE(self):
|
||||
terminate_ue_flag = True
|
||||
SSH.GetAllUEDevices(terminate_ue_flag)
|
||||
self.GetAllUEDevices(terminate_ue_flag)
|
||||
multi_jobs = []
|
||||
for device_id in self.UEDevices:
|
||||
p = Process(target= SSH.TerminateUE_common, args = (device_id,))
|
||||
@@ -1840,6 +1846,10 @@ class SSHConnection():
|
||||
self.eNB_instance = '0'
|
||||
self.TerminateeNB()
|
||||
|
||||
def IdleSleep(self):
|
||||
time.sleep(self.idle_sleep_time)
|
||||
self.CreateHtmlTestRow(str(self.idle_sleep_time) + ' sec', 'OK', ALL_PROCESSES_OK)
|
||||
|
||||
def LogCollectBuild(self):
|
||||
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
|
||||
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
|
||||
@@ -1930,6 +1940,7 @@ class SSHConnection():
|
||||
self.htmlFile.write(' <title>Test Results for TEMPLATE_JOB_NAME job build #TEMPLATE_BUILD_ID</title>\n')
|
||||
self.htmlFile.write('</head>\n')
|
||||
self.htmlFile.write('<body><div class="container">\n')
|
||||
self.htmlFile.write(' <br>\n')
|
||||
self.htmlFile.write(' <table style="border-collapse: collapse; border: none;">\n')
|
||||
self.htmlFile.write(' <tr style="border-collapse: collapse; border: none;">\n')
|
||||
self.htmlFile.write(' <td style="border-collapse: collapse; border: none;">\n')
|
||||
@@ -1946,37 +1957,37 @@ class SSHConnection():
|
||||
self.htmlFile.write(' <br>\n')
|
||||
self.htmlFile.write(' <table border = "1">\n')
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Build Start Time (UTC)</td>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-time"></span> Build Start Time (UTC) </td>\n')
|
||||
self.htmlFile.write(' <td>TEMPLATE_BUILD_TIME</td>\n')
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >GIT Repository</td>\n')
|
||||
self.htmlFile.write(' <td><a href="' + SSH.eNBRepository + '">' + SSH.eNBRepository + '</a></td>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository </td>\n')
|
||||
self.htmlFile.write(' <td><a href="' + self.eNBRepository + '">' + self.eNBRepository + '</a></td>\n')
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Job Trigger</td>\n')
|
||||
if (SSH.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Job Trigger </td>\n')
|
||||
if (self.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <td>Merge-Request</td>\n')
|
||||
else:
|
||||
self.htmlFile.write(' <td>Push to Branch</td>\n')
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
if (SSH.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Source Branch</td>\n')
|
||||
if (self.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch </td>\n')
|
||||
else:
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Branch</td>\n')
|
||||
self.htmlFile.write(' <td>' + SSH.eNBBranch + '</td>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-tree"></span> Branch</td>\n')
|
||||
self.htmlFile.write(' <td>' + self.eNBBranch + '</td>\n')
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
if (SSH.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Source Commit ID</td>\n')
|
||||
if (self.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID </td>\n')
|
||||
else:
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Commit ID</td>\n')
|
||||
self.htmlFile.write(' <td>' + SSH.eNBCommitID + '</td>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID </td>\n')
|
||||
self.htmlFile.write(' <td>' + self.eNBCommitID + '</td>\n')
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
if (SSH.eNB_AllowMerge):
|
||||
if (self.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Target Branch</td>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-log-in"></span> Target Branch </td>\n')
|
||||
if (self.eNBTargetBranch == ''):
|
||||
self.htmlFile.write(' <td>develop</td>\n')
|
||||
else:
|
||||
@@ -1985,19 +1996,45 @@ class SSHConnection():
|
||||
self.htmlFile.write(' </table>\n')
|
||||
|
||||
terminate_ue_flag = True
|
||||
SSH.GetAllUEDevices(terminate_ue_flag)
|
||||
SSH.GetAllCatMDevices(terminate_ue_flag)
|
||||
if (self.ADBIPAddress != 'none'):
|
||||
self.GetAllUEDevices(terminate_ue_flag)
|
||||
self.GetAllCatMDevices(terminate_ue_flag)
|
||||
else:
|
||||
self.UEDevices.append('doughq9rehg')
|
||||
self.UEDevices.append('dnsgiuahgia')
|
||||
self.UEDevices.append('uehgieng9')
|
||||
self.htmlUEConnected = len(self.UEDevices)
|
||||
|
||||
self.htmlFile.write(' <h2><a href="#FinalStatus">Jump to Final Status</a></h2>\n')
|
||||
self.htmlFile.write(' <h2><span class="glyphicon glyphicon-phone"></span> <span class="glyphicon glyphicon-menu-right"></span> ' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server</h2>\n')
|
||||
self.htmlFile.write(' <h2><span class="glyphicon glyphicon-phone"></span> <span class="glyphicon glyphicon-menu-right"></span> ' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server</h2>\n')
|
||||
self.htmlFile.write(' <br>\n')
|
||||
self.htmlFile.write(' <ul class="nav nav-pills">\n')
|
||||
count = 0
|
||||
while (count < self.nbTestXMLfiles):
|
||||
pillMsg = ' <li><a data-toggle="pill" href="#'
|
||||
pillMsg += self.htmlTabRefs[count]
|
||||
pillMsg += '">'
|
||||
pillMsg += self.htmlTabNames[count]
|
||||
pillMsg += ' <span class="glyphicon glyphicon-'
|
||||
pillMsg += self.htmlTabIcons[count]
|
||||
pillMsg += '"></span></a></li>\n'
|
||||
self.htmlFile.write(pillMsg)
|
||||
count += 1
|
||||
self.htmlFile.write(' </ul>\n')
|
||||
self.htmlFile.write(' <div class="tab-content">\n')
|
||||
self.htmlFile.close()
|
||||
|
||||
self.htmlFile.write(' <h2>' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server</h2>\n')
|
||||
self.htmlFile.write(' <h2>' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server</h2>\n')
|
||||
self.htmlFile.write(' <br>\n')
|
||||
|
||||
self.htmlFile.write(' <h2>Test Summary for ' + SSH.testXMLfile + '</h2>\n')
|
||||
self.htmlFile.write(' <table border = "1">\n')
|
||||
def CreateHtmlTabHeader(self):
|
||||
if (not self.htmlHeaderCreated):
|
||||
if (not os.path.isfile('test_results.html')):
|
||||
self.CreateHtmlHeader()
|
||||
self.htmlFile = open('test_results.html', 'a')
|
||||
if (self.nbTestXMLfiles == 1):
|
||||
self.htmlFile.write(' <div id="' + self.htmlTabRefs[0] + '" class="tab-pane fade">\n')
|
||||
self.htmlFile.write(' <h3>Test Summary for <span class="glyphicon glyphicon-file"></span> ' + self.testXMLfiles[0] + '</h3>\n')
|
||||
else:
|
||||
self.htmlFile.write(' <div id="build-tab" class="tab-pane fade">\n')
|
||||
self.htmlFile.write(' <table class="table" border = "1">\n')
|
||||
self.htmlFile.write(' <tr bgcolor = "#33CCFF" >\n')
|
||||
self.htmlFile.write(' <th>Test Id</th>\n')
|
||||
self.htmlFile.write(' <th>Test Desc</th>\n')
|
||||
@@ -2010,28 +2047,44 @@ class SSHConnection():
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
self.htmlHeaderCreated = True
|
||||
|
||||
def CreateHtmlFooter(self, passStatus):
|
||||
def CreateHtmlTabFooter(self, passStatus):
|
||||
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
|
||||
self.htmlFile.write(' <tr id="FinalStatus">\n')
|
||||
self.htmlFile.write(' <th bgcolor = "#33CCFF" colspan=2>Final Status</th>\n')
|
||||
self.htmlFile.write(' <tr">\n')
|
||||
self.htmlFile.write(' <th bgcolor = "#33CCFF" colspan=2>Final Tab Status</th>\n')
|
||||
if passStatus:
|
||||
self.htmlFile.write(' <th bgcolor = "green" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">PASS</font></th>\n')
|
||||
self.htmlFile.write(' <th bgcolor = "green" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">PASS <span class="glyphicon glyphicon-ok"></span> </font></th>\n')
|
||||
else:
|
||||
self.htmlFile.write(' <th bgcolor = "red" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">FAIL</font></th>\n')
|
||||
self.htmlFile.write(' <th bgcolor = "red" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">FAIL <span class="glyphicon glyphicon-remove"></span> </font></th>\n')
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
self.htmlFile.write(' </table>\n')
|
||||
self.htmlFile.write(' </div>\n')
|
||||
self.htmlFooterCreated = False
|
||||
|
||||
def CreateHtmlFooter(self, passStatus):
|
||||
if (os.path.isfile('test_results.html')):
|
||||
self.htmlFile = open('test_results.html', 'a')
|
||||
self.htmlFile.write('</div>\n')
|
||||
self.htmlFile.write(' <p></p>\n')
|
||||
self.htmlFile.write(' <table class="table">\n')
|
||||
self.htmlFile.write(' <tr">\n')
|
||||
self.htmlFile.write(' <th bgcolor = "#33CCFF">Final Status</th>\n')
|
||||
if passStatus:
|
||||
self.htmlFile.write(' <th bgcolor="green"><font color="white">PASS <span class="glyphicon glyphicon-ok"></span></font></th>\n')
|
||||
else:
|
||||
self.htmlFile.write(' <th bgcolor="red"><font color="white">FAIL <span class="glyphicon glyphicon-remove"></span> </font></th>\n')
|
||||
self.htmlFile.write(' </tr">\n')
|
||||
self.htmlFile.write(' </table>\n')
|
||||
self.htmlFile.write(' <p></p>\n')
|
||||
self.htmlFile.write(' <div class="well well-lg">End of Test Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2018 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n')
|
||||
self.htmlFile.write('</div></body>\n')
|
||||
self.htmlFile.write('</html>\n')
|
||||
self.htmlFile.close()
|
||||
self.htmlFooterCreated = False
|
||||
|
||||
def CreateHtmlTestRow(self, options, status, processesStatus):
|
||||
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >' + SSH.testCase_id + '</td>\n')
|
||||
self.htmlFile.write(' <td>' + SSH.desc + '</td>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >' + self.testCase_id + '</td>\n')
|
||||
self.htmlFile.write(' <td>' + self.desc + '</td>\n')
|
||||
self.htmlFile.write(' <td>' + str(options) + '</td>\n')
|
||||
if (str(status) == 'OK'):
|
||||
self.htmlFile.write(' <td bgcolor = "lightgreen" >' + str(status) + '</td>\n')
|
||||
@@ -2081,8 +2134,8 @@ class SSHConnection():
|
||||
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
|
||||
addOrangeBK = False
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >' + SSH.testCase_id + '</td>\n')
|
||||
self.htmlFile.write(' <td>' + SSH.desc + '</td>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >' + self.testCase_id + '</td>\n')
|
||||
self.htmlFile.write(' <td>' + self.desc + '</td>\n')
|
||||
self.htmlFile.write(' <td>' + str(options) + '</td>\n')
|
||||
if (str(status) == 'OK'):
|
||||
self.htmlFile.write(' <td bgcolor = "lightgreen" >' + str(status) + '</td>\n')
|
||||
@@ -2126,6 +2179,7 @@ def Usage():
|
||||
print(' --help Show this help.')
|
||||
print(' --mode=[Mode]')
|
||||
print(' TesteNB')
|
||||
print(' InitiateHtml, FinalizeHtml')
|
||||
print(' TerminateeNB, TerminateUE, TerminateHSS, TerminateMME, TerminateSPGW')
|
||||
print(' LogCollectBuild, LogCollecteNB, LogCollectHSS, LogCollectMME, LogCollectSPGW, LogCollectPing, LogCollectIperf')
|
||||
print(' --eNBIPAddress=[eNB\'s IP Address]')
|
||||
@@ -2149,7 +2203,7 @@ def Usage():
|
||||
print('------------------------------------------------------------')
|
||||
|
||||
def CheckClassValidity(action,id):
|
||||
if action != 'Build_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module':
|
||||
if action != 'Build_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'IdleSleep':
|
||||
logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action)
|
||||
return False
|
||||
return True
|
||||
@@ -2191,6 +2245,13 @@ def GetParametersFromXML(action):
|
||||
logging.debug('ERROR: test-case has wrong profile ' + SSH.iperf_profile)
|
||||
SSH.iperf_profile = 'balanced'
|
||||
|
||||
if action == 'IdleSleep':
|
||||
string_field = test.findtext('idle_sleep_time_in_sec')
|
||||
if (string_field is None):
|
||||
SSH.idle_sleep_time = 5
|
||||
else:
|
||||
SSH.idle_sleep_time = int(string_field)
|
||||
|
||||
#check if given test is in list
|
||||
#it is in list if one of the strings in 'list' is at the beginning of 'test'
|
||||
def test_in_list(test, list):
|
||||
@@ -2281,7 +2342,13 @@ while len(argvs) > 1:
|
||||
SSH.ADBPassword = matchReg.group(1)
|
||||
elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE):
|
||||
matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE)
|
||||
SSH.testXMLfile = matchReg.group(1)
|
||||
SSH.testXMLfiles.append(matchReg.group(1))
|
||||
SSH.nbTestXMLfiles += 1
|
||||
elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE):
|
||||
matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE)
|
||||
finalStatus = matchReg.group(1)
|
||||
if ((finalStatus == 'true') or (finalStatus == 'True')):
|
||||
SSH.finalStatus = True
|
||||
else:
|
||||
Usage()
|
||||
sys.exit('Invalid Parameter: ' + myArgv)
|
||||
@@ -2347,27 +2414,44 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE):
|
||||
Usage()
|
||||
sys.exit('Insufficient Parameter')
|
||||
SSH.LogCollectIperf()
|
||||
elif re.match('^InitiateHtml$', mode, re.IGNORECASE):
|
||||
if SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '':
|
||||
Usage()
|
||||
sys.exit('Insufficient Parameter')
|
||||
count = 0
|
||||
while (count < SSH.nbTestXMLfiles):
|
||||
xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[count]
|
||||
xmlTree = ET.parse(xml_test_file)
|
||||
xmlRoot = xmlTree.getroot()
|
||||
SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count)))
|
||||
SSH.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='Test-' + str(count)))
|
||||
SSH.htmlTabIcons.append(xmlRoot.findtext('htmlTabIcon',default='info-sign'))
|
||||
count += 1
|
||||
SSH.CreateHtmlHeader()
|
||||
elif re.match('^FinalizeHtml$', mode, re.IGNORECASE):
|
||||
SSH.CreateHtmlFooter(SSH.finalStatus)
|
||||
elif re.match('^TesteNB$', mode, re.IGNORECASE):
|
||||
if SSH.eNBIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '' or SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '' or SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '':
|
||||
Usage()
|
||||
sys.exit('Insufficient Parameter')
|
||||
|
||||
SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp")
|
||||
SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp")
|
||||
SSH.CreateHtmlHeader()
|
||||
|
||||
if (SSH.EPCIPAddress != 'none'):
|
||||
SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp")
|
||||
SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp")
|
||||
#read test_case_list.xml file
|
||||
# if no parameters for XML file, use default value
|
||||
if SSH.testXMLfile == '':
|
||||
if (SSH.nbTestXMLfiles != 1):
|
||||
xml_test_file = sys.path[0] + "/test_case_list.xml"
|
||||
else:
|
||||
xml_test_file = sys.path[0] + "/" + SSH.testXMLfile
|
||||
xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[0]
|
||||
|
||||
xmlTree = ET.parse(xml_test_file)
|
||||
xmlRoot = xmlTree.getroot()
|
||||
|
||||
exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='')
|
||||
requested_tests=xmlRoot.findtext('TestCaseRequestedList',default='')
|
||||
if (SSH.nbTestXMLfiles == 1):
|
||||
SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-0'))
|
||||
all_tests=xmlRoot.findall('testCase')
|
||||
|
||||
exclusion_tests=exclusion_tests.split()
|
||||
@@ -2405,6 +2489,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
|
||||
|
||||
signal.signal(signal.SIGUSR1, receive_signal)
|
||||
|
||||
SSH.CreateHtmlTabHeader()
|
||||
|
||||
for test_case_id in todo_tests:
|
||||
for test in all_tests:
|
||||
id = test.get('id')
|
||||
@@ -2460,10 +2546,12 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
|
||||
SSH.InitializeSPGW()
|
||||
elif action == 'Terminate_SPGW':
|
||||
SSH.TerminateSPGW()
|
||||
elif action == 'IdleSleep':
|
||||
SSH.IdleSleep()
|
||||
else:
|
||||
sys.exit('Invalid action')
|
||||
|
||||
SSH.CreateHtmlFooter(True)
|
||||
SSH.CreateHtmlTabFooter(True)
|
||||
else:
|
||||
Usage()
|
||||
sys.exit('Invalid mode')
|
||||
|
||||
Reference in New Issue
Block a user