Commit 171530c0 authored by Robert Schmidt's avatar Robert Schmidt

cls_oaicitest.py: use new cls_cmd.getConnection() instead of old SSHconnection class

It is clearer in CI logs to use absolute paths, and that is also a
"preference" of the new SSH class (cls_cmd.py) in the sense that some
functions don't handle "cd" gracefully (because of underlying Python
library paramiko).

For zip, though, we should change to have nice relative paths in the
archives, so use cd <path> && zip ... to achieve that, instead of
changing to a directory. This way, the path on which we operate is still
visible in the logs in each line.
......@@ -43,7 +43,6 @@ import json
#import our libs
import helpreadme as HELP
import constants as CONST
import sshconnection
import cls_module
import cls_cmd
......@@ -895,55 +894,43 @@ class OaiCiTest():
SourceCodePath = self.UESourceCodePath
else:
sys.exit('Insufficient Parameter')
SSH = sshconnection.SSHConnection()
SSH.open(IPAddress, UserName, Password)
SSH.command(f'cd {SourceCodePath}', '\$', 5)
SSH.command('cd cmake_targets', '\$', 5)
SSH.command('rm -f build.log.zip', '\$', 5)
SSH.command('zip -r build.log.zip build_log_*/*', '\$', 60)
SSH.close()
with cls_cmd.getConnection(IPAddress) as cmd:
d = f'{SourceCodePath}/cmake_targets'
cmd.run(f'rm -f {d}/build.log.zip')
cmd.run(f'cd {d} && zip -r build.log.zip build_log_*/*')
def LogCollectPing(self,EPC):
# Some pipelines are using "none" IP / Credentials
# In that case, just forget about it
if EPC.IPAddress == 'none':
sys.exit(0)
SSH = sshconnection.SSHConnection()
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
SSH.command(f'cd {EPC.SourceCodePath}', '\$', 5)
SSH.command('cd scripts', '\$', 5)
SSH.command('rm -f ping.log.zip', '\$', 5)
SSH.command('zip ping.log.zip ping*.log', '\$', 60)
SSH.command('rm ping*.log', '\$', 5)
SSH.close()
with cls_cmd.getConnection(EPC.IPAddress) as cmd:
d = f"{EPC.SourceCodePath}/scripts"
cmd.run(f'rm -f {d}/ping.log.zip')
cmd.run(f'cd {d} && zip ping.log.zip ping*.log')
cmd.run(f'rm {d}/ping*.log')
def LogCollectIperf(self,EPC):
# Some pipelines are using "none" IP / Credentials
# In that case, just forget about it
if EPC.IPAddress == 'none':
sys.exit(0)
SSH = sshconnection.SSHConnection()
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
SSH.command(f'cd {EPC.SourceCodePath}', '\$', 5)
SSH.command('cd scripts', '\$', 5)
SSH.command('rm -f iperf.log.zip', '\$', 5)
SSH.command('zip iperf.log.zip iperf*.log', '\$', 60)
SSH.command('rm iperf*.log', '\$', 5)
SSH.close()
with cls_cmd.getConnection(EPC.IPAddress) as cmd:
d = f"{EPC.SourceCodePath}/scripts"
cmd.run(f'rm -f {d}/iperf.log.zip')
cmd.run(f'cd {d} && zip iperf.log.zip iperf*.log')
cmd.run(f'rm {d}/iperf*.log')
def LogCollectOAIUE(self):
# Some pipelines are using "none" IP / Credentials
# In that case, just forget about it
if self.UEIPAddress == 'none':
sys.exit(0)
SSH = sshconnection.SSHConnection()
SSH.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
SSH.command(f'cd {self.UESourceCodePath}', '\$', 5)
SSH.command(f'cd cmake_targets', '\$', 5)
SSH.command(f'echo {self.UEPassword} | sudo -S rm -f ue.log.zip', '\$', 5)
SSH.command(f'echo {self.UEPassword} | sudo -S zip ue.log.zip ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 60)
SSH.command(f'echo {self.UEPassword} | sudo -S rm ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 5)
SSH.close()
with cls_cmd.getConnection(self.UEIPAddress) as cmd:
d = f'{self.UESourceCodePath}/cmake_targets'
cmd.run(f'echo {self.UEPassword} | sudo -S rm -f {d}/ue.log.zip')
cmd.run(f'cd {d} && echo {self.UEPassword} | sudo -S zip ue.log.zip ue*.log core* ue_*record.raw ue_*.pcap ue_*txt')
cmd.run(f'echo {self.UEPassword} | sudo -S rm {d}/ue*.log {d}/core* {d}/ue_*record.raw {d}/ue_*.pcap {d}/ue_*txt')
def ShowTestID(self):
logging.info(f'\u001B[1m----------------------------------------\u001B[0m')
......
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