Skip to content

Check for comments in sai.profile lines in the test_link_local_ip.py#19989

Merged
kevinskwang merged 2 commits intosonic-net:masterfrom
rraghav-cisco:link_local_ip
Aug 8, 2025
Merged

Check for comments in sai.profile lines in the test_link_local_ip.py#19989
kevinskwang merged 2 commits intosonic-net:masterfrom
rraghav-cisco:link_local_ip

Conversation

@rraghav-cisco
Copy link
Copy Markdown
Contributor

Description of PR

Summary:
The issue is the loop at:

        sai_profile = "/usr/share/sonic/device/{}/{}/sai.profile".format(platform, hwsku)
        for line in duthost.command("cat %s" % sai_profile)["stdout_lines"]:
            key, value = line.split("=")
            sai_settings[key] = value

The check in line.split() fails if there is a comment line in the sai.profile. This PR updates the loop to ignore the comment lines and lines without a = sign.

Type of change

  • 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?

Pls see the description.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@kevinskwang kevinskwang left a comment

Choose a reason for hiding this comment

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

LGTM

@kevinskwang kevinskwang merged commit 3b6d07e into sonic-net:master Aug 8, 2025
14 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Aug 8, 2025
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #20142

mssonicbld pushed a commit that referenced this pull request Aug 8, 2025
…19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.

Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.

Signed-off-by: Yael Tzur <ytzur@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Mar 27, 2026
…onic-net#19989)

* Check the sai.profile lines for comments.

* Add to check for space before the # sign.
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.

3 participants