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

sonic-utilities : CLICK support to add/delete rules in openconfig format #2523

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ArthiGovindaraj
Copy link

What I did

Changes in existing acl CLICK command to handle cases of rule addition/deletion:

  • Existing CLICK command "config acl remove table <table_name>" doesn't remove the rules in config db. Only the ACL tables are deleted in hardware whereas the rules remain in config_db. We need to explicitly call "acl-loader delete to delete the rules from config_db". Modified the python script to delete the rules by calling "acl-loader delete" when deleting the table.
  • CLICK Support for adding rules using json file in dataplane acl using "config acl add rule
  • CLICK Support for deleting rule using table_name rule_name using "config acl remove rule <table_name> <rule_name>"

Existing CLICK commands "config acl update full/incremental", both delete all the existing acl rules and add the new rules. There is no option for adding new rules to the dataplane ACL table. Similarly, there is no provision to remove a single rule from acl table using CLICK commands.

How I did it

  • Remove table => Handling rule deletion as well when deleting the tables.
    In config/main.py script, "config acl remove table" included the cli command "acl-loader delete " also. This ensures that rules are also cleared when table is deleted.
  • Support for add rule command
  • Added new "acl-loader add <filename.json>", this handles adding/updating existing rules and other existing rules are not disturbed using this command. From CLICK, command "config acl add rule <.json>" invokes the acl-loader add and does the rule addition.
  • Delete a given rule using tablename and rulename. New CLICK command "config acl remove rule " added in config/main.py which invokes existing "acl-loader delete " to handle single rule deletion.

How to verify it

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)

#config acl add rule acl_src_ipv4.json
#config acl remove rule DATAACL RULE_2
#config acl remove table DATAACL

UT file attached.

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

…mat using acl-loader

* Support for adding rules using json file in dataplane acl using
 "config acl add rule <filename>
* Support for deleting rule using table_name rule_name using
 "config acl delete rule <table_name> <rule_name>"
@lgtm-com
Copy link

lgtm-com bot commented Nov 24, 2022

This pull request introduces 1 alert when merging 580c7a5 into addae73 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@ArthiGovindaraj
Copy link
Author

This pull request introduces 1 alert when merging 580c7a5 into addae73 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

Addressed

@ArthiGovindaraj
Copy link
Author

Closed by mistake. Reopening.

@ArthiGovindaraj ArthiGovindaraj marked this pull request as draft November 25, 2022 06:47
@ArthiGovindaraj ArthiGovindaraj marked this pull request as ready for review November 30, 2022 08:33
@ArthiGovindaraj ArthiGovindaraj marked this pull request as draft December 5, 2022 14:15
@ArthiGovindaraj ArthiGovindaraj marked this pull request as ready for review December 5, 2022 14:15
@ArthiGovindaraj
Copy link
Author

Hi, Can anyone review this pull request and give your feedback.

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.

None yet

1 participant