From 971dfc1a29daa5109672254d5ea48a62cf901aa7 Mon Sep 17 00:00:00 2001 From: Devesh Pathak <54966909+devpatha@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:42:25 -0700 Subject: [PATCH] Add support for PACKET_ACTION_COPY (#3288) What I did Added COPY packet action, that uses SAI_PACKET_ACTION_COPY attribute. Why I did it This allows ACL to copy packets to CPU. It can be used to dump and debug transit packets. --- orchagent/aclorch.cpp | 1 + orchagent/aclorch.h | 1 + tests/mock_tests/aclorch_ut.cpp | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/orchagent/aclorch.cpp b/orchagent/aclorch.cpp index f8bf775868..b20b382009 100644 --- a/orchagent/aclorch.cpp +++ b/orchagent/aclorch.cpp @@ -122,6 +122,7 @@ static acl_packet_action_lookup_t aclPacketActionLookup = { { PACKET_ACTION_FORWARD, SAI_PACKET_ACTION_FORWARD }, { PACKET_ACTION_DROP, SAI_PACKET_ACTION_DROP }, + { PACKET_ACTION_COPY, SAI_PACKET_ACTION_COPY }, }; static acl_dtel_flow_op_type_lookup_t aclDTelFlowOpTypeLookup = diff --git a/orchagent/aclorch.h b/orchagent/aclorch.h index 5458e970be..be6c1f2af5 100644 --- a/orchagent/aclorch.h +++ b/orchagent/aclorch.h @@ -72,6 +72,7 @@ #define PACKET_ACTION_FORWARD "FORWARD" #define PACKET_ACTION_DROP "DROP" +#define PACKET_ACTION_COPY "COPY" #define PACKET_ACTION_REDIRECT "REDIRECT" #define PACKET_ACTION_DO_NOT_NAT "DO_NOT_NAT" diff --git a/tests/mock_tests/aclorch_ut.cpp b/tests/mock_tests/aclorch_ut.cpp index 4a92d65c80..351d523219 100644 --- a/tests/mock_tests/aclorch_ut.cpp +++ b/tests/mock_tests/aclorch_ut.cpp @@ -889,6 +889,13 @@ namespace aclorch_test return false; } } + else if (attr_value == PACKET_ACTION_COPY) + { + if (it->second.getSaiAttr().value.aclaction.parameter.s32 != SAI_PACKET_ACTION_COPY) + { + return false; + } + } else { // unknown attr_value