I did define the direction of the mirror in my code, but it is specified as an input parameter, which means it can be specified by the user. However, in the P4Runtime protocol message definition, there is no way for the user to pass input parameters such as direction. So, I am wondering if I can use the “instance” field in the “Replica” message as the direction. Actually, this parameter only works for multicast, but I want to use it as the direction and then parse it on the receiving end.
In mine previous message I meant to say that the direction of the clone is fixed at compiler level. So, whether or not you use the P4 runtime at control level you cannot change the direction of packet cloning. This also applies to the session id that is associated with that specific “clone function/object” defined in your P4 program.
Tofino has its own control plane APIs that should support its full range of configuration options.
P4Runtime API configuration for mirroring can cover the options for the v1model architecture and PSA architecture, but not necessarily Tofino’s, which has more options than the others.
P4Runtime API was never designed to cover that full range of options in any architecture other than PSA. There is work going on in the P4 API work group to generalize what P4Runtime API can support, but it is not there yet.