Skip to content

Adding new states in WarmState Adapter. #905

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f28b8d5
Adding new states in WarmState Adapter.
divyagayathri-hcl Aug 27, 2024
7f30700
Merge branch 'master' into swss_1
divyagayathri-hcl Sep 6, 2024
84f7489
Merge branch 'master' into swss_1
divyagayathri-hcl Sep 13, 2024
84c8476
Merge branch 'master' into swss_1
divyagayathri-hcl Sep 18, 2024
9650c94
Merge branch 'master' into swss_1
divyagayathri-hcl Sep 30, 2024
4d7c3cc
Merge branch 'master' into swss_1
divyagayathri-hcl Oct 14, 2024
fa3909d
Merge branch 'master' into swss_1
divyagayathri-hcl Sep 30, 2024
32c15cd
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Oct 14, 2024
abba3be
Merge branch 'swss_1' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Oct 14, 2024
5985976
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Feb 5, 2025
502871a
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Feb 10, 2025
60f4105
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Mar 12, 2025
2a2ee36
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Mar 27, 2025
44e77f2
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Apr 4, 2025
fd85ffe
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl Apr 27, 2025
48c043d
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl May 9, 2025
d5cd9ff
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-s…
divyagayathri-hcl May 28, 2025
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
6 changes: 5 additions & 1 deletion common/warm_restart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const WarmStart::WarmStartStateNameMap WarmStart::warmStartStateNameMap =
{REPLAYED, "replayed"},
{RECONCILED, "reconciled"},
{WSDISABLED, "disabled"},
{WSUNKNOWN, "unknown"}
{WSUNKNOWN, "unknown"},
{FROZEN, "frozen"},
{QUIESCENT, "quiescent"},
{CHECKPOINTED, "checkpointed"},
{FAILED, "failed"}
};

const WarmStart::DataCheckStateNameMap WarmStart::dataCheckStateNameMap =
Expand Down
4 changes: 4 additions & 0 deletions common/warm_restart.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class WarmStart
RECONCILED,
WSDISABLED,
WSUNKNOWN,
FROZEN,
QUIESCENT,
CHECKPOINTED,
FAILED,
};

enum DataCheckState
Expand Down
43 changes: 43 additions & 0 deletions tests/warm_restart_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,49 @@ TEST(WarmRestart, getWarmStartTimer)
EXPECT_EQ(timer, 5000u);
}

TEST(WarmRestart, set_get_WarmStartState)
{
DBConnector stateDb("STATE_DB", 0, true);
Table stateWarmRestartTable(&stateDb, STATE_WARM_RESTART_TABLE_NAME);
Table stateWarmRestartEnableTable(&stateDb, STATE_WARM_RESTART_ENABLE_TABLE_NAME);

DBConnector configDb("CONFIG_DB", 0, true);
Table cfgWarmRestartTable(&configDb, CFG_WARM_RESTART_TABLE_NAME);

//Clean up warm restart state for testAppName and warm restart config for testDockerName
stateWarmRestartTable.del(testAppName);
cfgWarmRestartTable.del(testDockerName);

//Initialize WarmStart class for TestApp
WarmStart::initialize(testAppName, testDockerName, 0, true);

WarmStart::WarmStartState warmStartStates[] =
{
WarmStart::INITIALIZED,
WarmStart::RESTORED,
WarmStart::REPLAYED,
WarmStart::RECONCILED,
WarmStart::WSDISABLED,
WarmStart::WSUNKNOWN,
WarmStart::FROZEN,
WarmStart::QUIESCENT,
WarmStart::CHECKPOINTED,
WarmStart::FAILED,
};

for (const auto &currState : warmStartStates) {
WarmStart::setWarmStartState(testAppName, currState);

string state;
stateWarmRestartTable.hget(testAppName, "state", state);
EXPECT_EQ(state, WarmStart::warmStartStateNameMap.at(currState).c_str());

WarmStart::WarmStartState ret_state;
WarmStart::getWarmStartState(testAppName, ret_state);
EXPECT_EQ(ret_state, currState);
}
}

TEST(WarmRestart, set_get_DataCheckState)
{
DBConnector stateDb("STATE_DB", 0, true);
Expand Down
Loading