[docker-sonic-vs]: More changes to support DPU-2P HWKSU (#15695)
Why I did it port_config.ini and hwsku.json are needed to generate the default config switch_type needs to be "dpu" to spawn the right set of processes during dvs initialization and to make sure that DASH APIs can be handled properly Work item tracking Microsoft ADO 24375371: How I did it Use the same hwsku.json and port_config.ini for DPU-2P as the ones used for Nvidia-MBF2H536C SKU in nvidia-sonic sonic-buildimage repo. Set switch_type to "dpu" in DEVICE_METADATA configuration to make sure DASH specific APIs are handled properly Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
This commit is contained in:
parent
75a1fd9558
commit
114f276dd4
10
device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/hwsku.json
Normal file
10
device/virtual/x86_64-kvm_x86_64-r0/DPU-2P/hwsku.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"interfaces": {
|
||||||
|
"Ethernet0": {
|
||||||
|
"default_brkout_mode": "1x100G"
|
||||||
|
},
|
||||||
|
"Ethernet4": {
|
||||||
|
"default_brkout_mode": "1x100G"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
# name lanes alias index
|
||||||
|
Ethernet0 0,1,2,3 etp1 1
|
||||||
|
Ethernet4 4,5,6,7 etp2 2
|
@ -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_HOSTIF_USE_TAP_DEVICE=true
|
||||||
SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini
|
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_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini
|
@ -147,7 +147,7 @@ COPY ["zero_profiles.json", "/etc/sonic"]
|
|||||||
COPY ["buffermgrd.sh", "/usr/bin/"]
|
COPY ["buffermgrd.sh", "/usr/bin/"]
|
||||||
|
|
||||||
COPY ["platform.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"]
|
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/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/brcm_gearbox_vs/"]
|
||||||
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"]
|
COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"]
|
||||||
|
@ -2,16 +2,20 @@
|
|||||||
"DEVICE_METADATA": {
|
"DEVICE_METADATA": {
|
||||||
"localhost": {
|
"localhost": {
|
||||||
"mac": "{{ system_mac }}",
|
"mac": "{{ system_mac }}",
|
||||||
|
"switch_type": "{{ switch_type }}",
|
||||||
"buffer_model": "traditional"
|
"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": {
|
"FEATURE": {
|
||||||
{% for feature in features %}
|
{% for feature, state in features.items() %}
|
||||||
"{{ feature }}": {
|
"{{ feature }}": {
|
||||||
"state": "enabled"
|
"state": "{{ state }}"
|
||||||
}{% if not loop.last %},{% endif %}
|
}{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,9 +8,11 @@
|
|||||||
ln -sf /usr/share/sonic/device/$PLATFORM /usr/share/sonic/platform
|
ln -sf /usr/share/sonic/device/$PLATFORM /usr/share/sonic/platform
|
||||||
ln -sf /usr/share/sonic/device/$PLATFORM/$HWSKU /usr/share/sonic/hwsku
|
ln -sf /usr/share/sonic/device/$PLATFORM/$HWSKU /usr/share/sonic/hwsku
|
||||||
|
|
||||||
|
SWITCH_TYPE=switch
|
||||||
PLATFORM_CONF=platform.json
|
PLATFORM_CONF=platform.json
|
||||||
if [[ $HWSKU == "NPU-2P" ]]; then
|
if [[ $HWSKU == "DPU-2P" ]]; then
|
||||||
PLATFORM_CONF=platform-npu-2p.json
|
SWITCH_TYPE=dpu
|
||||||
|
PLATFORM_CONF=platform-dpu-2p.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd /usr/share/sonic/hwsku
|
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/
|
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}')
|
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
|
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
|
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
|
# generate and merge buffers configuration into config file
|
||||||
if [ -f /usr/share/sonic/hwsku/buffers.json.j2 ]; then
|
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
|
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
|
fi
|
||||||
if [ -f /usr/share/sonic/hwsku/qos.json.j2 ]; then
|
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
|
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
|
fi
|
||||||
|
|
||||||
sonic-cfggen -p /usr/share/sonic/device/$PLATFORM/$PLATFORM_CONF -k $HWSKU --print-data > /tmp/ports.json
|
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
|
# change admin_status from up to down; Test cases dependent
|
||||||
sed -i "s/up/down/g" /tmp/ports.json
|
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
|
fi
|
||||||
|
|
||||||
sonic-cfggen -t /usr/share/sonic/templates/copp_cfg.j2 > /etc/sonic/copp_cfg.json
|
sonic-cfggen -t /usr/share/sonic/templates/copp_cfg.j2 > /etc/sonic/copp_cfg.json
|
||||||
|
|
||||||
if [ "$HWSKU" == "Mellanox-SN2700" ]; then
|
if [ "$HWSKU" == "Mellanox-SN2700" ]; then
|
||||||
cp /usr/share/sonic/hwsku/sai_mlnx.profile /usr/share/sonic/hwsku/sai.profile
|
cp /usr/share/sonic/hwsku/sai_mlnx.profile /usr/share/sonic/hwsku/sai.profile
|
||||||
elif [ "$HWSKU" == "NPU" ]; then
|
elif [ "$HWSKU" == "DPU-2P" ]; then
|
||||||
cp /usr/share/sonic/hwsku/sai_npu.profile /usr/share/sonic/hwsku/sai.profile
|
cp /usr/share/sonic/hwsku/sai_dpu_2p.profile /usr/share/sonic/hwsku/sai.profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /etc/swss/config.d/
|
mkdir -p /etc/swss/config.d/
|
||||||
|
Loading…
Reference in New Issue
Block a user