Skip to content

Commit

Permalink
[orchagent]: Handle additional SAI error conditions gracefully (sonic…
Browse files Browse the repository at this point in the history
…-net#2755)

* Handle SAI_STATUS_TABLE_FULL errors for routes
 * Handle SAI_STATUS_ITEM_ALREADY_EXISTS, SAI_STATUS_ITEM_NOT_FOUND and
   SAI_STATUS_TABLE_FULL errors for nexthops, nexthop groups and neighbors

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
  • Loading branch information
prabhataravind authored May 3, 2023
1 parent bc4062b commit 6cbf7a0
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions orchagent/saihelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,27 @@ task_process_status handleSaiCreateStatus(sai_api_t api, sai_status_t status, vo
/* With VNET routes, the same route can be learned via multiple
sources, like via BGP. Handle this gracefully */
return task_success;
case SAI_STATUS_TABLE_FULL:
return task_need_retry;
default:
SWSS_LOG_ERROR("Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s",
sai_serialize_api(api).c_str(), sai_serialize_status(status).c_str());
handleSaiFailure(true);
break;
}
break;
case SAI_API_NEIGHBOR:
case SAI_API_NEXT_HOP:
case SAI_API_NEXT_HOP_GROUP:
switch(status)
{
case SAI_STATUS_SUCCESS:
SWSS_LOG_WARN("SAI_STATUS_SUCCESS is not expected in handleSaiCreateStatus");
return task_success;
case SAI_STATUS_ITEM_ALREADY_EXISTS:
return task_success;
case SAI_STATUS_TABLE_FULL:
return task_need_retry;
default:
SWSS_LOG_ERROR("Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s",
sai_serialize_api(api).c_str(), sai_serialize_status(status).c_str());
Expand Down Expand Up @@ -630,8 +651,8 @@ task_process_status handleSaiRemoveStatus(sai_api_t api, sai_status_t status, vo
* in each orch.
* 3. Take the type of sai api into consideration.
*/
switch (api)
{
switch (api)
{
case SAI_API_ROUTE:
switch (status)
{
Expand All @@ -650,6 +671,23 @@ switch (api)
break;
}
break;
case SAI_API_NEIGHBOR:
case SAI_API_NEXT_HOP:
case SAI_API_NEXT_HOP_GROUP:
switch (status)
{
case SAI_STATUS_SUCCESS:
SWSS_LOG_WARN("SAI_STATUS_SUCCESS is not expected in handleSaiRemoveStatus");
return task_success;
case SAI_STATUS_ITEM_NOT_FOUND:
return task_success;
default:
SWSS_LOG_ERROR("Encountered failure in remove operation, exiting orchagent, SAI API: %s, status: %s",
sai_serialize_api(api).c_str(), sai_serialize_status(status).c_str());
handleSaiFailure(true);
break;
}
break;
default:
switch (status)
{
Expand Down

0 comments on commit 6cbf7a0

Please sign in to comment.