From 5f2f1b5eabb1a662d42dfc2f2d473437b6750605 Mon Sep 17 00:00:00 2001
From: hardy <remi.hardy@openairinterface.org>
Date: Thu, 7 Oct 2021 10:32:04 +0200
Subject: [PATCH] adding the support of different apn depending on CN in ue
 infra yaml

---
 ci-scripts/ci_ueinfra.yaml  | 9 +++++++--
 ci-scripts/cls_module_ue.py | 4 ++--
 ci-scripts/cls_oaicitest.py | 2 +-
 ci-scripts/ran.py           | 2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml
index 2fb3f79a2e..0957a1e465 100644
--- a/ci-scripts/ci_ueinfra.yaml
+++ b/ci-scripts/ci_ueinfra.yaml
@@ -4,7 +4,9 @@ idefix:
   Kind : quectel
   Process : 
     Name : quectel-CM
-    Cmd : /home/oaicicd/quectel-CM/quectel-CM -s oai.ipv4 -4
+    Cmd : /home/oaicicd/quectel-CM/quectel-CM -4 -s
+    Apn :
+      ltebox : oai.ipv4
   WakeupScript : ci_ctl_qtel.py /dev/ttyUSB2 wup
   DetachScript : ci_ctl_qtel.py /dev/ttyUSB2 detach
   LogStore : /media/usb-drive/ci_qlogs
@@ -20,7 +22,10 @@ nrmodule2_quectel:
   Kind : quectel
   Process :
     Name : quectel-CM
-    Cmd : /home/nrmodule2/quectel-CM/quectel-CM -s oai -4 #oai is the dnn for OAI CN5G (hardcoded in CN)
+    Cmd : /home/nrmodule2/quectel-CM/quectel-CM -4 -s
+    Apn :
+      OAICN5G : oai
+      OAI-Rel14-Docker : oai.ipv4
   WakeupScript : ci_ctl_qtel.py /dev/ttyUSB7 wup
   DetachScript : ci_ctl_qtel.py /dev/ttyUSB7 detach
   LogStore : /media/ci_qlogs  
diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py
index 758e7866f0..74ae9c207e 100644
--- a/ci-scripts/cls_module_ue.py
+++ b/ci-scripts/cls_module_ue.py
@@ -61,7 +61,7 @@ class Module_UE:
 
 	#this method checks if the specified Process is running on the server hosting the module
 	#if not it will be started
-	def CheckCMProcess(self):
+	def CheckCMProcess(self,CNType):
 		HOST=self.HostUsername+'@'+self.HostIPAddress
 		COMMAND="ps aux | grep " + self.Process['Name'] + " | grep -v grep "
 		logging.debug(COMMAND)
@@ -76,7 +76,7 @@ class Module_UE:
 			logging.debug('Starting ' + self.Process['Name'])
 			mySSH = sshconnection.SSHConnection()
 			mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
-			mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S ' + self.Process['Cmd'] + ' &','\$',5)
+			mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S ' + self.Process['Cmd'] + ' ' +  self.Process['Apn'][CNType]  + ' &','\$',5)
 			mySSH.close()
 			#checking the process
 			time.sleep(5)
diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py
index ada51aae45..8bda1fa202 100644
--- a/ci-scripts/cls_oaicitest.py
+++ b/ci-scripts/cls_oaicitest.py
@@ -388,7 +388,7 @@ class OaiCiTest():
 			#RH
 			Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
 			Module_UE.ue_trace=ue_trace
-			is_module=Module_UE.CheckCMProcess()
+			is_module=Module_UE.CheckCMProcess(EPC.Type)
 			if is_module:
 				Module_UE.EnableTrace()
 				time.sleep(5)
diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py
index 1eb76e505f..807fa1dd07 100644
--- a/ci-scripts/ran.py
+++ b/ci-scripts/ran.py
@@ -486,7 +486,7 @@ class RANManagement():
 			monitor_file='stats_monitor.py'
 			#mySSH.command('echo ' + lPassWord + ' | sudo -S cp ' + self.eNBSourceCodePath + '/ci-scripts/'+ monitor_file + ' ' + self.eNBSourceCodePath + '/cmake_targets/ran_build/build/.','\$', 5)
 			#mySSH.command('echo $USER; nohup python3 ' + self.eNBSourceCodePath + '/cmake_targets/ran_build/build/' + monitor_file + ' 2>&1 &', '\$', 5)
-			mySSH.command('echo $USER; nohup python3 ../ci-scripts/' + monitor_file + ' 2>&1 &', '\$', 5)
+			mySSH.command('echo $USER; nohup python3 ../ci-scripts/' + monitor_file + ' 2>&1 > stats_monitor_execution.log &', '\$', 5)
 
 
 
-- 
2.26.2