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

Any samples for dscp values modification in ip stack? #53

Closed muthvar1 closed 5 years ago

muthvar1 commented 5 years ago

Figured out 802.1p can be changed by adjusting field values within vlan stack, but seems like DSCP is a little more involved and needs manipulation of multiple fields? Is there any other easy way to do this? If you have an example please post it

Basically what I need to do with DSCP is that when the user provides a specific DSCP value (i.e af11), I need to be able to translate this to adding it to the stack in the traffic item. When looking at the api browser under fields for ip stack there are quite a few and we would need to modify quite a few fields in order to update to a specific dscp value.

hubertgee commented 5 years ago

Hi muthvar1,

This is how you configure DSCP. Look at all the options in the comments. They are the same as what is shown in the Traffic Item's packet header/ipv4/IpPriority/ToS/Precedence. To see how to create packet headers using the Traffic Item object, please look at sample script createTrafficItemAddPacketHeader.py. There is also a step-by-step guide on how to use the API browser to create packet headers. This guide correlates to the RestPy sample script also: https://www.openixia.com/tutorials?subject=ixNetwork/apiBrowser&page=addTrafficItemPacketHeader.html

ipv4PrecedenceField = ixNetwork.Traffic.TrafficItem.find()[0].ConfigElement.find()[0].Stack.find()[2].Field.find()[3]

# 000 Routine, 001 Priority, 010 Immediate, 011 Flash, 100 Flash Override,                                                                          
# 101 CRITIC/ECP, 110 Internetwork Control, 111 Network Control                                                                                     
ipv4PrecedenceField = ipv4FieldObj.find(DisplayName='Precedence')
ipv4PrecedenceField.ActiveFieldChoice = True
ipv4PrecedenceField.FieldValue = '011 Flash'