I am a newbie in p4 and my question is : is it possibile through the SimpleSwitchThriftAPI or any other API to query the BMV2 switch statistics (E.g queeue depth ,number of a rule matched … ) without using a p4 program to do that . I want to compare the values obtained from the p4 program with the ones obtained from the SimpleSwitchThriftAPI().
I did not answer the question because I was not sure about the answer. But since no one passed by yet, let me try to answer.
I have to say that I am not sure what you mean by stating: without using a p4 program to do that. Which statistics did you collect with your P4 code?
Anyway, as you mentioned, you can query some statistics via the control plane protocol. If you run the simple_switch_CLI you can check some statistics like the counters for bytes or packets. You can associate them to a table and get the information you need via the control plane. See here an example for counters. See more example about the runtime CLI here. I could be wrong but last time I read it (could be a long time), the CLI used the Thrift API. This file might be of help.