Skip to content

How to Use SAI Player

lguohan edited this page Jul 30, 2019 · 7 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 all sonic processes and clean the redis DB for fresh start
    docker exec -it swss killall orchagent
    redis-cli flushall
    docker exec -it syncd killall syncd
    docker exec -id syncd service syncd start
    
  5. replay recording in syncd docker
    docker exec -it syncd saiplayer sairedis.2017-04-27.02:47:15.674566.rec
    
  6. confirm that ASIC is in bad state as found in the first place
  7. describe what the problem is and send recoding file to vendor for investigation
Clone this wiki locally