From 456adc32a9c86ed9b727e71227b3b2bd5b0a85a3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 1 Sep 2020 13:52:29 -0700 Subject: [PATCH] [docker-sonic-vs] Create /usr/share/sonic/platform symlink (#5268) Copying platform.json file into an empty /usr/share/sonic/platform directory does not mimic an actual device. A more correct approach is to create a /usr/share/sonic/platform symlink which links to the actual platform directory; this is more like what is done inside SONiC containers. Then, we only need to copy the platform.json file into the actual platform directory; the symlink takes care of the alternative path, and also exposes all the other files in the platform directory. --- platform/vs/docker-sonic-vs/Dockerfile.j2 | 1 - platform/vs/docker-sonic-vs/start.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 8a764960f1..b6dde0b9f8 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -136,7 +136,6 @@ COPY ["chassis_db.py", "/usr/bin/"] 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 ["platform.json", "/usr/share/sonic/platform/"] # Workaround the tcpdump issue RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index d7ff9920fb..95c24ae371 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -5,6 +5,7 @@ # NOTE: 'PLATFORM' and 'HWSKU' environment variables are set # in the Dockerfile so that they persist for the life of the container +ln -sf /usr/share/sonic/device/$PLATFORM /usr/share/sonic/platform ln -sf /usr/share/sonic/device/$PLATFORM/$HWSKU /usr/share/sonic/hwsku pushd /usr/share/sonic/hwsku