[show] invalid acl table output with single port#1498
Open
d-dashkov wants to merge 1 commit intosonic-net:masterfrom
Open
[show] invalid acl table output with single port#1498d-dashkov wants to merge 1 commit intosonic-net:masterfrom
d-dashkov wants to merge 1 commit intosonic-net:masterfrom
Conversation
Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
daall
reviewed
Mar 23, 2021
Contributor
daall
left a comment
There was a problem hiding this comment.
See question. Also, please add a new unit test case(s) to tests/acl_loader_test.py.
| data.append([key, val["type"], "", val["policy_desc"], stage]) | ||
| else: | ||
| ports = natsorted(val["ports"]) | ||
| if isinstance(val['ports'], str): |
Contributor
There was a problem hiding this comment.
Have you tried the case where "ports" is a comma-separated string like "Ethernet0,Ethernet1,..."? Does this come back as a string or a list?
Contributor
Author
There was a problem hiding this comment.
@daall
I`ve tried cases with different acl command and they all work fine:
#sudo config acl add table test_1 L3 -p Ethernet0,Ethernet4 -s ingress
"test_1": {
"policy_desc": "Mirror Session",
"ports": [
"Ethernet0",
"Ethernet4"
],
"stage": "INGRESS",
"type": "MIRROR"
}
#sudo config acl add table test_2 L3 -p "Ethernet0,Ethernet4" -s ingress
"test_2": {
"policy_desc": "Mirror Session",
"ports": [
"Ethernet0",
"Ethernet4"
],
"stage": "INGRESS",
"type": "MIRROR"
}
#sudo config acl add table test_single L3 -p Ethernet0 -s ingress
"test_single": {
"policy_desc": "Mirror Session",
"ports": [
"Ethernet0"
],
"stage": "INGRESS",
"type": "MIRROR"
}
This bug happens only when I manually write the wrong value in config db.json, as this stated in issue(instead of list, write single str port)
"1": {
"stage": "INGRESS",
"type": "MIRROR",
"policy_desc": "Mirror Session",
"ports": "Ethernet16" <= incorrect value
}
stepanblyschak
pushed a commit
to stepanblyschak/sonic-utilities
that referenced
this pull request
Apr 28, 2022
7f50b9815e14d90c02d9dce63fd08d90e25cee3f (HEAD -> 201911, origin/201911) handled update() function of fdb orchagent for FDB FLUSH event (sonic-net#1534) 17adc13b6ca21846fe27c94d6a16f9909c712d77 Add a check for warm-restart, and do a clear only when warm-restart is enable. (sonic-net#1498) d097260a5aa7bd611babd5062e220056374e23d8 Fixed compilation failure with debug option (sonic-net#1518) Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
Fixed the bug "Observing the binding field is not proper while executing "show acl table" command"
fixes sonic-net/SONiC#305
- How I did it
Added changes to the function show_table in acl_lader.
Added the checking of a value type for the ports. If the value is a string then we print it as is in other cases we split and sort the values.
- How to verify it
Follow the description in the bug.
1.Create an acl :
- Previous command output (if the output of a command-line utility has changed)
- New command output (if the output of a command-line utility has changed)