Skip to content

How to Use SAI Player

Longxiang Lyu edited this page Sep 23, 2025 · 9 revisions

Sonic is equipped with saiplayer tool. When orchestration agent starts, it starts recording each SAI operation to a recording file in format sairedis.YYYY-MM-DD.HH:MM:SS.MS.rec. This file contains each SAI ASIC operation (one per line) as well as SAI notifications and sairedis control messages (like init view and apply view).

This tool can be used to "replay" recording on ASCI without orchestration agent. There is no need for waiting for "event" to happen, each operation is already recorded and it will be replayed with maximum possible speed. This can be very helpful when reproducing bugs. One team can find a bug, and then send recording to vendor for investigation.

This tool assumes that object IDs between ASIC reinitialize are stable and don't change. Also it must also be used on the same ASIC with the same SAI version. Cross ASIC replaying is not supported.

Here is possible scenario:

  1. bug is spotted, ASIC is not configured as expected
  2. Remove comment lines from the recording file such as the ones which begin with |#|
  3. copy recording file sairedis.2017-04-27.02:47:15.674566.rec from swss docker to syncd docker
    docker cp swss:/sairedis.2017-04-27.02:47:15.674566.rec .
    docker cp ./sairedis.2017-04-27.02:47:15.674566.rec syncd:/
    
  4. stop orchagent
    docker exec swss supervisorctl stop supervisor-proc-exit-listener
    docker exec swss supervisorctl stop orchagent
    
  5. clean the Redis DB and restart syncd
    docker exec -it syncd bash
    supervisorctl stop supervisor-proc-exit-listener
    supervisorctl stop syncd
    pkill syncd
    redis-cli flushall
    /usr/bin/syncd
    
  6. replay recording in syncd docker
    docker exec -it syncd saiplayer sairedis.2017-04-27.02:47:15.674566.rec
    
  7. confirm that ASIC is in bad state as found in the first place
  8. describe what the problem is and send recoding file to vendor for investigation
Clone this wiki locally