mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 03:37:55 +00:00
Mostly Ghost table fixes
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -255,6 +255,7 @@ class GhostRequest:
|
|||||||
grafana_host,
|
grafana_host,
|
||||||
grafanajson_port=grafana_port
|
grafanajson_port=grafana_port
|
||||||
)
|
)
|
||||||
|
if self.debug:
|
||||||
print('Folders: %s' % folders)
|
print('Folders: %s' % folders)
|
||||||
|
|
||||||
ssh_push = paramiko.SSHClient()
|
ssh_push = paramiko.SSHClient()
|
||||||
@@ -280,6 +281,7 @@ class GhostRequest:
|
|||||||
print('Target folders: %s' % target_folders)
|
print('Target folders: %s' % target_folders)
|
||||||
else:
|
else:
|
||||||
for folder in folders:
|
for folder in folders:
|
||||||
|
if self.debug:
|
||||||
print(folder)
|
print(folder)
|
||||||
target_folders.append(folder)
|
target_folders.append(folder)
|
||||||
|
|
||||||
@@ -304,7 +306,7 @@ class GhostRequest:
|
|||||||
dut_serial = csvreader.get_column(df, 'dut-serial-num')[0]
|
dut_serial = csvreader.get_column(df, 'dut-serial-num')[0]
|
||||||
times_append = csvreader.get_column(df, 'Date')
|
times_append = csvreader.get_column(df, 'Date')
|
||||||
for target_time in times_append:
|
for target_time in times_append:
|
||||||
times.append(float(target_time)/1000)
|
times.append(float(target_time) / 1000)
|
||||||
if pass_fail['PASS'] + pass_fail['FAIL'] > 0:
|
if pass_fail['PASS'] + pass_fail['FAIL'] > 0:
|
||||||
text = text + 'Tests passed: %s<br />' % pass_fail['PASS']
|
text = text + 'Tests passed: %s<br />' % pass_fail['PASS']
|
||||||
text = text + 'Tests failed: %s<br />' % pass_fail['FAIL']
|
text = text + 'Tests failed: %s<br />' % pass_fail['FAIL']
|
||||||
@@ -347,9 +349,10 @@ class GhostRequest:
|
|||||||
images.append('<img src="%s"></img>' % image)
|
images.append('<img src="%s"></img>' % image)
|
||||||
self.images = []
|
self.images = []
|
||||||
|
|
||||||
results = csvreader.get_columns(df, ['short-description', 'numeric-score', 'test details', 'test-priority'])
|
results = csvreader.get_columns(df, ['short-description', 'numeric-score', 'test details', 'pass/fail',
|
||||||
|
'test-priority'])
|
||||||
|
|
||||||
results[0] = ['Short Description', 'Score', 'Test Details', 'test-priority']
|
results[0] = ['Short Description', 'Score', 'Test Details', 'Pass or Fail', 'test-priority']
|
||||||
|
|
||||||
low_priority = csvreader.filter_df(results, 'test-priority', 'less than', 94)
|
low_priority = csvreader.filter_df(results, 'test-priority', 'less than', 94)
|
||||||
high_priority = csvreader.filter_df(results, 'test-priority', 'greater than or equal to', 95)
|
high_priority = csvreader.filter_df(results, 'test-priority', 'greater than or equal to', 95)
|
||||||
@@ -359,6 +362,8 @@ class GhostRequest:
|
|||||||
|
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
|
|
||||||
|
test_pass_fail_results = sum((Counter(test) for test in test_pass_fail), Counter())
|
||||||
|
|
||||||
end_time = max(times)
|
end_time = max(times)
|
||||||
start_time = '2021-07-01'
|
start_time = '2021-07-01'
|
||||||
end_time = datetime.utcfromtimestamp(end_time).strftime('%Y-%m-%d %H:%M:%S')
|
end_time = datetime.utcfromtimestamp(end_time).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
@@ -366,8 +371,12 @@ class GhostRequest:
|
|||||||
high_priority = csvreader.concat(high_priority_list)
|
high_priority = csvreader.concat(high_priority_list)
|
||||||
low_priority = csvreader.concat(low_priority_list)
|
low_priority = csvreader.concat(low_priority_list)
|
||||||
|
|
||||||
high_priority = csvreader.get_columns(high_priority, ['Short Description', 'Score', 'Test Details'])
|
high_priority = csvreader.get_columns(high_priority,
|
||||||
low_priority = csvreader.get_columns(low_priority, ['Short Description', 'Score', 'Test Details'])
|
['Short Description', 'Score', 'Test Details'])
|
||||||
|
low_priority = csvreader.get_columns(low_priority,
|
||||||
|
['Short Description', 'Score', 'Test Details'])
|
||||||
|
high_priority.append(['Total Passed', test_pass_fail_results['PASS'], 'Total subtests passed during this run'])
|
||||||
|
high_priority.append(['Total Failed', test_pass_fail_results['FAIL'], 'Total subtests failed during this run'])
|
||||||
|
|
||||||
if title is None:
|
if title is None:
|
||||||
title = now.strftime('%B %d, %Y %I:%M %p report')
|
title = now.strftime('%B %d, %Y %I:%M %p report')
|
||||||
@@ -387,35 +396,36 @@ class GhostRequest:
|
|||||||
pass_fail='GhostRequest',
|
pass_fail='GhostRequest',
|
||||||
testbed=testbeds[0])
|
testbed=testbeds[0])
|
||||||
|
|
||||||
|
|
||||||
test_pass_fail_results = sum((Counter(test) for test in test_pass_fail), Counter())
|
|
||||||
if self.influx_token is not None:
|
if self.influx_token is not None:
|
||||||
influxdb = RecordInflux(_influx_host=self.influx_host,
|
influxdb = RecordInflux(_influx_host=self.influx_host,
|
||||||
_influx_port=self.influx_port,
|
_influx_port=self.influx_port,
|
||||||
_influx_org=self.influx_org,
|
_influx_org=self.influx_org,
|
||||||
_influx_token=self.influx_token,
|
_influx_token=self.influx_token,
|
||||||
_influx_bucket=self.influx_bucket)
|
_influx_bucket=self.influx_bucket)
|
||||||
short_description = 'Ghost Post Tests passed'#variable name
|
short_description = 'Ghost Post Tests passed' # variable name
|
||||||
numeric_score = test_pass_fail_results['PASS'] #value
|
numeric_score = test_pass_fail_results['PASS'] # value
|
||||||
tags = dict()
|
tags = dict()
|
||||||
|
print(datetime.utcfromtimestamp(max(times)))
|
||||||
tags['testbed'] = testbeds[0]
|
tags['testbed'] = testbeds[0]
|
||||||
tags['script'] = 'GhostRequest'
|
tags['script'] = 'GhostRequest'
|
||||||
tags['Graph-Group'] = 'PASS'
|
tags['Graph-Group'] = 'PASS'
|
||||||
date = now.astimezone().isoformat() #date
|
date = datetime.utcfromtimestamp(max(times)).isoformat()
|
||||||
influxdb.post_to_influx(short_description, numeric_score, tags, date)
|
influxdb.post_to_influx(short_description, numeric_score, tags, date)
|
||||||
|
|
||||||
short_description = 'Ghost Post Tests failed'#variable name
|
short_description = 'Ghost Post Tests failed' # variable name
|
||||||
numeric_score = test_pass_fail_results['FAIL'] #value
|
numeric_score = test_pass_fail_results['FAIL'] # value
|
||||||
tags = dict()
|
tags = dict()
|
||||||
tags['testbed'] = testbeds[0]
|
tags['testbed'] = testbeds[0]
|
||||||
tags['script'] = 'GhostRequest'
|
tags['script'] = 'GhostRequest'
|
||||||
tags['Graph-Group'] = 'FAIL'
|
tags['Graph-Group'] = 'FAIL'
|
||||||
date = now.astimezone().isoformat() #date
|
date = datetime.utcfromtimestamp(max(times)).isoformat()
|
||||||
influxdb.post_to_influx(short_description, numeric_score, tags, date)
|
influxdb.post_to_influx(short_description, numeric_score, tags, date)
|
||||||
|
|
||||||
text = 'Testbed: %s<br />' % testbeds[0]
|
text = 'Testbed: %s<br />' % testbeds[0]
|
||||||
dut_table = '<table><tr><td>DUT_HW</td><td>DUT_SW</td><td>DUT model</td><td>DUT Serial</td><td>Tests passed</td><td>Tests failed</td></tr>' \
|
dut_table = '<table><tr><td>DUT_HW</td><td>DUT_SW</td><td>DUT model</td><td>DUT Serial</td><td>Tests passed</td><td>Tests failed</td></tr>' \
|
||||||
'<tr><td style="white-space:nowrap">%s</td><td style="white-space:nowrap">%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr></table>' % (dut_hw, dut_sw, dut_model, dut_serial, test_pass_fail_results['PASS'], test_pass_fail_results['FAIL'])
|
'<tr><td style="white-space:nowrap">%s</td><td style="white-space:nowrap">%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr></table>' % (
|
||||||
|
dut_hw, dut_sw, dut_model, dut_serial, test_pass_fail_results['PASS'],
|
||||||
|
test_pass_fail_results['FAIL'])
|
||||||
text = text + dut_table
|
text = text + dut_table
|
||||||
|
|
||||||
for pdf in pdfs:
|
for pdf in pdfs:
|
||||||
@@ -442,4 +452,3 @@ class GhostRequest:
|
|||||||
text=text,
|
text=text,
|
||||||
tags='custom',
|
tags='custom',
|
||||||
authors=authors)
|
authors=authors)
|
||||||
|
|
||||||
|
|||||||
@@ -320,6 +320,10 @@ class GrafanaRequest:
|
|||||||
panel['title'] = scriptname + ' ' + graph_group
|
panel['title'] = scriptname + ' ' + graph_group
|
||||||
else:
|
else:
|
||||||
panel['title'] = scriptname
|
panel['title'] = scriptname
|
||||||
|
if 'PASS' in panel['title']:
|
||||||
|
panel['title'] = 'Total Passed'
|
||||||
|
if 'FAIL' in panel['title']:
|
||||||
|
panel['title'] = 'Total Failed'
|
||||||
panel['transformations'] = list()
|
panel['transformations'] = list()
|
||||||
panel['transformations'].append(transformation)
|
panel['transformations'].append(transformation)
|
||||||
panel['type'] = "graph"
|
panel['type'] = "graph"
|
||||||
|
|||||||
Reference in New Issue
Block a user