Skip to content

Commit 02d92f1

Browse files
authored
Add log info for not matching SG/IPG/QUEUES (sonic-net#409)
1 parent 8793562 commit 02d92f1

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

syncd/syncd_applyview.cpp

+61
Original file line numberDiff line numberDiff line change
@@ -1828,6 +1828,65 @@ void matchOids(
18281828
SWSS_LOG_NOTICE("matched oids");
18291829
}
18301830

1831+
/**
1832+
* @brief Check internal objects.
1833+
*
1834+
* During warm boot, when switch restarted we expect that switch will have the
1835+
* same number of objects like before boot, and all vendor OIDs (RIDs) will be
1836+
* exactly the same as before reboot.
1837+
*
1838+
* If OIDs are not the same, then this is a vendor bug.
1839+
*
1840+
* Exception of this rule is when orchagent will be restarted and it will add
1841+
* some more objects or remove some objects.
1842+
*
1843+
* We take special care here about INGRESS_PRIORIRITY_GROUPS, SCHEDULER_GROUPS
1844+
* and QUEUES, since those are internal objects created by vendor when switch
1845+
* is instantiated.
1846+
*
1847+
* @param currentView Current view.
1848+
* @param temporaryView Temporary view.
1849+
*/
1850+
void checkInternalObjects(
1851+
_In_ const AsicView &cv,
1852+
_In_ const AsicView &tv)
1853+
{
1854+
SWSS_LOG_ENTER();
1855+
1856+
std::vector<sai_object_type_t> ots =
1857+
{
1858+
SAI_OBJECT_TYPE_QUEUE,
1859+
SAI_OBJECT_TYPE_SCHEDULER_GROUP,
1860+
SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP
1861+
};
1862+
1863+
for (auto ot: ots)
1864+
{
1865+
auto cot = cv.getObjectsByObjectType(ot);
1866+
auto tot = tv.getObjectsByObjectType(ot);
1867+
1868+
auto sot = sai_serialize_object_type(ot);
1869+
1870+
if (cot.size() != tot.size())
1871+
{
1872+
SWSS_LOG_WARN("different number of objects %s, curr: %zu, tmp %zu (not expected if warm boot)",
1873+
sot.c_str(),
1874+
cot.size(),
1875+
tot.size());
1876+
}
1877+
1878+
for (auto o: cot)
1879+
if (o->getObjectStatus() != SAI_OBJECT_STATUS_MATCHED)
1880+
SWSS_LOG_ERROR("object status is not MATCHED on curr: %s:%s",
1881+
sot.c_str(), o->str_object_id.c_str());
1882+
1883+
for (auto o: tot)
1884+
if (o->getObjectStatus() != SAI_OBJECT_STATUS_MATCHED)
1885+
SWSS_LOG_ERROR("object status is not MATCHED on temp: %s:%s",
1886+
sot.c_str(), o->str_object_id.c_str());
1887+
}
1888+
}
1889+
18311890
void checkMatchedPorts(
18321891
_In_ const AsicView &temporaryView)
18331892
{
@@ -6899,6 +6958,8 @@ sai_status_t syncdApplyView()
68996958

69006959
populateExistingObjects(current, temp, existingObjects);
69016960

6961+
checkInternalObjects(current, temp);
6962+
69026963
/*
69036964
* Call main method!
69046965
*/

0 commit comments

Comments
 (0)