OpenIxia / IxNetwork

A central location for IxNetwork sample scripts and utilities. Please also visit http://openixia.com
MIT License
50 stars 59 forks source link

How to add a step iterator for TCP #70

Closed muthvar1 closed 5 years ago

muthvar1 commented 5 years ago

Hi, Do you have examples of adding a step iterator for TCP stack. I only see the option for a single value.

configElement = trafficItem.ConfigElement.find()[0] protocol_template=ixNetwork.Traffic.ProtocolTemplate.find(StackTypeId='tcp') ipstack = configElement.Stack.find(StackTypeId='ipv4') tcpFieldObj = configElement.Stack.read(ipstack.AppendProtocol(protocol_template)) tcpFieldObj.Field.find(DisplayName='TCP-Source-Port').Auto = False tcpFieldObj.Field.find(DisplayName='TCP-Source-Port').SingleValue = int(stream_params['sFromPort']) tcpFieldObj.Field.find(DisplayName='TCP-Dest-Port').Auto = False tcpFieldObj.Field.find(DisplayName='TCP-Dest-Port').SingleValue = int(stream_params['dFromPort'])

Something similar to ip address ip_construct.Address.Increment(start_value=ip_value, step_value=counter_step)

ajbalogh commented 5 years ago

field = tcpFieldObj.Field.find(DisplayName='TCP-Dest-Port') field.update(ValueType='singleValue', SingleValue=int(stream_params['dFromPort'])) field.update(ValueType='increment', StartValue='1000', StepValue='2') field.update(ValueType='decrement', StartValue='50000', StepValue='2') field.update(ValueType='valueList', ValueList=['1000', '2000', '3000', '4000']) field.update(ValueType='random') field.update(ValueType='repeatableRandomRange', MinValue='1000', MaxValue='10000', Step='1', Seed='1', CountValue='2000')

muthvar1 commented 5 years ago

Thanks much Andy.