From 8b46aea34d7b942aa2a27e073c3a096f425b2968 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Fri, 24 Aug 2018 11:57:13 +0200
Subject: [PATCH] CI: optimization on scripts

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 .../enb.band7.tm1.100PRB.usrpb210.conf         |  2 +-
 .../enb.band7.tm1.25PRB.usrpb210.conf          |  2 +-
 .../enb.band7.tm1.50PRB.usrpb210.conf          |  2 +-
 ci-scripts/main.py                             | 18 ++++++++++++++----
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
index 2bd28a60df3..4380bd30be7 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
@@ -33,7 +33,7 @@ eNBs =
       tdd_config_s            			      = 0;
       prefix_type             			      = "NORMAL";
       eutra_band              			      = 7;
-      downlink_frequency      			      = 2685000000L;
+      downlink_frequency      			      = 2680000000L;
       uplink_frequency_offset 			      = -120000000;
       Nid_cell					      = 0;
       N_RB_DL                 			      = 100;
diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
index 102fc89a13b..dded9cfdeb8 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
@@ -33,7 +33,7 @@ eNBs =
       tdd_config_s            			      = 0;
       prefix_type             			      = "NORMAL";
       eutra_band              			      = 7;
-      downlink_frequency      			      = 2685000000L;
+      downlink_frequency      			      = 2680000000L;
       uplink_frequency_offset 			      = -120000000;
       Nid_cell					      = 0;
       N_RB_DL                 			      = 25;
diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
index fe6e2f0b595..7c4292eb61b 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
@@ -33,7 +33,7 @@ eNBs =
       tdd_config_s            			      = 0;
       prefix_type             			      = "NORMAL";
       eutra_band              			      = 7;
-      downlink_frequency      			      = 2685000000L;
+      downlink_frequency      			      = 2680000000L;
       uplink_frequency_offset 			      = -120000000;
       Nid_cell					      = 0;
       N_RB_DL                 			      = 50;
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index c453558790a..c08db909469 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -308,17 +308,25 @@ class SSHConnection():
 			loopCounter = loopCounter - 1
 			if (loopCounter == 0):
 				doLoop = False
+				# Checking if process is still alive
+				self.command('stdbuf -o0 ps -aux | grep -v grep | grep --color=never lte-softmodem', '\$', 5)
+				result = re.search('lte-softmodem', str(self.ssh.before))
+				if result is None:
+					logging.debug('\u001B[1;37;41m eNB process is already down \u001B[0m')
+					self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', 0)
+					self.CreateHtmlFooter()
+					sys.exit(1)
 				logging.debug('\u001B[1;30;43m eNB logging system did not show got sync! See with attach later \u001B[0m')
-				self.CreateHtmlTestRow(config_file, 'eNB not showing got sync!', 0)
+				self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'eNB not showing got sync!', 0)
 				# Not getting got sync is bypassed for the moment
 				#sys.exit(1)
-			self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | grep -i sync', '\$', 10)
+			self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | grep --color=never -i sync', '\$', 10)
 			result = re.search('got sync', str(self.ssh.before))
 			if result is None:
 				time.sleep(6)
 			else:
 				doLoop = False
-				self.CreateHtmlTestRow(config_file, 'OK', 0)
+				self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'OK', 0)
 				logging.debug('\u001B[1m Initialize eNB Completed\u001B[0m')
 
 		self.close()
@@ -650,6 +658,7 @@ class SSHConnection():
 
 		if (status_queue.empty()):
 			self.CreateHtmlTestRow(self.ping_args, 'KO', len(self.UEDevices))
+			self.CreateHtmlFooter()
 			sys.exit(1)
 		else:
 			ping_status = True
@@ -695,7 +704,7 @@ class SSHConnection():
 			else:
 				iperf_bandwidth_new = residualBW
 		iperf_bandwidth_str = '-b ' + iperf_bandwidth
-		iperf_bandwidth_str_new = '-b ' + str(iperf_bandwidth_new)
+		iperf_bandwidth_str_new = '-b ' + ('%.2f' % iperf_bandwidth_new)
 		result = re.sub(iperf_bandwidth_str, iperf_bandwidth_str_new, str(self.iperf_args))
 		if result is None:
 			logging.debug('\u001B[1;37;41m Calculate Iperf bandwidth Failed! \u001B[0m')
@@ -1074,6 +1083,7 @@ class SSHConnection():
 
 		if (status_queue.empty()):
 			self.CreateHtmlTestRow(self.iperf_args, 'KO', len(self.UEDevices))
+			self.CreateHtmlFooter()
 			sys.exit(1)
 		else:
 			iperf_status = True
-- 
GitLab