Skip to content

Commit

Permalink
table data parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Dec 6, 2023
1 parent 108d90f commit 940a8da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dash-pipeline/SAI/sai_api_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __init__(self):
self.actions = []
self.action_params = []
self.with_counters = 'false'
self.stage = ""
self.stage = None
self.is_object = None

def _parse_p4rt(self, p4rt_table, program, all_actions, ignore_tables):
Expand Down Expand Up @@ -555,8 +555,8 @@ def write_sai_files(sai_api):
for line in lines:
if 'Add new experimental entries above this line' in line:
for table in sai_api[TABLES_TAG]:
if table['is_object'] == 'false':
new_line = ' sai_' + table[NAME_TAG] + '_t ' + table[NAME_TAG] + ';\n'
if table.is_object == 'false':
new_line = ' sai_' + table.name + '_t ' + table.name + ';\n'
if new_line not in lines:
new_lines.append(' /** @validonly object_type == SAI_OBJECT_TYPE_' + table[NAME_TAG].upper() + ' */\n')
new_lines.append(new_line + '\n')
Expand Down
4 changes: 2 additions & 2 deletions dash-pipeline/SAI/templates/saiapi.cpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static sai_status_t dash_sai_create_{{ table.name }}(
{% for group_item in tables%}
{% if group_item.name != table.name %}{% continue %}{% endif %}
{% set table = group_item %}
{% if 'stage' in table %}
{% if table.stage != None %}
// For stage {{ table.stage }}
{% endif %}
matchActionEntry = std::make_shared<p4::v1::TableEntry>();
Expand Down Expand Up @@ -413,7 +413,7 @@ static sai_status_t dash_sai_create_{{ table.name }}(

switch(attr_list[i].id)
{
{% for param in table.actionParams %}
{% for param in table.action_params %}
{% if param.skipattr == 'true' %}
{% else %}
case SAI_{{ table.name | upper }}_ATTR_{{ param.name | upper }}:
Expand Down
2 changes: 1 addition & 1 deletion dash-pipeline/SAI/templates/saiapi.h.j2
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ typedef enum _sai_{{ table.name }}_attr_t
{% endfor %}
{% endif %}
{% endif %}
{% for param in table.actionParams %}
{% for param in table.action_params %}
{% if param.skipattr == 'true' %}
{% else %}
/**
Expand Down

0 comments on commit 940a8da

Please sign in to comment.