[acl] Refactor port OID retrieval into aclorch #1462
Merged
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.
Signed-off-by: Danny Allen [email protected]
What I did
I moved getAclBindPortId from portsorch to aclorch.
Why I did it
This serves two purposes:
There was a bug wherein AclTable::update would fail to handle port deletion events because the getAclBindPortId method lived in portsorch. Because this method was using the provided alias to get the OID internally, this method would fail in the delete case because the port had already been deleted from portsorch. As a result, all delete events would fail and print a "Unable to retrieve OID" method. This was caught by the
test_po_update
pytest because it deletes the PortChannel at the end of the test case, which triggers a delete event, which triggers this bug.The behavior implemented in this method is specific to the ACL implementation in SONiC, and it doesn't really make sense to include it in the more generic AclOrch. Furthermore, we have access to all the port info in AclOrch, so there is no need to take a dependency on PortsOrch to fetch the port OID info and perform the parsing logic. There was a
TODO
indicating the same.How I verified it
test_po_update
passes in the master image now. I also re-ran theacl
andeverflow
tests and everything looks good to go.Details if related
Fixes sonic-net/sonic-buildimage#5273