From b29b88380c7409b8ccf44dece90ea58edc02dc87 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Mon, 30 Nov 2020 22:27:15 +0100
Subject: [PATCH] [CI]: flexran-rtc support when deployed in a container.   --
 Not completed for X2 Handover case

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/cls_oaicitest.py                   | 17 ++++++++---
 .../conf_files/cu.band7.tm1.100PRB.conf       |  2 +-
 ci-scripts/conf_files/cu.band7.tm1.25PRB.conf |  2 +-
 ci-scripts/conf_files/cu.band7.tm1.50PRB.conf |  2 +-
 .../du.band7.tm1.100PRB.usrpb210.conf         |  2 +-
 .../du.band7.tm1.25PRB.usrpb210.conf          |  2 +-
 .../du.band7.tm1.50PRB.usrpb210.conf          |  2 +-
 .../enb.band13.tm1.25PRB.usrpb210.conf        |  2 +-
 .../conf_files/enb.band13.tm1.50PRB.emtc.conf |  2 +-
 .../enb.band17.tm1.25PRB.usrpb210.conf        |  2 +-
 .../enb.band17.tm1.mbms.25PRB.usrpb210.conf   |  2 +-
 ...d40.tm1.100PRB.FairScheduler.usrpb210.conf |  2 +-
 ...nd40.tm1.25PRB.FairScheduler.usrpb210.conf |  2 +-
 ...nd40.tm1.50PRB.FairScheduler.usrpb210.conf |  2 +-
 ...nd40.tm2.25PRB.FairScheduler.usrpb210.conf |  2 +-
 .../enb.band7.tm1.100PRB.usrpb210.conf        |  2 +-
 .../enb.band7.tm1.25PRB.slave.usrpb210.conf   |  2 +-
 .../enb.band7.tm1.25PRB.usrpb210.conf         |  2 +-
 .../enb.band7.tm1.50PRB.usrpb210.conf         |  2 +-
 .../enb.band7.tm2.25PRB.usrpb210.conf         |  2 +-
 .../enb.slave.band13.tm1.25PRB.usrpb210.conf  |  2 +-
 ...d40.tm1.100PRB.FairScheduler.usrpb210.conf |  2 +-
 ...nd40.tm1.25PRB.FairScheduler.usrpb210.conf |  2 +-
 ...nd40.tm1.50PRB.FairScheduler.usrpb210.conf |  2 +-
 ...cc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf |  2 +-
 ...rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf |  2 +-
 ...rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf |  2 +-
 ci-scripts/epc.py                             | 30 +++++++++++++------
 ci-scripts/ran.py                             |  5 +++-
 ci-scripts/tcp_iperf_stats.awk                |  6 +++-
 30 files changed, 69 insertions(+), 41 deletions(-)

diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py
index 33fba12770..8b4c292e20 100644
--- a/ci-scripts/cls_oaicitest.py
+++ b/ci-scripts/cls_oaicitest.py
@@ -225,7 +225,16 @@ class OaiCiTest():
 		result = re.search('/opt/flexran_rtc/build/rt_controller', SSH.getBefore())
 		if result is not None:
 			RAN.flexranCtrlInstalled=True
+			RAN.flexranCtrlIpAddress=EPC.IPAddress
 			logging.debug('Flexran Controller is installed')
+		else:
+			# Maybe flexran-rtc is deployed into a container
+			SSH.command('docker inspect --format="FLEX_RTC_IP_ADDR = {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" prod-flexran-rtc', '\$', 5)
+			result = re.search('FLEX_RTC_IP_ADDR = (?P<flex_ip_addr>[0-9\.]+)', SSH.getBefore())
+			if result is not None:
+				RAN.flexranCtrlDeployed=True
+				RAN.flexranCtrlIpAddress=result.group('flex_ip_addr')
+				logging.debug('Flexran Controller is deployed: ' + RAN.flexranCtrlIpAddress)
 		SSH.close()
 
 	def InitializeFlexranCtrl(self, HTML,RAN,EPC):
@@ -1267,12 +1276,12 @@ class OaiCiTest():
 			i += 1
 		for job in multi_jobs:
 			job.join()
-		if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted:
+		if (RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted) or RAN.flexranCtrlDeployed:
 			SSH = sshconnection.SSHConnection()
 			SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
