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

[202012][cherry-pick] Support port name in ACL table AttachTo attribute #13178

Open
wants to merge 2 commits into
base: 202012
Choose a base branch
from

Conversation

bingwang-ms
Copy link
Contributor

@bingwang-ms bingwang-ms commented Dec 27, 2022

Why I did it

This PR is to cherry-pick #13105 and #13444 into 202012 branch after resloving conflicts.

This PR is to update minigraph.py to support both port alias and port name as input of AttachTo attribute of ACL table.
Before this change, only port alias is supported.
Because the input string of AttachTo for ACL table can appear in both port name group and port alias group, I added a logic to determine whether the string should be port name or port alias

  1. If all the input strings belong to port name group, then we treat all of them as port name
  2. If all the input strings belong to port alias, then we treat all of them as port alias
  3. If all the input string belongs to both port alias group and port name group, we prefer port alias. The behavior is as before.

How I did it

  1. Add a global variable to store port names
  2. Search both port names and port alias wheh parsing the value of AttachTo.

How to verify it

  1. Verified by a new unit test case test_minigraph_acl_attach_to_ports
  2. Verified by copying the new minigraph.py to a testbed and run conflg load_minigraph.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211

Description for the changelog

This PR is to update minigraph.py to support both port alias and port name as input of AttachTo attribute of ACL table.

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@bingwang-ms bingwang-ms requested a review from Blueve December 27, 2022 06:45
…onic-net#13444)

Why I did it
This PR is an enhancement of PR sonic-net#13105
Because the input string of AttachTo for ACL table can appear in both port name group and port alias group, I added a logic to determine whether the string should be port name or port alias

If all the input strings belong to port name group, then we treat all of them as port name
If all the input strings belong to port alias, then we treat all of them as port alias
If all the input string belongs to both port alias group and port name group, we prefer port alias. The behavior is as before.
How I did it
Walk through all port names/alias in the input to make a decision.

How to verify it
Verified by adding UT.
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.

2 participants