Skip to content

Commit 9228147

Browse files
prabhataravindsonic-otn
authored andcommitted
[docker-sonic-vs]: dd NPU SKU for docker-sonic-vs (sonic-net#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 <paravind@microsoft.com>
1 parent 5225cdc commit 9228147

4 files changed

Lines changed: 44 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_NPU
2+
SAI_VS_HOSTIF_USE_TAP_DEVICE=true
3+
SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini
4+
SAI_VS_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini
5+
SAI_VS_INTERFACE_FABRIC_LANE_MAP_FILE=/usr/share/sonic/hwsku/fabriclanemap.ini

platform/vs/docker-sonic-vs/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ COPY ["zero_profiles.json", "/etc/sonic"]
147147
COPY ["buffermgrd.sh", "/usr/bin/"]
148148

149149
COPY ["platform.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"]
150+
COPY ["platform-npu-2p.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"]
150151
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/"]
151152
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/"]
152153
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"interfaces": {
3+
"Ethernet0": {
4+
"index": "1,1,1,1",
5+
"lanes": "0,1,2,3",
6+
"breakout_modes": {
7+
"1x100G": ["etp1"],
8+
"1x100G[50G,40G,25G,10G]": ["etp1"],
9+
"2x50G[25G,10G]": ["etp1a", "etp1b"],
10+
"4x10G[25G]": ["etp1a", "etp1b", "etp1c", "etp1d"]
11+
}
12+
},
13+
"Ethernet4": {
14+
"index": "2,2,2,2",
15+
"lanes": "4,5,6,7",
16+
"breakout_modes": {
17+
"1x100G": ["etp2"],
18+
"1x100G[50G,40G,25G,10G]": ["etp2"],
19+
"2x50G[25G,10G]": ["etp2a", "etp2b"]
20+
}
21+
}
22+
}
23+
}

platform/vs/docker-sonic-vs/start.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
ln -sf /usr/share/sonic/device/$PLATFORM /usr/share/sonic/platform
99
ln -sf /usr/share/sonic/device/$PLATFORM/$HWSKU /usr/share/sonic/hwsku
1010

11+
PLATFORM_CONF=platform.json
12+
if [[ $HWSKU == "NPU-2P" ]]; then
13+
PLATFORM_CONF=platform-npu-2p.json
14+
fi
15+
1116
pushd /usr/share/sonic/hwsku
1217

1318
# filter available front panel ports in lanemap.ini
@@ -45,9 +50,14 @@ if [ -f /etc/sonic/config_db.json ]; then
4550
mv /tmp/config_db.json /etc/sonic/config_db.json
4651
else
4752
# generate and merge buffers configuration into config file
48-
sonic-cfggen -k $HWSKU -p /usr/share/sonic/device/$PLATFORM/platform.json -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json
49-
sonic-cfggen -j /etc/sonic/init_cfg.json -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json
50-
sonic-cfggen -p /usr/share/sonic/device/$PLATFORM/platform.json -k $HWSKU --print-data > /tmp/ports.json
53+
if [ -f /usr/share/sonic/hwsku/buffers.json.j2 ]; then
54+
sonic-cfggen -k $HWSKU -p /usr/share/sonic/device/$PLATFORM/$PLATFORM_CONF -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json
55+
fi
56+
if [ -f /usr/share/sonic/hwsku/qos.json.j2 ]; then
57+
sonic-cfggen -j /etc/sonic/init_cfg.json -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json
58+
fi
59+
60+
sonic-cfggen -p /usr/share/sonic/device/$PLATFORM/$PLATFORM_CONF -k $HWSKU --print-data > /tmp/ports.json
5161
# change admin_status from up to down; Test cases dependent
5262
sed -i "s/up/down/g" /tmp/ports.json
5363
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
5666

5767
if [ "$HWSKU" == "Mellanox-SN2700" ]; then
5868
cp /usr/share/sonic/hwsku/sai_mlnx.profile /usr/share/sonic/hwsku/sai.profile
69+
elif [ "$HWSKU" == "NPU" ]; then
70+
cp /usr/share/sonic/hwsku/sai_npu.profile /usr/share/sonic/hwsku/sai.profile
5971
fi
6072

6173
mkdir -p /etc/swss/config.d/

0 commit comments

Comments
 (0)