Commit 3c1c6e3c authored by hardy's avatar hardy

adding tcp bidir option to CI tests

parent e807d518
...@@ -2009,6 +2009,35 @@ class OaiCiTest(): ...@@ -2009,6 +2009,35 @@ class OaiCiTest():
else: else:
return -2 return -2
def Iperf_analyzeV2BIDIR(self, lock, UE_IPAddress, device_id, statusQueue,server_filename,client_filename):
#server file is unused for the moment
if (not os.path.isfile(client_filename)):
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Bidir TCP : Could not analyze from client log')
return
report=[]
report_msg='Client Report:\n'
with open(client_filename, 'r') as f_client:
for line in f_client.readlines():
result = re.search(rf'^\[\s+\d+\](?P<direction>\[.+\]).*\s+(?P<bitrate>[0-9\.]+ [KMG]bits\/sec).*\s+(?P<role>\bsender|receiver\b)', str(line))
if result is not None:
report.append(str(line))
report_msg+=result.group('role') + ' ' + result.group('direction')+ '\t = ' +result.group('bitrate')+'\n'
if len(report)>0:
lock.acquire()
statusQueue.put(0)
statusQueue.put(device_id)
statusQueue.put(UE_IPAddress)
statusQueue.put(report_msg)
logging.debug('\u001B[1;37;45m TCP Bidir Iperf Result (' + UE_IPAddress + ') \u001B[0m')
logging.debug('\u001B[1;35m ' + report_msg + '\u001B[0m')
lock.release()
else:
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Bidir TCP : Could not analyze from client log')
def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options, filename,type): def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options, filename,type):
if (not os.path.isfile(filename)): if (not os.path.isfile(filename)):
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log') self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log')
...@@ -2297,14 +2326,19 @@ class OaiCiTest(): ...@@ -2297,14 +2326,19 @@ class OaiCiTest():
result = re.search('TRF_IP_ADDR = (?P<trf_ip_addr>[0-9\.]+)', SSH.getBefore()) result = re.search('TRF_IP_ADDR = (?P<trf_ip_addr>[0-9\.]+)', SSH.getBefore())
if result is not None: if result is not None:
trf_gen_IP = result.group('trf_ip_addr') trf_gen_IP = result.group('trf_ip_addr')
#kill iperf processes on EPC side
SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf"', '\$', 5)
SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf3"', '\$', 5)
SSH.close() SSH.close()
#kill iperf processes on UE side before (in case there are still some remaining) #kill iperf processes on UE side before (in case there are still some remaining)
SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword)
cmd = 'killall --signal=SIGKILL iperf' cmd = 'killall --signal=SIGKILL iperf'
SSH.command(cmd,'\$',5) SSH.command(cmd,'\$',5)
cmd = 'killall --signal=SIGKILL iperf3'
SSH.command(cmd,'\$',5)
SSH.close() SSH.close()
iperf_time = self.Iperf_ComputeTime() iperf_time = self.Iperf_ComputeTime()
if self.iperf_direction=="DL": if self.iperf_direction=="DL":
logging.debug("Iperf for Module in DL mode detected") logging.debug("Iperf for Module in DL mode detected")
#server side UE #server side UE
...@@ -2318,7 +2352,7 @@ class OaiCiTest(): ...@@ -2318,7 +2352,7 @@ class OaiCiTest():
#client side EPC #client side EPC
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf"', '\$', 5)
iperf_cmd = 'bin/iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename iperf_cmd = 'bin/iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename
cmd = 'docker exec -it prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' cmd = 'docker exec -it prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"'
SSH.command(cmd,'\$',int(iperf_time)*5.0) SSH.command(cmd,'\$',int(iperf_time)*5.0)
...@@ -2337,7 +2371,7 @@ class OaiCiTest(): ...@@ -2337,7 +2371,7 @@ class OaiCiTest():
#server side EPC #server side EPC
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf"', '\$', 5)
iperf_cmd = 'echo $USER; nohup bin/iperf -s -u 2>&1 > ' + server_filename iperf_cmd = 'echo $USER; nohup bin/iperf -s -u 2>&1 > ' + server_filename
cmd = 'docker exec -d prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"' cmd = 'docker exec -d prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"'
SSH.command(cmd,'\$',5) SSH.command(cmd,'\$',5)
...@@ -2362,6 +2396,38 @@ class OaiCiTest(): ...@@ -2362,6 +2396,38 @@ class OaiCiTest():
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, server_filename, '.') SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, server_filename, '.')
#send for analysis #send for analysis
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,server_filename,1) self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,server_filename,1)
elif self.iperf_direction=="BIDIR":
logging.debug("Iperf for Module in BIDIR mode detected")
#server side EPC
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
iperf_cmd = 'echo $USER; nohup /usr/local/bin/iperf3 -s 2>&1 > ' + server_filename
cmd = 'docker exec -d prod-trf-gen /bin/bash -c \"' + iperf_cmd + '\"'
SSH.command(cmd,'\$',5)
SSH.close()
#client side UE
SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword)
client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log'
cmd = 'rm '+ client_filename
SSH.command(cmd,'\$',5)
SSH.command('iperf3 -B ' + UE_IPAddress + ' -c ' + trf_gen_IP + ' ' + self.iperf_args + ' 2>&1 > ' + client_filename, '\$', int(iperf_time)*5.0)
SSH.close()
#once client is done, retrieve the server file from container to EPC Host
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
SSH.command('docker cp prod-trf-gen:/iperf-2.0.13/' + server_filename + ' ' + EPC.SourceCodePath, '\$', 5)
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/' + server_filename, '.')
SSH.close()
#copy the 2 resulting files locally
SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, client_filename, '.')
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, server_filename, '.')
#send for analysis
self.Iperf_analyzeV2BIDIR(lock, UE_IPAddress, device_id, statusQueue, server_filename, client_filename)
else : else :
logging.debug("Incorrect or missing IPERF direction in XML") logging.debug("Incorrect or missing IPERF direction in XML")
...@@ -2427,6 +2493,30 @@ class OaiCiTest(): ...@@ -2427,6 +2493,30 @@ class OaiCiTest():
#send for analysis #send for analysis
filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1) self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1)
elif self.iperf_direction=="BIDIR":
logging.debug("Iperf for Module in BIDIR mode detected")
#server side EPC
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
server_filename = 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
cmd = 'rm ' + server_filename
SSH.command(cmd,'\$',5)
cmd = 'echo $USER; nohup iperf3 -s 2>&1 > '+server_filename+' &'
SSH.command(cmd,'\$',5)
SSH.close()
#client side UE
SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword)
client_filename = 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log'
cmd = 'rm ' + client_filename
SSH.command(cmd,'\$',5)
SSH.command('iperf3 -c 192.172.0.1 ' + self.iperf_args + ' 2>&1 > '+client_filename, '\$', int(iperf_time)*5.0)
SSH.close()
#copy the 2 resulting files locally
SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, client_filename, '.')
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, server_filename, '.')
#send for analysis
self.Iperf_analyzeV2BIDIR(lock, UE_IPAddress, device_id, statusQueue, server_filename, client_filename)
else : else :
logging.debug("Incorrect or missing IPERF direction in XML") logging.debug("Incorrect or missing IPERF direction in XML")
......
...@@ -308,7 +308,7 @@ def GetParametersFromXML(action): ...@@ -308,7 +308,7 @@ def GetParametersFromXML(action):
CiTestObj.ue_id = "" CiTestObj.ue_id = ""
else: else:
CiTestObj.ue_id = ue_id CiTestObj.ue_id = ue_id
CiTestObj.iperf_direction = test.findtext('direction')#used for modules only CiTestObj.iperf_direction = test.findtext('direction')#used for modules only
CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold') CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold')
CiTestObj.iperf_profile = test.findtext('iperf_profile') CiTestObj.iperf_profile = test.findtext('iperf_profile')
if (CiTestObj.iperf_profile is None): if (CiTestObj.iperf_profile is None):
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
000001 000001
070001 070001
000001 000001
070002
000001
050000 050000
050001 050001
010002 010002
...@@ -132,6 +134,14 @@ ...@@ -132,6 +134,14 @@
<iperf_profile>single-ue</iperf_profile> <iperf_profile>single-ue</iperf_profile>
</testCase> </testCase>
<testCase id="070002">
<class>Iperf</class>
<desc>iperf (BIDIR TCP)(10 sec)(single-ue profile)</desc>
<iperf_args>-t 10 --bidir</iperf_args>
<direction>BIDIR</direction>
<id>idefix</id>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="080000"> <testCase id="080000">
<class>Terminate_eNB</class> <class>Terminate_eNB</class>
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
050001 050001
070000 070000
070001 070001
070002
000001 000001
010002 010002
080000 080000
...@@ -118,6 +119,15 @@ ...@@ -118,6 +119,15 @@
<iperf_profile>single-ue</iperf_profile> <iperf_profile>single-ue</iperf_profile>
</testCase> </testCase>
<testCase id="070002">
<class>Iperf</class>
<desc>iperf (BIDIR TCP)(10 sec)(single-ue profile)</desc>
<iperf_args>-t 10 --bidir</iperf_args>
<direction>BIDIR</direction>
<id>nrmodule2_quectel</id>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="080000"> <testCase id="080000">
<class>Terminate_eNB</class> <class>Terminate_eNB</class>
......
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