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

[xcvrd] Introduce regex style keys in media_settings for setting up port configuration in xcvrd #417

Closed
wants to merge 4 commits into from

Conversation

vdahiya12
Copy link
Contributor

@vdahiya12 vdahiya12 commented Dec 22, 2023

Description

This PR introduces a new way of specifying keys in media_settings file in a regex format. This way port settings will be applied to ports specified in GLOBAL_MEDIA_PATTERN_SETTINGS key in the media_settings.json key and whichever port vendor key matches the regex format key, they will be configured with params specified for that key.
If None of the keys match, default settings if any will be applied as in GLOBAL_MEDIA_SETTINGS or PORT_MEDIA_SETTINGS.

{
    "GLOBAL_MEDIA_PATTERN_SETTINGS": {
        "1-32": {
            "^QSFP28+\\.*10G.*SR.*": {
                   "interface_type": "sr4"

            },
            "^QSFP\\+.*40G.*": {
                   "interface_type": "sr4"

            },
            "QSFP\\+.*100GBASE-LR4.*": {
                   "interface_type": "sr4"

            }

        }
    }
}

Motivation and Context

How Has This Been Tested?

UT and testing on a sonic-mgmt Testbed

Additional Information (Optional)

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 vdahiya12 requested a review from prgeor December 22, 2023 20:38

for dkey, val in media_dict.items():
if re.match(dkey, key[1]):
return media_dict[key[1]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vdahiya12 dkey = "^QSFP28+\.*10G.SR.", then the return should be media_dict["^QSFP28+\.*10G.SR."]
need to return media_dict[dkey] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added suggestion

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@prgeor
Copy link
Collaborator

prgeor commented Dec 30, 2023

@vdahiya12
Copy link
Contributor Author

hi @keboliu @Junchao-Mellanox can you review the change ?

@StormLiangMS
Copy link

hi @vdahiya12 this one more like an enhancement, what's the justification to have this into 202305?

@lguohan
Copy link
Contributor

lguohan commented Jan 4, 2024

we should not accept this into 202305, @vdahiya12 , as we discussed, please do not backport this into 202305.

@vdahiya12
Copy link
Contributor Author

as discussed will add in master for now

@vdahiya12 vdahiya12 closed this Jan 4, 2024
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.

4 participants