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/main.py]: Use get to fetch key 'ports'. #932

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

Conversation

praveen-li
Copy link
Member

With if condition, always get must be used otherwise code will never receive None.

Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com

- What I did
Use get instead of []. With if condition, always get must be used otherwise code will never receive None.

- How I did it
Use get instead of [].

- How to verify it

root@fec26aa9f1be:/praveen# sonic-cfggen -d --print-data | grep -A 10 -B 5 NO-NSW-PACL-TEST
{
    "ACL_TABLE": {
        "NO-NSW-PACL-TEST": {
            "policy_desc": "NO-NSW-PACL-TEST",
            "ports": [
                ""
            ],
            "type": "L3"
        }
    },

root@fec26aa9f1be:/praveen# show acl table
Name              Type    Binding    Description       Stage
----------------  ------  ---------  ----------------  -------
NO-NSW-PACL-TEST  L3                 NO-NSW-PACL-TEST  ingress

- 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)

Reason:show command must work even when Ports does not exist in ACL_TABLE.

Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
@praveen-li
Copy link
Member Author

@lguohan @jleveque

I think We should merge this simple fix, we are comparing val["ports"] against the None, whereas val["ports"] never returns None.

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

Successfully merging this pull request may close these issues.

1 participant