-
Notifications
You must be signed in to change notification settings - Fork 664
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
[GCU]Remove GCU unique lane check for duplicate lanes platforms #2343
Changes from 4 commits
72b8249
1c4096b
c30e05f
8eab6fa
34bfc37
1f6d114
6cb3a8c
7fb2c37
b1f7c3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,8 @@ def validate_config_db_config(self, config_db_as_json): | |
# TODO: Move these validators to YANG models | ||
supplemental_yang_validators = [self.validate_bgp_peer_group, | ||
self.validate_lanes] | ||
validators_params = [(config_db_as_json,), | ||
(config_db_as_json, False)] | ||
|
||
try: | ||
tmp_config_db_as_json = copy.deepcopy(config_db_as_json) | ||
|
@@ -124,16 +126,17 @@ def validate_config_db_config(self, config_db_as_json): | |
|
||
sy.validate_data_tree() | ||
|
||
for supplemental_yang_validator in supplemental_yang_validators: | ||
success, error = supplemental_yang_validator(config_db_as_json) | ||
for supplemental_yang_validator, validator_params in \ | ||
zip(supplemental_yang_validators, validators_params): | ||
success, error = supplemental_yang_validator(*validator_params) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if not success: | ||
return success, error | ||
except sonic_yang.SonicYangException as ex: | ||
return False, ex | ||
|
||
return True, None | ||
|
||
def validate_lanes(self, config_db): | ||
def validate_lanes(self, config_db, unique_lanes=True): | ||
if "PORT" not in config_db: | ||
return True, None | ||
|
||
|
@@ -154,14 +157,15 @@ def validate_lanes(self, config_db): | |
return False, f"PORT '{port}' has an invalid lane '{lane}'" | ||
port_to_lanes_map[port] = lanes | ||
|
||
# Validate lanes are unique | ||
existing = {} | ||
for port in port_to_lanes_map: | ||
lanes = port_to_lanes_map[port] | ||
for lane in lanes: | ||
if lane in existing: | ||
return False, f"'{lane}' lane is used multiple times in PORT: {set([port, existing[lane]])}" | ||
existing[lane] = port | ||
if unique_lanes: | ||
# Validate lanes are unique | ||
existing = {} | ||
for port in port_to_lanes_map: | ||
lanes = port_to_lanes_map[port] | ||
for lane in lanes: | ||
if lane in existing: | ||
return False, f"'{lane}' lane is used multiple times in PORT: {set([port, existing[lane]])}" | ||
existing[lane] = port | ||
return True, None | ||
|
||
def validate_bgp_peer_group(self, config_db): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6157,4 +6157,4 @@ | |
] | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3034,6 +3034,9 @@ def test_patch_sorter_success(self): | |
data = Files.PATCH_SORTER_TEST_SUCCESS | ||
skip_exact_change_list_match = False | ||
for test_case_name in data: | ||
# DPB_1_TO_4__SUCCESS will fail when unique_lanes is set to False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can check above sorting output here #2343 (comment) |
||
if test_case_name == "DPB_1_TO_4__SUCCESS": | ||
continue | ||
with self.subTest(name=test_case_name): | ||
self.run_single_success_case(data[test_case_name], skip_exact_change_list_match) | ||
|
||
|
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.