@@ -856,205 +856,6 @@ Executor *Orch::getExecutor(string executorName)
856
856
return NULL ;
857
857
}
858
858
859
- task_process_status Orch::handleSaiCreateStatus (sai_api_t api, sai_status_t status, void *context)
860
- {
861
- /*
862
- * This function aims to provide coarse handling of failures in sairedis create
863
- * operation (i.e., notify users by throwing excepions when failures happen).
864
- * Return value: task_success - Handled the status successfully. No need to retry this SAI operation.
865
- * task_need_retry - Cannot handle the status. Need to retry the SAI operation.
866
- * task_failed - Failed to handle the status but another attempt is unlikely to resolve the failure.
867
- * TODO: 1. Add general handling logic for specific statuses (e.g., SAI_STATUS_ITEM_ALREADY_EXISTS)
868
- * 2. Develop fine-grain failure handling mechanisms and replace this coarse handling
869
- * in each orch.
870
- * 3. Take the type of sai api into consideration.
871
- */
872
- switch (api)
873
- {
874
- case SAI_API_FDB:
875
- switch (status)
876
- {
877
- case SAI_STATUS_SUCCESS:
878
- SWSS_LOG_WARN (" SAI_STATUS_SUCCESS is not expected in handleSaiCreateStatus" );
879
- return task_success;
880
- case SAI_STATUS_ITEM_ALREADY_EXISTS:
881
- /*
882
- * In FDB creation, there are scenarios where the hardware learns an FDB entry before orchagent.
883
- * In such cases, the FDB SAI creation would report the status of SAI_STATUS_ITEM_ALREADY_EXISTS,
884
- * and orchagent should ignore the error and treat it as entry was explicitly created.
885
- */
886
- return task_success;
887
- default :
888
- SWSS_LOG_ERROR (" Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s" ,
889
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
890
- abort ();
891
- }
892
- break ;
893
- case SAI_API_HOSTIF:
894
- switch (status)
895
- {
896
- case SAI_STATUS_SUCCESS:
897
- return task_success;
898
- case SAI_STATUS_FAILURE:
899
- /*
900
- * Host interface maybe failed due to lane not available.
901
- * In some scenarios, like SONiC virtual machine, the invalid lane may be not enabled by VM configuration,
902
- * So just ignore the failure and report an error log.
903
- */
904
- return task_ignore;
905
- default :
906
- SWSS_LOG_ERROR (" Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s" ,
907
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
908
- abort ();
909
- }
910
- default :
911
- switch (status)
912
- {
913
- case SAI_STATUS_SUCCESS:
914
- SWSS_LOG_WARN (" SAI_STATUS_SUCCESS is not expected in handleSaiCreateStatus" );
915
- return task_success;
916
- default :
917
- SWSS_LOG_ERROR (" Encountered failure in create operation, exiting orchagent, SAI API: %s, status: %s" ,
918
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
919
- abort ();
920
- }
921
- }
922
- return task_need_retry;
923
- }
924
-
925
- task_process_status Orch::handleSaiSetStatus (sai_api_t api, sai_status_t status, void *context)
926
- {
927
- /*
928
- * This function aims to provide coarse handling of failures in sairedis set
929
- * operation (i.e., notify users by throwing excepions when failures happen).
930
- * Return value: task_success - Handled the status successfully. No need to retry this SAI operation.
931
- * task_need_retry - Cannot handle the status. Need to retry the SAI operation.
932
- * task_failed - Failed to handle the status but another attempt is unlikely to resolve the failure.
933
- * TODO: 1. Add general handling logic for specific statuses
934
- * 2. Develop fine-grain failure handling mechanisms and replace this coarse handling
935
- * in each orch.
936
- * 3. Take the type of sai api into consideration.
937
- */
938
- if (status == SAI_STATUS_SUCCESS)
939
- {
940
- SWSS_LOG_WARN (" SAI_STATUS_SUCCESS is not expected in handleSaiSetStatus" );
941
- return task_success;
942
- }
943
-
944
- switch (api)
945
- {
946
- case SAI_API_PORT:
947
- switch (status)
948
- {
949
- case SAI_STATUS_INVALID_ATTR_VALUE_0:
950
- /*
951
- * If user gives an invalid attribute value, no need to retry or exit orchagent, just fail the current task
952
- * and let user correct the configuration.
953
- */
954
- SWSS_LOG_ERROR (" Encountered SAI_STATUS_INVALID_ATTR_VALUE_0 in set operation, task failed, SAI API: %s, status: %s" ,
955
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
956
- return task_failed;
957
- default :
958
- SWSS_LOG_ERROR (" Encountered failure in set operation, exiting orchagent, SAI API: %s, status: %s" ,
959
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
960
- abort ();
961
- }
962
- case SAI_API_TUNNEL:
963
- switch (status)
964
- {
965
- case SAI_STATUS_ATTR_NOT_SUPPORTED_0:
966
- SWSS_LOG_ERROR (" Encountered SAI_STATUS_ATTR_NOT_SUPPORTED_0 in set operation, task failed, SAI API: %s, status: %s" ,
967
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
968
- return task_failed;
969
- default :
970
- SWSS_LOG_ERROR (" Encountered failure in set operation, exiting orchagent, SAI API: %s, status: %s" ,
971
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
972
- abort ();
973
- }
974
- default :
975
- SWSS_LOG_ERROR (" Encountered failure in set operation, exiting orchagent, SAI API: %s, status: %s" ,
976
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
977
- abort ();
978
- }
979
-
980
- return task_need_retry;
981
- }
982
-
983
- task_process_status Orch::handleSaiRemoveStatus (sai_api_t api, sai_status_t status, void *context)
984
- {
985
- /*
986
- * This function aims to provide coarse handling of failures in sairedis remove
987
- * operation (i.e., notify users by throwing excepions when failures happen).
988
- * Return value: task_success - Handled the status successfully. No need to retry this SAI operation.
989
- * task_need_retry - Cannot handle the status. Need to retry the SAI operation.
990
- * task_failed - Failed to handle the status but another attempt is unlikely to resolve the failure.
991
- * TODO: 1. Add general handling logic for specific statuses (e.g., SAI_STATUS_OBJECT_IN_USE,
992
- * SAI_STATUS_ITEM_NOT_FOUND)
993
- * 2. Develop fine-grain failure handling mechanisms and replace this coarse handling
994
- * in each orch.
995
- * 3. Take the type of sai api into consideration.
996
- */
997
- switch (status)
998
- {
999
- case SAI_STATUS_SUCCESS:
1000
- SWSS_LOG_WARN (" SAI_STATUS_SUCCESS is not expected in handleSaiRemoveStatus" );
1001
- return task_success;
1002
- default :
1003
- SWSS_LOG_ERROR (" Encountered failure in remove operation, exiting orchagent, SAI API: %s, status: %s" ,
1004
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
1005
- abort ();
1006
- }
1007
- return task_need_retry;
1008
- }
1009
-
1010
- task_process_status Orch::handleSaiGetStatus (sai_api_t api, sai_status_t status, void *context)
1011
- {
1012
- /*
1013
- * This function aims to provide coarse handling of failures in sairedis get
1014
- * operation (i.e., notify users by throwing excepions when failures happen).
1015
- * Return value: task_success - Handled the status successfully. No need to retry this SAI operation.
1016
- * task_need_retry - Cannot handle the status. Need to retry the SAI operation.
1017
- * task_failed - Failed to handle the status but another attempt is unlikely to resolve the failure.
1018
- * TODO: 1. Add general handling logic for specific statuses
1019
- * 2. Develop fine-grain failure handling mechanisms and replace this coarse handling
1020
- * in each orch.
1021
- * 3. Take the type of sai api into consideration.
1022
- */
1023
- switch (status)
1024
- {
1025
- case SAI_STATUS_SUCCESS:
1026
- SWSS_LOG_WARN (" SAI_STATUS_SUCCESS is not expected in handleSaiGetStatus" );
1027
- return task_success;
1028
- case SAI_STATUS_NOT_IMPLEMENTED:
1029
- SWSS_LOG_ERROR (" Encountered failure in get operation due to the function is not implemented, exiting orchagent, SAI API: %s" ,
1030
- sai_serialize_api (api).c_str ());
1031
- throw std::logic_error (" SAI get function not implemented" );
1032
- default :
1033
- SWSS_LOG_ERROR (" Encountered failure in get operation, SAI API: %s, status: %s" ,
1034
- sai_serialize_api (api).c_str (), sai_serialize_status (status).c_str ());
1035
- }
1036
- return task_failed;
1037
- }
1038
-
1039
- bool Orch::parseHandleSaiStatusFailure (task_process_status status)
1040
- {
1041
- /*
1042
- * This function parses task process status from SAI failure handling function to whether a retry is needed.
1043
- * Return value: true - no retry is needed.
1044
- * false - retry is needed.
1045
- */
1046
- switch (status)
1047
- {
1048
- case task_need_retry:
1049
- return false ;
1050
- case task_failed:
1051
- return true ;
1052
- default :
1053
- SWSS_LOG_WARN (" task_process_status %d is not expected in parseHandleSaiStatusFailure" , status);
1054
- }
1055
- return true ;
1056
- }
1057
-
1058
859
void Orch2::doTask (Consumer &consumer)
1059
860
{
1060
861
SWSS_LOG_ENTER ();
0 commit comments