Skip to content

Commit

Permalink
[docker-sonic-vs]: dd NPU SKU for docker-sonic-vs (sonic-net#15604)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
prabhataravind authored and sonic-otn committed Sep 20, 2023
1 parent 5225cdc commit 9228147
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
5 changes: 5 additions & 0 deletions device/virtual/x86_64-kvm_x86_64-r0/NPU/sai_npu.profile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions platform/vs/docker-sonic-vs/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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/"]
Expand Down
23 changes: 23 additions & 0 deletions platform/vs/docker-sonic-vs/platform-npu-2p.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
}
18 changes: 15 additions & 3 deletions platform/vs/docker-sonic-vs/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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/
Expand Down

0 comments on commit 9228147

Please sign in to comment.