I worked with Intel Tofino switches and adding/changing entries in the control plane was easy.
Now I am trying to add entries in the control plane in bmv2 switch by using : ./tools/behavioral-model/tools/runtime_CLI.py file.
RuntimeCmd: table_info MyIngress.ipv4_lpm
MyIngress.ipv4_lpm [implementation=None, mk=ipv4.dstAddr(lpm, 32)]
********************************************************************************
MyIngress.drop []
MyIngress.ipv4_forward [dstAddr(48), port(9)]
NoAction []
Now I want to add values to MyIngress.ipv4_forward table but wasn’t successful.
Is there any source where I can learn control plane configuration of bmv2 switch architecture?
Any help is appreciated.
Kind regards,
Nagmat
Hi @nagmat
The syntax is table_add table_name action_name match_criteria => value
table_name = args[0]
table = self.get_res("table", table_name, ResType.table)
self.client.bm_mt_clear_entries(0, table.name, False)
def complete_table_clear(self, text, line, start_index, end_index):
return self._complete_tables(text)
@handle_bad_input
def do_table_add(self, line):
"Add entry to a match table: table_add <table name> <action name> <match fields> => <action parameters> [priority]"
args = line.split()
self.at_least_n_args(args, 3)
table_name, action_name = args[0], args[1]
table = self.get_res("table", table_name, ResType.table)
action = table.get_action(action_name)
if action is None:
raise UIn_Error(
"Table %s has no action %s" % (table_name, action_name)
1 Like
DavideS:
action_name
It worked out, Thanks!
RuntimeCmd: table_add MyIngress.ipv4_lpm MyIngress.ipv4_forward 10.0.3.0/24 => 3 3
Adding entry to lpm match table MyIngress.ipv4_lpm
match key: LPM-0a:00:03:00/24
action: MyIngress.ipv4_forward
runtime data: 00:00:00:00:00:03 00:03
Entry has been added with handle 0
nagmat
May 11, 2023, 11:41pm
4
As a follow-up to my previous question.
{
"target": "bmv2",
"p4info": "build/mri.p4.p4info.txt",
"bmv2_json": "build/mri.json",
"table_entries": [
{
"table": "MyEgress.swtrace",
"default_action": true,
"action_name": "MyEgress.add_swtrace",
"action_params": {
"swid": 1
}
},
I could add table_add MyEgress.swtrace MyEgress.add_swtrace => 1
match key:
action: MyEgress.add_swtrace
runtime data: 00:00:00:01
Entry has been added with handle 0
but couldn’t set the default_action to True
. Does anyone know how to set the default_action to True?
Kind regards,
Nagmat