Skip to content

Commit c660463

Browse files
committed
Throw JSON error if table lacks a default_action key, or action_data
Signed-off-by: Andy Fingerhut <[email protected]>
1 parent 2834e72 commit c660463

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/bm_sim/P4Objects.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,17 @@ P4Objects::init_pipelines(const Json::Value &cfg_root,
19471947

19481948
table->set_default_default_entry(action, std::move(adata),
19491949
is_action_entry_const);
1950+
} else {
1951+
throw json_exception(
1952+
EFormat() << "'default_action' of table '" << table_name
1953+
<< "' should have key 'action_data'",
1954+
cfg_default_entry);
19501955
}
1956+
} else {
1957+
throw json_exception(
1958+
EFormat() << "Table '" << table_name << "' should have key"
1959+
<< " 'default_action'",
1960+
cfg_table);
19511961
}
19521962

19531963
// for 'simple' tables, it is possible to specify immutable entries

0 commit comments

Comments
 (0)