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 update command enhancement #1287

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

Conversation

vishnushetty
Copy link

- What I did
Added incremental update for datapath acl.
To support backward incremental effect use 'load' command. Now three options for update:

full (add/delete)
incremental (add/delete/update)
load (add/update)

And fixed python3 (cmp not available).

- How I did it

- How to verify it
root@sonic:# config acl add table MYTESTACL l3
root@sonic:
# config acl update full acl_rule_1_2.json
root@sonic:~# show acl rule
Table Rule Priority Action Match


MYTESTACL RULE_1 9999 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.1/32
MYTESTACL RULE_2 9998 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.2/32
MYTESTACL DEFAULT_RULE 1 DROP ETHER_TYPE: 2048
root@sonic:# config acl update incremental acl_rule_1_4.json
root@sonic:
# show acl rule
Table Rule Priority Action Match


MYTESTACL RULE_1 9999 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.1/32
MYTESTACL RULE_2 9998 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.2/32
MYTESTACL RULE_3 9997 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.3/32
MYTESTACL RULE_4 9996 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.4/32
MYTESTACL DEFAULT_RULE 1 DROP ETHER_TYPE: 2048
root@sonic:# config acl update load acl_rule_1_4.json
root@sonic:
# show acl rule
Table Rule Priority Action Match


MYTESTACL RULE_1 9999 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.1/32
MYTESTACL RULE_2 9998 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.2/32
MYTESTACL RULE_3 9997 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.3/32
MYTESTACL RULE_4 9996 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.4/32
MYTESTACL DEFAULT_RULE 1 DROP ETHER_TYPE: 2048
root@sonic:#
- Previous command output (if the output of a command-line utility has changed)
root@sonic:
# config acl add table MYTESTACL l3
root@sonic:# config acl update full acl_rule_1_2.json
root@sonic:
# show acl rule
Table Rule Priority Action Match


MYTESTACL RULE_1 9999 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.1/32
MYTESTACL RULE_2 9998 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.2/32
MYTESTACL DEFAULT_RULE 1 DROP ETHER_TYPE: 2048
root@sonic:# config acl update incremental acl_rule_1_4.json
root@sonic:
# show acl rule
Table Rule Priority Action Match


MYTESTACL RULE_1 9999 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.1/32
MYTESTACL RULE_2 9998 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.2/32
MYTESTACL RULE_3 9997 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.3/32
MYTESTACL RULE_4 9996 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.4/32
MYTESTACL DEFAULT_RULE 1 DROP ETHER_TYPE: 2048
root@sonic:~
- New command output (if the output of a command-line utility has changed)
oot@sonic:# config acl update load acl_rule_1_4.json
root@sonic:
# show acl rule
Table Rule Priority Action Match


MYTESTACL RULE_1 9999 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.1/32
MYTESTACL RULE_2 9998 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.2/32
MYTESTACL RULE_3 9997 FORWARD IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.3/32
MYTESTACL RULE_4 9996 DROP IP_PROTOCOL: 6
L4_DST_PORT: 22
SRC_IP: 192.168.1.4/32
MYTESTACL DEFAULT_RULE 1 DROP ETHER_TYPE: 2048

@ghost
Copy link

ghost commented Dec 3, 2020

CLA assistant check
All CLA requirements met.

@ben-gale
Copy link
Collaborator

@lguohan - can we get some review pls?

@ben-gale
Copy link
Collaborator

@lgouhan - pls help with review of this one

@lguohan
Copy link
Contributor

lguohan commented Jan 29, 2021

please add unit test

@ben-gale
Copy link
Collaborator

please add unit test

@lguohan - there are no existing Click unit tests for ACL loader - the only tests there are API-based UTs on the AclLoader class, and these are pretty minimal. As discussed in the past, I'm not sure how reasonable it is to ask contributors to take on the load of a full UT catch-up when adding a small change to an existing component w/o existing UT coverage. So what are you looking for here please? Thx.

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

Successfully merging this pull request may close these issues.

3 participants