From d7d067165cf1fc2838b5b24e3a74ab7530c8ef7f Mon Sep 17 00:00:00 2001
From: Dhanuja Elizabeth Thomas <dhanuja.thomas@openairinterface.org>
Date: Fri, 17 Feb 2023 14:47:58 +0100
Subject: [PATCH] Add custom command to reboot or reset SDRs in CI

---
 .../xml_files/container_lte_b200_fdd_05Mhz_tm1.xml     | 10 ++++++++--
 ci-scripts/xml_files/container_nsa_b200_quectel.xml    |  8 +++++++-
 ci-scripts/xml_files/fr1_enb_build.xml                 |  8 ++++++++
 ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml           |  8 +++++++-
 ci-scripts/xml_files/fr1_nsa_quectel.xml               |  7 +++++++
 ci-scripts/xml_files/fr1_sa_quectel.xml                |  8 +++++++-
 ci-scripts/xml_files/gnb_usrp_build.xml                |  8 ++++++++
 ci-scripts/xml_files/sa_cn5g_asue_start.xml            |  9 ++++++++-
 ci-scripts/xml_files/sa_cn5g_start.xml                 |  2 +-
 9 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/ci-scripts/xml_files/container_lte_b200_fdd_05Mhz_tm1.xml b/ci-scripts/xml_files/container_lte_b200_fdd_05Mhz_tm1.xml
index ce9a19fde3a..135321a36b3 100644
--- a/ci-scripts/xml_files/container_lte_b200_fdd_05Mhz_tm1.xml
+++ b/ci-scripts/xml_files/container_lte_b200_fdd_05Mhz_tm1.xml
@@ -28,6 +28,7 @@ Replaces xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
     <htmlTabIcon>tasks</htmlTabIcon>
     <TestCaseRequestedList>
 111110
+300000
 040101
 030101
 000001
@@ -41,8 +42,13 @@ Replaces xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
         <desc>Pull Images from Local Registry</desc>
         <test_svr_id>0</test_svr_id>
         <images_to_pull>oai-enb</images_to_pull>
-    </testCase>
-
+   </testCase>
+   <testCase id="300000">
+	    <class>Custom_Command</class>
+	    <desc>To reset USRP</desc>
+	    <node>hutch</node>
+	    <command>sudo -S b2xx_fx3_utils --reset-device</command>
+   </testCase>
     <testCase id="030101">
         <class>Deploy_Object</class>
         <desc>Deploy eNB (FDD/Band7/5MHz/B200) in a container</desc>
diff --git a/ci-scripts/xml_files/container_nsa_b200_quectel.xml b/ci-scripts/xml_files/container_nsa_b200_quectel.xml
index 3734c91229f..5362e4ec31f 100644
--- a/ci-scripts/xml_files/container_nsa_b200_quectel.xml
+++ b/ci-scripts/xml_files/container_nsa_b200_quectel.xml
@@ -26,6 +26,7 @@
 	<htmlTabIcon>tasks</htmlTabIcon>
 	<repeatCount>1</repeatCount>
 	<TestCaseRequestedList>
+ 100000
  111110
  111111
  000001
@@ -69,7 +70,12 @@
 		<desc>Initialize Quectel</desc>
 		<id>idefix</id>
 	</testCase>
-
+        <testCase id = "100000">
+		<class>Custom_Command</class>
+		<desc>To reset USRP</desc>
+		<node>nepes</node>
+		<command>sudo -S b2xx_fx3_utils --reset-device</command>
+        </testCase>
 
 	<testCase id="010002">
 		<class>Terminate_UE</class>
diff --git a/ci-scripts/xml_files/fr1_enb_build.xml b/ci-scripts/xml_files/fr1_enb_build.xml
index 084f58a5913..6ea1ccfd29e 100644
--- a/ci-scripts/xml_files/fr1_enb_build.xml
+++ b/ci-scripts/xml_files/fr1_enb_build.xml
@@ -25,6 +25,7 @@
 	<htmlTabName>Build</htmlTabName>
 	<htmlTabIcon>wrench</htmlTabIcon>
 	<TestCaseRequestedList>
+ 100000
  000001
  000002
 	</TestCaseRequestedList>
@@ -47,4 +48,11 @@
 		<eNB_serverId>0</eNB_serverId>
 	</testCase>
 
+	<testCase id="100000">
+		<class>Custom_Command</class>
+		<desc>To reboot USRP</desc>
+		<node>obelix</node>
+		<command>ssh root@172.21.19.13 reboot ; sleep 45 </command>
+        </testCase>
+
 </testCaseList>
diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
index 459a16c3237..be9df7a2776 100644
--- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
+++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
@@ -27,6 +27,7 @@
 	<repeatCount>1</repeatCount>
 	<TestCaseRequestedList>
  010002
+ 100000
  030000
  040000
  000002
@@ -84,7 +85,12 @@
 		<rt_stats_cfg>datalog_rt_stats.2x2.yaml</rt_stats_cfg>
 		<USRP_IPAddress>172.21.19.14</USRP_IPAddress>
 	</testCase>
