diff --git a/src/bm_sim/P4Objects.cpp b/src/bm_sim/P4Objects.cpp index d11a2c20..b61ccf61 100644 --- a/src/bm_sim/P4Objects.cpp +++ b/src/bm_sim/P4Objects.cpp @@ -1920,6 +1920,12 @@ P4Objects::init_pipelines(const Json::Value &cfg_root, const auto table_type = cfg_table["type"].asString(); const auto &cfg_default_entry = cfg_table["default_entry"]; + if (!cfg_default_entry.isMember("action_id")) { + throw json_exception( + EFormat() << "'default_entry' of table '" << table_name + << "' must have key 'action_id'", + cfg_default_entry); + } const p4object_id_t action_id = cfg_default_entry["action_id"].asInt(); const ActionFn *action = get_action_by_id(action_id); assert(action); @@ -1949,15 +1955,18 @@ P4Objects::init_pipelines(const Json::Value &cfg_root, is_action_entry_const); } else { throw json_exception( - EFormat() << "'default_action' of table '" << table_name - << "' should have key 'action_data'", + EFormat() << "'default_entry' of table '" << table_name + << "' must have key 'action_data'", cfg_default_entry); } } else { - throw json_exception( - EFormat() << "Table '" << table_name << "' should have key" - << " 'default_action'", - cfg_table); + const auto table_type = cfg_table["type"].asString(); + if ((table_type != "indirect") && (table_type != "indirect_ws")) { + throw json_exception( + EFormat() << "Table '" << table_name << "' with type '" + << table_type << "' must have key" << " 'default_entry'", + cfg_table); + } } // for 'simple' tables, it is possible to specify immutable entries