Skip to content

[ha][ssw] remove hardcoded devicename and loopback config#22736

Open
zjswhhh wants to merge 2 commits intosonic-net:masterfrom
zjswhhh:public_hardcoded_loopback
Open

[ha][ssw] remove hardcoded devicename and loopback config#22736
zjswhhh wants to merge 2 commits intosonic-net:masterfrom
zjswhhh:public_hardcoded_loopback

Conversation

@zjswhhh
Copy link
Contributor

@zjswhhh zjswhhh commented Mar 4, 2026

Description of PR

Summary:
Fixes # (issue)

Instead of hardcoding the device name and loopback addresses, get it from topo file.

sign-off: Jing Zhang zhangjing@microsoft.com

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

Approach

What is the motivation for this PR?

Otherwise every time we run ha tests, the device name and loopback will be changed.

How did you do it?

Get the information from tbinfo instead of hard coded it.

How did you verify/test it?

I ran a dummy test with the fixture, checked the json files generated under /tmp, loopback addresses and device names are accurate on both DUTs.

Any platform specific information?

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

Documentation

Signed-off-by: Jing Zhang <zhangjing@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zjswhhh zjswhhh requested review from aronovic and dypet March 4, 2026 23:03
@zjswhhh zjswhhh requested a review from yue-fred-gao March 4, 2026 23:03
@zjswhhh zjswhhh added smartswitch-ha Label for tracking smartswitch HA related changes Request for 202511 branch Request to backport a change to 202511 branch labels Mar 4, 2026
loopback_v6 = topo_dut["loopback"]["ipv6"][switch_id]

# VLAN SVI per DUT
svi_ip = "20.0.200.14/28" if switch_id == 0 else "20.0.201.14/28"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also remove those hardcoded IP addresses?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @aronovic - these VLAN IPs are actually identical for all testbeds, plus we don't have it defined in topo file or testbed file, so might have to hard code it for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

def generate_ha_config_for_dut(switch_id: int, duthost, tbinfo):
"""
switch_id 0 FOR DUT01
switch_id 1 FOR DUT02
Copy link
Contributor

Choose a reason for hiding this comment

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

Where will the hostname come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's from testbed.yml iirc.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

Copy link
Contributor

@aronovic aronovic left a comment

Choose a reason for hiding this comment

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

Looks good.

@zjswhhh
Copy link
Contributor Author

zjswhhh commented Mar 5, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zjswhhh
Copy link
Contributor Author

zjswhhh commented Mar 6, 2026

/azp run Azure.sonic-mgmt

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Request for 202511 branch Request to backport a change to 202511 branch smartswitch-ha Label for tracking smartswitch HA related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants