From 0c09131b816a197cb7f176bb4e43f3d7583eb68d Mon Sep 17 00:00:00 2001 From: nnelluri-cisco Date: Mon, 23 Dec 2024 14:55:24 -0800 Subject: [PATCH] Summary:New smartswitch DPU config template --- ansible/config_sonic_basedon_testbed.yml | 10 +++ ansible/lab | 40 ++++++++++++ ansible/templates/dpu_config.j2 | 80 ++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 ansible/templates/dpu_config.j2 diff --git a/ansible/config_sonic_basedon_testbed.yml b/ansible/config_sonic_basedon_testbed.yml index 44ab5a3e1a0..a6323ccb1a4 100644 --- a/ansible/config_sonic_basedon_testbed.yml +++ b/ansible/config_sonic_basedon_testbed.yml @@ -702,6 +702,16 @@ shell: bash "/etc/sonic/apply_clet.sh" when: stat_result.stat.exists is defined and stat_result.stat.exists + - block: + - name: create dpu config file for SONiC device + template: src=templates/dpu_config.j2 + dest=/etc/sonic/dpu_config.json + become: true + + - name: active dpu config + become: true + shell: sonic-cfggen -j /etc/sonic/dpu_config.json -w + - block: - name: create isis config file for SONiC device template: src=templates/isis_config.j2 diff --git a/ansible/lab b/ansible/lab index 7308519349a..716b79de67e 100644 --- a/ansible/lab +++ b/ansible/lab @@ -234,3 +234,43 @@ sonic_cisco_vs: hwsku: cisco-8101-p4-32x100-vs ansible_host: 10.250.0.125 ansible_hostv6: fec0::ffff:afa:13 + +sonic_cisco_smartswitch: + vars: + hwsku: Cisco-8102-28FH-DPU-O-T1 + dpu_username: admin + iface_speed: 400000 + num_asics: 1 + plt_reboot_dict: + acl/test_acl.py::TestAclWithReboot: + timeout: 540 + wait: 660 + + midplane_network: + bridge_name: "bridge-midplane" + bridge_address: "169.254.200.254/24" + + device_metadata: + localhost: + subtype: "SmartSwitch" + + feature: + dhcp_server: + auto_restart: "enabled" + state: "enabled" + dhcp_relay: + auto_restart: "enabled" + state: "enabled" + + mid_plane_bridge: + global: + bridge: "bridge-midplane" + ip_prefix: "169.254.200.254/24" + + dhcp_server_ipv4: + bridge-midplane: + gateway: "169.254.200.254" + lease_time: "600000000" + mode: "PORT" + netmask: "255.255.255.0" + state: "enabled" diff --git a/ansible/templates/dpu_config.j2 b/ansible/templates/dpu_config.j2 new file mode 100644 index 00000000000..a5e138007b7 --- /dev/null +++ b/ansible/templates/dpu_config.j2 @@ -0,0 +1,80 @@ +{ + "CHASSIS_MODULE": { + {% for dpu in range(8) -%} + "DPU{{ dpu }}": { + "admin_status": "up" + }{% if not loop.last %},{% endif %} + {%- endfor %} + + }, + "midplane_network": { + "bridge_name": "{{ midplane_network.bridge_name }}", + "bridge_address": "{{ midplane_network.bridge_address }}" + }, + "DEVICE_METADATA": { + "localhost": { + "subtype": "{{ device_metadata.localhost.subtype }}" + } + }, + "FEATURE": { + "dhcp_server": { + "auto_restart": "{{ feature.dhcp_server.auto_restart }}", + "state": "{{ feature.dhcp_server.state }}" + }, + "dhcp_relay": { + "auto_restart": "{{ feature.dhcp_relay.auto_restart }}", + "state": "{{ feature.dhcp_relay.state }}" + } + }, + "MID_PLANE_BRIDGE": { + "GLOBAL": { + "bridge": "{{ mid_plane_bridge.global.bridge }}", + "ip_prefix": "{{ mid_plane_bridge.global.ip_prefix }}" + } + }, + "DHCP_SERVER_IPV4": { + "{{ midplane_network.bridge_name }}": { + "gateway": "{{ dhcp_server_ipv4[midplane_network.bridge_name].gateway }}", + "lease_time": "{{ dhcp_server_ipv4[midplane_network.bridge_name].lease_time }}", + "mode": "{{ dhcp_server_ipv4[midplane_network.bridge_name].mode }}", + "netmask": "{{ dhcp_server_ipv4[midplane_network.bridge_name].netmask }}", + "state": "{{ dhcp_server_ipv4[midplane_network.bridge_name].state }}" + + } + }, + "DHCP_SERVER_IPV4_PORT": { + {% for dpu in range(8) -%} + "{{ midplane_network.bridge_name }}|dpu{{ dpu }}": { + "ips": [ + "{{ '169.254.200.' ~ dpu }}" + ] + }{% if not loop.last %},{% endif %} + {%- endfor %} + + }, + "DPUS": { + {% for dpu in range(8) -%} + "dpu{{ dpu }}": { + "midplane_interface": "dpu{{ dpu }}" + }{% if not loop.last %},{% endif %} + {%- endfor %} + + }, + "INTERFACE": { + {% for i in range(8) -%} + "Ethernet-BP{{ i }}": {}, + "Ethernet-BP{{ i }}|18.{{ i }}.202.0/31": {}{% if not loop.last %}, + {% endif %} + {%- endfor %} + + }, + "PORT": { + {% for dpu in range(8) -%} + "Ethernet-BP{{ dpu }}": { + "admin_status": "up" + }{% if not loop.last %},{% endif %} + {%- endfor %} + + } + +}