@@ -1828,6 +1828,65 @@ void matchOids(
1828
1828
SWSS_LOG_NOTICE (" matched oids" );
1829
1829
}
1830
1830
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
+
1831
1890
void checkMatchedPorts (
1832
1891
_In_ const AsicView &temporaryView)
1833
1892
{
@@ -6899,6 +6958,8 @@ sai_status_t syncdApplyView()
6899
6958
6900
6959
populateExistingObjects (current, temp, existingObjects);
6901
6960
6961
+ checkInternalObjects (current, temp);
6962
+
6902
6963
/*
6903
6964
* Call main method!
6904
6965
*/
0 commit comments