From 9228147b16dbe6dd6c25a6a119e237a426815a4b Mon Sep 17 00:00:00 2001 From: prabhataravind <108555774+prabhataravind@users.noreply.github.com> Date: Tue, 27 Jun 2023 14:10:53 -0700 Subject: [PATCH] [docker-sonic-vs]: dd NPU SKU for docker-sonic-vs (#15604) Define a generic 2-port NPU SKU for docker-sonic-vs to enable DASH vstests to pass on azure pipelines Work item tracking Microsoft ADO 24375371: How I did it Define a generic 2-port NPU hwsku that is used only for DASH-specific vstests. Signed-off-by: Prabhat Aravind --- .../x86_64-kvm_x86_64-r0/NPU/sai_npu.profile | 5 ++++ platform/vs/docker-sonic-vs/Dockerfile.j2 | 1 + .../vs/docker-sonic-vs/platform-npu-2p.json | 23 +++++++++++++++++++ platform/vs/docker-sonic-vs/start.sh | 18 ++++++++++++--- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile create mode 100644 platform/vs/docker-sonic-vs/platform-npu-2p.json diff --git a/device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile b/device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile new file mode 100644 index 000000000000..ffc5d7a21103 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile @@ -0,0 +1,5 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_NPU +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 +SAI_VS_INTERFACE_FABRIC_LANE_MAP_FILE=/usr/share/sonic/hwsku/fabriclanemap.ini diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 4b356fa1a17a..bbff022601c9 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -147,6 +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 ["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/platform-npu-2p.json b/platform/vs/docker-sonic-vs/platform-npu-2p.json new file mode 100644 index 000000000000..718582b1a283 --- /dev/null +++ b/platform/vs/docker-sonic-vs/platform-npu-2p.json @@ -0,0 +1,23 @@ +{ + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1", + "lanes": "0,1,2,3", + "breakout_modes": { + "1x100G": ["etp1"], + "1x100G[50G,40G,25G,10G]": ["etp1"], + "2x50G[25G,10G]": ["etp1a", "etp1b"], + "4x10G[25G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + } + }, + "Ethernet4": { + "index": "2,2,2,2", + "lanes": "4,5,6,7", + "breakout_modes": { + "1x100G": ["etp2"], + "1x100G[50G,40G,25G,10G]": ["etp2"], + "2x50G[25G,10G]": ["etp2a", "etp2b"] + } + } + } +} diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 9911c1bfe011..59c05ed4eabf 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -8,6 +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 +PLATFORM_CONF=platform.json +if [[ $HWSKU == "NPU-2P" ]]; then + PLATFORM_CONF=platform-npu-2p.json +fi + pushd /usr/share/sonic/hwsku # filter available front panel ports in lanemap.ini @@ -45,9 +50,14 @@ if [ -f /etc/sonic/config_db.json ]; then mv /tmp/config_db.json /etc/sonic/config_db.json else # generate and merge buffers configuration into config file - sonic-cfggen -k $HWSKU -p /usr/share/sonic/device/$PLATFORM/platform.json -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json - sonic-cfggen -j /etc/sonic/init_cfg.json -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json - sonic-cfggen -p /usr/share/sonic/device/$PLATFORM/platform.json -k $HWSKU --print-data > /tmp/ports.json + 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 + 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 + 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 @@ -56,6 +66,8 @@ sonic-cfggen -t /usr/share/sonic/templates/copp_cfg.j2 > /etc/sonic/copp_cfg.jso 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 fi mkdir -p /etc/swss/config.d/