Hi Jan, Can you try to compare the two API traces? Either using src/tools/vppapitrace or "api trace dump" inside of VPP.
Cheers, Ole > On 18 Sep 2019, at 10:30, Jan Gelety via Lists.Fd.Io > <jgelety=cisco....@lists.fd.io> wrote: > > Hello vpp-dev, > > We are converting CSIT Policer.py library to use PAPI instead of VAT > commands. Unfortunately policer functional > test is failing with „Invalid DSCP: 0, should be 20 “ in case of > configuration via PAPI. > > The root cause seems to be that policer_index is not set for > policer-classify as reported in packet trace: > > 00:00:17:623180: ip4-policer-classify > POLICER_CLASSIFY: sw_if_index 1 next 1 table 0 offset -1 policer_index -1 > 00:00:17:623185: ip4-lookup > fib 0 dpo-idx 1 flow hash: 0x00000000 > TCP: 10.10.10.2 -> 20.20.20.2 > tos 0x00, ttl 64, length 40, checksum 0x3eae > fragment id 0x0001 > TCP: 20 -> 80 > seq. 0x00000000 ack 0x00000000 > flags 0x02 SYN, tcp header: 20 bytes > window 8192, checksum 0x535d > 00:00:17:623194: ip4-rewrite > tx_sw_if_index 2 dpo-idx 1 : ipv4 via 20.20.20.2 > VirtualFunctionEthernet3b/a/3: mtu:9200 face00000203face000006030800 flow > hash: 0x00000000 > 00000000: face00000203face00000603080045000028000100003f063fae0a0a0a021414 > 00000020: 140200140050000000000000000050022000535d0000000000000000 > 00:00:17:623205: VirtualFunctionEthernet3b/a/3-output > > While in case of configuration via VAT policer_index is set correctly: > > 00:00:16:770119: ip4-input-no-checksum > TCP: 10.10.10.2 -> 20.20.20.2 > tos 0x00, ttl 64, length 40, checksum 0x3eae > fragment id 0x0001 > TCP: 20 -> 80 > seq. 0x00000000 ack 0x00000000 > flags 0x02 SYN, tcp header: 20 bytes > window 8192, checksum 0x535d > 00:00:16:770128: ip4-policer-classify > POLICER_CLASSIFY: sw_if_index 1 next 1 table 0 offset 1200 policer_index 0 > 00:00:16:770132: ip4-lookup > fib 0 dpo-idx 1 flow hash: 0x00000000 > TCP: 10.10.10.2 -> 20.20.20.2 > tos 0x50, ttl 64, length 40, checksum 0x3e5e > fragment id 0x0001 > TCP: 20 -> 80 > seq. 0x00000000 ack 0x00000000 > flags 0x02 SYN, tcp header: 20 bytes > window 8192, checksum 0x535d > 00:00:16:770140: ip4-rewrite > tx_sw_if_index 2 dpo-idx 1 : ipv4 via 20.20.20.2 > VirtualFunctionEthernet3b/a/3: mtu:9200 badc0ffe0203badc0ffe06030800 flow > hash: 0x00000000 > 00000000: badc0ffe0203badc0ffe0603080045500028000100003f063f5e0a0a0a021414 > 00000020: 140200140050000000000000000050022000535d0000000000000000 > 00:00:16:770146: VirtualFunctionEthernet3b/a/3-output > > > VAT configuration > > policer_add_del name policer1 cir 100 eir 150 cb 64 eb 64 rate_type pps > round_type closest type 2r3c-2698 conform_action transmit exceed_action > mark-and-transmit AF22 violate_action transmit color-aware > classify_add_del_table mask l3 ip4 dst > classify_add_del_session policer-hit-next 0 exceed-color table-index 0 skip_n > 1 match_n 2 match l3 ip4 dst 20.20.20.2 > policer_classify_set_interface sw_if_index 1 ip4-table 0 > > have been converted to PAPI configuration > > policer_add_del(conform_action_type=1,eir=150,name='policer1',cb=64,is_add=1,rate_type=1,eb=64,cir=100,violate_action_type=1,exceed_dscp=20,violate_dscp=0,color_aware=1,conform_dscp=0,type=2,exceed_action_type=2,round_type=0) > classify_add_del_table(next_table_index=4294967295,miss_next_index=4294967295,mask_len=32,match_n_vectors=2,mask='\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',current_data_offset=0,memory_size=2097152,table_index=4294967295,nbuckets=2,skip_n_vectors=0,is_add=1,current_data_flag=0) > classify_add_del_session(advance=0,match_len=32,is_add=1,opaque_index=1,hit_next_index=0,table_index=0,action=0,match='\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14\x14\x14\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',metadata=0) > policer_classify_set_interface(ip6_table_index=4294967295,ip4_table_index=0,l2_table_index=4294967295,is_add=1,sw_if_index=1) > > based on the corresponding VAT code in api_format.c file, that means > > - policer_index returned by policer_add_del API function has been used > for parameter hit_next_index of classify_add_del_session API function > - new_table_index returned by classify_add_del_table API function has > been used for parameter table_index of classify_add_del_session API function > - value of opaque_index parameter of classify_add_del_session API > function has been set based on required pre-color setting (exceed-color in > this case) > > Can somebody help us to fix the issue, please? > > Test log: > https://logs.fd.io/production/vex-yul-rot-jenkins-1/csit-vpp-device-master-ubuntu1804-1n-skx/3683/archives/log.html.gz#s1-s1-s1-s4-s5-t1 > Tested on Ubuntu bionic system with vpp build 20.01-rc0~174-g3d1ef873d~b3588. > > Thanks, > Jan > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > > View/Reply Online (#3734): https://lists.fd.io/g/csit-dev/message/3734 > Mute This Topic: https://lists.fd.io/mt/34185744/675193 > Group Owner: csit-dev+ow...@lists.fd.io > Unsubscribe: https://lists.fd.io/g/csit-dev/unsub [otr...@employees.org] > -=-=-=-=-=-=-=-=-=-=-=-
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#14012): https://lists.fd.io/g/vpp-dev/message/14012 Mute This Topic: https://lists.fd.io/mt/34185800/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-