Skip to content

Commit

Permalink
Fix portstat parser to accomodate new reminder message portstat output (
Browse files Browse the repository at this point in the history
#7537)

Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
  • Loading branch information
SuvarnaMeenakshi authored and wangxin committed Feb 23, 2023
1 parent 8f1c53c commit 7fb7c1c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/common/portstat_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ def parse_portstat(content_lines):
header_line = ''
separation_line = ''
separation_line_number = 0
reminder_line_number = len(content_lines)
for idx, line in enumerate(content_lines):
if line.find('----') >= 0:
header_line = content_lines[idx-1]
separation_line = content_lines[idx]
separation_line_number = idx
break
if 'Reminder' in line:
reminder_line_number = idx

try:
positions = parse_column_positions(separation_line)
Expand All @@ -63,7 +65,9 @@ def parse_portstat(content_lines):
return {}

results = {}
for line in content_lines[separation_line_number+1:]:
for line in content_lines[separation_line_number+1:reminder_line_number]:
if line == '\n': # skip empty line
continue
portstats = []
for pos in positions:
portstat = line[pos[0]:pos[1]].strip()
Expand Down

0 comments on commit 7fb7c1c

Please sign in to comment.