p4-utils
p4-utils copied to clipboard
a table without keys
I have a table without keys, and I try to down some entries for it through sswitch_thrift_API.SimpleSwitchThriftAPI.table_add
.Unfortunately, thrift_API.SwitchInfo.load_json_str
could not load the table. Could you give me some advice? Thanks a lot!
What do you want to add if there are no keys? You can only have a default action no? Or can you explain a bit more what are you trying to do?
This is my definition of table.
table swid { actions = { set_swid; NoAction; } default_action=NoAction(); }
the action set_swid
tries to set switch id for each device. And I want to down the switch id.
But if you have no keys, the only way to make that action to be "executed" is by setting it as default. Thus, table_add
can not be used with keyless tables, you need to match to something.
Thanks for your reply.
I made some fixes in my thrift_API.SwitchInfo.load_json_str
to make it work for this case. I think it is reasonable. Because even if I set it as default, I need the control plane to add parameters. But at this time, the key is redundant. This behavior is supported in CLI. So if the official will support this kind of table in the future?
By the way, I think you are right. I do need to modify my definition of table.