sb = stc.create("streamblock", under=port1) ipv4 = stc.get(sb, 'children-ipv4:ipv4') tosdiffserv = stc.get(ipv4, 'children-tosdiffserv') tos = stc.get(tosdiffserv, 'children-tos') stc.delete(tos) diffserv = stc.create('diffserv', under=tosdiffserv, dscpHigh=7, # First 3 bits of DSCP dscpLow=7, # Last 3 bits of DSCP reserved=11) # ECN setting (2 bits)
sb = stc.create("streamblock", under=port1) ipv4 = stc.get(sb, 'children-ipv4:ipv4') ipv4_name = stc.get(ipv4, 'name') tosdiffserv = stc.get(ipv4, 'children-tosdiffserv') tos = stc.get(tosdiffserv, 'children-tos') stc.delete(tos) diffserv = stc.create('diffserv', under=tosdiffserv) stc.create("RangeModifier", under=sb, EnableStream='TRUE', Data='f9', StepValue='1', Mask='ff', RecycleCount=1, RepeatCount=0, DataType='BYTE', OffsetReference=f'{ipv4_name}.tosDiffserv.diffServ')
sth.traffic_config(mode='create', port_handle=port_handle[0], l3_protocol='ipv4', ip_dscp=0, # DSCP in decimal representation (from 0 t0 64) ip_ecn='01') # ECN {00|01|10|11} # "ip_ecn" is not implemented in old versions, you need to use "invoke" sth.invoke('stc::config streamblock1.ipv4:ipv4.tosdiffserv.diffserv -reserved 11')