From fce0c607b9bfea70e72b9d5574c96d6bb79ad67f Mon Sep 17 00:00:00 2001 From: Ann Pokora <44511240+qbdwlr@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:30:07 -0400 Subject: [PATCH] [crm] Fix for Issue Azure/sonic-buildimage#8036 (#1829) *Added more appropriate log message for CRM queries of MPLS_INSEG and MPLS_NEXTHOP resources when platform does not support these resource types. --- orchagent/crmorch.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/orchagent/crmorch.cpp b/orchagent/crmorch.cpp index bdd899057a..1e67a72087 100644 --- a/orchagent/crmorch.cpp +++ b/orchagent/crmorch.cpp @@ -565,6 +565,16 @@ void CrmOrch::getResAvailableCounters() sai_status_t status = sai_object_type_get_availability(gSwitchId, objType, 0, nullptr, &availCount); if (status != SAI_STATUS_SUCCESS) { + if ((status == SAI_STATUS_NOT_SUPPORTED) || + (status == SAI_STATUS_NOT_IMPLEMENTED) || + SAI_STATUS_IS_ATTR_NOT_SUPPORTED(status) || + SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(status)) + { + // mark unsupported resources + res.second.resStatus = CrmResourceStatus::CRM_RES_NOT_SUPPORTED; + SWSS_LOG_NOTICE("CRM Resource %s not supported", crmResTypeNameMap.at(res.first).c_str()); + break; + } SWSS_LOG_ERROR("Failed to get availability for object_type %u , rv:%d", objType, status); break; } @@ -585,6 +595,16 @@ void CrmOrch::getResAvailableCounters() sai_status_t status = sai_object_type_get_availability(gSwitchId, objType, 1, &attr, &availCount); if (status != SAI_STATUS_SUCCESS) { + if ((status == SAI_STATUS_NOT_SUPPORTED) || + (status == SAI_STATUS_NOT_IMPLEMENTED) || + SAI_STATUS_IS_ATTR_NOT_SUPPORTED(status) || + SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(status)) + { + // mark unsupported resources + res.second.resStatus = CrmResourceStatus::CRM_RES_NOT_SUPPORTED; + SWSS_LOG_NOTICE("CRM Resource %s not supported", crmResTypeNameMap.at(res.first).c_str()); + break; + } SWSS_LOG_ERROR("Failed to get availability for object_type %u , rv:%d", objType, status); break; }