@@ -1740,6 +1740,37 @@ sai_status_t Meta::meta_validate_stats(
1740
1740
return SAI_STATUS_SUCCESS;
1741
1741
}
1742
1742
1743
+ sai_status_t Meta::meta_validate_query_stats_capability (
1744
+ _In_ sai_object_type_t object_type,
1745
+ _In_ sai_object_id_t object_id)
1746
+ {
1747
+ SWSS_LOG_ENTER ();
1748
+
1749
+ PARAMETER_CHECK_OBJECT_TYPE_VALID (object_type);
1750
+ PARAMETER_CHECK_OID_OBJECT_TYPE (object_id, object_type);
1751
+ PARAMETER_CHECK_OID_EXISTS (object_id, object_type);
1752
+
1753
+ sai_object_id_t switch_id = switchIdQuery (object_id);
1754
+
1755
+ // checks also if object type is OID
1756
+ sai_status_t status = meta_sai_validate_oid (object_type, &object_id, switch_id, false );
1757
+
1758
+ CHECK_STATUS_SUCCESS (status);
1759
+
1760
+ auto info = sai_metadata_get_object_type_info (object_type);
1761
+
1762
+ PARAMETER_CHECK_IF_NOT_NULL (info);
1763
+
1764
+ if (info->statenum == nullptr )
1765
+ {
1766
+ SWSS_LOG_ERROR (" %s does not support stats" , info->objecttypename );
1767
+
1768
+ return SAI_STATUS_INVALID_PARAMETER;
1769
+ }
1770
+
1771
+ return SAI_STATUS_SUCCESS;
1772
+ }
1773
+
1743
1774
sai_status_t Meta::getStats (
1744
1775
_In_ sai_object_type_t object_type,
1745
1776
_In_ sai_object_id_t object_id,
@@ -1760,6 +1791,24 @@ sai_status_t Meta::getStats(
1760
1791
return status;
1761
1792
}
1762
1793
1794
+ sai_status_t Meta::queryStatsCapability (
1795
+ _In_ sai_object_id_t switchId,
1796
+ _In_ sai_object_type_t objectType,
1797
+ _Inout_ sai_stat_capability_list_t *stats_capability)
1798
+ {
1799
+ SWSS_LOG_ENTER ();
1800
+
1801
+ auto status = meta_validate_query_stats_capability (objectType, switchId);
1802
+
1803
+ CHECK_STATUS_SUCCESS (status);
1804
+
1805
+ status = m_implementation->queryStatsCapability (switchId, objectType, stats_capability);
1806
+
1807
+ // no post validation required
1808
+
1809
+ return status;
1810
+ }
1811
+
1763
1812
sai_status_t Meta::getStatsExt (
1764
1813
_In_ sai_object_type_t object_type,
1765
1814
_In_ sai_object_id_t object_id,
0 commit comments