You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a IxNetwork config file with 2 traffic items configured, from the GUI I am able to get the stats from both traffic items in the "Traffic Item Statistics"
With the following code, I am only able to get the "Traffic Item Statistic" from only one traffic item
When I print the "Traffic Item Statistics", I only see 1 of the 2 traffic items:
Code:
"""This script demonstrates how to get started with ixnetwork_restpy scripting.The script demonstrates the following: - connect to an IxNetwork test platform, authenticate, add a new session and clear the config - create 1 tx port and 1 rx port - create traffic from the tx port to the rx port - start traffic - print statistics - stop traffic """importos, sys, tracebackfrompprintimportpprintimporttime, refromixnetwork_restpyimportSessionAssistant, Files, StatViewAssistant# local_file=False # config file is on ixNet API Server machine,# It must be stored under 'C:\\Users\\<user name>\\AppData\\Local\\Ixia\\sdmStreamManager\\common\\' dir# local_file=True# config file is on the script machine#configFile = r"C:\\Users\\an144a\\Documents\\Ixia\\IxNetwork\\Repository\\Cisco-SDWAN Flexware Performance Test-noHW.ixncfg"#configFile = r'C:\\Users\\an144a\\AppData\\Local\\Ixiay\\Cisco-SDWAN Flexware Performance Test-noHW.ixncfg'#configFile = r'C:/Users/an144a/AppData/Local/Ixiay/cisco_sdwan_automation.ixncfg'configFile=r'C:/Users/an144a/AppData/Local/Ixia/sdmStreamManager/common/cisco_sdwan_automation_api.ixncfg'#The script will configure following Ixia chassis ixChassisIpList= ['135.16.178.57']
# IP - CARD - PORTportList= [[ixChassisIpList[0], 5,5], [ixChassisIpList[0], 5, 6]]
# Forcefully take port ownership if the portList are owned by other users.forceTakePortOwnership=True# For linux and connection_manager only. Set to True to leave the session alive for debugging.debugMode=Falsetry:
# create a test tool sessionsession_assistant=SessionAssistant(IpAddress='172.30.7.215', IgnoreEnvProxy=True, LogLevel=SessionAssistant.LOGLEVEL_INFO, ClearConfig=False)
ixnetwork=session_assistant.Ixnetworkixnetwork.info('Loading config file: {0}'.format(configFile))
ixnetwork.LoadConfig(Files(configFile, local_file=True))
# Assign portstestPorts= []
vportList= [vport.hrefforvportinixnetwork.Vport.find()]
forportinportList:
testPorts.append(dict(Arg1=port[0], Arg2=port[1], Arg3=port[2]))
ixnetwork.AssignPorts(testPorts, [], vportList, forceTakePortOwnership)
# create tx and rx port resources#port_map = session_assistant.PortMapAssistant()#port_map.Map('135.16.178.57', 2, 3, Name='10GE LAN - Flex SDWAN')#port_map.Map('135.16.178.57', 2, 4, Name='10GE LAN - C8500X')# finding all the traffic items in our configtraffic_items=ixnetwork.Traffic.TrafficItem.find()
print(traffic_items)
ixnetwork.StartAllProtocols(Arg1='sync')
time.sleep(20)
# push ConfigElement settings down to HighLevelStream resourcestraffic_items.Generate()
ixnetwork.info('Apply config')
ixnetwork.Traffic.Apply()
ixnetwork.info('Starting traffic')
ixnetwork.Traffic.StartStatelessTrafficBlocking()
# StatViewAssistant could also filter by regex, LESS_THAN, GREATER_THAN, EQUAL. # Examples:# flowStatistics.AddRowFilter('Port Name', StatViewAssistant.REGEX, '^Port 1$')# flowStatistics.AddRowFilter('Tx Frames', StatViewAssistant.LESS_THAN, 50000)time.sleep(30)
trafficItemStatistics=StatViewAssistant(ixnetwork, 'Traffic Item Statistics')
print(trafficItemStatistics)
# Get the statistic values#txFrames = trafficItemStatistics.Rows[0]['Tx Frames']#rxFrames = trafficItemStatistics.Rows[0]['Rx Frames']#ixnetwork.info('\nTraffic Item Stats:\n\tTxFrames: {} RxFrames: {}\n'.format(txFrames, rxFrames))time.sleep(30)
#ixnetwork.info('{}\n'.format(trafficItemStatistics))forrowNumber,trafStatinenumerate(trafficItemStatistics.Rows):
#ixnetwork.info('\n\nSTATS: {}\n\n'.format(trafStat))ixnetwork.info('\n\nRow:{} Traffic Item:{} Tx Frames:{} Rx Frames:{} Loss %:{} \n'.format(rowNumber, trafStat['Traffic Item'], trafStat['Tx Frames'], trafStat['Rx Frames'], trafStat['Loss %']))
# print statistics#print(session_assistant.StatViewAssistant('Port Statistics'))#print(session_assistant.StatViewAssistant('Traffic Item Statistics'))#print(session_assistant.StatViewAssistant('Flow Statistics'))# stop trafficixnetwork.Traffic.StopStatelessTrafficBlocking()
ixnetwork.StopAllProtocols(Arg1='sync')
#portMap.Disconnect()ifdebugMode==False:
# For linux and connection_manager onlysession_assistant.Session.remove()
exceptExceptionaserrMsg:
print('\n%s'%traceback.format_exc(None, errMsg))
ifdebugMode==Falseand'session'inlocals():
session_assistant.Session.remove()
Output:
As you can see only 1 traffic item statistic is outputed, while I have 2
Hello,
IxNetwork 9.20
Python3
ixnetwork-restpy==1.1.11
I have a IxNetwork config file with 2 traffic items configured, from the GUI I am able to get the stats from both traffic items in the "Traffic Item Statistics"
With the following code, I am only able to get the "Traffic Item Statistic" from only one traffic item
When I print the "Traffic Item Statistics", I only see 1 of the 2 traffic items:
Code:
Output:
As you can see only 1 traffic item statistic is outputed, while I have 2
The text was updated successfully, but these errors were encountered: