behavioral-model
behavioral-model copied to clipboard
simple_switch_grpc time synchronization
hi, I use simple_switch_grpc to build a bmv2 switch topology. I have read the BMv2 timestamp implementation notes
and I want to ask if I want to call a method like gettimeofday, how should I implement it? Is it in the simple_switch.cpp ,the same as simple_switch?
You would need to look for occurrences of the metadata field names ingress_global_timestamp
and egress_global_timestamp
, and update the code there. It appears there are only a few such places, as far as I know (I have not tried to make this change before):
ingress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L265
egress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L654
You would need to look for occurrences of the metadata field names
ingress_global_timestamp
andegress_global_timestamp
, and update the code there. It appears there are only a few such places, as far as I know (I have not tried to make this change before):ingress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L265
egress_global_timestamp: https://github.com/p4lang/behavioral-model/blob/main/targets/simple_switch/simple_switch.cpp#L654
Thanks for your reply. So may I understand that there are no related files in the targets/simple_switch_grpc
folder ? And I just need to find it in the simple_switch.cpp? In other words, metadata fields telemetry related are defined in the simple_switch?
Best wishes.
As far as I know, the simple_switch_grpc process is compiled from nearly the same source code as the simple_switch process, except it also has some additional source files for a gRPC server for P4Runtime API.
That said, try it out and see what happens. Add some debug print statements to your changes, and see whether they appear in the output or not when you run simple_switch_grpc. Then you will know for sure, no matter what I write here :-)
Thanks. I'll try it.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days