Skip to content

Commit

Permalink
fix flow metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbalogh committed Nov 20, 2020
1 parent a6f7930 commit e44c3c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.60
0.0.61
11 changes: 7 additions & 4 deletions ixnetwork_open_traffic_generator/trafficitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,10 @@ def results(self, request):
if request is not None and request.flow_names is not None and len(
request.flow_names) > 0:
flow_names = request.flow_names
filter['regex'] = '^(%s)$' % '|'.join(flow_names)
if len(flow_names) == 1:
filter['regex'] = '^%s$' % flow_names[0]
elif len(flow_names) > 1:
filter['regex'] = '^(%s)$' % '|'.join(flow_names)

# initialize result values
flow_rows = {}
Expand All @@ -541,11 +544,11 @@ def results(self, request):
# resolve result values
table = self._api.assistant.StatViewAssistant(
'Flow Statistics')
table.AddRowFilter('Traffic Item', StatViewAssistant.REGEX,
filter['regex'])
for row in table.Rows:
if len(flow_names) > 0 and row['Traffic Item'] not in flow_names:
continue
flow_row = flow_rows[row['Traffic Item'] + row['Tx Port'] + row['Rx Port']]
if traffic_item['state'] == 'stopped' and float(row['Tx Frame Rate']) > 0 or int(row['Tx Frames']) == 0:
if float(row['Tx Frame Rate']) > 0 or int(row['Tx Frames']) == 0:
flow_row['transmit'] = 'started'
for external_name, internal_name, external_type in self._RESULT_COLUMNS:
self._set_result_value(flow_row, external_name, row[internal_name], external_type)
Expand Down

0 comments on commit e44c3c4

Please sign in to comment.