Skip to content

Commit

Permalink
Handled Review comments. Also added changes to warm_restart.h/cpp
Browse files Browse the repository at this point in the history
to allow for compilation of the PR sonic-net/sonic-swss#1264
  • Loading branch information
srj102 committed Jun 3, 2020
1 parent e021cad commit 7252397
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 11 deletions.
13 changes: 2 additions & 11 deletions common/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace swss {
#define APP_VXLAN_TUNNEL_TABLE_NAME "VXLAN_TUNNEL_TABLE"
#define APP_VXLAN_FDB_TABLE_NAME "VXLAN_FDB_TABLE"
#define APP_VXLAN_REMOTE_VNI_TABLE_NAME "VXLAN_REMOTE_VNI_TABLE"
#define APP_EVPN_NVO_TABLE_NAME "EVPN_NVO_TABLE"
#define APP_EVPN_NVO_TABLE_NAME "VXLAN_EVPN_NVO_TABLE"
#define APP_NEIGH_SUPPRESS_VLAN_TABLE_NAME "SUPPRESS_VLAN_NEIGH_TABLE"
#define APP_PASS_THROUGH_ROUTE_TABLE_NAME "PASS_THROUGH_ROUTE_TABLE"
#define APP_ACL_TABLE_TABLE_NAME "ACL_TABLE_TABLE"
Expand All @@ -56,10 +56,6 @@ namespace swss {
#define APP_NAT_GLOBAL_TABLE_NAME "NAT_GLOBAL_TABLE"
#define APP_NAPT_POOL_IP_TABLE_NAME "NAPT_POOL_IP_TABLE"


#define APP_NEIGH_SUPPRESS_VLAN_TABLE_NAME "SUPPRESS_VLAN_NEIGH_TABLE"

#define APP_STP_VLAN_TABLE_NAME "STP_VLAN_TABLE"
#define APP_STP_VLAN_PORT_TABLE_NAME "STP_VLAN_PORT_TABLE"
#define APP_STP_VLAN_INSTANCE_TABLE_NAME "STP_VLAN_INSTANCE_TABLE"
#define APP_STP_PORT_TABLE_NAME "STP_PORT_TABLE"
Expand Down Expand Up @@ -217,17 +213,14 @@ namespace swss {

#define CFG_VXLAN_TUNNEL_TABLE_NAME "VXLAN_TUNNEL"
#define CFG_VXLAN_TUNNEL_MAP_TABLE_NAME "VXLAN_TUNNEL_MAP"
#define CFG_VXLAN_EVPN_NVO_TABLE_NAME "EVPN_NVO"
#define CFG_VXLAN_EVPN_NVO_TABLE_NAME "VXLAN_EVPN_NVO"
#define CFG_VNET_TABLE_NAME "VNET"
#define CFG_NEIGH_TABLE_NAME "NEIGH"
#define CFG_NEIGH_SUPPRESS_VLAN_TABLE_NAME "SUPPRESS_VLAN_NEIGH"

#define CFG_VNET_RT_TABLE_NAME "VNET_ROUTE"
#define CFG_VNET_RT_TUNNEL_TABLE_NAME "VNET_ROUTE_TUNNEL"


#define CFG_NEIGH_SUPPRESS_VLAN_TABLE_NAME "SUPPRESS_VLAN_NEIGH"

#define CFG_PASS_THROUGH_ROUTE_TABLE_NAME "PASS_THROUGH_ROUTE_TABLE"
#define CFG_SFLOW_TABLE_NAME "SFLOW"
#define CFG_SFLOW_SESSION_TABLE_NAME "SFLOW_SESSION"
Expand Down Expand Up @@ -264,8 +257,6 @@ namespace swss {
#define STATE_MIRROR_SESSION_TABLE_NAME "MIRROR_SESSION_TABLE"
#define STATE_VXLAN_TABLE_NAME "VXLAN_TABLE"
#define STATE_VXLAN_TUNNEL_TABLE_NAME "VXLAN_TUNNEL_TABLE"


#define STATE_TUNNEL_VLAN_MAP_TABLE_NAME "TUNNEL_VLAN_MAP_TABLE"
#define STATE_BGP_TABLE_NAME "BGP_STATE_TABLE"
#define STATE_DEBUG_COUNTER_CAPABILITIES_NAME "DEBUG_COUNTER_CAPABILITIES"
Expand Down
34 changes: 34 additions & 0 deletions common/warm_restart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,40 @@ void WarmStart::setWarmStartState(const std::string &app_name, WarmStartState st
warmStartStateNameMap.at(state).c_str());
}

void WarmStart::getWarmStartState(const std::string &app_name, WarmStartState &state)
{
//WarmStartStateNameMap::iterator it;
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(std::map<WarmStart::WarmStartState, std::string>::const_iterator 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 data check state for a particular application.
void WarmStart::setDataCheckState(const std::string &app_name, DataCheckStage stage, DataCheckState state)
{
Expand Down
5 changes: 5 additions & 0 deletions common/warm_restart.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class WarmStart
INITIALIZED,
RESTORED,
RECONCILED,
WSUNKNOWN,
};

enum DataCheckState
Expand Down Expand Up @@ -56,6 +57,10 @@ class WarmStart
static void setWarmStartState(const std::string &app_name,
WarmStartState state);

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


static uint32_t getWarmStartTimer(const std::string &app_name,
const std::string &docker_name);

Expand Down

0 comments on commit 7252397

Please sign in to comment.