4040#include " google/protobuf/repeated_field.h"
4141#include " google/protobuf/repeated_ptr_field.h"
4242#include " gutil/collections.h"
43+ #include " gutil/ordered_map.h"
4344#include " gutil/proto.h"
4445#include " gutil/status.h"
4546#include " lib/p4rt/p4rt_port.h"
5354#include " p4_fuzzer/switch_state.h"
5455#include " p4_pdpi/built_ins.h"
5556#include " p4_pdpi/entity_keys.h"
56- #include " p4_pdpi/internal/ordered_map.h"
5757#include " p4_pdpi/ir.pb.h"
5858#include " p4_pdpi/netaddr/ipv6_address.h"
5959#include " p4_pdpi/references.h"
@@ -65,6 +65,7 @@ namespace p4_fuzzer {
6565using ::absl::gntohll;
6666
6767using ::absl::Uniform;
68+ using ::gutil::AsOrderedView;
6869using ::p4::v1::Action;
6970using ::p4::v1::Entity;
7071using ::p4::v1::FieldMatch;
@@ -566,7 +567,7 @@ std::vector<uint32_t> GetMandatoryMatchTableIds(const FuzzerConfig& config) {
566567 std::vector<uint32_t > table_ids;
567568
568569 for (const IrTableDefinition& table : AllValidTablesForP4RtRole (config)) {
569- for (auto & [match_id, match] : Ordered (table.match_fields_by_id ())) {
570+ for (auto & [match_id, match] : AsOrderedView (table.match_fields_by_id ())) {
570571 if (match.match_field ().match_type () ==
571572 p4::config::v1::MatchField::EXACT) {
572573 table_ids.push_back (table.preamble ().id ());
@@ -582,7 +583,7 @@ std::vector<uint32_t> GetMandatoryMatchTableIds(const FuzzerConfig& config) {
582583std::vector<uint32_t > GetDifferentRoleTableIds (const FuzzerConfig& config) {
583584 std::vector<uint32_t > table_ids;
584585
585- for (auto & [key, table] : Ordered (config.GetIrP4Info ().tables_by_id ())) {
586+ for (auto & [key, table] : AsOrderedView (config.GetIrP4Info ().tables_by_id ())) {
586587 if (table.role () == config.GetRole ()) continue ;
587588 table_ids.push_back (key);
588589 }
@@ -1016,7 +1017,7 @@ struct VariableWithReferences {
10161017absl::StatusOr<p4::config::v1::ActionProfile> GetActionProfile (
10171018 const pdpi::IrP4Info& ir_info, int table_id) {
10181019 for (const auto & [id, action_profile_definition] :
1019- Ordered (ir_info.action_profiles_by_id ())) {
1020+ AsOrderedView (ir_info.action_profiles_by_id ())) {
10201021 if (action_profile_definition.has_action_profile ()) {
10211022 // Does the action profile apply to the given table?
10221023 auto & action_profile = action_profile_definition.action_profile ();
@@ -1034,7 +1035,7 @@ const std::vector<IrTableDefinition> AllValidTablesForP4RtRole(
10341035 const FuzzerConfig& config) {
10351036 std::vector<IrTableDefinition> tables;
10361037
1037- for (auto & [key, table] : Ordered (config.GetIrP4Info ().tables_by_id ())) {
1038+ for (auto & [key, table] : AsOrderedView (config.GetIrP4Info ().tables_by_id ())) {
10381039 // Tables with the wrong role can't be modified by the controller.
10391040 if (table.role () != config.GetRole ()) continue ;
10401041 // Tables without actions cannot have valid table entries.
@@ -1070,7 +1071,7 @@ const std::vector<pdpi::IrMatchFieldDefinition> AllValidMatchFields(
10701071 std::vector<pdpi::IrMatchFieldDefinition> match_fields;
10711072
10721073 for (const auto & [_, match_field_info] :
1073- Ordered (table.match_fields_by_id ())) {
1074+ AsOrderedView (table.match_fields_by_id ())) {
10741075 // Skip deprecated, unused, and disallowed fields.
10751076 const absl::StatusOr<std::string> fully_qualified_match_field =
10761077 GetFullyQualifiedMatchFieldName (table, match_field_info);
@@ -1366,7 +1367,7 @@ absl::StatusOr<p4::v1::Action> FuzzAction(
13661367 action.set_action_id (ir_action_info.preamble ().id ());
13671368
13681369 for (auto & [param_name, ir_param] :
1369- Ordered (ir_action_info.params_by_name ())) {
1370+ AsOrderedView (ir_action_info.params_by_name ())) {
13701371 p4::v1::Action::Param* param = action.add_params ();
13711372 param->set_param_id (ir_param.param ().id ());
13721373 ASSIGN_OR_RETURN (
0 commit comments