-
Notifications
You must be signed in to change notification settings - Fork 549
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]: Insert new acl rule with priority in between other rules #482
[acl]: Insert new acl rule with priority in between other rules #482
Conversation
New test case - I created 4 rules with priorities 10, 20, 30, 40, then I added a fifth rule with priority 21. Made sure they were all programmed correctly in the DB
I configured five rules with priorities 10, 20, 30, 40, then configured another rule with priority 21. Verified that all five rules were pushed to the ASICDB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you add a new test_acl.py file in the orchagent directory? If by accident, please remove it. Modification should be in the tests/test_acl.py only.
mistakenly added this file
Thanks for pointing it out. I have removed the extra file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you simplify the code logic by using for loop? for example, for the first four rules, can you use for loop to insert, the code are very similar. The validation code has similar issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the same check_rule_existence function you are going to write in your other PR.
tests/test_acl.py
Outdated
|
||
tbl = swsscommon.Table(db, "ACL_RULE") | ||
fvs5 = swsscommon.FieldValuePairs([("PRIORITY", "21"), ("PACKET_ACTION", "DROP"), ("ETHER_TYPE", "4660")]) | ||
tbl.set("test_insert|acl_test_rule5", fvs5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use num_rules as above for indexing instead of hard-coding to 5
tests/test_acl.py
Outdated
(status, fvs) = atbl.get(entry) | ||
assert status == True | ||
assert len(fvs) == 6 | ||
if ('SAI_ACL_ENTRY_ATTR_PRIORITY', '10') in fvs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kindly optimize this part as suggested by Guohan. As a general comment, suggest to use elif
if you are checking the same condition against different values
…sonic-net#482) * Tool to verify ASIC route entries against APPL-DB ROUTE & INTF tables * code updated per review comments
What I did
I added a new acl test case: Four ACL rules are configured with priorities 10, 20, 30, 40. Then I added another rule with priority 21. I made sure all five rules were pushed to the ASICDB and with the proper priorities.
Why I did it
Part of the ACL test cases suggested by Dell and approved by Microsoft
How I verified it
Ran the python script in the repo
Details if related
Logs are attached
insert_acl_rule_logs.txt