Commit 29618c5e authored by Raphael Defosseux's avatar Raphael Defosseux

CI: fix autoterminate with multiple servers

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 708f34ee
......@@ -2909,7 +2909,7 @@ class OaiCiTest():
self.ShowTestID()
#terminate all RAN nodes eNB/gNB/OCP
for instance in range(0, len(RAN.air_interface)):
if RAN.air_interface[instance]!=''
if RAN.air_interface[instance]!='':
logging.debug('Auto Termination of Instance ' + str(instance) + ' : ' + RAN.air_interface[instance])
RAN.eNB_instance=instance
RAN.TerminateeNB()
......
......@@ -113,9 +113,11 @@ def GetParametersFromXML(action):
RAN.eNB_instance=0
else:
RAN.eNB_instance=int(eNB_instance)
RAN.eNB_serverId=test.findtext('eNB_serverId')
if (RAN.eNB_serverId is None):
RAN.eNB_serverId='0'
eNB_serverId=test.findtext('eNB_serverId')
if (eNB_serverId is None):
RAN.eNB_serverId[RAN.eNB_instance]='0'
else:
RAN.eNB_serverId[RAN.eNB_instance]=eNB_serverId
xmlBgBuildField = test.findtext('backgroundBuild')
if (xmlBgBuildField is None):
RAN.backgroundBuild=False
......@@ -132,9 +134,11 @@ def GetParametersFromXML(action):
RAN.eNB_instance=0
else:
RAN.eNB_instance=int(eNB_instance)
RAN.eNB_serverId=test.findtext('eNB_serverId')
if (RAN.eNB_serverId is None):
RAN.eNB_serverId='0'
eNB_serverId=test.findtext('eNB_serverId')
if (eNB_serverId is None):
RAN.eNB_serverId[RAN.eNB_instance]='0'
else:
RAN.eNB_serverId[RAN.eNB_instance]=eNB_serverId
elif action == 'Initialize_eNB':
RAN.Initialize_eNB_args=test.findtext('Initialize_eNB_args')
......@@ -143,9 +147,11 @@ def GetParametersFromXML(action):
RAN.eNB_instance=0
else:
RAN.eNB_instance=int(eNB_instance)
RAN.eNB_serverId=test.findtext('eNB_serverId')
if (RAN.eNB_serverId is None):
RAN.eNB_serverId='0'
eNB_serverId=test.findtext('eNB_serverId')
if (eNB_serverId is None):
RAN.eNB_serverId[RAN.eNB_instance]='0'
else:
RAN.eNB_serverId[RAN.eNB_instance]=eNB_serverId
#local variable air_interface
air_interface = test.findtext('air_interface')
......@@ -162,10 +168,12 @@ def GetParametersFromXML(action):
RAN.eNB_instance=0
else:
RAN.eNB_instance=int(eNB_instance)
RAN.eNB_serverId=test.findtext('eNB_serverId')
if (RAN.eNB_serverId is None):
RAN.eNB_serverId='0'
eNB_serverId=test.findtext('eNB_serverId')
if (eNB_serverId is None):
RAN.eNB_serverId[RAN.eNB_instance]='0'
else:
RAN.eNB_serverId[RAN.eNB_instance]=eNB_serverId
#local variable air_interface
air_interface = test.findtext('air_interface')
if (air_interface is None) or (air_interface.lower() not in ['nr','lte','ocp']):
......@@ -383,8 +391,8 @@ if re.match('^TerminateeNB$', mode, re.IGNORECASE):
if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
RAN.eNB_serverId='0'
RAN.eNB_instance=0
RAN.eNB_serverId[0]='0'
RAN.eNBSourceCodePath='/tmp/'
RAN.TerminateeNB()
elif re.match('^TerminateUE$', mode, re.IGNORECASE):
......
......@@ -79,7 +79,7 @@ class RANManagement():
self.Initialize_eNB_args = ''
self.air_interface = ['', '', ''] #changed from 'lte' to '' may lead to side effects in main
self.eNB_instance = 0
self.eNB_serverId = ''
self.eNB_serverId = ['', '', '']
self.eNBLogFiles = ['', '', '']
self.eNBOptions = ['', '', '']
self.eNBmbmsEnables = [False, False, False]
......@@ -102,17 +102,17 @@ class RANManagement():
if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
if self.eNB_serverId == '0':
if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName
lPassWord = self.eNBPassword
lSourcePath = self.eNBSourceCodePath
elif self.eNB_serverId == '1':
elif self.eNB_serverId[self.eNB_instance] == '1':
lIpAddr = self.eNB1IPAddress
lUserName = self.eNB1UserName
lPassWord = self.eNB1Password
lSourcePath = self.eNB1SourceCodePath
elif self.eNB_serverId == '2':
elif self.eNB_serverId[self.eNB_instance] == '2':
lIpAddr = self.eNB2IPAddress
lUserName = self.eNB2UserName
lPassWord = self.eNB2Password
......@@ -120,6 +120,7 @@ class RANManagement():
if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
logging.debug('Building on server: ' + lIpAddr)
mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord)
......@@ -218,17 +219,17 @@ class RANManagement():
self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.testCase_id)
def WaitBuildeNBisFinished(self):
if self.eNB_serverId == '0':
if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName
lPassWord = self.eNBPassword
lSourcePath = self.eNBSourceCodePath
elif self.eNB_serverId == '1':
elif self.eNB_serverId[self.eNB_instance] == '1':
lIpAddr = self.eNB1IPAddress
lUserName = self.eNB1UserName
lPassWord = self.eNB1Password
lSourcePath = self.eNB1SourceCodePath
elif self.eNB_serverId == '2':
elif self.eNB_serverId[self.eNB_instance] == '2':
lIpAddr = self.eNB2IPAddress
lUserName = self.eNB2UserName
lPassWord = self.eNB2Password
......@@ -236,6 +237,7 @@ class RANManagement():
if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
logging.debug('Waiting for end of build on server: ' + lIpAddr)
mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord)
count = 40
......@@ -284,7 +286,7 @@ class RANManagement():
mySSH.command('mkdir -p build_log_' + testcaseId, '\$', 5)
mySSH.command('mv log/* ' + 'build_log_' + testcaseId, '\$', 5)
mySSH.command('mv compile_oai_enb.log ' + 'build_log_' + testcaseId, '\$', 5)
if self.eNB_serverId != '0':
if self.eNB_serverId[self.eNB_instance] != '0':
mySSH.command('cd cmake_targets', '\$', 5)
mySSH.command('if [ -e tmp_build' + testcaseId + '.zip ]; then rm -f tmp_build' + testcaseId + '.zip; fi', '\$', 5)
mySSH.command('zip -r -qq tmp_build' + testcaseId + '.zip build_log_' + testcaseId, '\$', 5)
......@@ -317,17 +319,17 @@ class RANManagement():
sys.exit(1)
def InitializeeNB(self):
if self.eNB_serverId == '0':
if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName
lPassWord = self.eNBPassword
lSourcePath = self.eNBSourceCodePath
elif self.eNB_serverId == '1':
elif self.eNB_serverId[self.eNB_instance] == '1':
lIpAddr = self.eNB1IPAddress
lUserName = self.eNB1UserName
lPassWord = self.eNB1Password
lSourcePath = self.eNB1SourceCodePath
elif self.eNB_serverId == '2':
elif self.eNB_serverId[self.eNB_instance] == '2':
lIpAddr = self.eNB2IPAddress
lUserName = self.eNB2UserName
lPassWord = self.eNB2Password
......@@ -335,6 +337,7 @@ class RANManagement():
if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
logging.debug('Starting eNB/gNB on server: ' + lIpAddr)
if self.htmlObj is not None:
self.testCase_id = self.htmlObj.testCase_id
......@@ -507,7 +510,7 @@ class RANManagement():
else:
logging.error('\u001B[1m oaitun_enm1 interface is either NOT mounted or NOT configured\u001B[0m')
if enbDidSync:
self.eNBstatuses[int(self.eNB_instance)] = int(self.eNB_serverId)
self.eNBstatuses[int(self.eNB_instance)] = int(self.eNB_serverId[self.eNB_instance])
mySSH.close()
if self.htmlObj is not None:
......@@ -547,17 +550,17 @@ class RANManagement():
os.kill(os.getppid(),signal.SIGUSR1)
def TerminateeNB(self):
if self.eNB_serverId == '0':
if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName
lPassWord = self.eNBPassword
lSourcePath = self.eNBSourceCodePath
elif self.eNB_serverId == '1':
elif self.eNB_serverId[self.eNB_instance] == '1':
lIpAddr = self.eNB1IPAddress
lUserName = self.eNB1UserName
lPassWord = self.eNB1Password
lSourcePath = self.eNB1SourceCodePath
elif self.eNB_serverId == '2':
elif self.eNB_serverId[self.eNB_instance] == '2':
lIpAddr = self.eNB2IPAddress
lUserName = self.eNB2UserName
lPassWord = self.eNB2Password
......@@ -565,6 +568,7 @@ class RANManagement():
if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
logging.debug('Stopping eNB/gNB on server: ' + lIpAddr)
mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord)
mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5)
......@@ -632,7 +636,7 @@ class RANManagement():
self.htmlObj.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
self.eNBmbmsEnables[int(self.eNB_instance)] = False
return
if self.eNB_serverId != '0':
if self.eNB_serverId[self.eNB_instance] != '0':
mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + fileToAnalyze, self.eNBSourceCodePath + '/cmake_targets/')
logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + fileToAnalyze)
logStatus = self.AnalyzeLogFile_eNB(fileToAnalyze)
......
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