-			SSH.command('cd /opt/flexran_rtc', '\$', 5)
-			SSH.command('curl http://localhost:9999/stats | jq \'.\' > log/check_status_' + self.testCase_id + '.log 2>&1', '\$', 5)
-			SSH.command('cat log/check_status_' + self.testCase_id + '.log | jq \'.eNB_config[0].UE\' | grep -c rnti | sed -e "s#^#Nb Connected UE = #"', '\$', 5)
+			SSH.command('cd ' + EPC.SourceCodePath + '/scripts', '\$', 5)
+			SSH.command('curl http://' + RAN.flexranCtrlIpAddress + ':9999/stats | jq \'.\' > check_status_' + self.testCase_id + '.log 2>&1', '\$', 5)
+			SSH.command('cat check_status_' + self.testCase_id + '.log | jq \'.eNB_config[0].UE\' | grep -c rnti | sed -e "s#^#Nb Connected UE = #"', '\$', 5)
 			result = re.search('Nb Connected UE = (?P<nb_ues>[0-9]+)', SSH.getBefore())
 			passStatus = True
 			if result is not None:
diff --git a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf
index 42cade271c..e2c94b14ab 100644
--- a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf
+++ b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf
@@ -215,7 +215,7 @@ log_config = {
 NETWORK_CONTROLLER : {
   FLEXRAN_ENABLED        = "no";
   FLEXRAN_INTERFACE_NAME = "lo";
-  FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+  FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
   FLEXRAN_PORT           = 2210;
   FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
   FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf
index 51f7277267..5b994ed29b 100644
--- a/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf
+++ b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf
@@ -215,7 +215,7 @@ log_config = {
 NETWORK_CONTROLLER : {
   FLEXRAN_ENABLED        = "no";
   FLEXRAN_INTERFACE_NAME = "lo";
-  FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+  FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
   FLEXRAN_PORT           = 2210;
   FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
   FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf
index 9946713c3a..148c5a9903 100644
--- a/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf
+++ b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf
@@ -215,7 +215,7 @@ log_config = {
 NETWORK_CONTROLLER : {
   FLEXRAN_ENABLED        = "no";
   FLEXRAN_INTERFACE_NAME = "lo";
-  FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+  FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
   FLEXRAN_PORT           = 2210;
   FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
   FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf
index 7167bffa6d..a3ecffb9be 100644
--- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf
@@ -112,7 +112,7 @@ log_config = {
 NETWORK_CONTROLLER : {
   FLEXRAN_ENABLED        = "no";
   FLEXRAN_INTERFACE_NAME = "lo";
-  FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+  FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
   FLEXRAN_PORT           = 2210;
   FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
   FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf
index 3c951a2a6e..1920992d70 100644
--- a/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf
@@ -112,7 +112,7 @@ log_config = {
 NETWORK_CONTROLLER : {
   FLEXRAN_ENABLED        = "no";
   FLEXRAN_INTERFACE_NAME = "lo";
-  FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+  FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
   FLEXRAN_PORT           = 2210;
   FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
   FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf
index 4726269312..5df8da05a3 100644
--- a/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf
@@ -112,7 +112,7 @@ log_config = {
 NETWORK_CONTROLLER : {
   FLEXRAN_ENABLED        = "no";
   FLEXRAN_INTERFACE_NAME = "lo";
-  FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+  FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
   FLEXRAN_PORT           = 2210;
   FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
   FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf
index 0c247e9ef9..e70ca78205 100644
--- a/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf
@@ -239,7 +239,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "eth0";
-    FLEXRAN_IPV4_ADDRESS   = "CI_MME_IP_ADDR";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
index f560958e15..400d1a6c9d 100644
--- a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
+++ b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
@@ -448,7 +448,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf
index ba81f832db..bd2999b5d5 100644
--- a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf
@@ -251,7 +251,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "eth0";
-    FLEXRAN_IPV4_ADDRESS   = "CI_MME_IP_ADDR";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf
index 79bbd7ee6f..19ef6d0797 100644
--- a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf
@@ -395,7 +395,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "eth0";
-    FLEXRAN_IPV4_ADDRESS   = "CI_MME_IP_ADDR";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf
index b5fd1255bb..f34878c569 100644
--- a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf
@@ -228,7 +228,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf
index 552dfd637b..e2e482a7c7 100644
--- a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf
@@ -228,7 +228,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
index d95d2b6ac1..bfea139e92 100644
--- a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
@@ -228,7 +228,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf
index e466a23ab0..4e0025770b 100644
--- a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf
@@ -226,7 +226,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
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 e3cdb033c9..1627d21e1a 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
@@ -247,7 +247,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf
index f95530b251..efa1fa64b8 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf
@@ -256,7 +256,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "eth0";
-    FLEXRAN_IPV4_ADDRESS   = "CI_MME_IP_ADDR";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
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 eddb34a579..5236e20d5a 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
@@ -250,7 +250,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "eth0";
-    FLEXRAN_IPV4_ADDRESS   = "CI_MME_IP_ADDR";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
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 b5d7f35a76..4d89ad96da 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
@@ -255,7 +255,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
index 67cc5706ae..72754165d0 100644
--- a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
@@ -249,7 +249,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf
index 1b5376644b..da65aad775 100644
--- a/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf
@@ -244,7 +244,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "eth0";
-    FLEXRAN_IPV4_ADDRESS   = "CI_MME_IP_ADDR";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf
index 2bf79a3d7e..d01e4e1c4e 100644
--- a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf
@@ -235,7 +235,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf
index 6b0e7de659..419598647b 100644
--- a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf
@@ -235,7 +235,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf
index 6b41d78506..d4f2eb9ef2 100644
--- a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf
@@ -235,7 +235,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
index 5df8f16f78..683fff0bc8 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
@@ -254,7 +254,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
index ad753bb114..2c3c11b84f 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
@@ -254,7 +254,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
index dbe3aff3dc..49365a1f61 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
@@ -254,7 +254,7 @@ NETWORK_CONTROLLER :
 {
     FLEXRAN_ENABLED        = "no";
     FLEXRAN_INTERFACE_NAME = "lo";
-    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_IPV4_ADDRESS   = "CI_FLEXRAN_CTL_IP_ADDR";
     FLEXRAN_PORT           = 2210;
     FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
     FLEXRAN_AWAIT_RECONF   = "no";
diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py
index 455f6fa68b..cc01b8d172 100644
--- a/ci-scripts/epc.py
+++ b/ci-scripts/epc.py
@@ -221,7 +221,7 @@ class EPCManagement():
 			mySSH = SSH.SSHConnection() 
 			mySSH.open(self.IPAddress, self.UserName, self.Password)
 			if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
-				mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "ps aux | grep oai_hss"', '\$', 5)
+				mySSH.command('docker top ' + self.containerPrefix + '-oai-hss', '\$', 5)
 			else:
 				mySSH.command('stdbuf -o0 ps -aux | grep --color=never hss | grep -v grep', '\$', 5)
 			if re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
@@ -246,7 +246,7 @@ class EPCManagement():
 			mySSH = SSH.SSHConnection() 
 			mySSH.open(self.IPAddress, self.UserName, self.Password)
 			if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
-				mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "ps aux | grep oai_mme"', '\$', 5)
+				mySSH.command('docker top ' + self.containerPrefix + '-oai-mme', '\$', 5)
 			else:
 				mySSH.command('stdbuf -o0 ps -aux | grep --color=never mme | grep -v grep', '\$', 5)
 			if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
@@ -273,11 +273,11 @@ class EPCManagement():
 			mySSH = SSH.SSHConnection() 
 			mySSH.open(self.IPAddress, self.UserName, self.Password)
 			if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
-				mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "ps aux | grep oai_spgwc"', '\$', 5)
-				result = re.search('oai_spgwc -o -c ', mySSH.getBefore())
+				mySSH.command('docker top ' + self.containerPrefix + '-oai-spgwc', '\$', 5)
+				result = re.search('oai_spgwc -', mySSH.getBefore())
 				if result is not None:
-					mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "ps aux | grep oai_spgwu"', '\$', 5)
-					result = re.search('oai_spgwu -o -c ', mySSH.getBefore())
+					mySSH.command('docker top ' + self.containerPrefix + '-oai-spgwu-tiny', '\$', 5)
+					result = re.search('oai_spgwu -', mySSH.getBefore())
 			elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE):
 				mySSH.command('stdbuf -o0 ps -aux | grep --color=never spgw | grep -v grep', '\$', 5)
 				result = re.search('spgwu -c ', mySSH.getBefore())
@@ -439,7 +439,7 @@ class EPCManagement():
 		# - docker-compose config | grep container_name
 		mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5)
 		mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/docker-compose.yml', self.SourceCodePath + '/scripts')
-		mySSH.command('wget --quiet https://raw.githubusercontent.com/OPENAIRINTERFACE/openair-hss/develop/src/hss_rel14/db/oai_db.cql', '\$', 5)
+		mySSH.command('wget --quiet --tries=3 --retry-connrefused https://raw.githubusercontent.com/OPENAIRINTERFACE/openair-hss/develop/src/hss_rel14/db/oai_db.cql', '\$', 30)
 		mySSH.command('docker-compose down', '\$', 60)
 		mySSH.command('docker-compose up -d db_init', '\$', 60)
 
@@ -531,13 +531,25 @@ class EPCManagement():
 		mySSH.command('docker cp prod-oai-spgwu-tiny:/tmp/spgwu_check_run.pcap spgwu_' + self.testCase_id + '.pcap', '\$', 60)
 		# Remove all
 		mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5)
+		listOfContainers = 'prod-cassandra prod-oai-hss prod-oai-mme prod-oai-spgwc prod-oai-spgwu-tiny'
+		nbContainers = 5
+		# Checking for additional services
+		mySSH.command('docker-compose config', '\$', 5)
+		configResponse = mySSH.getBefore()
+		if configResponse.count('flexran_rtc') == 1:
+			listOfContainers += ' prod-flexran-rtc'
+			nbContainers += 1
+		if configResponse.count('trf_gen') == 1:
+			listOfContainers += ' prod-trf-gen'
+			nbContainers += 1
+
 		mySSH.command('docker-compose down', '\$', 60)
-		mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' prod-cassandra prod-oai-hss prod-oai-mme prod-oai-spgwc prod-oai-spgwu-tiny', '\$', 10)
+		mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' ' + listOfContainers, '\$', 10)
 		noMoreContainerNb = mySSH.getBefore().count('No such object')
 		mySSH.command('docker inspect --format=\'{{.Name}}\' prod-oai-public-net prod-oai-private-net', '\$', 10)
 		noMoreNetworkNb = mySSH.getBefore().count('No such object')
 		mySSH.close()
-		if noMoreContainerNb == 5 and noMoreNetworkNb == 2:
+		if noMoreContainerNb == nbContainers and noMoreNetworkNb == 2:
 			logging.debug('Undeployment OK')
 			self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
 		else:
diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py
index d555558fc9..1df082a127 100644
--- a/ci-scripts/ran.py
+++ b/ci-scripts/ran.py
@@ -87,6 +87,8 @@ class RANManagement():
 		self.eNBstatuses = [-1, -1, -1]
 		self.flexranCtrlInstalled = False
 		self.flexranCtrlStarted = False
+		self.flexranCtrlDeployed = False
+		self.flexranCtrlIpAddress = ''
 		self.testCase_id = ''
 		self.epcPcapFile = ''
 		self.htmlObj = None
@@ -581,8 +583,9 @@ class RANManagement():
 		mySSH.command('sed -i -e \'s/CI_RRU1_IP_ADDR/' + self.eNB1IPAddress + '/\' ' + ci_full_config_file, '\$', 2);
 		mySSH.command('sed -i -e \'s/CI_RRU2_IP_ADDR/' + self.eNB2IPAddress + '/\' ' + ci_full_config_file, '\$', 2);
 		mySSH.command('sed -i -e \'s/CI_FR1_CTL_ENB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2);
-		if self.flexranCtrlInstalled and self.flexranCtrlStarted:
+		if (self.flexranCtrlInstalled and self.flexranCtrlStarted) or self.flexranCtrlDeployed:
 			mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED.*;/FLEXRAN_ENABLED        = "yes";/\' ' + ci_full_config_file, '\$', 2);
+			mySSH.command('sed -i -e \'s/CI_FLEXRAN_CTL_IP_ADDR/' + self.flexranCtrlIpAddress + '/\' ' + ci_full_config_file, '\$', 2);
 		else:
 			mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED.*;/FLEXRAN_ENABLED        = "no";/\' ' + ci_full_config_file, '\$', 2);
 		self.eNBmbmsEnables[int(self.eNB_instance)] = False
diff --git a/ci-scripts/tcp_iperf_stats.awk b/ci-scripts/tcp_iperf_stats.awk
index 3a00e4555f..b21bf16a2f 100644
--- a/ci-scripts/tcp_iperf_stats.awk
+++ b/ci-scripts/tcp_iperf_stats.awk
@@ -21,7 +21,11 @@
 BEGIN{max=0;min=10000}
 {
     if ($0 ~/Mbits/) {
-        split($0,a,"MBytes")
+        if ($0 ~/KBytes/) {
+            split($0,a,"KBytes")
+        } else {
+            split($0,a,"MBytes")
+        }
         split(a[2],b)
         if (b[1]>max) {
             max=b[1]
-- 
2.26.2