Commit cffdac04 authored by hardy's avatar hardy Committed by Remi Hardy

adding module support, primary test/debug

parent b28ac6d9
ranRepository : https://gitlab.eurecom.fr/oai/openairinterface5g.git ranRepository : https://gitlab.eurecom.fr/oai/openairinterface5g.git
ranBranch : BRANCH_NAME ranBranch : integration_2021_wk13_a
ranCommitID : COMMIT_ID ranCommitID : 104aa7eed5d6702c1b9da663414079ef698da206
ranAllowMerge : 'true' ranAllowMerge : 'yes'
ranTargetBranch : develop ranTargetBranch : develop
steps: steps:
- InitiateHtml,none - InitiateHtml,none
- TesteNB,xml_files/fr1_multi_node_build.xml - TesteNB,xml_files/fr1_multi_node_build.xml
- TesteNB,xml_files/fr1_epc_start.xml - TesteNB,xml_files/fr1_epc_start.xml
- TesteNB,xml_files/fr1_ran_ue_base.xml #ue toggle, nodes initialize, ue toggle, ping, nodes terminate - TesteNB,xml_files/fr1_nsa_base_next.xml #ue toggle, nodes initialize, ue toggle, ping, nodes terminate
- TesteNB,xml_files/fr1_epc_closure.xml - TesteNB,xml_files/fr1_epc_closure.xml
......
idefix:
ID: idefix
State : enabled
Kind : quectel
Process : quectel-CM
WakeupScript : ci_qtel.py
UENetwork : wwan0
HostIPAddress : 192.168.18.188
HostUsername : oaicicd
HostPassword : oaicicd
HostSourceCodePath : none
dummy1:
ID: dummy1
Kind : simcom
State : disabled
Process : quectel-cm
HostIPAddress : 192.168.18.187
HostUsername : oaicicd
HostPassword : oaicicd
HostSourceCodePath : none
dummy2:
ID: dummy2
Kind : cots
State : disabled
Process : quectel-cm
HostIPAddress : 192.168.18.186
HostUsername : oaicicd
HostPassword : oaicicd
HostSourceCodePath : none
# * 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
# */
#---------------------------------------------------------------------
#
# Required Python Version
# Python 3.x
#
#---------------------------------------------------------------------
#to use isfile
import os
import sys
import logging
#to create a SSH object locally in the methods
import sshconnection
#time.sleep
import time
#to load ue infrastructure dictionary
import yaml
class InfraUE:
def __init__(self):
self.ci_ue_infra ={}
#-----------------$
#PUBLIC Methods$
#-----------------$
#This method reads the yaml file describing the multi-UE infrastructure
#and stores the infra permanently in the related class attribute self.ci_ue_infra
def Get_UE_Infra(self,ue_infra_filename):
f_yaml=ue_infra_filename
with open(f_yaml,'r') as file:
logging.debug('Loading UE infrastructure from file '+f_yaml)
#load it permanently in the class attribute
self.ci_ue_infra = yaml.load(file,Loader=yaml.FullLoader)
# * 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
# */
#---------------------------------------------------------------------
#
# Required Python Version
# Python 3.x
#
#---------------------------------------------------------------------
#to use isfile
import os
import sys
import logging
#to create a SSH object locally in the methods
import sshconnection
#time.sleep
import time
import re
import subprocess
class Module_UE:
# ID: idefix
# State : enabled
# Kind : quectel
# Process : quectel-cm
# WakeupScript : ci_qtel.py
# UENetwork : wwan0
# HostIPAddress : 192.168.18.188
# HostUsername : oaicicd
# HostPassword : oaicicd
# HostSourceCodePath : none
def __init__(self,Module):
#create attributes as in the Module dictionary
for k, v in Module.items():
setattr(self, k, v)
self.UEIPAddress = ""
#-----------------$
#PUBLIC Methods$
#-----------------$
#this method checks if the specified Process is running on the server hosting the module
def CheckIsModule(self):
HOST=self.HostIPAddress
COMMAND="ps aux | grep " + self.Process + " | grep -v grep "
logging.debug(COMMAND)
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
result = ssh.stdout.readlines()
if len(result)!=0:
logging.debug(self.Process + " process found")
return True
else:
logging.debug(self.Process + " process NOT found")
return False
#this method wakes up the module by calling the specified python script
def WakeUp(self):
mySSH = sshconnection.SSHConnection()
mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
mySSH.command('echo ' + self.HostPassword + ' | sudo -S python3 ' + self.WakeupScript + ' ','\$',5)
time.sleep(5)
logging.debug("Module wake-up")
mySSH.close()
#this method retrieves the Module IP address (not the Host IP address)
def GetModuleIPAddress(self):
HOST=self.HostIPAddress
COMMAND="ip a show dev " + self.UENetwork + " | grep inet | grep " + self.UENetwork
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
response = ssh.stdout.readlines()
if len(response)!=0:
result = re.search('inet (?P<moduleipaddress>[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', response[0].decode("utf-8") )
if result is not None:
if result.group('moduleipaddress') is not None:
self.UEIPAddress = result.group('moduleipaddress')
logging.debug('\u001B[1mUE Module IP Address is ' + self.UEIPAddress + '\u001B[0m')
else:
logging.debug('\u001B[1;37;41m Module IP Address Not Found! \u001B[0m')
else:
logging.debug('\u001B[1;37;41m Module IP Address Not Found! \u001B[0m')
else:
logging.debug('\u001B[1;37;41m Module IP Address Not Found! \u001B[0m')
...@@ -54,7 +54,8 @@ import helpreadme as HELP ...@@ -54,7 +54,8 @@ import helpreadme as HELP
import constants as CONST import constants as CONST
import sshconnection import sshconnection
import cls_module_ue
import cls_ci_ueinfra #class defining the multi Ue infrastrucure
#----------------------------------------------------------- #-----------------------------------------------------------
...@@ -129,6 +130,7 @@ class OaiCiTest(): ...@@ -129,6 +130,7 @@ class OaiCiTest():
self.iperf_packetloss_threshold = '' self.iperf_packetloss_threshold = ''
self.iperf_profile = '' self.iperf_profile = ''
self.iperf_options = '' self.iperf_options = ''
self.iperf_direction = ''
self.nbMaxUEtoAttach = -1 self.nbMaxUEtoAttach = -1
self.UEDevices = [] self.UEDevices = []
self.UEDevicesStatus = [] self.UEDevicesStatus = []
...@@ -157,6 +159,7 @@ class OaiCiTest(): ...@@ -157,6 +159,7 @@ class OaiCiTest():
self.clean_repository = True self.clean_repository = True
self.air_interface='' self.air_interface=''
self.expectedNbOfConnectedUEs = 0 self.expectedNbOfConnectedUEs = 0
self.ue_id = '' #used for module identification
def BuildOAIUE(self,HTML): def BuildOAIUE(self,HTML):
...@@ -364,29 +367,39 @@ class OaiCiTest(): ...@@ -364,29 +367,39 @@ class OaiCiTest():
except: except:
os.kill(os.getppid(),signal.SIGUSR1) os.kill(os.getppid(),signal.SIGUSR1)
def InitializeUE(self,HTML,COTS_UE): def InitializeUE(self,HTML,COTS_UE, InfraUE):
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': if self.ue_id=='':#no ID specified, then it is a COTS controlled by ADB
HELP.GenericHelp(CONST.Version) if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
sys.exit('Insufficient Parameter') HELP.GenericHelp(CONST.Version)
multi_jobs = [] sys.exit('Insufficient Parameter')
i = 0 multi_jobs = []
for device_id in self.UEDevices: i = 0
p = Process(target = self.InitializeUE_common, args = (device_id,i,COTS_UE,)) for device_id in self.UEDevices:
p.daemon = True p = Process(target = self.InitializeUE_common, args = (device_id,i,COTS_UE,))
p.start() p.daemon = True
multi_jobs.append(p) p.start()
i += 1 multi_jobs.append(p)
for job in multi_jobs: i += 1
job.join() for job in multi_jobs:
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) job.join()
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
else: #if an ID is specified, it is a module from the yaml infrastructure file
#RH
Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
is_module=Module_UE.CheckIsModule()
if is_module:
Module_UE.WakeUp()
Module_UE.GetModuleIPAddress()
HTML.CreateHtmlTestRow(Module_UE.UEIPAddress, 'OK', CONST.ALL_PROCESSES_OK)
self.UEIPAddresses.append(Module_UE.UEIPAddress)
logging.debug(self.UEIPAddresses)
def InitializeOAIUE(self,HTML,RAN,EPC,COTS_UE): def InitializeOAIUE(self,HTML,RAN,EPC,COTS_UE):
if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '':
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
if self.air_interface == 'lte-uesoftmodem': if self.air_interface == 'lte-uesoftmodem':
result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args)) result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
if result is None: if result is None:
...@@ -1437,14 +1450,20 @@ class OaiCiTest(): ...@@ -1437,14 +1450,20 @@ class OaiCiTest():
statusQueue.put(message) statusQueue.put(message)
lock.release() lock.release()
def Ping_common(self, lock, UE_IPAddress, device_id, statusQueue,EPC): def Ping_common(self, lock, UE_IPAddress, device_id, statusQueue,EPC, InfraUE):
try: try:
SSH = sshconnection.SSHConnection() SSH = sshconnection.SSHConnection()
# Launch ping on the EPC side (true for ltebox and old open-air-cn) # Launch ping on the EPC side (true for ltebox and old open-air-cn)
# But for OAI-Rel14-CUPS, we launch from python executor # But for OAI-Rel14-CUPS, we launch from python executor
launchFromEpc = True launchFromEpc = True
launchFromModule = False
if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE): if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE):
launchFromEpc = False launchFromEpc = False
#if module, ping from module to EPC
if self.ue_id!='':
launchFromEpc = False
launchfromModule = True
ping_time = re.findall("-c (\d+)",str(self.ping_args)) ping_time = re.findall("-c (\d+)",str(self.ping_args))
if launchFromEpc: if launchFromEpc:
...@@ -1462,21 +1481,36 @@ class OaiCiTest(): ...@@ -1462,21 +1481,36 @@ class OaiCiTest():
#copy the ping log file to have it locally for analysis (ping stats) #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_' + self.testCase_id + '_' + device_id + '.log', '.') SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '.')
else: else:
#ping log file is on the python executor if launchfromModule == False:
cmd = 'ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + device_id + '.log' #ping log file is on the python executor
message = cmd + '\n' cmd = 'ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + device_id + '.log'
logging.debug(cmd) message = cmd + '\n'
ret = subprocess.run(cmd, shell=True) logging.debug(cmd)
ping_status = ret.returncode ret = subprocess.run(cmd, shell=True)
#copy the ping log file to an other folder for log collection (source and destination are EPC) ping_status = ret.returncode
SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'ping_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts') #copy the ping log file to an other folder for log collection (source and destination are EPC)
#copy the ping log file to have it locally for analysis (ping stats) SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'ping_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
logging.debug(EPC.SourceCodePath + 'ping_' + self.testCase_id + '_' + device_id + '.log') #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_' + self.testCase_id + '_' + device_id + '.log', '.') logging.debug(EPC.SourceCodePath + 'ping_' + self.testCase_id + '_' + device_id + '.log')
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath +'/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '.')
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
#cat is executed on EPC
SSH.command('cat ' + EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
else: #launch from Module
Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword)
cmd = 'ping -I ' + UE_IPAddress + ' ' + self.ping_args + ' ' + EPC.IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command(cmd,'\$',int(ping_time[0])*1.5)
logging.debug(cmd)
#copy the ping log file to have it locally for analysis (ping stats)
SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, 'ping_' + self.testCase_id + '_' + self.ue_id + '.log', '.')
#cat is executed locally
SSH.command('cat ping_' + self.testCase_id + '_' + self.ue_id + '.log', '\$', 5)
ping_status=0
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
#cat is executed on EPC
SSH.command('cat ' + EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
# TIMEOUT CASE # TIMEOUT CASE
if ping_status < 0: if ping_status < 0:
message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!' message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!'
...@@ -1660,7 +1694,7 @@ class OaiCiTest(): ...@@ -1660,7 +1694,7 @@ class OaiCiTest():
except: except:
os.kill(os.getppid(),signal.SIGUSR1) os.kill(os.getppid(),signal.SIGUSR1)
def Ping(self,HTML,RAN,EPC,COTS_UE): def Ping(self,HTML,RAN,EPC,COTS_UE, InfraUE):
result = re.search('noS1', str(RAN.Initialize_eNB_args)) result = re.search('noS1', str(RAN.Initialize_eNB_args))
if result is not None: if result is not None:
self.PingNoS1(HTML,RAN,EPC,COTS_UE) self.PingNoS1(HTML,RAN,EPC,COTS_UE)
...@@ -1678,18 +1712,29 @@ class OaiCiTest(): ...@@ -1678,18 +1712,29 @@ class OaiCiTest():
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0): if self.ue_id=="":
HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) ueIpStatus = self.GetAllUEIPAddresses()
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) if (ueIpStatus < 0):
return HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return
else:
Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
Module_UE.GetModuleIPAddress()
if Module_UE.UEIPAddress not in self.UEIPAddresses:
self.UEIPAddresses.append(Module_UE.UEIPAddress)
logging.debug(self.UEIPAddresses)
multi_jobs = [] multi_jobs = []
i = 0 i = 0
lock = Lock() lock = Lock()
status_queue = SimpleQueue() status_queue = SimpleQueue()
for UE_IPAddress in self.UEIPAddresses: for UE_IPAddress in self.UEIPAddresses:
device_id = self.UEDevices[i] if self.ue_id=="":
p = Process(target = self.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,EPC,)) device_id = self.UEDevices[i]
else:
device_id = ""
p = Process(target = self.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,EPC,InfraUE,))
p.daemon = True p.daemon = True
p.start() p.start()
multi_jobs.append(p) multi_jobs.append(p)
...@@ -1864,8 +1909,8 @@ class OaiCiTest(): ...@@ -1864,8 +1909,8 @@ class OaiCiTest():
else: else:
return -2 return -2
def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options, filename,type):
if (not os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')): 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')
return return
# Computing the requested bandwidth in float # Computing the requested bandwidth in float
...@@ -1890,14 +1935,18 @@ class OaiCiTest(): ...@@ -1890,14 +1935,18 @@ class OaiCiTest():
req_bandwidth = '%.1f Gbits/sec' % req_bw req_bandwidth = '%.1f Gbits/sec' % req_bw
req_bw = req_bw * 1000000000 req_bw = req_bw * 1000000000
server_file = open('iperf_server_' + self.testCase_id + '_' + device_id + '.log', 'r') server_file = open(filename, 'r')
br_sum = 0.0 br_sum = 0.0
ji_sum = 0.0 ji_sum = 0.0
pl_sum = 0 pl_sum = 0
ps_sum = 0 ps_sum = 0
row_idx = 0 row_idx = 0
for line in server_file.readlines(): for line in server_file.readlines():
result = re.search('(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(?P<lostPack>[0-9]+)/ +(?P<sentPack>[0-9]+)', str(line)) if type==0:
result = re.search('(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(?P<lostPack>[0-9]+)/ +(?P<sentPack>[0-9]+)', str(line))
else:
result = re.search('^.+ +(?P<bitrate>[0-9\.]+ [KMG]bits\/sec) +(?P<jitter>[0-9\.]+ ms) +(?P<lostPack>[0-9]+)\/(?P<sentPack>[0-9]+)', str(line))
if result is not None: if result is not None:
bitrate = result.group('bitrate') bitrate = result.group('bitrate')
jitter = result.group('jitter') jitter = result.group('jitter')
...@@ -2127,13 +2176,65 @@ class OaiCiTest(): ...@@ -2127,13 +2176,65 @@ class OaiCiTest():
SSH.command('docker cp prod-trf-gen:/iperf-2.0.5/iperf_server_' + self.testCase_id + '_' + device_id + '.log ' + EPC.SourceCodePath + '/scripts', '\$', 5) SSH.command('docker cp prod-trf-gen:/iperf-2.0.5/iperf_server_' + self.testCase_id + '_' + device_id + '.log ' + EPC.SourceCodePath + '/scripts', '\$', 5)
SSH.close() SSH.close()
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath+ '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.') SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath+ '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) filename='iperf_server_' + self.testCase_id + '_' + device_id + '.log'
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options,filename,0)
# in case of OAI-UE # in case of OAI-UE
if (device_id == 'OAI-UE'): if (device_id == 'OAI-UE'):
SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_' + self.testCase_id + '_' + device_id + '.log', '.') SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_' + self.testCase_id + '_' + device_id + '.log', '.')
SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts') SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts')
def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC):
def Iperf_Module(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC, InfraUE):
SSH = sshconnection.SSHConnection()
iperf_time = self.Iperf_ComputeTime()
if self.iperf_direction=="DL":
logging.debug("Iperf for Module in DL mode detected")
#server side UE
Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword)
cmd = 'echo $USER; nohup iperf -s -B ' + UE_IPAddress + ' -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command(cmd,'\$',5)
logging.debug(cmd)
#client side EPC
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
cmd = 'iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command(cmd,'\$',int(iperf_time)*5.0)
logging.debug(cmd)
#copy the 2 resulting files locally
SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log', '.')
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log', '.')
#send for analysis
filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1)
elif self.iperf_direction=="UL":
logging.debug("Iperf for Module in UL mode detected")
#server side UE
Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
SSH.open(Module_UE.UEHostIPAddr, Module_UE.UEHostUserName, Module_UE.UEHostPassWord)
cmd = 'echo $USER; nohup iperf -s -B ' + UE_IPAddress + ' -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command(cmd,'\$',5)
logging.debug(cmd)
#client side EPC
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
cmd = 'iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command(cmd,'\$',int(iperf_time)*5.0)
logging.debug(cmd)
#copy the 2 resulting files locally
SSH.copyin(Module_UE.UEHostIPAddr, Module_UE.UEHostUserName, Module_UE.UEHostPassWord, 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log', '.')
SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log', '.')
#send for analysis
filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1)
else :
logging.debug("Incorrect or missing IPERF direction in XML")
SSH.close()
return
def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC, InfraUE):
try: try:
SSH = sshconnection.SSHConnection() SSH = sshconnection.SSHConnection()
# Single-UE profile -- iperf only on one UE # Single-UE profile -- iperf only on one UE
...@@ -2229,8 +2330,13 @@ class OaiCiTest(): ...@@ -2229,8 +2330,13 @@ class OaiCiTest():
# Launch the IPERF client on the EPC side for DL (true for ltebox and old open-air-cn # Launch the IPERF client on the EPC side for DL (true for ltebox and old open-air-cn
# But for OAI-Rel14-CUPS, we launch from python executor # But for OAI-Rel14-CUPS, we launch from python executor
launchFromEpc = True launchFromEpc = True
launchFromModule = False
if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE): if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE):
launchFromEpc = False launchFromEpc = False
#if module
if self.ue_id!='' and self.iperf :
launchFromEpc = False
launchfromModule = True
# When using a docker-based deployment, IPERF client shall be launched from trf container # When using a docker-based deployment, IPERF client shall be launched from trf container
launchFromTrfContainer = False launchFromTrfContainer = False
if re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE): if re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE):
...@@ -2334,7 +2440,8 @@ class OaiCiTest(): ...@@ -2334,7 +2440,8 @@ class OaiCiTest():
subprocess.run(cmd, shell=True) subprocess.run(cmd, shell=True)
except: except:
pass pass
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) filename='iperf_server_' + self.testCase_id + '_' + device_id + '.log'
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options,filename,0)
# in case of OAI UE: # in case of OAI UE:
if (device_id == 'OAI-UE'): if (device_id == 'OAI-UE'):
...@@ -2422,7 +2529,8 @@ class OaiCiTest(): ...@@ -2422,7 +2529,8 @@ class OaiCiTest():
if (os.path.isfile('iperf_server_' + self.testCase_id + '.log')): if (os.path.isfile('iperf_server_' + self.testCase_id + '.log')):
os.remove('iperf_server_' + self.testCase_id + '.log') os.remove('iperf_server_' + self.testCase_id + '.log')
SSH.copyin(iServerIPAddr, iServerUser, iServerPasswd, '/tmp/tmp_iperf_server_' + self.testCase_id + '.log', 'iperf_server_' + self.testCase_id + '_OAI-UE.log') SSH.copyin(iServerIPAddr, iServerUser, iServerPasswd, '/tmp/tmp_iperf_server_' + self.testCase_id + '.log', 'iperf_server_' + self.testCase_id + '_OAI-UE.log')
self.Iperf_analyzeV2Server(lock, '10.0.1.2', 'OAI-UE', status_queue, modified_options) filename='iperf_server_' + self.testCase_id + '_' + device_id + '.log'
self.Iperf_analyzeV2Server(lock, '10.0.1.2', 'OAI-UE', status_queue, modified_options,filename,0)
# copying on the EPC server for logCollection # copying on the EPC server for logCollection
if (clientStatus == -1): if (clientStatus == -1):
...@@ -2457,7 +2565,7 @@ class OaiCiTest(): ...@@ -2457,7 +2565,7 @@ class OaiCiTest():
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def Iperf(self,HTML,RAN,EPC,COTS_UE): def Iperf(self,HTML,RAN,EPC,COTS_UE, InfraUE):
result = re.search('noS1', str(RAN.Initialize_eNB_args)) result = re.search('noS1', str(RAN.Initialize_eNB_args))
if result is not None: if result is not None:
self.IperfNoS1(HTML,RAN,EPC,COTS_UE) self.IperfNoS1(HTML,RAN,EPC,COTS_UE)
...@@ -2477,11 +2585,26 @@ class OaiCiTest(): ...@@ -2477,11 +2585,26 @@ class OaiCiTest():
return return
ueIpStatus = self.GetAllUEIPAddresses() ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0): if (ueIpStatus < 0):
logging.debug('going here')
HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
if self.ue_id=="":
ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0):
HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return
else:
Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
Module_UE.GetModuleIPAddress()
if Module_UE.UEIPAddress not in self.UEIPAddresses:
self.UEIPAddresses.append(Module_UE.UEIPAddress)
self.dummyIperfVersion = '2.0.10' self.dummyIperfVersion = '2.0.10'
#cmd = 'iperf --version' #cmd = 'iperf --version'
#logging.debug(cmd + '\n') #logging.debug(cmd + '\n')
...@@ -2498,13 +2621,18 @@ class OaiCiTest(): ...@@ -2498,13 +2621,18 @@ class OaiCiTest():
ue_num = len(self.UEIPAddresses) ue_num = len(self.UEIPAddresses)
lock = Lock() lock = Lock()
status_queue = SimpleQueue() status_queue = SimpleQueue()
logging.debug(self.UEIPAddresses)
for UE_IPAddress in self.UEIPAddresses: for UE_IPAddress in self.UEIPAddresses:
device_id = self.UEDevices[i] device_id = self.UEDevices[i]
p = Process(target = self.Iperf_common, args = (lock,UE_IPAddress,device_id,i,ue_num,status_queue,EPC,)) #special quick and dirty treatment for modules, iperf to be restructured
p.daemon = True if self.ue_id!="":
p.start() p = Process(target = self.Iperf_Module ,args = (lock, UE_IPAddress, device_id, i, ue_num, status_queue, EPC, InfraUE,))
multi_jobs.append(p) else:
i = i + 1 p = Process(target = self.Iperf_common, args = (lock, UE_IPAddress, device_id, i, ue_num, status_queue, EPC, InfraUE,))
p.daemon = True
p.start()
multi_jobs.append(p)
i = i + 1
for job in multi_jobs: for job in multi_jobs:
job.join() job.join()
......
...@@ -40,9 +40,9 @@ import constants as CONST ...@@ -40,9 +40,9 @@ import constants as CONST
import cls_oaicitest #main class for OAI CI test framework import cls_oaicitest #main class for OAI CI test framework
import cls_physim #class PhySim for physical simulators build and test import cls_physim #class PhySim for physical simulators build and test
import cls_cots_ue #class CotsUe for Airplane mode control import cls_cots_ue #class CotsUe for Airplane mode control of various mobile phones
import cls_containerize #class Containerize for all container-based operations on RAN/UE objects import cls_containerize #class Containerize for all container-based operations on RAN/UE objects
import cls_ci_ueinfra #class defining the multi Ue infrastrucure
import sshconnection import sshconnection
import epc import epc
...@@ -192,6 +192,14 @@ def GetParametersFromXML(action): ...@@ -192,6 +192,14 @@ def GetParametersFromXML(action):
else : else :
RAN.air_interface[RAN.eNB_instance] = 'ocp-enb' RAN.air_interface[RAN.eNB_instance] = 'ocp-enb'
elif action == 'Initialize_UE':
ue_id = test.findtext('id')
if (ue_id is None):
CiTestObj.ue_id = ""
else:
CiTestObj.ue_id = ue_id
elif action == 'Attach_UE': elif action == 'Attach_UE':
nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach') nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach')
if (nbMaxUEtoAttach is None): if (nbMaxUEtoAttach is None):
...@@ -252,9 +260,20 @@ def GetParametersFromXML(action): ...@@ -252,9 +260,20 @@ def GetParametersFromXML(action):
elif (action == 'Ping') or (action == 'Ping_CatM_module'): elif (action == 'Ping') or (action == 'Ping_CatM_module'):
CiTestObj.ping_args = test.findtext('ping_args') CiTestObj.ping_args = test.findtext('ping_args')
CiTestObj.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold') CiTestObj.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold')
ue_id = test.findtext('id')
if (ue_id is None):
CiTestObj.ue_id = ""
else:
CiTestObj.ue_id = ue_id
elif action == 'Iperf': elif action == 'Iperf':
CiTestObj.iperf_args = test.findtext('iperf_args') CiTestObj.iperf_args = test.findtext('iperf_args')
ue_id = test.findtext('id')
if (ue_id is None):
CiTestObj.ue_id = ""
else:
CiTestObj.ue_id = ue_id
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):
...@@ -368,6 +387,10 @@ with open(yaml_file,'r') as f: ...@@ -368,6 +387,10 @@ with open(yaml_file,'r') as f:
xml_class_list = yaml.load(f,Loader=yaml.FullLoader) xml_class_list = yaml.load(f,Loader=yaml.FullLoader)
InfraUE=cls_ci_ueinfra.InfraUE() #initialize UE infrastructure class
InfraUE.Get_UE_Infra("ci_ueinfra.yaml") #read the UE infra, filename is hardcoded and unique for the moment but should be passed as parameter from the test suite
mode = '' mode = ''
...@@ -382,7 +405,6 @@ CONTAINERS = cls_containerize.Containerize() ...@@ -382,7 +405,6 @@ CONTAINERS = cls_containerize.Containerize()
ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build
#----------------------------------------------------------- #-----------------------------------------------------------
# Parsing Command Line Arguments # Parsing Command Line Arguments
#----------------------------------------------------------- #-----------------------------------------------------------
...@@ -671,7 +693,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -671,7 +693,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Terminate_eNB': elif action == 'Terminate_eNB':
RAN.TerminateeNB(HTML, EPC) RAN.TerminateeNB(HTML, EPC)
elif action == 'Initialize_UE': elif action == 'Initialize_UE':
CiTestObj.InitializeUE(HTML,COTS_UE) CiTestObj.InitializeUE(HTML,COTS_UE, InfraUE)
elif action == 'Terminate_UE': elif action == 'Terminate_UE':
CiTestObj.TerminateUE(HTML,COTS_UE) CiTestObj.TerminateUE(HTML,COTS_UE)
elif action == 'Attach_UE': elif action == 'Attach_UE':
...@@ -701,9 +723,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -701,9 +723,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Ping_CatM_module': elif action == 'Ping_CatM_module':
CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE,EPC) CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE,EPC)
elif action == 'Ping': elif action == 'Ping':
CiTestObj.Ping(HTML,RAN,EPC,COTS_UE) CiTestObj.Ping(HTML,RAN,EPC,COTS_UE, InfraUE)
elif action == 'Iperf': elif action == 'Iperf':
CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE) CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE, InfraUE)
elif action == 'Reboot_UE': elif action == 'Reboot_UE':
CiTestObj.RebootUE(HTML,RAN,EPC) CiTestObj.RebootUE(HTML,RAN,EPC)
elif action == 'Initialize_HSS': elif action == 'Initialize_HSS':
......
...@@ -239,7 +239,6 @@ class RANManagement(): ...@@ -239,7 +239,6 @@ class RANManagement():
while (count > 0) and buildOAIprocess: while (count > 0) and buildOAIprocess:
mySSH.command('ps aux | grep --color=never build_ | grep -v grep', '\$', 6) mySSH.command('ps aux | grep --color=never build_ | grep -v grep', '\$', 6)
result = re.search('build_oai', mySSH.getBefore()) result = re.search('build_oai', mySSH.getBefore())
print(result)
if result is None: if result is None:
buildOAIprocess = False buildOAIprocess = False
else: else:
......
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