-
+	<testCase id = "100000">
+		<class>Custom_Command</class>
+		<desc>To reboot USRP</desc>
+		<node>asterix</node>
+		<command>ssh root@172.21.19.14 reboot ; sleep 45</command>
+        </testCase>
 	<testCase id="000001">
 		<class>IdleSleep</class>
 		<desc>Sleep</desc>
diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml
index c72c61c0a28..cad63582317 100644
--- a/ci-scripts/xml_files/fr1_nsa_quectel.xml
+++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml
@@ -26,6 +26,7 @@
 	<htmlTabIcon>tasks</htmlTabIcon>
 	<repeatCount>1</repeatCount>
 	<TestCaseRequestedList>
+ 100000
  010002
  030000
  040000
@@ -52,6 +53,12 @@
 		<id>idefix</id>
 		<UE_Trace>yes</UE_Trace>
 	</testCase>
+	<testCase id="100000">
+		<class>Custom_Command</class>
+		<desc>To reset USRP</desc>
+		<node>obelix</node>
+		<command>sudo -S b2xx_fx3_utils --reset-device</command>
+	</testCase>
 
 	<testCase id="010002">
 		<class>Terminate_UE</class>
diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml
index 0a9d17b63d8..4d4c0ef45ef 100644
--- a/ci-scripts/xml_files/fr1_sa_quectel.xml
+++ b/ci-scripts/xml_files/fr1_sa_quectel.xml
@@ -27,6 +27,7 @@
 	<repeatCount>1</repeatCount>
 	<TestCaseRequestedList>
  010002
+ 300000
  040000
  000002
  010000
@@ -59,7 +60,12 @@
 		<desc>Terminate Quectel</desc>
 		<id>nrmodule2_quectel</id>
 	</testCase>
-
+       <testCase id="300000">
+            <class>Custom_Command</class>
+            <desc>To reboot USRP</desc>
+            <node>asterix</node>
+            <command>ssh root@172.21.19.14 reboot ; sleep 45</command>
+       </testCase>
 
 	<testCase id="040000">
 		<class>Initialize_eNB</class>
diff --git a/ci-scripts/xml_files/gnb_usrp_build.xml b/ci-scripts/xml_files/gnb_usrp_build.xml
index 3fc1b1c955f..4dd477cbb43 100644
--- a/ci-scripts/xml_files/gnb_usrp_build.xml
+++ b/ci-scripts/xml_files/gnb_usrp_build.xml
@@ -26,6 +26,7 @@
 	<htmlTabIcon>wrench</htmlTabIcon>
 	<repeatCount>1</repeatCount>
 	<TestCaseRequestedList>
+100000
 010101
 	</TestCaseRequestedList>
 	<TestCaseExclusionList></TestCaseExclusionList>
@@ -38,4 +39,11 @@
 		<forced_workspace_cleanup>True</forced_workspace_cleanup>
 	</testCase>
 
+	<testCase id="100000">
+		<class>Custom_Command</class>
+		<desc>To reboot USRP</desc>
+		<node>caracal</node>
+		<command>ssh root@192.168.20.2 reboot</command>
+        </testCase>
+
 </testCaseList>
diff --git a/ci-scripts/xml_files/sa_cn5g_asue_start.xml b/ci-scripts/xml_files/sa_cn5g_asue_start.xml
index 740022b1c9c..8e4e32a95e0 100644
--- a/ci-scripts/xml_files/sa_cn5g_asue_start.xml
+++ b/ci-scripts/xml_files/sa_cn5g_asue_start.xml
@@ -25,7 +25,8 @@
 	<htmlTabName>CN5G-Start</htmlTabName>
 	<htmlTabIcon>log-in</htmlTabIcon>
 	<TestCaseRequestedList>
- 000100
+100000
+000100
 	</TestCaseRequestedList>
 	<TestCaseExclusionList>
 	</TestCaseExclusionList>
@@ -35,5 +36,11 @@
 		<desc>Initialize 5G Core</desc>
 		<args>--type start-mini-as-ue --fqdn yes --scenario 1 --capture /tmp/oai-cn5g-v1.3.pcap</args>
 	</testCase>
+	<testCase id = "100000">
+		<class>Custom_Command</class>
+		<desc>To reboot USRP</desc>
+		<node>asterix</node>
+                <command>ssh root@172.21.19.14 reboot ; sleep 45</command>
+	</testCase>
 
 </testCaseList>
diff --git a/ci-scripts/xml_files/sa_cn5g_start.xml b/ci-scripts/xml_files/sa_cn5g_start.xml
index a524610569e..44ec44b1d90 100644
--- a/ci-scripts/xml_files/sa_cn5g_start.xml
+++ b/ci-scripts/xml_files/sa_cn5g_start.xml
@@ -25,7 +25,7 @@
 	<htmlTabName>CN5G-Start</htmlTabName>
 	<htmlTabIcon>log-in</htmlTabIcon>
 	<TestCaseRequestedList>
- 000100
+000100
 	</TestCaseRequestedList>
 	<TestCaseExclusionList>
 	</TestCaseExclusionList>
-- 
GitLab