From e4c7678a29b269cd277e42876f98d9d25dfa1878 Mon Sep 17 00:00:00 2001 From: Rajesh Sankaran Date: Wed, 20 May 2020 04:03:30 -0700 Subject: [PATCH] Handled Review comments. Also added changes to warm_restart.h/cpp to allow for compilation of the PR https://github.com/Azure/sonic-swss/pull/1264 --- common/schema.h | 13 ++----------- common/warm_restart.cpp | 34 ++++++++++++++++++++++++++++++++++ common/warm_restart.h | 5 +++++ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/common/schema.h b/common/schema.h index 53d4dfe9..fe0c4bc4 100644 --- a/common/schema.h +++ b/common/schema.h @@ -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" @@ -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" @@ -217,7 +213,7 @@ 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" @@ -225,9 +221,6 @@ namespace swss { #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" @@ -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" diff --git a/common/warm_restart.cpp b/common/warm_restart.cpp index 62aa846c..30d39386 100644 --- a/common/warm_restart.cpp +++ b/common/warm_restart.cpp @@ -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::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) { diff --git a/common/warm_restart.h b/common/warm_restart.h index dd6bf7c4..1b879f9e 100644 --- a/common/warm_restart.h +++ b/common/warm_restart.h @@ -17,6 +17,7 @@ class WarmStart INITIALIZED, RESTORED, RECONCILED, + WSUNKNOWN, }; enum DataCheckState @@ -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);