@@ -24,6 +24,10 @@ using namespace swss;
2424
2525IntfMgr::IntfMgr (DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames) :
2626 Orch(cfgDb, tableNames),
27+ m_cfgIntfTable(cfgDb, CFG_INTF_TABLE_NAME),
28+ m_cfgVlanIntfTable(cfgDb, CFG_VLAN_INTF_TABLE_NAME),
29+ m_cfgLagIntfTable(cfgDb, CFG_LAG_INTF_TABLE_NAME),
30+ m_cfgLoopbackIntfTable(cfgDb, CFG_LOOPBACK_INTERFACE_TABLE_NAME),
2731 m_statePortTable(stateDb, STATE_PORT_TABLE_NAME),
2832 m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME),
2933 m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME),
@@ -34,6 +38,12 @@ IntfMgr::IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c
3438 if (!WarmStart::isWarmStart ())
3539 {
3640 flushLoopbackIntfs ();
41+ WarmStart::setWarmStartState (" intfmgrd" , WarmStart::WSDISABLED);
42+ }
43+ else
44+ {
45+ // Build the interface list to be replayed to Kernel
46+ buildIntfReplayList ();
3747 }
3848}
3949
@@ -172,6 +182,25 @@ int IntfMgr::getIntfIpCount(const string &alias)
172182 return std::stoi (res);
173183}
174184
185+ void IntfMgr::buildIntfReplayList (void )
186+ {
187+ vector<string> intfList;
188+
189+ m_cfgIntfTable.getKeys (intfList);
190+ std::copy ( intfList.begin (), intfList.end (), std::inserter ( m_pendingReplayIntfList, m_pendingReplayIntfList.end () ) );
191+
192+ m_cfgLoopbackIntfTable.getKeys (intfList);
193+ std::copy ( intfList.begin (), intfList.end (), std::inserter ( m_pendingReplayIntfList, m_pendingReplayIntfList.end () ) );
194+
195+ m_cfgVlanIntfTable.getKeys (intfList);
196+ std::copy ( intfList.begin (), intfList.end (), std::inserter ( m_pendingReplayIntfList, m_pendingReplayIntfList.end () ) );
197+
198+ m_cfgLagIntfTable.getKeys (intfList);
199+ std::copy ( intfList.begin (), intfList.end (), std::inserter ( m_pendingReplayIntfList, m_pendingReplayIntfList.end () ) );
200+
201+ SWSS_LOG_INFO (" Found %d Total Intfs to be replayed" , (int )m_pendingReplayIntfList.size () );
202+ }
203+
175204bool IntfMgr::isIntfCreated (const string &alias)
176205{
177206 vector<FieldValueTuple> temp;
@@ -676,6 +705,7 @@ bool IntfMgr::doIntfAddrTask(const vector<string>& keys,
676705void IntfMgr::doTask (Consumer &consumer)
677706{
678707 SWSS_LOG_ENTER ();
708+ static bool replayDone = false ;
679709
680710 auto it = consumer.m_toSync .begin ();
681711 while (it != consumer.m_toSync .end ())
@@ -693,6 +723,11 @@ void IntfMgr::doTask(Consumer &consumer)
693723 it++;
694724 continue ;
695725 }
726+ else
727+ {
728+ // Entry programmed, remove it from pending list if present
729+ m_pendingReplayIntfList.erase (keys[0 ]);
730+ }
696731 }
697732 else if (keys.size () == 2 )
698733 {
@@ -701,6 +736,11 @@ void IntfMgr::doTask(Consumer &consumer)
701736 it++;
702737 continue ;
703738 }
739+ else
740+ {
741+ // Entry programmed, remove it from pending list if present
742+ m_pendingReplayIntfList.erase (keys[0 ] + config_db_key_delimiter + keys[1 ] );
743+ }
704744 }
705745 else
706746 {
@@ -709,4 +749,13 @@ void IntfMgr::doTask(Consumer &consumer)
709749
710750 it = consumer.m_toSync .erase (it);
711751 }
752+
753+ if (!replayDone && WarmStart::isWarmStart () && m_pendingReplayIntfList.empty () )
754+ {
755+ replayDone = true ;
756+ WarmStart::setWarmStartState (" intfmgrd" , WarmStart::REPLAYED);
757+ // There is no operation to be performed for intfmgr reconcillation
758+ // Hence mark it reconciled right away
759+ WarmStart::setWarmStartState (" intfmgrd" , WarmStart::RECONCILED);
760+ }
712761}
0 commit comments