From e39edad283314d10d7e7995036efc736f2b0e3d9 Mon Sep 17 00:00:00 2001 From: divyagayathri-hcl <159437886+divyagayathri-hcl@users.noreply.github.com> Date: Tue, 22 Oct 2024 04:07:42 +0530 Subject: [PATCH] [SAIP4] Introduce new unsupported tunnel_decap action. (#641) Co-authored-by: kishanps Co-authored-by: rhalstea Co-authored-by: smolkaj --- sai_p4/fixed/ids.h | 24 ++--- sai_p4/fixed/tunnel_termination.p4 | 35 ++++---- .../google/fabric_border_router.p4 | 3 +- .../google/fabric_border_router.p4info.pb.txt | 89 +++++++++---------- sai_p4/instantiations/google/middleblock.p4 | 3 +- .../google/middleblock.p4info.pb.txt | 89 +++++++++---------- sai_p4/instantiations/google/sai_pd.proto | 8 +- .../google/test_tools/test_entries.cc | 10 +-- .../google/test_tools/test_entries.h | 3 +- .../google/test_tools/test_entries_test.cc | 8 +- ...mv2_tunnel_termination_integration_test.cc | 36 ++++---- .../google/unioned_p4info.pb.txt | 89 +++++++++---------- 12 files changed, 184 insertions(+), 213 deletions(-) diff --git a/sai_p4/fixed/ids.h b/sai_p4/fixed/ids.h index a3ec4594..67e46f15 100644 --- a/sai_p4/fixed/ids.h +++ b/sai_p4/fixed/ids.h @@ -56,18 +56,18 @@ #define MIRRORING_MIRROR_AS_IPV4_ERSPAN_ACTION_ID 0x01000007 // 16777223 #define CLONING_INGRESS_CLONE_ACTION_ID 0x0100001C // 16777244 #define CLONING_MIRROR_WITH_VLAN_TAG_AND_IPFIX_ENCAPSULATION_ACTION_ID \ - 0x0100001D // 16777245 -#define L3_ADMIT_ACTION_ID 0x01000008 // 16777224 -#define MIRRORING_SET_PRE_SESSION_ACTION_ID 0x01000009 // 16777225 -#define SELECT_ECMP_HASH_ALGORITHM_ACTION_ID 0x010000A // 16777226 -#define COMPUTE_ECMP_HASH_IPV4_ACTION_ID 0x0100000B // 16777227 -#define COMPUTE_ECMP_HASH_IPV6_ACTION_ID 0x0100000C // 16777228 -#define COMPUTE_LAG_HASH_IPV4_ACTION_ID 0x0100000D // 16777229 -#define COMPUTE_LAG_HASH_IPV6_ACTION_ID 0x0100000E // 16777230 -#define ROUTING_SET_METADATA_AND_DROP_ACTION_ID 0x01000015 // 16777237 -#define MARK_FOR_TUNNEL_DECAP_AND_SET_VRF_ACTION_ID 0x01000016 // 16777238 -#define DISABLE_VLAN_CHECKS_ACTION_ID 0x0100001A // 16777242 -// Next available action id: 0x0100001E (16777246) + 0x0100001D // 16777245 +#define L3_ADMIT_ACTION_ID 0x01000008 // 16777224 +#define MIRRORING_SET_PRE_SESSION_ACTION_ID 0x01000009 // 16777225 +#define SELECT_ECMP_HASH_ALGORITHM_ACTION_ID 0x010000A // 16777226 +#define COMPUTE_ECMP_HASH_IPV4_ACTION_ID 0x0100000B // 16777227 +#define COMPUTE_ECMP_HASH_IPV6_ACTION_ID 0x0100000C // 16777228 +#define COMPUTE_LAG_HASH_IPV4_ACTION_ID 0x0100000D // 16777229 +#define COMPUTE_LAG_HASH_IPV6_ACTION_ID 0x0100000E // 16777230 +#define ROUTING_SET_METADATA_AND_DROP_ACTION_ID 0x01000015 // 16777237 +#define TUNNEL_DECAP_ACTION_ID 0x01000016 // 16777238 +#define DISABLE_VLAN_CHECKS_ACTION_ID 0x0100001A // 16777242 +// Next available action id: 0x0100001F (16777247) // --- Action Profiles and Selectors (8 most significant bits = 0x11) ---------- // This value should ideally be 0x11000001, but we currently have this value for diff --git a/sai_p4/fixed/tunnel_termination.p4 b/sai_p4/fixed/tunnel_termination.p4 index 57810a06..31f3a806 100644 --- a/sai_p4/fixed/tunnel_termination.p4 +++ b/sai_p4/fixed/tunnel_termination.p4 @@ -17,16 +17,23 @@ #ifndef SAI_TUNNEL_TERMINATION_P4_ #define SAI_TUNNEL_TERMINATION_P4_ -// Should be applied at the beginning of the pre-ingress stage. -control tunnel_termination_lookup(in headers_t headers, +#include +#include "headers.p4" +#include "metadata.p4" +#include "ids.h" +#include "minimum_guaranteed_sizes.p4" + +// Should be applied at the end of the pre-ingress stage. +control tunnel_termination(inout headers_t headers, inout local_metadata_t local_metadata) { + bool marked_for_ip_in_ipv6_decap = false; - // Sets SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID. - @id(MARK_FOR_TUNNEL_DECAP_AND_SET_VRF_ACTION_ID) - action mark_for_tunnel_decap_and_set_vrf(vrf_id_t vrf_id) { - // Actual decap is delayed until the end of the pre-ingress stage. - local_metadata.apply_tunnel_decap_at_end_of_pre_ingress = true; - local_metadata.vrf_id = vrf_id; + @id(TUNNEL_DECAP_ACTION_ID) + @unsupported + action tunnel_decap() { + // Bmv2 does not support if statements in actions, so control metadata is + // set and decapping is performed post-action. + marked_for_ip_in_ipv6_decap = true; } // Models SAI_TUNNEL_TERM_TABLE. @@ -36,6 +43,7 @@ control tunnel_termination_lookup(in headers_t headers, @unsupported @p4runtime_role(P4RUNTIME_ROLE_ROUTING) @id(IPV6_TUNNEL_TERMINATION_TABLE_ID) + @unsupported table ipv6_tunnel_termination_table { key = { // Sets `SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_DST_IP[_MASK]`. @@ -46,7 +54,7 @@ control tunnel_termination_lookup(in headers_t headers, @id(2) @name("src_ipv6") @format(IPV6_ADDRESS); } actions = { - @proto_id(1) mark_for_tunnel_decap_and_set_vrf; + @proto_id(1) tunnel_decap; } size = IPV6_TUNNEL_TERMINATION_TABLE_MINIMUM_GUARANTEED_SIZE; } @@ -61,15 +69,8 @@ control tunnel_termination_lookup(in headers_t headers, ipv6_tunnel_termination_table.apply(); } } - } -} - -// Should be applied at the end of the pre-ingress stage. -control tunnel_termination_decap(inout headers_t headers, - in local_metadata_t local_metadata) { - apply { - if (local_metadata.apply_tunnel_decap_at_end_of_pre_ingress) { + if (marked_for_ip_in_ipv6_decap) { // Currently, this should only ever be set for IP-in-IPv6 packets. // TODO: Remove guard once p4-symbolic suports assertions. #ifndef PLATFORM_P4SYMBOLIC diff --git a/sai_p4/instantiations/google/fabric_border_router.p4 b/sai_p4/instantiations/google/fabric_border_router.p4 index 2c22a456..166d4748 100644 --- a/sai_p4/instantiations/google/fabric_border_router.p4 +++ b/sai_p4/instantiations/google/fabric_border_router.p4 @@ -33,11 +33,10 @@ control ingress(inout headers_t headers, apply { packet_out_decap.apply(headers, local_metadata, standard_metadata); if (!local_metadata.bypass_ingress) { - tunnel_termination_lookup.apply(headers, local_metadata); vlan_untag.apply(headers, local_metadata, standard_metadata); acl_pre_ingress.apply(headers, local_metadata, standard_metadata); ingress_vlan_checks.apply(headers, local_metadata, standard_metadata); - tunnel_termination_decap.apply(headers, local_metadata); + tunnel_termination.apply(headers, local_metadata); admit_google_system_mac.apply(headers, local_metadata); l3_admit.apply(headers, local_metadata, standard_metadata); routing_lookup.apply(headers, local_metadata, standard_metadata); diff --git a/sai_p4/instantiations/google/fabric_border_router.p4info.pb.txt b/sai_p4/instantiations/google/fabric_border_router.p4info.pb.txt index 0c4d8e38..5c0591d0 100644 --- a/sai_p4/instantiations/google/fabric_border_router.p4info.pb.txt +++ b/sai_p4/instantiations/google/fabric_border_router.p4info.pb.txt @@ -4,39 +4,6 @@ pkg_info { arch: "v1model" organization: "Google" } -tables { - preamble { - id: 33554507 - name: "ingress.tunnel_termination_lookup.ipv6_tunnel_termination_table" - alias: "ipv6_tunnel_termination_table" - annotations: "@unsupported" - annotations: "@p4runtime_role(\"sdn_controller\")" - } - match_fields { - id: 1 - name: "dst_ipv6" - annotations: "@format(IPV6_ADDRESS)" - bitwidth: 128 - match_type: TERNARY - } - match_fields { - id: 2 - name: "src_ipv6" - annotations: "@format(IPV6_ADDRESS)" - bitwidth: 128 - match_type: TERNARY - } - action_refs { - id: 16777238 - annotations: "@proto_id(1)" - } - action_refs { - id: 21257015 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - size: 126 -} tables { preamble { id: 33554509 @@ -161,6 +128,40 @@ tables { direct_resource_ids: 318767361 size: 254 } +tables { + preamble { + id: 33554507 + name: "ingress.tunnel_termination.ipv6_tunnel_termination_table" + alias: "ipv6_tunnel_termination_table" + annotations: "@unsupported" + annotations: "@p4runtime_role(\"sdn_controller\")" + annotations: "@unsupported" + } + match_fields { + id: 1 + name: "dst_ipv6" + annotations: "@format(IPV6_ADDRESS)" + bitwidth: 128 + match_type: TERNARY + } + match_fields { + id: 2 + name: "src_ipv6" + annotations: "@format(IPV6_ADDRESS)" + bitwidth: 128 + match_type: TERNARY + } + action_refs { + id: 16777238 + annotations: "@proto_id(1)" + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 126 +} tables { preamble { id: 33554503 @@ -1125,20 +1126,6 @@ actions { annotations: "@sai_action(SAI_PACKET_ACTION_DROP)" } } -actions { - preamble { - id: 16777238 - name: "ingress.tunnel_termination_lookup.mark_for_tunnel_decap_and_set_vrf" - alias: "mark_for_tunnel_decap_and_set_vrf" - } - params { - id: 1 - name: "vrf_id" - type_name { - name: "vrf_id_t" - } - } -} actions { preamble { id: 16777242 @@ -1163,6 +1150,14 @@ actions { } } } +actions { + preamble { + id: 16777238 + name: "ingress.tunnel_termination.tunnel_decap" + alias: "tunnel_decap" + annotations: "@unsupported" + } +} actions { preamble { id: 16777224 diff --git a/sai_p4/instantiations/google/middleblock.p4 b/sai_p4/instantiations/google/middleblock.p4 index 254947db..79315251 100644 --- a/sai_p4/instantiations/google/middleblock.p4 +++ b/sai_p4/instantiations/google/middleblock.p4 @@ -34,11 +34,10 @@ control ingress(inout headers_t headers, apply { packet_out_decap.apply(headers, local_metadata, standard_metadata); if (!local_metadata.bypass_ingress) { - tunnel_termination_lookup.apply(headers, local_metadata); vlan_untag.apply(headers, local_metadata, standard_metadata); acl_pre_ingress.apply(headers, local_metadata, standard_metadata); ingress_vlan_checks.apply(headers, local_metadata, standard_metadata); - tunnel_termination_decap.apply(headers, local_metadata); + tunnel_termination.apply(headers, local_metadata); admit_google_system_mac.apply(headers, local_metadata); l3_admit.apply(headers, local_metadata, standard_metadata); routing_lookup.apply(headers, local_metadata, standard_metadata); diff --git a/sai_p4/instantiations/google/middleblock.p4info.pb.txt b/sai_p4/instantiations/google/middleblock.p4info.pb.txt index 06d2ea70..df04af27 100755 --- a/sai_p4/instantiations/google/middleblock.p4info.pb.txt +++ b/sai_p4/instantiations/google/middleblock.p4info.pb.txt @@ -4,39 +4,6 @@ pkg_info { arch: "v1model" organization: "Google" } -tables { - preamble { - id: 33554507 - name: "ingress.tunnel_termination_lookup.ipv6_tunnel_termination_table" - alias: "ipv6_tunnel_termination_table" - annotations: "@unsupported" - annotations: "@p4runtime_role(\"sdn_controller\")" - } - match_fields { - id: 1 - name: "dst_ipv6" - annotations: "@format(IPV6_ADDRESS)" - bitwidth: 128 - match_type: TERNARY - } - match_fields { - id: 2 - name: "src_ipv6" - annotations: "@format(IPV6_ADDRESS)" - bitwidth: 128 - match_type: TERNARY - } - action_refs { - id: 16777238 - annotations: "@proto_id(1)" - } - action_refs { - id: 21257015 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - size: 126 -} tables { preamble { id: 33554509 @@ -153,6 +120,40 @@ tables { direct_resource_ids: 318767361 size: 254 } +tables { + preamble { + id: 33554507 + name: "ingress.tunnel_termination.ipv6_tunnel_termination_table" + alias: "ipv6_tunnel_termination_table" + annotations: "@unsupported" + annotations: "@p4runtime_role(\"sdn_controller\")" + annotations: "@unsupported" + } + match_fields { + id: 1 + name: "dst_ipv6" + annotations: "@format(IPV6_ADDRESS)" + bitwidth: 128 + match_type: TERNARY + } + match_fields { + id: 2 + name: "src_ipv6" + annotations: "@format(IPV6_ADDRESS)" + bitwidth: 128 + match_type: TERNARY + } + action_refs { + id: 16777238 + annotations: "@proto_id(1)" + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 126 +} tables { preamble { id: 33554503 @@ -1080,20 +1081,6 @@ actions { annotations: "@sai_action(SAI_PACKET_ACTION_DROP)" } } -actions { - preamble { - id: 16777238 - name: "ingress.tunnel_termination_lookup.mark_for_tunnel_decap_and_set_vrf" - alias: "mark_for_tunnel_decap_and_set_vrf" - } - params { - id: 1 - name: "vrf_id" - type_name { - name: "vrf_id_t" - } - } -} actions { preamble { id: 16777242 @@ -1118,6 +1105,14 @@ actions { } } } +actions { + preamble { + id: 16777238 + name: "ingress.tunnel_termination.tunnel_decap" + alias: "tunnel_decap" + annotations: "@unsupported" + } +} actions { preamble { id: 16777224 diff --git a/sai_p4/instantiations/google/sai_pd.proto b/sai_p4/instantiations/google/sai_pd.proto index 8cba4d27..6f5ea170 100755 --- a/sai_p4/instantiations/google/sai_pd.proto +++ b/sai_p4/instantiations/google/sai_pd.proto @@ -210,7 +210,8 @@ message Ipv6TunnelTerminationTableEntry { } Match match = 1; message Action { - MarkForTunnelDecapAndSetVrfAction mark_for_tunnel_decap_and_set_vrf = 1; + // CAUTION: This action is not (yet) supported. + TunnelDecapAction tunnel_decap = 1; } Action action = 2; int32 priority = 3; @@ -858,9 +859,8 @@ message SetMetadataAndDropAction { string route_metadata = 1; // Format::HEX_STRING / 6 bits } -message MarkForTunnelDecapAndSetVrfAction { - string vrf_id = 1; // Format::STRING -} +// CAUTION: This action is not (yet) supported. +message TunnelDecapAction {} message SetIpNexthopAndDisableRewritesAction { // Refers to 'router_interface_table.router_interface_id'. diff --git a/sai_p4/instantiations/google/test_tools/test_entries.cc b/sai_p4/instantiations/google/test_tools/test_entries.cc index be53ba8a..e7e4a4e2 100644 --- a/sai_p4/instantiations/google/test_tools/test_entries.cc +++ b/sai_p4/instantiations/google/test_tools/test_entries.cc @@ -233,21 +233,15 @@ EntryBuilder& EntryBuilder::AddPreIngressAclEntryAssigningVrfForGivenIpType( << "invalid ip version: " << static_cast(ip_version); } -EntryBuilder& EntryBuilder::AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf( - absl::string_view vrf) { +EntryBuilder& EntryBuilder::AddEntryDecappingAllIpInIpv6Packets() { sai::TableEntry& entry = *entries_.add_entries(); entry = gutil::ParseProtoOrDie(R"pb( ipv6_tunnel_termination_table_entry { match {} # Wildcard match - action { mark_for_tunnel_decap_and_set_vrf { vrf_id: "" } } + action { tunnel_decap {} } priority: 1 } )pb"); - entry.mutable_ipv6_tunnel_termination_table_entry() - ->mutable_action() - ->mutable_mark_for_tunnel_decap_and_set_vrf() - // TODO: Pass string_view directly once proto supports it. - ->set_vrf_id(std::string(vrf)); return *this; } diff --git a/sai_p4/instantiations/google/test_tools/test_entries.h b/sai_p4/instantiations/google/test_tools/test_entries.h index f511301d..72aba8dc 100644 --- a/sai_p4/instantiations/google/test_tools/test_entries.h +++ b/sai_p4/instantiations/google/test_tools/test_entries.h @@ -207,8 +207,7 @@ class EntryBuilder { int multicast_group_id); EntryBuilder& AddPreIngressAclEntryAssigningVrfForGivenIpType( absl::string_view vrf, IpVersion ip_version); - EntryBuilder& AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf( - absl::string_view vrf); + EntryBuilder& AddEntryDecappingAllIpInIpv6Packets(); EntryBuilder& AddEntryPuntingPacketsWithTtlZeroAndOne(); EntryBuilder& AddMulticastGroupEntry(int multicast_group_id, absl::Span replicas); diff --git a/sai_p4/instantiations/google/test_tools/test_entries_test.cc b/sai_p4/instantiations/google/test_tools/test_entries_test.cc index b5aec697..4f7d5fd4 100644 --- a/sai_p4/instantiations/google/test_tools/test_entries_test.cc +++ b/sai_p4/instantiations/google/test_tools/test_entries_test.cc @@ -285,17 +285,15 @@ TEST(EntryBuilder, AddPreIngressAclEntryAssigningVrfForGivenIpTypeAddsEntry) { EXPECT_THAT(entities.entities(), SizeIs(3)); } -TEST(EntryBuilder, AddEntryDecappingAllIpInIpv6PacketsAndSettingVrfAddsEntry) { +TEST(EntryBuilder, AddEntryDecappingAllIpInIpv6PacketsAddsEntry) { pdpi::IrP4Info kIrP4Info = GetIrP4Info(Instantiation::kFabricBorderRouter); ASSERT_OK_AND_ASSIGN( pdpi::IrEntities entities, EntryBuilder() - .AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf("vrf-1") - .AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf("vrf-2") - .AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf("vrf-3") + .AddEntryDecappingAllIpInIpv6Packets() .LogPdEntries() .GetDedupedIrEntities(kIrP4Info, /*allow_unsupported=*/true)); - EXPECT_THAT(entities.entities(), SizeIs(3)); + EXPECT_THAT(entities.entities(), SizeIs(1)); } TEST(EntryBuilder, AddMulticastGroupEntryReplicaOverloadAddsEntry) { diff --git a/sai_p4/instantiations/google/tests/sai_p4_bmv2_tunnel_termination_integration_test.cc b/sai_p4/instantiations/google/tests/sai_p4_bmv2_tunnel_termination_integration_test.cc index 619bd6a1..3f6955d2 100644 --- a/sai_p4/instantiations/google/tests/sai_p4_bmv2_tunnel_termination_integration_test.cc +++ b/sai_p4/instantiations/google/tests/sai_p4_bmv2_tunnel_termination_integration_test.cc @@ -113,8 +113,8 @@ absl::StatusOr GetIpv4InIpv6Packet( using TunnelTerminationTest = testing::TestWithParam; -// Checks that decapsulation and tunnel termination VRF assignment work as -// expected for forwarded packets +// Checks that decapsulation and VRF assignment work as expected for forwarded +// packets. TEST_P(TunnelTerminationTest, PacketGetsDecapsulatedAndForwarded) { const sai::Instantiation kInstantiation = GetParam(); const pdpi::IrP4Info kIrP4Info = sai::GetIrP4Info(kInstantiation); @@ -125,7 +125,8 @@ TEST_P(TunnelTerminationTest, PacketGetsDecapsulatedAndForwarded) { ASSERT_OK_AND_ASSIGN( std::vector pi_entities, sai::EntryBuilder() - .AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf("vrf") + .AddEntrySettingVrfForAllPackets("vrf") + .AddEntryDecappingAllIpInIpv6Packets() .AddDefaultRouteForwardingAllPacketsToGivenPort( /*egress_port=*/"\001", sai::IpVersion::kIpv4, "vrf", // Rewrites to the same src and dst mac as the input packet. @@ -177,8 +178,6 @@ modified: headers[1].ipv4_header.checksum: "0x5003" -> "0x5103" // Checks the interaction of pre ingress ACLs and tunnel termination: // - Pre ingress ACLs see the original packet before decap. -// - VRF assignments in pre ingress ACLs override VRF assignments from -// tunnel termination. TEST_P(TunnelTerminationTest, PreIngressAclMatchesOnUndecappedPacketAndOverridesDecapVrf) { const sai::Instantiation kInstantiation = GetParam(); @@ -191,20 +190,17 @@ TEST_P(TunnelTerminationTest, ASSERT_OK_AND_ASSIGN( std::vector pi_entities, sai::EntryBuilder() - .AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf("decap-vrf") + .AddEntryDecappingAllIpInIpv6Packets() .AddPreIngressAclEntryAssigningVrfForGivenIpType( "acl-ipv4-vrf", sai::IpVersion::kIpv4) .AddPreIngressAclEntryAssigningVrfForGivenIpType( "acl-ipv6-vrf", sai::IpVersion::kIpv6) - // Route that will apply if the decap entry determines the VRF. - .AddDefaultRouteForwardingAllPacketsToGivenPort( - /*egress_port=*/"\001", sai::IpVersion::kIpv4And6, "decap-vrf") // Route that will apply if the ACL entry matching the decapped packet // determines the VRF. .AddDefaultRouteForwardingAllPacketsToGivenPort( /*egress_port=*/"\002", sai::IpVersion::kIpv4And6, "acl-ipv4-vrf") // Route that will apply if the ACL entry matching the undecapped - // packet determines the VRF.p + // packet determines the VRF. .AddDefaultRouteForwardingAllPacketsToGivenPort( /*egress_port=*/"\003", sai::IpVersion::kIpv4And6, "acl-ipv6-vrf") .AddEntryAdmittingAllPacketsToL3() // Needed for forwarding. @@ -240,16 +236,16 @@ TEST_P(TunnelTerminationTest, PuntedPacketIsNotDecapsulated) { // Install table entries: decap & punt to controller, so we can check that the // punted packet did not get decapped. - ASSERT_OK_AND_ASSIGN( - std::vector pi_entities, - sai::EntryBuilder() - .AddEntryDecappingAllIpInIpv6PacketsAndSettingVrf("vrf") - .AddEntryPuntingAllPackets(sai::PuntAction::kTrap) - .LogPdEntries() - .GetDedupedPiEntities(kIrP4Info, - // TODO: Remove once tunnel termination table is - // no longer `@unsupported`. - /*allow_unsupported=*/true)); + ASSERT_OK_AND_ASSIGN(std::vector pi_entities, + sai::EntryBuilder() + .AddEntryDecappingAllIpInIpv6Packets() + .AddEntryPuntingAllPackets(sai::PuntAction::kTrap) + .LogPdEntries() + .GetDedupedPiEntities( + kIrP4Info, + // TODO: Remove once tunnel + // termination table is no longer `@unsupported`. + /*allow_unsupported=*/true)); ASSERT_OK(pdpi::InstallPiEntities(bmv2.P4RuntimeSession(), pi_entities)); // Inject Ipv4-in-IPv6 test packet and expect 0 forwarded packets and 1 diff --git a/sai_p4/instantiations/google/unioned_p4info.pb.txt b/sai_p4/instantiations/google/unioned_p4info.pb.txt index c088f653..2cf368c1 100644 --- a/sai_p4/instantiations/google/unioned_p4info.pb.txt +++ b/sai_p4/instantiations/google/unioned_p4info.pb.txt @@ -4,39 +4,6 @@ pkg_info { arch: "v1model" organization: "Google" } -tables { - preamble { - id: 33554507 - name: "ingress.tunnel_termination_lookup.ipv6_tunnel_termination_table" - alias: "ipv6_tunnel_termination_table" - annotations: "@unsupported" - annotations: "@p4runtime_role(\"sdn_controller\")" - } - match_fields { - id: 1 - name: "dst_ipv6" - annotations: "@format(IPV6_ADDRESS)" - bitwidth: 128 - match_type: TERNARY - } - match_fields { - id: 2 - name: "src_ipv6" - annotations: "@format(IPV6_ADDRESS)" - bitwidth: 128 - match_type: TERNARY - } - action_refs { - id: 16777238 - annotations: "@proto_id(1)" - } - action_refs { - id: 21257015 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - size: 126 -} tables { preamble { id: 33554509 @@ -161,6 +128,40 @@ tables { direct_resource_ids: 318767361 size: 254 } +tables { + preamble { + id: 33554507 + name: "ingress.tunnel_termination.ipv6_tunnel_termination_table" + alias: "ipv6_tunnel_termination_table" + annotations: "@unsupported" + annotations: "@p4runtime_role(\"sdn_controller\")" + annotations: "@unsupported" + } + match_fields { + id: 1 + name: "dst_ipv6" + annotations: "@format(IPV6_ADDRESS)" + bitwidth: 128 + match_type: TERNARY + } + match_fields { + id: 2 + name: "src_ipv6" + annotations: "@format(IPV6_ADDRESS)" + bitwidth: 128 + match_type: TERNARY + } + action_refs { + id: 16777238 + annotations: "@proto_id(1)" + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 126 +} tables { preamble { id: 33554503 @@ -1641,20 +1642,6 @@ actions { annotations: "@sai_action(SAI_PACKET_ACTION_DROP)" } } -actions { - preamble { - id: 16777238 - name: "ingress.tunnel_termination_lookup.mark_for_tunnel_decap_and_set_vrf" - alias: "mark_for_tunnel_decap_and_set_vrf" - } - params { - id: 1 - name: "vrf_id" - type_name { - name: "vrf_id_t" - } - } -} actions { preamble { id: 16777242 @@ -1679,6 +1666,14 @@ actions { } } } +actions { + preamble { + id: 16777238 + name: "ingress.tunnel_termination.tunnel_decap" + alias: "tunnel_decap" + annotations: "@unsupported" + } +} actions { preamble { id: 16777224