[docker-sonic-vs]Added support for Mellanox-SN2700 based SKU for docker-sonic-vs (#9044)

Added support for Mellanox-SN2700 based SKU for docker-sonic-vs and to differentiate platform based on hw-sku rather than on fake_platform in VS.
Currently SAI VS library uses hwsku based SAI profile to differentiate and mock different platform implementations. The same functionality in swss is achieved using a fake_platform env variable.
Using a fake_platform has some drawbacks that the vs container appears to still use a different vendor hw-sku

env
PLATFORM=x86_64-kvm_x86_64-r0
HOSTNAME=dd21a1637723
PWD=/
HOME=/root
TERM=xterm
HWSKU=Force10-S6000
SHLVL=1
fake_platform=mellanox
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DEBIAN_FRONTEND=noninteractive
_=/usr/bin/env

In order to unify the approach at both swss and vs SAI and to be uniform throughout this PR introduces the approach of using hw-sku to differentiate different platforms. This requires support for Mellanox-SN2700 HWSKU for Mellanox platform which is also addressed by this PR.

root@23c9ba83b0aa:/# show platform summary
/bin/sh: 1: sudo: not found
Platform: x86_64-kvm_x86_64-r0
HwSKU: Mellanox-SN2700
ASIC: vs
ASIC Count: 1
Serial Number: N/A
Model Number: N/A
Hardware Revision: N/A
root@23c9ba83b0aa:/# env
PLATFORM=x86_64-kvm_x86_64-r0
HOSTNAME=23c9ba83b0aa
PWD=/
HOME=/root
TERM=xterm
HWSKU=Mellanox-SN2700
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DEBIAN_FRONTEND=noninteractive
_=/usr/bin/env
root@23c9ba83b0aa:/#

Signed-off-by: Sudharsan Dhamal Gopalarathnam <sudharsand@nvidia.com>
This commit is contained in:
Sudharsan Dhamal Gopalarathnam 2021-11-01 23:21:06 -07:00 committed by GitHub
parent fcff3f3d09
commit dd9ff10fee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -176,6 +176,7 @@ 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 ["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/"]
# Workaround the tcpdump issue # Workaround the tcpdump issue
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump

View File

@ -1,9 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ -z "$fake_platform" ]]; then #This is required since we have platform based checks in orchagent
export platform=vs #fakeplatform to be removed once swss migrates to hw-sku
else
if [ "$HWSKU" == "Mellanox-SN2700" ]; then
export platform="mellanox"
elif [ -n "$fake_platform" ]; then
export platform=$fake_platform export platform=$fake_platform
else
export platform=vs
fi fi
SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2 SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2

View File

@ -54,10 +54,15 @@ else
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
#To be removed once swss migrates to HWSKU
if [ "$fake_platform" == "mellanox" ]; then if [ "$fake_platform" == "mellanox" ]; 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
fi fi
if [ "$HWSKU" == "Mellanox-SN2700" ]; then
cp /usr/share/sonic/hwsku/sai_mlnx.profile /usr/share/sonic/hwsku/sai.profile
fi
mkdir -p /etc/swss/config.d/ mkdir -p /etc/swss/config.d/
rm -f /var/run/rsyslogd.pid rm -f /var/run/rsyslogd.pid