Commit 8def7528 authored by hardy's avatar hardy

adding module UE detach, to be tested

parent 756ab7ab
......@@ -78,6 +78,7 @@ class Module_UE:
logging.debug(self.Process + " process NOT found")
return False
#Wakeup/Detach can probably be improved with encapsulation of the command such def Command(self, command)
#this method wakes up the module by calling the specified python script
def WakeUp(self):
mySSH = sshconnection.SSHConnection()
......@@ -87,6 +88,15 @@ class Module_UE:
logging.debug("Module wake-up")
mySSH.close()
#this method detaches the module by calling the specified python script
def Detach(self):
mySSH = sshconnection.SSHConnection()
mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
mySSH.command('echo ' + self.HostPassword + ' | sudo -S python3 ' + self.DetachScript + ' ','\$',5)
time.sleep(5)
logging.debug("Module detach")
mySSH.close()
#this method retrieves the Module IP address (not the Host IP address)
def GetModuleIPAddress(self):
HOST=self.HostIPAddress
......
......@@ -392,7 +392,7 @@ class OaiCiTest():
Module_UE.GetModuleIPAddress()
HTML.CreateHtmlTestRow(Module_UE.UEIPAddress, 'OK', CONST.ALL_PROCESSES_OK)
self.UEIPAddresses.append(Module_UE.UEIPAddress)
logging.debug(self.UEIPAddresses)
logging.debug('UEs IP addresses : '+ self.UEIPAddresses)
def InitializeOAIUE(self,HTML,RAN,EPC,COTS_UE):
if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '':
......@@ -957,7 +957,8 @@ class OaiCiTest():
except:
os.kill(os.getppid(),signal.SIGUSR1)
def AttachUE(self,HTML,RAN,EPC,COTS_UE):
def AttachUE(self,HTML,RAN,EPC,COTS_UE,InfraUE):
if self.ue_id=='':#no ID specified, then it is a COTS controlled by ADB
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
......@@ -1039,6 +1040,7 @@ class OaiCiTest():
os.kill(os.getppid(),signal.SIGUSR1)
def DetachUE(self,HTML,RAN,EPC,COTS_UE):
if self.ue_id=='':#no ID specified, then it is a COTS controlled by ADB
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
......@@ -1069,6 +1071,13 @@ class OaiCiTest():
while cnt < len(self.UEDevices):
self.UEDevicesStatus[cnt] = CONST.UE_STATUS_DETACHED
cnt += 1
else:#if an ID is specified, it is a module from the yaml infrastructure file
Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id])
is_module=Module_UE.CheckIsModule()
if is_module:
Module_UE.Detach()
Module_UE.GetModuleIPAddress()
HTML.CreateHtmlTestRow(Module_UE.UEIPAddress, 'OK', CONST.ALL_PROCESSES_OK)
def RebootUE_common(self, device_id):
try:
......
......@@ -200,6 +200,12 @@ def GetParametersFromXML(action):
else:
CiTestObj.ue_id = ue_id
elif action == 'Detach_UE':
ue_id = test.findtext('id')
if (ue_id is None):
CiTestObj.ue_id = ""
else:
CiTestObj.ue_id = ue_id
elif action == 'Attach_UE':
nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach')
......
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