-
Notifications
You must be signed in to change notification settings - Fork 549
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
Combine v4 and v6 L3 ACL rules on optimized platforms #1267 #2735
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import pytest | ||
from requests import request | ||
|
||
L3V4V6_TABLE_TYPE = "L3V4V6" | ||
L3V4V6_TABLE_NAME = "L3_V4V6_TEST" | ||
L3V4V6_BIND_PORTS = ["Ethernet0", "Ethernet4", "Ethernet8"] | ||
L3V4V6_RULE_NAME = "L3V4V6_TEST_RULE" | ||
|
||
class TestAcl: | ||
@pytest.fixture | ||
def l3v4v6_acl_table(self, dvs_acl): | ||
try: | ||
dvs_acl.create_acl_table(L3V4V6_TABLE_NAME, | ||
L3V4V6_TABLE_TYPE, | ||
L3V4V6_BIND_PORTS) | ||
yield dvs_acl.get_acl_table_ids(1)[0] | ||
finally: | ||
dvs_acl.remove_acl_table(L3V4V6_TABLE_NAME) | ||
dvs_acl.verify_acl_table_count(0) | ||
|
||
@pytest.fixture | ||
def setup_teardown_neighbor(self, dvs): | ||
try: | ||
# NOTE: set_interface_status has a dependency on cdb within dvs, | ||
# so we still need to setup the db. This should be refactored. | ||
dvs.setup_db() | ||
|
||
# Bring up an IP interface with a neighbor | ||
dvs.set_interface_status("Ethernet4", "up") | ||
dvs.add_ip_address("Ethernet4", "10.0.0.1/24") | ||
dvs.add_neighbor("Ethernet4", "10.0.0.2", "00:01:02:03:04:05") | ||
|
||
yield dvs.get_asic_db().wait_for_n_keys("ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP", 1)[0] | ||
finally: | ||
# Clean up the IP interface and neighbor | ||
dvs.remove_neighbor("Ethernet4", "10.0.0.2") | ||
dvs.remove_ip_address("Ethernet4", "10.0.0.1/24") | ||
dvs.set_interface_status("Ethernet4", "down") | ||
|
||
def test_L3V4V6AclTableCreationDeletion(self, dvs_acl): | ||
try: | ||
dvs_acl.create_acl_table(L3V4V6_TABLE_NAME, L3V4V6_TABLE_TYPE, L3V4V6_BIND_PORTS) | ||
|
||
acl_table_id = dvs_acl.get_acl_table_ids(1)[0] | ||
acl_table_group_ids = dvs_acl.get_acl_table_group_ids(len(L3V4V6_BIND_PORTS)) | ||
|
||
dvs_acl.verify_acl_table_group_members(acl_table_id, acl_table_group_ids, 1) | ||
dvs_acl.verify_acl_table_port_binding(acl_table_id, L3V4V6_BIND_PORTS, 1) | ||
# Verify status is written into STATE_DB | ||
dvs_acl.verify_acl_table_status(L3V4V6_TABLE_NAME, "Active") | ||
finally: | ||
dvs_acl.remove_acl_table(L3V4V6_TABLE_NAME) | ||
dvs_acl.verify_acl_table_count(0) | ||
# Verify the STATE_DB entry is removed | ||
dvs_acl.verify_acl_table_status(L3V4V6_TABLE_NAME, None) | ||
|
||
def test_ValidAclRuleCreation_sip_dip(self, dvs_acl, l3v4v6_acl_table): | ||
config_qualifiers = {"DST_IP": "20.0.0.1/32", | ||
"SRC_IP": "10.0.0.0/32"}; | ||
|
||
dvs_acl.create_acl_rule(L3V4V6_TABLE_NAME, "VALID_RULE", config_qualifiers) | ||
# Verify status is written into STATE_DB | ||
dvs_acl.verify_acl_rule_status(L3V4V6_TABLE_NAME, "VALID_RULE", "Active") | ||
|
||
dvs_acl.remove_acl_rule(L3V4V6_TABLE_NAME, "VALID_RULE") | ||
# Verify the STATE_DB entry is removed | ||
dvs_acl.verify_acl_rule_status(L3V4V6_TABLE_NAME, "VALID_RULE", None) | ||
dvs_acl.verify_no_acl_rules() | ||
|
||
def test_InvalidAclRuleCreation_sip_sipv6(self, dvs_acl, l3v4v6_acl_table): | ||
config_qualifiers = {"SRC_IPV6": "2777::0/64", | ||
"SRC_IP": "10.0.0.0/32"}; | ||
|
||
dvs_acl.create_acl_rule(L3V4V6_TABLE_NAME, "INVALID_RULE", config_qualifiers) | ||
# Verify status is written into STATE_DB | ||
dvs_acl.verify_acl_rule_status(L3V4V6_TABLE_NAME, "INVALID_RULE", "Inactive") | ||
|
||
dvs_acl.remove_acl_rule(L3V4V6_TABLE_NAME, "INVALID_RULE") | ||
# Verify the STATE_DB entry is removed | ||
dvs_acl.verify_acl_rule_status(L3V4V6_TABLE_NAME, "INVALID_RULE", None) | ||
dvs_acl.verify_no_acl_rules() | ||
|
||
def test_InvalidAclRuleCreation_dip_sipv6(self, dvs_acl, l3v4v6_acl_table): | ||
config_qualifiers = {"SRC_IPV6": "2777::0/64", | ||
"DST_IP": "10.0.0.0/32"}; | ||
|
||
dvs_acl.create_acl_rule(L3V4V6_TABLE_NAME, "INVALID_RULE", config_qualifiers) | ||
# Verify status is written into STATE_DB | ||
dvs_acl.verify_acl_rule_status(L3V4V6_TABLE_NAME, "INVALID_RULE", "Inactive") | ||
|
||
dvs_acl.remove_acl_rule(L3V4V6_TABLE_NAME, "INVALID_RULE") | ||
# Verify the STATE_DB entry is removed | ||
dvs_acl.verify_acl_rule_status(L3V4V6_TABLE_NAME, "INVALID_RULE", None) | ||
dvs_acl.verify_no_acl_rules() | ||
|
||
# Add Dummy always-pass test at end as workaroud | ||
# for issue when Flaky fail on final test it invokes module tear-down before retrying | ||
def test_nonflaky_dummy(): | ||
pass |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change VS platform to combined? Does it impact any current acl tests? @bingwang-ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the change to VS makes no difference. AFAIK, We don't run acl test on VS. But even though, I think it doesn't make sense to change the behavior of VS. I suggest removing the change to VS_PLATFORM. @rck-innovium
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bingwang-ms
After removing the VS platform, I ran the tests that create ACL tables of the new L3V4V6 type and saw that the ACL table creation fails.
The reason for the error is that the VS platform does NOT support the new ACL table type L3V4V6.
@prsunny
This change does not affect any other existing ACL features since this capability check is used only for the newly introduced ACL table type L3V4V6. Also, I verified that all the current swss ACL tests pass as well as PTF test_acl.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rck-innovium Probably we can mock the platform by setting
DVS_FAKE_PLATFORM
. Please search in existing test code.Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bingwang-ms
I was not able to find DVS_FAKE_PLATFORM in existing swss test code
marvell@cpss-testvm2:
/rck/sonic-dbg/sonic-buildimage/src/sonic-swss$ grep -ir DVS_FAKE_PLATFORM */rck/sonic-dbg/sonic-buildimage/src/sonic-swss$ grep -r FAKE_PLATFORM *marvell@cpss-testvm2:
marvell@cpss-testvm2:
/rck/sonic-dbg/sonic-buildimage/src/sonic-swss$ cd ../rck/sonic-dbg/sonic-buildimage/src$ grep -r DVS_FAKE_PLATFORM *marvell@cpss-testvm2:
marvell@cpss-testvm2:~/rck/sonic-dbg/sonic-buildimage/src$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rck-innovium Sorry for the misleading. I just realize that the
DVS_FAKE_PLATFORM
has been removed from the latest testing code. I don't know if we have other method to mock the platform string. @prsunny Any suggestions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prsunny @bingwang-ms
DVS_FAKE_PLATFORM has been removed from the entire SONiC codebase and in SWSS it has been replaced with DVS_ENV.
I digged through the past versions of SONiC to find that Nvidia has changed DVS_FAKE_PLATFORM to DVS_ENV = ["HWSKU=Mellanox-SN2700"]. The reason I presume is to support mimicking at a deeper HwSKU level instead of just the platform.
However, I see in today’s swss/tests, only Mellanox-SN2700 SKU is being faked. In fact, I ran into several issues when faking Marvell and Innovium platforms.
I have raised PR #2785 to track the issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prsunny
Coming back to the original question, the new checks do NOT affect any other feature since this capability check is only used by the new L3V4V6 ACL table feature.
So adding VS platform does not have any impact on any of the existing feature.