Commit 4c4cbc96 authored by Raphael Defosseux's avatar Raphael Defosseux

fix(ci): little fixes after migration to new infra:

 - Better mechanism for qlog cleaning
 - Faster attachment check
 - html.py is confusing for some python3 installation -- renaming it
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent b8ac9d5d
......@@ -64,10 +64,10 @@ class Log_Mgt:
if m is not None:
return int(m.group(1))
def __RemoveOldest(self):
def __RemoveOldest(self, days):
mySSH = sshconnection.SSHConnection()
mySSH.open(self.IPAddress, self.Username, self.Password)
COMMAND='echo ' + self.Password + ' | sudo -S find ' + self.path + ' -type f -mtime +14 -delete'
COMMAND='echo ' + self.Password + ' | sudo -S find ' + self.path + ' -type f -mtime +' + str(days) + ' -delete'
mySSH.command(COMMAND,'\$',20)
mySSH.close()
......@@ -79,13 +79,18 @@ class Log_Mgt:
def LogRotation(self):
used_space = self.__CheckUsedSpace() #avail space in target folder
if used_space > 80 :
logging.debug('\u001B[1;37;41m Used Disk > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m')
logging.debug('\u001B[1;37;41m Removing Artifacts older than 14 days \u001B[0m')
self.__RemoveOldest()
else:
logging.debug('Used Disk < 80%, on ' + self.Username+'@'+self.IPAddress +', no cleaning required')
doLoop = True
nbDays = 14
while doLoop and nbDays > 2:
used_space = self.__CheckUsedSpace() #avail space in target folder
if used_space > 80 :
logging.debug('\u001B[1;37;41m Used Disk (' + str(used_space) + '%) > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m')
logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + nbDays + ' days \u001B[0m')
self.__RemoveOldest(nbDays)
nbDays -= 1
else:
logging.debug('Used Disk (' + str(used_space) + '%) < 80%, on ' + self.Username+'@'+self.IPAddress +', no cleaning required')
doLoop = False
......
......@@ -107,14 +107,15 @@ class Module_UE:
def GetModuleIPAddress(self):
HOST=self.HostUsername+'@'+self.HostIPAddress
response= []
tentative = 3
tentative = 8
while (len(response)==0) and (tentative>0):
COMMAND="ip a show dev " + self.UENetwork + " | grep --colour=never inet | grep " + self.UENetwork
logging.debug(COMMAND)
if tentative == 8:
logging.debug(COMMAND)
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
response = ssh.stdout.readlines()
tentative-=1
time.sleep(10)
time.sleep(2)
if (tentative==0) and (len(response)==0):
logging.debug('\u001B[1;37;41m Module IP Address Not Found! Time expired \u001B[0m')
return -1
......
......@@ -439,7 +439,7 @@ class OaiCiTest():
while cnt < 4:
Module_UE.Command("wup")
logging.debug("Waiting for IP address to be assigned")
time.sleep(20)
time.sleep(5)
logging.debug("Retrieve IP address")
status=Module_UE.GetModuleIPAddress()
if status==0:
......@@ -1111,7 +1111,7 @@ class OaiCiTest():
while cnt < 4:
Module_UE.Command("wup")
logging.debug("Waiting for IP address to be assigned")
time.sleep(20)
time.sleep(5)
logging.debug("Retrieve IP address")
status=Module_UE.GetModuleIPAddress()
if status==0:
......
......@@ -32,7 +32,7 @@ import logging
#to create a SSH object locally in the methods
import sshconnection
#to update the HTML object
import html
import cls_oai_html
from multiprocessing import SimpleQueue
#for log folder maintenance
import os
......
......@@ -33,7 +33,7 @@
#-----------------------------------------------------------
import logging
import sshconnection as SSH
import html
import cls_oai_html
import os
import re
import time
......
......@@ -49,7 +49,7 @@ import cls_physim1 #class PhySim for physical simulators deploy and run
import sshconnection
import epc
import ran
import html
import cls_oai_html
#-----------------------------------------------------------
......@@ -518,7 +518,7 @@ CiTestObj = cls_oaicitest.OaiCiTest()
SSH = sshconnection.SSHConnection()
EPC = epc.EPCManagement()
RAN = ran.RANManagement()
HTML = html.HTMLManagement()
HTML = cls_oai_html.HTMLManagement()
CONTAINERS = cls_containerize.Containerize()
SCA = cls_static_code_analysis.StaticCodeAnalysis()
PHYSIM = cls_physim1.PhySim()
......
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