From e089b6354737592dc7a40168efbb35854301d9bb Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Tue, 30 May 2023 14:47:04 +0200
Subject: [PATCH] chore(ci): removing OAI-Rel14-CUPS old bare-metal 4G core
 installation variant

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/args_parse.py    |  4 +--
 ci-scripts/cls_oaicitest.py | 59 ++++++++++++-------------------------
 ci-scripts/helpreadme.py    |  2 +-
 3 files changed, 22 insertions(+), 43 deletions(-)

diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py
index af9eb8ca6b..8bac1f6a92 100644
--- a/ci-scripts/args_parse.py
+++ b/ci-scripts/args_parse.py
@@ -220,10 +220,10 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST
             EPC.SourceCodePath=matchReg.group(1)
         elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE):
             matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE)
-            if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE) or re.match('OC-OAI-CN5G', matchReg.group(1), re.IGNORECASE):
+            if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE) or re.match('OC-OAI-CN5G', matchReg.group(1), re.IGNORECASE):
                 EPC.Type=matchReg.group(1)
             else:
-                sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker or OC-OAI-CN5G)')
+                sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-Docker or OC-OAI-CN5G)')
         elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE):
             matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE)
             EPC.ContainerPrefix=matchReg.group(1)
diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py
index 8166c50697..5b5ee8538c 100644
--- a/ci-scripts/cls_oaicitest.py
+++ b/ci-scripts/cls_oaicitest.py
@@ -505,54 +505,33 @@ class OaiCiTest():
 
 	def Ping_common(self, EPC, ue, RAN):
 		# Launch ping on the EPC side (true for ltebox and old open-air-cn)
-		# But for OAI-Rel14-CUPS, we launch from python executor
 		ping_status = 0
 		ueIP = ue.getIP()
 		if not ueIP:
 			return (False, f"UE {ue.getName()} has no IP address")
-		launchFromEpc = False
 		ping_log_file = f'ping_{self.testCase_id}_{ue.getName()}.log'
-		if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE):
-			launchFromEpc = False
 		ping_time = re.findall("-c *(\d+)",str(self.ping_args))
-		if launchFromEpc:
-			SSH = sshconnection.SSHConnection()
-			SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
-			SSH.command('cd ' + EPC.SourceCodePath, '\$', 5)
-			SSH.command('cd scripts', '\$', 5)
-			# In case of a docker-based deployment, we need to ping from the trf-gen container
-			launchFromTrfContainer = False
-			if (re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE)) or (re.match('OAICN5G', EPC.Type, re.IGNORECASE)):
-				launchFromTrfContainer = True
-			if launchFromTrfContainer:
-				ping_status = SSH.command(f'docker exec -it prod-trf-gen /bin/bash -c "ping {self.ping_args} {ueIP}" 2>&1 | tee {ping_log_file}', '\$', int(ping_time[0])*1.5)
-			else:
-				ping_status = SSH.command(f'stdbuf -o0 ping {self.ping_args} {ueIP} 2>&1 | stdbuf -o0 tee {ping_log_file}', '\$', int(ping_time[0])*1.5)
-			#copy the ping log file to have it locally for analysis (ping stats)
-			SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/scripts/{ping_log_file}', '.')
-			SSH.close()
+		#target address is different depending on EPC type
+		if re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE):
+			Target = EPC.MmeIPAddress
+		elif re.match('OAICN5G', EPC.Type, re.IGNORECASE):
+			Target = EPC.MmeIPAddress
+		elif re.match('OC-OAI-CN5G', EPC.Type, re.IGNORECASE):
+			Target = "172.21.6.100"
 		else:
-			#target address is different depending on EPC type
-			if re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE):
-				Target = EPC.MmeIPAddress
-			elif re.match('OAICN5G', EPC.Type, re.IGNORECASE):
-				Target = EPC.MmeIPAddress
-			elif re.match('OC-OAI-CN5G', EPC.Type, re.IGNORECASE):
-				Target = "172.21.6.100"
-			else:
-				Target = EPC.IPAddress
-			#ping from module NIC rather than IP address to make sure round trip is over the air
-			interface = f'-I {ue.getIFName()}' if ue.getIFName() else ''
-			ping_cmd = f'{ue.getCmdPrefix()} ping {interface} {self.ping_args} {Target} &> /tmp/{ping_log_file}'
-			cmd = cls_cmd.getConnection(ue.getHost())
-			response = cmd.run(ping_cmd, timeout=int(ping_time[0])*1.5)
-			if response.returncode != 0:
-				ping_status = -1
-			else:
-				#copy the ping log file to have it locally for analysis (ping stats)
-				cmd.copyin(src=f'/tmp/{ping_log_file}', tgt=ping_log_file)
+			Target = EPC.IPAddress
+		#ping from module NIC rather than IP address to make sure round trip is over the air
+		interface = f'-I {ue.getIFName()}' if ue.getIFName() else ''
+		ping_cmd = f'{ue.getCmdPrefix()} ping {interface} {self.ping_args} {Target} &> /tmp/{ping_log_file}'
+		cmd = cls_cmd.getConnection(ue.getHost())
+		response = cmd.run(ping_cmd, timeout=int(ping_time[0])*1.5)
+		if response.returncode != 0:
+			ping_status = -1
+		else:
+			#copy the ping log file to have it locally for analysis (ping stats)
+			cmd.copyin(src=f'/tmp/{ping_log_file}', tgt=ping_log_file)
 
-			cmd.close()
+		cmd.close()
 
 		# TIMEOUT CASE
 		ue_header = f'UE {ue.getName()} ({ueIP})'
diff --git a/ci-scripts/helpreadme.py b/ci-scripts/helpreadme.py
index 3a37876265..9ecba905ac 100644
--- a/ci-scripts/helpreadme.py
+++ b/ci-scripts/helpreadme.py
@@ -68,7 +68,7 @@ def EPCSrvHelp(ipaddr, username, password, sourcepath, epctype):
 	print('  --EPCUserName=[EPC\'s Login User Name]                   -- ' + username)
 	print('  --EPCPassword=[EPC\'s Login Password]                    -- ' + password)
 	print('  --EPCSourceCodePath=[EPC\'s Source Code Path]            -- ' + sourcepath)
-	print('  --EPCType=[EPC\'s Type: OAI or ltebox or OAI-Rel14-CUPS] -- ' + epctype)
+	print('  --EPCType=[EPC\'s Type: OAI or ltebox or OC-OAI-CN5G]    -- ' + epctype)
 
 def XmlHelp(filename):
 	print('  --XMLTestFile=[XML Test File to be run]                  -- ' + filename)
-- 
2.26.2