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

[acl_loader] show acl rule counter in command "show acl rule" #566

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RichardWu-Hebut
Copy link
Contributor

         When showing acl rule, add the ACL rule counter in the
         command output

Signed-off-by: Richard Wu wutong23@baidu.com

- What I did
Enhance "show acl rule" command to show the acl rule counter in the command output
- How I did it
Get the acl rule counter info from COUNTER DB

- How to verify it
Set acl rule, send traffic to match the acl rule, and run the command "show acl rule" to check whether the counter info is correct.

- Previous command output (if the output of a command-line utility has changed)
root@switch2:/usr/lib/python2.7/dist-packages/acl_loader# show acl rule

Table Rule Priority Action Match


data-aclv4 ICMP 2000 FORWARD IP_PROTOCOL: 0x01

data-aclv4 IGMP 1900 FORWARD IP_PROTOCOL: 0x02

data-aclv4 ARP 1800 DROP ETHER_TYPE: 0x0806

- New command output (if the output of a command-line utility has changed)
root@switch2:/usr/lib/python2.7/dist-packages/acl_loader# show acl rule

Table Rule Priority Action Match Packets Bytes


data-aclv4 ICMP 2000 FORWARD IP_PROTOCOL: 0x01 1000 128000

data-aclv4 IGMP 1900 FORWARD IP_PROTOCOL: 0x02 0 0

data-aclv4 ARP 1800 DROP ETHER_TYPE: 0x0806 0 0

             When showing acl rule, add the ACL rule counter in the
             command output

Signed-off-by: Richard Wu <wutong23@baidu.com>
Copy link
Contributor

@stcheng stcheng left a comment

Choose a reason for hiding this comment

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

thanks for adding this


ignore_list = ["PRIORITY", "PACKET_ACTION", "MIRROR_ACTION"]

counter_db = SonicV2Connector(host="127.0.0.1")
counter_db.connect(counter_db.COUNTERS_DB)

Copy link
Contributor

Choose a reason for hiding this comment

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

could you move these two lines to below? right above the part you add the counter querying logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean move those two lines above the "counter_db.get_all", right? If yes, then it will re-create a socket with Redis DB for each ACL rule. IMO, it is not a good way, as we can use just one socket to get the counters for all ACL rules, no need to create connection with Redis DB again and again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants