From 19b592b8aafdfbf9304e64e2a44e6adf870e86cf Mon Sep 17 00:00:00 2001 From: vganesan-nokia <67648637+vganesan-nokia@users.noreply.github.com> Date: Wed, 2 Dec 2020 13:31:43 -0500 Subject: [PATCH] [vstest]VS test for VOQ System ports (#5862) Changes for supporting vstest for VOQ system ports. The changes include: (1)Use of chassis_db.json is avoided since the SYSTEM_PORT is made available in virtual chassis linecard's default_config.json which will be loaded during bootup (2)Core port index map file is introduced and is copied from virtual chassis directory to hwsku direcory by start.sh (3)vs sai profile is modified to include core port index map file name Signed-off-by: vedganes --- platform/vs/docker-sonic-vs/Dockerfile.j2 | 1 - platform/vs/docker-sonic-vs/chassis_db.py | 13 ------------- platform/vs/docker-sonic-vs/database_config.json | 2 +- platform/vs/docker-sonic-vs/start.sh | 6 +++++- src/sonic-device-data/src/sai.vs_profile | 1 + 5 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 platform/vs/docker-sonic-vs/chassis_db.py diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index d51bb60bb1ae..22ff02fdfda1 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -157,7 +157,6 @@ COPY ["port_breakout_config_db.json", "/etc/sonic/"] COPY ["database_config.json", "/etc/default/sonic-db/"] COPY ["hostname.j2", "/usr/share/sonic/templates/"] COPY ["default_chassis_cfg.json", "/etc/default/sonic-db/"] -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/"] diff --git a/platform/vs/docker-sonic-vs/chassis_db.py b/platform/vs/docker-sonic-vs/chassis_db.py deleted file mode 100644 index c6cc774fb0c0..000000000000 --- a/platform/vs/docker-sonic-vs/chassis_db.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python - -import swsssdk -import json -chassisdb = swsssdk.SonicV2Connector(host='10.0.0.200', port='6380') -chassisdb.connect(chassisdb.CHASSIS_APP_DB) -fname='/usr/share/sonic/virtual_chassis/chassis_db.json' -with open(fname) as f: - js = json.load(f) - client=chassisdb.get_redis_client(chassisdb.CHASSIS_APP_DB) - for h, table in js.items(): - for k, v in table.items(): - client.hset(h, k, v) diff --git a/platform/vs/docker-sonic-vs/database_config.json b/platform/vs/docker-sonic-vs/database_config.json index 86e8142f5084..953c23f22710 100644 --- a/platform/vs/docker-sonic-vs/database_config.json +++ b/platform/vs/docker-sonic-vs/database_config.json @@ -74,7 +74,7 @@ "instance" : "redis" }, "CHASSIS_APP_DB" : { - "id" : 11, + "id" : 12, "separator": "|", "instance" : "redis_chassis" } diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index ed668983c835..99c15925d179 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -76,7 +76,6 @@ supervisorctl start redis-server start_chassis_db=`sonic-cfggen -v DEVICE_METADATA.localhost.start_chassis_db -y $chassisdb_cfg_file` if [[ "$HOSTNAME" == *"supervisor"* ]] || [ "$start_chassis_db" == "1" ]; then supervisorctl start redis-chassis - python /usr/bin/chassis_db.py fi conn_chassis_db=`sonic-cfggen -v DEVICE_METADATA.localhost.connect_to_chassis_db -y $chassisdb_cfg_file` @@ -86,6 +85,11 @@ if [ "$start_chassis_db" != "1" ] && [ "$conn_chassis_db" != "1" ]; then cp $db_cfg_file_tmp $db_cfg_file fi +if [ "$conn_chassis_db" == "1" ]; then + if [ -f /usr/share/sonic/virtual_chassis/coreportindexmap.ini ]; then + cp /usr/share/sonic/virtual_chassis/coreportindexmap.ini /usr/share/sonic/hwsku/ + fi +fi /usr/bin/configdb-load.sh diff --git a/src/sonic-device-data/src/sai.vs_profile b/src/sonic-device-data/src/sai.vs_profile index bfc466f27e54..317654a27a9d 100644 --- a/src/sonic-device-data/src/sai.vs_profile +++ b/src/sonic-device-data/src/sai.vs_profile @@ -3,3 +3,4 @@ SAI_WARM_BOOT_WRITE_FILE=/var/cache/sai_warmboot.bin SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 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