sai_status_t handle_neighbor( _In_ const std::string &str_object_id, _In_ sai_common_api_t api, _In_ uint32_t attr_count, _In_ sai_attribute_t *attr_list) { SWSS_LOG_ENTER(); sai_neighbor_entry_t neighbor_entry; sai_deserialize_neighbor_entry(str_object_id, neighbor_entry); neighbor_entry.switch_id = translate_local_to_redis(neighbor_entry.switch_id); neighbor_entry.rif_id = translate_local_to_redis(neighbor_entry.rif_id); switch(api) { case SAI_COMMON_API_CREATE: return sai_metadata_sai_neighbor_api->create_neighbor_entry(&neighbor_entry, attr_count, attr_list); case SAI_COMMON_API_REMOVE: return sai_metadata_sai_neighbor_api->remove_neighbor_entry(&neighbor_entry); case SAI_COMMON_API_SET: return sai_metadata_sai_neighbor_api->set_neighbor_entry_attribute(&neighbor_entry, attr_list); case SAI_COMMON_API_GET: return sai_metadata_sai_neighbor_api->get_neighbor_entry_attribute(&neighbor_entry, attr_count, attr_list); default: SWSS_LOG_THROW("neighbor other apis not implemented"); } }
sai_status_t handle_neighbor( _In_ std::string &str_object_id, _In_ sai_common_api_t api, _In_ uint32_t attr_count, _In_ sai_attribute_t *attr_list) { SWSS_LOG_ENTER(); int index = 0; sai_neighbor_entry_t neighbor_entry; sai_deserialize_neighbor_entry(str_object_id, index, neighbor_entry); neighbor_entry.rif_id = translate_vid_to_rid(neighbor_entry.rif_id); switch(api) { case SAI_COMMON_API_CREATE: return sai_neighbor_api->create_neighbor_entry(&neighbor_entry, attr_count, attr_list); case SAI_COMMON_API_REMOVE: return sai_neighbor_api->remove_neighbor_entry(&neighbor_entry); case SAI_COMMON_API_SET: return sai_neighbor_api->set_neighbor_attribute(&neighbor_entry, attr_list); case SAI_COMMON_API_GET: return sai_neighbor_api->get_neighbor_attribute(&neighbor_entry, attr_count, attr_list); default: SWSS_LOG_ERROR("neighbor other apis not implemented"); exit(EXIT_FAILURE); } }