Hi,
I’m learning p4 and I want to use it on a monitoring tool that I developed. I already checked the forum and tutorials but I can’t find even if it is possible to clone a package and send the clone to a different host, keeping the original to their destiny. I’m a new at this, could someone explain to me if this is even possible and how/where can I find how to do it?
Thanks a lot!
Hi @dnredson,
You can clone/mirror a packet easilly, for example in the behavioral model the clone can be “deployed” in 2 steps:
- You have to use the extern clone in your P4 code
https://github.com/p4lang/p4c/blob/main/p4include/v1model.p4#L450 - Then you have to use the CLI (or P4Runtime) provided by the switch to configure the egres port where the cloned/mirrored packet will be forwarded. (https://github.com/p4lang/behavioral-model/blob/7d7c3c7c5b82c14a8d70ecd82ad15635425f01d9/targets/simple_switch/sswitch_CLI.py#L86)
This bheavior should be similar also in other siwtches (SW/HW)