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

[hwsku] set optional fields for child ports #6660

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

Conversation

dmytroxshevchuk
Copy link
Contributor

@dmytroxshevchuk dmytroxshevchuk commented Feb 3, 2021

- Why I did it
Currently after split ports using mode in hwsku, optional parameters set only for parent ports.
Example:
if we set autoneg, fec in hwsku for Ethernet0 like this:

        "Ethernet0": {
            "default_brkout_mode": "2x100G",
            "autoneg": "off",
            "fec": "rs"
        },

config_db will be:

        "Ethernet0": {
            "alias": "Ethernet0",
            "lanes": "0,1,2,3",
            "speed": "100000",
            "index": "1",
            "admin_status": "up",
            "autoneg": "off",
            "fec": "rs",
            "mtu": "9100"
        },
        "Ethernet4": {
            "alias": "Ethernet4",
            "lanes": "4,5,6,7",
            "speed": "100000",
            "index": "1",
            "admin_status": "up",
            "mtu": "9100"
        },

Its not really correct because of we need set this parameters for all generate interfaces.
After fix, config_db will be:

        "Ethernet0": {
            "alias": "Ethernet0",
            "lanes": "0,1,2,3",
            "speed": "100000",
            "index": "1",
            "admin_status": "up",
            "autoneg": "off",
            "fec": "rs",
            "mtu": "9100"
        },
        "Ethernet4": {
            "alias": "Ethernet4",
            "lanes": "4,5,6,7",
            "speed": "100000",
            "index": "1",
            "admin_status": "up",
            "autoneg": "off",
            "fec": "rs",
            "mtu": "9100"
        },

- How I did it
Add optional fields for child ports.

- How to verify it
Add optional fields in hwsku.json and generate config_db

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@dmytroxshevchuk dmytroxshevchuk changed the title [hwsku] set optional fields for child ports WIP: [hwsku] set optional fields for child ports Feb 3, 2021
@dmytroxshevchuk dmytroxshevchuk changed the title WIP: [hwsku] set optional fields for child ports [hwsku] set optional fields for child ports Feb 3, 2021
@@ -255,7 +255,8 @@ def parse_platform_json_file(hwsku_json_file, platform_json_file):
# take optional fields from hwsku.json
for key, item in hwsku_dict[INTF_KEY][intf].items():
if key in OPTIONAL_HWSKU_ATTRIBUTES:
child_ports.get(intf)[key] = item
for child_key in child_ports.keys():
child_ports.get(child_key)[key] = item
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add a unit test for catch such error?

Copy link
Contributor Author

@dmytroxshevchuk dmytroxshevchuk Feb 8, 2021

Choose a reason for hiding this comment

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

@lguohan , done, please check

akokhan
akokhan previously approved these changes Feb 10, 2021
@dmytroxshevchuk
Copy link
Contributor Author

@lguohan , reminder for review

@dmytroxshevchuk
Copy link
Contributor Author

@lguohan please merge

@dmytroxshevchuk
Copy link
Contributor Author

@lguohan @daall @jleveque @qiluo-msft please review and merge this PR.

@lgtm-com
Copy link

lgtm-com bot commented Mar 11, 2021

This pull request introduces 1 alert when merging a788f8e243b798658c8f0c7e1dfddb78af640369 into 070b020 - view on LGTM.com

new alerts:

  • 1 for Testing equality to None

@allas-nvidia
Copy link

Can someone take a look, please?
Thanks

@dmytroxshevchuk
Copy link
Contributor Author

@lguohan, please merge

@@ -226,6 +226,16 @@ def get_child_ports(interface, breakout_mode, platform_json_file):
parent_intf_id = int(re.search("Ethernet(\d+)", interface).group(1))
for k in match_list:
offset = gen_port_config(child_ports, parent_intf_id, index, alias_list, lanes, k, offset)

if hwsku_dict is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

As mentioned in #7578 , what we really need is to enhance the design to support other fields in platform.json.

Copy link
Collaborator

@zhenggen-xu zhenggen-xu left a comment

Choose a reason for hiding this comment

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

Design change is needed.

@dmytroxshevchuk dmytroxshevchuk requested a review from a team as a code owner June 10, 2022 02:01
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.

6 participants