Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update used psabpf library for PTF tests (PSA/eBPF) #3261

Merged
merged 2 commits into from
May 2, 2022

Conversation

tatry
Copy link
Contributor

@tatry tatry commented Apr 28, 2022

It adds support, compared to earlier version, for:

  • DirectMeter;
  • DirectCounter;
  • set default action;
  • get table entry (limited to single entry for table without implementation).

CC: @osinstom @kmateuszssak

It adds support, compared to earlier version, for:
- DirectMeter;
- DirectCounter;
- set default action;
- get table entry (limited to single entry without implementation).
cmd = "psabpf-ctl table get pipe {} {} ".format(TEST_PIPELINE_ID, table)
if indirect:
# TODO: cmd = cmd + "ref "
self.fail("support for indirect table not supported yet")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove one "support"

_, stdout, _ = self.exec_ns_cmd(cmd, "Table get entry failed")
return json.loads(stdout)[table]

def table_verify(self, table, keys, action=0, priority=None, data=None, references=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these functions could use a documentation """

if priority:
cmd = cmd + "priority {}".format(priority)
self.exec_ns_cmd(cmd, "Table {} failed".format(method))

def table_add(self, table, keys, action=0, data=None, priority=None, references=None):
def table_add(self, table, keys, action=0, data=None, priority=None, references=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you considered adding type annotation to your python?
I find they help a lot with readability.
So actions are encoded as integers? I wonder whether p4info could be used to use action symbolic names.

Copy link
Contributor Author

@tatry tatry Apr 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you considered adding type annotation to your python? I find they help a lot with readability.

At some point of time I had an idea to add that annotations, but I abandoned it. I don't remember why.

EDIT: For now I would keep as is.

So actions are encoded as integers? I wonder whether p4info could be used to use action symbolic names.

Yes, exactly, actions are encoded as integers. We decided that p4info can't be used at the level of psabpf[-cli], so every think what we can comes from BTF side. DirectCounters and DirectMeters are recognized by name, so for actions it should be also possible, but is not implemented yet.

@osinstom
Copy link
Contributor

osinstom commented May 2, 2022

@mbudiu-vmw can we merge this?

@mihaibudiu mihaibudiu merged commit cac88d8 into p4lang:main May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants