mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
lf_check.py : removed \n from the kernel version , node version ,
GUI build date read from LANforge. Getting data ready to do the software version analysis Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
@@ -211,6 +211,19 @@ class lf_check():
|
|||||||
scripts_git_sha = commit_hash.decode('utf-8','ignore')
|
scripts_git_sha = commit_hash.decode('utf-8','ignore')
|
||||||
return scripts_git_sha
|
return scripts_git_sha
|
||||||
|
|
||||||
|
def get_lanforge_node_version(self):
|
||||||
|
ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router
|
||||||
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key
|
||||||
|
#ssh.connect(self.lf_mgr_ip, port=22, username=self.lf_mgr_user, password=self.lf_mgr_pass, banner_timeout=600)
|
||||||
|
ssh.connect(hostname=self.lf_mgr_ip, port=22, username=self.lf_mgr_user, password=self.lf_mgr_pass, banner_timeout=600)
|
||||||
|
stdin, stdout, stderr = ssh.exec_command('uname -n')
|
||||||
|
lanforge_node_version = stdout.readlines()
|
||||||
|
# print('\n'.join(output))
|
||||||
|
lanforge_node_version =[line.replace('\n','') for line in lanforge_node_version]
|
||||||
|
ssh.close()
|
||||||
|
time.sleep(1)
|
||||||
|
return lanforge_node_version
|
||||||
|
|
||||||
def get_lanforge_kernel_version(self):
|
def get_lanforge_kernel_version(self):
|
||||||
ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router
|
ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router
|
||||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key
|
||||||
@@ -219,6 +232,7 @@ class lf_check():
|
|||||||
stdin, stdout, stderr = ssh.exec_command('uname -r')
|
stdin, stdout, stderr = ssh.exec_command('uname -r')
|
||||||
lanforge_kernel_version = stdout.readlines()
|
lanforge_kernel_version = stdout.readlines()
|
||||||
# print('\n'.join(output))
|
# print('\n'.join(output))
|
||||||
|
lanforge_kernel_version =[line.replace('\n','') for line in lanforge_kernel_version]
|
||||||
ssh.close()
|
ssh.close()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return lanforge_kernel_version
|
return lanforge_kernel_version
|
||||||
@@ -231,6 +245,7 @@ class lf_check():
|
|||||||
stdin, stdout, stderr = ssh.exec_command('./btserver --version | grep Version')
|
stdin, stdout, stderr = ssh.exec_command('./btserver --version | grep Version')
|
||||||
lanforge_gui_version = stdout.readlines()
|
lanforge_gui_version = stdout.readlines()
|
||||||
# print('\n'.join(output))
|
# print('\n'.join(output))
|
||||||
|
lanforge_gui_version =[line.replace('\n','') for line in lanforge_gui_version]
|
||||||
ssh.close()
|
ssh.close()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return lanforge_gui_version
|
return lanforge_gui_version
|
||||||
@@ -1060,6 +1075,7 @@ Example :
|
|||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
# Test-rig information information
|
# Test-rig information information
|
||||||
|
lanforge_node_version = 'NO_LF_NODE_VER'
|
||||||
scripts_git_sha = 'NO_GIT_SHA'
|
scripts_git_sha = 'NO_GIT_SHA'
|
||||||
lanforge_kernel_version = 'NO_KERNEL_VER'
|
lanforge_kernel_version = 'NO_KERNEL_VER'
|
||||||
lanforge_gui_version = 'NO_LF_GUI_VER'
|
lanforge_gui_version = 'NO_LF_GUI_VER'
|
||||||
@@ -1132,6 +1148,12 @@ Example :
|
|||||||
except:
|
except:
|
||||||
print("git_sha read exception ")
|
print("git_sha read exception ")
|
||||||
|
|
||||||
|
try:
|
||||||
|
lanforge_node_version = check.get_lanforge_node_version()
|
||||||
|
print("lanforge_node_version {node_ver}".format(node_node=lanforge_node_version))
|
||||||
|
except:
|
||||||
|
print("lanforge_node_version exception")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lanforge_kernel_version = check.get_lanforge_kernel_version()
|
lanforge_kernel_version = check.get_lanforge_kernel_version()
|
||||||
print("lanforge_kernel_version {kernel_ver}".format(kernel_ver=lanforge_kernel_version))
|
print("lanforge_kernel_version {kernel_ver}".format(kernel_ver=lanforge_kernel_version))
|
||||||
@@ -1146,7 +1168,7 @@ Example :
|
|||||||
|
|
||||||
# LANforge and scripts config
|
# LANforge and scripts config
|
||||||
lf_test_setup = pd.DataFrame({
|
lf_test_setup = pd.DataFrame({
|
||||||
'LANforge Config': [""],
|
'LANforge': lanforge_node_version,
|
||||||
'kernel version': lanforge_kernel_version,
|
'kernel version': lanforge_kernel_version,
|
||||||
'GUI version': lanforge_gui_version,
|
'GUI version': lanforge_gui_version,
|
||||||
'scripts git sha': scripts_git_sha
|
'scripts git sha': scripts_git_sha
|
||||||
@@ -1158,12 +1180,14 @@ Example :
|
|||||||
report.start_content_div2()
|
report.start_content_div2()
|
||||||
report.set_obj_html("Objective","Run QA Tests")
|
report.set_obj_html("Objective","Run QA Tests")
|
||||||
report.build_objective()
|
report.build_objective()
|
||||||
|
report.set_text("LANforge")
|
||||||
|
report.build_text()
|
||||||
report.set_table_dataframe(lf_test_setup)
|
report.set_table_dataframe(lf_test_setup)
|
||||||
report.build_table()
|
report.build_table()
|
||||||
report.set_table_title("LF Check Test Results")
|
report.set_table_title("LF Check Test Results")
|
||||||
report.build_table_title()
|
report.build_table_title()
|
||||||
report.set_text("lanforge-scripts git sha: {}".format(git_sha))
|
# report.set_text("lanforge-scripts git sha: {}".format(git_sha))
|
||||||
report.build_text()
|
# report.build_text()
|
||||||
html_results = check.get_html_results()
|
html_results = check.get_html_results()
|
||||||
report.set_custom_html(html_results)
|
report.set_custom_html(html_results)
|
||||||
report.build_custom()
|
report.build_custom()
|
||||||
|
|||||||
Reference in New Issue
Block a user