How to Implement Ranges in P4-Runtime_sh?

I am trying to implement ranges in my p4 runtime shell but am unable to do so. Here is one short example which really want to do with some fields from a header named custom and contains those fields.

(main.p4)
table l2_exact_table {
key = {
hdr.Custom.arrival_time: range;
}
(P4-runtime-sh)
te = table_entry’IngressPipeImpl.l2_exact_table’
te.match[‘hdr.Custom.arrival_time’] = (‘196’, ‘255’)
te.action[‘port_num’] = ‘3’
te.insert()

i know this might be the wrong approach, but i would be very grateful if anyone can guide me about it.
thank you,

Here is a working example code snippet from a published PTF test I have written called matchkinds.py: p4-guide/ptf-tests/matchkinds/matchkinds.py at master · jafingerhut/p4-guide · GitHub

To the field te.match['my_field_name'] you must assign a string that is of the form “<min_value>…<max_value>”, with two dots between the values.

In the special case that min_value is 0 and max_value is the maximum possible value for the field, e.g. 255 for an 8-bit field, you must not assign anything to te.match['my_field_name'] at all, or else the P4Runtime server will return an error.

1 Like