Skip to content

Commit

Permalink
Make a Merge() call allow not-yet-recognized new fields in P4Info fil…
Browse files Browse the repository at this point in the history
…es (#132)

Make a Merge() call allow not-yet-recognized new fields in P4Info files
This is helpful when p4c adds new P4Info fields to the P4Info files it
generates, but the consumers have not yet all been updated to
recognize them.  The most recent example of this in 2024-Aug is the
initial_default_action field of Table messages.

Signed-off-by: Andy Fingerhut <[email protected]>
  • Loading branch information
jafingerhut authored Sep 3, 2024
1 parent 8869f64 commit 82094bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p4runtime_sh/p4runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def set_fwd_pipe_config(self, p4info_path, bin_path):
with open(p4info_path, 'r') as f1:
with open(bin_path, 'rb') as f2:
try:
google.protobuf.text_format.Merge(f1.read(), req.config.p4info)
google.protobuf.text_format.Merge(f1.read(), req.config.p4info,
allow_unknown_field=True)
except google.protobuf.text_format.ParseError:
logging.error("Error when parsing P4Info")
raise
Expand Down

0 comments on commit 82094bd

Please sign in to comment.