diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 7b246a49de..7ee70efa08 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -31,6 +31,11 @@ if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then CHASS_CFG="-j /usr/share/sonic/virtual_chassis/default_config.json" fi +# Note: libswsscommon requires a dabase_config file in /var/run/redis/sonic-db/ +# Prepare this file before any dependent application, such as sonic-cfggen +mkdir -p /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}') sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'", "buffer_model": "traditional"}}}' $CHASS_CFG --print-data > /etc/sonic/init_cfg.json @@ -68,9 +73,6 @@ else echo "10.8.1.200 redis_chassis.server" >> /etc/hosts fi -mkdir -p /var/run/redis/sonic-db -cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db/ - supervisorctl start redis-server start_chassis_db=`sonic-cfggen -v DEVICE_METADATA.localhost.start_chassis_db -y $chassisdb_cfg_file` diff --git a/rules/sonic-config.mk b/rules/sonic-config.mk index 996e311b5f..e8e59fc1b9 100644 --- a/rules/sonic-config.mk +++ b/rules/sonic-config.mk @@ -2,7 +2,8 @@ SONIC_CONFIG_ENGINE_PY2 = sonic_config_engine-1.0-py2-none-any.whl $(SONIC_CONFIG_ENGINE_PY2)_SRC_PATH = $(SRC_PATH)/sonic-config-engine -$(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SWSSSDK_PY2) $(SONIC_PY_COMMON_PY2) +$(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) +$(SONIC_CONFIG_ENGINE_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) $(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2 SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) @@ -10,7 +11,8 @@ SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) SONIC_CONFIG_ENGINE_PY3 = sonic_config_engine-1.0-py3-none-any.whl $(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH = $(SRC_PATH)/sonic-config-engine -$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_PY_COMMON_PY3) +$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY3) +$(SONIC_CONFIG_ENGINE_PY3)_DEBS_DEPENDS += $(PYTHON3_SWSSCOMMON) # Synthetic dependency to avoid building the Python 2 and 3 packages # simultaneously and any potential conflicts which may arise $(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY2) diff --git a/src/sonic-config-engine/portconfig.py b/src/sonic-config-engine/portconfig.py index d20212eb55..8a3177f31b 100644 --- a/src/sonic-config-engine/portconfig.py +++ b/src/sonic-config-engine/portconfig.py @@ -5,7 +5,7 @@ try: import re import sys - from swsssdk import ConfigDBConnector + from swsscommon.swsscommon import ConfigDBConnector from sonic_py_common import device_info except ImportError as e: raise ImportError("%s - required module not found" % str(e)) diff --git a/src/sonic-config-engine/redis_bcc.py b/src/sonic-config-engine/redis_bcc.py index 1045e0c5c8..c9d3ebca23 100644 --- a/src/sonic-config-engine/redis_bcc.py +++ b/src/sonic-config-engine/redis_bcc.py @@ -19,11 +19,11 @@ class RedisBytecodeCache(jinja2.BytecodeCache): return code = self._client.get(self._client.LOGLEVEL_DB, self.REDIS_HASH, bucket.key) if code is not None: - bucket.bytecode_from_string(b64decode(code)) + bucket.bytecode_from_string(b64decode(code.encode())) def dump_bytecode(self, bucket): if self._client is None: return self._client.set(self._client.LOGLEVEL_DB, self.REDIS_HASH, - bucket.key, b64encode(bucket.bytecode_to_string())) + bucket.key, b64encode(bucket.bytecode_to_string()).decode()) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index af638c2c28..0f9ffafad6 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -43,7 +43,7 @@ from portconfig import get_port_config, get_breakout_mode from redis_bcc import RedisBytecodeCache from sonic_py_common.multi_asic import get_asic_id_from_name, is_multi_asic from sonic_py_common import device_info -from swsssdk import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector +from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector PY3x = sys.version_info >= (3, 0) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 2db7bea996..2f79bb49d1 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 2db7bea9963a988a575b8075e1f6c5369d057230 +Subproject commit 2f79bb49d13820f2c108e4e27a2a12181713662f