Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MultiDB]: repalce old APIs with New APIs incuding testing #537

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/sai_redis_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ sai_status_t sai_api_initialize(

memcpy(&g_services, services, sizeof(g_services));

g_db = std::make_shared<swss::DBConnector>(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
g_dbNtf = std::make_shared<swss::DBConnector>(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
g_db = std::make_shared<swss::DBConnector>("ASIC_DB", 0);
g_dbNtf = std::make_shared<swss::DBConnector>("ASIC_DB", 0);
g_redisPipeline = std::make_shared<swss::RedisPipeline>(g_db.get()); //enable default pipeline 128
g_asicState = std::make_shared<swss::ProducerTable>(g_redisPipeline.get(), ASIC_STATE_TABLE, true);
g_redisGetConsumer = std::make_shared<swss::ConsumerTable>(g_db.get(), "GETRESPONSE");
Expand Down
2 changes: 1 addition & 1 deletion saidump/saidump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ int main(int argc, char ** argv)

g_cmdOptions = handleCmdLine(argc, argv);

swss::DBConnector db(ASIC_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
swss::DBConnector db("ASIC_DB", 0);

std::string table = ASIC_STATE_TABLE;

Expand Down
2 changes: 1 addition & 1 deletion syncd/scripts/syncd_init_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ case "$(cat /proc/cmdline)" in
;;
*SONIC_BOOT_TYPE=fast*|*fast-reboot*)
# check that the key exists
if [[ $(redis-cli -n 6 GET "FAST_REBOOT|system") == "1" ]]; then
if [[ $(sonic-db-cli STATE_DB GET "FAST_REBOOT|system") == "1" ]]; then
FAST_REBOOT='yes'
else
FAST_REBOOT='no'
Expand Down
8 changes: 4 additions & 4 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3947,10 +3947,10 @@ int syncd_main(int argc, char **argv)
}
#endif // SAITHRIFT

dbAsic = std::make_shared<swss::DBConnector>(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
std::shared_ptr<swss::DBConnector> dbNtf = std::make_shared<swss::DBConnector>(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
std::shared_ptr<swss::DBConnector> dbFlexCounter = std::make_shared<swss::DBConnector>(FLEX_COUNTER_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
std::shared_ptr<swss::DBConnector> dbState = std::make_shared<swss::DBConnector>(STATE_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
dbAsic = std::make_shared<swss::DBConnector>("ASIC_DB", 0);
std::shared_ptr<swss::DBConnector> dbNtf = std::make_shared<swss::DBConnector>("ASIC_DB", 0);
std::shared_ptr<swss::DBConnector> dbFlexCounter = std::make_shared<swss::DBConnector>("FLEX_COUNTER_DB", 0);
std::shared_ptr<swss::DBConnector> dbState = std::make_shared<swss::DBConnector>("STATE_DB", 0);
std::unique_ptr<swss::Table> warmRestartTable = std::unique_ptr<swss::Table>(new swss::Table(dbState.get(), STATE_WARM_RESTART_TABLE_NAME));

g_redisClient = std::make_shared<swss::RedisClient>(dbAsic.get());
Expand Down
2 changes: 1 addition & 1 deletion syncd/syncd_applyview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ void redisGetAsicView(

SWSS_LOG_TIMER("get asic view from %s", tableName.c_str());

swss::DBConnector db(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
swss::DBConnector db("ASIC_DB", 0);

swss::Table table(&db, tableName);

Expand Down
2 changes: 1 addition & 1 deletion syncd/syncd_flex_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ void FlexCounter::flexCounterThread(void)
{
SWSS_LOG_ENTER();

swss::DBConnector db(COUNTERS_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
swss::DBConnector db("COUNTERS_DB", 0);
swss::RedisPipeline pipeline(&db);
swss::Table countersTable(&pipeline, COUNTERS_TABLE, true);

Expand Down
2 changes: 1 addition & 1 deletion syncd/syncd_request_shutdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}

swss::DBConnector db(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
swss::DBConnector db("ASIC_DB", 0);
swss::NotificationProducer restartQuery(&db, "RESTARTQUERY");

std::vector<swss::FieldValueTuple> values;
Expand Down
4 changes: 2 additions & 2 deletions syncd/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void clearDB()
{
SWSS_LOG_ENTER();

swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector db("ASIC_DB", 0, true);
swss::RedisReply r(&db, "FLUSHALL", REDIS_REPLY_STATUS);
r.checkStatusOK();
}
Expand Down Expand Up @@ -168,7 +168,7 @@ void bulk_nhgm_consumer_worker()
SWSS_LOG_ENTER();

std::string tableName = ASIC_STATE_TABLE;
swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector db("ASIC_DB", 0, true);
swss::ConsumerTable c(&db, tableName);
swss::Select cs;
swss::Selectable *selectcs;
Expand Down
2 changes: 1 addition & 1 deletion vslib/src/sai_vs_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ sai_status_t sai_api_initialize(

clear_local_state();

g_dbNtf = std::make_shared<swss::DBConnector>(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
g_dbNtf = std::make_shared<swss::DBConnector>("ASIC_DB", 0);
g_unittestChannelNotificationConsumer = std::make_shared<swss::NotificationConsumer>(g_dbNtf.get(), SAI_VS_UNITTEST_CHANNEL);

g_unittestChannelRun = true;
Expand Down
4 changes: 2 additions & 2 deletions vslib/src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void test_set_readonly_attribute_via_redis()

// this scope contains all operations needed to perform set operation on readonly attribute
{
swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector db("ASIC_DB", 0, true);
swss::NotificationProducer vsntf(&db, SAI_VS_UNITTEST_CHANNEL);

std::vector<swss::FieldValueTuple> entry;
Expand Down Expand Up @@ -271,7 +271,7 @@ void test_set_stats_via_redis()

// this scope contains all operations needed to perform set stats on object
{
swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector db("ASIC_DB", 0, true);
swss::NotificationProducer vsntf(&db, SAI_VS_UNITTEST_CHANNEL);

std::vector<swss::FieldValueTuple> entry;
Expand Down