diff --git a/common/Makefile.am b/common/Makefile.am index 733365f44..96fc1d9fa 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -7,7 +7,8 @@ EXTRA_DIST = \ consumer_table_pops.lua \ producer_state_table_apply_view.lua \ table_dump.lua \ - fdb_flush.lua + fdb_flush.lua \ + database_config.json swssdir = $(datadir)/swss diff --git a/common/database_config.json b/common/database_config.json new file mode 100644 index 000000000..b86ae11bb --- /dev/null +++ b/common/database_config.json @@ -0,0 +1,57 @@ +{ + "INSTANCES": { + "redis":{ + "hostname" : "127.0.0.1", + "port" : 6379, + "unix_socket_path" : "/var/run/redis/redis.sock" + } + }, + "DATABASES" : { + "APPL_DB" : { + "id" : 0, + "separator": ":", + "instance" : "redis" + }, + "ASIC_DB" : { + "id" : 1, + "separator": ":", + "instance" : "redis" + }, + "COUNTERS_DB" : { + "id" : 2, + "separator": ":", + "instance" : "redis" + }, + "LOGLEVEL_DB" : { + "id" : 3, + "separator": ":", + "instance" : "redis" + }, + "CONFIG_DB" : { + "id" : 4, + "separator": "|", + "instance" : "redis" + }, + "PFC_WD_DB" : { + "id" : 5, + "separator": ":", + "instance" : "redis" + }, + "FLEX_COUNTER_DB" : { + "id" : 5, + "separator": ":", + "instance" : "redis" + }, + "STATE_DB" : { + "id" : 6, + "separator": "|", + "instance" : "redis" + }, + "SNMP_OVERLAY_DB" : { + "id" : 7, + "separator": "|", + "instance" : "redis" + } + }, + "VERSION" : "1.0" +} diff --git a/debian/libswsscommon.install b/debian/libswsscommon.install index 551541db4..252737866 100644 --- a/debian/libswsscommon.install +++ b/debian/libswsscommon.install @@ -1,3 +1,4 @@ usr/lib/*/lib*.so.* usr/share/swss/*.lua +usr/share/swss/*.json usr/bin/swssloglevel diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 000000000..afc335656 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,11 @@ +#!/bin/bash +# This `DEBIAN/postinst` script is run post-installation +DST_PATH="/var/run/redis/sonic-db" +DST_FILE="database_config.json" +SRC_PATH="/usr/share/swss" + +# if there is no $DST_FILE, it is needed to copy one default to $DST_FILE +if [ ! -e $DST_PATH/$DST_FILE ]; then + mkdir -p $DST_PATH + cp $SRC_PATH/$DST_FILE $DST_PATH/$DST_FILE +fi