Skip to content

Commit

Permalink
fix devicetxrx implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbalogh committed Nov 14, 2020
1 parent 1b21405 commit 8d53cb9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.45
0.0.46
22 changes: 14 additions & 8 deletions ixnetwork_open_traffic_generator/trafficitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def config(self):
args = {
'Name': flow.name,
'TrafficItemType': 'l2L3',
'TrafficType': self._get_traffic_type(flow)
'TrafficType': self._get_traffic_type(flow),
'SrcDestMesh': 'oneToOne' if flow.tx_rx.choice == 'port' else 'manyToMany'
}
ixn_traffic_item.find(Name='^%s$' % flow.name,
TrafficType=args['TrafficType'])
Expand Down Expand Up @@ -325,12 +326,15 @@ def _configure_pattern(self,
ValueList=pattern.list)
elif pattern.choice == 'counter':
value_type = 'increment' if pattern.counter.up is True else 'decrement'
ixn_field.update(Auto=False,
ValueType=value_type,
ActiveFieldChoice=field_choice,
StartValue=pattern.counter.start,
StepValue=pattern.counter.step,
CountValue=pattern.counter.count)
try:
ixn_field.update(Auto=False,
ValueType=value_type,
ActiveFieldChoice=field_choice,
StartValue=pattern.counter.start,
StepValue=pattern.counter.step,
CountValue=pattern.counter.count)
except Exception as e:
print(e)
elif pattern.choice == 'random':
ixn_field.update(Auto=False,
ActiveFieldChoice=field_choice,
Expand Down Expand Up @@ -550,11 +554,13 @@ def results(self, request):
flow_rows[traffic_item['name']] = flow_row
try:
table = self._api.assistant.StatViewAssistant(
'Traffic Item Statistics')
'Flow Statistics')
table.AddRowFilter('Traffic Item', StatViewAssistant.REGEX,
filter['regex'])
for row in table.Rows:
flow_row = flow_rows[row['Traffic Item']]
self._set_result_value(flow_row, 'port_tx', row['Tx Port'])
self._set_result_value(flow_row, 'port_rx', row['Rx Port'])
self._set_result_value(flow_row, 'frames_tx', row['Tx Frames'],
int)
self._set_result_value(flow_row, 'frames_rx', row['Rx Frames'],
Expand Down
4 changes: 1 addition & 3 deletions tests/test_flow_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ def test_flow_results(serializer, api, b2b_ipv4_flow_config):
state = control.State(control.FlowTransmitState(state='start'))
api.set_state(state)

request = result.FlowRequest(
column_names=['name', 'transmit', 'frames_tx', 'frames_rx'])
while True:
results = api.get_flow_results(request)
results = api.get_flow_results(result.FlowRequest())
df = pandas.DataFrame.from_dict(results)
print(df)
if df.frames_tx.sum() >= b2b_ipv4_flow_config.flows[0].duration.packets.packets:
Expand Down

0 comments on commit 8d53cb9

Please sign in to comment.