From b0d65fd6cbe6ffa07a326e21247ecb6786e5e22d Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Thu, 2 Jul 2020 17:06:43 +0200
Subject: [PATCH] CI: adding test on caracal with TX Write Thread enabled

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/.gitignore                         |  1 +
 ci-scripts/ran.py                             |  8 +++
 .../gnb_nr_ue_usrp_run_multi_thread.xml       | 71 +++++++++++++++++++
 ci-scripts/xml_files/gnb_usrp_build.xml       |  1 +
 ci-scripts/xml_files/nr_ue_usrp_build.xml     |  1 +
 5 files changed, 82 insertions(+)
 create mode 100644 ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml

diff --git a/ci-scripts/.gitignore b/ci-scripts/.gitignore
index dc5e7c74764..34d19403a7c 100644
--- a/ci-scripts/.gitignore
+++ b/ci-scripts/.gitignore
@@ -1,3 +1,4 @@
+r*.raw
 enb_*.log
 ue_*.log
 ping_*.*
diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py
index c968521bda7..79fe1e2fc0f 100644
--- a/ci-scripts/ran.py
+++ b/ci-scripts/ran.py
@@ -811,6 +811,7 @@ class RANManagement():
 		uplinkSegmentsAborted = 0
 		ulschReceiveOK = 0
 		gnbRxTxWakeUpFailure = 0
+		gnbTxWriteThreadEnabled = False
 		cdrxActivationMessageCount = 0
 		dropNotEnoughRBs = 0
 		mbmsRequestMsg = 0
@@ -924,6 +925,9 @@ class RANManagement():
 			result = re.search('could not wakeup gNB rxtx process', str(line))
 			if result is not None:
 				gnbRxTxWakeUpFailure += 1
+			result = re.search('tx write thread ready', str(line))
+			if result is not None:
+				gnbTxWriteThreadEnabled = True
 			result = re.search('ULSCH in error in round|ULSCH 0 in error', str(line))
 			if result is not None:
 				ulschFailure += 1
@@ -964,6 +968,10 @@ class RANManagement():
 				statMsg = nodeB_prefix + 'NB showed ' + str(gnbRxTxWakeUpFailure) + ' "could not wakeup gNB rxtx process" message(s)'
 				logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
 				htmleNBFailureMsg += statMsg + '\n'
+			if gnbTxWriteThreadEnabled:
+				statMsg = nodeB_prefix + 'NB ran with TX Write thread enabled'
+				logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
+				htmleNBFailureMsg += statMsg + '\n'
 		if uciStatMsgCount > 0:
 			statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)'
 			logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml
new file mode 100644
index 00000000000..ad91807a9bd
--- /dev/null
+++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml
@@ -0,0 +1,71 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.openairinterface.org/?page_id=698
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+        <htmlTabRef>run-oai-gnb-nr-ue</htmlTabRef>
+        <htmlTabName>Run-gNB-and-NR-UE</htmlTabName>
+        <htmlTabIcon>tasks</htmlTabIcon>	
+	<repeatCount>2</repeatCount>
+	<TestCaseRequestedList>
+090103 000001 090104 000002 090108 090109
+	</TestCaseRequestedList>
+	<TestCaseExclusionList></TestCaseExclusionList>
+	
+        <testCase id="090103">
+                <class>Initialize_eNB</class>
+                <desc>Initialize gNB USRP (Multi-Threading enabled)</desc>
+		<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test --usrp-tx-thread-config 1</Initialize_eNB_args>
+		<air_interface>NR</air_interface>
+        </testCase>
+
+	<testCase id="000001">
+		<class>IdleSleep</class>
+		<desc>Sleep</desc>
+		<idle_sleep_time_in_sec>5</idle_sleep_time_in_sec>
+	</testCase>
+
+	<testCase id="000002">
+		<class>IdleSleep</class>
+		<desc>Waiting for NR UE to synchronize w/ gNB</desc>
+		<idle_sleep_time_in_sec>180</idle_sleep_time_in_sec>
+	</testCase>
+
+        <testCase id="090104">
+                <class>Initialize_OAI_UE</class>
+                <desc>Initialize NR UE USRP</desc>
+		<Initialize_OAI_UE_args>--phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --threadoffset 16 --rrc_config_path .</Initialize_OAI_UE_args>
+		<air_interface>NR</air_interface>
+        </testCase>
+
+        <testCase id="090108">
+                <class>Terminate_OAI_UE</class>
+                <desc>Terminate NR UE</desc>
+		<air_interface>NR</air_interface>
+        </testCase>
+
+        <testCase id="090109">
+                <class>Terminate_eNB</class>
+                <desc>Terminate gNB</desc>
+		<air_interface>NR</air_interface>
+        </testCase>
+
+</testCaseList>
diff --git a/ci-scripts/xml_files/gnb_usrp_build.xml b/ci-scripts/xml_files/gnb_usrp_build.xml
index bba92930c51..97d6ef06f62 100644
--- a/ci-scripts/xml_files/gnb_usrp_build.xml
+++ b/ci-scripts/xml_files/gnb_usrp_build.xml
@@ -24,6 +24,7 @@
 	<htmlTabRef>gnb-build-tab</htmlTabRef>
 	<htmlTabName>Build-gNB</htmlTabName>
 	<htmlTabIcon>wrench</htmlTabIcon>
+	<repeatCount>4</repeatCount>
 	<TestCaseRequestedList>
 010101
 	</TestCaseRequestedList>
diff --git a/ci-scripts/xml_files/nr_ue_usrp_build.xml b/ci-scripts/xml_files/nr_ue_usrp_build.xml
index 7d8d97d2c52..c3c842b85a9 100644
--- a/ci-scripts/xml_files/nr_ue_usrp_build.xml
+++ b/ci-scripts/xml_files/nr_ue_usrp_build.xml
@@ -24,6 +24,7 @@
 	<htmlTabRef>nr-ue-build-tab</htmlTabRef>
 	<htmlTabName>Build-NR-UE</htmlTabName>
 	<htmlTabIcon>wrench</htmlTabIcon>
+	<repeatCount>2</repeatCount>
 	<TestCaseRequestedList>
 010102
 	</TestCaseRequestedList>
-- 
GitLab