Skip to content

Fix the golden_Config_db generation for multi-asic#18652

Open
arlakshm wants to merge 2 commits intosonic-net:masterfrom
arlakshm:dev/arlakshm/fix_golden_config_db
Open

Fix the golden_Config_db generation for multi-asic#18652
arlakshm wants to merge 2 commits intosonic-net:masterfrom
arlakshm:dev/arlakshm/fix_golden_config_db

Conversation

@arlakshm
Copy link
Copy Markdown
Contributor

Description of PR

  • [ x] Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Approach

What is the motivation for this PR?

Fixes #18596

How did you do it?

Do not get the override from the running configuration. use the config generated from the minigraph instead

How did you verify/test it?

deploy-mg on multi asic platform

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@arlakshm arlakshm mentioned this pull request May 27, 2025
10 tasks
Copy link
Copy Markdown
Contributor

@YatishSVC YatishSVC left a comment

Choose a reason for hiding this comment

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

lgtm

@ysmanman
Copy link
Copy Markdown
Contributor

ysmanman commented Jun 6, 2025

Hi @arlakshm , we uncovered issues with this PR in recent testing. With the change in the PR, the member ports of PO in configDb was mistakenly set to asic port name EthX, instead of alias. E.g.,

    "PORTCHANNEL_MEMBER": {
        "PortChannel2001|Eth0": {},
        "PortChannel2003|Eth80": {}
    },

In minigraph generated by sonic-mgmt, the member port name is asic port name, e.g., EthX. The asic port name needs to be converted to correct port alias name when generating config from minigraph. However, when running sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data -n asicX alone, the port alias map is computed from configDb, instead of port_config.ini. In configDb, there is only mapping from port to its alias, e.g., EthernetX -> EthernetY/1, but no mapping from asic port name to alias. As a result, asic port name cannot be converted to the correct port alias.


return out
for asic_id in range(0, multi_asic.get_num_asics()):
rc, out, err = self.module.run_command("sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data -n asic{}".format(asic_id))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To address the issue brought up by @ysmanman , we propose the following change here:

platform = device_info.get_platform()
ini_file = "/usr/share/sonic/device/{}/{}/{}/port_config.ini".format(platform, self.hwsku, asic_id)
rc, out, err = self.module.run_command("sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data -n asic{} -p {}".format(asic_id, ini_file))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As an amendment to my previous comment, we should also check that the port_config.ini file exits (e.g. since sonic-net/sonic-buildimage#23070 removed the file on supervisors). Revised:

platform = device_info.get_platform()
cmd = "sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --print-data -n asic{}".format(asic_id)
ini_file_rc, ini_out, ini_err = self.module.run_command("test -f {}".format(ini_file))
if ini_file_rc == 0:
    cmd += " -p {}".format(ini_file)
rc, out, err = self.module.run_command(cmd)

@yejianquan
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rlhui
Copy link
Copy Markdown

rlhui commented Aug 13, 2025

@arlakshm reminder on this

@veronica-arista
Copy link
Copy Markdown
Contributor

@rlhui @arlakshm This change is needed for msft-202503 branch (we are applying it internally with the revised change I mentioned in the comments). Thanks!

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.

[multi-asic] sonic-mgmt config may be mistakenly overridden

8 participants