CLI commands
I am using VM given by P4 tutorials (https://github.com/p4lang/tutorials) and I want to set queue rate of my bmv2 switch. But, I do not want to do it by opening an another terminal and then call simple_switch_cli and then set the rate of the queue. I want to add this in the code such that when I do "make run" of my code, all my switches in the topology already have queue_rate set to this value.
I want to know, in which file and where should I mention this command.
The tool p4-utils may be helpful to you. You could refer to any contrller code in examples or exercises to know how to use the API. Such as:
from p4utils.utils.sswitch_API import SimpleSwitchAPI
class contoller():
...
self.controller = SimpleSwitchAPI(thrift_port)
...
self.controller.set_queue_rate(rate, egress_port)
You can find the details of params or other available APIs in p4-utils/p4utils/utils/sswitch_thrift_API.py and p4-utils/p4utils/utils/thrift_API.py.