CI UE Attach: add more frequent checks, improve output
check for IP once before sleeping in case UE IP address exists, which should speed up the CI. With this, Only print the actual attach command once. Print errors only at the beginning. This should simplify attach command output logs.
This commit is contained in:
@@ -70,11 +70,11 @@ class Module_UE:
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.__str__()
|
return self.__str__()
|
||||||
|
|
||||||
def _command(self, cmd, silent = False):
|
def _command(self, cmd, silent=False, reportNonZero=True):
|
||||||
if cmd is None:
|
if cmd is None:
|
||||||
raise Exception("no command provided")
|
raise Exception("no command provided")
|
||||||
with cls_cmd.getConnection(self.host) as c:
|
with cls_cmd.getConnection(self.host) as c:
|
||||||
response = c.run(cmd, silent=silent)
|
response = c.run(cmd, silent=silent, reportNonZero=reportNonZero)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
#-----------------$
|
#-----------------$
|
||||||
@@ -109,10 +109,11 @@ class Module_UE:
|
|||||||
self._command(self.cmd_dict["attach"])
|
self._command(self.cmd_dict["attach"])
|
||||||
timeout = attach_timeout
|
timeout = attach_timeout
|
||||||
logging.debug("Waiting for IP address to be assigned")
|
logging.debug("Waiting for IP address to be assigned")
|
||||||
|
ip = self.getIP(silent=False, reportNonZero=True)
|
||||||
while timeout > 0 and not ip:
|
while timeout > 0 and not ip:
|
||||||
time.sleep(5)
|
time.sleep(1)
|
||||||
timeout -= 5
|
timeout -= 1
|
||||||
ip = self.getIP()
|
ip = self.getIP(silent=True, reportNonZero=False)
|
||||||
if ip:
|
if ip:
|
||||||
break
|
break
|
||||||
logging.warning(f"UE did not receive IP address after {attach_timeout} s, detaching")
|
logging.warning(f"UE did not receive IP address after {attach_timeout} s, detaching")
|
||||||
@@ -156,8 +157,8 @@ class Module_UE:
|
|||||||
logging.error(message)
|
logging.error(message)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getIP(self):
|
def getIP(self, silent=True, reportNonZero=True):
|
||||||
output = self._command(self.cmd_dict["getNetwork"], silent=True)
|
output = self._command(self.cmd_dict["getNetwork"], silent=silent, reportNonZero=reportNonZero)
|
||||||
result = re.search(r'inet (?P<ip>[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', output.stdout)
|
result = re.search(r'inet (?P<ip>[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', output.stdout)
|
||||||
if result and result.group('ip'):
|
if result and result.group('ip'):
|
||||||
ip = result.group('ip')
|
ip = result.group('ip')
|
||||||
|
|||||||
Reference in New Issue
Block a user