Skip to content

Commit

Permalink
[warm reboot] Warm Reboot Support for EVPN VXLAN (#350)
Browse files Browse the repository at this point in the history
* [warm reboot] Warm Reboot Support for EVPN VXLAN
Co-authored-by: Nikhil Kelapure <nikhil.kelapure@broadcom.com>
  • Loading branch information
srj102 authored Oct 12, 2020
1 parent 92a35d9 commit 0253214
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
40 changes: 39 additions & 1 deletion common/warm_restart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const WarmStart::WarmStartStateNameMap WarmStart::warmStartStateNameMap =
{
{INITIALIZED, "initialized"},
{RESTORED, "restored"},
{RECONCILED, "reconciled"}
{REPLAYED, "replayed"},
{RECONCILED, "reconciled"},
{WSDISABLED, "disabled"},
{WSUNKNOWN, "unknown"}
};

const WarmStart::DataCheckStateNameMap WarmStart::dataCheckStateNameMap =
Expand Down Expand Up @@ -181,6 +184,41 @@ bool WarmStart::isSystemWarmRebootEnabled(void)
return warmStart.m_systemWarmRebootEnabled;
}

void WarmStart::getWarmStartState(const std::string &app_name, WarmStartState &state)
{
std::string statestr;

auto& warmStart = getInstance();

state = RECONCILED;

if (!isWarmStart())
{
return;
}

warmStart.m_stateWarmRestartTable->hget(app_name, "state", statestr);

/* If warm-start is enabled, state cannot be assumed as Reconciled
* It should be set to unknown
*/
state = WSUNKNOWN;

for (auto it = warmStartStateNameMap.begin(); it != warmStartStateNameMap.end(); it++)
{
if (it->second == statestr)
{
state = it->first;
break;
}
}

SWSS_LOG_INFO("%s warm start state get %s(%d)",
app_name.c_str(), statestr.c_str(), state);

return;
}

// Set the WarmStart FSM state for a particular application.
void WarmStart::setWarmStartState(const std::string &app_name, WarmStartState state)
{
Expand Down
6 changes: 6 additions & 0 deletions common/warm_restart.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class WarmStart
{
INITIALIZED,
RESTORED,
REPLAYED,
RECONCILED,
WSDISABLED,
WSUNKNOWN,
};

enum DataCheckState
Expand Down Expand Up @@ -54,6 +57,9 @@ class WarmStart

static bool isSystemWarmRebootEnabled(void);

static void getWarmStartState(const std::string &app_name,
WarmStartState &state);

static void setWarmStartState(const std::string &app_name,
WarmStartState state);

Expand Down

0 comments on commit 0253214

Please sign in to comment.