Skip to content

Reading Direct Counter Value #40

@johnhauhnar

Description

@johnhauhnar

Hi,
I was trying out this tutorial specifically the one explained in "EXERCISE-1.md"
I was able to send ping packet between the hosts after programming the table entries from P4 Runtime shell.

Then I tried reading the counter values, but I could not seem to do so..
Can you quickly point me how to read the direct/in-direct counter from p4runtime shell?

Below is the logs of my attempt to read the counter values:

P4Runtime sh >>> direct_counters
acl_table_counter
l2_exact_table_counter
l2_ternary_table_counter
my_station_table_counter
ndp_reply_table_counter
routing_v6_table_counter

P4Runtime sh >>> direct_counters["acl_table_counter"]
Out[6]:
preamble {
id: 318773822
name: "acl_table_counter"
alias: "acl_table_counter"
}
spec {
unit: BOTH
}
direct_table_id: 33557865 ("IngressPipeImpl.acl_table")

P4Runtime sh >>> direct_counter_entry["acl_table_counter"]
Out[7]:
table_entry {
table_id: 33557865 ("IngressPipeImpl.acl_table")
}

P4Runtime sh >>> for dce in direct_counter_entry["acl_table_counter"].read:
...: print(dce)
...:

TypeError Traceback (most recent call last)
in
----> 1 for dce in direct_counter_entry["acl_table_counter"].read:
2 print(dce)
3

TypeError: 'method' object is not iterable

P4Runtime sh >>> dce = direct_counter_entry["acl_table_counter"].read()

P4Runtime sh >>> print dce
<p4runtime_sh.shell._EntityBase.read.._EntryIterator object at 0x7f66241b0208>

P4Runtime sh >>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions