Commit 9f55d712 authored by Robert Schmidt's avatar Robert Schmidt

Refactor Ping to use %cn_ip% for address to ping, or hardcoded

parent 2500138f
......@@ -511,37 +511,34 @@ class OaiCiTest():
return (False, f"UE {ue.getName()} has no IP address")
ping_log_file = f'ping_{self.testCase_id}_{ue.getName()}.log'
ping_time = re.findall("-c *(\d+)",str(self.ping_args))
#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
local_ping_log_file = f'{os.getcwd()}/{ping_log_file}'
# if has pattern %cn_ip%, replace with core IP address, else we assume the IP is present
if re.search('%cn_ip%', self.ping_args):
#target address is different depending on EPC type
if re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE):
self.ping_args = re.sub('%cn_ip%', EPC.MmeIPAddress, self.ping_args)
elif re.match('OAICN5G', EPC.Type, re.IGNORECASE):
self.ping_args = re.sub('%cn_ip%', EPC.MmeIPAddress, self.ping_args)
elif re.match('OC-OAI-CN5G', EPC.Type, re.IGNORECASE):
self.ping_args = re.sub('%cn_ip%', '172.21.6.100', self.ping_args)
else:
self.ping_args = re.sub('%cn_ip%', EPC.IPAddress, self.ping_args)
#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}'
ping_cmd = f'{ue.getCmdPrefix()} ping {interface} {self.ping_args} 2>&1 | tee /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)
message = ue_header + ': ping crashed: TIMEOUT?'
logging.error('\u001B[1;37;41m ' + message + ' \u001B[0m')
return (False, message)
#copy the ping log file to have it locally for analysis (ping stats)
cmd.copyin(src=f'/tmp/{ping_log_file}', tgt=local_ping_log_file)
cmd.close()
# TIMEOUT CASE
ue_header = f'UE {ue.getName()} ({ueIP})'
if ping_status < 0:
message = ue_header + ': ping crashed: TIMEOUT?'
logging.error('\u001B[1;37;41m ' + message + ' \u001B[0m')
return (False, message)
#search is done on cat result
logging.debug('Analyzing Ping log file : ' + os.getcwd() + '/' + ping_log_file)
with open(ping_log_file, 'r') as f:
with open(local_ping_log_file, 'r') as f:
ping_output = "".join(f.readlines())
result = re.search(', (?P<packetloss>[0-9\.]+)% packet loss, time [0-9\.]+ms', ping_output)
if result is None:
......
......@@ -110,7 +110,7 @@ Replaces xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
<testCase id="040501">
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -148,7 +148,7 @@ Replaces xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xm
<testCase id="040502">
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......@@ -156,7 +156,7 @@ Replaces xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xm
<testCase id="040503">
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -104,7 +104,7 @@ Replaces xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
<testCase id="040511">
<class>Ping</class>
<desc>ping (10MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -97,7 +97,7 @@ Replaces xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
<testCase id="040512">
<class>Ping</class>
<desc>ping (10MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -103,7 +103,7 @@ Replaces xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
<testCase id="040521">
<class>Ping</class>
<desc>ping (20MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -111,7 +111,7 @@ Replaces xml_files/enb_usrp210_band40_test_05mhz_tm1.xml
<testCase id="040501">
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>25</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -101,7 +101,7 @@ Replaces xml_files/enb_usrp210_band40_test_05mhz_tm2.xml
<testCase id="040502">
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>25</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -101,7 +101,7 @@ Replaces xml_files/enb_usrp210_band40_test_10mhz_tm1.xml
<testCase id="040511">
<class>Ping</class>
<desc>ping (10MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>25</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -101,7 +101,7 @@ Replaces xml_files/enb_usrp210_band40_test_20mhz_tm1.xml
<testCase id="040521">
<class>Ping</class>
<desc>ping (20MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>25</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -103,7 +103,7 @@ Replaces xml_files/enb_usrp210_band40_test_20mhz_tm1_default_scheduler.xml
<testCase id="040522">
<class>Ping</class>
<desc>ping (20MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>25</ping_packetloss_threshold>
<id>adb_ue_1 adb_ue_2</id>
</testCase>
......
......@@ -102,7 +102,7 @@
<class>Ping</class>
<desc>Ping: 20 pings</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>60</ping_rttavg_threshold>
</testCase>
......@@ -111,7 +111,7 @@
<class>Ping</class>
<desc>Ping: 100 pings, size 1024</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 100 -s 1024 -i 0,2</ping_args>
<ping_args>-c 100 -s 1024 -i 0,2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>60</ping_rttavg_threshold>
</testCase>
......
......@@ -102,7 +102,7 @@
<class>Ping</class>
<desc>Ping: 20 pings</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>60</ping_rttavg_threshold>
</testCase>
......@@ -111,7 +111,7 @@
<class>Ping</class>
<desc>Ping: 100 pings, size 1024</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 100 -s 1024 -i 0,2</ping_args>
<ping_args>-c 100 -s 1024 -i 0,2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>60</ping_rttavg_threshold>
</testCase>
......
......@@ -151,7 +151,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......@@ -160,7 +160,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......@@ -169,7 +169,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......@@ -178,7 +178,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......
......@@ -123,7 +123,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec, multi-ue</desc>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>25</ping_rttavg_threshold>
</testCase>
......@@ -132,7 +132,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec, multi-ue</desc>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>30</ping_rttavg_threshold>
</testCase>
......
......@@ -113,7 +113,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......@@ -122,7 +122,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......
......@@ -119,7 +119,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>25</ping_rttavg_threshold>
</testCase>
......@@ -128,7 +128,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>110</ping_rttavg_threshold>
</testCase>
......@@ -137,7 +137,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>110</ping_rttavg_threshold>
</testCase>
......@@ -146,7 +146,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>110</ping_rttavg_threshold>
</testCase>
......
......@@ -144,7 +144,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......@@ -152,7 +152,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 100 -i 0,2</ping_args>
<ping_args>-c 100 -i 0,2 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......
......@@ -144,7 +144,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......
......@@ -141,7 +141,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......@@ -150,7 +150,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>15</ping_rttavg_threshold>
</testCase>
......
......@@ -109,7 +109,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
......@@ -117,7 +117,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
......
......@@ -106,7 +106,7 @@
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
......@@ -114,7 +114,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>idefix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
......
......@@ -79,7 +79,7 @@
<testCase id="050000">
<class>Ping</class>
<desc>Ping from CN to UE: 20pings in 20sec</desc>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......@@ -87,7 +87,7 @@
<class>Ping</class>
<desc>Ping from CN to UE: 100pings in 20sec</desc>
<id>oai_ue_obelix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......
......@@ -95,7 +95,7 @@
<class>Ping</class>
<desc>Ping from CN to UE: 20pings in 20sec</desc>
<id>oai_ue_obelix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......@@ -103,7 +103,7 @@
<class>Ping</class>
<desc>Ping from CN to UE: 100pings in 20sec</desc>
<id>oai_ue_obelix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......
......@@ -80,7 +80,7 @@
<class>Ping</class>
<desc>Ping from CN to UE: 20pings in 20sec</desc>
<id>oai_ue_obelix</id>
<ping_args>-c 20</ping_args>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......@@ -88,7 +88,7 @@
<class>Ping</class>
<desc>Ping from CN to UE: 100pings in 20sec</desc>
<id>oai_ue_obelix</id>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......
......@@ -114,7 +114,7 @@
<class>Ping</class>
<desc>Ping: 40pings in 40sec</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 40</ping_args>
<ping_args>-c 40 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>10</ping_rttavg_threshold>
</testCase>
......@@ -123,7 +123,7 @@
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 100 -i 0,2</ping_args>
<ping_args>-c 100 -i 0,2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>10</ping_rttavg_threshold>
</testCase>
......
......@@ -111,7 +111,7 @@
<class>Ping</class>
<desc>Ping: 40pings in 40sec</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 40</ping_args>
<ping_args>-c 40 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>20</ping_rttavg_threshold>
</testCase>
......
......@@ -119,7 +119,7 @@
<class>Ping</class>
<desc>Ping: 40pings in 40sec</desc>
<id>nrmodule2_quectel</id>
<ping_args>-c 40</ping_args>
<ping_args>-c 40 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>20</ping_rttavg_threshold>
</testCase>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment