From bf3621c5a80a04bd1099e5f1e24abd58b7936d47 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Fri, 28 Feb 2020 11:53:25 +0100
Subject: [PATCH] CI: needs to append CI workspace path to UE RRC conf files

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/main.py                          | 8 +++++++-
 ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 2a4da2818f..63e455c649 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -1043,6 +1043,12 @@ class SSHConnection():
 			logging.debug('Found a N3xx device --> resetting it')
 		self.command('cd ' + self.UESourceCodePath, '\$', 5)
 		# Initialize_OAI_UE_args usually start with -C and followed by the location in repository
+		# in case of NR-UE, we may have rrc_config_path (Temporary?)
+		modifiedUeOptions = str(self.Initialize_OAI_UE_args)
+		if self.air_interface == 'nr':
+			result = re.search('--rrc_config_path ', modifiedUeOptions)
+			if result is not None:
+				modifiedUeOptions = modifiedUeOptions.replace('rrc_config_path ', 'rrc_config_path ' + self.UESourceCodePath + '/')
 		self.command('source oaienv', '\$', 5)
 		self.command('cd cmake_targets/ran_build/build', '\$', 5)
 		if self.air_interface == 'lte':
@@ -1057,7 +1063,7 @@ class SSHConnection():
 					self.command('sed -e "s#93#92#" -e "s#8baf473f2f8fd09487cccbd7097c6862#fec86ba6eb707ed08905757b1bb44b8f#" -e "s#e734f8734007d6c5ce7a0508809e7e9c#C42449363BBAD02B66D16BC975D77CC1#" ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf > ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf', '\$', 5)
 				self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf .u*', '\$', 5)
 				self.command('echo ' + self.UEPassword + ' | sudo -S ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf -o .', '\$', 5)
-		self.command('echo "ulimit -c unlimited && ./'+ self.air_interface +'-uesoftmodem ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
+		self.command('echo "ulimit -c unlimited && ./'+ self.air_interface +'-uesoftmodem ' + modifiedUeOptions + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
 		self.command('chmod 775 ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
 		self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5)
 		self.UELogFile = 'ue_' + self.testCase_id + '.log'
diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml
index bd723aa8b6..30a8772df7 100644
--- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml
+++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml
@@ -24,7 +24,7 @@
         <htmlTabRef>run-oai-gnb-nr-ue</htmlTabRef>
         <htmlTabName>Run-gNB-and-NR-UE</htmlTabName>
         <htmlTabIcon>tasks</htmlTabIcon>	
-	<repeatCount>4</repeatCount>
+	<repeatCount>2</repeatCount>
 	<TestCaseRequestedList>
 090101 000001 090102 000002 090108 090109
 	</TestCaseRequestedList>
-- 
2.26.2