Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for CRM available bug #1699

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,24 +442,24 @@ void CrmOrch::getResAvailableCounters()
continue;
}

sai_attribute_t attr;
attr.id = crmResSaiAvailAttrMap.at(res.first);

switch (attr.id)
switch (res.first)
{
case SAI_SWITCH_ATTR_AVAILABLE_IPV4_ROUTE_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_IPV6_ROUTE_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_IPV4_NEXTHOP_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_IPV6_NEXTHOP_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_IPV4_NEIGHBOR_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_IPV6_NEIGHBOR_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_NEXT_HOP_GROUP_MEMBER_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_NEXT_HOP_GROUP_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_FDB_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_IPMC_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_SNAT_ENTRY:
case SAI_SWITCH_ATTR_AVAILABLE_DNAT_ENTRY:
case CrmResourceType::CRM_IPV4_ROUTE:
case CrmResourceType::CRM_IPV6_ROUTE:
case CrmResourceType::CRM_IPV4_NEXTHOP:
case CrmResourceType::CRM_IPV6_NEXTHOP:
case CrmResourceType::CRM_IPV4_NEIGHBOR:
case CrmResourceType::CRM_IPV6_NEIGHBOR:
case CrmResourceType::CRM_NEXTHOP_GROUP_MEMBER:
case CrmResourceType::CRM_NEXTHOP_GROUP:
case CrmResourceType::CRM_FDB_ENTRY:
case CrmResourceType::CRM_IPMC_ENTRY:
case CrmResourceType::CRM_SNAT_ENTRY:
case CrmResourceType::CRM_DNAT_ENTRY:
{
sai_attribute_t attr;
attr.id = crmResSaiAvailAttrMap.at(res.first);

sai_status_t status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr);
if (status != SAI_STATUS_SUCCESS)
{
Expand All @@ -482,9 +482,12 @@ void CrmOrch::getResAvailableCounters()
break;
}

case SAI_SWITCH_ATTR_AVAILABLE_ACL_TABLE:
case SAI_SWITCH_ATTR_AVAILABLE_ACL_TABLE_GROUP:
case CrmResourceType::CRM_ACL_TABLE:
case CrmResourceType::CRM_ACL_GROUP:
{
sai_attribute_t attr;
attr.id = crmResSaiAvailAttrMap.at(res.first);

vector<sai_acl_resource_t> resources(CRM_ACL_RESOURCE_COUNT);

attr.value.aclresource.count = CRM_ACL_RESOURCE_COUNT;
Expand Down Expand Up @@ -512,9 +515,12 @@ void CrmOrch::getResAvailableCounters()
break;
}

case SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_ENTRY:
case SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_COUNTER:
case CrmResourceType::CRM_ACL_ENTRY:
case CrmResourceType::CRM_ACL_COUNTER:
{
sai_attribute_t attr;
attr.id = crmResSaiAvailAttrMap.at(res.first);

for (auto &cnt : res.second.countersMap)
{
sai_status_t status = sai_acl_api->get_acl_table_attribute(cnt.second.id, 1, &attr);
Expand All @@ -531,7 +537,7 @@ void CrmOrch::getResAvailableCounters()
}

default:
SWSS_LOG_ERROR("Failed to get CRM attribute %u. Unknown attribute.\n", attr.id);
SWSS_LOG_ERROR("Failed to get CRM resource type %u. Unknown resource type.\n", (uint32_t)res.first);
return;
}
}
Expand Down