diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index 905a105512213e0c8ad80e450931d2dd43de99c8..e29e9168b70cfcbbf2c85a8ecf25842d538882f1 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -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 diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index fb107007980d53059da297e06bcb396a80922480..dcf75a34fcd616a111cc3c98fc25f1e9281706dd 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -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 diff --git a/ci-scripts/html.py b/ci-scripts/cls_oai_html.py similarity index 100% rename from ci-scripts/html.py rename to ci-scripts/cls_oai_html.py diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 33910f1f9bd5dbe8ebe0e025d1745c9a3d61baba..9d5ae840387e4e9d12ba33352e913167fd1ce4c4 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -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: diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index 33792f6ca4cb2c57f6179c1460ef43f3d2b0d183..ecd8f63af121561c3d004b2f2a0bef9443b71bf4 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -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 diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 54329790cd92eb7c1cfc00ff4ccf8b35d6ff88f3..3907fc2a34d3364225f0c9534b1350cb0dbcd4f4 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -33,7 +33,7 @@ #----------------------------------------------------------- import logging import sshconnection as SSH -import html +import cls_oai_html import os import re import time diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 65f9fbb0daf306fbb27d3ad5e90725901c2ef329..03947bdfc968c83f83eed43a6f0ab05212b6c218 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -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()