@@ -24,6 +24,10 @@ using namespace swss;
24
24
25
25
IntfMgr::IntfMgr (DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames) :
26
26
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),
27
31
m_statePortTable(stateDb, STATE_PORT_TABLE_NAME),
28
32
m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME),
29
33
m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME),
@@ -34,6 +38,12 @@ IntfMgr::IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c
34
38
if (!WarmStart::isWarmStart ())
35
39
{
36
40
flushLoopbackIntfs ();
41
+ WarmStart::setWarmStartState (" intfmgrd" , WarmStart::WSDISABLED);
42
+ }
43
+ else
44
+ {
45
+ // Build the interface list to be replayed to Kernel
46
+ buildIntfReplayList ();
37
47
}
38
48
}
39
49
@@ -172,6 +182,25 @@ int IntfMgr::getIntfIpCount(const string &alias)
172
182
return std::stoi (res);
173
183
}
174
184
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
+
175
204
bool IntfMgr::isIntfCreated (const string &alias)
176
205
{
177
206
vector<FieldValueTuple> temp;
@@ -676,6 +705,7 @@ bool IntfMgr::doIntfAddrTask(const vector<string>& keys,
676
705
void IntfMgr::doTask (Consumer &consumer)
677
706
{
678
707
SWSS_LOG_ENTER ();
708
+ static bool replayDone = false ;
679
709
680
710
auto it = consumer.m_toSync .begin ();
681
711
while (it != consumer.m_toSync .end ())
@@ -693,6 +723,11 @@ void IntfMgr::doTask(Consumer &consumer)
693
723
it++;
694
724
continue ;
695
725
}
726
+ else
727
+ {
728
+ // Entry programmed, remove it from pending list if present
729
+ m_pendingReplayIntfList.erase (keys[0 ]);
730
+ }
696
731
}
697
732
else if (keys.size () == 2 )
698
733
{
@@ -701,6 +736,11 @@ void IntfMgr::doTask(Consumer &consumer)
701
736
it++;
702
737
continue ;
703
738
}
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
+ }
704
744
}
705
745
else
706
746
{
@@ -709,4 +749,13 @@ void IntfMgr::doTask(Consumer &consumer)
709
749
710
750
it = consumer.m_toSync .erase (it);
711
751
}
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
+ }
712
761
}
0 commit comments