OpenIxia / ixnetwork_restpy

The IxNetwork python client.
https://openixia.github.io/ixnetwork_restpy/#/
MIT License
30 stars 16 forks source link

 Easier way to script/configure  traffic/protocol template and it’s field using Rest.Py #49

Closed Vibaswan closed 3 years ago

Vibaswan commented 3 years ago

Currently we find protocol and relevant field in order to set that parameter.  We will extend Rest.Py protocol/template so that actual protocol and field information is made available  to user as class properties. to user as class properties.

For example:

# Current way of scripting :
tr1 = traffic.TrafficItem.add(Name='RAW TCP', BiDirectional=False, TrafficType='raw',TrafficItemType='l2L3') 
configElement = tr1.ConfigElement.find()[0] 
ethernetStackObj = configElement.Stack.find(DisplayName='Ethernet II') 
ethernetSrcField = ethernetStackObj.Field.find(DisplayName='Source MAC Address') 
ethernetSrcField.SingleValue = '00:11:00:00:22:00' 
ipv4ProtocolTemplate = traffic.ProtocolTemplate.find(DisplayName='IPv4')
# Proposed way of scripting :
tr1 = traffic.add(Name='RAW TCP', BiDirectional=False, TrafficType='raw', TrafficItemType='l2L3') 
stack = tr1.ConfigElement.Stack 
eth_st = stack.Ethernet_II.add() 
eth_st.Destination_MAC_Address.Single('00:33:00:11:22:00') 
ipv4_st = stack.IPv4.add()
ajbalogh commented 3 years ago

This is now supported in version 1.1.0