Commit 70711c34 authored by Raphael Defosseux's avatar Raphael Defosseux

CI: adding support for multiple XML scenario files

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent b805cfc6
...@@ -27,6 +27,8 @@ def pythonExecutor = params.pythonExecutor ...@@ -27,6 +27,8 @@ def pythonExecutor = params.pythonExecutor
// Location of the test XML file to be run // Location of the test XML file to be run
def testXMLFile = params.pythonTestXmlFile def testXMLFile = params.pythonTestXmlFile
def mainPythonAllXmlFiles = ""
def buildStageStatus = true
// Name of the test stage // Name of the test stage
def testStageName = params.pipelineTestStageName def testStageName = params.pipelineTestStageName
...@@ -108,8 +110,14 @@ pipeline { ...@@ -108,8 +110,14 @@ pipeline {
if (params.pythonTestXmlFile == null) { if (params.pythonTestXmlFile == null) {
// picking default // picking default
testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml'
echo "Test XML file(default): ${testXMLFile}"
mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " "
} else { } else {
echo "Test XML file : ${testXMLFile}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
for (xmlFile in myXmlTestSuite) {
mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " "
echo "Test XML file : ${xmlFile}"
}
} }
// If not present picking a default Stage Name // If not present picking a default Stage Name
if (params.pipelineTestStageName == null) { if (params.pipelineTestStageName == null) {
...@@ -194,17 +202,23 @@ pipeline { ...@@ -194,17 +202,23 @@ pipeline {
steps { steps {
script { script {
dir ('ci-scripts') { dir ('ci-scripts') {
try { echo "\u2705 \u001B[32m${testStageName}\u001B[0m"
echo "\u2705 \u001B[32m${testStageName}\u001B[0m" withCredentials([
withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'],
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'],
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password']
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) {
]) { sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}"
sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${testXMLFile}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
for (xmlFile in myXmlTestSuite) {
try {
sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
buildStageStatus = false
}
} }
} catch (Exception e) { sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus}"
currentBuild.result = 'FAILURE'
} }
} }
} }
......
...@@ -91,7 +91,8 @@ class SSHConnection(): ...@@ -91,7 +91,8 @@ class SSHConnection():
self.ADBUserName = '' self.ADBUserName = ''
self.ADBPassword = '' self.ADBPassword = ''
self.testCase_id = '' self.testCase_id = ''
self.testXMLfile = '' self.testXMLfiles = []
self.nbTestXMLfiles = 0
self.desc = '' self.desc = ''
self.Build_eNB_args = '' self.Build_eNB_args = ''
self.Initialize_eNB_args = '' self.Initialize_eNB_args = ''
...@@ -112,6 +113,11 @@ class SSHConnection(): ...@@ -112,6 +113,11 @@ class SSHConnection():
self.htmlUEConnected = 0 self.htmlUEConnected = 0
self.htmleNBFailureMsg = '' self.htmleNBFailureMsg = ''
self.picocom_closure = False self.picocom_closure = False
self.idle_sleep_time = 0
self.htmlTabRefs = []
self.htmlTabNames = []
self.htmlTabIcons = []
self.finalStatus = False
def open(self, ipaddress, username, password): def open(self, ipaddress, username, password):
count = 0 count = 0
...@@ -282,9 +288,9 @@ class SSHConnection(): ...@@ -282,9 +288,9 @@ class SSHConnection():
self.command('chmod 777 log', '\$', 5) self.command('chmod 777 log', '\$', 5)
# no need to remove in log (git clean did the trick) # 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('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('mkdir -p build_log_' + self.testCase_id, '\$', 5)
self.command('mv log/* ' + 'build_log_' + SSH.testCase_id, '\$', 5) self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5)
self.command('mv compile_oai_enb.log ' + 'build_log_' + SSH.testCase_id, '\$', 5) self.command('mv compile_oai_enb.log ' + 'build_log_' + self.testCase_id, '\$', 5)
# Workaround to run with develop-nr # Workaround to run with develop-nr
self.command('if [ -e ran_build ]; then cp -rf ran_build lte_build_oai; fi', '\$', 30) self.command('if [ -e ran_build ]; then cp -rf ran_build lte_build_oai; fi', '\$', 30)
self.close() self.close()
...@@ -300,7 +306,7 @@ class SSHConnection(): ...@@ -300,7 +306,7 @@ class SSHConnection():
self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
self.command('source oaienv', '\$', 5) self.command('source oaienv', '\$', 5)
self.command('cd scripts', '\$', 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: else:
logging.debug('Using the ltebox simulated HSS') 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) 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(): ...@@ -326,7 +332,7 @@ class SSHConnection():
logging.debug('\u001B[1;37;41m Hostname Not Found! \u001B[0m') logging.debug('\u001B[1;37;41m Hostname Not Found! \u001B[0m')
sys.exit(1) sys.exit(1)
host_name = result.group('host_name') 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: else:
self.command('cd /opt/ltebox/tools', '\$', 5) self.command('cd /opt/ltebox/tools', '\$', 5)
self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_mme', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_mme', '\$', 5)
...@@ -342,7 +348,7 @@ class SSHConnection(): ...@@ -342,7 +348,7 @@ class SSHConnection():
self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
self.command('source oaienv', '\$', 5) self.command('source oaienv', '\$', 5)
self.command('cd scripts', '\$', 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: else:
self.command('cd /opt/ltebox/tools', '\$', 5) self.command('cd /opt/ltebox/tools', '\$', 5)
self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_xGw', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_xGw', '\$', 5)
...@@ -357,7 +363,7 @@ class SSHConnection(): ...@@ -357,7 +363,7 @@ class SSHConnection():
pStatus = self.CheckProcessExist(initialize_eNB_flag) pStatus = self.CheckProcessExist(initialize_eNB_flag)
if (pStatus < 0): if (pStatus < 0):
self.CreateHtmlTestRow(self.Initialize_eNB_args, 'KO', pStatus) self.CreateHtmlTestRow(self.Initialize_eNB_args, 'KO', pStatus)
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
# If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB # 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)) result = re.search('T_stdout', str(self.Initialize_eNB_args))
...@@ -368,8 +374,8 @@ class SSHConnection(): ...@@ -368,8 +374,8 @@ class SSHConnection():
if result is not None: if result is not None:
eth_interface = result.group('eth_interface') eth_interface = result.group('eth_interface')
logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m') 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 ' + 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_' + SSH.testCase_id + '_s1log.pcap > /tmp/tshark.log 2>&1 &', self.EPCUserName, 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.close()
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
self.command('cd ' + self.eNBSourceCodePath, '\$', 5) self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
...@@ -384,7 +390,7 @@ class SSHConnection(): ...@@ -384,7 +390,7 @@ class SSHConnection():
logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m') logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m')
self.command('cd common/utils/T/tracer', '\$', 5) self.command('cd common/utils/T/tracer', '\$', 5)
self.command('make', '\$', 10) 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) self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
full_config_file = full_config_file[:extIdx + 5] full_config_file = full_config_file[:extIdx + 5]
config_path, config_file = os.path.split(full_config_file) config_path, config_file = os.path.split(full_config_file)
...@@ -402,12 +408,12 @@ class SSHConnection(): ...@@ -402,12 +408,12 @@ class SSHConnection():
# Launch eNB with the modified config file # Launch eNB with the modified config file
self.command('source oaienv', '\$', 5) self.command('source oaienv', '\$', 5)
self.command('cd cmake_targets', '\$', 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('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(SSH.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_' + SSH.testCase_id + '.log', '\$', 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(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 ' + 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: if not rruCheck:
self.eNBLogFile = 'enb_' + SSH.testCase_id + '.log' self.eNBLogFile = 'enb_' + self.testCase_id + '.log'
time.sleep(6) time.sleep(6)
doLoop = True doLoop = True
loopCounter = 10 loopCounter = 10
...@@ -422,7 +428,7 @@ class SSHConnection(): ...@@ -422,7 +428,7 @@ class SSHConnection():
doLoop = False doLoop = False
logging.error('\u001B[1;37;41m eNB logging system did not show got sync! \u001B[0m') 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.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 # In case of T tracer recording, we need to kill tshark on EPC side
result = re.search('T_stdout', str(self.Initialize_eNB_args)) result = re.search('T_stdout', str(self.Initialize_eNB_args))
if result is not None: if result is not None:
...@@ -431,12 +437,12 @@ class SSHConnection(): ...@@ -431,12 +437,12 @@ class SSHConnection():
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
self.close() self.close()
time.sleep(1) 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.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/.') self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
sys.exit(1) sys.exit(1)
else: 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: if rruCheck:
result = re.search('wait RUs', str(self.ssh.before)) result = re.search('wait RUs', str(self.ssh.before))
else: else:
...@@ -472,7 +478,7 @@ class SSHConnection(): ...@@ -472,7 +478,7 @@ class SSHConnection():
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
multi_jobs = [] multi_jobs = []
for device_id in self.UEDevices: 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.daemon = True
p.start() p.start()
multi_jobs.append(p) multi_jobs.append(p)
...@@ -639,7 +645,7 @@ class SSHConnection(): ...@@ -639,7 +645,7 @@ class SSHConnection():
if (pStatus < 0): if (pStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', pStatus) self.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
multi_jobs = [] multi_jobs = []
status_queue = SimpleQueue() status_queue = SimpleQueue()
...@@ -647,7 +653,7 @@ class SSHConnection(): ...@@ -647,7 +653,7 @@ class SSHConnection():
nb_ue_to_connect = 0 nb_ue_to_connect = 0
for device_id in self.UEDevices: for device_id in self.UEDevices:
if (self.nbMaxUEtoAttach == -1) or (nb_ue_to_connect < self.nbMaxUEtoAttach): 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.daemon = True
p.start() p.start()
multi_jobs.append(p) multi_jobs.append(p)
...@@ -657,7 +663,7 @@ class SSHConnection(): ...@@ -657,7 +663,7 @@ class SSHConnection():
if (status_queue.empty()): if (status_queue.empty()):
self.CreateHtmlTestRow('N/A', 'KO', ALL_PROCESSES_OK) self.CreateHtmlTestRow('N/A', 'KO', ALL_PROCESSES_OK)
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
sys.exit(1) sys.exit(1)
else: else:
...@@ -683,7 +689,7 @@ class SSHConnection(): ...@@ -683,7 +689,7 @@ class SSHConnection():
else: else:
self.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue) self.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
def DetachUE_common(self, device_id): def DetachUE_common(self, device_id):
...@@ -704,11 +710,11 @@ class SSHConnection(): ...@@ -704,11 +710,11 @@ class SSHConnection():
if (pStatus < 0): if (pStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', pStatus) self.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
multi_jobs = [] multi_jobs = []
for device_id in self.UEDevices: 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.daemon = True
p.start() p.start()
multi_jobs.append(p) multi_jobs.append(p)
...@@ -767,11 +773,11 @@ class SSHConnection(): ...@@ -767,11 +773,11 @@ class SSHConnection():
pStatus = self.CheckProcessExist(initialize_eNB_flag) pStatus = self.CheckProcessExist(initialize_eNB_flag)
if (pStatus < 0): if (pStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', pStatus) self.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
multi_jobs = [] multi_jobs = []
for device_id in self.UEDevices: 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.daemon = True
p.start() p.start()
multi_jobs.append(p) multi_jobs.append(p)
...@@ -851,7 +857,7 @@ class SSHConnection(): ...@@ -851,7 +857,7 @@ class SSHConnection():
self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
self.command('cd scripts', '\$', 5) self.command('cd scripts', '\$', 5)
ping_time = re.findall("-c (\d+)",str(self.ping_args)) 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 # TIMEOUT CASE
if ping_status < 0: if ping_status < 0:
message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!' message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!'
...@@ -919,12 +925,12 @@ class SSHConnection(): ...@@ -919,12 +925,12 @@ class SSHConnection():
pStatus = self.CheckProcessExist(initialize_eNB_flag) pStatus = self.CheckProcessExist(initialize_eNB_flag)
if (pStatus < 0): if (pStatus < 0):
self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
ueIpStatus = self.GetAllUEIPAddresses() ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0): if (ueIpStatus < 0):
self.CreateHtmlTestRow(self.ping_args, 'KO', UE_IP_ADDRESS_ISSUE) self.CreateHtmlTestRow(self.ping_args, 'KO', UE_IP_ADDRESS_ISSUE)
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
multi_jobs = [] multi_jobs = []
i = 0 i = 0
...@@ -932,7 +938,7 @@ class SSHConnection(): ...@@ -932,7 +938,7 @@ class SSHConnection():
status_queue = SimpleQueue() status_queue = SimpleQueue()
for UE_IPAddress in self.UEIPAddresses: for UE_IPAddress in self.UEIPAddresses:
device_id = self.UEDevices[i] 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.daemon = True
p.start() p.start()
multi_jobs.append(p) multi_jobs.append(p)
...@@ -943,7 +949,7 @@ class SSHConnection(): ...@@ -943,7 +949,7 @@ class SSHConnection():
if (status_queue.empty()): if (status_queue.empty()):
self.CreateHtmlTestRow(self.ping_args, 'KO', ALL_PROCESSES_OK) self.CreateHtmlTestRow(self.ping_args, 'KO', ALL_PROCESSES_OK)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
else: else:
ping_status = True ping_status = True
...@@ -962,7 +968,7 @@ class SSHConnection(): ...@@ -962,7 +968,7 @@ class SSHConnection():
else: else:
self.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue) self.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
def Iperf_ComputeTime(self): def Iperf_ComputeTime(self):
...@@ -978,11 +984,11 @@ class SSHConnection(): ...@@ -978,11 +984,11 @@ class SSHConnection():
logging.debug('\u001B[1;37;41m Iperf bandwidth Not Found! \u001B[0m') logging.debug('\u001B[1;37;41m Iperf bandwidth Not Found! \u001B[0m')
sys.exit(1) sys.exit(1)
iperf_bandwidth = result.group('iperf_bandwidth') iperf_bandwidth = result.group('iperf_bandwidth')
if SSH.iperf_profile == 'balanced': if self.iperf_profile == 'balanced':
iperf_bandwidth_new = float(iperf_bandwidth)/ue_num 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) iperf_bandwidth_new = float(iperf_bandwidth)
if SSH.iperf_profile == 'unbalanced': if self.iperf_profile == 'unbalanced':
# residual is 2% of max bw # residual is 2% of max bw
residualBW = float(iperf_bandwidth) / 50 residualBW = float(iperf_bandwidth) / 50
if idx == 0: if idx == 0:
...@@ -998,7 +1004,7 @@ class SSHConnection(): ...@@ -998,7 +1004,7 @@ class SSHConnection():
return result return result
def Iperf_analyzeV2TCPOutput(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): 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)) 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: if result is not None:
avgbitrate = result.group('average') avgbitrate = result.group('average')
...@@ -1104,7 +1110,7 @@ class SSHConnection(): ...@@ -1104,7 +1110,7 @@ class SSHConnection():
return 0 return 0
def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): 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') self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log')
return return
# Computing the requested bandwidth in float # Computing the requested bandwidth in float
...@@ -1129,7 +1135,7 @@ class SSHConnection(): ...@@ -1129,7 +1135,7 @@ class SSHConnection():
req_bandwidth = '%.1f Gbits/sec' % req_bw req_bandwidth = '%.1f Gbits/sec' % req_bw
req_bw = req_bw * 1000000000 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 br_sum = 0.0
ji_sum = 0.0 ji_sum = 0.0
pl_sum = 0 pl_sum = 0
...@@ -1254,12 +1260,12 @@ class SSHConnection(): ...@@ -1254,12 +1260,12 @@ class SSHConnection():
# Launch iperf server on EPC side # Launch iperf server on EPC side
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) 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 port = 5001 + idx
if udpIperf: 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: 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) time.sleep(0.5)
self.close() self.close()
...@@ -1276,8 +1282,8 @@ class SSHConnection(): ...@@ -1276,8 +1282,8 @@ class SSHConnection():
modified_options = modified_options.replace('-R','') modified_options = modified_options.replace('-R','')
time.sleep(0.5) 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)
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) 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 # TIMEOUT Case
if iperf_status < 0: if iperf_status < 0:
self.close() self.close()
...@@ -1295,15 +1301,15 @@ class SSHConnection(): ...@@ -1295,15 +1301,15 @@ class SSHConnection():
# in case of failure, retrieve server log # in case of failure, retrieve server log
if (clientStatus == -1): if (clientStatus == -1):
time.sleep(1) time.sleep(1)
if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
os.remove('iperf_server_' + SSH.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_' + SSH.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) self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue): def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue):
try: try:
# Single-UE profile -- iperf only on one UE # 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 return
useIperf3 = False useIperf3 = False
udpIperf = True udpIperf = True
...@@ -1334,13 +1340,13 @@ class SSHConnection(): ...@@ -1334,13 +1340,13 @@ class SSHConnection():
if (useIperf3): if (useIperf3):
self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5) self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5)
else: 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)) result = re.search('-u', str(self.iperf_args))
if result is None: 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 udpIperf = False
else: 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) time.sleep(0.5)
self.close() self.close()
...@@ -1355,14 +1361,14 @@ class SSHConnection(): ...@@ -1355,14 +1361,14 @@ class SSHConnection():
modified_options = str(self.iperf_args) modified_options = str(self.iperf_args)
time.sleep(0.5) 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): 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 clientStatus = 0
self.Iperf_analyzeV3Output(lock, UE_IPAddress, device_id, statusQueue) self.Iperf_analyzeV3Output(lock, UE_IPAddress, device_id, statusQueue)
else: 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: if iperf_status < 0:
self.close() self.close()
message = 'iperf on UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT !' message = 'iperf on UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT !'
...@@ -1381,9 +1387,9 @@ class SSHConnection(): ...@@ -1381,9 +1387,9 @@ class SSHConnection():
self.close() self.close()
if (clientStatus == -1): if (clientStatus == -1):
time.sleep(1) time.sleep(1)
if (os.path.isfile('iperf_server_' + SSH.testCase_id + '_' + device_id + '.log')): if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
os.remove('iperf_server_' + SSH.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_' + SSH.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) self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
except: except:
os.kill(os.getppid(),signal.SIGUSR1) os.kill(os.getppid(),signal.SIGUSR1)
...@@ -1397,13 +1403,13 @@ class SSHConnection(): ...@@ -1397,13 +1403,13 @@ class SSHConnection():
if (pStatus < 0): if (pStatus < 0):
self.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus) self.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
ueIpStatus = self.GetAllUEIPAddresses() ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0): if (ueIpStatus < 0):
self.CreateHtmlTestRow(self.iperf_args, 'KO', UE_IP_ADDRESS_ISSUE) self.CreateHtmlTestRow(self.iperf_args, 'KO', UE_IP_ADDRESS_ISSUE)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
multi_jobs = [] multi_jobs = []
i = 0 i = 0
...@@ -1423,7 +1429,7 @@ class SSHConnection(): ...@@ -1423,7 +1429,7 @@ class SSHConnection():
if (status_queue.empty()): if (status_queue.empty()):
self.CreateHtmlTestRow(self.iperf_args, 'KO', ALL_PROCESSES_OK) self.CreateHtmlTestRow(self.iperf_args, 'KO', ALL_PROCESSES_OK)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
else: else:
iperf_status = True iperf_status = True
...@@ -1447,7 +1453,7 @@ class SSHConnection(): ...@@ -1447,7 +1453,7 @@ class SSHConnection():
else: else:
self.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue) self.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB() self.AutoTerminateUEandeNB()
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
def CheckProcessExist(self, initialize_eNB_flag): def CheckProcessExist(self, initialize_eNB_flag):
...@@ -1699,8 +1705,8 @@ class SSHConnection(): ...@@ -1699,8 +1705,8 @@ class SSHConnection():
def TerminateeNB(self): def TerminateeNB(self):
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
self.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5) 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('echo ' + self.eNBPassword + ' | sudo -S daemon --name=enb' + str(self.eNB_instance) + '_daemon --stop', '\$', 5)
self.command('rm -f my-lte-softmodem-run' + str(SSH.eNB_instance) + '.sh', '\$', 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) self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGINT lte-softmodem || true', '\$', 5)
time.sleep(5) time.sleep(5)
self.command('stdbuf -o0 ps -aux | grep -v grep | grep lte-softmodem', '\$', 5) self.command('stdbuf -o0 ps -aux | grep -v grep | grep lte-softmodem', '\$', 5)
...@@ -1744,7 +1750,7 @@ class SSHConnection(): ...@@ -1744,7 +1750,7 @@ class SSHConnection():
logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile) logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile)
if (logStatus < 0): if (logStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', logStatus) self.CreateHtmlTestRow('N/A', 'KO', logStatus)
self.CreateHtmlFooter(False) self.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
else: else:
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
...@@ -1818,7 +1824,7 @@ class SSHConnection(): ...@@ -1818,7 +1824,7 @@ class SSHConnection():
def TerminateUE(self): def TerminateUE(self):
terminate_ue_flag = True terminate_ue_flag = True
SSH.GetAllUEDevices(terminate_ue_flag) self.GetAllUEDevices(terminate_ue_flag)
multi_jobs = [] multi_jobs = []
for device_id in self.UEDevices: for device_id in self.UEDevices:
p = Process(target= SSH.TerminateUE_common, args = (device_id,)) p = Process(target= SSH.TerminateUE_common, args = (device_id,))
...@@ -1840,6 +1846,10 @@ class SSHConnection(): ...@@ -1840,6 +1846,10 @@ class SSHConnection():
self.eNB_instance = '0' self.eNB_instance = '0'
self.TerminateeNB() 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): def LogCollectBuild(self):
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
self.command('cd ' + self.eNBSourceCodePath, '\$', 5) self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
...@@ -1930,6 +1940,7 @@ class SSHConnection(): ...@@ -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(' <title>Test Results for TEMPLATE_JOB_NAME job build #TEMPLATE_BUILD_ID</title>\n')
self.htmlFile.write('</head>\n') self.htmlFile.write('</head>\n')
self.htmlFile.write('<body><div class="container">\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(' <table style="border-collapse: collapse; border: none;">\n')
self.htmlFile.write(' <tr 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') self.htmlFile.write(' <td style="border-collapse: collapse; border: none;">\n')
...@@ -1946,37 +1957,37 @@ class SSHConnection(): ...@@ -1946,37 +1957,37 @@ class SSHConnection():
self.htmlFile.write(' <br>\n') self.htmlFile.write(' <br>\n')
self.htmlFile.write(' <table border = "1">\n') self.htmlFile.write(' <table border = "1">\n')
self.htmlFile.write(' <tr>\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(' <td>TEMPLATE_BUILD_TIME</td>\n')
self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </tr>\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 bgcolor = "lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository </td>\n')
self.htmlFile.write(' <td><a href="' + SSH.eNBRepository + '">' + SSH.eNBRepository + '</a></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(' <tr>\n') self.htmlFile.write(' <tr>\n')
self.htmlFile.write(' <td bgcolor = "lightcyan" >Job Trigger</td>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Job Trigger </td>\n')
if (SSH.eNB_AllowMerge): if (self.eNB_AllowMerge):
self.htmlFile.write(' <td>Merge-Request</td>\n') self.htmlFile.write(' <td>Merge-Request</td>\n')
else: else:
self.htmlFile.write(' <td>Push to Branch</td>\n') self.htmlFile.write(' <td>Push to Branch</td>\n')
self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </tr>\n')
self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <tr>\n')
if (SSH.eNB_AllowMerge): if (self.eNB_AllowMerge):
self.htmlFile.write(' <td bgcolor = "lightcyan" >Source Branch</td>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch </td>\n')
else: else:
self.htmlFile.write(' <td bgcolor = "lightcyan" >Branch</td>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-tree"></span> Branch</td>\n')
self.htmlFile.write(' <td>' + SSH.eNBBranch + '</td>\n') self.htmlFile.write(' <td>' + self.eNBBranch + '</td>\n')
self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </tr>\n')
self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <tr>\n')
if (SSH.eNB_AllowMerge): if (self.eNB_AllowMerge):
self.htmlFile.write(' <td bgcolor = "lightcyan" >Source Commit ID</td>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID </td>\n')
else: else:
self.htmlFile.write(' <td bgcolor = "lightcyan" >Commit ID</td>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID </td>\n')
self.htmlFile.write(' <td>' + SSH.eNBCommitID + '</td>\n') self.htmlFile.write(' <td>' + self.eNBCommitID + '</td>\n')
self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </tr>\n')
if (SSH.eNB_AllowMerge): if (self.eNB_AllowMerge):
self.htmlFile.write(' <tr>\n') 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 == ''): if (self.eNBTargetBranch == ''):
self.htmlFile.write(' <td>develop</td>\n') self.htmlFile.write(' <td>develop</td>\n')
else: else:
...@@ -1985,19 +1996,45 @@ class SSHConnection(): ...@@ -1985,19 +1996,45 @@ class SSHConnection():
self.htmlFile.write(' </table>\n') self.htmlFile.write(' </table>\n')
terminate_ue_flag = True terminate_ue_flag = True
SSH.GetAllUEDevices(terminate_ue_flag) if (self.ADBIPAddress != 'none'):
SSH.GetAllCatMDevices(terminate_ue_flag) 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.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(' <br>\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(' <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(' <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>Test Summary for ' + SSH.testXMLfile + '</h2>\n') def CreateHtmlTabHeader(self):
self.htmlFile.write(' <table border = "1">\n') 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(' <tr bgcolor = "#33CCFF" >\n')
self.htmlFile.write(' <th>Test Id</th>\n') self.htmlFile.write(' <th>Test Id</th>\n')
self.htmlFile.write(' <th>Test Desc</th>\n') self.htmlFile.write(' <th>Test Desc</th>\n')
...@@ -2010,28 +2047,44 @@ class SSHConnection(): ...@@ -2010,28 +2047,44 @@ class SSHConnection():
self.htmlFile.write(' </tr>\n') self.htmlFile.write(' </tr>\n')
self.htmlHeaderCreated = True self.htmlHeaderCreated = True
def CreateHtmlFooter(self, passStatus): def CreateHtmlTabFooter(self, passStatus):
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
self.htmlFile.write(' <tr id="FinalStatus">\n') self.htmlFile.write(' <tr">\n')
self.htmlFile.write(' <th bgcolor = "#33CCFF" colspan=2>Final Status</th>\n') self.htmlFile.write(' <th bgcolor = "#33CCFF" colspan=2>Final Tab Status</th>\n')
if passStatus: 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: 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(' </tr>\n')
self.htmlFile.write(' </table>\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(' <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 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('</div></body>\n')
self.htmlFile.write('</html>\n') self.htmlFile.write('</html>\n')
self.htmlFile.close() self.htmlFile.close()
self.htmlFooterCreated = False
def CreateHtmlTestRow(self, options, status, processesStatus): def CreateHtmlTestRow(self, options, status, processesStatus):
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <tr>\n')
self.htmlFile.write(' <td bgcolor = "lightcyan" >' + SSH.testCase_id + '</td>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" >' + self.testCase_id + '</td>\n')
self.htmlFile.write(' <td>' + SSH.desc + '</td>\n') self.htmlFile.write(' <td>' + self.desc + '</td>\n')
self.htmlFile.write(' <td>' + str(options) + '</td>\n') self.htmlFile.write(' <td>' + str(options) + '</td>\n')
if (str(status) == 'OK'): if (str(status) == 'OK'):
self.htmlFile.write(' <td bgcolor = "lightgreen" >' + str(status) + '</td>\n') self.htmlFile.write(' <td bgcolor = "lightgreen" >' + str(status) + '</td>\n')
...@@ -2081,8 +2134,8 @@ class SSHConnection(): ...@@ -2081,8 +2134,8 @@ class SSHConnection():
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
addOrangeBK = False addOrangeBK = False
self.htmlFile.write(' <tr>\n') self.htmlFile.write(' <tr>\n')
self.htmlFile.write(' <td bgcolor = "lightcyan" >' + SSH.testCase_id + '</td>\n') self.htmlFile.write(' <td bgcolor = "lightcyan" >' + self.testCase_id + '</td>\n')
self.htmlFile.write(' <td>' + SSH.desc + '</td>\n') self.htmlFile.write(' <td>' + self.desc + '</td>\n')
self.htmlFile.write(' <td>' + str(options) + '</td>\n') self.htmlFile.write(' <td>' + str(options) + '</td>\n')
if (str(status) == 'OK'): if (str(status) == 'OK'):
self.htmlFile.write(' <td bgcolor = "lightgreen" >' + str(status) + '</td>\n') self.htmlFile.write(' <td bgcolor = "lightgreen" >' + str(status) + '</td>\n')
...@@ -2126,6 +2179,7 @@ def Usage(): ...@@ -2126,6 +2179,7 @@ def Usage():
print(' --help Show this help.') print(' --help Show this help.')
print(' --mode=[Mode]') print(' --mode=[Mode]')
print(' TesteNB') print(' TesteNB')
print(' InitiateHtml, FinalizeHtml')
print(' TerminateeNB, TerminateUE, TerminateHSS, TerminateMME, TerminateSPGW') print(' TerminateeNB, TerminateUE, TerminateHSS, TerminateMME, TerminateSPGW')
print(' LogCollectBuild, LogCollecteNB, LogCollectHSS, LogCollectMME, LogCollectSPGW, LogCollectPing, LogCollectIperf') print(' LogCollectBuild, LogCollecteNB, LogCollectHSS, LogCollectMME, LogCollectSPGW, LogCollectPing, LogCollectIperf')
print(' --eNBIPAddress=[eNB\'s IP Address]') print(' --eNBIPAddress=[eNB\'s IP Address]')
...@@ -2149,7 +2203,7 @@ def Usage(): ...@@ -2149,7 +2203,7 @@ def Usage():
print('------------------------------------------------------------') print('------------------------------------------------------------')
def CheckClassValidity(action,id): 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) logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action)
return False return False
return True return True
...@@ -2191,6 +2245,13 @@ def GetParametersFromXML(action): ...@@ -2191,6 +2245,13 @@ def GetParametersFromXML(action):
logging.debug('ERROR: test-case has wrong profile ' + SSH.iperf_profile) logging.debug('ERROR: test-case has wrong profile ' + SSH.iperf_profile)
SSH.iperf_profile = 'balanced' 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 #check if given test is in list
#it is in list if one of the strings in 'list' is at the beginning of 'test' #it is in list if one of the strings in 'list' is at the beginning of 'test'
def test_in_list(test, list): def test_in_list(test, list):
...@@ -2281,7 +2342,13 @@ while len(argvs) > 1: ...@@ -2281,7 +2342,13 @@ while len(argvs) > 1:
SSH.ADBPassword = matchReg.group(1) SSH.ADBPassword = matchReg.group(1)
elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE): elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE):
matchReg = 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: else:
Usage() Usage()
sys.exit('Invalid Parameter: ' + myArgv) sys.exit('Invalid Parameter: ' + myArgv)
...@@ -2347,27 +2414,44 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE): ...@@ -2347,27 +2414,44 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE):
Usage() Usage()
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
SSH.LogCollectIperf() 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): 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 == '': 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() Usage()
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp") if (SSH.EPCIPAddress != 'none'):
SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp") SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp")
SSH.CreateHtmlHeader() SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp")
#read test_case_list.xml file #read test_case_list.xml file
# if no parameters for XML file, use default value # 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" xml_test_file = sys.path[0] + "/test_case_list.xml"
else: else:
xml_test_file = sys.path[0] + "/" + SSH.testXMLfile xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[0]
xmlTree = ET.parse(xml_test_file) xmlTree = ET.parse(xml_test_file)
xmlRoot = xmlTree.getroot() xmlRoot = xmlTree.getroot()
exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='') exclusion_tests=xmlRoot.findtext('TestCaseExclusionList',default='')
requested_tests=xmlRoot.findtext('TestCaseRequestedList',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') all_tests=xmlRoot.findall('testCase')
exclusion_tests=exclusion_tests.split() exclusion_tests=exclusion_tests.split()
...@@ -2405,6 +2489,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE): ...@@ -2405,6 +2489,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
signal.signal(signal.SIGUSR1, receive_signal) signal.signal(signal.SIGUSR1, receive_signal)
SSH.CreateHtmlTabHeader()
for test_case_id in todo_tests: for test_case_id in todo_tests:
for test in all_tests: for test in all_tests:
id = test.get('id') id = test.get('id')
...@@ -2460,10 +2546,12 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE): ...@@ -2460,10 +2546,12 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
SSH.InitializeSPGW() SSH.InitializeSPGW()
elif action == 'Terminate_SPGW': elif action == 'Terminate_SPGW':
SSH.TerminateSPGW() SSH.TerminateSPGW()
elif action == 'IdleSleep':
SSH.IdleSleep()
else: else:
sys.exit('Invalid action') sys.exit('Invalid action')
SSH.CreateHtmlFooter(True) SSH.CreateHtmlTabFooter(True)
else: else:
Usage() Usage()
sys.exit('Invalid mode') sys.exit('Invalid mode')
......
...@@ -323,6 +323,7 @@ function report_build { ...@@ -323,6 +323,7 @@ function report_build {
echo " <base href = \"http://www.openairinterface.org/\" />" >> ./build_results.html echo " <base href = \"http://www.openairinterface.org/\" />" >> ./build_results.html
echo "</head>" >> ./build_results.html echo "</head>" >> ./build_results.html
echo "<body><div class=\"container\">" >> ./build_results.html echo "<body><div class=\"container\">" >> ./build_results.html
echo " <br>" >> ./build_results.html
echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
...@@ -339,45 +340,45 @@ function report_build { ...@@ -339,45 +340,45 @@ function report_build {
echo " <br>" >> ./build_results.html echo " <br>" >> ./build_results.html
echo " <table border = \"1\">" >> ./build_results.html echo " <table border = \"1\">" >> ./build_results.html
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Build Start Time (UTC)</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-time\"></span> Build Start Time (UTC)</td>" >> ./build_results.html
echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./build_results.html echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-cloud-upload\"></span> GIT Repository</td>" >> ./build_results.html
echo " <td>$GIT_URL</td>" >> ./build_results.html echo " <td><a href=\"$GIT_URL\">$GIT_URL</a></td>" >> ./test_simulator_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-wrench\"></span> Job Trigger</td>" >> ./build_results.html
if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./build_results.html; fi if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./build_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./build_results.html; fi if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./build_results.html; fi
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
if [ $PU_TRIG -eq 1 ] if [ $PU_TRIG -eq 1 ]
then then
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tree\"></span> Branch</td>" >> ./build_results.html
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Commit ID</td>" >> ./build_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
fi fi
if [ $MR_TRIG -eq 1 ] if [ $MR_TRIG -eq 1 ]
then then
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-out\"></span> Source Branch</td>" >> ./build_results.html
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Source Commit ID</td>" >> ./build_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-in\"></span> Target Branch</td>" >> ./build_results.html
echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Target Commit ID</td>" >> ./build_results.html
echo " <td>$TARGET_COMMIT_ID</td>" >> ./build_results.html echo " <td>$TARGET_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
fi fi
......
...@@ -100,6 +100,7 @@ function report_test { ...@@ -100,6 +100,7 @@ function report_test {
echo " <base href = \"http://www.openairinterface.org/\" />" >> ./test_simulator_results.html echo " <base href = \"http://www.openairinterface.org/\" />" >> ./test_simulator_results.html
echo "</head>" >> ./test_simulator_results.html echo "</head>" >> ./test_simulator_results.html
echo "<body><div class=\"container\">" >> ./test_simulator_results.html echo "<body><div class=\"container\">" >> ./test_simulator_results.html
echo " <br>" >> ./test_simulator_results.html
echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
...@@ -116,45 +117,45 @@ function report_test { ...@@ -116,45 +117,45 @@ function report_test {
echo " <br>" >> ./test_simulator_results.html echo " <br>" >> ./test_simulator_results.html
echo " <table border = \"1\">" >> ./test_simulator_results.html echo " <table border = \"1\">" >> ./test_simulator_results.html
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Build Start Time (UTC)</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-time\"></span> Build Start Time (UTC)</td>" >> ./test_simulator_results.html
echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./test_simulator_results.html echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-cloud-upload\"></span> GIT Repository</td>" >> ./test_simulator_results.html
echo " <td><a href=\"$GIT_URL\">$GIT_URL</a></td>" >> ./test_simulator_results.html echo " <td><a href=\"$GIT_URL\">$GIT_URL</a></td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-wrench\"></span> Job Trigger</td>" >> ./test_simulator_results.html
if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./test_simulator_results.html; fi if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./test_simulator_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./test_simulator_results.html; fi if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./test_simulator_results.html; fi
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
if [ $PU_TRIG -eq 1 ] if [ $PU_TRIG -eq 1 ]
then then
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tree\"></span> Branch</td>" >> ./test_simulator_results.html
echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Commit ID</td>" >> ./test_simulator_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
fi fi
if [ $MR_TRIG -eq 1 ] if [ $MR_TRIG -eq 1 ]
then then
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-out\"></span> Source Branch</td>" >> ./test_simulator_results.html
echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Source Commit ID</td>" >> ./test_simulator_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-in\"></span> Target Branch</td>" >> ./test_simulator_results.html
echo " <td>$TARGET_BRANCH</td>" >> ./test_simulator_results.html echo " <td>$TARGET_BRANCH</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Target Commit ID</td>" >> ./test_simulator_results.html
echo " <td>$TARGET_COMMIT_ID</td>" >> ./test_simulator_results.html echo " <td>$TARGET_COMMIT_ID</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
fi fi
......
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