From 94d3e1701eb6d25c24c9aa01e3f71b1066214f94 Mon Sep 17 00:00:00 2001 From: mprabhu Date: Wed, 14 Oct 2020 00:41:28 -0700 Subject: [PATCH 1/2] GLOBAL_STATE_DB on control-card for chassis state On a modular chassis, add a GLOBAL_STATE_DB where all state information from line-cards can be persisted. One example is thermal sensors information from each of the line cards are stored in GLOBAL_STATE_DB. Control card can access this information to feed to the thermal-policy, fan algorithm etc. --- common/database_config.json | 5 +++++ common/schema.h | 1 + common/table.cpp | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/database_config.json b/common/database_config.json index cda2c6cb4..1c1fa6e6a 100644 --- a/common/database_config.json +++ b/common/database_config.json @@ -71,6 +71,11 @@ "id" : 11, "separator": "|", "instance" : "redis" + }, + "GLOBAL_STATE_DB" : { + "id" : 12, + "separator": "|", + "instance" : "redis-global_db" } }, "VERSION" : "1.0" diff --git a/common/schema.h b/common/schema.h index 0433798e8..d89d6d0a2 100644 --- a/common/schema.h +++ b/common/schema.h @@ -20,6 +20,7 @@ namespace swss { #define GB_ASIC_DB 9 #define GB_COUNTERS_DB 10 #define GB_FLEX_COUNTER_DB 11 +#define GLOBAL_STATE_DB 12 /***** APPLICATION DATABASE *****/ diff --git a/common/table.cpp b/common/table.cpp index 431c9dcd5..76bf8e57f 100644 --- a/common/table.cpp +++ b/common/table.cpp @@ -30,7 +30,8 @@ const TableNameSeparatorMap TableBase::tableNameSeparatorMap = { { RESTAPI_DB, TABLE_NAME_SEPARATOR_VBAR }, { GB_ASIC_DB, TABLE_NAME_SEPARATOR_VBAR }, { GB_COUNTERS_DB, TABLE_NAME_SEPARATOR_VBAR }, - { GB_FLEX_COUNTER_DB, TABLE_NAME_SEPARATOR_VBAR } + { GB_FLEX_COUNTER_DB, TABLE_NAME_SEPARATOR_VBAR }, + { GLOBAL_STATE_DB, TABLE_NAME_SEPARATOR_VBAR } }; Table::Table(const DBConnector *db, const string &tableName) From d8bda802cdbc5a8e1a288eb1e126ff068a40331f Mon Sep 17 00:00:00 2001 From: mprabhu Date: Fri, 23 Oct 2020 11:08:47 -0700 Subject: [PATCH 2/2] Changing global to chassis for DB names --- common/database_config.json | 6 +++--- common/schema.h | 2 +- common/table.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/database_config.json b/common/database_config.json index 1c1fa6e6a..3013dc095 100644 --- a/common/database_config.json +++ b/common/database_config.json @@ -72,10 +72,10 @@ "separator": "|", "instance" : "redis" }, - "GLOBAL_STATE_DB" : { - "id" : 12, + "CHASSIS_STATE_DB" : { + "id" : 13, "separator": "|", - "instance" : "redis-global_db" + "instance" : "redis_chassis" } }, "VERSION" : "1.0" diff --git a/common/schema.h b/common/schema.h index d89d6d0a2..691f72a40 100644 --- a/common/schema.h +++ b/common/schema.h @@ -20,7 +20,7 @@ namespace swss { #define GB_ASIC_DB 9 #define GB_COUNTERS_DB 10 #define GB_FLEX_COUNTER_DB 11 -#define GLOBAL_STATE_DB 12 +#define CHASSIS_STATE_DB 13 /***** APPLICATION DATABASE *****/ diff --git a/common/table.cpp b/common/table.cpp index 76bf8e57f..cf3a4efe1 100644 --- a/common/table.cpp +++ b/common/table.cpp @@ -31,7 +31,7 @@ const TableNameSeparatorMap TableBase::tableNameSeparatorMap = { { GB_ASIC_DB, TABLE_NAME_SEPARATOR_VBAR }, { GB_COUNTERS_DB, TABLE_NAME_SEPARATOR_VBAR }, { GB_FLEX_COUNTER_DB, TABLE_NAME_SEPARATOR_VBAR }, - { GLOBAL_STATE_DB, TABLE_NAME_SEPARATOR_VBAR } + { CHASSIS_STATE_DB, TABLE_NAME_SEPARATOR_VBAR } }; Table::Table(const DBConnector *db, const string &tableName)