Skip to content

Add fixtures to call dpus on smartswtich directly#15695

Merged
bingwang-ms merged 3 commits intosonic-net:masterfrom
JibinBao:infra_ss_operate_dpu
Dec 17, 2024
Merged

Add fixtures to call dpus on smartswtich directly#15695
bingwang-ms merged 3 commits intosonic-net:masterfrom
JibinBao:infra_ss_operate_dpu

Conversation

@JibinBao
Copy link
Copy Markdown
Contributor

Description of PR

The mgmt IP of dpus on smartswitch is private IP(169.254.200.0/24), we cannot access it directly out of the switch. To operate dpu like operating switch when impmenting the test case(dash, platform on dup), we add two fixtures: dpuhost and fixture_dpuhosts. They are same as duthost and fixture_duthosts.
Before the calling the fixtures, we need to do the steps as follows:

  1. Enable the NAT configuation on SmartSwitch by running sonic-dpu-mgmt-traffic.sh
    [SmartSwitch] Added inbound traffic capability for DPU management traffic script sonic-buildimage#20635
    e.g.

sonic-dpu-mgmt-traffic.sh inbound -e --dpus all --ports 5021,5022,5023,5024

  1. Add dpu information to ansible/inventory(Notes: the ansible_ssh_port should be same as the above config of NAT)
    e.g.

smartswtich-01 ansible_host=10.200.100.2 sonic_version=v2 sonic_hwsku=Mellanox-SN4280-O28 switch_type="switch"....
smartswtich-01-dpu-0 ansible_host=10.200.100.2 ansible_ssh_port=5021 sonic_version=v2 sonic_hwsku=Nvidia-bf3-
com-dpu switch_type="dpu" ....
smartswtich-01-dpu-1 ansible_host=10.200.100.2 ansible_ssh_port=5022 sonic_version=v2 sonic_hwsku=Nvidia-bf3-
com-dpu switch_type="dpu" ....
smartswtich-01-dpu-2 ansible_host=10.200.100.2 ansible_ssh_port=5023 sonic_version=v2 sonic_hwsku=Nvidia-bf3-
com-dpu switch_type="dpu" ....
smartswtich-01-dpu-3 ansible_host=10.200.100.2 ansible_ssh_port=5024 sonic_version=v2 sonic_hwsku=Nvidia-bf3-
com-dpu switch_type="dpu" ....

  1. Add dpu information to ansible/testbed.yaml
    e.g.
  • conf-name: smartswtich-01-t1-28-lag
    group-name: vm-t2
    topo: t1-28-lag
    ptf_image_name: docker-ptf-mlnx
    ptf: ptf-smartswtich-01
    ptf_ip: 10.200.100.12/24
    ptf_ipv6:
    server: server_72
    vm_base: VM3701
    dut:
    • smartswtich-01
    • smartswtich-01-dpu-0
    • smartswtich-01-dpu-1
    • smartswtich-01-dpu-2
    • smartswtich-01-dpu-3
      comment: smartswitch testbed
  1. Add dpu infromation to ansible/lab

smartswtich-01-dpu-0 ansible_host=10.200.100.2 ansible_ssh_port=5021 ansible_hostv6="fe80::966d:aeff:fe04:1f58" sonic_version=v2 hwsku="Nvidia-bf3-com-dpu" iface_speed=100000 mgmt_subnet_mask_length=22 vm_base=VM0000
smartswtich-01-dpu-1 ansible_host=10.200.100.2 ansible_ssh_port=5022 ansible_hostv6="fe80::966d:aeff:fe04:1f58" sonic_version=v2 hwsku="Nvidia-bf3-com-dpu" iface_speed=100000 mgmt_subnet_mask_length=22 vm_base=VM0000
smartswtich-01-dpu-2 ansible_host=10.200.100.2 ansible_ssh_port=5023 ansible_hostv6="fe80::966d:aeff:fe04:1f58" sonic_version=v2 hwsku="Nvidia-bf3-com-dpu" iface_speed=100000 mgmt_subnet_mask_length=22 vm_base=VM0000
smartswtich-01-dpu-3 ansible_host=10.200.100.2 ansible_ssh_port=5024 ansible_hostv6="fe80::966d:aeff:fe04:1f58" sonic_version=v2 hwsku="Nvidia-bf3-com-dpu" iface_speed=100000 mgmt_subnet_mask_length=22 vm_base=VM0000

So, we can access the dpu directly out of switch such as "ssh admin@10.200.100.2 -p 5021"

Run tests usage:
When runing case only on dpu(For the exsiting tests such as platform, techsupport, we can run them without any case change):

python3 -m pytest platform_tests/cli/test_show_platform.py --testbed smartswitch-01-t1-28-lag --host-pattern smartswitch-01-dpu-0 ....

When running case on smartswitch(NPU) and dpu:

python3 -m pytest dash/test_dash_privatelink.py --testbed smartswitch-01-t1-28-lag --host-pattern smartswitch-01 --dpu-pattern smartswitch-01-dpu-0,smartswitch-01-dpu-1,smartswitch-01-dpu-2,smartswitch-01-dpu-3 .....

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

Add fixtures to operate dup directly out of switch like operating switch

How did you do it?

Add fixures : duthost and fixture_duthosts

How did you verify/test it?

run platform case on dpu only and dash case on smartswitch

Any platform specific information?

SmartSwtich

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

Documentation

@JibinBao JibinBao changed the title Add two fixtures dpuhosts and fixture_dpuhosts for calling dpu on sma… Add fixtures to call dpus on smartswtich directly Nov 22, 2024
@prabhataravind
Copy link
Copy Markdown
Contributor

prabhataravind commented Nov 27, 2024

@nissampa @rameshraghupathy for viz

@JibinBao
Copy link
Copy Markdown
Contributor Author

JibinBao commented Dec 3, 2024

Hi @theasianpianist , Can you please review the reply?

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@JibinBao JibinBao force-pushed the infra_ss_operate_dpu branch from 9606cbb to 92e1a77 Compare December 13, 2024 09:25
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

1. remove dut with dpu string, otherwise when add topo, we don't need to add topo for dpu
2. remove space for duts, otherwise it when using echo to create fail will fail
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@JibinBao
Copy link
Copy Markdown
Contributor Author

The commit of update testbed-cli.sh is to resove the following issues:

  1. remove dpu dut, because it will affect adding topo for NPU
  2. remove space from duts, because when the dut string includes space, using echo to create a file will fail.

Copy link
Copy Markdown
Contributor

@theasianpianist theasianpianist left a comment

Choose a reason for hiding this comment

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

this will be great to have, 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.

7 participants