ixnetwork_restpy
ixnetwork_restpy copied to clipboard
Unable to update traffic flow when test is running.
Hi, I'm having issues regenerating traffic flow when "FrameRate" is updated on the fly (while loop based on packet loss of the "Traffic Item Statistics" this is obviously possible via the GUI. Code snippet:
traffic_config = traffic_item.ConfigElement.find()
traffic_item.Generate()
ixnetwork.Traffic.Apply()
ixnetwork.Traffic.StartStatelessTrafficBlocking()
traffic_item_statistics = session.StatViewAssistant(
'Traffic Item Statistics'
)
#
total_loss = float(traffic_item_statistics.Rows['Loss %'])
while total_loss < 1:
print(
f'[+] Current total loss: {total_loss}%'
)
initial_rate += 50
print(
{
'total_tx_frames': traffic_item_statistics.Rows['Tx Frames'],
'total_tx_rate_mbps': traffic_item_statistics.Rows['Tx Rate (Mbps)'],
'total_rx_frames': traffic_item_statistics.Rows['Rx Frames'],
'total_rx_rate_mbps': traffic_item_statistics.Rows['Rx Rate (Mbps)'],
'total_loss': traffic_item_statistics.Rows['Loss %']
}
)
sleep(10)
traffic_config.FrameRate.update(
Type='bitsPerSecond',
Rate=initial_rate
)
traffic_item.Generate() <--------------------------
ixnetwork.info(
ixnetwork.Traffic.TrafficItem.find()
)
if total_loss > 1 or initial_rate == 1000:
print('[+] Loss exceeded 1%')
# Stop the test
ixnetwork.info('[+] Stopping the test...')
ixnetwork.Traffic.StopStatelessTrafficBlocking()
break
Warnings: ['Traffic Generate required: The Traffic Item was modified. Please perform a Traffic Generate to update the associated traffic Flow Groups']
Error Msg: Unable to regenerate a started/transmitting trafficItem