diff --git a/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/hwsku.json b/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/hwsku.json new file mode 100644 index 000000000000..caf6d7ed37b4 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/hwsku.json @@ -0,0 +1,10 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x100G" + }, + "Ethernet4": { + "default_brkout_mode": "1x100G" + } + } +} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/port_config.ini new file mode 100644 index 000000000000..1c163d89f7bf --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/port_config.ini @@ -0,0 +1,3 @@ +# name lanes alias index +Ethernet0 0,1,2,3 etp1 1 +Ethernet4 4,5,6,7 etp2 2 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile b/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/sai_dpu_2p.profile similarity index 83% rename from device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile rename to device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/sai_dpu_2p.profile index ffc5d7a21103..bb429eb4c552 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile +++ b/device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/sai_dpu_2p.profile @@ -1,4 +1,4 @@ -SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_NPU +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_DPU_SIMU_2P SAI_VS_HOSTIF_USE_TAP_DEVICE=true SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini SAI_VS_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index bbff022601c9..6d495ae5679b 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -147,7 +147,7 @@ COPY ["zero_profiles.json", "/etc/sonic"] COPY ["buffermgrd.sh", "/usr/bin/"] COPY ["platform.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"] -COPY ["platform-npu-2p.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"] +COPY ["platform-dpu-2p.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"] diff --git a/platform/vs/docker-sonic-vs/init_cfg.json.j2 b/platform/vs/docker-sonic-vs/init_cfg.json.j2 index 418c9b871338..6f1eb65aa3dc 100644 --- a/platform/vs/docker-sonic-vs/init_cfg.json.j2 +++ b/platform/vs/docker-sonic-vs/init_cfg.json.j2 @@ -2,16 +2,20 @@ "DEVICE_METADATA": { "localhost": { "mac": "{{ system_mac }}", + "switch_type": "{{ switch_type }}", "buffer_model": "traditional" } }, -{% set features = ["swss", "bgp", "teamd", "nat", "database", "lldp", "dhcp_relay", "macsec"] %} +{% if switch_type != "dpu" %} +{% set features = ({"swss": "enabled", "bgp": "enabled", "teamd": "enabled", "nat": "enabled", "database": "enabled", "lldp": "enabled", "dhcp_relay": "enabled", "macsec": "enabled"}) %} +{% else %} +{% set features = ({"swss": "enabled", "bgp": "enabled", "teamd": "disabled", "nat": "disabled", "database": "enabled", "lldp": "enabled", "dhcp_relay": "disabled", "macsec": "disabled"}) %} +{% endif %} "FEATURE": { -{% for feature in features %} +{% for feature, state in features.items() %} "{{ feature }}": { - "state": "enabled" + "state": "{{ state }}" }{% if not loop.last %},{% endif %} {% endfor %} } } - diff --git a/platform/vs/docker-sonic-vs/platform-npu-2p.json b/platform/vs/docker-sonic-vs/platform-dpu-2p.json similarity index 100% rename from platform/vs/docker-sonic-vs/platform-npu-2p.json rename to platform/vs/docker-sonic-vs/platform-dpu-2p.json diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 59c05ed4eabf..5e3497850e61 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -8,9 +8,11 @@ ln -sf /usr/share/sonic/device/$PLATFORM /usr/share/sonic/platform ln -sf /usr/share/sonic/device/$PLATFORM/$HWSKU /usr/share/sonic/hwsku +SWITCH_TYPE=switch PLATFORM_CONF=platform.json -if [[ $HWSKU == "NPU-2P" ]]; then - PLATFORM_CONF=platform-npu-2p.json +if [[ $HWSKU == "DPU-2P" ]]; then + SWITCH_TYPE=dpu + PLATFORM_CONF=platform-dpu-2p.json fi pushd /usr/share/sonic/hwsku @@ -38,7 +40,7 @@ mkdir -p /var/run/redis/sonic-db cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db/ SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') -sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\"}" > /etc/sonic/init_cfg.json +sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\", \"switch_type\": \"$SWITCH_TYPE\"}" > /etc/sonic/init_cfg.json if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/virtual_chassis/default_config.json --print-data > /tmp/init_cfg.json @@ -52,22 +54,25 @@ else # generate and merge buffers configuration into config file if [ -f /usr/share/sonic/hwsku/buffers.json.j2 ]; then sonic-cfggen -k $HWSKU -p /usr/share/sonic/device/$PLATFORM/$PLATFORM_CONF -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json + buffers_cmd="-j /tmp/buffers.json" fi if [ -f /usr/share/sonic/hwsku/qos.json.j2 ]; then sonic-cfggen -j /etc/sonic/init_cfg.json -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json + qos_cmd="-j /tmp/qos.json" fi sonic-cfggen -p /usr/share/sonic/device/$PLATFORM/$PLATFORM_CONF -k $HWSKU --print-data > /tmp/ports.json # change admin_status from up to down; Test cases dependent sed -i "s/up/down/g" /tmp/ports.json - sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json -j /tmp/qos.json -j /tmp/ports.json --print-data > /etc/sonic/config_db.json + sonic-cfggen -j /etc/sonic/init_cfg.json $buffers_cmd $qos_cmd -j /tmp/ports.json --print-data > /etc/sonic/config_db.json fi + sonic-cfggen -t /usr/share/sonic/templates/copp_cfg.j2 > /etc/sonic/copp_cfg.json if [ "$HWSKU" == "Mellanox-SN2700" ]; then cp /usr/share/sonic/hwsku/sai_mlnx.profile /usr/share/sonic/hwsku/sai.profile -elif [ "$HWSKU" == "NPU" ]; then - cp /usr/share/sonic/hwsku/sai_npu.profile /usr/share/sonic/hwsku/sai.profile +elif [ "$HWSKU" == "DPU-2P" ]; then + cp /usr/share/sonic/hwsku/sai_dpu_2p.profile /usr/share/sonic/hwsku/sai.profile fi mkdir -p /etc/swss/config.d/