[acl]: Insert new acl rule with priority in between other rules#482
[acl]: Insert new acl rule with priority in between other rules#482prsunny merged 5 commits intosonic-net:masterfrom
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
zhenggen-xu
left a comment
There was a problem hiding this comment.
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 |
lguohan
left a comment
There was a problem hiding this comment.
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.
lguohan
left a comment
There was a problem hiding this comment.
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.
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.
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
…c-net#482) * Add new test case for ACL - Rule Priority 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 * new acl test case: added a rule in between configured rules 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 * Delete test_acl.py mistakenly added this file * removing redundant code by inserting via a loop * created helper function to check proper rule config
MUX Metrics table will be used to collect metrics relevant to the MUX hardware. signed-off-by: Tamer Ahmed <[email protected]>
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