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